Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
        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);
                }
            }
        }