private void AddEvent_Click(object sender, EventArgs e) { if (!mLogicTree.ContainsKey(mCurrentSpellID)) { return; } List <SpellLogic> logicList = mLogicTree[mCurrentSpellID]; SPELL_EVENT sp_event = (SPELL_EVENT)Enum.GetValues(gSpellEventEnum).GetValue(this.EventsComboBox.SelectedIndex); //foreach (SpellLogic logi in logicList) //{ // if (logi.nEventID == sp_event) // { // Trace.Warring("已经存在事件:" + sp_event.ToString() + ",请勿重复添加!"); // return; // } //} SpellLogic logic = new SpellLogic(); logic.nEventID = sp_event; logicList.Add(logic); ShowSpellEvens(mCurrentSpellID); }
public bool Push(Impact pImpact, SPELL_EVENT_ID nID) { if ((pImpact == null) || (nID >= SPELL_EVENT_ID.SPELL_EVENT_ID_NUMBER) || (nID <= SPELL_EVENT_ID.SPELL_EVENT_ID_INVALID)) { LogManager.LogAssert(null); } if (m_FreeCache.Count > 0) { SPELL_EVENT pRet = m_FreeCache[0]; m_FreeCache.RemoveAt(0); pRet.m_pImpact = pImpact; pRet.m_nEventID = nID; m_UseList[nID].Add(pRet); } else { if (!m_UseList.ContainsKey(nID)) { m_UseList.Add(nID, new List <SPELL_EVENT>()); } SPELL_EVENT pEvent = new SPELL_EVENT(); pEvent.m_pImpact = pImpact; pEvent.m_nEventID = nID; m_UseList[nID].Add(pEvent); } return(true); }
public bool Recycle(SPELL_EVENT pCache) { if (pCache == null) { return(false); } pCache.CleanUp(); m_FreeCache.Insert(0, pCache); return(true); }
public void CleanUp() { for (int index = 0; index < (int)SPELL_EVENT_ID.SPELL_EVENT_ID_NUMBER; ++index) { SPELL_EVENT_ID i = (SPELL_EVENT_ID)index; while (m_UseList[i].Count > 0) { List <SPELL_EVENT> it = new List <SPELL_EVENT>(); it = m_UseList[i]; SPELL_EVENT p = new SPELL_EVENT(); p = it[0]; m_UseList[i].RemoveAt(0); Recycle(p); } } }