public void OnCrateClickedFromDetail(UXButton button) { ObjectiveViewData objectiveViewData = button.Tag as ObjectiveViewData; ObjectiveProgress objective = objectiveViewData.Objective; if (objective.State == ObjectiveState.Rewarded) { return; } this.HandleCrateClicked(objective, button); if (objective.State == ObjectiveState.Active) { string bILoggingMessageForCrates = this.GetBILoggingMessageForCrates(objective, "details"); Service.EventManager.SendEvent(EventId.ObjectiveLockedCrateClicked, bILoggingMessageForCrates); } }
public void UpdateObjectiveEntry(ObjectiveViewData objectiveData, bool isGrace) { ObjectiveProgress objective = objectiveData.Objective; UXSprite spriteCheckmark = objectiveData.SpriteCheckmark; UXSprite spriteSupplyCrate = objectiveData.SpriteSupplyCrate; UXSprite spriteObjectiveIcon = objectiveData.SpriteObjectiveIcon; UXSprite spritePreview = objectiveData.SpritePreview; UXLabel statusLabel = objectiveData.StatusLabel; UXLabel titleLabel = objectiveData.TitleLabel; UXSlider progressSlider = objectiveData.ProgressSlider; UXSprite radialProgress = objectiveData.RadialProgress; UXLabel expiredLabel = objectiveData.ExpiredLabel; UXSprite spriteObjectiveExpired = objectiveData.SpriteObjectiveExpired; UXElement objectiveBgComplete = objectiveData.ObjectiveBgComplete; UXElement objectiveBgCollected = objectiveData.ObjectiveBgCollected; UXElement objectiveBgExpired = objectiveData.ObjectiveBgExpired; UXElement objectiveBgActive = objectiveData.ObjectiveBgActive; UXElement objectiveContainer = objectiveData.ObjectiveContainer; UXElement objectiveContainerLEI = objectiveData.ObjectiveContainerLEI; bool flag = objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace); Lang lang = Service.Lang; ObjectiveVO vO = objectiveData.Objective.VO; string crateRewardUid = vO.CrateRewardUid; CrateVO optional = Service.StaticDataController.GetOptional <CrateVO>(crateRewardUid); if (optional == null) { Service.Logger.ErrorFormat("The objective {0} specifies an invalid crateRewardUid {1}", new object[] { vO.Uid, crateRewardUid }); return; } string value = null; if (objectiveContainerLEI != null) { FactionType faction = Service.CurrentPlayer.Faction; if (faction != FactionType.Rebel) { if (faction == FactionType.Empire) { value = optional.EmpireLEIUid; } } else { value = optional.RebelLEIUid; } } if (objectiveBgCollected == null || objectiveContainer == null || objectiveContainerLEI == null || objectiveBgComplete == null || objectiveBgExpired == null) { Service.Logger.Error("ObjectiveViewData is initialized incompletely"); } else { ObjectiveState state = objective.State; if (state != ObjectiveState.Active) { if (state != ObjectiveState.Complete) { if (state == ObjectiveState.Rewarded) { objectiveBgCollected.Visible = true; objectiveBgExpired.Visible = false; objectiveContainer.Visible = false; objectiveContainerLEI.Visible = false; objectiveBgComplete.Visible = false; objectiveBgActive.Visible = false; } } else { objectiveBgComplete.Visible = true; objectiveBgExpired.Visible = false; objectiveContainer.Visible = false; objectiveContainerLEI.Visible = false; objectiveBgCollected.Visible = false; objectiveBgActive.Visible = false; } } else if (isGrace) { objectiveBgExpired.Visible = true; objectiveBgCollected.Visible = false; objectiveContainer.Visible = false; objectiveContainerLEI.Visible = false; objectiveBgComplete.Visible = false; objectiveBgActive.Visible = false; } else { objectiveContainerLEI.Visible = !string.IsNullOrEmpty(value); objectiveContainer.Visible = string.IsNullOrEmpty(value); objectiveBgActive.Visible = true; objectiveBgExpired.Visible = false; objectiveBgCollected.Visible = false; objectiveBgComplete.Visible = false; } } if (progressSlider != null) { if (objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace)) { progressSlider.Visible = true; progressSlider.Value = (float)objective.Count / (float)objective.Target; } else { progressSlider.Visible = false; } } if (radialProgress != null) { if (objective.State == ObjectiveState.Complete || (objective.State == ObjectiveState.Active && !isGrace)) { radialProgress.Visible = true; radialProgress.FillAmount = (float)objective.Count / (float)objective.Target; } else { radialProgress.Visible = false; } } if (expiredLabel != null) { expiredLabel.Visible = (isGrace && objective.State == ObjectiveState.Active); } if (spriteObjectiveExpired != null) { spriteObjectiveExpired.Visible = (isGrace && objective.State == ObjectiveState.Active); } if (statusLabel != null) { ObjectiveState state2 = objective.State; if (state2 != ObjectiveState.Active) { if (state2 != ObjectiveState.Complete) { if (state2 == ObjectiveState.Rewarded) { statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR); statusLabel.Text = lang.Get("OBJECTIVE_COLLECTED", new object[] { lang.ThousandsSeparated(objective.Count), lang.ThousandsSeparated(objective.Target) }); } } else { statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR); statusLabel.Text = lang.Get("OBJECTIVE_ACTIVE_UNLOCKED", new object[] { lang.ThousandsSeparated(objective.Count), lang.ThousandsSeparated(objective.Target) }); } } else if (isGrace) { statusLabel.TextColor = ObjectiveController.TEXT_RED_DIM_COLOR; statusLabel.Text = lang.Get("OBJECTIVE_EXPIRED", new object[0]); } else { statusLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREEN_DIM_COLOR : ObjectiveController.TEXT_GREEN_COLOR); statusLabel.Text = lang.Get("OBJECTIVE_PROGRESS", new object[] { lang.ThousandsSeparated(objective.Count), lang.ThousandsSeparated(objective.Target) }); } } if (titleLabel != null) { titleLabel.Text = lang.Get(objective.VO.ObjString, new object[] { lang.ThousandsSeparated(objective.Target) }); titleLabel.TextColor = ((!flag) ? ObjectiveController.TEXT_GREY_COLOR : ObjectiveController.TEXT_WHITE_COLOR); } UXSprite uXSprite = null; UXSprite uXSprite2 = null; if (spriteSupplyCrate != null) { spriteSupplyCrate.Tag = objectiveData; uXSprite2 = spriteSupplyCrate; ObjectiveState state3 = objective.State; if (state3 != ObjectiveState.Active) { if (state3 != ObjectiveState.Complete) { if (state3 == ObjectiveState.Rewarded) { spriteCheckmark.Visible = true; spriteCheckmark.SpriteName = "IcoCheck"; spriteSupplyCrate.Alpha = 0.6f; spriteSupplyCrate.Visible = true; } } else { spriteCheckmark.Visible = false; spriteSupplyCrate.Alpha = 1f; spriteSupplyCrate.Visible = true; } } else { spriteCheckmark.Visible = false; spriteSupplyCrate.Visible = !isGrace; } } if (spritePreview != null) { spritePreview.Tag = objectiveData; ObjectiveState state4 = objective.State; if (state4 != ObjectiveState.Active) { if (state4 != ObjectiveState.Complete) { if (state4 == ObjectiveState.Rewarded) { uXSprite2 = spritePreview; uXSprite = null; spriteCheckmark.Visible = true; spriteCheckmark.SpriteName = "IcoCheck"; } } else { uXSprite2 = spritePreview; uXSprite = null; spriteCheckmark.Visible = false; } } else { uXSprite = spritePreview; uXSprite2 = null; spriteCheckmark.Visible = isGrace; spriteCheckmark.SpriteName = "icoCancelRed"; } } if (spriteObjectiveIcon != null) { uXSprite = spriteObjectiveIcon; } if (objectiveData.GeoControlCrate != null) { objectiveData.GeoControlCrate.Destroy(); } if (objectiveData.GeoControlIcon != null) { objectiveData.GeoControlIcon.Destroy(); } if (uXSprite2 != null) { ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(optional, uXSprite2); projectorConfig.AnimState = this.GetAnimStateFromObjectiveState(objectiveData.Objective.State); projectorConfig.AnimPreference = AnimationPreference.AnimationAlways; projectorConfig.Outline = (objective.State == ObjectiveState.Complete); projectorConfig.OutlineInner = GameConstants.CRATE_OUTLINE_INNER; projectorConfig.OutlineOuter = GameConstants.CRATE_OUTLINE_OUTER; objectiveData.GeoControlCrate = ProjectorUtils.GenerateProjector(projectorConfig); uXSprite2.Alpha = ((!flag) ? 0.5f : 1f); } if (uXSprite != null) { IGeometryVO iconVOFromObjective = GameUtils.GetIconVOFromObjective(objectiveData.Objective.VO, objectiveData.Objective.HQ); ProjectorConfig projectorConfig2 = ProjectorUtils.GenerateGeometryConfig(iconVOFromObjective, uXSprite); projectorConfig2.AnimPreference = AnimationPreference.AnimationPreferred; objectiveData.GeoControlIcon = ProjectorUtils.GenerateProjector(projectorConfig2); uXSprite.Alpha = ((!flag) ? 0.5f : 1f); } }