internal void Notify(string key, object data) { for (int i = 0; i < tasks.Count; i++) { IAiTask task = tasks[i]; if (task.Notify(key, data)) { int slot = tasks[i].Slot; if ((activeTasksBySlot[slot] == null || task.Priority > activeTasksBySlot[slot].PriorityForCancel)) { if (activeTasksBySlot[slot] != null) { activeTasksBySlot[slot].FinishExecute(true); } activeTasksBySlot[slot] = task; task.StartExecute(); Console.WriteLine("start " + task.ProfilerName); OnTaskStarted?.Invoke(task); } } } }
internal void Notify(string key, object data) { for (int i = 0; i < Tasks.Count; i++) { IAiTask task = Tasks[i]; if (task.Notify(key, data)) { int slot = Tasks[i].Slot; if ((ActiveTasksBySlot[slot] == null || task.Priority > ActiveTasksBySlot[slot].PriorityForCancel)) { if (ActiveTasksBySlot[slot] != null) { ActiveTasksBySlot[slot].FinishExecute(true); } ActiveTasksBySlot[slot] = task; task.StartExecute(); } } } }