void Refresh(TableState state) { if (mTableState != state) { mTableState = state; if (SkillTreeInfo.SkillMainTypeInfo.ContainsKey(pageIndex)) { mSkillTypeDatas.Clear(); // int count = 0; for (int i = 0; i < SkillTreeInfo.SkillMainTypeInfo[pageIndex].Count; i++) { int main_type = SkillTreeInfo.SkillMainTypeInfo[pageIndex][i]._mainType; SkillMainType mainType = SkillTreeInfo.SkillMainTypeInfo[pageIndex].Find(itr => itr._mainType == main_type); UISkillType.SkillTypeData skillTypeData = new UISkillType.SkillTypeData(SkillTreeInfo.GetUIShowList(mainType._mainType, skillMgr), mainType); mSkillTypeDatas.Add(skillTypeData); } mSkillTypeCtrl.SetContent(SkillTreeInfo.SkillMainTypeInfo[pageIndex].Count, OnSetSkillTypeBtnContent); mSkillTypeCtrl.SetActiveBtn(0); } } UpdateSkillTypePos(); }
void RefreshTypeData(int maintype) { int index = mSkillTypeDatas.FindIndex(itr => itr.info._mainType == maintype); if (index != -1) { mSkillTypeDatas[index].data = SkillTreeInfo.GetUIShowList(maintype, skillMgr); } if (mActiveSkillType != null) { SkillMainType mainType = SkillTreeInfo.SkillMainTypeInfo[pageIndex].Find(itr => itr._mainType == mActiveSkillType.data.info._mainType); if (mainType != null) { UISkillType.SkillTypeData skillTypeData = new UISkillType.SkillTypeData(SkillTreeInfo.GetUIShowList(mainType._mainType, skillMgr), mainType); mActiveSkillType.data = skillTypeData; } } if (onRefreshTypeData != null) { onRefreshTypeData(this); } }