First try at updating command system to be like TC. Still needs alot of testing/work

This commit is contained in:
hondacrx
2022-01-20 09:57:15 -05:00
parent 260b792fd8
commit 883a3bb990
37 changed files with 147 additions and 106 deletions
+16 -10
View File
@@ -17,25 +17,26 @@
namespace Framework.Dynamic
{
public struct Optional<T> where T : new()
public struct Optional<T>
{
private bool _hasValue;
public T Value;
public Optional(T value)
{
Value = value;
_hasValue = true;
}
public bool HasValue
{
get { return _hasValue; }
set
{
_hasValue = value;
Value = _hasValue ? new T() : default;
}
}
public void Set(T v)
public void Set(T value)
{
Value = value;
_hasValue = true;
Value = v;
}
public void Clear()
@@ -49,9 +50,14 @@ namespace Framework.Dynamic
return HasValue ? Value : otherValue;
}
public static explicit operator T(Optional<T> value)
public static explicit operator T(Optional<T> optional)
{
return (T)value;
return optional.Value;
}
public static implicit operator Optional<T>(T value)
{
return new Optional<T>(value);
}
}
}
+1 -1
View File
@@ -561,7 +561,7 @@ namespace Framework.Dynamic
/// <returns></returns>
TaskContext ClearGroup()
{
_task._group.HasValue = false;
_task._group.Clear();
return this;
}