/// <summary> /// 刷新技能说明处显示信息; /// </summary> void UpdateDetails(bool needTypeWriterEffect) { SkillLearnTableItem learnItem = MySkillModule.GetDetailBySkillId(CurSkillId); if (learnItem == null) { return; } SkillLevelTableItem levelItem = null; int levelId = 0; int lv = MySkillModule.GetSkillLvBySkillID(CurSkillId); if (lv < 0) { return; } skillName.text = learnItem.skill_name; if (lv == 0) //锁定状态/可解锁状态; { if (!MySkillModule.canOpen(CurSkillId)) //锁定; { skillLV.text = StringHelper.StringWithColor(FontColor.Red, "未解锁"); } else { skillLV.text = "[079d6a]可解锁[-]"; } levelId = SkillModule.SkillLearnToLevel(CurSkillId, 1); levelItem = MySkillModule.GetDetailByLevelID(levelId); if (levelItem == null) { Debug.LogError("SkillLevel表格缺少ID为" + levelId.ToString() + "的数据!"); return; } detail1.text = learnItem.skill_desc + "\n" + levelItem.skill_desc.Replace("\\n", "\n"); levelId = SkillModule.SkillLearnToLevel(CurSkillId, 2); levelItem = MySkillModule.GetDetailByLevelID(levelId); if (levelItem == null) { Debug.LogError("SkillLevel表格缺少ID为" + levelId.ToString() + "的数据!"); return; } detail2.text = levelItem.skill_desc.Replace("\\n", "\n"); needLvLb.gameObject.SetActive(true); int lvUpLv = SkillModule.GetPlayerLvBySkillLevelId(levelId); if (lvUpLv > 0) { PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { GameDebug.LogError("f**k"); return; } if (pdm.GetLevel() < lvUpLv) { needLvLb.text = string.Format(StringHelper.GetString("skill_open_lv", FontColor.Red), lvUpLv); } else { needLvLb.text = string.Format(StringHelper.GetString("skill_open_lv", FontColor.Green), lvUpLv); } } else { needLvLb.text = ""; } } else { skillLV.text = "Lv. " + lv.ToString(); //levelItem = MySkillModule.GetDetailByCurLvSkillID(CurSkillId, MySkillModule.GetSkillLvBySkillID(CurSkillId) - 1); levelId = SkillModule.SkillLearnToLevel(CurSkillId, lv); levelItem = MySkillModule.GetDetailByLevelID(levelId); if (levelItem == null) { Debug.LogError("error le"); return; } detail1.text = learnItem.skill_desc + "\n" + levelItem.skill_desc.Replace("\\n", "\n"); if (MySkillModule.IsFullLv(CurSkillId)) { detail2.text = StringHelper.GetString("skill_full_lv"); needLvLb.gameObject.SetActive(false); } else { levelId = SkillModule.SkillLearnToLevel(CurSkillId, lv + 1); levelItem = MySkillModule.GetDetailByLevelID(levelId); if (levelItem == null) { Debug.LogError("SkillLevel表格缺少ID为" + levelId.ToString() + "的数据!"); return; } needLvLb.gameObject.SetActive(true); int lvUpLv = SkillModule.GetPlayerLvBySkillLevelId(levelId); if (lvUpLv > 0) { PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { GameDebug.LogError("f**k"); return; } if (pdm.GetLevel() < lvUpLv) { needLvLb.text = string.Format(StringHelper.GetString("skill_open_lv", FontColor.Red), lvUpLv); } else { needLvLb.text = string.Format(StringHelper.GetString("skill_open_lv", FontColor.Green), lvUpLv); } } else { needLvLb.text = ""; } detail2.text = levelItem.skill_desc.Replace("\\n", "\n"); } } TypewriterEffect te1 = null, te2 = null; if (UIEffectManager.IsUIEffectActive <TypewriterEffect>(detail1.gameObject, ref te1)) { if (needTypeWriterEffect) { te1.ReStart(); } else { te1.SetProcessText(); } } else { if (needTypeWriterEffect) { detail1.gameObject.AddMissingComponent <TypewriterEffect>(); } } if (UIEffectManager.IsUIEffectActive <TypewriterEffect>(detail2.gameObject, ref te2)) { if (needTypeWriterEffect) { te2.ReStart(); } else { te2.SetProcessText(); } } else { if (needTypeWriterEffect) { detail2.gameObject.AddMissingComponent <TypewriterEffect>(); } } }
/// <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()); } } }