public string GetColorizedLocalizedName(Empire empireLooking, bool useYou = false) { if (useYou && this.Empire == empireLooking) { return(GuiEmpire.Colorize(this.Empire, AgeLocalizer.Instance.LocalizeString("%YouTitle"))); } return(GuiEmpire.Colorize(this.Empire, this.Empire.LocalizedName)); }
public static string GetFactionSymbolString(Empire empire, Empire empireLooking) { if (GuiEmpire.IsKnownByLookingPlayer(empire, empireLooking)) { GuiFaction guiFaction = new GuiFaction(empire.Faction); return(guiFaction.Icon); } return("\\7800\\"); }
public string GetColorizedLocalizedNameAndFaction(Empire empireLooking, bool useYou = false) { if (useYou && this.Empire == empireLooking) { return(GuiEmpire.Colorize(this.Empire, AgeLocalizer.Instance.LocalizeString("%YouTitle"))); } if (TutorialManager.IsActivated) { return(GuiEmpire.Colorize(this.Empire, this.Empire.LocalizedName)); } return(GuiEmpire.Colorize(this.Empire, this.Empire.LocalizedName + " - " + this.GuiFaction.LocalizedName)); }
private void UpdateBackgroundImage() { if (this.BackgroundImage == null) { return; } if (this.SelectedEmpire == null) { this.BackgroundImage.Image = null; return; } GuiEmpire guiEmpire = new GuiEmpire(this.SelectedEmpire); this.BackgroundImage.Image = guiEmpire.GetImageTexture(global::GuiPanel.IconSize.NegotiationLarge, base.Empire); }
public Texture2D GetImageTexture(StaticString size, Empire empireLooking) { bool flag = this.Empire is MajorEmpire && (this.Empire as MajorEmpire).IsSpectator; if (this.Empire.SimulationObject.Tags.Contains(Empire.TagEmpireEliminated) && !flag) { if (size == GuiPanel.IconSize.LogoSmall) { return(AgeManager.Instance.FindDynamicTexture("eliminatedLogoSmall", false)); } return(AgeManager.Instance.FindDynamicTexture("Gui/DynamicBitmaps/Factions/elimination" + size, false)); } else { if (GuiEmpire.IsKnownByLookingPlayer(this.Empire, empireLooking) || flag) { return(this.GuiFaction.GetImageTexture(size, false)); } return(this.GuiFaction.GetRandomImageTexture(size)); } }
private void Set_FortressOwnerIcon(global::Empire empire, global::Empire playerEmpire) { this.Empire = empire; this.PlayerEmpire = playerEmpire; if (this.Empire != null) { if (!this.IsKnownByEmpirePlayer) { this.EmpireLabel.Text = GuiEmpire.Colorize(this.Empire, "???"); } else { this.EmpireLabel.Text = GuiEmpire.Colorize(this.Empire, GuiEmpire.GetFactionSymbolString(this.Empire, this.PlayerEmpire)); } } else { this.EmpireLabel.Text = string.Empty; AgePrimitiveLabel empireLabel = this.EmpireLabel; empireLabel.Text += 'Ẑ'; } }
private void DisplayQuestFailed() { this.WriteSummaryDescription(); int failedStepRank = (this.guiNotification as GuiNotificationQuestFailed).FailedStepRank; QuestStep step; if (failedStepRank >= 0 && failedStepRank < this.Quest.QuestDefinition.Steps.Length) { step = this.Quest.QuestDefinition.Steps[failedStepRank]; } else { step = null; } Diagnostics.Assert(failedStepRank != -1, "There wasn't any step in progress when the quest failed"); this.LeftTitleLabel.Text = "%NotificationQuestFailedObjectiveTitle"; this.LeftSummary.Hide(); this.LeftStepItem.Show(this.Quest, step, failedStepRank, this.empire); string arg = this.Quest.QuestDefinition.Name; if (this.questGuiElement != null) { arg = AgeLocalizer.Instance.LocalizeString(this.questGuiElement.Title); } string text = string.Empty; bool flag = false; if (this.Quest.QuestDefinition.IsGlobal && this.Quest.QuestDefinition.GlobalWinner == GlobalQuestWinner.First && this.Quest.QuestState == QuestState.Failed) { flag = true; QuestRegisterVariable questRegisterVariable = null; if (this.Quest.QuestVariables.TryGetValue(QuestDefinition.WinnerVariableName, out questRegisterVariable) && questRegisterVariable != null) { if (this.game == null) { IGameService service = Services.GetService <IGameService>(); Diagnostics.Assert(service != null && service.Game != null && service.Game is global::Game); this.game = (service.Game as global::Game); } int value = questRegisterVariable.Value; if (this.departmentOfForeignAffairs.GetDiplomaticRelation(this.game.Empires[value]).State.Name == DiplomaticRelationState.Names.Unknown) { text = AgeLocalizer.Instance.LocalizeString("%UnknownEmpire"); } else { text = new GuiEmpire(this.game.Empires[value]).GetColorizedLocalizedNameAndFaction(this.empire, false); } } } string text2; if (flag) { text2 = string.Format(AgeLocalizer.Instance.LocalizeString("%NotificationQuestFailedCompetitiveDescription"), arg); if (!string.IsNullOrEmpty(text.Trim())) { text2 = text2 + "\n" + string.Format(AgeLocalizer.Instance.LocalizeString("%NotificationQuestFailedCompetitiveWinnerDescription"), text); } } else { text2 = string.Format(AgeLocalizer.Instance.LocalizeString("%NotificationQuestFailedDescription"), arg); } this.RightSummary.Show(this.Quest, "%QuestOutcomeTitle", text2); this.RightStepItem.Hide(); }
public override void RefreshContent() { base.RefreshContent(); if (this.Fortress == null) { return; } if (this.Fortress.Occupant != null) { GuiEmpire guiEmpire = new GuiEmpire(this.Fortress.Occupant); this.OwningEmpireImage.Image = guiEmpire.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, this.playerControllerRepositoryService.ActivePlayerController.Empire as global::Empire); } string text = string.Empty; this.NextStockpileLabel.AgeTransform.Visible = false; this.WeatherControlGroup.Visible = false; GuiElement guiElement; if (base.GuiService.GuiPanelHelper.TryGetGuiElement(this.Fortress.PointOfInterest.PointOfInterestDefinition.PointOfInterestTemplateName, out guiElement)) { if (this.Fortress.Orientation == Fortress.CardinalOrientation.Center) { text = AgeLocalizer.Instance.LocalizeString(guiElement.Title); } else { text = AgeLocalizer.Instance.LocalizeString("%FortressGeolocalizedNameFormat").Replace("$FortressName", AgeLocalizer.Instance.LocalizeString(guiElement.Title)); text = text.Replace("$FortressPosition", AgeLocalizer.Instance.LocalizeString("%" + this.Fortress.Orientation.ToString() + "GeolocalizationTitle")); } this.CitadelTitle.Text = text; if (this.CitadelTitle.AgeTransform.AgeTooltip != null) { this.CitadelTitle.AgeTransform.AgeTooltip.Class = Fortress.Facility; this.CitadelTitle.AgeTransform.AgeTooltip.Content = guiElement.Name; this.CitadelTitle.AgeTransform.AgeTooltip.ClientData = this.Fortress.PointOfInterest.PointOfInterestImprovement; } Texture2D image; if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image)) { this.CitadelImage.Image = image; this.CitadelImage.AgeTransform.AgeTooltip.Copy(this.CitadelTitle.AgeTransform.AgeTooltip); } } else { this.CitadelTitle.Text = this.Fortress.PointOfInterest.PointOfInterestDefinition.PointOfInterestTemplateName; } List <PointOfInterest> facilities = this.Fortress.Facilities; for (int i = 0; i < facilities.Count; i++) { if (facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.StockPile1) || facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.StockPile2) || facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.StockPile3)) { this.NextStockpileLabel.AgeTransform.Visible = true; int num; if (this.Fortress.Region.NavalEmpire.GetAgency <PirateCouncil>().Stockpiles.TryGetValue(facilities[i].GUID, out num)) { if (num > 1) { this.NextStockpileLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoNextStockpileGenerationFormatPlural").Replace("$Timer", num.ToString()); } else { this.NextStockpileLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoNextStockpileGenerationFormatSingle").Replace("$Timer", num.ToString()); } } else { this.NextStockpileLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoNextStockpileGenerationFormatPlural").Replace("$Timer", "???"); } } if (facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.WeatherControl) && this.weatherService != null) { this.WeatherControlGroup.Visible = true; List <string> list = new List <string>(); List <string> list2 = new List <string>(); list.Add("%FortressInfoWeatherControlNoPresetTitle"); list2.Add("%FortressInfoWeatherControlNoPresetDescription"); bool flag = this.weatherService.WeatherControlCooldown <= 0 || this.weatherService.WeatherControlStartTurn == (base.Game as global::Game).Turn + 1; int weatherControlTurnDurationFor = this.weatherService.GetWeatherControlTurnDurationFor(this.fortress.Occupant); string newValue = string.Empty; for (int j = 0; j < this.presetNames.Count; j++) { GuiElement guiElement2; if (base.GuiService.GuiPanelHelper.TryGetGuiElement("Weather" + this.presetNames[j], out guiElement2)) { list.Add(guiElement2.Title); if (!flag) { newValue = (weatherControlTurnDurationFor - ((base.Game as global::Game).Turn + 1 - this.weatherService.WeatherControlStartTurn)).ToString(); } else { newValue = weatherControlTurnDurationFor.ToString(); } list2.Add(AgeLocalizer.Instance.LocalizeString(guiElement2.Description).Replace("$Timer", newValue)); } } this.WeatherControlDroplist.ItemTable = list.ToArray(); this.WeatherControlDroplist.TooltipTable = list2.ToArray(); if (this.presetNames.Contains(this.weatherService.PresetName)) { this.WeatherControlDroplist.SelectedItem = this.presetNames.IndexOf(this.weatherService.PresetName) + 1; } else { this.WeatherControlDroplist.SelectedItem = 0; } if (flag) { this.WeatherControlLabel.Text = "%FortressInfoWeatherControlUseTitle"; this.WeatherControlLabel.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%FortressInfoWeatherControlUseDescription").Replace("$Timer", weatherControlTurnDurationFor.ToString()); this.WeatherControlDroplist.AgeTransform.Enable = true; } else if (this.weatherService.WeatherControlCooldown > 0) { this.WeatherControlDroplist.AgeTransform.Enable = false; this.WeatherControlLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoWeatherControlEndOfCooldownFormatSingle").Replace("$Timer", this.weatherService.WeatherControlCooldown.ToString()); this.WeatherControlLabel.AgeTransform.AgeTooltip.Content = "%FortressInfoWeatherControlEndOfCooldownDescription"; if (this.weatherService.WeatherControlCooldown > 1) { this.WeatherControlLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoWeatherControlEndOfCooldownFormatPlural").Replace("$Timer", this.weatherService.WeatherControlCooldown.ToString()); } } } } for (int k = 0; k < this.typesFIDS.Count; k++) { if (k < this.valuesFIDS.Count) { this.valuesFIDS[k].AgeTransform.Alpha = 1f; this.valuesFIDS[k].AgeTransform.ResetAllModifiers(true, false); float propertyValue = this.Fortress.GetPropertyValue(this.typesFIDS[k]); this.valuesFIDS[k].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0); } } this.PlayerEmpire = (this.PlayerController.Empire as global::Empire); this.FacilitiesTable.ReserveChildren(facilities.Count, this.FacilityOccurencePrefab, Fortress.Facility); this.FacilitiesTable.RefreshChildrenIList <PointOfInterest>(facilities, this.updateFacilityDelegate, false, false); }
public void RefreshContent() { if (this.KaijuGarrison == null) { return; } if (this.KaijuGarrison.Owner != null) { if (this.KaijuGarrison.Kaiju.OnArmyMode()) { this.AgeTransform.Visible = false; return; } this.AgeTransform.Visible = true; this.FactionIcon.AgeTransform.Visible = true; this.StatusImage.AgeTransform.Visible = false; this.StatusTurns.AgeTransform.Visible = false; this.TameCost.AgeTransform.Visible = false; GuiEmpire guiEmpire = new GuiEmpire(this.KaijuGarrison.Owner); this.FactionIcon.Image = guiEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, false); this.FactionIcon.TintColor = guiEmpire.Color; this.Frame.TintColor = guiEmpire.Color; this.PinLine.TintColor = guiEmpire.Color; this.KaijuIcon.TintColor = guiEmpire.Color; this.StatusPanel.AgeTooltip.Content = string.Empty; } else { this.AgeTransform.Visible = true; this.FactionIcon.AgeTransform.Visible = false; this.StatusImage.AgeTransform.Visible = true; this.StatusTurns.AgeTransform.Visible = true; this.Frame.TintColor = this.KaijuGarrison.Empire.Color; this.PinLine.TintColor = this.KaijuGarrison.Empire.Color; this.KaijuIcon.TintColor = this.KaijuGarrison.Empire.Color; KaijuCouncil agency = this.KaijuGarrison.KaijuEmpire.GetAgency <KaijuCouncil>(); if (this.KaijuGarrison.Kaiju.IsWild()) { this.StatusTurns.Text = agency.RelocationETA.ToString(); this.StatusImage.Image = AgeManager.Instance.FindDynamicTexture("Gui/DynamicBitmaps/Icons/kaijuMoveIcon", false); this.StatusPanel.AgeTooltip.Content = "%KaijuTurnsToMoveDescription"; } else if (this.KaijuGarrison.Kaiju.IsStunned()) { this.StatusTurns.Text = this.KaijuGarrison.Kaiju.GetRemainingTurnBeforeStunFinish().ToString(); this.StatusImage.Image = AgeManager.Instance.FindDynamicTexture("Gui/DynamicBitmaps/Icons/kaijuStunnedIcon", false); this.StatusPanel.AgeTooltip.Content = "%KaijuStunnedDescription"; } KaijuTameCost kaijuTameCost = KaijuCouncil.GetKaijuTameCost(); this.TameCost.AgeTransform.Visible = true; this.TameCost.Text = GuiFormater.FormatGui(kaijuTameCost.GetValue(this.empire), false, true, false, 0) + this.GuiService.FormatSymbol((ELCPUtilities.UseELCPSymbiosisBuffs ? agency.ELCPResourceName.ToString() : kaijuTameCost.ResourceName.ToString()) + "Dark"); } if (this.statusPanelTooltip != null) { this.statusPanelTooltip.Content = "%KaijuSpawnedProperties"; } if (this.panelTooltip != null) { GuiElement kaijuFactionGuiElement = this.KaijuFactionGuiElement; if (kaijuFactionGuiElement != null) { this.panelTooltip.Content = kaijuFactionGuiElement.Description; } } this.UnitNumber.Text = this.KaijuGarrison.UnitsCount.ToString(); string text = (this.KaijuGuiUnit == null) ? this.KaijuGarrison.Kaiju.Name.ToString() : GuiUnitDesign.GetTruncatedTitle(this.KaijuGuiUnit.UnitDesign, this.KaijuName); this.KaijuName.Text = text; }
public void SetupTechnology(global::Empire empire, TechnologyDefinition technologyDefinition, GameObject client) { this.empire = empire; this.TechnologyDefinition = technologyDefinition; this.selectionClient = client; if (this.TagsList == null) { this.TagsList = new List <string>(); } else { this.TagsList.Clear(); } if (this.empire == null) { return; } this.BuildTags(); if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Quest)) { this.EraLabel.Text = string.Empty; AgePrimitiveLabel eraLabel = this.EraLabel; eraLabel.Text += (char)this.QuestCharNumber; } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Medal)) { this.EraLabel.Text = string.Empty; AgePrimitiveLabel eraLabel2 = this.EraLabel; eraLabel2.Text += (char)this.MedalCharNumber; } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Affinity)) { this.EraLabel.Text = string.Empty; AgePrimitiveLabel eraLabel3 = this.EraLabel; eraLabel3.Text += GuiEmpire.GetFactionSymbolString(this.empire, this.empire); } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.OrbUnlock)) { this.EraLabel.Text = string.Empty; } else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock)) { this.EraLabel.Text = string.Empty; } else { int technologyEraNumber = DepartmentOfScience.GetTechnologyEraNumber(technologyDefinition); if (technologyEraNumber > 0) { this.EraLabel.Text = AgeUtils.ToRoman(technologyEraNumber); } else { this.EraLabel.Text = "-"; } } this.GlowImage.AgeTransform.Visible = false; IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null && service.IsShared(DownloadableContent9.ReadOnlyName) && technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Unique)) { this.GlowImage.AgeTransform.Visible = true; } if (this.UnlockImage != null) { this.UnlockImage.Image = DepartmentOfScience.GetTechnologyImage(technologyDefinition, global::GuiPanel.IconSize.Small); } this.CategoryIcon.Image = DepartmentOfScience.GetCategoryIcon(technologyDefinition, global::GuiPanel.IconSize.Small); this.CategoryFullIcon.Image = this.CategoryIcon.Image; if (this.SubCategoryIcon.Image != null) { this.CategoryIcon.AgeTransform.PixelOffsetLeft = -this.CategoryIcon.AgeTransform.Width; this.CategoryFullIcon.AgeTransform.PixelOffsetLeft = -this.CategoryFullIcon.AgeTransform.Width; } else { this.CategoryIcon.AgeTransform.PixelOffsetLeft = -(0.5f * this.CategoryIcon.AgeTransform.Width); this.CategoryFullIcon.AgeTransform.PixelOffsetLeft = -(0.5f * this.CategoryFullIcon.AgeTransform.Width); } this.SubCategoryIcon.Image = DepartmentOfScience.GetSubCategoryIcon(technologyDefinition, global::GuiPanel.IconSize.Small); this.SubCategoryFullIcon.Image = this.SubCategoryIcon.Image; DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, this.empire, this.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); this.InProgressSector.TintColor = this.InProgressColor; this.MarkupGroup.Visible = false; DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>(); DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(technologyDefinition); this.Refresh(empire, technologyState); }
public void RefreshContent(Player player, Empire playerEmpire, IGuiPanelHelper helper) { GuiEmpire guiEmpire = new GuiEmpire(player.Empire); this.EmpireIcon.Image = guiEmpire.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, playerEmpire); this.EmpireIcon.TintColor = guiEmpire.Color; AgeUtils.TruncateString(player.LocalizedName, this.EmpireLeader, out this.temp, '.'); this.EmpireLeader.Text = this.temp; this.EmpireLeader.TintColor = player.Empire.Color; float value = 0f; MajorEmpire majorEmpire = player.Empire as MajorEmpire; if (majorEmpire != null) { Diagnostics.Assert(majorEmpire.GameScores != null); GameScore gameScore = null; if (majorEmpire.GameScores.TryGetValue(GameScores.Names.GlobalScore, out gameScore)) { value = gameScore.Value; } } bool flag = false; ISessionService service = Services.GetService <ISessionService>(); Diagnostics.Assert(service != null && service.Session != null); string lobbyData = service.Session.GetLobbyData <string>(EmpireInfo.EmpireInfoAccessibility, "Default"); switch ((int)Enum.Parse(typeof(EmpireInfo.Accessibility), lobbyData)) { case 0: flag = true; break; case 1: if (player.Empire == playerEmpire) { flag = true; } else if (playerEmpire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(player.Empire).State.Name == DiplomaticRelationState.Names.Dead) { flag = true; } break; case 2: if (player.Empire == playerEmpire) { flag = true; } else { DepartmentOfIntelligence agency = playerEmpire.GetAgency <DepartmentOfIntelligence>(); if (agency != null && agency.IsEmpireInfiltrated(player.Empire)) { flag = true; } else if (playerEmpire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(player.Empire).State.Name == DiplomaticRelationState.Names.Dead) { flag = true; } } break; default: flag = true; break; } if (flag || !(playerEmpire is MajorEmpire) || (playerEmpire as MajorEmpire).IsEliminated) { this.EmpireScore.Text = GuiFormater.FormatGui(value, false, false, false, 1); } else { this.EmpireScore.Text = "???"; } this.EmpireScore.TintColor = player.Empire.Color; if (player.Empire == playerEmpire) { this.EmpireDiplomacy.Text = "-"; this.EmpireDiplomacy.TintColor = player.Empire.Color; } else { DepartmentOfForeignAffairs agency2 = playerEmpire.GetAgency <DepartmentOfForeignAffairs>(); if (agency2 != null) { DiplomaticRelation diplomaticRelation = agency2.GetDiplomaticRelation(player.Empire); GuiElement guiElement; if (helper.TryGetGuiElement(diplomaticRelation.State.Name, out guiElement)) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(guiElement.Title), this.EmpireDiplomacy, out this.temp, '.'); this.EmpireDiplomacy.Text = this.temp; this.EmpireDiplomacy.TintColor = player.Empire.Color; } if (player.Empire.IsControlledByAI) { if (diplomaticRelation.State.Name == DiplomaticRelationState.Names.Unknown) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(guiElement.Title), this.EmpireDiplomacy, out this.temp, '.'); this.EmpireLeader.Text = this.temp; } else { AgeUtils.TruncateString(player.Empire.LocalizedName, this.EmpireLeader, out this.temp, '.'); this.EmpireLeader.Text = this.temp; } } } } string key = string.Empty; this.EmpireStatus.Text = string.Empty; PlayerHelper.ComputePlayerState(ref player); key = string.Format("%PlayerState_{0}", player.State); string src = string.Empty; if (player.Type == PlayerType.Human && service.Session.SessionMode != SessionMode.Single) { src = string.Format("{0} ({1:0.}ms)", AgeLocalizer.Instance.LocalizeString(key), player.Latency * 1000.0); } else { src = AgeLocalizer.Instance.LocalizeString(key); } AgeUtils.TruncateString(src, this.EmpireStatus, out this.temp, '.'); AgePrimitiveLabel empireStatus = this.EmpireStatus; empireStatus.Text = empireStatus.Text + this.temp + "\n"; this.EmpireStatus.Text = this.EmpireStatus.Text.TrimEnd(new char[] { '\n' }); this.EmpireStatus.TintColor = player.Empire.Color; }