void SetSkillItemInfo(GameObject go, SkillDatabase db) { LeftSkillItem item = go.GetComponent <LeftSkillItem>(); if (item == null) { item = go.AddComponent <LeftSkillItem>(); } if (!m_dicLeftItem.ContainsKey(db.wdID)) { m_dicLeftItem.Add(db.wdID, item); } item.InitItem(db); #region drag code //if(go.GetComponent<LearnSkillItem>() == null) //{ // go.AddComponent<LearnSkillItem>().InitItem( db ); //} //else //{ // LearnSkillItem item = go.GetComponent<LearnSkillItem>(); // item.InitItem( db ); //} //if(go.GetComponent<SkillDragDropItem>() == null) //{ // SkillDragDropItem item = go.AddComponent<SkillDragDropItem>(); // item.cloneOnDrag = true; //} #endregion }
void skilldataManager_ValueUpdateEvent(object sender, ValueUpdateEventArgs e) { if (e != null) { if (e.key == LearnSkillDispatchEvents.SkillLevelUP.ToString()) { SkillInfo newInfo = (SkillInfo)e.newValue; SortedDictionary <uint, LeftSkillItem> .Enumerator itemIter = m_dicLeftItem.GetEnumerator(); while (itemIter.MoveNext()) { if (itemIter.Current.Key == newInfo.skillID) { LeftSkillItem skillItem = itemIter.Current.Value; SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>(newInfo.skillID, (int)newInfo.level); if (db != null) { skillItem.InitItem(db); skillItem.AddEffectInSkillPanel(); } } } //页签红点提示 UpdateRedPoint(); } } }