static public void DefaultConstructorTest() { var voidable = new Voidable <object>(); voidable.Value.Should().BeNull(); voidable.HasValue.Should().BeFalse(); }
static public void ImplicitOperatorWithNullTest() { Voidable <object> voidable = null; voidable.Value.Should().BeNull(); voidable.HasValue.Should().BeTrue(); }
static public void StaticVoidTest() { Voidable <object> voidable = Voidable <object> .Void; voidable.Value.Should().BeNull(); voidable.HasValue.Should().BeFalse(); }
static public void ConstructorWithNullTest() { var voidable = new Voidable <object>(null); voidable.Value.Should().BeNull(); voidable.HasValue.Should().BeTrue(); }
static public void ImplicitOperatorWithValueTest() { var value = new object(); Voidable <object> voidable = value; voidable.Value.Should().Be(value); voidable.HasValue.Should().BeTrue(); }
static public void ConstructorWithValueTest() { var value = new object(); var voidable = new Voidable <object>(value); voidable.Value.Should().Be(value); voidable.HasValue.Should().BeTrue(); }
public static void DebugWatcherField <T>(string key, object obj, System.Type objType, Rect rect) { var debug = _events.TryGetValue(key, out var evnt); var newDebug = K10.EditorGUIExtention.IconButton.Toggle.Draw(rect, debug, "DebugOn", "DebugOff"); if (newDebug != debug) { if (newDebug) { var debugEvnt = new Voidable <T>((value) => Debug.Log($"{value} new value on {key}")); _events.Add(key, debugEvnt); var onChangeProp = objType.GetProperty(BoolState.ON_CHANGE_PROP_NAME); var onChangePropValue = onChangeProp.GetValue(obj) as IEventRegister <T>; onChangePropValue.Register(debugEvnt); } else { evnt.Void(); _events.Remove(key); } } }
public static void DebugWatcherField <T>(this SerializedProperty property, Rect debugRect) { var key = property.GetKey(); var debug = _events.TryGetValue(key, out var evnt); var newDebug = IconButton.Toggle.Draw(debugRect, debug, "DebugOn", "DebugOff"); if (newDebug != debug) { if (newDebug) { var debugEvnt = new Voidable <T>((value) => Debug.Log($"{value} new value on {key}")); _events.Add(key, debugEvnt); var obj = property.GetInstance(out var objType); var onChangeProp = objType.GetProperty(BoolState.ON_CHANGE_PROP_NAME); var onChangePropValue = onChangeProp.GetValue(obj) as IEventRegister <T>; onChangePropValue.Register(debugEvnt); } else { evnt.Void(); _events.Remove(key); } } }