protected override void onRefresh()
        {
            Player player = GameLogic.Binder.GameState.Player;

            base.m_contentMenu.refreshTitle(StringExtensions.ToUpperLoca(_.L(ConfigLoca.DHUD_BUTTON_MISSIONS, null, false)), string.Empty, string.Empty);
            bool flag = player.Missions.hasMissionOnCooldown();

            this.m_sortedMissionInstanceList.Clear();
            for (int i = 0; i < player.Missions.Instances.Count; i++)
            {
                this.m_sortedMissionInstanceList.Add(player.Missions.Instances[i]);
            }
            this.m_sortedMissionInstanceList.Sort(new Comparison <MissionInstance>(MissionInstance.CompareByCooldown));
            for (int j = 0; j < this.m_missionCells.Count; j++)
            {
                MissionCell cell = this.m_missionCells[j];
                if (j < this.m_sortedMissionInstanceList.Count)
                {
                    MissionInstance mission = this.m_sortedMissionInstanceList[j];
                    bool            flag2   = mission.getRemainingCooldownSeconds() > 0L;
                    cell.gameObject.SetActive(!flag2);
                    if (!flag2)
                    {
                        if (App.Binder.ConfigMeta.NOTIFY_NEW_MISSIONS_DURING_WELCOME_BACK)
                        {
                            CmdInspectMission.ExecuteStatic(player, mission);
                        }
                        cell.refresh(player, mission, (j < player.Missions.Instances.Count) || flag, null, null);
                        if (!App.Binder.ConfigMeta.NOTIFY_NEW_MISSIONS_DURING_WELCOME_BACK)
                        {
                            CmdInspectMission.ExecuteStatic(player, mission);
                        }
                    }
                }
                else
                {
                    cell.gameObject.SetActive(false);
                }
            }
            if (flag)
            {
                this.MasterCooldownRootTm.gameObject.SetActive(true);
                this.MasterCooldownText.text = MenuHelpers.SecondsToStringHoursMinutes(player.Missions.getMinRemainingCooldownSeconds());
                this.MasterCooldownRootTm.SetAsLastSibling();
            }
            else
            {
                this.MasterCooldownRootTm.gameObject.SetActive(false);
            }
            int amount = player.Missions.getNumCompletedMissionsRequiredForBigPrize();
            int num4   = amount - Mathf.Max(amount - player.Missions.NumUnclaimedMissionCompletions, 0);

            this.MasterDescription.text = _.L(ConfigLoca.MISSIONS_BIG_PRIZE, new < > __AnonType9 <int>(amount), false);
            this.MasterProgressBar.setNormalizedValue(Mathf.Clamp01(((float)num4) / ((float)amount)));
            this.MasterProgressBarText.text = num4 + " / " + amount;
        }
Beispiel #2
0
        public void refresh(Player player, MissionInstance mission, bool doShowDivider, [Optional, DefaultParameterValue(null)] string titleOverride, [Optional, DefaultParameterValue(null)] string descriptionOverride)
        {
            double num;
            float  v = mission.getMissionProgress(player, out num);

            num = (num <= mission.Requirement) ? num : mission.Requirement;
            ConfigMissions.Mission missionData = ConfigMissions.GetMissionData(mission.MissionId);
            long  totalSeconds = mission.getRemainingCooldownSeconds();
            bool  flag         = ((mission.MissionType == MissionType.PromotionEvent) && (v == 1.0)) && !mission.OnCooldown;
            bool  flag2        = (mission.MissionType == MissionType.PromotionEvent) && mission.OnCooldown;
            Image image        = (mission.MissionType != MissionType.PromotionEvent) ? this.RewardIconBig : this.RewardIconSmall;

            this.IconBgGolden.gameObject.SetActive(flag);
            this.ProgressBarFgGolden.gameObject.SetActive(flag);
            this.ProgressBarText.gameObject.SetActive(!flag);
            this.CooldownRoot.SetActive(flag2);
            this.Title.gameObject.SetActive(!flag2);
            this.Description.gameObject.SetActive(!flag2);
            this.ProgressBar.gameObject.SetActive(!flag2);
            this.RewardText.gameObject.SetActive(!(flag2 || flag));
            this.RewardIconSmall.gameObject.SetActive(false);
            this.RewardIconBig.gameObject.SetActive(false);
            image.gameObject.SetActive(!(flag2 || flag));
            this.Divider.SetActive(doShowDivider);
            if (mission.MissionType == MissionType.PromotionEvent)
            {
                this.CooldownSubtitle.text = _.L(ConfigLoca.PROMOTION_EVENT_MISSION_AVAILABLE_IN, null, false);
            }
            this.CooldownTime.text = MenuHelpers.SecondsToStringDaysHoursMinutes(totalSeconds, true);
            this.Icon.sprite       = (mission.MissionType != MissionType.PromotionEvent) ? PlayerView.Binder.SpriteResources.getSprite(missionData.Icon) : PlayerView.Binder.SpriteResources.getSprite(ConfigMissions.PROMOTION_EVENT_MISSION_ICON);
            this.Icon.material     = !flag2 ? null : PlayerView.Binder.DisabledUiMaterial;
            this.IconBg.material   = !flag2 ? null : PlayerView.Binder.DisabledUiMaterial;
            this.Notifier.SetActive(!mission.Inspected);
            this.Title.text       = StringExtensions.ToUpperLoca((titleOverride == null) ? _.L(missionData.Title, null, false) : titleOverride);
            this.Description.text = !flag?missionData.getFormattedMissionDescription(mission.Requirement, true, descriptionOverride) : _.L(ConfigLoca.MISSION_COMPLETED, null, false);

            this.ProgressBarText.text = num + " / " + mission.Requirement;
            this.ProgressBar.setNormalizedValue(v);
            image.sprite         = ConfigMissions.GetMissionRewardIcon(mission);
            this.RewardText.text = ConfigMissions.GetMissionRewardTitle(mission);
        }