/// <summary> /// 更新指定技能ID的信息,技能列表中,技能索引减1即列表索引; /// </summary> /// <param name="skillId">Skill identifier.</param> void UpdateSkillInfo(int skillId) { if (!MySkillModule.IsLegalSkillID(skillId)) { return; } // if(skillId > skillsList.Count || skillId < 1) // return; SkillItemUI item = skillsList[skillId - 1] as SkillItemUI; if (item == null) { return; } int skillLv = MySkillModule.GetSkillLvBySkillID(skillId); bool canOpen = MySkillModule.canOpen(skillId); if (skillLv == 0 && !canOpen)//锁定状态; { item.SLockType = SkillLockType.Locked; item.IsShowEquiSlotNum = false; item.IsShowLv = false; int openLv = MySkillModule.GetSkillUnlockLvByID(skillId); item.SetShowHint(openLv.ToString() + "级解锁"); return; } else if (skillLv == 0 && canOpen)//可解锁状态; { item.SLockType = SkillLockType.Opened; item.IsShowEquiSlotNum = false; item.IsShowLv = false; item.SetShowHint("可解锁"); return; } else { item.SLockType = SkillLockType.UnLocked; item.SetShowLevel(skillLv); item.IsShowHint = false; int slotIdx = -1; if (MySkillModule.GetSlotIdxBySkillID(skillId, ref slotIdx)) { item.IsShowEquiSlotNum = true; item.SetShowEquipNum(slotIdx + 1); } else { item.IsShowEquiSlotNum = false; } } }
/// <summary> /// 刷新技能升级消耗显示、按钮内容显示 /// </summary> void UpdateUpgradeAndCost() { int lv = MySkillModule.GetSkillLvBySkillID(CurSkillId); //非法数据; if (lv < 0) { return; } //锁定状态; if (lv == 0 && !MySkillModule.canOpen(CurSkillId)) { int unlockLv = MySkillModule.GetSkillUnlockLvByID(CurSkillId); if (unlockLv < 1) { return; } // costLb.gameObject.SetActive(false); fullLvSp.gameObject.SetActive(false); costLb.transform.parent.gameObject.SetActive(false); upgradeBtn.gameObject.SetActive(false); equipRoot.SetActive(false); unlockBtn.gameObject.SetActive(true); // unlockBtn.isEnabled = false; openSp.gameObject.SetActive(true); openLvLb.gameObject.SetActive(true); openLvLb.text = StringHelper.StringWithColor(FontColor.Red, "LV" + unlockLv.ToString()) + "才可以解锁此技能!"; return; } //可解锁状态; else if (0 == lv && MySkillModule.canOpen(CurSkillId)) { // costLb.gameObject.SetActive(false); fullLvSp.gameObject.SetActive(false); costLb.transform.parent.gameObject.SetActive(false); upgradeBtn.gameObject.SetActive(false); equipRoot.SetActive(false); unlockBtn.gameObject.SetActive(true); // unlockBtn.isEnabled = true; openSp.gameObject.SetActive(true); openLvLb.gameObject.SetActive(true); openLvLb.text = "可以解锁此技能!"; } //有等级状态; else { equipRoot.SetActive(true); openSp.gameObject.SetActive(false); openLvLb.gameObject.SetActive(false); unlockBtn.gameObject.SetActive(false); //满级了; if (MySkillModule.IsFullLv(CurSkillId)) { // costLb.gameObject.SetActive(false); costLb.transform.parent.gameObject.SetActive(false); upgradeBtn.gameObject.SetActive(false); fullLvSp.gameObject.SetActive(true); } else { fullLvSp.gameObject.SetActive(false); // costLb.gameObject.SetActive(true); costLb.transform.parent.gameObject.SetActive(true); upgradeBtn.gameObject.SetActive(true); SkillLevelTableItem slti = MySkillModule.GetDetailByCurLvSkillID(CurSkillId); if (slti == null) { return; } UIAtlasHelper.SetSpriteByMoneyType(costTypeSp, (ProceedsType)slti.money_type, false); //if (slti.money_type == 0) //{ // //costTypeSp.spriteName = "jinbi"; //} //else if (slti.money_type == 1) // costTypeSp.spriteName = "zuanshi"; // costTypeSp.MakePixelPerfect(); PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { GameDebug.LogError(@"PlayerData没了"); } uint curMoney = pdm.GetProceeds((ProceedsType)slti.money_type); FontColor color = curMoney < slti.money_num ? FontColor.Red : FontColor.Green; costLb.text = StringHelper.StringWithColor(color, slti.money_num.ToString()); } } }