private void PoolView_DoubleClick(object sender, EventArgs e) { InvokePool invoker = InvokePool.Undefined; if (sender == actionPoolView) { invoker = InvokePool.Action; } else if (sender == finderPoolView) { invoker = InvokePool.Finder; } if (invoker == InvokePool.Undefined) { throw new InvalidOperationException(); } object tag = ((TreeView)sender).SelectedNode?.Tag; if (tag == null) { return; } if ((invoker == InvokePool.Action && tag is PatchAction) || (invoker == InvokePool.Finder && tag is TargetFinder)) { if (invoker == InvokePool.Action) { SetAction((PatchAction)tag, true); } else if (invoker == InvokePool.Finder) { AddFinder((TargetFinder)tag, true); } return; } Type patchActionType = tag as Type; if (patchActionType != null) { var entryType = editorFactory.GetEntryTypeByEditorType(patchActionType); var finder = dataStruct.EntryFactory.CreateEntryByType(entryType); if (invoker == InvokePool.Action) { SetAction((PatchAction)finder, true); } else if (invoker == InvokePool.Finder) { AddNewFinder((TargetFinder)finder); } return; } }
public static void Invoke(Action callback, float delay, float interval = 0, int count = 0) { if (m_instance.m_freeList.Count == 0) { InvokePool invokePool = new InvokePool(); m_instance.m_freeList.Add(invokePool); } m_instance.m_freeList[0].Create(callback, delay, interval, count); m_instance.m_usingList.Add(m_instance.m_freeList[0]); m_instance.m_freeList.RemoveAt(0); }