public static void InitChapterForm(CUIFormScript formScript, int currentChapter, int levelNo, int difficulty) { if (Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo() == null) { return; } CAdventureView.InitChapterList(formScript, currentChapter, levelNo, difficulty); CAdventureView.InitLevelList(formScript, currentChapter, levelNo, difficulty); CAdventureView.InitDifficultList(formScript, currentChapter, levelNo, difficulty); CAdventureView.InitChapterElement(formScript, currentChapter, levelNo, difficulty); }
public static void InitChapterList(CUIFormScript formScript, int currentChapter, int levelNo, int difficulty) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo == null) { return; } CUIListScript component = formScript.transform.FindChild("ChapterList").GetComponent <CUIListScript>(); PVE_ADV_COMPLETE_INFO pVE_ADV_COMPLETE_INFO = masterRoleInfo.pveLevelDetail[difficulty - 1]; string prefabPath = string.Empty; string text = 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 flag = Singleton <CFunctionUnlockSys> .get_instance().ChapterIsUnlock(dataByIndex.dwChapterId); bool bActive = i == (int)(Singleton <CAdventureSys> .get_instance().bNewChapterId - 1); PVE_CHAPTER_COMPLETE_INFO chapterInfo = pVE_ADV_COMPLETE_INFO.ChapterDetailList[i]; CUIListElementScript elemenet = component.GetElemenet(i); int chapterTotalStar = CAdventureSys.GetChapterTotalStar(chapterInfo); CAdventureView.SetRewardItem(elemenet.gameObject, chapterInfo, chapterTotalStar, i); text = CAdventureView.GetChapterName(i + 1); elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().text = text; if (currentChapter == i + 1 && flag) { elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = CAdventureView.s_Adv_Chaptper_Colors[0]; } else if (flag) { elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = CAdventureView.s_Adv_Chaptper_Colors[1]; } else { elemenet.transform.FindChild("ChapterNameText").GetComponent <Text>().color = CAdventureView.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(!flag); elemenet.transform.FindChild("Unlock").gameObject.CustomSetActive(flag); prefabPath = CAdventureView.GetChapterBgPath(i + 1); elemenet.transform.FindChild("BackgroundImg").GetComponent <Image>().SetSprite(prefabPath, component.m_belongedFormScript, true, false, false, false); elemenet.transform.FindChild("Lock/SelectedImg").GetComponent <Image>().SetSprite(prefabPath, component.m_belongedFormScript, true, false, false, false); elemenet.transform.FindChild("Lock/LockText").GetComponent <Text>().text = Utility.UTF8Convert(dataByIndex.szLockedTip); elemenet.transform.FindChild("New").gameObject.CustomSetActive(bActive); } 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 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); }
private static void SetMopupTenEnable(GameObject Mopup, byte StarBitsMask, RES_LEVEL_DIFFICULTY_TYPE difficulty, int LeftPlayNum) { Button component = Mopup.GetComponent <Button>(); CUIEventScript component2 = component.gameObject.GetComponent <CUIEventScript>(); stUIEventParams onClickEventParams = default(stUIEventParams); bool isEnable; if (difficulty == 1) { Text componetInChild = Utility.GetComponetInChild <Text>(Mopup, "Text"); componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Sweep_Number", new string[] { "10" }); isEnable = (CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL && CAdventureView.isVip()); onClickEventParams.tag = 10; component2.m_onClickEventParams = onClickEventParams; } else { if (difficulty != 2) { DebugHelper.Assert(false, "Invalid difficulty -- {0}", new object[] { difficulty }); return; } Text componetInChild2 = Utility.GetComponetInChild <Text>(Mopup, "Text"); if (LeftPlayNum > 0) { componetInChild2.text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Sweep_Number", new string[] { LeftPlayNum.ToString() }); } else { componetInChild2.text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Can_Not_Sweep"); } isEnable = (CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL && CAdventureView.isVip() && LeftPlayNum > 0); onClickEventParams.tag = LeftPlayNum; component2.m_onClickEventParams = onClickEventParams; } CUICommonSystem.SetButtonEnable(component, isEnable, true, true); }
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) { return; } ResChapterInfo dataByKey = GameDataMgr.chapterInfoDatabin.GetDataByKey((long)currentChapter); DebugHelper.Assert(dataByKey != null); bool flag = Singleton <CFunctionUnlockSys> .get_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>().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(dataByKey2.szName); if (levelNo == i + 1 && !flag2) { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = CAdventureView.s_Adv_Level_Colors[0]; } else if (!flag2) { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = CAdventureView.s_Adv_Level_Colors[1]; } else { elemenet.transform.FindChild("TxtLevelNameText").GetComponent <Text>().color = CAdventureView.s_Adv_Level_Colors[2]; } elemenet.transform.FindChild("SelectedFrame").GetComponent <Image>().color = CAdventureView.s_Adv_Difficult_Color[difficulty - 1]; elemenet.transform.FindChild("SelectedFrame/Image1").GetComponent <Image>().color = CAdventureView.s_Adv_Difficult_Color[CAdventureView.s_Adv_Difficult_Color.Length / 2 + difficulty - 1]; elemenet.transform.FindChild("SelectedFrame/Image2").GetComponent <Image>().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) ? elemenet.m_defaultSprite : sprite, elemenet.m_selectedLayout); } component.SelectElement(levelNo - 1, true); }