void UpdateSkill() { if (!gameObject.active) { return; } ResetUI(); if (tabMode == TAB_MODE.TAB_SKILL) { int num = CActionSystem.Instance.GetSkillActionNum(); int showIndex = 0; for (int i = 0; i < num; i++) { if (showIndex >= buttons.Count) { break; } CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; if (skill != null && skill.GetXinfaID() >= SCLIENT_SKILLCLASS.XINFATYPE_SKILLBENGIN) { //LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + " skill = " + skill.GetDefineID()); //这里可能有问题 items[showIndex].SetActiveRecursively(true); SCLIENT_SKILL skillData = skill.GetImpl() as SCLIENT_SKILL; buttons[showIndex].UpdateItemFromAction(skill); if (skillData != null && skillData.IsCanUse_CheckLevel(CObjectManager.Instance.getPlayerMySelf().ID, (int)skillData.m_nLevel) == OPERATE_RESULT.OR_OK) { buttons[showIndex].EnableDrag(); txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); } else { buttons[showIndex].DisableDrag(); txtLevels[showIndex].Text = "未学习"; } buttons[showIndex].EnableDoAction = true; //update text txtNames[showIndex].Text = skill.GetName(); SCLIENT_SKILLCLASS skillClass = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_SkillClass(skill.GetXinfaID()); //升级可操作 string error; if (!CDataPool.Instance.isCanSkillLevelUp(skillClass.m_pDefine.nID, skillClass.m_nLevel + 1, out error)) { levelUpBtns[showIndex].Hide(true); //levelUpBtns[showIndex].controlIsEnabled = false; toolText[showIndex] = UIString.Instance.ParserString_Runtime(error); } else { // levelUpBtns[showIndex].controlIsEnabled = true; levelUpBtns[showIndex].Hide(false); toolText[showIndex] = null; } showIndex++; } } } else if (tabMode == TAB_MODE.TAB_JINGJIE) { int num = CActionSystem.Instance.GetSkillActionNum(); int showIndex = 0; for (int i = 0; i < num; i++) { if (showIndex >= buttons.Count) { break; } CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; //LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + " skill = " + skill.GetDefineID()); if (skill != null && (skill.GetXinfaID() >= SCLIENT_SKILLCLASS.XINFATYPE_JINGJIEBEGIN && skill.GetXinfaID() < SCLIENT_SKILLCLASS.XINFATYPE_SKILLBENGIN)) { //这里可能有问题 items[showIndex].SetActiveRecursively(true); buttons[showIndex].UpdateItemFromAction(skill); buttons[showIndex].DisableDrag(); buttons[showIndex].EnableDoAction = false; //update text txtNames[showIndex].Text = skill.GetName(); txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); SCLIENT_SKILLCLASS skillClass = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_SkillClass(skill.GetXinfaID()); //升级可操作 string error; if (!CDataPool.Instance.isCanSkillLevelUp(skillClass.m_pDefine.nID, skillClass.m_nLevel + 1, out error)) { levelUpBtns[showIndex].controlIsEnabled = false; toolText[showIndex] = UIString.Instance.ParserString_Runtime(error); } else { levelUpBtns[showIndex].controlIsEnabled = true; toolText[showIndex] = null; } showIndex++; } } } else if (tabMode == TAB_MODE.TAB_USUALSKILL) { int num = CActionSystem.Instance.GetSkillActionNum(); //LogManager.LogWarning("Skill count = " + num); int showIndex = 0; for (int i = 0; i < num; i++) { CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; if (showIndex >= buttons.Count) { break; } //超过51不属于普通技能 if (skill != null && (skill.GetXinfaID() == -1 && skill.GetIDTable() < 51)) { // LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + "skill = " + skill.GetDefineID() + "index=" + i); //这里可能有问题 items[showIndex].SetActiveRecursively(true); buttons[showIndex].UpdateItemFromAction(skill); buttons[showIndex].EnableDrag(); buttons[showIndex].EnableDoAction = true; //update text txtNames[showIndex].Text = skill.GetName(); txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); levelUpBtns[showIndex].gameObject.SetActiveRecursively(false); showIndex++; } } } }
void UpdateSkill() { if (!gameObject.active) { return; } ResetUI(); if (tabMode == TAB_MODE.TAB_SELFXINFA) { int num = CActionSystem.Instance.GetSkillActionNum(); int nXinfaIndex = -1; IUIListObject listItem = null; for (int i = 0; i < num; i++) { CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; if (skill != null && (skill.GetXinfaID() >= SCLIENT_SKILLCLASS.XINFATYPE_JINGJIEBEGIN && skill.GetXinfaID() < SCLIENT_SKILLCLASS.XINFATYPE_SKILLBENGIN)) { nXinfaIndex++; int nOffset = nXinfaIndex % 3; if (nOffset == 0) { listItem = list.CreateItem(itemPrefab); listItem.gameObject.name = "XinfaListItem" + nXinfaIndex; for (int j = 0; j < 3; j++) { listItem.gameObject.transform.FindChild("Item" + j).gameObject.SetActiveRecursively(false); } } GameObject item = listItem.gameObject.transform.FindChild("Item" + nOffset).gameObject; item.SetActiveRecursively(true); ActionButton skillAction = item.GetComponentInChildren <ActionButton>(); if (skillAction != null) { skillAction.SetActionItemByActionId(skill.GetID()); skillAction.DisableDrag(); skillAction.EnableDoAction = false; } UIButton bg = item.transform.FindChild("Bg").gameObject.GetComponent <UIButton>(); if (bg != null) { bg.SetInputDelegate(handlerInput); } SpriteText txt = item.transform.FindChild("NameLabel").gameObject.GetComponent <SpriteText>(); if (txt != null) { txt.Text = skill.GetName() + "\n" + "等级:" + skill.GetSkillLevel(); } UIButton levelBtn = item.transform.FindChild("LevelUp").gameObject.GetComponent <UIButton>(); if (levelBtn != null) { levelBtn.SetInputDelegate(levelUpInputDelegate); //LogManager.LogWarning("Set Delegate : " + levelBtn.gameObject.name); } SCLIENT_SKILLCLASS skillClass = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_SkillClass(skill.GetXinfaID()); //升级可操作 string error; if (!CDataPool.Instance.isCanSkillLevelUp(skillClass.m_pDefine.nID, skillClass.m_nLevel + 1, out error)) { item.transform.FindChild("LevelUp").gameObject.GetComponent <UIButton>().controlIsEnabled = false; //toolText[showIndex] = UIString.Instance.ParserString_Runtime(error); } else { item.transform.FindChild("LevelUp").gameObject.GetComponent <UIButton>().controlIsEnabled = true; //toolText[showIndex] = null; } } } } else if (tabMode == TAB_MODE.TAB_PETXINFA) { //int num = CActionSystem.Instance.GetSkillActionNum(); ////LogManager.LogWarning("Skill count = " + num); //int showIndex = 0; //for (int i = 0; i < num; i++) //{ // CActionItem_Skill skill = CActionSystem.Instance.EnumAction(i, ActionNameType.Skill) as CActionItem_Skill; // if (showIndex >= buttons.Count) break; // //超过51不属于普通技能 // if (skill != null && (skill.GetXinfaID() == -1 && skill.GetIDTable() < 51)) // { // // LogManager.LogWarning("Xinfa = " + skill.GetXinfaID() + "skill = " + skill.GetDefineID() + "index=" + i); // //这里可能有问题 // items[showIndex].SetActiveRecursively(true); // buttons[showIndex].UpdateItemFromAction(skill); // buttons[showIndex].EnableDrag(); // buttons[showIndex].EnableDoAction = true; // //update text // txtNames[showIndex].Text = skill.GetName(); // txtLevels[showIndex].Text = "等级:" + skill.GetSkillLevel(); // levelUpBtns[showIndex].gameObject.SetActiveRecursively(false); // showIndex++; // } //} } if (list.UnviewableArea > 0) { list.slider.Hide(false); } else { list.slider.Hide(true); } }