void TrU() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Profiler.BeginSample("Event ---"); EventManager.UnityEvent.Trigger(EventType, EventName, gameObject, gameObject); Profiler.EndSample(); stopwatch.Stop(); IcLog.Error(stopwatch.Elapsed); }
protected void Loaded(Object asset, string assetPath) { #if ICDEBUG if (asset == null) { IcLog.LogError("Load " + assetPath + " failed."); } #endif //m_eInitProcess = eInitProcess.loaded_fail; m_loadedAsset = asset; //m_eInitProcess = eInitProcess.loaded_success; RunCallBack(); }
public static void Trigger <TArgs>(EventTarget target, TArgs args) { HashSet <Action <TArgs> > handlers = null; if (events.TryGetValue(target, out var potentialHandlers)) { foreach (var potentialHandler in potentialHandlers) { if (potentialHandler is Action <TArgs> handler) { if (handlers == null) { handlers = HashSetPool <Action <TArgs> > .New(); } handlers.Add(handler); } } } if (handlers == null || handlers.Count == 0) { if (OpenWarning) { if (target.target == null) { IcLog.Warning($"Global Event: {target.name} No Any Handle."); } else { IcLog.Warning($"{target.name}---:---{target.target} No Any Handle."); } return; } } if (handlers != null) { foreach (var handler in handlers) { handler.Invoke(args); } handlers.Free(); } }