public void MainMenuBar_ActionUpdate(GAME_EVENT_ID eventId, List <string> vParam) { if (eventId == GAME_EVENT_ID.GE_CHANGE_BAR) { string arg0 = vParam[0]; if (arg0 == "main") { int nIndex = int.Parse(vParam[1]); if (nIndex <= 0 || nIndex > 10) { return; } int actionId = int.Parse(vParam[2]); buttons[nIndex - 1].SetActionItemByActionId(actionId); } } else if (eventId == GAME_EVENT_ID.GE_UNIT_EXP) { ShowExperience(); } else if (eventId == GAME_EVENT_ID.GE_UNIT_MAX_EXP) { ShowExperience(); } else if (eventId == GAME_EVENT_ID.GE_NEW_SKILL) { int skillID = int.Parse(vParam[0]); CActionItem_Skill actionSkill = CActionSystem.Instance.GetAction_SkillID(skillID); if (actionSkill == null) { return; } for (int i = 0; i < 10; i++) { int actionID = CActionSystem.Instance.MainMenuBar_Get(i); if (actionID == MacroDefine.INVALID_ID) { CActionSystem.Instance.MainMenuBar_Set(i, actionSkill.GetID()); return; } } } }
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); } }