public Invoker SetTicks(ulong value) { InvokerType oldType = Type; Type = InvokerType.Ticks; Value = value; UpdateValues(Type != oldType); return(this); }
public Invoker SetFrames(ulong value) { InvokerType oldType = Type; Type = InvokerType.Frames; Value = value; UpdateValues(oldType != Type); return(this); }
public Invoker SetTime(TimeSpan value) { InvokerType oldType = Type; Type = InvokerType.Delay; Value = (ulong)value.Ticks; UpdateValues(oldType != Type); return(this); }
public Invoker SetTicks(ulong value, ulong repeatedValue) { InvokerType oldType = Type; Type = InvokerType.Ticks; Value = value; RepeatedValue = repeatedValue; IsRepeated = true; UpdateValues(oldType != Type); return(this); }
public Invoker SetTime(TimeSpan value, TimeSpan repeatedValue) { InvokerType oldType = Type; Type = InvokerType.Delay; Value = (ulong)value.Ticks; RepeatedValue = (ulong)repeatedValue.Ticks; IsRepeated = true; UpdateValues(oldType != Type); return(this); }
public UnrealBinaryHeapEx <Invoker> GetCollection(InvokerType type) { switch (type) { case InvokerType.Delay: return(delayInvokers); case InvokerType.Ticks: return(ticksInvokers); case InvokerType.Frames: return(framesInvokers); } return(null); }
public MethodInvoker GetInvoker(string name, int argsCount, InvokerType type) { if (name == null) { throw new ArgumentNullException(nameof(name)); } var key = CacheKey(type, name, argsCount); if (InvokerCache.TryGetValue(key, out MethodInvoker invoker)) { return(invoker); } var method = GetFilterMethod(key); if (method == null) { return(null); } return(InvokerCache[key] = TypeExtensions.GetInvokerToCache(method)); }
private string CacheKey(InvokerType type, string methodName, int argsCount) => type + "::" + methodName.ToLower() + "`" + argsCount;
private static Invoker StartInvoker(object obj, InvokerHandlerType handlerType, Delegate handler, InvokerType type, ulong value, ulong repeatValue, CoroutineGroup group = CoroutineGroup.Tick, bool pool = PoolByDefault) { Invoker invoker = pool ? InvokerPool.GetObject() : new Invoker(); invoker.SetHandler(handlerType, handler); switch (type) { case InvokerType.Delay: TimeSpan time = TimeSpan.FromTicks((long)value); TimeSpan repeatTime = TimeSpan.FromTicks((long)repeatValue); if (repeatTime != default(TimeSpan)) { invoker.SetTime(time, repeatTime); } else { invoker.SetTime(time); } break; case InvokerType.Ticks: if (repeatValue != default(ulong)) { invoker.SetTicks(value, repeatValue); } else { invoker.SetTicks(value); } break; case InvokerType.Frames: if (repeatValue != default(ulong)) { invoker.SetFrames(value, repeatValue); } else { invoker.SetFrames(value); } break; } invoker.SetGroup(group); invoker.Start(); return(invoker); }
public MethodInvoker GetInvoker(string name, int argsCount, InvokerType type) => type == InvokerType.Filter ? GetInvoker(name, argsCount) : type == InvokerType.ContextFilter ? GetContextFilterInvoker(name, argsCount) : GetContextBlockInvoker(name, argsCount);
public virtual IInvoker Build(InvokerType type) { return(invokers[type]); }
private string CacheKey(InvokerType type, string methodName, int argsCount) => $"{type}::{methodName.ToLower()}`{argsCount}";
private static Invoker StartInvoker(object obj, InvokerHandlerType handlerType, Delegate handler, InvokerType type, ulong value, ulong repeatValue, CoroutineGroup group = CoroutineGroup.Tick, bool pool = PoolByDefault) { IntPtr world = IntPtr.Zero; UObject ownerObj = obj as UObject; if (ownerObj != null) { world = Native_UObject.GetWorld(ownerObj.Address); Debug.Assert(world != IntPtr.Zero, "UObject invokers must be objects with a UWorld reference (e.g. AActor) - " + "this is so that the invoker can be stopped when the world is destroyed."); } Invoker invoker = pool ? InvokerPool.GetObject() : new Invoker(); invoker.OwnerWorld = world; invoker.Owner = obj; invoker.SetHandler(handlerType, handler); switch (type) { case InvokerType.Delay: TimeSpan time = TimeSpan.FromTicks((long)value); TimeSpan repeatTime = TimeSpan.FromTicks((long)repeatValue); if (repeatTime != default(TimeSpan)) { invoker.SetTime(time, repeatTime); } else { invoker.SetTime(time); } break; case InvokerType.Ticks: if (repeatValue != default(ulong)) { invoker.SetTicks(value, repeatValue); } else { invoker.SetTicks(value); } break; case InvokerType.Frames: if (repeatValue != default(ulong)) { invoker.SetFrames(value, repeatValue); } else { invoker.SetFrames(value); } break; } invoker.SetGroup(group); invoker.Start(); return(invoker); }