public static void InitHeroTalentLevelInfo(HeroTalentLevelInfo info, uint skill1, uint skill2, uint skill3, RESDT_TALENT_DETAIL talentDetail) { info.m_tarlentLibList = new ListView <ResTalentLib>(); info.m_levelDetail = talentDetail; if (skill1 != 0) { info.m_tarlentLibList.Add(GameDataMgr.talentLib.GetDataByKey(skill1)); } if (skill2 != 0) { info.m_tarlentLibList.Add(GameDataMgr.talentLib.GetDataByKey(skill2)); } if (skill3 != 0) { info.m_tarlentLibList.Add(GameDataMgr.talentLib.GetDataByKey(skill3)); } }
public static HeroTalentViewInfo GetHeroTalentViewInfo(uint heroCfgID) { HeroTalentViewInfo info = new HeroTalentViewInfo { m_talentLevel = 0, m_learnTalentList = new uint[5] }; ResTalentHero dataByKey = GameDataMgr.talentHero.GetDataByKey(heroCfgID); if (dataByKey != null) { info.m_heroTalentLevelInfoList = new ListView <HeroTalentLevelInfo>(); for (int i = 0; i < dataByKey.astTalentList.Length; i++) { HeroTalentLevelInfo info2 = new HeroTalentLevelInfo(); InitHeroTalentLevelInfo(info2, dataByKey.astTalentList[i].dwLvl1ID, dataByKey.astTalentList[i].dwLvl2ID, dataByKey.astTalentList[i].dwLvl3ID, dataByKey.astTalentList[i]); info.m_heroTalentLevelInfoList.Add(info2); } } return(info); }
public void Refresh() { if (Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo() != null) { HeroTalentViewInfo heroTalentViewInfo = this.GetHeroTalentViewInfo(this.m_heroCaption); if (heroTalentViewInfo != null) { uint configId = (uint)heroTalentViewInfo.m_hero.handle.TheActorMeta.ConfigId; List <stTalentEventParams> list = new List <stTalentEventParams>(); for (int i = heroTalentViewInfo.m_talentLevel - 1; i >= 0; i--) { if (heroTalentViewInfo.m_learnTalentList[i] == 0) { for (int k = 0; k < heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_tarlentLibList.Count; k++) { if (heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_tarlentLibList[k] == null) { return; } stTalentEventParams item = new stTalentEventParams { talentLevelIndex = (byte)i, talentInfo = heroTalentViewInfo.m_heroTalentLevelInfoList[i].m_tarlentLibList[k], isCanLearn = true }; if (!IsNeedBuy(i, k) || IsBuyTalent(configId, i)) { item.isHaveTalent = true; list.Add(item); } } break; } } GameObject gameObject = this.m_root.transform.Find("List1").gameObject; GameObject[] objArray = new GameObject[] { gameObject.transform.Find("talentCell1").gameObject, gameObject.transform.Find("talentCell2").gameObject, gameObject.transform.Find("talentCell3").gameObject }; for (int j = 0; j < objArray.Length; j++) { GameObject obj3 = objArray[j]; if (j < list.Count) { obj3.CustomSetActive(true); stTalentEventParams params2 = list[j]; Image component = obj3.transform.Find("imgIcon").GetComponent <Image>(); Text text = obj3.transform.Find("panelDesc/Text").GetComponent <Text>(); component.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + params2.talentInfo.dwIcon, Singleton <CBattleSystem> .GetInstance().m_FormScript, true, false, false); text.text = StringHelper.UTF8BytesToString(ref params2.talentInfo.szDesc2); CUIEventScript script = obj3.GetComponent <CUIEventScript>(); stUIEventParams eventParams = new stUIEventParams { talentParams = params2 }; script.SetUIEvent(enUIEventType.Click, enUIEventID.Talent_BtnLearnClick, eventParams); } else { obj3.CustomSetActive(false); } } if (list.Count > 0) { gameObject.gameObject.CustomSetActive(true); } else { gameObject.gameObject.CustomSetActive(false); } CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_TalentFormPath); if (form != null) { CUIListScript[] scriptArray = new CUIListScript[] { form.gameObject.transform.Find("Panel/PanelLeft/List1").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List2").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List3").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List4").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List5").GetComponent <CUIListScript>() }; for (int m = 0; m < this.m_talentRuleList.Count; m++) { HeroTalentLevelInfo info3 = heroTalentViewInfo.m_heroTalentLevelInfoList[m]; uint num6 = heroTalentViewInfo.m_learnTalentList[m]; bool flag = heroTalentViewInfo.m_talentLevel > m; CUIListScript script3 = scriptArray[m]; script3.SetElementAmount(info3.m_tarlentLibList.Count); GameObject obj4 = script3.gameObject.transform.Find("Current").gameObject; obj4.CustomSetActive(false); for (int n = 0; n < info3.m_tarlentLibList.Count; n++) { GameObject obj5 = script3.GetElemenet(n).gameObject.transform.Find("talentCell").gameObject; Image image = obj5.transform.Find("imgIcon").GetComponent <Image>(); Image image3 = obj5.transform.Find("lock").GetComponent <Image>(); Text text2 = obj5.transform.Find("lblName").GetComponent <Text>(); CanvasGroup group = obj5.GetComponent <CanvasGroup>(); CUIEventScript script4 = obj5.GetComponent <CUIEventScript>(); ResTalentLib lib = info3.m_tarlentLibList[n]; if (lib == null) { return; } image.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + lib.dwIcon, form, true, false, false); image.color = CUIUtility.s_Color_White; text2.text = StringHelper.UTF8BytesToString(ref lib.szName); stTalentEventParams params4 = new stTalentEventParams { talentLevelIndex = (byte)m, talentInfo = info3.m_tarlentLibList[n], isCanLearn = false }; if (IsNeedBuy(m, n) && !IsBuyTalent(configId, m)) { params4.isHaveTalent = false; image3.gameObject.CustomSetActive(true); } else { params4.isHaveTalent = true; image3.gameObject.CustomSetActive(false); } if (flag) { if (num6 == 0) { if (params4.isHaveTalent) { params4.isCanLearn = true; } obj4.CustomSetActive(true); } else if (lib.dwID != num6) { group.alpha = 0.25f; } else { group.alpha = 1f; } image.color = CUIUtility.s_Color_White; image3.color = CUIUtility.s_Color_White; text2.color = CUIUtility.s_Color_White; } else { image.color = CUIUtility.s_Color_GrayShader; image3.color = CUIUtility.s_Color_GrayShader; text2.color = CUIUtility.s_Color_Grey; } stUIEventParams params5 = new stUIEventParams { talentParams = params4 }; script4.SetUIEvent(enUIEventType.Click, enUIEventID.Talent_ItemClick, params5); } } } } } }
public void RefreshForm(int effectIndex = -1) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_talentBuyFormPath); if (form != null) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { CHeroInfo heroInfo = masterRoleInfo.GetHeroInfo(this.m_heroID, false); HeroTalentViewInfo heroTalentViewInfo = TalentView.GetHeroTalentViewInfo(this.m_heroID); if (heroTalentViewInfo != null) { CUIListScript[] scriptArray = new CUIListScript[] { form.gameObject.transform.Find("Panel/PanelLeft/List1").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List2").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List3").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List4").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List5").GetComponent <CUIListScript>() }; for (int i = 0; i < 5; i++) { CUIListScript script2 = scriptArray[i]; HeroTalentLevelInfo info4 = heroTalentViewInfo.m_heroTalentLevelInfoList[i]; ResTalentLib lib = info4.m_tarlentLibList[info4.m_tarlentLibList.Count - 1]; Button component = script2.transform.Find("BtnBuyCoin").GetComponent <Button>(); Text text = script2.transform.Find("lblTips").GetComponent <Text>(); Text text2 = text.transform.Find("Text").GetComponent <Text>(); Image image = text.transform.Find("Image").GetComponent <Image>(); component.gameObject.CustomSetActive(false); text2.gameObject.CustomSetActive(false); image.gameObject.CustomSetActive(false); if (!TalentView.IsHaveTalentBuyFunc(this.m_heroID)) { text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_3"); } else if ((heroInfo == null) && (i == 0)) { text.text = Singleton <CTextManager> .instance.GetText("Skin_NeedToBuyAHero"); } else if (TalentView.IsBuyTalent(this.m_heroID, i)) { text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_2"); } else if ((i > 0) && !TalentView.IsBuyTalent(this.m_heroID, i - 1)) { int num2 = heroTalentViewInfo.m_heroTalentLevelInfoList[i - 1].m_tarlentLibList.Count - 1; string str = StringHelper.UTF8BytesToString(ref heroTalentViewInfo.m_heroTalentLevelInfoList[i - 1].m_tarlentLibList[num2].szName); string[] args = new string[] { str }; text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_4", args); } else { if (heroInfo == null) { continue; } string str2 = StringHelper.UTF8BytesToString(ref CHeroInfo.GetHeroProficiency(heroInfo.cfgInfo.bJob, heroInfo.m_ProficiencyLV).szTitle); string str3 = StringHelper.UTF8BytesToString(ref CHeroInfo.GetHeroProficiency(heroInfo.cfgInfo.bJob, info4.m_levelDetail.bLvl3UnlockLvl).szTitle); if (heroInfo.m_ProficiencyLV < info4.m_levelDetail.bLvl3UnlockLvl) { component.gameObject.CustomSetActive(true); stUIEventParams eventParams = new stUIEventParams { tag = info4.m_levelDetail.bLvl3LockCostType, tagUInt = info4.m_levelDetail.dwLvl3LockCostPrice, tag2 = i, tagStr = StringHelper.UTF8BytesToString(ref lib.szName) }; CMallSystem.SetPayButton(form, (RectTransform)component.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3LockCostType), info4.m_levelDetail.dwLvl3LockCostPrice, enUIEventID.Talent_Buy_BtnSellClick, ref eventParams); string[] textArray2 = new string[] { str3 }; text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_7", textArray2); text2.gameObject.CustomSetActive(true); image.gameObject.CustomSetActive(true); CMallSystem.SetPayButton(form, (RectTransform)text.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3UnLockCostType), info4.m_levelDetail.dwLvl3UnLockCostPrice, enUIEventID.None, ref eventParams); } else { component.gameObject.CustomSetActive(true); stUIEventParams params2 = new stUIEventParams { tag = info4.m_levelDetail.bLvl3UnLockCostType, tagUInt = info4.m_levelDetail.dwLvl3UnLockCostPrice, tag2 = i, tagStr = StringHelper.UTF8BytesToString(ref lib.szName) }; CMallSystem.SetPayButton(form, (RectTransform)component.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3UnLockCostType), info4.m_levelDetail.dwLvl3UnLockCostPrice, enUIEventID.Talent_Buy_BtnSellClick, ref params2); string[] textArray3 = new string[] { str2 }; text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_8", textArray3); } } script2.SetElementAmount(info4.m_tarlentLibList.Count); for (int j = 0; j < info4.m_tarlentLibList.Count; j++) { GameObject gameObject = script2.GetElemenet(j).gameObject.transform.Find("talentCell").gameObject; Image image2 = gameObject.transform.Find("imgIcon").GetComponent <Image>(); Image image3 = gameObject.transform.Find("lock").GetComponent <Image>(); Text text3 = gameObject.transform.Find("lblName").GetComponent <Text>(); CanvasGroup group = gameObject.GetComponent <CanvasGroup>(); CUIEventScript script3 = gameObject.GetComponent <CUIEventScript>(); ResTalentLib lib2 = info4.m_tarlentLibList[j]; if (lib2 == null) { return; } image2.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + lib2.dwIcon, form, true, false, false); image2.color = CUIUtility.s_Color_White; text3.text = StringHelper.UTF8BytesToString(ref lib2.szName); stTalentEventParams params3 = new stTalentEventParams { talentLevelIndex = (byte)i, talentInfo = info4.m_tarlentLibList[j], isCanLearn = false }; if (TalentView.IsNeedBuy(i, j) && !TalentView.IsBuyTalent(this.m_heroID, i)) { params3.isHaveTalent = false; image3.gameObject.CustomSetActive(true); image2.color = CUIUtility.s_Color_GrayShader; } else { params3.isHaveTalent = true; image3.gameObject.CustomSetActive(false); image2.color = CUIUtility.s_Color_White; if ((effectIndex == i) && (j == (info4.m_tarlentLibList.Count - 1))) { CUICommonSystem.PlayAnimator(gameObject, "UnLock_Anim"); } } string strContent = StringHelper.UTF8BytesToString(ref lib2.szDesc); CUICommonSystem.SetCommonTipsEvent(form, gameObject, strContent, enUseableTipsPos.enTop); } } } } } }