public void OnClose() { Service.ViewTimeEngine.UnregisterClockTimeObserver(this); if (this.grid != null) { for (int i = 0; i < 3; i++) { UXElement item = this.grid.GetItem(i); if (item != null && item.Tag != null) { ObjectiveViewData objectiveViewData = item.Tag as ObjectiveViewData; objectiveViewData.BtnSupplyCrate = null; objectiveViewData.Objective = null; objectiveViewData.SpriteCheckmark = null; objectiveViewData.SpriteSupplyCrate = null; objectiveViewData.ObjectiveBgComplete = null; objectiveViewData.ObjectiveBgActive = null; objectiveViewData.ObjectiveBgCollected = null; objectiveViewData.ObjectiveBgExpired = null; if (objectiveViewData.GeoControlCrate != null) { objectiveViewData.GeoControlCrate.Destroy(); } objectiveViewData.GeoControlCrate = null; objectiveViewData.ObjectiveContainer = null; objectiveViewData.ObjectiveContainerLEI = null; } } this.grid.Clear(); } }
public void OnClose() { Service.ViewTimeEngine.UnregisterClockTimeObserver(this); int i = 0; int count = this.data.Count; while (i < count) { ObjectiveViewData objectiveViewData = this.data[i]; objectiveViewData.BtnSupplyCrate = null; objectiveViewData.Objective = null; objectiveViewData.SpriteCheckmark = null; objectiveViewData.RadialProgress = null; objectiveViewData.ExpiredLabel = null; objectiveViewData.SpritePreview = null; objectiveViewData.ObjectiveBgComplete = null; objectiveViewData.ObjectiveBgActive = null; objectiveViewData.ObjectiveBgCollected = null; objectiveViewData.SpecailObjectiveFx = null; objectiveViewData.ObjectiveBgExpired = null; if (objectiveViewData.GeoControlCrate != null) { objectiveViewData.GeoControlCrate.Destroy(); } objectiveViewData.GeoControlCrate = null; if (objectiveViewData.GeoControlIcon != null) { objectiveViewData.GeoControlIcon.Destroy(); } objectiveViewData.GeoControlIcon = null; objectiveViewData.ObjectiveContainer = null; objectiveViewData.ObjectiveContainerLEI = null; i++; } }
private void OnPreviewIconClicked(UXButton button) { ObjectiveViewData objectiveViewData = button.Tag as ObjectiveViewData; ObjectiveProgress objective = objectiveViewData.Objective; if (objective.State == ObjectiveState.Complete) { this.objectiveController.HandleCrateClicked(objective, button); return; } this.OnObjectivesDetailsClicked(button); }
public void OnScreenLoaded() { this.objectiveController = Service.ObjectiveController; this.objectivesPanel = this.screen.GetElement <UXElement>("Objectives"); this.labelOperationsLocked = this.screen.GetElement <UXLabel>("LabelOperationsLocked"); if (!this.objectiveController.ShouldShowObjectives()) { this.objectivesPanel.Visible = false; return; } this.objectiveController = Service.ObjectiveController; this.labelObjectivesTitle = this.screen.GetElement <UXLabel>("LabelObjectivesTitle"); this.labelObjectivesTitle.Text = Service.Lang.Get("OBJECTIVES", new object[0]); this.labelObjectivesTimer = this.screen.GetElement <UXLabel>("LabelObjectivesTimer"); this.btnDetails = this.screen.GetElement <UXButton>("BtnObjectiveDetails"); this.btnDetails.OnClicked = new UXButtonClickedDelegate(this.OnObjectivesDetailsClicked); this.labelBtnDetails = this.screen.GetElement <UXLabel>("LabelBtnDetails"); this.labelBtnDetails.Text = this.lang.Get("objective_details", new object[0]); this.containerJewelObjectives = this.screen.GetElement <UXElement>("ContainerJewelObjectives"); this.containerJewelObjectives.Visible = false; this.specialObjectiveIcon = this.screen.GetElement <UXTexture>("TextureObjectiveSpecial"); this.specialObjectiveFrame = this.screen.GetElement <UXTexture>("TextureObjectiveFrameSpecial"); this.specialObjectiveIcon.Visible = false; this.specialObjectiveFrame.Visible = false; for (int i = 0; i < 3; i++) { ObjectiveViewData objectiveViewData = new ObjectiveViewData(); this.data.Add(objectiveViewData); string text = (i + 1).ToString(); objectiveViewData.BtnSupplyCrate = this.screen.GetElement <UXButton>("BtnSupplyCrate" + text); objectiveViewData.SpriteCheckmark = this.screen.GetElement <UXSprite>("SpriteCheckmark" + text); objectiveViewData.SpritePreview = this.screen.GetElement <UXSprite>("SpriteSupplyCrate" + text); objectiveViewData.RadialProgress = this.screen.GetElement <UXSprite>("SpriteObjectiveProgress" + text); objectiveViewData.ObjectiveBgComplete = this.screen.GetElement <UXElement>("CrateBgComplete" + text); objectiveViewData.ObjectiveBgActive = this.screen.GetElement <UXElement>("CrateBgProgress" + text); objectiveViewData.ObjectiveBgExpired = this.screen.GetElement <UXElement>("CrateBgExpired" + text); objectiveViewData.ObjectiveBgCollected = this.screen.GetElement <UXElement>("CrateBgCollected" + text); objectiveViewData.SpecailObjectiveFx = this.screen.GetElement <UXElement>("CrateEffect" + text); objectiveViewData.BtnSupplyCrate.OnClicked = new UXButtonClickedDelegate(this.OnPreviewIconClicked); objectiveViewData.BtnSupplyCrate.Tag = objectiveViewData; objectiveViewData.ExpiredLabel = this.screen.GetElement <UXLabel>("LabelObjectiveExpired" + text); objectiveViewData.ObjectiveContainer = this.screen.GetElement <UXElement>("ContainerCrateBgProgress3"); objectiveViewData.ObjectiveContainerLEI = ((!(text == "3")) ? this.screen.GetElement <UXElement>("ContainerCrateBgProgress3") : this.screen.GetElement <UXElement>("ContainerCrateBgProgressSpecial3")); } Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f); this.RefreshScreenForPlanetChange(); }
private void OnDelayedScreenLoad(uint timerId, object cookie) { this.screen.GetElement <UXButton>("BtnBackToPlanetFullScreen").OnClicked = new UXButtonClickedDelegate(this.OnBackButtonClicked); this.header = this.screen.GetElement <UXLabel>("LabelObjectivesDetailsHeader"); this.timer = this.screen.GetElement <UXLabel>("LabelObjectivesDetailsTimer"); this.relocation = this.screen.GetElement <UXLabel>("LabelRelocationRequirement"); this.specialEventIcon = this.screen.GetElement <UXTexture>("TextureObjectiveDetailsSpecial"); this.specialEventFrame = this.screen.GetElement <UXTexture>("TextureObjectiveDetailsFrameSpecial"); this.specialEventIcon.Visible = false; this.specialEventFrame.Visible = false; this.btnBack = this.screen.GetElement <UXButton>("BtnBackToPlanet"); this.btnBack.OnClicked = new UXButtonClickedDelegate(this.OnBackButtonClicked); this.grid = this.screen.GetElement <UXGrid>("GridObjective"); this.grid.Clear(); this.grid.SetTemplateItem("TemplateObjective"); for (int i = 0; i < 3; i++) { string itemUid = i.ToString(); UXElement uXElement = this.grid.CloneTemplateItem(itemUid); ObjectiveViewData objectiveViewData = new ObjectiveViewData(); objectiveViewData.BtnSupplyCrate = this.grid.GetSubElement <UXButton>(itemUid, "BtnSupplyCrate"); objectiveViewData.BtnSupplyCrate.OnClicked = new UXButtonClickedDelegate(this.objectiveController.OnCrateClickedFromDetail); objectiveViewData.BtnSupplyCrate.Tag = objectiveViewData; objectiveViewData.SpriteCheckmark = this.grid.GetSubElement <UXSprite>(itemUid, "SpriteCheckmark"); objectiveViewData.SpriteSupplyCrate = this.grid.GetSubElement <UXSprite>(itemUid, "SpriteSupplyCrate"); objectiveViewData.ObjectiveBgComplete = this.grid.GetSubElement <UXElement>(itemUid, "TemplateObjectiveCompleteBg"); objectiveViewData.ObjectiveBgCollected = this.grid.GetSubElement <UXElement>(itemUid, "TemplateObjectiveCollectedBg"); objectiveViewData.ObjectiveBgActive = this.grid.GetSubElement <UXElement>(itemUid, "TemplateObjectiveProgressBg"); objectiveViewData.SpecailObjectiveFx = this.grid.GetSubElement <UXElement>(itemUid, "CrateDetailEffect"); objectiveViewData.ObjectiveBgExpired = this.grid.GetSubElement <UXElement>(itemUid, "TemplateObjectiveExpiredBg"); objectiveViewData.StatusLabel = this.grid.GetSubElement <UXLabel>(itemUid, "LabelObjectiveDetailStatus"); objectiveViewData.TitleLabel = this.grid.GetSubElement <UXLabel>(itemUid, "LabelObjectiveDetailName"); objectiveViewData.ProgressSlider = this.grid.GetSubElement <UXSlider>(itemUid, "PBarObjectiveDetail"); objectiveViewData.SpriteObjectiveIcon = this.grid.GetSubElement <UXSprite>(itemUid, "SpriteUnit"); objectiveViewData.ObjectiveContainer = this.grid.GetSubElement <UXElement>(itemUid, "TemplateObjectiveProgressBg"); objectiveViewData.ObjectiveContainerLEI = this.grid.GetSubElement <UXElement>(itemUid, "TemplateObjectiveSpecialBg"); uXElement.Tag = objectiveViewData; this.grid.AddItem(uXElement, i); } this.grid.RepositionItems(); this.details.Visible = false; }
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); }