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 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);
                }
            }
        }
Exemplo n.º 3
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);
                }
            }
        }