示例#1
0
 private void Grace(string planetUid, ObjectiveGroup group)
 {
     if (planetUid == Service.CurrentPlayer.PlanetId)
     {
         this.ClearProcessorMap(false);
     }
 }
示例#2
0
        public void OnViewClockTime(float dt)
        {
            string planetDisplayName = LangUtils.GetPlanetDisplayName(this.screen.viewingPlanetVO);

            if (!this.player.Objectives.ContainsKey(this.screen.viewingPlanetVO.Uid) || this.player.Objectives[this.screen.viewingPlanetVO.Uid].ProgressObjects.Count <= 0)
            {
                this.timer.Text      = this.lang.Get("NO_OBJECTIVES_AVAILABLE", new object[0]);
                this.timer.TextColor = ObjectiveController.TEXT_WHITE_COLOR;
                this.header.Text     = this.lang.Get("OBJECTIVE_DETAILS_HEADER", new object[]
                {
                    planetDisplayName
                });
                return;
            }
            ObjectiveGroup    objectiveGroup    = this.player.Objectives[this.screen.viewingPlanetVO.Uid];
            ObjectiveSeriesVO objectiveSeriesVO = Service.StaticDataController.Get <ObjectiveSeriesVO>(objectiveGroup.GroupSeriesId);

            this.objectiveController.GetTimeData(this.lang, objectiveGroup, ref this.tempIsGrace, ref this.tempTimeString);
            if (objectiveSeriesVO.SpecialEvent)
            {
                this.header.Text = ((!this.tempIsGrace) ? this.lang.Get(objectiveSeriesVO.ObjectiveString, new object[0]) : this.lang.Get(objectiveSeriesVO.ObjectiveExpiringString, new object[0]));
            }
            else
            {
                this.header.Text = ((!this.tempIsGrace) ? this.lang.Get("OBJECTIVE_DETAILS_HEADER", new object[]
                {
                    planetDisplayName
                }) : this.lang.Get("OBJECTIVES_DETAILS_HEADER_EXPIRED", new object[]
                {
                    planetDisplayName
                }));
            }
            this.timer.Text      = this.tempTimeString;
            this.timer.TextColor = ((!this.tempIsGrace) ? ObjectiveController.TEXT_RED_COLOR : ObjectiveController.TEXT_YELLOW_COLOR);
        }
示例#3
0
        public void RefreshScreenForPlanetChange()
        {
            if (!this.CanRefresh(this.player))
            {
                this.objectivesPanel.Visible = false;
                if (this.objectiveController.ShouldShowObjectives())
                {
                    this.labelOperationsLocked.Visible = true;
                    this.labelOperationsLocked.Text    = this.lang.Get("NO_OBJECTIVES_AVAILABLE", new object[0]);
                }
                return;
            }
            if (!this.player.Objectives.ContainsKey(this.screen.viewingPlanetVO.Uid) || this.player.Objectives[this.screen.viewingPlanetVO.Uid].ProgressObjects.Count == 0)
            {
                this.objectivesPanel.Visible       = false;
                this.labelOperationsLocked.Visible = true;
                this.labelOperationsLocked.Text    = this.lang.Get("NO_OBJECTIVES_AVAILABLE", new object[0]);
                this.specialObjectiveIcon.Visible  = false;
                this.specialObjectiveFrame.Visible = false;
                return;
            }
            this.objectiveController.GetTimeData(this.lang, this.player.Objectives[this.screen.viewingPlanetVO.Uid], ref this.tempIsGrace, ref this.tempTimeString);
            this.objectivesPanel.Visible = true;
            ObjectiveGroup    objectiveGroup    = this.player.Objectives[this.screen.viewingPlanetVO.Uid];
            ObjectiveSeriesVO objectiveSeriesVO = Service.StaticDataController.Get <ObjectiveSeriesVO>(objectiveGroup.GroupSeriesId);

            this.specialObjectiveIcon.Visible  = objectiveSeriesVO.SpecialEvent;
            this.specialObjectiveFrame.Visible = objectiveSeriesVO.SpecialEvent;
            if (objectiveSeriesVO.SpecialEvent)
            {
                this.specialObjectiveIcon.LoadTexture(objectiveSeriesVO.EventIcon);
                this.specialObjectiveFrame.LoadTexture(objectiveSeriesVO.EventPlayArt);
                this.labelObjectivesTitle.Text = Service.Lang.Get(objectiveSeriesVO.ObjectiveString, new object[0]);
            }
            else
            {
                this.labelObjectivesTitle.Text = Service.Lang.Get("OBJECTIVES", new object[0]);
            }
            int i   = 0;
            int num = 3;

            while (i < num)
            {
                if (i >= objectiveGroup.ProgressObjects.Count)
                {
                    this.data[i].Objective = null;
                    this.data[i].BtnSupplyCrate.Visible = false;
                }
                else
                {
                    ObjectiveProgress objective = objectiveGroup.ProgressObjects[i];
                    this.data[i].Objective = objective;
                    this.data[i].BtnSupplyCrate.Visible     = true;
                    this.data[i].SpecailObjectiveFx.Visible = objectiveSeriesVO.SpecialEvent;
                    this.objectiveController.UpdateObjectiveEntry(this.data[i], this.tempIsGrace);
                }
                i++;
            }
            this.OnViewClockTime(0f);
        }
示例#4
0
        public int GetObjectiveProgressIndex(string objectiveUid)
        {
            int            num            = 0;
            CurrentPlayer  currentPlayer  = Service.CurrentPlayer;
            string         planetId       = currentPlayer.PlanetId;
            ObjectiveGroup objectiveGroup = null;

            if (objectiveUid != null && planetId != null && currentPlayer.Objectives != null && currentPlayer.Objectives.TryGetValue(planetId, out objectiveGroup))
            {
                int i     = 0;
                int count = objectiveGroup.ProgressObjects.Count;
                while (i < count)
                {
                    ObjectiveProgress objectiveProgress = objectiveGroup.ProgressObjects[i];
                    if (objectiveProgress.ObjectiveUid != null && objectiveProgress.ObjectiveUid == objectiveUid)
                    {
                        num = i + 1;
                        break;
                    }
                    i++;
                }
            }
            if (num == 0)
            {
                Service.Logger.ErrorFormat("Failed to get Objective progressIndex for uid:{0}", new object[]
                {
                    objectiveUid
                });
            }
            return(num);
        }
示例#5
0
        protected override void FillProcessorMap()
        {
            if (this.processorMap.Count > 0)
            {
                Service.Logger.Error("Attempting to fill an already-full processorMap!");
            }
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            string        planetId      = currentPlayer.PlanetId;

            if (currentPlayer.Objectives.ContainsKey(planetId))
            {
                ObjectiveGroup objectiveGroup = currentPlayer.Objectives[planetId];
                int            i     = 0;
                int            count = objectiveGroup.ProgressObjects.Count;
                while (i < count)
                {
                    ObjectiveProgress objectiveProgress = objectiveGroup.ProgressObjects[i];
                    if (objectiveProgress.State == ObjectiveState.Active)
                    {
                        BaseGoalProcessor processor = GoalFactory.GetProcessor(objectiveProgress.VO, this);
                        this.processorMap.Add(processor, objectiveProgress);
                    }
                    i++;
                }
            }
        }
示例#6
0
 private void Expire(string planetUid, ObjectiveGroup group)
 {
     if (planetUid == Service.CurrentPlayer.PlanetId)
     {
         this.ClearProcessorMap(false);
     }
     group.ProgressObjects.Clear();
 }
示例#7
0
 public int GetRemainingTime(int now, ObjectiveGroup group)
 {
     if (this.IsGracePeriod(now, group))
     {
         return(group.EndTimestamp - now);
     }
     return(group.GraceTimestamp - now);
 }
示例#8
0
        public override ISerializable FromObject(object obj)
        {
            Dictionary <string, object> dictionary = obj as Dictionary <string, object>;

            if (dictionary != null)
            {
                this.Group = (new ObjectiveGroup(this.planetUid).FromObject(dictionary) as ObjectiveGroup);
            }
            return(this);
        }
示例#9
0
        public void GetTimeData(Lang lang, ObjectiveGroup group, ref bool isGrace, ref string timeRemainingString)
        {
            int serverTime   = (int)Service.ServerAPI.ServerTime;
            int totalSeconds = Math.Max(0, this.GetRemainingTime(serverTime, group));

            isGrace             = this.IsGracePeriod(serverTime, group);
            timeRemainingString = ((!isGrace) ? lang.Get("expires_in", new object[]
            {
                GameUtils.GetTimeLabelFromSeconds(totalSeconds)
            }) : lang.Get("grace_period", new object[]
            {
                GameUtils.GetTimeLabelFromSeconds(totalSeconds)
            }));
        }
示例#10
0
        public int GetCompletedObjectivesCount()
        {
            int           num           = 0;
            CurrentPlayer currentPlayer = Service.CurrentPlayer;

            foreach (KeyValuePair <string, ObjectiveGroup> current in currentPlayer.Objectives)
            {
                ObjectiveGroup value = current.Value;
                int            i     = 0;
                int            count = value.ProgressObjects.Count;
                while (i < count)
                {
                    ObjectiveProgress objectiveProgress = value.ProgressObjects[i];
                    if (objectiveProgress.State == ObjectiveState.Complete)
                    {
                        num++;
                    }
                    i++;
                }
            }
            return(num);
        }
示例#11
0
        private string GetBILoggingMessageForCrates(ObjectiveProgress progress, string location)
        {
            ObjectiveVO         objectiveVO        = Service.StaticDataController.Get <ObjectiveVO>(progress.ObjectiveUid);
            string              value              = string.Empty;
            PlanetDetailsScreen highestLevelScreen = Service.ScreenController.GetHighestLevelScreen <PlanetDetailsScreen>();
            string              value2             = string.Empty;

            if (highestLevelScreen != null)
            {
                ObjectiveGroup objectiveGroup = this.player.Objectives[highestLevelScreen.viewingPlanetVO.Uid];
                value  = objectiveGroup.GroupId;
                value2 = highestLevelScreen.viewingPlanetVO.PlanetBIName;
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(value).Append("|");
            stringBuilder.Append(objectiveVO.Uid).Append("|");
            stringBuilder.Append(objectiveVO.CrateRewardUid).Append("|");
            stringBuilder.Append(location).Append("|");
            stringBuilder.Append(value2);
            return(stringBuilder.ToString());
        }
示例#12
0
        public void RefreshScreenForPlanetChange()
        {
            if (!this.objectiveController.ShouldShowObjectives())
            {
                return;
            }
            if (this.specialEventIcon == null || this.specialEventFrame == null || this.player.Objectives == null || this.screen.viewingPlanetVO == null || this.grid == null || this.relocation == null)
            {
                return;
            }
            this.tempIsGrace = true;
            this.specialEventIcon.Visible  = false;
            this.specialEventFrame.Visible = false;
            string planetDisplayName = LangUtils.GetPlanetDisplayName(this.screen.viewingPlanetVO);

            if (this.player.Objectives.ContainsKey(this.screen.viewingPlanetVO.Uid))
            {
                this.objectiveController.GetTimeData(this.lang, this.player.Objectives[this.screen.viewingPlanetVO.Uid], ref this.tempIsGrace, ref this.tempTimeString);
                ObjectiveGroup objectiveGroup = this.player.Objectives[this.screen.viewingPlanetVO.Uid];
                if (objectiveGroup == null)
                {
                    Service.Logger.WarnFormat("Player objectives for planet {0} are null", new object[]
                    {
                        this.screen.viewingPlanetVO.Uid
                    });
                    return;
                }
                ObjectiveSeriesVO objectiveSeriesVO = Service.StaticDataController.Get <ObjectiveSeriesVO>(objectiveGroup.GroupSeriesId);
                if (objectiveGroup.ProgressObjects != null && objectiveGroup.ProgressObjects.Count > 0)
                {
                    this.specialEventIcon.Visible  = objectiveSeriesVO.SpecialEvent;
                    this.specialEventFrame.Visible = objectiveSeriesVO.SpecialEvent;
                }
                if (objectiveSeriesVO.SpecialEvent)
                {
                    this.specialEventIcon.LoadTexture(objectiveSeriesVO.EventIcon);
                    this.specialEventFrame.LoadTexture(objectiveSeriesVO.EventDetailsArt);
                }
                int i   = 0;
                int num = 3;
                while (i < num)
                {
                    UXElement         item = this.grid.GetItem(i);
                    ObjectiveViewData objectiveViewData = item.Tag as ObjectiveViewData;
                    if (i >= objectiveGroup.ProgressObjects.Count)
                    {
                        item.Visible = false;
                    }
                    else
                    {
                        item.Visible = true;
                        objectiveViewData.SpecailObjectiveFx.Visible = objectiveSeriesVO.SpecialEvent;
                        objectiveViewData.Objective = objectiveGroup.ProgressObjects[i];
                        this.objectiveController.UpdateObjectiveEntry(objectiveViewData, this.tempIsGrace);
                    }
                    i++;
                }
            }
            else
            {
                this.header.Text = this.lang.Get("OBJECTIVE_DETAILS_HEADER", new object[]
                {
                    planetDisplayName
                });
                int j    = 0;
                int num2 = 3;
                while (j < num2)
                {
                    UXElement item2 = this.grid.GetItem(j);
                    item2.Visible = false;
                    j++;
                }
            }
            if (this.screen.viewingPlanetVO == this.player.Planet || this.tempIsGrace)
            {
                this.relocation.Text = string.Empty;
            }
            else
            {
                this.relocation.Text = this.lang.Get("RELOCATE_TO_PLANET_MESSAGE", new object[]
                {
                    planetDisplayName
                });
            }
            this.OnViewClockTime(0f);
        }
示例#13
0
 public bool IsGracePeriod(int now, ObjectiveGroup group)
 {
     return(now > group.GraceTimestamp && now < group.EndTimestamp);
 }