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); } }
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); }
private static void SetMopupEnable(GameObject Mopup, byte StarBitsMask, RES_LEVEL_DIFFICULTY_TYPE difficulty, int LeftPlayNum) { Button component = Mopup.GetComponent <Button>(); bool isEnable = false; if (difficulty == RES_LEVEL_DIFFICULTY_TYPE.RES_LEVEL_DIFFICULTY_TYPE_NORMAL) { isEnable = CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL; } else if (difficulty == RES_LEVEL_DIFFICULTY_TYPE.RES_LEVEL_DIFFICULTY_TYPE_NIGHTMARE) { isEnable = (CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL) && (LeftPlayNum > 0); } else { object[] inParameters = new object[] { difficulty }; DebugHelper.Assert(false, "Invalid difficulty -- {0}", inParameters); return; } CUICommonSystem.SetButtonEnable(component, isEnable, true, true); }
private static void SetMopupTenEnable(GameObject Mopup, byte StarBitsMask, RES_LEVEL_DIFFICULTY_TYPE difficulty, int LeftPlayNum) { Button component = Mopup.GetComponent <Button>(); bool isEnable = false; CUIEventScript script = component.gameObject.GetComponent <CUIEventScript>(); stUIEventParams @params = new stUIEventParams(); if (difficulty == RES_LEVEL_DIFFICULTY_TYPE.RES_LEVEL_DIFFICULTY_TYPE_NORMAL) { string[] args = new string[] { "10" }; Utility.GetComponetInChild <Text>(Mopup, "Text").text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Sweep_Number", args); isEnable = (CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL) && isVip(); @params.tag = 10; script.m_onClickEventParams = @params; } else if (difficulty == RES_LEVEL_DIFFICULTY_TYPE.RES_LEVEL_DIFFICULTY_TYPE_NIGHTMARE) { Text componetInChild = Utility.GetComponetInChild <Text>(Mopup, "Text"); if (LeftPlayNum > 0) { string[] textArray2 = new string[] { LeftPlayNum.ToString() }; componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Sweep_Number", textArray2); } else { componetInChild.text = Singleton <CTextManager> .GetInstance().GetText("PVE_Level_Can_Not_Sweep"); } isEnable = ((CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL) && isVip()) && (LeftPlayNum > 0); @params.tag = LeftPlayNum; script.m_onClickEventParams = @params; } else { object[] inParameters = new object[] { difficulty }; DebugHelper.Assert(false, "Invalid difficulty -- {0}", inParameters); return; } CUICommonSystem.SetButtonEnable(component, isEnable, true, true); }
private static void SetMopupEnable(GameObject Mopup, byte StarBitsMask, RES_LEVEL_DIFFICULTY_TYPE difficulty, int LeftPlayNum) { Button component = Mopup.GetComponent <Button>(); bool isEnable; if (difficulty == 1) { isEnable = (CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL); } else { if (difficulty != 2) { DebugHelper.Assert(false, "Invalid difficulty -- {0}", new object[] { difficulty }); return; } isEnable = (CAdventureSys.GetStarNum(StarBitsMask) == CAdventureSys.STAR_PER_LEVEL && LeftPlayNum > 0); } CUICommonSystem.SetButtonEnable(component, isEnable, true, true); }
public bool CheckUnlock(uint id) { bool result = false; ResUnlockCondition dataByKey = GameDataMgr.unlockConditionDatabin.GetDataByKey(id); DebugHelper.Assert(dataByKey != null, "ResUnlockCondition[{0}] can not be find.", new object[] { id }); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "roleinfo can't be null in CheckUnlock"); if (masterRoleInfo != null && dataByKey != null) { switch (dataByKey.wUnlockType) { case 1: result = (masterRoleInfo.PvpLevel >= dataByKey.UnlockParam[0]); break; case 2: { int num = (int)dataByKey.UnlockParam[0]; int num2 = (int)dataByKey.UnlockParam[1]; int num3 = 0; ResLevelCfgInfo dataByKey2 = GameDataMgr.levelDatabin.GetDataByKey((long)num); DebugHelper.Assert(dataByKey2 != null, "can't find level = {0}", new object[] { num }); if (dataByKey2 != null && dataByKey2 != null && masterRoleInfo.pveLevelDetail[num3] != null && masterRoleInfo.pveLevelDetail[num3].ChapterDetailList[dataByKey2.iChapterId - 1] != null) { PVE_CHAPTER_COMPLETE_INFO pVE_CHAPTER_COMPLETE_INFO = masterRoleInfo.pveLevelDetail[num3].ChapterDetailList[dataByKey2.iChapterId - 1]; for (int i = 0; i < pVE_CHAPTER_COMPLETE_INFO.LevelDetailList.Length; i++) { PVE_LEVEL_COMPLETE_INFO pVE_LEVEL_COMPLETE_INFO = pVE_CHAPTER_COMPLETE_INFO.LevelDetailList[i]; if (pVE_LEVEL_COMPLETE_INFO != null && pVE_LEVEL_COMPLETE_INFO.iLevelID == num) { bool arg_178_0 = pVE_LEVEL_COMPLETE_INFO.levelStatus == 1 && num2 <= CAdventureSys.GetStarNum(pVE_LEVEL_COMPLETE_INFO.bStarBits); break; } } } result = true; break; } case 4: { uint num4 = 0u; if (masterRoleInfo.pvpDetail != null) { num4 = masterRoleInfo.pvpDetail.stOneVsOneInfo.dwTotalNum + masterRoleInfo.pvpDetail.stTwoVsTwoInfo.dwTotalNum + masterRoleInfo.pvpDetail.stThreeVsThreeInfo.dwTotalNum; } result = (dataByKey.UnlockParam[0] <= num4 && dataByKey.UnlockParam[1] <= masterRoleInfo.PvpLevel); break; } } } return(result); }
public bool CheckUnlock(uint id) { bool flag = false; ResUnlockCondition dataByKey = GameDataMgr.unlockConditionDatabin.GetDataByKey(id); object[] inParameters = new object[] { id }; DebugHelper.Assert(dataByKey != null, "ResUnlockCondition[{0}] can not be find.", inParameters); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "roleinfo can't be null in CheckUnlock"); if ((masterRoleInfo != null) && (dataByKey != null)) { switch (dataByKey.wUnlockType) { case 1: return(masterRoleInfo.PvpLevel >= dataByKey.UnlockParam[0]); case 2: { int num = (int)dataByKey.UnlockParam[0]; int num2 = (int)dataByKey.UnlockParam[1]; int index = 0; ResLevelCfgInfo info2 = GameDataMgr.levelDatabin.GetDataByKey((long)num); object[] objArray2 = new object[] { num }; DebugHelper.Assert(info2 != null, "can't find level = {0}", objArray2); flag = false; if (((info2 != null) && (info2 != null)) && ((masterRoleInfo.pveLevelDetail[index] != null) && (masterRoleInfo.pveLevelDetail[index].ChapterDetailList[info2.iChapterId - 1] != null))) { PVE_CHAPTER_COMPLETE_INFO pve_chapter_complete_info = masterRoleInfo.pveLevelDetail[index].ChapterDetailList[info2.iChapterId - 1]; for (int i = 0; i < pve_chapter_complete_info.LevelDetailList.Length; i++) { PVE_LEVEL_COMPLETE_INFO pve_level_complete_info = pve_chapter_complete_info.LevelDetailList[i]; if ((pve_level_complete_info != null) && (pve_level_complete_info.iLevelID == num)) { flag = (pve_level_complete_info.levelStatus == 1) && (num2 <= CAdventureSys.GetStarNum(pve_level_complete_info.bStarBits)); break; } } } return(true); } case 3: return(flag); case 4: { uint num5 = 0; if (masterRoleInfo.pvpDetail != null) { num5 = (masterRoleInfo.pvpDetail.stOneVsOneInfo.dwTotalNum + masterRoleInfo.pvpDetail.stTwoVsTwoInfo.dwTotalNum) + masterRoleInfo.pvpDetail.stThreeVsThreeInfo.dwTotalNum; } return((dataByKey.UnlockParam[0] <= num5) && (dataByKey.UnlockParam[1] <= masterRoleInfo.PvpLevel)); } } } return(flag); }
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); }