public static void InitChapterElement(CUIFormScript formScript, int currentChapter, 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_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[currentChapter - 1]; PVE_LEVEL_COMPLETE_INFO[] levelDetailList = pVE_CHAPTER_COMPLETE_INFO.LevelDetailList; ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey((long)levelDetailList[levelNo - 1].iLevelID); if (dataByKey == null) { return; } formScript.transform.FindChild("ChapterElement/ChapterImg").GetComponent <Image>().SetSprite(CAdventureView.GetLevelBgPath(currentChapter, levelNo, difficulty), formScript, true, false, false, false); formScript.transform.FindChild("ChapterElement/ChapterNameText").GetComponent <Text>().text = Utility.UTF8Convert(dataByKey.szName); formScript.transform.FindChild("ChapterElement/ChapterDEscText").GetComponent <Text>().text = Utility.UTF8Convert(dataByKey.szLevelDesc); formScript.transform.FindChild("ChapterElement/RecPlayerLvlText").GetComponent <Text>().text = Singleton <CTextManager> .get_instance().GetText("Level_Recommend_Tips_1", new string[] { dataByKey.RecommendLevel[difficulty - 1].ToString() }); formScript.transform.FindChild("Bg").GetComponent <Image>().color = CAdventureView.s_Adv_Difficult_Bg_Color[difficulty - 1]; }
public static void InitLevelList(CUIFormScript form, int currentChapter, int levelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey(currentChapter); DebugHelper.Assert(dataByKey != null); bool flag = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByKey.dwChapterId); PVE_ADV_COMPLETE_INFO pve_adv_complete_info = masterRoleInfo.pveLevelDetail[difficulty - 1]; PVE_CHAPTER_COMPLETE_INFO pve_chapter_complete_info = pve_adv_complete_info.ChapterDetailList[currentChapter - 1]; PVE_LEVEL_COMPLETE_INFO[] levelDetailList = pve_chapter_complete_info.LevelDetailList; CUIListScript component = form.transform.FindChild("LevelList").GetComponent <CUIListScript>(); component.SetElementAmount(levelDetailList.Length); CUIListElementScript elemenet = null; Sprite sprite = CUIUtility.GetSpritePrefeb(GetLevelFramePath(difficulty), false, false).GetComponent <SpriteRenderer>().sprite; GameObject prefab = CUIUtility.GetSpritePrefeb(GetLevelSelectFramePath(difficulty), false, false); for (int i = 0; i < levelDetailList.Length; i++) { elemenet = component.GetElemenet(i); ResLevelCfgInfo info3 = GameDataMgr.levelDatabin.GetDataByKey(levelDetailList[i].iLevelID); object[] inParameters = new object[] { levelDetailList[i].iLevelID }; DebugHelper.Assert(info3 != null, "Can't find LevelConfig = {0}", inParameters); bool bActive = (levelDetailList[i].levelStatus == 0) || !flag; bool flag3 = (levelDetailList[i].levelStatus == 1) && flag; int starNum = CAdventureSys.GetStarNum(levelDetailList[i].bStarBits); elemenet.transform.FindChild("Unlock/star1").GetComponent <Image>().color = (starNum < 1) ? CUIUtility.s_Color_GrayShader : Color.white; elemenet.transform.FindChild("Unlock/star2").GetComponent <Image>().color = (starNum < 2) ? CUIUtility.s_Color_GrayShader : Color.white; elemenet.transform.FindChild("Unlock/star3").GetComponent <Image>().color = (starNum < 3) ? CUIUtility.s_Color_GrayShader : Color.white; elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().text = Utility.UTF8Convert(info3.szName); if ((levelNo == (i + 1)) && !bActive) { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[0]; } else if (!bActive) { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[1]; } else { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = s_Adv_Level_Colors[2]; } elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().color = s_Adv_Difficult_Color[difficulty - 1]; elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().color = s_Adv_Difficult_Color[((s_Adv_Difficult_Color.Length / 2) + difficulty) - 1]; elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().color = s_Adv_Difficult_Color[((s_Adv_Difficult_Color.Length / 2) + difficulty) - 1]; elemenet.transform.FindChild("SelectedFrame/SelectedFrame").GetComponent <Image>().SetSprite(prefab); elemenet.transform.FindChild("New").gameObject.CustomSetActive(flag3); elemenet.GetComponent <CUIEventScript>().m_onClickEventID = enUIEventID.Adv_SelectLevel; elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1; elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(!bActive); elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(bActive); elemenet.m_selectedSprite = sprite; elemenet.GetComponent <Image>().SetSprite(((levelNo - 1) != i) ? elemenet.m_defaultSprite : sprite, elemenet.m_selectedLayout); } component.SelectElement(levelNo - 1, true); } }
public static void InitChapterList(CUIFormScript formScript, int currentChapter, int levelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { CUIListScript component = formScript.transform.FindChild("ChapterList").GetComponent <CUIListScript>(); PVE_ADV_COMPLETE_INFO pve_adv_complete_info = masterRoleInfo.pveLevelDetail[difficulty - 1]; PVE_CHAPTER_COMPLETE_INFO chapterInfo = null; CUIListElementScript elemenet = null; int stars = 0; string prefabPath = string.Empty; string chapterName = string.Empty; component.SetElementAmount(CAdventureSys.CHAPTER_NUM); for (int i = 0; i < CAdventureSys.CHAPTER_NUM; i++) { ResChapterInfo dataByIndex = GameDataMgr.chapterInfoDatabin.GetDataByIndex(i); DebugHelper.Assert(dataByIndex != null); bool bActive = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByIndex.dwChapterId); bool flag2 = i == (Singleton <CAdventureSys> .instance.bNewChapterId - 1); chapterInfo = pve_adv_complete_info.ChapterDetailList[i]; elemenet = component.GetElemenet(i); stars = CAdventureSys.GetChapterTotalStar(chapterInfo); SetRewardItem(elemenet.gameObject, chapterInfo, stars, i); chapterName = GetChapterName(i + 1); elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().text = chapterName; if ((currentChapter == (i + 1)) && bActive) { elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = s_Adv_Chaptper_Colors[0]; } else if (bActive) { elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = s_Adv_Chaptper_Colors[1]; } else { elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = s_Adv_Chaptper_Colors[2]; } elemenet.GetComponent <CUIEventScript>().m_onClickEventID = enUIEventID.Adv_SelectChapter; elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1; elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(!bActive); elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(bActive); prefabPath = GetChapterBgPath(i + 1); elemenet.transform.FindChild("BackgroundImg").GetComponent <Image>().SetSprite(prefabPath, component.m_belongedFormScript, true, false, false); elemenet.transform.FindChild("Lock/SelectedImg").GetComponent <Image>().SetSprite(prefabPath, component.m_belongedFormScript, true, false, false); elemenet.transform.FindChild("Lock/LockText").GetComponent <Text>().text = Utility.UTF8Convert(dataByIndex.szLockedTip); elemenet.transform.FindChild("New").gameObject.CustomSetActive(flag2); } component.SelectElement(currentChapter - 1, true); component.MoveElementInScrollArea(currentChapter - 1, true); } }
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 }); } }
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 InitDifficultList(CUIFormScript form, int currentChapter, int levelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { return; } CUIListScript component = form.transform.FindChild("DifficultList").GetComponent <CUIListScript>(); string text = string.Empty; string prefabPath = string.Empty; int lEVEL_DIFFICULT_OPENED = CAdventureSys.LEVEL_DIFFICULT_OPENED; component.SetElementAmount(lEVEL_DIFFICULT_OPENED); for (int i = 0; i < lEVEL_DIFFICULT_OPENED; i++) { bool flag = CAdventureSys.IsDifOpen(currentChapter, i + 1); prefabPath = CAdventureView.GetDifficultIcon(i + 1); CUIListElementScript elemenet = component.GetElemenet(i); Image component2 = elemenet.transform.FindChild("DifficultImg").GetComponent <Image>(); component2.SetSprite(prefabPath, form, true, false, false, false); component2.color = ((!flag) ? CAdventureView.s_Adv_Difficulty_Gray_Color : Color.white); elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().SetSprite(prefabPath, form, true, false, false, false); text = Singleton <CTextManager> .get_instance().GetText(string.Format("Adventure_Level_{0}", i + 1)); elemenet.transform.FindChild("DifficultImg/DifficultText").GetComponent <Text>().text = text; elemenet.transform.FindChild("SelectedFrame/DifficultText").GetComponent <Text>().text = text; elemenet.GetComponent <CUIEventScript>().m_onClickEventID = enUIEventID.Adv_SelectDifficult; elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1; elemenet.transform.FindChild("SelectedFrame/Frame_circle").GetComponent <Image>().color = CAdventureView.s_Adv_Difficult_Circle_Color[i]; PVE_ADV_COMPLETE_INFO pVE_ADV_COMPLETE_INFO = masterRoleInfo.pveLevelDetail[i]; PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[currentChapter - 1]; int chapterTotalStar = CAdventureSys.GetChapterTotalStar(pVE_CHAPTER_COMPLETE_INFO); elemenet.transform.FindChild("SelectedFrame/RewardBox").gameObject.CustomSetActive(chapterTotalStar == CAdventureSys.LEVEL_PER_CHAPTER * CAdventureSys.STAR_PER_LEVEL && pVE_CHAPTER_COMPLETE_INFO.bIsGetBonus == 0); elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(!flag); } component.SelectElement(difficulty - 1, true); }
public static void InitLevelList(CUIFormScript form, int currentChapter, int levelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { return; } ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)currentChapter); DebugHelper.Assert(dataByKey != null); bool flag = Singleton <CFunctionUnlockSys> .instance.ChapterIsUnlock(dataByKey.dwChapterId); PVE_ADV_COMPLETE_INFO pVE_ADV_COMPLETE_INFO = masterRoleInfo.pveLevelDetail[difficulty - 1]; PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = pVE_ADV_COMPLETE_INFO.ChapterDetailList[currentChapter - 1]; PVE_LEVEL_COMPLETE_INFO[] levelDetailList = pVE_CHAPTER_COMPLETE_INFO.LevelDetailList; CUIListScript component = form.transform.FindChild("LevelList").GetComponent <CUIListScript>(); component.SetElementAmount(levelDetailList.Length); Sprite sprite = CUIUtility.GetSpritePrefeb(CAdventureView.GetLevelFramePath(difficulty), false, false).GetComponent <SpriteRenderer>().sprite; GameObject spritePrefeb = CUIUtility.GetSpritePrefeb(CAdventureView.GetLevelSelectFramePath(difficulty), false, false); for (int i = 0; i < levelDetailList.Length; i++) { CUIListElementScript elemenet = component.GetElemenet(i); ResLevelCfgInfo dataByKey2 = GameDataMgr.levelDatabin.GetDataByKey((long)levelDetailList[i].iLevelID); DebugHelper.Assert(dataByKey2 != null, "Can't find LevelConfig = {0}", new object[] { levelDetailList[i].iLevelID }); bool flag2 = levelDetailList[i].levelStatus == 0 || !flag; bool bActive = levelDetailList[i].levelStatus == 1 && flag; int starNum = CAdventureSys.GetStarNum(levelDetailList[i].bStarBits); elemenet.transform.FindChild("Unlock/star1").GetComponent <Image>().set_color((starNum >= 1) ? Color.white : CUIUtility.s_Color_GrayShader); elemenet.transform.FindChild("Unlock/star2").GetComponent <Image>().set_color((starNum >= 2) ? Color.white : CUIUtility.s_Color_GrayShader); elemenet.transform.FindChild("Unlock/star3").GetComponent <Image>().set_color((starNum >= 3) ? Color.white : CUIUtility.s_Color_GrayShader); elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_text(Utility.UTF8Convert(dataByKey2.szName)); if (levelNo == i + 1 && !flag2) { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[0]); } else if (!flag2) { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[1]); } else { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().set_color(CAdventureView.s_Adv_Level_Colors[2]); } elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[difficulty - 1]); elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]); elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().set_color(CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]); elemenet.transform.FindChild("SelectedFrame/SelectedFrame").GetComponent <Image>().SetSprite(spritePrefeb, false); elemenet.transform.FindChild("New").gameObject.CustomSetActive(bActive); elemenet.GetComponent <CUIEventScript>().m_onClickEventID = enUIEventID.Adv_SelectLevel; elemenet.GetComponent <CUIEventScript>().m_onClickEventParams.tag = i + 1; elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(!flag2); elemenet.transform.FindChild("Lock").gameObject.CustomSetActive(flag2); elemenet.m_selectedSprite = sprite; elemenet.GetComponent <Image>().SetSprite((levelNo - 1 == i) ? sprite : elemenet.m_defaultSprite, elemenet.m_selectedLayout); } component.SelectElement(levelNo - 1, true); }