public void GetTrophyProgress(ref uint cur, ref uint next) { cur = this.GetTotalDonePoints(); if (this.LastDoneTrophyRewardInfo == null) { if (this.TrophyRewardInfoArrCnt > 0u) { next = this.TrophyRewardInfoArr[0].MaxPoint; } else { next = 0u; } } else { uint num = this.LastDoneTrophyRewardInfo.Cfg.dwTrophyLvl; while (this.TrophyRewardDic.ContainsKey(num)) { CTrophyRewardInfo cTrophyRewardInfo = this.TrophyRewardDic[num]; if (cur < cTrophyRewardInfo.MaxPoint) { next = cTrophyRewardInfo.MaxPoint; return; } num += 1u; } next = this.LastDoneTrophyRewardInfo.MaxPoint; } }
public static void OnReceiveGetTrophyRewardRsp(CSPkg msg) { Singleton <CUIManager> .GetInstance().CloseSendMsgAlert(); SCPKG_GET_TROPHYLVL_REWARD_RSP stGetTrophyLvlmentRewardRsp = msg.stPkgData.stGetTrophyLvlmentRewardRsp; if (stGetTrophyLvlmentRewardRsp.iResult < 0) { Singleton <CUIManager> .GetInstance().OpenTips(string.Format("奖励领取失败,请稍后再试 {0}", stGetTrophyLvlmentRewardRsp.iResult), false, 1.5f, null, new object[0]); return; } CAchieveInfo2 masterAchieveInfo = CAchieveInfo2.GetMasterAchieveInfo(); int num = (int)(stGetTrophyLvlmentRewardRsp.dwTrophyLvl - 1u); if (num < 0 || (long)num > (long)((ulong)masterAchieveInfo.TrophyRewardInfoArrCnt)) { return; } CTrophyRewardInfo cTrophyRewardInfo = masterAchieveInfo.TrophyRewardInfoArr[num]; CUseable[] trophyRewards = cTrophyRewardInfo.GetTrophyRewards(); Singleton <CUIManager> .instance.OpenAwardTip(trophyRewards, null, false, enUIEventID.None, false, false, "Form_Award"); cTrophyRewardInfo.State = TrophyState.GotRewards; Singleton <EventRouter> .GetInstance().BroadCastEvent(EventID.ACHIEVE_TROPHY_REWARD_INFO_STATE_CHANGE); }
public void ClearData() { this.LastDoneTrophyRewardInfo = null; this.m_AchiveItems.Clear(); this.m_AchiveItemDic.Clear(); this.m_Trophies.Clear(); this.MostLatelyDoneAchievements.Clear(); Array.Clear(this.SelectedTrophies, 0, this.SelectedTrophies.Length); this.TrophyRewardDic.Clear(); Array.Clear(this.TrophyRewardInfoArr, 0, this.TrophyRewardInfoArr.Length); }
public void ResetData() { this.m_curAchieveItem = null; this.m_curTrophyRewardInfo = null; this.m_nextPoint = 0u; this.m_startPoint = 0u; this.m_endPoint = 0u; this.m_achievePointsFrom = 0f; this.m_achievePointsTo = 1f; this.m_isNewTrophy = false; this.m_curAchieveItem = null; this.m_curTrophyRewardInfo = null; }
private void OnGetTrophyReward(CUIEvent uiEvent) { int tag = uiEvent.m_eventParams.tag; CAchieveInfo2 masterAchieveInfo = CAchieveInfo2.GetMasterAchieveInfo(); CTrophyRewardInfo[] trophyRewardInfoArr = masterAchieveInfo.TrophyRewardInfoArr; if (tag < 0 || tag >= trophyRewardInfoArr.Length) { return; } CTrophyRewardInfo cTrophyRewardInfo = trophyRewardInfoArr[tag]; this.SendGetTrophyRewardReq(cTrophyRewardInfo.Cfg.dwTrophyLvl); }
private CAchieveInfo2(int logicWorldID, ulong playerUUID) { this.m_Trophies = new ListView <CAchieveItem2>(); this.m_AchiveItems = new ListView <CAchieveItem2>(); this.m_AchiveItemDic = new DictionaryView <uint, CAchieveItem2>(); this.TrophyRewardInfoArrCnt = 0u; this.TrophyRewardInfoArr = new CTrophyRewardInfo[100]; this.LastDoneTrophyRewardInfo = null; this.TrophyRewardDic = new DictionaryView <uint, CTrophyRewardInfo>(); this.MostLatelyDoneAchievements = new List <uint>(); this.SelectedTrophies = new CAchieveItem2[3]; this.m_logicWorldID = logicWorldID; this.m_playerUUID = playerUUID; this.InitLocalData(); }
private void OnServerTrophy(uint trophyPoints) { int num = 0; while ((long)num < (long)((ulong)this.TrophyRewardInfoArrCnt)) { if (trophyPoints < this.TrophyRewardInfoArr[num].MaxPoint) { break; } this.TrophyRewardInfoArr[num].State = TrophyState.Finished; this.LastDoneTrophyRewardInfo = this.TrophyRewardInfoArr[num]; num++; } }
public void TrophyLevelUp(uint oldLevel, uint newLevel) { for (uint num = oldLevel + 1u; num <= newLevel; num += 1u) { if (this.TrophyRewardDic.ContainsKey(num)) { this.LastDoneTrophyRewardInfo = this.TrophyRewardDic[num]; this.LastDoneTrophyRewardInfo.State = TrophyState.Finished; } } uint key = newLevel + 1u; if (this.TrophyRewardDic.ContainsKey(key)) { this.TrophyRewardDic[key].State = TrophyState.OnGoing; } }
public CTrophyRewardInfo GetFirstTrophyRewardInfoAwardNotGot() { if (this.LastDoneTrophyRewardInfo == null) { return(null); } ListView <CTrophyRewardInfo> trophyRewardInfoWithRewards = this.GetTrophyRewardInfoWithRewards(); for (int i = 0; i < trophyRewardInfoWithRewards.Count; i++) { CTrophyRewardInfo cTrophyRewardInfo = trophyRewardInfoWithRewards[i]; if (!cTrophyRewardInfo.HasGotAward()) { return(cTrophyRewardInfo); } } return(null); }
private void RefreshData(uint achievementId) { this.ResetData(); CAchieveInfo2 masterAchieveInfo = CAchieveInfo2.GetMasterAchieveInfo(); this.m_curAchieveItem = masterAchieveInfo.m_AchiveItemDic[achievementId]; CAchieveItem2 head = this.m_curAchieveItem.GetHead(); if (head == this.m_curAchieveItem) { this.m_isNewTrophy = true; } else { this.m_isNewTrophy = false; } uint num = 0u; masterAchieveInfo.GetTrophyProgress(ref num, ref this.m_nextPoint); uint num2 = 0u; for (int i = 0; i < masterAchieveInfo.MostLatelyDoneAchievements.get_Count(); i++) { CAchieveItem2 cAchieveItem = masterAchieveInfo.m_AchiveItemDic[masterAchieveInfo.MostLatelyDoneAchievements.get_Item(i)]; num2 += cAchieveItem.Cfg.dwPoint; } this.m_startPoint = num - num2; this.m_endPoint = this.m_startPoint + this.m_curAchieveItem.Cfg.dwPoint; CTrophyRewardInfo trophyRewardInfoByPoint = masterAchieveInfo.GetTrophyRewardInfoByPoint(this.m_startPoint); CTrophyRewardInfo cTrophyRewardInfo = this.m_curTrophyRewardInfo = masterAchieveInfo.GetTrophyRewardInfoByPoint(this.m_endPoint); CTrophyRewardInfo trophyRewardInfoByIndex = masterAchieveInfo.GetTrophyRewardInfoByIndex(cTrophyRewardInfo.Index + 1); if (trophyRewardInfoByPoint.Cfg.dwTrophyLvl == cTrophyRewardInfo.Cfg.dwTrophyLvl) { this.m_achievePointsFrom = Utility.Divide(this.m_startPoint - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.GetPointStep()); this.m_achievePointsTo = Utility.Divide(this.m_endPoint - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.GetPointStep()); } else { this.m_achievePointsFrom = 0f; this.m_achievePointsTo = Utility.Divide(this.m_endPoint - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.GetPointStep()); } }
private void OnServerTrophy(ref COMDT_TROPHY_INFO TrophyRewardsInfo) { this.TrophyRewardInfoArrCnt = Math.Min(this.TrophyRewardInfoArrCnt, 100u); if (this.TrophyRewardInfoArrCnt == 0u) { DebugHelper.Assert(false, "成就系统荣耀奖励配置为空!"); return; } uint totalDonePoints = this.GetTotalDonePoints(); int num = 0; int num2 = 0; while ((long)num < (long)((ulong)this.TrophyRewardInfoArrCnt)) { if (num < (int)TrophyRewardsInfo.bAlreadyGetRewardNoGapLvl) { this.TrophyRewardInfoArr[num].State = TrophyState.GotRewards; } else if (num >= (int)TrophyRewardsInfo.bAlreadyGetRewardNoGapLvl && num < (int)(TrophyRewardsInfo.bAlreadyGetRewardNoGapLvl + TrophyRewardsInfo.bNum) && num2 < (int)TrophyRewardsInfo.bNum) { this.TrophyRewardInfoArr[num].State = ((TrophyRewardsInfo.szTrophyStateArray[num2] == 1) ? TrophyState.Finished : TrophyState.GotRewards); num2++; } else if (totalDonePoints > this.TrophyRewardInfoArr[num].MinPoint && totalDonePoints < this.TrophyRewardInfoArr[num].MaxPoint) { this.TrophyRewardInfoArr[num].State = TrophyState.OnGoing; } else if (totalDonePoints >= this.TrophyRewardInfoArr[num].MaxPoint) { this.TrophyRewardInfoArr[num].State = TrophyState.Finished; } else if (totalDonePoints <= this.TrophyRewardInfoArr[num].MinPoint) { this.TrophyRewardInfoArr[num].State = TrophyState.UnFinish; } if (this.TrophyRewardInfoArr[num].IsFinish()) { this.LastDoneTrophyRewardInfo = this.TrophyRewardInfoArr[num]; } num++; } }
private void RefreshShareForm() { if (this.m_curTrophyRewardInfo == null) { return; } if (this.m_shareForm == null) { this.m_shareForm = Singleton <CUIManager> .GetInstance().GetForm("UGUI/Form/System/Achieve/Form_Achievement_Share.prefab"); } if (this.m_shareForm == null) { return; } CAchieveInfo2 masterAchieveInfo = CAchieveInfo2.GetMasterAchieveInfo(); CTrophyRewardInfo trophyRewardInfoByIndex = masterAchieveInfo.GetTrophyRewardInfoByIndex(this.m_curTrophyRewardInfo.Index + 1); if (this.m_isNewTrophy) { } Text component = this.m_shareForm.GetWidget(0).GetComponent <Text>(); component.set_text(this.m_curAchieveItem.Cfg.szName); Text component2 = this.m_shareForm.GetWidget(5).GetComponent <Text>(); component2.set_text(this.m_curAchieveItem.GetAchievementDesc()); Text component3 = this.m_shareForm.GetWidget(7).GetComponent <Text>(); component3.set_text(this.m_curAchieveItem.GetAchievementTips()); GameObject widget = this.m_shareForm.GetWidget(6); Image component4 = widget.GetComponent <Image>(); component4.SetSprite(this.m_curAchieveItem.GetAchieveImagePath(), this.m_shareForm, true, false, false, false); GameObject widget2 = this.m_shareForm.GetWidget(18); CAchievementSystem.SetAchieveBaseIcon(widget2.transform, this.m_curAchieveItem, this.m_shareForm); Image component5 = this.m_shareForm.GetWidget(20).GetComponent <Image>(); GameObject widget3 = this.m_shareForm.GetWidget(12); GameObject widget4 = this.m_shareForm.GetWidget(19); Text component6 = this.m_shareForm.GetWidget(11).GetComponent <Text>(); Text component7 = widget3.GetComponent <Text>(); Text component8 = this.m_shareForm.GetWidget(16).GetComponent <Text>(); component5.SetSprite(this.m_curTrophyRewardInfo.GetTrophyImagePath(), this.m_shareForm, true, false, false, false); component8.set_text(string.Format("{0}/{1}", this.m_endPoint - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.GetPointStep())); component6.set_text(this.m_curTrophyRewardInfo.Cfg.dwTrophyLvl.ToString()); if (masterAchieveInfo.GetWorldRank() == 0u) { widget4.CustomSetActive(true); widget3.CustomSetActive(false); } else { widget3.CustomSetActive(true); component7.set_text(masterAchieveInfo.GetWorldRank().ToString()); widget4.CustomSetActive(false); } this.DoTrophyTween(); Text component9 = this.m_shareForm.GetWidget(10).GetComponent <Text>(); ShareSys.SetSharePlatfText(component9); if (CSysDynamicBlock.bSocialBlocked) { Transform transform = this.m_shareForm.transform.Find("Panel_ShareAchievement_Btn"); if (transform != null) { transform.gameObject.CustomSetActive(false); } Transform transform2 = this.m_shareForm.transform.Find("Panel_NewAchievement_Btn/Btn_Share"); if (transform2 != null) { transform2.gameObject.CustomSetActive(false); } } }
private void RefreshOverviewForm(CUIFormScript overviewForm = null) { if (overviewForm == null) { overviewForm = Singleton <CUIManager> .GetInstance().GetForm("UGUI/Form/System/Achieve/Form_Trophy_Overview.prefab"); } if (overviewForm == null) { return; } CUIListScript component = overviewForm.GetWidget(1).GetComponent <CUIListScript>(); if (component != null) { component.SetElementAmount(this.m_CurAchieveSeries.Count); } GameObject widget = overviewForm.GetWidget(2); GameObject widget2 = overviewForm.GetWidget(3); GameObject widget3 = overviewForm.GetWidget(7); GameObject widget4 = overviewForm.GetWidget(8); GameObject widget5 = overviewForm.GetWidget(9); GameObject widget6 = overviewForm.GetWidget(10); GameObject widget7 = overviewForm.GetWidget(4); GameObject widget8 = overviewForm.GetWidget(5); GameObject widget9 = overviewForm.GetWidget(6); if (widget == null || widget2 == null || widget3 == null || widget4 == null || widget7 == null || widget8 == null || widget9 == null || widget5 == null || widget6 == null) { DebugHelper.Assert(false, "Some of Trophy overview form widgets is null"); return; } Text component2 = widget.GetComponent <Text>(); Text component3 = widget2.GetComponent <Text>(); Image component4 = widget6.GetComponent <Image>(); Image component5 = widget3.GetComponent <Image>(); Text component6 = widget4.GetComponent <Text>(); CAchieveInfo2 masterAchieveInfo = CAchieveInfo2.GetMasterAchieveInfo(); if (masterAchieveInfo.LastDoneTrophyRewardInfo != null) { component4.SetSprite(masterAchieveInfo.LastDoneTrophyRewardInfo.GetTrophyImagePath(), overviewForm, true, false, false, false); } component2.set_text((masterAchieveInfo.LastDoneTrophyRewardInfo == null) ? "0" : string.Format("{0}", masterAchieveInfo.LastDoneTrophyRewardInfo.Cfg.dwTrophyLvl)); if (masterAchieveInfo.GetWorldRank() == 0u) { widget5.CustomSetActive(true); widget2.CustomSetActive(false); } else { widget5.CustomSetActive(false); widget2.CustomSetActive(true); component3.set_text(masterAchieveInfo.GetWorldRank().ToString()); } uint num = 0u; uint num2 = 0u; masterAchieveInfo.GetTrophyProgress(ref num, ref num2); CTrophyRewardInfo trophyRewardInfoByPoint = masterAchieveInfo.GetTrophyRewardInfoByPoint(num); CTrophyRewardInfo trophyRewardInfoByIndex = masterAchieveInfo.GetTrophyRewardInfoByIndex(trophyRewardInfoByPoint.Index + 1); component5.set_fillAmount(Utility.Divide(num - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.MaxPoint - trophyRewardInfoByIndex.MinPoint)); component6.set_text(string.Format("{0}/{1}", num - trophyRewardInfoByIndex.MinPoint, trophyRewardInfoByIndex.MaxPoint - trophyRewardInfoByIndex.MinPoint)); Text component7 = widget7.GetComponent <Text>(); CUIListScript component8 = widget8.GetComponent <CUIListScript>(); CUIEventScript component9 = widget9.GetComponent <CUIEventScript>(); CTrophyRewardInfo firstTrophyRewardInfoAwardNotGot = masterAchieveInfo.GetFirstTrophyRewardInfoAwardNotGot(); if (firstTrophyRewardInfoAwardNotGot == null) { widget7.CustomSetActive(false); widget9.CustomSetActive(false); component8.SetElementAmount(0); } else { bool flag = false; CUseable[] trophyRewards = firstTrophyRewardInfoAwardNotGot.GetTrophyRewards(); if (!firstTrophyRewardInfoAwardNotGot.HasGotAward() && firstTrophyRewardInfoAwardNotGot.IsFinish()) { flag = true; } widget7.CustomSetActive(true); component7.set_text(string.Format("{0}级奖励:", firstTrophyRewardInfoAwardNotGot.Cfg.dwTrophyLvl)); component8.SetElementAmount(trophyRewards.Length); for (int i = 0; i < trophyRewards.Length; i++) { CUIListElementScript elemenet = component8.GetElemenet(i); CUICommonSystem.SetItemCell(overviewForm, elemenet.GetWidget(0), trophyRewards[i], false, false, false, false); } widget9.CustomSetActive(true); if (flag) { CUICommonSystem.SetButtonEnableWithShader(widget9.GetComponent <Button>(), true, true); component9.SetUIEvent(enUIEventType.Click, enUIEventID.Achievement_Get_Trophy_Reward, new stUIEventParams { tag = firstTrophyRewardInfoAwardNotGot.Index }); } else { CUICommonSystem.SetButtonEnableWithShader(widget9.GetComponent <Button>(), false, true); } } }
private void OnTrophyRewardInfoEnable(CUIEvent uiEvent) { int srcWidgetIndexInBelongedList = uiEvent.m_srcWidgetIndexInBelongedList; int num = (this.m_TrophyRewardInfoWithRewardList == null) ? 0 : this.m_TrophyRewardInfoWithRewardList.Count; if (srcWidgetIndexInBelongedList < 0 || srcWidgetIndexInBelongedList >= num) { return; } CTrophyRewardInfo cTrophyRewardInfo = this.m_TrophyRewardInfoWithRewardList[srcWidgetIndexInBelongedList]; CUIListElementScript cUIListElementScript = uiEvent.m_srcWidgetScript as CUIListElementScript; if (cUIListElementScript == null) { DebugHelper.Assert(false, "achievement reward enable elementscript is null"); return; } GameObject widget = cUIListElementScript.GetWidget(0); GameObject widget2 = cUIListElementScript.GetWidget(1); GameObject widget3 = cUIListElementScript.GetWidget(2); GameObject widget4 = cUIListElementScript.GetWidget(3); GameObject widget5 = cUIListElementScript.GetWidget(4); GameObject widget6 = cUIListElementScript.GetWidget(5); GameObject widget7 = cUIListElementScript.GetWidget(6); GameObject widget8 = cUIListElementScript.GetWidget(7); GameObject widget9 = cUIListElementScript.GetWidget(8); GameObject widget10 = cUIListElementScript.GetWidget(9); GameObject widget11 = cUIListElementScript.GetWidget(10); if (cTrophyRewardInfo.HasGotAward()) { widget.CustomSetActive(false); widget2.CustomSetActive(true); widget5.CustomSetActive(false); widget8.CustomSetActive(false); widget6.CustomSetActive(true); Text component = widget6.GetComponent <Text>(); component.set_text(Singleton <CTextManager> .GetInstance().GetText("Achievement_Trophy_Reward_Status_Got")); widget9.CustomSetActive(false); } else if (cTrophyRewardInfo.IsFinish()) { uint num2 = 0u; for (int i = 0; i < 3; i++) { if (cTrophyRewardInfo.Cfg.astReqReward[i].dwRewardNum != 0u) { num2 += 1u; } } if (num2 == 0u) { widget.CustomSetActive(false); widget2.CustomSetActive(true); widget5.CustomSetActive(false); widget8.CustomSetActive(false); widget6.CustomSetActive(true); Text component2 = widget6.GetComponent <Text>(); component2.set_text(Singleton <CTextManager> .GetInstance().GetText("Achievement_Trophy_Reward_Status_Done")); } else { widget.CustomSetActive(true); widget2.CustomSetActive(false); widget5.CustomSetActive(false); widget8.CustomSetActive(true); widget6.CustomSetActive(false); CUIEventScript component3 = widget8.GetComponent <CUIEventScript>(); if (component3 != null) { component3.SetUIEvent(enUIEventType.Click, enUIEventID.Achievement_Get_Trophy_Reward, new stUIEventParams { tag = cTrophyRewardInfo.Index }); } } widget9.CustomSetActive(false); } else { widget.CustomSetActive(true); widget2.CustomSetActive(false); widget5.CustomSetActive(false); widget8.CustomSetActive(false); widget6.CustomSetActive(true); Text component4 = widget6.GetComponent <Text>(); if (component4 != null) { component4.set_text((cTrophyRewardInfo.State == TrophyState.OnGoing) ? Singleton <CTextManager> .GetInstance().GetText("Achievement_Trophy_Reward_Status_OnGoing") : Singleton <CTextManager> .GetInstance().GetText("Achievement_Trophy_Reward_Status_Not_Done")); } widget9.CustomSetActive(false); } Image component5 = widget3.GetComponent <Image>(); component5.SetSprite(cTrophyRewardInfo.GetTrophyImagePath(), cUIListElementScript.m_belongedFormScript, true, false, false, false); Text component6 = widget4.GetComponent <Text>(); if (component6 != null) { component6.set_text(cTrophyRewardInfo.Cfg.szTrophyDesc); } CUIListScript component7 = widget7.GetComponent <CUIListScript>(); if (component7 != null) { CUseable[] trophyRewards = cTrophyRewardInfo.GetTrophyRewards(); component7.SetElementAmount(trophyRewards.Length); for (int j = 0; j < trophyRewards.Length; j++) { CUIListElementScript elemenet = component7.GetElemenet(j); GameObject widget12 = elemenet.GetWidget(0); if (widget12 != null) { CUseable cUseable = trophyRewards[j]; if (cUseable == null) { component7.SetElementAmount(0); return; } if (trophyRewards.Length >= 5) { CUICommonSystem.SetItemCell(component7.m_belongedFormScript, widget12, cUseable, false, false, false, false); } else { CUICommonSystem.SetItemCell(component7.m_belongedFormScript, widget12, cUseable, true, false, false, false); } if (cUseable.m_stackCount == 1) { Utility.FindChild(widget12, "cntBg").CustomSetActive(false); Utility.FindChild(widget12, "lblIconCount").CustomSetActive(false); } else { Utility.FindChild(widget12, "cntBg").CustomSetActive(true); Utility.FindChild(widget12, "lblIconCount").CustomSetActive(true); } } } } }