protected override IEnumerator OnLoadGame() { yield return(base.OnLoadGame()); this.playerControllerRepository = base.Game.Services.GetService <IPlayerControllerRepositoryService>(); this.valuesFIDS = new List <AgePrimitiveLabel>(); this.typesFIDS = new List <StaticString>(); this.typesFIDS.Add(SimulationProperties.DistrictFood); this.typesFIDS.Add(SimulationProperties.DistrictIndustry); this.typesFIDS.Add(SimulationProperties.DistrictScience); this.typesFIDS.Add(SimulationProperties.DistrictDust); this.typesFIDS.Add(SimulationProperties.DistrictCityPoint); for (int i = 0; i < this.typesFIDS.Count; i++) { GuiElement guiElement; base.GuiService.GuiPanelHelper.TryGetGuiElement(this.typesFIDS[i], out guiElement); if (guiElement != null) { ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement; if (i < this.TotalValuesTable.GetChildren().Count) { AgeTransform element = this.TotalValuesTable.GetChildren()[i]; for (int j = 0; j < element.GetChildren().Count; j++) { AgeTransform child = element.GetChildren()[j]; if (child.name == "1Symbol") { Texture2D texture; if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out texture)) { child.GetComponent <AgePrimitiveImage>().Image = texture; child.GetComponent <AgePrimitiveImage>().TintColor = extendedGuiElement.Color; } } else if (child.name == "2Value") { this.valuesFIDS.Add(child.GetComponent <AgePrimitiveLabel>()); child.GetComponent <AgePrimitiveLabel>().TintColor = extendedGuiElement.Color; } } } } } Diagnostics.Assert(this.typesFIDS.Count == this.valuesFIDS.Count, "CREEPING NODE INFO PANEL : Invalid number of value FIDS"); for (int k = 0; k < this.valuesFIDS.Count; k++) { if (this.valuesFIDS[k].AgeTransform.AgeTooltip == null) { break; } this.valuesFIDS[k].AgeTransform.AgeTooltip.Class = "FIDS"; this.valuesFIDS[k].AgeTransform.AgeTooltip.Content = this.typesFIDS[k]; this.valuesFIDS[k].AgeTransform.AgeTooltip.ClientData = new SimulationPropertyTooltipData(this.typesFIDS[k], this.typesFIDS[k], null); } yield break; }
private void RefreshCityLine(AgeTransform tableitem, City city, int index) { tableitem.StartNewMesh = true; CityLine component = tableitem.GetComponent <CityLine>(); component.Bind(city, this.selectionClient.gameObject); component.ReadOnly = this.ReadOnly; component.RefreshContent(); component.AgeTransform.Enable = true; if (this.DisableCitiesWithoutSlotLeft) { component.DisableIfNoSlotLeft(); } if (this.DisableCitiesWithHeroAssignmentImpossible) { component.DisableIfHeroAssignmentImpossible(); } if (this.DisableCitiesInEncounter) { component.DisableIfGarrisonIsInEncounter(); } if (this.DisableCitiesWithNoArmySpawnLocation) { component.DisableIfNoArmySpawnLocation(); } if (this.DisableCitiesWithNoSeafaringArmySpawnLocation) { component.DisableIfNoSeafaringArmySpawnLocation(); } }
private void RefreshPointOfInterest(AgeTransform tableitem, PointOfInterest pointOfInterest, int index) { GeoConstructibleLabel component = tableitem.GetComponent <GeoConstructibleLabel>(); component.Bind(pointOfInterest, this.validImprovements[index], this.City, base.gameObject, base.GuiService.GuiPanelHelper); tableitem.Visible = true; }
private void RefreshProgressItem(AgeTransform item, string text, int index) { AgePrimitiveLabel component = item.GetComponent <AgePrimitiveLabel>(); component.Text = text; item.Alpha = 1f - 0.2f * (float)index; }
private void SetupGuiFaction(AgeTransform tableItem, GuiFaction guiFaction, int index) { FactionCard component = tableItem.GetComponent <FactionCard>(); component.SetContent(guiFaction, base.gameObject); ISessionService service = Services.GetService <ISessionService>(); Diagnostics.Assert(service != null); bool lobbyData = service.Session.GetLobbyData <bool>("CustomFactions", true); if (guiFaction.IsCustom && !lobbyData) { component.AgeTransform.Enable = false; component.AgeTransform.AgeTooltip.Content = "%CustomFactionsNotAllowed"; } else { component.AgeTransform.Enable = true; component.AgeTransform.AgeTooltip.Content = string.Empty; } IDownloadableContentService service2 = Services.GetService <IDownloadableContentService>(); bool flag; if (service2 != null && service2.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFaction, component.GuiFaction.Faction.Name, out flag) && !flag) { component.AgeTransform.Enable = false; component.AgeTransform.AgeTooltip.Content = "%RestrictedDownloadableContentTitle"; } if ((service.Session.SessionMode == SessionMode.Single || !service.Session.GetLobbyData <bool>("SpectatorMode", false) || service.Session.GetLobbyData <int>("NumberOfMajorFactions", 0) < 3) && guiFaction.Name == "FactionELCPSpectator") { component.AgeTransform.Enable = false; component.AgeTransform.AgeTooltip.Content = "%GameOptionSpectatorModeDisabled"; } }
private void RefreshEra(AgeTransform tableitem, ResearchEraFrame.TechnologyEra era, int index) { ResearchEraFrame component = tableitem.GetComponent <ResearchEraFrame>(); component.RefreshEra(this.currentEraNumber >= era.EraNumber, this.departmentOfIndustry, this.departmentOfTheInterior, this.departmentOfScience); component.SetSimpleMode(this.currentZoomFactor == 0.5f); }
private void SetupVictoryCondition(AgeTransform item, VictoryCondition victoryCondition, int index) { VictoryStatusItem component = item.GetComponent <VictoryStatusItem>(); component.SetContent(victoryCondition, base.GuiService.GuiPanelHelper, base.PlayerController, index); component.UpdateVictoryStatus(this.empires); }
private void AddCreditHeader(string headerText, Transform prefab) { AgeTransform ageTransform = this.CreditsContent.InstanciateChild(prefab, "CreditItem"); ageTransform.GetComponent <CreditHeaderItem>().HeaderTitle.Text = headerText; this.PlaceItem(ageTransform); }
private void SetupGuiModule(AgeTransform tableItem, GuiModule guiModule, int index) { ExternalModuleLine component = tableItem.GetComponent <ExternalModuleLine>(); if (component == null) { Diagnostics.LogError("In the MenuModuleSetupScreen, trying to refresh a table item that is not a ExternalModuleLine"); return; } if (index % 20 == 0) { tableItem.StartNewMesh = true; } if (guiModule.IsInvalid) { component.SetInvalidMode(guiModule); } else if (guiModule.IsDownloading) { component.SetDownloadingMode(guiModule); } else { component.RefreshContent(guiModule, base.gameObject, index, true); } guiModule.ModuleLine = component; }
private void RefreshParticipantHistogram(AgeTransform tableitem, EmpireInfo empireInfo, int index) { EmpireInfo empireInfo2 = this.EmpireInfos.FirstOrDefault((EmpireInfo iterator) => iterator.IsActiveOrLocalPlayer); int observerIndex = -1; if (empireInfo2 != null) { observerIndex = empireInfo2.EmpireIndex; } if (this.IsEmpireVisible(empireInfo, observerIndex)) { tableitem.Visible = true; AgePrimitiveHistogramLinear component = tableitem.GetComponent <AgePrimitiveHistogramLinear>(); component.TintColor = empireInfo.FactionColor; Snapshot[] snapshots = this.Snapshot.Snapshots; float[] array = new float[snapshots.Length]; for (int i = 0; i < snapshots.Length; i++) { string name = string.Format("Turn #{0}", i); Snapshot snapshot; Snapshot snapshot2; if (this.Snapshot.TryGetSnapshot(name, out snapshot) && snapshot.TryGetSnapshot(empireInfo.EmpireName, out snapshot2)) { snapshot2.TryRead(this.CurrentScoreDefinition.Name, out array[i]); } } component.Values = array; } else { tableitem.Visible = false; } }
private void HeroRefresh(AgeTransform tableitem, Unit hero, int index) { HeroCard component = tableitem.GetComponent <HeroCard>(); component.Bind(hero, this.Empire, base.gameObject); component.RefreshContent(false, false); if (DepartmentOfEducation.IsInjured(hero) || DepartmentOfEducation.IsLocked(hero) || DepartmentOfIntelligence.IsHeroInfiltrating(hero, this.Empire) || DepartmentOfEducation.IsCaptured(hero)) { component.GetComponent <AgeTransform>().Enable = false; component.Foreground.Alpha = 0.8f; } else if (hero.Garrison != null && hero.Garrison.IsInEncounter) { component.GetComponent <AgeTransform>().Enable = false; component.Foreground.Alpha = 0.8f; } else if (DepartmentOfEducation.CheckGarrisonAgainstSiege(hero, hero.Garrison) && !DepartmentOfEducation.CheckHeroExchangeAgainstSiege(hero.Garrison, this.destination)) { component.GetComponent <AgeTransform>().Enable = false; component.Foreground.Alpha = 0.8f; } else { component.GetComponent <AgeTransform>().Enable = true; component.Foreground.Alpha = 0f; } if (this.isASpySelection && !hero.CheckUnitAbility(UnitAbility.ReadonlySpy, -1)) { component.GetComponent <AgeTransform>().Enable = false; component.Foreground.Alpha = 0.8f; } }
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); }
private void RefreshParticipantScoreLine(AgeTransform tableitem, EmpireInfo empireInfo, int index) { tableitem.SetupCustomELCPScaling(this.ParticipantsScoreTableScale); if (this.visibleEmpires.Contains(empireInfo.EmpireIndex)) { tableitem.Visible = true; ParticipantScoreLine component = tableitem.GetComponent <ParticipantScoreLine>(); component.ParticipantName.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale); component.ParticipantScore.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale); component.ParticipantLogoBackground.TintColor = empireInfo.FactionColor; component.ParticipantName.Text = empireInfo.LocalizedName; GuiFaction guiFaction = new GuiFaction(empireInfo.Faction); component.ParticipantLogo.Image = guiFaction.GetImageTexture(GuiPanel.IconSize.LogoLarge, true); Snapshot[] snapshots = this.Snapshot.Snapshots; string name = string.Format("Turn #{0}", snapshots.Length - 1); Snapshot snapshot; Snapshot snapshot2; if (this.Snapshot.TryGetSnapshot(name, out snapshot) && snapshot.TryGetSnapshot(empireInfo.EmpireName, out snapshot2)) { float num; snapshot2.TryRead(this.CurrentScoreDefinition.Name, out num); string str = ""; int decimals = 0; component.ParticipantScore.WordWrap = false; if (num >= 1000f) { str = "k"; if (num <= 10000f) { num = Mathf.Round(num / 100f); num /= 10f; decimals = 1; } else if (num <= 999999f) { num = Mathf.Round(num / 1000f); } else if (num <= 9999999f) { num = Mathf.Round(num / 100000f); num /= 10f; str = "M"; decimals = 1; } else if (num > 9999999f) { num = Mathf.Round(num / 1000000f); str = "M"; } } component.ParticipantScore.Text = GuiFormater.FormatGui(num, false, false, false, decimals) + str; return; } } else { tableitem.Visible = false; } }
private void SetupGuiExchangeTurn(AgeTransform tableItem, GuiExchangeTurn guiExchangeTurn, int index) { ExchangeTurnItem component = tableItem.GetComponent <ExchangeTurnItem>(); component.SetContent(guiExchangeTurn, base.Empire); component.RefreshContent(); tableItem.StartNewMesh = true; }
private void AddCreditParagraph(string paragraphContent) { AgeTransform ageTransform = this.CreditsContent.InstanciateChild(this.CreditParagraphPrefab, "CreditItem"); CreditParagraphItem component = ageTransform.GetComponent <CreditParagraphItem>(); component.ParagraphContent.AgeTransform.Height = 0f; component.ParagraphContent.Text = paragraphContent; this.PlaceItem(ageTransform); }
private void AddCreditLine(string creditTitle, string creditName) { AgeTransform ageTransform = this.CreditsContent.InstanciateChild(this.CreditLinePrefab, "CreditItem"); CreditLineItem component = ageTransform.GetComponent <CreditLineItem>(); component.Title.Text = creditTitle; component.Name.Text = creditName; this.PlaceItem(ageTransform); }
private void UpdateFacility(AgeTransform tableitem, PointOfInterest facilityPoint, int index) { FacilityOccurence component = tableitem.GetComponent <FacilityOccurence>(); if (component != null) { component.RefreshContent(facilityPoint, facilityPoint.PointOfInterestImprovement != null, this.PlayerEmpire, true); component.AgeTransform.AgeTooltip.Anchor = this.FacilitiesTable; } }
private void RefreshFortressLine(AgeTransform tableitem, Fortress fortress, int index) { tableitem.StartNewMesh = true; FortressLine component = tableitem.GetComponent <FortressLine>(); component.Bind(fortress, this.Empire, this.selectionClient.gameObject, false); component.RefreshContent(); component.AgeTransform.Enable = true; component.DisableIfGarrisonIsInEncounter(); }
private void SetupDownloadableContentContainer(AgeTransform tableitem, DownloadableContent downloadableContent, int index) { DlcDescription component = tableitem.GetComponent <DlcDescription>(); if (component != null) { component.SetupContent(downloadableContent, base.gameObject, this.downloadableContentActivationState[downloadableContent.Name]); tableitem.Y = this.currentY; this.currentY += tableitem.Height + this.DlcContainer.VerticalSpacing; } }
private void SetupCustomTraitFamily(AgeTransform tableItem, string customTraitFamily, int index) { CustomTraitFamilyFilterToggle component = tableItem.GetComponent <CustomTraitFamilyFilterToggle>(); if (component == null) { Diagnostics.LogError("In the MenuCustomFactionScreen, trying to refresh a table item that is not a CustomTraitFamilyFilterToggle"); return; } component.SetContent(customTraitFamily, "CustomTraitFamily", base.gameObject); }
private void SetupDiplomaticAbility(AgeTransform tableItem, GuiElement diplomaticAbilityGuiElement, int index) { DiplomaticAbilityItem component = tableItem.GetComponent <DiplomaticAbilityItem>(); if (component == null) { Diagnostics.LogError("In the NegotiationScreen, trying to refresh a table item that is not a DiplomaticAbilityItem"); return; } component.RefreshContent(diplomaticAbilityGuiElement); }
private void RefreshRegionBuilding(AgeTransform tableitem, PointOfInterest reference, int index) { ConstructedBuildingGuiItem component = tableitem.GetComponent <ConstructedBuildingGuiItem>(); Diagnostics.Assert(component != null); if (component != null) { component.RefreshRegionBuilding(this.City, reference, base.GuiService.GuiPanelHelper, base.gameObject); component.Toggle.State = false; tableitem.Enable = (this.interactionsAllowed && !this.IsOtherEmpire && !reference.ArmyPillaging.IsValid && !reference.SimulationObject.Tags.Contains(DepartmentOfDefense.PillageStatusDescriptor)); } }
private void SetupSaveLineSlot(AgeTransform tableitem, int index, GameSaveDescriptor gameSaveDescriptor) { tableitem.DirtyPosition = true; tableitem.Enable = true; if (index % 20 == 0) { tableitem.StartNewMesh = true; } SaveLineSlot component = tableitem.GetComponent <SaveLineSlot>(); component.RefreshContent(index, gameSaveDescriptor, base.gameObject); }
private void RefreshRelationState(AgeTransform slot, DiplomaticRelationState diplomaticRelationState, int index) { global::Game x = base.Game as global::Game; Diagnostics.Assert(x != null); if (this.diplomaticRelationsViewport != null) { string diplomaticRelationName = diplomaticRelationState.Name; Bounds iconBound = this.diplomaticRelationsViewport.GetIconBound(diplomaticRelationName); slot.GetComponent <RelationStateItem>().RefreshContentWith3DView(diplomaticRelationState, iconBound); } }
protected virtual void RefreshGuiUnit(AgeTransform unitTransform, GuiUnit guiUnit, int index) { unitTransform.GetComponent <UnitGuiItem>().RefreshContent(guiUnit, base.gameObject, base.AgeTransform); unitTransform.Enable = !guiUnit.IsMilitia; if (guiUnit.Unit == this.Garrison.Hero) { unitTransform.Visible = false; } else { unitTransform.Visible = true; } }
private void RefreshCityImprovement(AgeTransform tableitem, CityImprovement reference, int index) { ConstructedBuildingGuiItem component = tableitem.GetComponent <ConstructedBuildingGuiItem>(); Diagnostics.Assert(component != null); if (component != null) { component.RefreshCityImprovement(this.City, reference, base.gameObject); component.Toggle.State = false; bool flag = !reference.SimulationObject.DescriptorHolders.Exists((SimulationDescriptorHolder match) => match.Descriptor.Name == "CityImprovementUndestroyable"); tableitem.Enable = (flag && this.interactionsAllowed && !this.IsOtherEmpire); } }
private void SetupGuiFactionTrait(AgeTransform tableItem, GuiFactionTrait guiFactionTrait, int index) { AgePrimitiveLabel component = tableItem.GetComponent <AgePrimitiveLabel>(); if (component != null) { component.Text = guiFactionTrait.IconAndTitle; } if (tableItem.AgeTooltip != null) { guiFactionTrait.GenerateTooltip(tableItem.AgeTooltip, this.SelectedGuiFaction.Faction.Affinity); } }
private void SetupGameSessionLine(AgeTransform tableItem, MenuJoinGameScreen.LobbyDescription lobbyDescription, int index) { MenuOnlineSessionLine component = tableItem.GetComponent <MenuOnlineSessionLine>(); if (component == null) { Diagnostics.LogError("In the MenuJoinGameScreen, trying to refresh a table item that is not a GameSessionLine"); return; } component.LobbyDescription = lobbyDescription; component.Parent = this; component.RefreshContent(); }
private IEnumerator ListGamesAsync(int listingNumber) { this.LoadSaveContainer.DestroyAllChildren(); IGameSerializationService service = Services.GetService <IGameSerializationService>(); if (service != null) { List <GameSaveDescriptor> gameSaveDescriptors = new List <GameSaveDescriptor>(); this.LoadSaveContainer.Height = 0f; IEnumerable <GameSaveDescriptor> listOfGameSaveDescritors = service.GetListOfGameSaveDescritors(!this.SaveMode); foreach (GameSaveDescriptor gameSaveDescriptor in listOfGameSaveDescritors) { gameSaveDescriptors.Add(gameSaveDescriptor); this.LoadSaveContainer.ReserveChildren(gameSaveDescriptors.Count, this.SaveLineSlotPrefab, "Item"); this.LoadSaveContainer.ArrangeChildren(); this.LoadSaveScrollView.OnPositionRecomputed(); int index = gameSaveDescriptors.Count - 1; AgeTransform ageTransform = this.LoadSaveContainer.GetChildren()[index]; this.SetupSaveLineSlot(ageTransform, index, gameSaveDescriptor); if (!Amplitude.Unity.Framework.Application.Preferences.EnableMultiplayer && gameSaveDescriptor.GameSaveSessionDescriptor.SessionMode != SessionMode.Single) { ageTransform.Enable = false; } else { SaveLineSlot component = ageTransform.GetComponent <SaveLineSlot>(); Diagnostics.Assert(component != null); if (component.GameSaveRuntimeConfigurationState == RuntimeModuleConfigurationState.Undefined) { ageTransform.Enable = false; } } yield return(null); if (this.ListingNumber > listingNumber) { yield break; } } IEnumerator <GameSaveDescriptor> enumerator = null; if (this.SortsContainer.SortButtons.Last <SortButton>() != null) { this.SortsContainer.SortButtons.Last <SortButton>().OnSortCB(null); this.SortsContainer.SortButtons.Last <SortButton>().OnSortCB(null); } gameSaveDescriptors = null; } this.listing = null; yield break; yield break; }
private void RefreshBoosterStock(AgeTransform tableitem, GuiStackedBooster guiStackedBooster, int index) { if (this.City == null || this.City.Empire == null) { return; } BoosterStock component = tableitem.GetComponent <BoosterStock>(); if (component != null) { component.Bind(this.City.Empire); component.SetContent(guiStackedBooster); component.RefreshContent(); } }