Copy Aetheria Code
Added a bunch of code from the old Aetheria project
This commit is contained in:
parent
ab392cd3d6
commit
c58ba0b1da
1704 changed files with 175081 additions and 313 deletions
|
|
@ -0,0 +1,44 @@
|
|||
// for uGUI(from 4.6)
|
||||
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
|
||||
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UniRx
|
||||
{
|
||||
public static partial class UnityGraphicExtensions
|
||||
{
|
||||
public static IObservable<Unit> DirtyLayoutCallbackAsObservable(this Graphic graphic)
|
||||
{
|
||||
return Observable.Create<Unit>(observer =>
|
||||
{
|
||||
UnityAction registerHandler = () => observer.OnNext(Unit.Default);
|
||||
graphic.RegisterDirtyLayoutCallback(registerHandler);
|
||||
return Disposable.Create(() => graphic.UnregisterDirtyLayoutCallback(registerHandler));
|
||||
});
|
||||
}
|
||||
|
||||
public static IObservable<Unit> DirtyMaterialCallbackAsObservable(this Graphic graphic)
|
||||
{
|
||||
return Observable.Create<Unit>(observer =>
|
||||
{
|
||||
UnityAction registerHandler = () => observer.OnNext(Unit.Default);
|
||||
graphic.RegisterDirtyMaterialCallback(registerHandler);
|
||||
return Disposable.Create(() => graphic.UnregisterDirtyMaterialCallback(registerHandler));
|
||||
});
|
||||
}
|
||||
|
||||
public static IObservable<Unit> DirtyVerticesCallbackAsObservable(this Graphic graphic)
|
||||
{
|
||||
return Observable.Create<Unit>(observer =>
|
||||
{
|
||||
UnityAction registerHandler = () => observer.OnNext(Unit.Default);
|
||||
graphic.RegisterDirtyVerticesCallback(registerHandler);
|
||||
return Disposable.Create(() => graphic.UnregisterDirtyVerticesCallback(registerHandler));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue