private void RefreshDLC13Tooltip() { if (this.LobbyDescription.DownloadableContentSharedByServer != 0u) { uint downloadableContentSharedByServer = this.LobbyDescription.DownloadableContentSharedByServer; IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null) { foreach (DownloadableContent downloadableContent in service) { uint num = 1u << (int)downloadableContent.Number; if ((downloadableContentSharedByServer & num) != 0u && downloadableContent.Type == DownloadableContentType.Exclusive && downloadableContent.Name == DownloadableContent13.ReadOnlyName) { string key = (!this.LobbyDescription.AdvancedSeasons) ? "%GameOptionSeasonDifficultyVanillaTitle" : ("%GameOptionSeasonDifficulty" + this.LobbyDescription.SeasonDifficulty + "Title"); AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip; ageTooltip.Content = ageTooltip.Content + "\n" + AgeLocalizer.Instance.LocalizeString("%AdvancedWinterSettingTooltip").Replace("$WinterSetting", AgeLocalizer.Instance.LocalizeString(key)); break; } } } } string key2 = "%GameOptionEmpireInfoAccessibility" + this.LobbyDescription.EmpireInfoAccessibility + "Title"; AgeTooltip ageTooltip2 = this.AgeTransform.AgeTooltip; ageTooltip2.Content = ageTooltip2.Content + "\n" + AgeLocalizer.Instance.LocalizeString("%EmpireScoresSettingTooltip").Replace("$ScoresSetting", AgeLocalizer.Instance.LocalizeString(key2)); this.AgeTransform.StopSearchingForTooltips = true; }
private void OverrideAffinitiesDropListTooltips() { AgeControlPopup componentInChildren = this.AffinityDropList.GetComponentInChildren <AgeControlPopup>(); if (componentInChildren != null) { List <AgeTransform> children = componentInChildren.AgeTransform.GetChildren(); for (int i = 0; i < children.Count; i++) { if (i < this.affinityGuiTraits.Count) { GuiFactionTrait guiFactionTrait = this.affinityGuiTraits[i]; for (int j = 0; j < guiFactionTrait.SubGuiTraits.Count; j++) { GuiFactionTrait guiFactionTrait2 = guiFactionTrait.SubGuiTraits[j]; if (guiFactionTrait2.Type == GuiFactionTrait.TraitType.Affinity) { AgeTooltip component = children[i].GetComponent <AgeTooltip>(); if (component != null) { StaticString relatedAffinity = StaticString.Empty; if (this.SelectedAffinity != null) { relatedAffinity = this.SelectedAffinity.Name; } guiFactionTrait2.GenerateTooltip(component, relatedAffinity); break; } } } } } } }
public void Unbind() { this.departmentOfDefense = null; this.isColossusArmy = false; this.isKaijuArmy = false; if (this.HeroCard != null) { this.HeroCard.Unbind(); this.guiHero = null; AgeTooltip ageTooltip = this.HeroCard.HeroInspectionButton.AgeTransform.AgeTooltip; if (ageTooltip != null && this.guiHero != null) { ageTooltip.ClientData = null; } } if (this.Army != null) { this.Army.StandardUnitCollectionChange -= this.Army_StandardUnitCollectionChange; this.Army.Refreshed -= this.Army_Refreshed; this.Army = null; } if (this.ArmyUpkeep != null) { AgeTransform ageTransform = this.ArmyUpkeep.AgeTransform.GetParent(); if (ageTransform != null && ageTransform.AgeTooltip != null) { ageTransform.AgeTooltip.ClientData = null; } } this.parent = null; }
public void Bind(City city) { this.City = city; this.City.Refreshed += this.City_Refreshed; this.IsOtherEmpire = (this.playerControllerRepository.ActivePlayerController.Empire != this.City.Empire); this.EndTurnService = Services.GetService <IEndTurnService>(); for (int i = 0; i < this.prodPerPopFIDSTypes.Count; i++) { SimulationPropertyTooltipData simulationPropertyTooltipData = this.ProdPerPopFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = city; } simulationPropertyTooltipData = (this.CityTileFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData); if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = city; } simulationPropertyTooltipData = (this.TotalFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData); if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = city; } simulationPropertyTooltipData = (this.ModifierFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData); if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = city; } } for (int j = 0; j < this.prodPerPopFIDSTypes.Count; j++) { GuiElement guiElement = null; base.GuiService.GuiPanelHelper.TryGetGuiElement(this.prodPerPopFIDSTypes[j], out guiElement, this.City.Empire.Faction.Name); if (guiElement != null) { ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement; if (j < this.FidsSymbols.Length && j < this.ProdPerPopFIDSValues.Length && j < this.ModifierFIDSValues.Length && j < this.CityTileFIDSValues.Length && j < this.TotalFIDSValues.Length && extendedGuiElement != null) { Texture2D image; if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image)) { this.FidsSymbols[j].Image = image; this.FidsSymbols[j].TintColor = extendedGuiElement.Color; } AgeTooltip component = this.FidsGroups[j].GetComponent <AgeTooltip>(); if (component != null) { component.Class = "Simple"; component.Content = extendedGuiElement.Description; } this.ProdPerPopFIDSValues[j].TintColor = extendedGuiElement.Color; this.CityTileFIDSValues[j].TintColor = extendedGuiElement.Color; this.ModifierFIDSValues[j].TintColor = extendedGuiElement.Color; this.TotalFIDSValues[j].TintColor = extendedGuiElement.Color; } } } this.departmentOfEducation = this.City.Empire.GetAgency <DepartmentOfEducation>(); this.departmentOfEducation.VaultItemsCollectionChange += this.DepartmentOfEducation_VaultItemsCollectionChange; }
public void InitializeContent(OptionDefinition optionDefinition, GameObject client) { this.OptionDefinition = optionDefinition; this.client = client; this.Unavailable.Visible = false; string str = "%" + optionDefinition.GetType().ToString().Replace("Definition", string.Empty); this.Title.Text = str + optionDefinition.Name + "Title"; AgeTooltip ageTooltip = this.Title.AgeTransform.AgeTooltip; if (ageTooltip != null) { ageTooltip.Content = str + optionDefinition.Name + "Description"; } if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeToggle) { Diagnostics.Assert(this.OptionDefinition.ItemDefinitions.Length == 2); Diagnostics.Assert(this.OptionDefinition.ItemDefinitions[0].Name == "False"); Diagnostics.Assert(this.OptionDefinition.ItemDefinitions[1].Name == "True"); this.DropList.AgeTransform.Visible = false; this.Toggle.AgeTransform.Visible = true; this.TextField.AgeTransform.Visible = false; } else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeDropList) { Diagnostics.Assert(this.OptionDefinition.ItemDefinitions.Length > 0); this.DropList.AgeTransform.Visible = true; this.Toggle.AgeTransform.Visible = false; this.TextField.AgeTransform.Visible = false; string[] array = new string[optionDefinition.ItemDefinitions.Length]; string[] array2 = new string[optionDefinition.ItemDefinitions.Length]; for (int i = 0; i < optionDefinition.ItemDefinitions.Length; i++) { array[i] = str + optionDefinition.Name + optionDefinition.ItemDefinitions[i].Name + "Title"; array2[i] = str + optionDefinition.Name + optionDefinition.ItemDefinitions[i].Name + "Description"; } this.DropList.ItemTable = array; this.DropList.TooltipTable = array2; } else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeTextField) { Diagnostics.Assert(this.OptionDefinition.ItemDefinitions.Length == 1); Diagnostics.Assert(this.OptionDefinition.ItemDefinitions[0].KeyValuePairs.Length == 1); this.DropList.AgeTransform.Visible = false; this.Toggle.AgeTransform.Visible = false; this.TextField.AgeTransform.Visible = true; if (!string.IsNullOrEmpty(this.OptionDefinition.ValidChars)) { this.TextField.ValidChars = this.OptionDefinition.ValidChars; } if (this.OptionDefinition.TextMaxLength > 0) { this.TextField.TextMaxLength = this.OptionDefinition.TextMaxLength; } string value = this.OptionDefinition.ItemDefinitions[0].KeyValuePairs[0].Value; this.TextField.ReplaceInputText(value); } }
public void RefreshContent() { Amplitude.Unity.Gui.IGuiService service = Services.GetService <global::IGuiService>(); if (this.ArePlayersReady && this.Session.SessionMode != SessionMode.Single) { this.ReadyImage.AgeTransform.Visible = true; } else { this.ReadyImage.AgeTransform.Visible = false; } if (this.MajorEmpire.IsEliminated && !this.MajorEmpire.IsSpectator) { this.AgeTransform.GetComponent <AgePrimitiveImage>().Image = AgeManager.Instance.FindDynamicTexture("eliminatedLogoSmall", false); } else if (this.IsInEncounter) { this.AgeTransform.GetComponent <AgePrimitiveImage>().Image = AgeManager.Instance.FindDynamicTexture("encounterLogoSmall", false); } else if (!this.IsKnownByActivePlayer && !this.MajorEmpire.IsSpectator) { this.AgeTransform.GetComponent <AgePrimitiveImage>().Image = AgeManager.Instance.FindDynamicTexture("majorFactionRandomLogoSmall", false); } else { this.LogoImage.Image = this.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, false); } if (this.IsKnownByActivePlayer) { this.AgeControlButton.OnMiddleClickMethod = "OnRightClick"; this.AgeControlButton.OnRightClickMethod = "OnRightClick"; this.AgeControlButton.OnMiddleClickObject = service.GetGuiPanel <EndTurnPanel>().gameObject; this.AgeControlButton.OnRightClickObject = service.GetGuiPanel <EndTurnPanel>().gameObject; this.AgeTransform.AgeTooltip.Content = this.MajorEmpire.LocalizedName + " - " + this.MajorEmpire.Faction.LocalizedName; if (!this.MajorEmpire.IsControlledByAI && this.MajorEmpire != this.ActivePlayerEmpire) { AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip; ageTooltip.Content = ageTooltip.Content + "\n \n" + AgeLocalizer.Instance.LocalizeString("%ClickToWhisperTooltipContent"); this.AgeControlButton.OnActivateMethod = "OnWhisperToEmpireCB"; this.AgeControlButton.OnActivateObject = service.GetGuiPanel <InGameConsolePanel>().gameObject; this.AgeControlButton.OnActivateData = this.MajorEmpire.LocalizedName; return; } } else { GuiElement guiElement; if (!service.GuiPanelHelper.TryGetGuiElement(DiplomaticRelationState.Names.Unknown, out guiElement)) { this.AgeTransform.AgeTooltip.Content = "Missing GuiElement " + DiplomaticRelationState.Names.Unknown; return; } this.AgeTransform.AgeTooltip.Content = guiElement.Title; this.AgeControlButton.OnActivateMethod = string.Empty; this.AgeControlButton.OnActivateObject = null; this.AgeControlButton.OnActivateData = string.Empty; } }
private void CreateEmpireFilters(List <global::Empire> empiresToSelect = null) { if (empiresToSelect != null && empiresToSelect.Count == 1 && empiresToSelect[0] == base.Empire) { empiresToSelect.Clear(); } this.empireToFilter.Clear(); DepartmentOfIntelligence agency = base.Empire.GetAgency <DepartmentOfIntelligence>(); bool flag = DepartmentOfTheInterior.CanSeeAllExchangeTransactions(base.Empire); global::Game game = base.Game as global::Game; for (int i = 0; i < game.Empires.Length; i++) { MajorEmpire majorEmpire = game.Empires[i] as MajorEmpire; if (majorEmpire != null) { if (base.Empire.Index == majorEmpire.Index) { this.empireToFilter.Add(majorEmpire); } else if (!majorEmpire.IsEliminated) { DepartmentOfScience agency2 = majorEmpire.GetAgency <DepartmentOfScience>(); if (agency2.CanTradeHeroes(true) || agency2.CanTradeUnits(true) || agency2.CanTradeResourcesAndBoosters(true)) { if (flag) { this.empireToFilter.Add(majorEmpire); } else if (agency != null && agency.IsEmpireInfiltrated(majorEmpire)) { this.empireToFilter.Add(majorEmpire); } } } } } this.empireFilterWidth = Mathf.Floor((this.EmpireFiltersContainer.Width - this.EmpireFiltersContainer.HorizontalSpacing * (float)(this.empireToFilter.Count - 1)) / (float)this.empireToFilter.Count); this.EmpireFiltersContainer.ReserveChildren(this.empireToFilter.Count, this.EmpireFilterPrefab, "EmpireFilterToggle"); this.EmpireFiltersContainer.RefreshChildrenIList <global::Empire>(this.empireToFilter, new AgeTransform.RefreshTableItem <global::Empire>(this.SetupEmpireFilterToggle), true, false); this.EmpireFiltersContainer.ArrangeChildren(); if (empiresToSelect != null && empiresToSelect.Count > 0) { this.SetEmpiresToShow(empiresToSelect); } else { this.SetEmpiresToShow(this.empireToFilter); } AgeTooltip ageTooltip = this.EmpireFilterPrefab.GetComponent <AgeTransform>().AgeTooltip; if (ageTooltip != null) { ageTooltip.Content = "%MarketplaceEmpireFilterDescription"; } }
private void RefreshPlayerLine(string playerName, int playerIndex) { Steamworks.SteamID steamID = Steamworks.SteamID.Zero; if (Steamworks.SteamAPI.IsSteamRunning) { try { steamID = new Steamworks.SteamID(Convert.ToUInt64(playerName, 16)); playerName = Steamworks.SteamAPI.SteamFriends.GetFriendPersonaName(steamID); goto IL_4E; } catch { Diagnostics.LogWarning("Unable to get player name from steam ID " + playerName); goto IL_4E; } } playerName = Environment.UserName + "(no Steam)"; IL_4E: this.PlayersTitleLabels[playerIndex].AgeTransform.Visible = true; this.PlayersTitleLabels[playerIndex].Text = playerName; AgeTooltip ageTooltip = this.PlayersTitleLabels[playerIndex].AgeTransform.AgeTooltip; if (ageTooltip != null) { ageTooltip.Content = playerName; } if (steamID == this.Session.SteamIDUser && playerIndex == 0) { this.CompetitorIsLocalOwner = true; } SessionMode sessionMode = this.Session.SessionMode; if (sessionMode == SessionMode.Single) { this.PlayerReadyToggles[playerIndex].AgeTransform.Visible = false; this.PlayerKickButtons[playerIndex].AgeTransform.Visible = false; return; } if (sessionMode - SessionMode.Private > 2) { throw new ArgumentOutOfRangeException(); } bool lobbyMemberData = this.Session.GetLobbyMemberData <bool>(steamID, "Ready", false); this.PlayerReadyToggles[playerIndex].AgeTransform.Visible = true; this.PlayerReadyToggles[playerIndex].State = lobbyMemberData; this.PlayerKickButtons[playerIndex].AgeTransform.Visible = (this.CompetitorIsHuman && this.Session.IsHosting && !this.CompetitorIsLocalOwner); this.PlayerKickButtons[playerIndex].OnActivateMethod = "OnKickUserCB"; this.PlayerKickButtons[playerIndex].OnActivateData = steamID.ToString(); bool visible = steamID == this.Session.LobbyOwnerSteamID; this.PlayerHostingIcons[playerIndex].AgeTransform.Visible = visible; }
protected override IEnumerator OnShow(params object[] parameters) { yield return(base.OnShow(parameters)); if (this.guiNotification != null && this.notificationItem != null) { base.SetHeader(); GuiNotificationHeroBase guiNotificationHeroBase = this.guiNotification as GuiNotificationHeroBase; if (guiNotificationHeroBase != null) { GuiElement guiElement; if (base.GuiService.GuiPanelHelper.TryGetGuiElement(guiNotificationHeroBase.RaisedEvent.EventName, out guiElement)) { this.Description.AgeTransform.Height = this.DescriptionSW.Viewport.Height; this.Description.Text = guiNotificationHeroBase.FormatDescription(guiElement.Description, base.GuiService); this.DescriptionSW.ResetUp(); } Unit unit = this.FetchHero(); if (unit != null) { GuiHero guiHero = new GuiHero(unit, null); if (base.GuiService.GuiPanelHelper.TryGetGuiElement(unit.UnitDesign.Name, out guiElement)) { Texture2D image; if (guiHero != null && guiHero.IsShifted) { if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.ShiftedLarge, out image)) { this.ImmersiveImage.Image = image; } } else if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Large, out image)) { this.ImmersiveImage.Image = image; } } AgeTooltip ageTooltip = this.ImmersiveImage.AgeTransform.AgeTooltip; if (guiHero != null) { ageTooltip.Class = "Unit"; ageTooltip.ClientData = guiHero; ageTooltip.Content = guiHero.Title; } } } if (this.guiNotification is GuiNotificationHeroLevelUp) { this.RefreshContent(); } } yield break; }
protected virtual void OnDestroy() { this.Reset(); this.GuiUnit = null; this.UnitDesign = null; this.UnitBody = null; this.empire = null; AgeTooltip component = base.GetComponent <AgeTooltip>(); if (component != null) { component.ClientData = null; } }
private void RefreshDownloadableContentsTooltip() { if (this.LobbyDescription.DownloadableContentSharedByServer != 0u) { string text = string.Empty; uint num = this.LobbyDescription.DownloadableContentSharedByServer; IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null) { foreach (DownloadableContent downloadableContent in service) { uint num2 = 1u << (int)downloadableContent.Number; if ((num & num2) != 0u) { if (downloadableContent.Type == DownloadableContentType.Exclusive) { IDatabase <GuiElement> database = Databases.GetDatabase <GuiElement>(true); ExtendedGuiElement extendedGuiElement = database.GetValue(downloadableContent.Name) as ExtendedGuiElement; if (extendedGuiElement != null && !string.IsNullOrEmpty(extendedGuiElement.SymbolString)) { string text2 = text; text = string.Concat(new string[] { text2, extendedGuiElement.SymbolString, " ", AgeLocalizer.Instance.LocalizeString(extendedGuiElement.Title), "\n" }); } } num &= ~num2; if (num == 0u) { break; } } } if (!string.IsNullOrEmpty(text)) { string str = AgeLocalizer.Instance.LocalizeStringDefaults("%DownloadableContentSharedByServerTooltip", "Shared Content: $SBS").Replace("$SBS", text); AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip; ageTooltip.Content += str; this.AgeTransform.StopSearchingForTooltips = true; } } } }
public void InitializeSimple(StaticString subCategory) { this.OptionDefinition = null; this.client = null; this.DropList.AgeTransform.Visible = false; this.Toggle.AgeTransform.Visible = false; this.TextField.AgeTransform.Visible = false; this.Unavailable.Visible = false; this.Title.Text = "%" + subCategory + "Title"; AgeTooltip ageTooltip = this.Title.AgeTransform.AgeTooltip; if (ageTooltip != null) { ageTooltip.Content = "%" + subCategory + "Description"; } }
public void Bind(Fortress fortress) { GuiElement guiElement = null; this.Fortress = fortress; for (int i = 0; i < this.typesFIDS.Count; i++) { base.GuiService.GuiPanelHelper.TryGetGuiElement(this.typesFIDS[i], out guiElement, this.Fortress.Occupant.Faction.Name); if (guiElement != null) { ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement; if (i < this.TotalValuesTable.GetChildren().Count) { AgeTransform ageTransform = this.TotalValuesTable.GetChildren()[i]; for (int j = 0; j < ageTransform.GetChildren().Count; j++) { AgeTooltip component = ageTransform.GetComponent <AgeTooltip>(); if (component != null) { component.Class = "Simple"; component.Content = extendedGuiElement.Description; } AgeTransform ageTransform2 = ageTransform.GetChildren()[j]; if (ageTransform2.name == "1Symbol") { Texture2D image; if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image)) { ageTransform2.GetComponent <AgePrimitiveImage>().Image = image; ageTransform2.GetComponent <AgePrimitiveImage>().TintColor = extendedGuiElement.Color; } break; } } } } SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = this.Fortress; } } IGameService service = Services.GetService <IGameService>(); this.PlayerController = service.Game.Services.GetService <IPlayerControllerRepositoryService>().ActivePlayerController; this.updateFacilityDelegate = new AgeTransform.RefreshTableItem <PointOfInterest>(this.UpdateFacility); }
protected virtual void DisplayPriceLevel() { this.PriceLevelLabel.Text = GuiFormater.FormatGui(this.PriceLevel, false, false, true, 1); string priceLevelName = this.GetPriceLevelName(); GuiElement guiElement; if (!this.guiPanelHelper.TryGetGuiElement(priceLevelName, out guiElement)) { Diagnostics.LogError("Cannot find a GuiElement for the price level {0}", new object[] { priceLevelName }); return; } Texture2D image; if (!this.guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Large, out image)) { Diagnostics.LogError("Cannot find a texture for the large icon of GuiElement {0}", new object[] { guiElement.Name }); return; } this.PriceLevelImage.Image = image; AgeTooltip ageTooltip = this.PriceLevelGroup.GetComponent <AgeTransform>().AgeTooltip; if (ageTooltip != null) { float referencePriceWithSalesTaxes = this.Tradable.GetReferencePriceWithSalesTaxes(TradableTransactionType.Buyout, this.empire); ageTooltip.Content = string.Concat(new string[] { AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableMaximumPrice"), ": ", GuiFormater.FormatGui(referencePriceWithSalesTaxes * Tradable.MaximumPriceMultiplier, false, false, false, 1), "\n", AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableStandardPrice"), ": ", GuiFormater.FormatGui(referencePriceWithSalesTaxes, false, false, false, 1), "\n", AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableMinimumPrice"), ": ", GuiFormater.FormatGui(referencePriceWithSalesTaxes * Tradable.MinimumPriceMultiplier, false, false, false, 1) }); } }
private void OnCloudToggleCB(GameObject obj) { Amplitude.Unity.Framework.Application.Registry.SetValue <bool>(global::Application.Registers.SteamCloudRemoteStorage, this.CloudToggle.State); AgeTooltip ageTooltip = this.CloudToggle.AgeTransform.AgeTooltip; if (ageTooltip != null) { if (this.CloudToggle.State) { ageTooltip.Content = "%LoadSaveCloudEnabledDescription"; } else { ageTooltip.Content = "%LoadSaveCloudDescription"; } } this.RefreshContent(); }
protected void DisplayPrice() { ConstructionCost[] costs = new ConstructionCost[] { new ConstructionCost(DepartmentOfTheTreasury.Resources.EmpireMoney, this.Price, true, false) }; string text = GuiFormater.FormatCost(this.empire, costs, false, 1, null); this.PriceLabel.Text = text; AgeTooltip ageTooltip = this.PriceLabel.AgeTransform.AgeTooltip; if (ageTooltip != null) { string formattedLine = AgeLocalizer.Instance.LocalizeString("%MarketplaceTradablePriceDescription").Replace("$TradableName", this.LocalizedName).Replace("$Price", text); StringBuilder stringBuilder = new StringBuilder(); AgeUtils.CleanLine(formattedLine, ref stringBuilder); ageTooltip.Content = stringBuilder.ToString(); } }
private void RefreshVictoryConditionTooltip() { if (this.LobbyDescription.VictoryConditions != null) { if (!string.IsNullOrEmpty(this.AgeTransform.AgeTooltip.Content)) { AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip; ageTooltip.Content += "\n"; } if (this.LobbyDescription.VictoryConditions.Length > 0) { IDatabase <GuiElement> database = Databases.GetDatabase <GuiElement>(true); List <string> list = new List <string>(this.LobbyDescription.VictoryConditions.Length); for (int i = 0; i < this.LobbyDescription.VictoryConditions.Length; i++) { string x = "VictoryCondition" + this.LobbyDescription.VictoryConditions[i].Name; GuiElement value = database.GetValue(x); if (value != null) { string item = AgeLocalizer.Instance.LocalizeString(value.Title); list.Add(item); } } string str = AgeLocalizer.Instance.LocalizeStringDefaults("%VictoryConditionsTooltip", "Victory conditions: $Conditions").Replace("$Conditions", string.Join(", ", list.ToArray())); AgeTooltip ageTooltip2 = this.AgeTransform.AgeTooltip; ageTooltip2.Content += str; } else { string str2 = AgeLocalizer.Instance.LocalizeStringDefaults("%VictoryConditionsNoneTooltip", "Victory conditions: none"); AgeTooltip ageTooltip3 = this.AgeTransform.AgeTooltip; ageTooltip3.Content += str2; } this.AgeTransform.StopSearchingForTooltips = true; } }
public void Bind(Army army, ArmyListPanel parent, global::Empire empire) { if (this.Army != null) { this.Unbind(); } this.Army = army; if (this.Army != null) { this.Army.Refreshed += this.Army_Refreshed; this.Army.StandardUnitCollectionChange += this.Army_StandardUnitCollectionChange; bool flag; if (this.Army.StandardUnits.Count > 0) { flag = this.Army.StandardUnits.All((Unit unit) => unit.UnitDesign.Tags.Contains(DownloadableContent9.TagColossus)); } else { flag = false; } this.isColossusArmy = flag; bool flag2; if (this.Army.StandardUnits.Count > 0) { flag2 = this.Army.StandardUnits.Any((Unit unit) => unit.UnitDesign.Tags.Contains(DownloadableContent20.TagKaijuMonster)); } else { flag2 = false; } this.isKaijuArmy = flag2; } if (this.HeroCard != null) { Garrison.IsAcceptingHeroAssignmentReasonsEnum isAcceptingHeroAssignmentReasonsEnum = Garrison.IsAcceptingHeroAssignmentReasonsEnum.None; if (this.Army.Hero != null) { this.guiHero = new GuiHero(this.Army.Hero, null); this.HeroCard.HeroInspectionButton.AgeTransform.Enable = true; } else { this.guiHero = null; this.HeroCard.HeroInspectionButton.AgeTransform.Enable = (!this.Army.IsInEncounter && this.Army.IsAcceptingHeroAssignments(out isAcceptingHeroAssignmentReasonsEnum)); } this.HeroCard.Bind(this.guiHero, this.Army.Empire, base.gameObject); AgeTooltip ageTooltip = this.HeroCard.HeroInspectionButton.AgeTransform.AgeTooltip; if (ageTooltip != null) { if (this.guiHero != null) { ageTooltip.Class = "Unit"; ageTooltip.ClientData = this.guiHero; ageTooltip.Content = this.guiHero.Title; } else { ageTooltip.Class = string.Empty; if (!this.Army.IsInEncounter) { if (isAcceptingHeroAssignmentReasonsEnum == Garrison.IsAcceptingHeroAssignmentReasonsEnum.None) { ageTooltip.Content = "%HeroAssignDescription"; } else { ageTooltip.Content = "%ArmyLineNoHeroAssignmentBecause" + isAcceptingHeroAssignmentReasonsEnum.ToString(); } } else { ageTooltip.Content = "%ArmyLockedInBattleDescription"; } } } } if (this.ArmyUpkeep != null) { AgeTransform ageTransform = this.ArmyUpkeep.AgeTransform.GetParent(); if (ageTransform != null && ageTransform.AgeTooltip != null) { ageTransform.AgeTooltip.Class = "MilitaryUpkeep"; ageTransform.AgeTooltip.Content = "MilitaryUpkeep"; ageTransform.AgeTooltip.ClientData = new SimulationPropertyTooltipData(SimulationProperties.MilitaryUpkeep, SimulationProperties.MilitaryUpkeep, this.Army); } } this.parent = parent; this.departmentOfDefense = empire.GetAgency <DepartmentOfDefense>(); this.ArmyNameTextField.ValidChars = AgeLocalizer.Instance.LocalizeString("%ArmyValidChars"); Diagnostics.Assert(this.ArmyNameTextField.ValidChars != "%ArmyValidChars", "No localization found for %ArmyValidChars"); }
public void RefreshContent() { this.AgeTransform.Enable = true; this.AgeTransform.StopSearchingForTooltips = false; this.AgeTransform.AgeTooltip.Content = string.Empty; this.ArmySize.TintColor = Color.white; this.HeroCard.HeroPortrait.TintColor = Color.white; if (this.ArmyNameLabel != null) { AgeUtils.TruncateString(this.Army.LocalizedName, this.ArmyNameLabel, out this.temp, '.'); this.ArmyNameLabel.Text = this.temp; if (this.Army.IsInEncounter) { this.ArmyNameLabel.TintColor = this.ColorIfInBattle; this.ArmyNameLabel.AgeTransform.AgeTooltip.Content = "%ArmyLockedInBattleDescription"; } else { this.ArmyNameLabel.TintColor = Color.white; this.ArmyNameLabel.AgeTransform.AgeTooltip.Content = string.Empty; } } if (this.HeroCard != null) { this.HeroCard.RefreshContent(this.isColossusArmy, this.isKaijuArmy); } if (this.ArmySize != null) { this.ArmySize.Text = this.Army.CurrentUnitSlot.ToString() + "/" + this.Army.MaximumUnitSlot.ToString(); AgeTooltip ageTooltip = this.ArmySize.AgeTransform.AgeTooltip; if (ageTooltip != null) { if (this.Army.CurrentUnitSlot > this.Army.MaximumUnitSlot) { ageTooltip.Content = "%ArmyCapacityExceededDescription"; this.ArmySize.TintColor = Color.red; } else { ageTooltip.Content = string.Empty; } } } if (this.ArmyHPLabel != null) { float propertyValue = this.Army.GetPropertyValue(SimulationProperties.Health); float propertyValue2 = this.Army.GetPropertyValue(SimulationProperties.MaximumHealth); float num = 0f; if (propertyValue2 > 0f) { num = 100f * (propertyValue / propertyValue2); } this.ArmyHPGauge.AgeTransform.PercentRight = num; if (num >= 75f) { this.ArmyHPGauge.TintColor = this.FullLifeColor; } else if (num >= 25f) { this.ArmyHPGauge.TintColor = this.HalfLifeColor; } else { this.ArmyHPGauge.TintColor = this.CriticalLifeColor; } this.ArmyHPLabel.Text = GuiFormater.FormatGui(Mathf.Floor(propertyValue), false, false, false, 1) + "/" + GuiFormater.FormatGui(Mathf.Floor(propertyValue2), false, false, false, 1); } if (this.ArmyMovement != null) { string str = GuiFormater.FormatGui(this.Army.GetPropertyValue(SimulationProperties.Movement), false, false, false, 1); string str2 = GuiFormater.FormatGui(this.Army.GetPropertyValue(SimulationProperties.MaximumMovement), false, false, false, 1); this.ArmyMovement.Text = str + "/" + str2; } if (this.ArmyLocation != null) { IGameService service = Services.GetService <IGameService>(); this.ArmyLocation.Text = service.Game.Services.GetService <IWorldPositionningService>().GetRegion(this.Army.WorldPosition).LocalizedName; } if (this.ArmyUpkeep != null) { float propertyValue3 = this.Army.GetPropertyValue(SimulationProperties.MilitaryUpkeep); this.ArmyUpkeep.Text = GuiFormater.FormatQuantity(-propertyValue3, SimulationProperties.MilitaryUpkeep, 0); } if (this.HeroCard != null) { this.HeroCard.AgeTransform.Enable = !this.ReadOnly; } bool flag; if (this.Army.StandardUnits.Count > 0) { flag = this.Army.StandardUnits.All((Unit unit) => unit.UnitDesign.Tags.Contains(DownloadableContent9.TagColossus)); } else { flag = false; } bool flag2 = flag; bool flag3; if (this.Army.StandardUnits.Count > 0) { flag3 = this.Army.StandardUnits.Any((Unit unit) => unit.UnitDesign.Tags.Contains(DownloadableContent20.TagKaijuMonster)); } else { flag3 = false; } bool flag4 = flag3; this.ArmySize.AgeTransform.Visible = (!flag2 && !flag4); this.ColossusArmyLabel.AgeTransform.Visible = flag2; if (flag2) { this.ColossusArmyLabel.Text = "\\7805\\"; this.ColossusArmyLabel.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyWithColossusDescription"); } this.KaijuArmyLabel.AgeTransform.Visible = flag4; if (flag4) { string text = this.ArmySize.Text; this.KaijuArmyLabel.Text = "\\7100\\ " + text; this.KaijuArmyLabel.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyWithKaijuMonsterDescription"); } AgeTransform ageTransform = this.ArmyStatusLabel.AgeTransform.GetParent(); if (this.Army.IsCamouflaged) { this.ArmyStatusLabel.AgeTransform.Visible = true; this.ArmyStatusLabel.Text = "\\7815\\"; ageTransform.AgeTooltip.Content = "%ArmyCamouflagedDescription"; } else if (this.Army.IsNaval) { this.ArmyStatusLabel.AgeTransform.Visible = true; this.ArmyStatusLabel.Text = "\\7825\\"; ageTransform.AgeTooltip.Content = "%ArmyIsSeafaringDescription"; } else { this.ArmyStatusLabel.AgeTransform.Visible = false; ageTransform.AgeTooltip.Content = string.Empty; } this.SelectionToggle.State = false; }
public override void RefreshContent() { base.RefreshContent(); float propertyValue = this.City.GetPropertyValue(SimulationProperties.NetCityApproval); this.ApprovalGauge.PercentRight = Mathf.Clamp(propertyValue, 0f, 100f); this.ApprovalValue.Text = GuiFormater.FormatGui(propertyValue * 0.01f, true, false, false, 1); StaticString descriptorNameFromType = this.City.GetDescriptorNameFromType("ApprovalStatus"); GuiElement guiElement; if (base.GuiService.GuiPanelHelper.TryGetGuiElement(descriptorNameFromType, out guiElement, this.City.Empire.Faction.Name)) { this.ApprovalState.Text = guiElement.Title; ExtendedGuiElement extendedGuiElement = guiElement as ExtendedGuiElement; if (extendedGuiElement != null) { this.ApprovalGauge.AgePrimitive.TintColor = extendedGuiElement.Color; this.ApprovalState.TintColor = extendedGuiElement.Color; } } else { this.ApprovalState.Text = "%ApprovalStatusUnknown"; } if (this.ApprovalState.AgeTransform.AgeTooltip != null) { this.ApprovalState.AgeTransform.AgeTooltip.Content = descriptorNameFromType.ToString(); } this.RefreshPopulationCount(); this.RefreshPopulationGrowth(); int num = Mathf.CeilToInt(this.City.GetPropertyValue(SimulationProperties.CityMoneyUpkeep)); this.UpkeepValue.Text = GuiFormater.FormatQuantity((float)(-(float)num), SimulationProperties.CityMoneyUpkeep, 1); AgeTooltip ageTooltip = this.UpkeepValue.AgeTransform.AgeTooltip; ageTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString("%BuildingsUpkeepFormatDescription"), this.UpkeepValue.Text); this.UpkeepIcon1.AgeTooltip.Copy(ageTooltip); this.UpkeepIcon2.AgeTooltip.Copy(ageTooltip); for (int i = 0; i < this.typesFIDS.Count; i++) { if (i < this.valuesFIDS.Count && i < this.deltaFIDS.Count) { if (!this.valuesFIDS[i].AgeTransform.ModifiersRunning) { this.valuesFIDS[i].AgeTransform.Alpha = 1f; this.valuesFIDS[i].AgeTransform.ResetAllModifiers(true, false); this.deltaFIDS[i].AgeTransform.Alpha = 0f; this.deltaFIDS[i].AgeTransform.ResetAllModifiers(true, false); } float propertyValue2 = this.City.GetPropertyValue(this.typesFIDS[i]); this.valuesFIDS[i].Text = GuiFormater.FormatGui(propertyValue2, false, false, false, 0); if (propertyValue2 != this.previousFIDS[i]) { this.AnimateFIDSChange(this.valuesFIDS[i], this.deltaFIDS[i], propertyValue2 - this.previousFIDS[i]); this.previousFIDS[i] = propertyValue2; } } } for (int j = 0; j < this.workerTypes.Count; j++) { if (j < this.workersFIDS.Count) { this.workersFIDS[j].Text = this.City.GetPropertyValue(this.workerTypes[j]).ToString(); } } if (this.CityWorkersPanel.IsVisible) { this.CityWorkersPanel.RefreshContent(); } this.RefreshButtons(); }
public void RefreshContent() { if (this.City == null) { return; } if (this.City.Empire == null) { return; } if (this.GuiEmpire.Index != this.City.Empire.Index) { if (this.guiEmpire == null) { this.Unbind(); return; } this.GuiEmpire = new GuiEmpire(this.City.Empire); DepartmentOfIndustry agency = this.City.Empire.GetAgency <DepartmentOfIndustry>(); this.ConstructionQueue = agency.GetConstructionQueue(this.City); } if (this.GuiEmpire != null) { this.FactionBackground.TintColor = this.GuiEmpire.Color; this.PopulationSymbol.TintColor = this.GuiEmpire.Color; this.FactionSymbol.TintColor = this.GuiEmpire.Color; this.PinLine.TintColor = this.GuiEmpire.Color; this.PopulationNumber.Text = GuiFormater.FormatGui(this.City.GetPropertyValue(SimulationProperties.Population), false, false, false, 1); this.FactionSymbol.Image = this.GuiEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, true); } string content = "%CityCurrentConstructionDescription"; if (this.City.IsInfected) { this.PanelSpying.Visible = false; this.PanelOvergrownCity.Visible = true; this.AgeTransform.Height = this.ModifierPosition.EndHeight; if (this.GuiPreviousEmpire == null) { this.GuiPreviousEmpire = new GuiEmpire(this.City.LastNonInfectedOwner); } if (this.GuiPreviousEmpire != null) { this.PreviousEmpireFactionIcon.TintColor = this.GuiPreviousEmpire.Color; this.PreviousEmpireFactionIcon.Image = this.GuiPreviousEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, true); this.PreviousEmpireFactionTooltip.Class = "Descriptor"; this.PreviousEmpireFactionTooltip.ClientData = this.GuiEmpire.Empire; Faction faction = this.GuiPreviousEmpire.Empire.Faction; if (faction != null) { new List <string>(); foreach (SimulationDescriptor simulationDescriptor in faction.GetIntegrationDescriptors()) { this.PreviousEmpireFactionTooltip.Content = simulationDescriptor.Name; } } } if (this.ConstructionQueue.PendingConstructions.Count > 0) { Construction construction = this.ConstructionQueue.Peek(); if (construction.ConstructibleElement.SubCategory == "SubCategoryAssimilation" && construction.ConstructibleElement.Name != "CityConstructibleActionInfectedRaze") { content = "%IntegratingFactionUnderConstructionDescription"; } } } this.ConstructionGroup.AgeTooltip.Content = content; this.RefreshCityName(); DepartmentOfIntelligence agency2 = this.playerControllerRepository.ActivePlayerController.Empire.GetAgency <DepartmentOfIntelligence>(); bool flag = this.playerControllerRepository.ActivePlayerController.Empire.SimulationObject.Tags.Contains(global::Empire.TagEmpireEliminated); if (flag && ELCPUtilities.SpectatorSpyFocus >= 0) { agency2 = this.game.Empires[ELCPUtilities.SpectatorSpyFocus].GetAgency <DepartmentOfIntelligence>(); } Unit hero = null; InfiltrationProcessus.InfiltrationState infiltrationState = InfiltrationProcessus.InfiltrationState.None; bool flag2 = false; if (this.playerControllerRepository != null) { if (this.City.Empire == this.playerControllerRepository.ActivePlayerController.Empire) { flag2 = true; } else if (this.PanelSpying.Visible && agency2 != null && agency2.TryGetSpyOnGarrison(this.City, out hero, out infiltrationState) && infiltrationState == InfiltrationProcessus.InfiltrationState.Infiltrated) { flag2 = true; } else if (flag) { flag2 = true; } } if (!flag2) { if (this.City.Empire == null) { this.CompetitorTitle.Text = string.Empty; } else { DiplomaticRelation diplomaticRelation = this.playerControllerRepository.ActivePlayerController.Empire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(this.City.Empire); Diagnostics.Assert(diplomaticRelation != null); if (diplomaticRelation.State != null && diplomaticRelation.State.Name == DiplomaticRelationState.Names.Alliance) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelAlliedTitle"), this.CompetitorTitle, out this.temp, '.'); this.CompetitorTitle.Text = this.temp; } else if (diplomaticRelation.State != null && diplomaticRelation.State.Name == DiplomaticRelationState.Names.Peace) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelFriendlyTitle"), this.CompetitorTitle, out this.temp, '.'); this.CompetitorTitle.Text = this.temp; } else { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelEnemyTitle"), this.CompetitorTitle, out this.temp, '.'); this.CompetitorTitle.Text = this.temp; } } } this.SelectionButton.AgeTransform.Enable = flag2; this.PlayerSpecificGroup.Visible = flag2; this.CompetitorSpecificGroup.Visible = !flag2; float propertyValue = this.City.GetPropertyValue(SimulationProperties.CityDefensePoint); float propertyValue2 = this.City.GetPropertyValue(SimulationProperties.MaximumCityDefensePoint); float propertyValue3 = this.City.GetPropertyValue(SimulationProperties.CityDefensePointRecoveryPerTurn); float propertyValue4 = this.City.GetPropertyValue(SimulationProperties.Ownership); Diagnostics.Assert(this.UnitNumber != null); Diagnostics.Assert(this.City.StandardUnits != null); int num = (this.City.Militia == null) ? 0 : this.City.Militia.StandardUnits.Count; this.UnitNumber.Text = GuiFormater.FormatGui(this.City.StandardUnits.Count + num); this.DefenseNumber.Text = GuiFormater.FormatStock(propertyValue, SimulationProperties.CityDefensePoint, 0, true); float propertyValue5 = this.City.GetPropertyValue(SimulationProperties.DefensivePower); this.DefenseGroup.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityDefenseDescription"); this.DefenseIcon.Image = AgeManager.Instance.FindDynamicTexture("fortificationCityLabel", false); if (propertyValue5 > 0f) { this.DefenseGroup.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityDefenseWithDefensivePowerDescription").Replace("$DefensivePowerValue", GuiFormater.FormatGui(propertyValue5, false, true, false, 1)); this.DefenseIcon.Image = AgeManager.Instance.FindDynamicTexture("retaliationCityLabel", false); } this.DefenseGroup.AgeTooltip.Content = this.DefenseGroup.AgeTooltip.Content.Replace("$CityDefenseValue", GuiFormater.FormatGui(propertyValue, false, true, false, 1)); if (propertyValue4 < 1f && !this.City.IsInfected) { this.OwnershipPercentage.AgeTransform.Visible = true; this.OwnershipPercentage.Text = GuiFormater.FormatGui(propertyValue4, true, false, false, 1); } else { this.OwnershipPercentage.AgeTransform.Visible = false; } if (this.City.BesiegingEmpire != null || this.City.BesiegingSeafaringArmies.Count != 0 || this.City.IsUnderEarthquake) { float num2 = DepartmentOfTheInterior.GetBesiegingPower(this.City, true); num2 += DepartmentOfTheInterior.GetCityPointEarthquakeDamage(this.City); this.DefenseTendency.Text = "(" + GuiFormater.FormatGui(-num2, false, true, true, 1) + ")"; } else if (propertyValue < propertyValue2) { this.DefenseTendency.Text = "(" + GuiFormater.FormatGui(propertyValue3, false, true, true, 1) + ")"; } else { this.DefenseTendency.Text = string.Empty; } if (flag2) { Construction construction2 = null; if (this.ConstructionQueue != null) { construction2 = this.ConstructionQueue.Peek(); } if (this.City.IsInfected && construction2 == null) { this.PlayerSpecificGroup.Visible = false; } if (construction2 != null) { IImageFeatureProvider imageFeatureProvider = construction2.ConstructibleElement as IImageFeatureProvider; GuiElement guiElement; if (imageFeatureProvider != null) { Texture2D image; if (imageFeatureProvider.TryGetTextureFromIcon(global::GuiPanel.IconSize.Small, out image)) { this.ConstructionImage.Image = image; } } else if (this.guiPanelHelper.TryGetGuiElement(construction2.ConstructibleElement.Name, out guiElement)) { Texture2D image2; if (this.guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image2)) { this.ConstructionImage.Image = image2; } } else { this.ConstructionImage.Image = null; } CityLabel.emptyList.Clear(); int b; float num3; float num4; bool flag3; QueueGuiItem.GetConstructionTurnInfos(this.City, construction2, CityLabel.emptyList, out b, out num3, out num4, out flag3); int numberOfTurn = Mathf.Max(1, b); this.ConstructionTurns.Text = QueueGuiItem.FormatNumberOfTurns(numberOfTurn); } else { this.ConstructionImage.Image = this.NoConstructionTexture; this.ConstructionTurns.Text = "%EmptyConstructionTitle"; } } if (this.PanelSpying.Visible && this.playerControllerRepository != null && agency2 != null) { float value = this.City.GetPropertyValue(SimulationProperties.CityAntiSpy) * 0.01f; this.AntiSpyValue.Text = GuiFormater.FormatGui(value, true, true, false, 0); this.HeroGroup.Visible = false; this.SpyingEffectsGroup.Visible = false; this.AssignSpyButton.AgeTransform.Visible = false; if (this.City.Empire != this.playerControllerRepository.ActivePlayerController.Empire) { if (infiltrationState != InfiltrationProcessus.InfiltrationState.None) { this.HeroGroup.Visible = true; this.HeroCard.Bind(hero, this.playerControllerRepository.ActivePlayerController.Empire as global::Empire, null); this.HeroCard.RefreshContent(false, false); if (this.HeroCard.GuiHero != null) { AgeTooltip ageTooltip = this.HeroCard.HeroPortrait.AgeTransform.AgeTooltip; if (ageTooltip != null) { ageTooltip.Class = "Unit"; ageTooltip.ClientData = this.HeroCard.GuiHero; ageTooltip.Content = this.HeroCard.GuiHero.Title; } } if (infiltrationState == InfiltrationProcessus.InfiltrationState.Infiltrated) { this.InfiltrationTurnSymbol.AgeTransform.Visible = false; this.InfiltrationTurnValue.AgeTransform.Visible = false; this.HeroCard.AgeTransform.Alpha = 1f; this.SpyingEffectsGroup.Visible = true; } else { this.HeroCard.AgeTransform.Alpha = 0.75f; this.InfiltrationTurnSymbol.AgeTransform.Visible = true; this.InfiltrationTurnValue.AgeTransform.Visible = true; int value2 = DepartmentOfIntelligence.InfiltrationRemainingTurns(hero); this.InfiltrationTurnValue.Text = GuiFormater.FormatGui(value2); } } else if (!flag) { this.AssignSpyButton.AgeTransform.Visible = true; float value3 = 0f; this.failures.Clear(); bool flag4 = agency2.CanBeInfiltrate(this.City, out value3, this.failures); bool flag5 = agency2.Empire.GetAgency <DepartmentOfEducation>().Heroes.Count < 1; if (flag5) { flag4 = false; } this.AssignSpyButton.AgeTransform.Enable = flag4; global::IGuiService service = Services.GetService <global::IGuiService>(); string str = string.Empty; if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotAffordable)) { str = "#c52222#"; } string arg = str + GuiFormater.FormatGui(value3, false, true, false, 0) + service.FormatSymbol(this.infiltrationCostResourceName); string format = AgeLocalizer.Instance.LocalizeString("%EspionageLabelAssignSpyTitle"); this.AssignTitle.Text = string.Format(format, arg); AgeTooltip ageTooltip2 = this.AssignSpyButton.AgeTransform.AgeTooltip; if (ageTooltip2) { if (flag4) { ageTooltip2.Content = "%EspionageLabelAssignSpyDescription"; } else if (flag5) { ageTooltip2.Content = "%EspionageLabelAssignSpyNoHeroesDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotVisible)) { ageTooltip2.Content = "%EspionageLabelAssignSpyNoVisibilityDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureSiege)) { ageTooltip2.Content = "%EspionageLabelAssignSpyUnderSiegeDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotAffordable)) { ageTooltip2.Content = "%EspionageLabelAssignSpyNotAffordableDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureAlreadyInfiltrated)) { ageTooltip2.Content = "%EspionageLabelAssignSpyAlreadyInfiltratedDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureCityInfected)) { ageTooltip2.Content = "%EspionageLabelAssignSpyCityInfectedDescription"; } } } } } bool flag6 = false; List <Kaiju> list = new List <Kaiju>(); foreach (RegionalEffect regionalEffect in this.city.GetRegionalEffects()) { IRegionalEffectsProviderGameEntity regionalEffectsProviderGameEntity = null; if (this.regionalEffectsService.TryGetEffectOwner(regionalEffect.GUID, out regionalEffectsProviderGameEntity) && regionalEffectsProviderGameEntity.GetRegionalEffectsProviderContext().SimulationObject.Tags.Contains("ClassKaiju")) { flag6 = true; if (regionalEffectsProviderGameEntity is Kaiju) { Kaiju item = regionalEffectsProviderGameEntity as Kaiju; if (!list.Contains(item)) { list.Add(item); } } } } if (flag6) { AgeTransform ageTransform = this.KaijuIcon.AgeTransform; ageTransform.Visible = true; ageTransform.Enable = true; this.PopulationGroup.PercentBottom = 100f - (ageTransform.Height + ageTransform.PixelMarginBottom) / ageTransform.GetParent().Height * 100f; KaijuInfluenceInCityTooltipData clientData = new KaijuInfluenceInCityTooltipData(this.City, list); this.KaijuIcon.AgeTransform.AgeTooltip.Content = "%CityKaijuAffectedDescription"; this.KaijuIcon.AgeTransform.AgeTooltip.Class = "Kaijus"; this.KaijuIcon.AgeTransform.AgeTooltip.ClientData = clientData; return; } this.KaijuIcon.AgeTransform.Visible = false; this.KaijuIcon.AgeTransform.Enable = false; this.PopulationGroup.PercentBottom = 100f; }
public void GenerateTooltip(AgeTooltip ageTooltip) { if (this.Type == GuiDiplomaticTerm.TermType.Dust) { ageTooltip.Class = "Simple"; ageTooltip.Content = string.Empty; ageTooltip.ClientData = null; return; } if (this.Type == GuiDiplomaticTerm.TermType.City && this.Term.Definition.Name == DiplomaticTermCityExchange.MimicsCityDeal) { string text = this.Term.EmpireWhichProvides.Faction.Affinity.Name.ToString(); text = text.Replace("Affinity", ""); if (text == "Mezari") { text = "Vaulters"; } ageTooltip.Class = "Simple"; ageTooltip.Content = "#FFB43F#" + AgeLocalizer.Instance.LocalizeString("%" + text + "IntegrationDescriptor1Title") + "#REVERT#\n\n" + AgeLocalizer.Instance.LocalizeString("%" + text + "IntegrationDescriptor1EffectOverride"); ageTooltip.ClientData = null; return; } if (this.Type == GuiDiplomaticTerm.TermType.Strategic || this.Type == GuiDiplomaticTerm.TermType.Luxury) { DiplomaticTermResourceExchange diplomaticTermResourceExchange = this.Term as DiplomaticTermResourceExchange; ResourceDefinition resourceDefinition; if (diplomaticTermResourceExchange != null && Databases.GetDatabase <ResourceDefinition>(false).TryGetValue(diplomaticTermResourceExchange.ResourceName, out resourceDefinition)) { IPlayerControllerRepositoryService service = Services.GetService <IGameService>().Game.Services.GetService <IPlayerControllerRepositoryService>(); Diagnostics.Assert(service != null); ResourceTooltipData resourceTooltipData = new ResourceTooltipData(resourceDefinition, service.ActivePlayerController.Empire as global::Empire); if (this.Type == GuiDiplomaticTerm.TermType.Luxury) { IDatabase <BoosterDefinition> database = Databases.GetDatabase <BoosterDefinition>(false); if (database != null) { resourceTooltipData.Constructible = database.GetValue("Booster" + resourceDefinition.Name); } } ageTooltip.Class = resourceTooltipData.TooltipClass; ageTooltip.Content = resourceDefinition.Name; ageTooltip.ClientData = resourceTooltipData; return; } } else if (this.Type == GuiDiplomaticTerm.TermType.Booster) { DiplomaticTermBoosterExchange diplomaticTermBoosterExchange = this.Term as DiplomaticTermBoosterExchange; BoosterDefinition boosterDefinition; if (diplomaticTermBoosterExchange != null && Databases.GetDatabase <BoosterDefinition>(false).TryGetValue(diplomaticTermBoosterExchange.BoosterDefinitionName, out boosterDefinition)) { GuiStackedBooster guiStackedBooster = new GuiStackedBooster(boosterDefinition); ageTooltip.Class = guiStackedBooster.BoosterDefinition.TooltipClass; ageTooltip.Content = guiStackedBooster.BoosterDefinition.Name; ageTooltip.ClientData = guiStackedBooster; return; } } else { if (this.Type == GuiDiplomaticTerm.TermType.Technology) { DepartmentOfScience.BuildTechnologyTooltip((this.Term as DiplomaticTermTechnologyExchange).TechnologyDefinition, this.Term.EmpireWhichProvides, ageTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); return; } if (this.Type == GuiDiplomaticTerm.TermType.Orb) { ageTooltip.Class = "OrbResource"; ageTooltip.Content = "Orb"; ageTooltip.ClientData = null; return; } ageTooltip.Class = "Simple"; ageTooltip.Content = this.Description; ageTooltip.ClientData = this; } }
public void Bind(City city) { if (this.City != null) { this.Unbind(); } this.City = city; this.Empire = this.City.Empire; this.Empire.Refreshed += this.Simulation_Refreshed; this.IsOtherEmpire = (this.playerControllerRepository.ActivePlayerController.Empire != this.Empire); DepartmentOfIndustry agency = this.Empire.GetAgency <DepartmentOfIndustry>(); this.ConstructionQueue = agency.GetConstructionQueue(this.City); base.GuiService.GetGuiPanel <QueueDragPanel>().Bind(this.City); base.GuiService.GetGuiPanel <QueueDragPanel>().CancelDrag(); if (this.ConstructionQueue != null) { this.constructions = this.ConstructionQueue.PendingConstructions; this.ConstructionQueue.CollectionChanged += this.ConstructionQueue_CollectionChanged; } else { this.constructions = new List <Construction>().AsReadOnly(); } GuiElement guiElement = null; for (int i = 0; i < this.typesFIDS.Count; i++) { base.GuiService.GuiPanelHelper.TryGetGuiElement(this.typesFIDS[i], out guiElement, this.City.Empire.Faction.Name); if (guiElement != null) { ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement; if (i < this.TotalValuesTable.GetChildren().Count) { AgeTransform ageTransform = this.TotalValuesTable.GetChildren()[i]; for (int j = 0; j < ageTransform.GetChildren().Count; j++) { AgeTooltip component = ageTransform.GetComponent <AgeTooltip>(); if (component != null) { component.Class = "Simple"; component.Content = extendedGuiElement.Description; } AgeTransform ageTransform2 = ageTransform.GetChildren()[j]; if (ageTransform2.name == "1Symbol") { Texture2D image; if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image)) { ageTransform2.GetComponent <AgePrimitiveImage>().Image = image; ageTransform2.GetComponent <AgePrimitiveImage>().TintColor = extendedGuiElement.Color; } break; } } } } SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = this.City; } } this.GuiEmpire = new GuiEmpire(this.City.Empire); if (this.GuiEmpire != null) { this.OwnerFactionIconSmall.TintColor = this.GuiEmpire.Color; this.OwnerFactionIconSmall.Image = this.GuiEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoLarge, true); } this.GuiPreviousEmpire = new GuiEmpire(this.City.LastNonInfectedOwner); if (this.GuiPreviousEmpire != null) { this.IntegratedFactionIconLarge.Image = this.GuiPreviousEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoLarge, true); this.LastOwnerCityFactionTitle.Text = this.GuiPreviousEmpire.Empire.Faction.LocalizedName; } this.IntegratedFactionIconTooltip.Class = "Descriptor"; this.IntegratedFactionIconTooltip.ClientData = this.City.Empire; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Class = "Descriptor"; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.ClientData = this.City.Empire; Faction faction = this.City.LastNonInfectedOwner.Faction; if (faction != null) { List <string> list = new List <string>(); foreach (SimulationDescriptor simulationDescriptor in faction.GetIntegrationDescriptors()) { this.IntegratedFactionIconTooltip.Content = simulationDescriptor.Name; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Content = simulationDescriptor.Name; if (base.GuiService.GuiPanelHelper.TryGetGuiElement(simulationDescriptor.Name, out guiElement)) { this.IntegratedTraitTitle.Text = "\\7765\\ " + AgeLocalizer.Instance.LocalizeString(guiElement.Title); } } } if (faction.Affinity.Name == this.City.Empire.Faction.Affinity.Name) { this.IntegratedTraitTitle.Text = "%OCPanelIntegratedFactionSameAffinityTitle"; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Class = string.Empty; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.ClientData = null; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Content = "%OCPanelIntegratedFactionSameAffinityTooltip"; this.IntegratedFactionIconTooltip.Class = string.Empty; this.IntegratedFactionIconTooltip.ClientData = null; this.IntegratedFactionIconTooltip.Content = "%OCPanelIntegratedFactionSameAffinityTooltip"; } bool enable = false; this.ActionToogle.AgeTransform.Enable = enable; this.ActionToogle.AgeTransform.Alpha = ((!this.ActionToogle.AgeTransform.Enable) ? 0.5f : 1f); this.ModifierSector.GetComponent <AgePrimitiveSector>().MaxAngle = 0f; this.ModifierSector.Reset(); }
private void RefreshButtons() { if (this.SelectedTradableLine != null && this.SelectedTradableLine.Tradable != null && this.SelectedTradableLine.Tradable.Quantity > 0f) { this.QuantityTextField.AgeTransform.Enable = true; this.QuantityMinusButton.AgeTransform.Enable = (this.CurrentQuantity > 1); if (this.CurrentQuantity >= Mathf.FloorToInt(this.SelectedTradableLine.Tradable.Quantity)) { this.QuantityPlusButton.AgeTransform.Enable = false; this.QuantityPlusButton.AgeTransform.AgeTooltip.Content = "%MarketplaceBuyQuantityPlusTradableQuantityReachedDescription"; } else if (this.CurrentQuantity >= 10) { this.QuantityPlusButton.AgeTransform.Enable = false; this.QuantityPlusButton.AgeTransform.AgeTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString("%MarketplaceBuyQuantityPlusHardLimitReachedDescription"), 10); } else { this.QuantityPlusButton.AgeTransform.Enable = true; this.QuantityPlusButton.AgeTransform.AgeTooltip.Content = "%MarketplaceBuyQuantityPlusDescription"; } string formattedPrice = this.GetFormattedPrice(this.SelectedTradableLine.Tradable, this.CurrentQuantity); this.BuyButtonPriceLabel.Text = formattedPrice; if (this.SelectedTradableLine.Tradable.Quantity >= (float)this.CurrentQuantity && this.CanAfford(this.SelectedTradableLine.Tradable, this.CurrentQuantity)) { this.BuyButton.AgeTransform.Enable = this.interactionsAllowed; AgeTooltip ageTooltip = this.BuyButton.AgeTransform.AgeTooltip; if (ageTooltip != null) { string formattedLine = AgeLocalizer.Instance.LocalizeString("%MarketplaceBuyDescription").Replace("$Quantity", this.CurrentQuantity.ToString()).Replace("$TradableName", this.SelectedTradableLine.LocalizedName).Replace("$Price", formattedPrice); StringBuilder stringBuilder = new StringBuilder(); AgeUtils.CleanLine(formattedLine, ref stringBuilder); ageTooltip.Content = stringBuilder.ToString(); if (this.SelectedTradableLine.Tradable is TradableUnit) { ITradeManagementService service = base.Game.Services.GetService <ITradeManagementService>(); UnitDesign unitDesign; if (service != null && service.TryRetrieveUnitDesign((this.SelectedTradableLine.Tradable as TradableUnit).Barcode, out unitDesign) && unitDesign.Tags.Contains(DownloadableContent9.TagColossus)) { float propertyValue = base.Empire.GetPropertyValue(SimulationProperties.MaximumNumberOfColossi); float propertyValue2 = base.Empire.GetPropertyValue(SimulationProperties.NumberOfColossi); if (propertyValue - propertyValue2 < 1f) { formattedLine = AgeLocalizer.Instance.LocalizeString("%MarketplaceCannotBuyColossusDescription").Replace("$ColossiCap", propertyValue.ToString()); stringBuilder = new StringBuilder(); AgeUtils.CleanLine(formattedLine, ref stringBuilder); this.BuyButton.AgeTransform.Enable = false; ageTooltip.Content = stringBuilder.ToString(); } } } } } else { this.BuyButton.AgeTransform.Enable = false; AgeTooltip ageTooltip2 = this.BuyButton.AgeTransform.AgeTooltip; if (ageTooltip2 != null) { string formattedLine2 = AgeLocalizer.Instance.LocalizeString("%MarketplaceCannotBuyDescription").Replace("$Quantity", this.CurrentQuantity.ToString()).Replace("$TradableName", this.SelectedTradableLine.LocalizedName); StringBuilder stringBuilder2 = new StringBuilder(); AgeUtils.CleanLine(formattedLine2, ref stringBuilder2); ageTooltip2.Content = stringBuilder2.ToString(); } } } else { this.QuantityTextField.AgeTransform.Enable = false; this.QuantityMinusButton.AgeTransform.Enable = false; this.QuantityPlusButton.AgeTransform.Enable = false; this.BuyButton.AgeTransform.Enable = false; this.BuyButtonPriceLabel.Text = string.Empty; AgeTooltip ageTooltip3 = this.BuyButton.AgeTransform.AgeTooltip; if (ageTooltip3 != null) { ageTooltip3.Content = null; } } }
public void RefreshCanExecute() { if (this.ArmyAction != null && !this.Army.IsEmpty) { this.failure.Clear(); bool flag; if (this.ArmyAction is IArmyActionWithTargetSelection && this.ArmyAction is IArmyActionWithUnitSelection) { this.armyActionTargets.Clear(); (this.ArmyAction as IArmyActionWithTargetSelection).FillTargets(this.Army, this.armyActionTargets, ref this.failure); flag = this.ArmyAction.CanExecute(this.Army, ref this.failure, new object[] { this.unitListPanel.SelectUnits, this.armyActionTargets }); } else if (this.ArmyAction is IArmyActionWithTargetSelection) { this.armyActionTargets.Clear(); (this.ArmyAction as IArmyActionWithTargetSelection).FillTargets(this.Army, this.armyActionTargets, ref this.failure); flag = this.ArmyAction.CanExecute(this.Army, ref this.failure, new object[] { this.armyActionTargets }); } else if (this.ArmyAction is IArmyActionWithUnitSelection) { flag = this.ArmyAction.CanExecute(this.Army, ref this.failure, new object[] { this.unitListPanel.SelectUnits }); } else { flag = this.ArmyAction.CanExecute(this.Army, ref this.failure, new object[0]); } flag &= (!this.failure.Contains(ArmyAction.NoCanDoWhileMoving) && !this.failure.Contains(ArmyAction.NoCanDoWhileTutorial)); if (!this.failure.Contains(ArmyAction.NoCanDoWhileHidden)) { this.AgeTransform.AgeTooltip.Content = string.Empty; GuiElement guiElement; if (Services.GetService <Amplitude.Unity.Gui.IGuiService>().GuiPanelHelper.TryGetGuiElement(this.ArmyAction.Name, out guiElement)) { if (this.failure.Count == 0) { this.AgeTransform.AgeTooltip.Content = "#50FF50#" + AgeLocalizer.Instance.LocalizeString(guiElement.Title).ToUpper() + "#REVERT#"; } else { this.AgeTransform.AgeTooltip.Content = "#FF5050#" + AgeLocalizer.Instance.LocalizeString(guiElement.Title).ToUpper() + "#REVERT#"; } } if (this.ArmyAction is IArmyActionWithToggle) { bool flag2 = this.failure.Contains(ArmyAction.NoCanDoWhileToggledOn); if (flag2) { this.failure.RemoveAll((StaticString failureFlag) => failureFlag.Equals(ArmyAction.NoCanDoWhileToggledOn)); } IArmyActionWithToggle armyActionWithToggle = this.ArmyAction as IArmyActionWithToggle; this.ActionToggle.AgeTransform.Enable = flag; this.ActionImage.AgeTransform.Alpha = ((this.ActionToggle.AgeTransform.Enable && !flag2) ? 1f : 0.5f); this.ActionToggle.State = ((flag || flag2) && armyActionWithToggle.IsToggled(this.Army)); if (this.ActionToggle.State && !this.ModifierSector.IsStarted()) { this.ModifierSector.StartAnimation(); } else if (!this.ActionToggle.State && this.ModifierSector.IsStarted()) { this.ModifierSector.Reset(); } if (this.failure.Count == 0) { if (this.ActionToggle.State) { StaticString toggledOnDescriptionOverride = armyActionWithToggle.ToggledOnDescriptionOverride; if (!StaticString.IsNullOrEmpty(toggledOnDescriptionOverride)) { AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip; ageTooltip.Content = ageTooltip.Content + " : " + AgeLocalizer.Instance.LocalizeString("%" + toggledOnDescriptionOverride); } else { AgeTooltip ageTooltip2 = this.AgeTransform.AgeTooltip; ageTooltip2.Content = ageTooltip2.Content + " : " + AgeLocalizer.Instance.LocalizeString(this.ArmyAction.FormatDescription("%" + this.ArmyAction.Name + "OffDescription")); } } else { StaticString toggledOffDescriptionOverride = armyActionWithToggle.ToggledOffDescriptionOverride; if (!StaticString.IsNullOrEmpty(toggledOffDescriptionOverride)) { AgeTooltip ageTooltip3 = this.AgeTransform.AgeTooltip; ageTooltip3.Content = ageTooltip3.Content + " : " + AgeLocalizer.Instance.LocalizeString("%" + toggledOffDescriptionOverride); } else { AgeTooltip ageTooltip4 = this.AgeTransform.AgeTooltip; ageTooltip4.Content = ageTooltip4.Content + " : " + AgeLocalizer.Instance.LocalizeString(this.ArmyAction.FormatDescription("%" + this.ArmyAction.Name + "OnDescription")); } } } } else { this.ActionButton.AgeTransform.Enable = flag; this.ActionImage.AgeTransform.Alpha = ((!this.ActionButton.AgeTransform.Enable) ? 0.5f : 1f); if (this.failure.Count == 0) { AgeTooltip ageTooltip5 = this.AgeTransform.AgeTooltip; ageTooltip5.Content = ageTooltip5.Content + " : " + AgeLocalizer.Instance.LocalizeString(this.ArmyAction.FormatDescription("%" + this.ArmyAction.Name + "Description")); if (this.ArmyAction is ArmyActionWithCooldown) { float num = (this.ArmyAction as ArmyActionWithCooldown).ComputeCooldownDuration(this.Army); this.AgeTransform.AgeTooltip.Content = this.AgeTransform.AgeTooltip.Content.Replace("$CooldownDuration", num.ToString()); } } } if (this.failure.Count > 0) { AgeTooltip ageTooltip6 = this.AgeTransform.AgeTooltip; ageTooltip6.Content = ageTooltip6.Content + " : " + AgeLocalizer.Instance.LocalizeString(this.ArmyAction.FormatDescription("%" + this.failure[0] + "Description")); if (this.ArmyAction is ArmyActionWithCooldown) { float num2 = (this.ArmyAction as ArmyActionWithCooldown).ComputeRemainingCooldownDuration(this.Army); this.AgeTransform.AgeTooltip.Content = this.AgeTransform.AgeTooltip.Content.Replace("$RemainingCooldownDuration", num2.ToString()); } } } float costInActionPoints = this.ArmyAction.GetCostInActionPoints(); if (costInActionPoints > 0f) { AgeTooltip ageTooltip7 = this.AgeTransform.AgeTooltip; ageTooltip7.Content = ageTooltip7.Content + "\n \n" + AgeLocalizer.Instance.LocalizeString("%ArmyActionPointRequirementFormat").Replace("$Value", costInActionPoints.ToString()); } for (int i = 0; i < this.ArmyAction.Costs.Length; i++) { string text = this.ArmyAction.Costs[i].ResourceName; bool flag3 = false; if (ELCPUtilities.UseELCPSymbiosisBuffs && this.ArmyAction is ArmyAction_TameUnstunnedKaiju) { foreach (IGameEntity gameEntity in this.armyActionTargets) { Kaiju kaiju = gameEntity as Kaiju; if (kaiju != null) { KaijuCouncil agency = kaiju.KaijuEmpire.GetAgency <KaijuCouncil>(); if (agency != null) { text = agency.ELCPResourceName; flag3 = true; break; } } } } if (!string.IsNullOrEmpty(text) && !text.Equals(DepartmentOfTheTreasury.Resources.ActionPoint)) { float num3 = this.ArmyAction.GetCostForResource(text, this.Army.Empire); if (flag3) { num3 = KaijuCouncil.GetKaijuTameCost().GetValue(this.Army.Empire); } if (num3 != 0f) { DepartmentOfTheTreasury agency2 = this.Army.Empire.GetAgency <DepartmentOfTheTreasury>(); float f = 0f; if (agency2.TryGetResourceStockValue(this.Army.Empire.SimulationObject, text, out f, false)) { GuiElement guiElement2; if (Services.GetService <global::IGuiService>().GuiPanelHelper.TryGetGuiElement(text, out guiElement2) && guiElement2 is ExtendedGuiElement) { ExtendedGuiElement extendedGuiElement = guiElement2 as ExtendedGuiElement; if (extendedGuiElement == null) { Diagnostics.LogError("Resource extended gui is 'null'."); } string text2 = AgeLocalizer.Instance.LocalizeString(extendedGuiElement.Title); string symbolString = extendedGuiElement.SymbolString; string arg = string.Format(AgeLocalizer.Instance.LocalizeString("%ArmyActionResourceRequirementFormat"), new object[] { num3, text2, symbolString, Mathf.Ceil(f) }); this.AgeTransform.AgeTooltip.Content = string.Format("{0}\n\n\n{1}", this.AgeTransform.AgeTooltip.Content, arg); } else { Diagnostics.LogError("Could not retrieve the resource gui element."); } } } } } } }
public void Bind(City city) { GuiElement guiElement = null; this.City = city; this.DepartmentOfScience = this.City.Empire.GetAgency <DepartmentOfScience>(); this.DepartmentOfTheTreasury = this.City.Empire.GetAgency <DepartmentOfTheTreasury>(); base.GuiService.GetGuiPanel <CityManagementPanel>().Bind(this.City); this.CityWorkersPanel.Bind(this.City); for (int i = 0; i < this.typesFIDS.Count; i++) { base.GuiService.GuiPanelHelper.TryGetGuiElement(this.typesFIDS[i], out guiElement, this.City.Empire.Faction.Name); if (guiElement != null) { ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement; if (i < this.TotalValuesTable.GetChildren().Count) { AgeTransform ageTransform = this.TotalValuesTable.GetChildren()[i]; for (int j = 0; j < ageTransform.GetChildren().Count; j++) { AgeTooltip component = ageTransform.GetComponent <AgeTooltip>(); if (component != null) { component.Class = "Simple"; component.Content = extendedGuiElement.Description; } AgeTransform ageTransform2 = ageTransform.GetChildren()[j]; if (ageTransform2.name == "1Symbol") { Texture2D image; if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image)) { ageTransform2.GetComponent <AgePrimitiveImage>().Image = image; ageTransform2.GetComponent <AgePrimitiveImage>().TintColor = extendedGuiElement.Color; } break; } } } } SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = this.City; } } for (int k = 0; k < this.typesFIDS.Count; k++) { this.previousFIDS[k] = this.City.GetPropertyValue(this.typesFIDS[k]); if (k < this.valuesFIDS.Count) { this.valuesFIDS[k].Text = GuiFormater.FormatGui(this.previousFIDS[k], false, true, false, 1); } } if (this.ApprovalGaugeTooltip.AgeTooltip != null) { SimulationPropertyTooltipData simulationPropertyTooltipData = this.ApprovalGaugeTooltip.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = this.City; } } if (this.ApprovalState.AgeTransform.AgeTooltip != null) { this.ApprovalState.AgeTransform.AgeTooltip.ClientData = this.City; } if (this.GaugePopulationTooltip.AgeTooltip != null) { SimulationPropertyTooltipData simulationPropertyTooltipData = this.GaugePopulationTooltip.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = this.City; } } if (this.PopulationCountGroup != null && this.PopulationCountGroup.AgeTooltip != null) { SimulationPropertyTooltipData simulationPropertyTooltipData = this.PopulationCountGroup.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData != null) { simulationPropertyTooltipData.Context = this.City; } } CityInfoPanel.ShowHidePopulationBuyoutButton(this.playerControllerRepository.ActivePlayerController.Empire, this.City, this.PopulationBuyoutButton.AgeTransform, this.GaugePopulationBackground, this.NextPopulationTurns.AgeTransform, this.NextPopulationHourglass, this.GaugePopulationTooltip); CityInfoPanel.ShowHidePopulationSacrificeButton(this.playerControllerRepository.ActivePlayerController.Empire, this.DepartmentOfScience, this.PopulationSacrificeButton); }