public static void InitLevelForm(CUIFormScript formScript, int chapterNo, int LevelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { PVE_ADV_COMPLETE_INFO pve_adv_complete_info = masterRoleInfo.pveLevelDetail[difficulty - 1]; PVE_LEVEL_COMPLETE_INFO pve_level_complete_info = pve_adv_complete_info.ChapterDetailList[chapterNo - 1].LevelDetailList[LevelNo - 1]; GameObject gameObject = formScript.gameObject; ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(pve_level_complete_info.iLevelID); if (dataByKey != null) { string str = StringHelper.UTF8BytesToString(ref dataByKey.szName); formScript.transform.Find("PanelLeft/DifficultText").GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(string.Format("Adventure_Level_{0}", difficulty)); formScript.transform.Find("Panel_Main/ImgMapNameBg/MapNameText").GetComponent <Text>().text = str; formScript.transform.Find("PanelLeft/MapNameText").GetComponent <Text>().text = str; formScript.transform.Find("PanelLeft/MapDescText").GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.szLevelDesc); string[] args = new string[] { dataByKey.RecommendLevel[difficulty - 1].ToString() }; formScript.transform.Find("PanelLeft/RecPlayerLvlText").GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText("Level_Recommend_Tips_1", args); formScript.transform.Find("PanelLeft/ChapterImg").GetComponent <Image>().SetSprite(GetLevelBgPath(chapterNo, LevelNo, difficulty), formScript, true, false, false); formScript.transform.Find("PanelLeft/DifficultImg").GetComponent <Image>().SetSprite(GetDifficultIcon(difficulty), formScript, true, false, false); for (int i = 1; i <= CAdventureSys.STAR_PER_LEVEL; i++) { GameObject descCon = gameObject.transform.Find("PanelRight/WinCondition" + i).gameObject; SetStarConditionDesc(formScript, descCon, (uint)dataByKey.astStarDetail[i - 1].iParam, CAdventureSys.IsStarGained(pve_level_complete_info.bStarBits, i)); } GameObject itemCell = gameObject.transform.Find("PanelRight/itemCell").gameObject; SetReward(formScript, itemCell, dataByKey, difficulty); GameObject obj5 = gameObject.transform.Find("PanelRight/HeroList").gameObject; int teamPower = 0; List <uint> heroListForBattleListID = Singleton <CHeroSelectSystem> .GetInstance().GetHeroListForBattleListID(dataByKey.dwBattleListID); SetTeamHeroList(obj5, heroListForBattleListID, out teamPower); SetStartBtnEnable(gameObject.transform.Find("BtnStart").gameObject, heroListForBattleListID); formScript.GetComponent <Image>().color = s_Adv_Difficult_Bg_Color[difficulty - 1]; } else { object[] inParameters = new object[] { pve_level_complete_info.iLevelID }; DebugHelper.Assert(false, "Can't find level info -- id: {0}", inParameters); } } }
public static void InitLevelForm(CUIFormScript formScript, int chapterNo, int LevelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { return; } PVE_ADV_COMPLETE_INFO pVE_ADV_COMPLETE_INFO = masterRoleInfo.pveLevelDetail[difficulty - 1]; PVE_LEVEL_COMPLETE_INFO pVE_LEVEL_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[chapterNo - 1].LevelDetailList[LevelNo - 1]; GameObject gameObject = formScript.gameObject; ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey((long)pVE_LEVEL_COMPLETE_INFO.iLevelID); if (dataByKey != null) { string text = StringHelper.UTF8BytesToString(ref dataByKey.szName); formScript.transform.Find("PanelLeft/DifficultText").GetComponent <Text>().text = Singleton <CTextManager> .get_instance().GetText(string.Format("Adventure_Level_{0}", difficulty)); formScript.transform.Find("Panel_Main/ImgMapNameBg/MapNameText").GetComponent <Text>().text = text; formScript.transform.Find("PanelLeft/MapNameText").GetComponent <Text>().text = text; formScript.transform.Find("PanelLeft/MapDescText").GetComponent <Text>().text = StringHelper.UTF8BytesToString(ref dataByKey.szLevelDesc); formScript.transform.Find("PanelLeft/RecPlayerLvlText").GetComponent <Text>().text = Singleton <CTextManager> .get_instance().GetText("Level_Recommend_Tips_1", new string[] { dataByKey.RecommendLevel[difficulty - 1].ToString() }); formScript.transform.Find("PanelLeft/ChapterImg").GetComponent <Image>().SetSprite(CAdventureView.GetLevelBgPath(chapterNo, LevelNo, difficulty), formScript, true, false, false, false); formScript.transform.Find("PanelLeft/DifficultImg").GetComponent <Image>().SetSprite(CAdventureView.GetDifficultIcon(difficulty), formScript, true, false, false, false); for (int i = 1; i <= CAdventureSys.STAR_PER_LEVEL; i++) { GameObject gameObject2 = gameObject.transform.Find("PanelRight/WinCondition" + i).gameObject; CAdventureView.SetStarConditionDesc(formScript, gameObject2, (uint)dataByKey.astStarDetail[i - 1].iParam, CAdventureSys.IsStarGained(pVE_LEVEL_COMPLETE_INFO.bStarBits, i)); } GameObject gameObject3 = gameObject.transform.Find("PanelRight/itemCell").gameObject; CAdventureView.SetReward(formScript, gameObject3, dataByKey, difficulty); GameObject gameObject4 = gameObject.transform.Find("PanelRight/HeroList").gameObject; int num = 0; List <uint> heroListForBattleListID = Singleton <CHeroSelectBaseSystem> .get_instance().GetHeroListForBattleListID(dataByKey.dwBattleListID); CAdventureView.SetTeamHeroList(gameObject4, heroListForBattleListID, out num); GameObject gameObject5 = gameObject.transform.Find("BtnStart").gameObject; CAdventureView.SetStartBtnEnable(gameObject5, heroListForBattleListID); formScript.gameObject.transform.FindChild("Bg").gameObject.GetComponent <Image>().color = CAdventureView.s_Adv_Difficult_Bg_Color[difficulty - 1]; } else { DebugHelper.Assert(false, "Can't find level info -- id: {0}", new object[] { pVE_LEVEL_COMPLETE_INFO.iLevelID }); } }