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;
 }
Exemple #2
0
    protected override IEnumerator OnLoad()
    {
        yield return(base.OnLoad());

        base.UseRefreshLoop              = true;
        this.InteractionAllowed          = true;
        CityLine.ResourceOccurencePrefab = this.ResourceOccurencePrefab;
        CityLine.FidsTypes = new List <string>();
        CityLine.FidsTypes.Add(SimulationProperties.NetCityGrowth);
        CityLine.FidsTypes.Add(SimulationProperties.NetCityProduction);
        CityLine.FidsTypes.Add(SimulationProperties.NetCityResearch);
        CityLine.FidsTypes.Add(SimulationProperties.NetCityMoney);
        CityLine.FidsTypes.Add(SimulationProperties.NetCityEmpirePoint);
        CityLine.FidsPopulations = new List <string>();
        CityLine.FidsPopulations.Add(SimulationProperties.FoodPopulation);
        CityLine.FidsPopulations.Add(SimulationProperties.IndustryPopulation);
        CityLine.FidsPopulations.Add(SimulationProperties.SciencePopulation);
        CityLine.FidsPopulations.Add(SimulationProperties.DustPopulation);
        CityLine.FidsPopulations.Add(SimulationProperties.CityPointPopulation);
        CityLine.FidsColors = new List <Color>();
        for (int i = 0; i < CityLine.FidsTypes.Count; i++)
        {
            GuiElement guiElement;
            base.GuiService.GuiPanelHelper.TryGetGuiElement(CityLine.FidsTypes[i], out guiElement);
            if (guiElement != null)
            {
                ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement;
                if (extendedGuiElement != null)
                {
                    CityLine.FidsColors.Add(extendedGuiElement.Color);
                }
            }
        }
        yield break;
    }
Exemple #3
0
 public void RefreshContent(CreepingNode creepingNode, GameObject client)
 {
     if (creepingNode != null)
     {
         this.selectionClient                    = client;
         this.CreepingNodeWorldPosition          = creepingNode.WorldPosition;
         this.DestroyedArmyIcon.Visible          = false;
         this.title.AgeTransform.PixelMarginLeft = this.DestroyedArmyIcon.PixelMarginRight;
         string     text = creepingNode.PointOfInterest.CreepingNodeImprovement.Name;
         GuiElement guiElement;
         if (Services.GetService <global::IGuiService>().GuiPanelHelper.TryGetGuiElement(creepingNode.PointOfInterest.CreepingNodeImprovement.Name, out guiElement))
         {
             text = guiElement.Title;
             if (guiElement is ExtendedGuiElement)
             {
                 ExtendedGuiElement extendedGuiElement = guiElement as ExtendedGuiElement;
                 if (extendedGuiElement.TooltipElement != null)
                 {
                     text = extendedGuiElement.Title;
                 }
             }
         }
         this.title.Text = text;
         this.ShowLocationAttackerButton.Visible = false;
         this.ShowLocationAttackerButton.Enable  = false;
     }
 }
    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;
    }
    protected override IEnumerator OnLoad()
    {
        yield return(base.OnLoad());

        base.UseRefreshLoop = true;
        GameObject prefab = (GameObject)Resources.Load(DiplomaticNegotiationViewport.DefaultPrefabName);

        if (prefab != null)
        {
            GameObject instance = UnityEngine.Object.Instantiate <GameObject>(prefab);
            if (instance != null)
            {
                instance.transform.parent          = base.transform;
                this.diplomaticNegotiationViewport = instance.GetComponent <DiplomaticNegotiationViewport>();
                yield return(this.diplomaticNegotiationViewport.OnLoad(this.ViewportLayer));

                if (this.SelectedEmpire != null)
                {
                    this.diplomaticNegotiationViewport.SetApparence(this.SelectedEmpire.Faction.AffinityMapping, this.SelectedEmpire.Color);
                }
            }
        }
        this.setupDiplomaticAbilityDelegate = new AgeTransform.RefreshTableItem <GuiElement>(this.SetupDiplomaticAbility);
        this.MyTermOptionsPanel.Load();
        this.TheirTermOptionsPanel.Load();
        this.ContractPanel.Load();
        this.ContractPanel.AdjustHeightToContent = false;
        Color      positiveColor = Color.white;
        Color      negativeColor = Color.white;
        GuiElement guiElement;

        if (base.GuiService.GuiPanelHelper.TryGetGuiElement("DiplomaticContractEvaluationPositive", out guiElement))
        {
            ExtendedGuiElement extendedGuiElement = guiElement as ExtendedGuiElement;
            if (extendedGuiElement != null)
            {
                positiveColor = extendedGuiElement.Color;
            }
        }
        if (base.GuiService.GuiPanelHelper.TryGetGuiElement("DiplomaticContractEvaluationNegative", out guiElement))
        {
            ExtendedGuiElement extendedGuiElement2 = guiElement as ExtendedGuiElement;
            if (extendedGuiElement2 != null)
            {
                negativeColor = extendedGuiElement2.Color;
            }
        }
        this.DealApprovalGauge.Init(-4f, 4f, positiveColor, negativeColor);
        yield break;
    }
 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 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 override IEnumerator OnLoad()
    {
        yield return(base.OnLoadGame());

        base.UseRefreshLoop = true;
        this.workerTypes    = new List <StaticString>();
        this.workerTypes.Add(SimulationProperties.FoodPopulation);
        this.workerTypes.Add(SimulationProperties.IndustryPopulation);
        this.workerTypes.Add(SimulationProperties.SciencePopulation);
        this.workerTypes.Add(SimulationProperties.DustPopulation);
        this.workerTypes.Add(SimulationProperties.CityPointPopulation);
        this.prodPerPopFIDSTypes = new List <StaticString>();
        this.prodPerPopFIDSTypes.Add(SimulationProperties.BaseFoodPerPopulation);
        this.prodPerPopFIDSTypes.Add(SimulationProperties.BaseIndustryPerPopulation);
        this.prodPerPopFIDSTypes.Add(SimulationProperties.BaseSciencePerPopulation);
        this.prodPerPopFIDSTypes.Add(SimulationProperties.BaseDustPerPopulation);
        this.prodPerPopFIDSTypes.Add(SimulationProperties.BaseCityPointPerPopulation);
        this.workedFIDSTypes = new List <StaticString>();
        this.workedFIDSTypes.Add(SimulationProperties.WorkedFood);
        this.workedFIDSTypes.Add(SimulationProperties.WorkedIndustry);
        this.workedFIDSTypes.Add(SimulationProperties.WorkedScience);
        this.workedFIDSTypes.Add(SimulationProperties.WorkedDust);
        this.workedFIDSTypes.Add(SimulationProperties.WorkedCityPoint);
        this.cityTileFIDSTypes = new List <StaticString>();
        this.cityTileFIDSTypes.Add(SimulationProperties.DistrictFoodNet);
        this.cityTileFIDSTypes.Add(SimulationProperties.DistrictIndustryNet);
        this.cityTileFIDSTypes.Add(SimulationProperties.DistrictScienceNet);
        this.cityTileFIDSTypes.Add(SimulationProperties.DistrictDustNet);
        this.cityTileFIDSTypes.Add(SimulationProperties.DistrictCityPointNet);
        this.totalFIDSTypes = new List <StaticString>();
        this.totalFIDSTypes.Add(SimulationProperties.NetCityGrowth);
        this.totalFIDSTypes.Add(SimulationProperties.NetCityProduction);
        this.totalFIDSTypes.Add(SimulationProperties.NetCityResearch);
        this.totalFIDSTypes.Add(SimulationProperties.NetCityMoney);
        this.totalFIDSTypes.Add(SimulationProperties.NetCityEmpirePoint);
        for (int i = 0; i < this.prodPerPopFIDSTypes.Count; i++)
        {
            GuiElement guiElement;
            base.GuiService.GuiPanelHelper.TryGetGuiElement(this.prodPerPopFIDSTypes[i], out guiElement);
            if (guiElement != null)
            {
                ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement;
                if (i < this.FidsSymbols.Length && i < this.ProdPerPopFIDSValues.Length && i < this.ModifierFIDSValues.Length && i < this.CityTileFIDSValues.Length && i < this.TotalFIDSValues.Length && extendedGuiElement != null)
                {
                    Texture2D image;
                    if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image))
                    {
                        this.FidsSymbols[i].Image     = image;
                        this.FidsSymbols[i].TintColor = extendedGuiElement.Color;
                    }
                    this.ProdPerPopFIDSValues[i].TintColor = extendedGuiElement.Color;
                    this.CityTileFIDSValues[i].TintColor   = extendedGuiElement.Color;
                    this.ModifierFIDSValues[i].TintColor   = extendedGuiElement.Color;
                    this.TotalFIDSValues[i].TintColor      = extendedGuiElement.Color;
                }
            }
        }
        if (this.WorkersGroups.Length != 0)
        {
            AgeTransform workersTable = this.WorkersGroups[0].WorkersTable;
            AgeTransform component    = this.WorkersGroups[0].WorkerSymbolPrefab.GetComponent <AgeTransform>();
            this.childWidth     = component.Width * AgeUtils.CurrentUpscaleFactor();
            this.childHeight    = component.Height * AgeUtils.CurrentUpscaleFactor();
            this.workersPerLine = Mathf.RoundToInt((workersTable.Width - workersTable.HorizontalMargin) / (this.childWidth + workersTable.HorizontalSpacing));
        }
        string[] array = new string[this.prodPerPopFIDSTypes.Count];
        array[0] = string.Format("{0},{1},{2},!{3}", new object[]
        {
            SimulationProperties.CityFood,
            SimulationProperties.CityGrowth,
            SimulationProperties.NetCityGrowth,
            SimulationProperties.CityGrowthUpkeep
        });
        array[1] = string.Format("{0},{1},{2},!{3}", new object[]
        {
            SimulationProperties.CityIndustry,
            SimulationProperties.CityProduction,
            SimulationProperties.NetCityProduction,
            SimulationProperties.CityProductionUpkeep
        });
        array[2] = string.Format("{0},{1},{2},!{3}", new object[]
        {
            SimulationProperties.CityScience,
            SimulationProperties.CityResearch,
            SimulationProperties.NetCityResearch,
            SimulationProperties.CityResearchUpkeep
        });
        array[3] = string.Format("{0},{1},{2},!{3}", new object[]
        {
            SimulationProperties.CityDust,
            SimulationProperties.CityMoney,
            SimulationProperties.NetCityMoney,
            SimulationProperties.TotalCityMoneyUpkeep
        });
        array[4] = string.Format("{0},{1},{2}", SimulationProperties.CityCityPoint, SimulationProperties.CityEmpirePoint, SimulationProperties.NetCityEmpirePoint);
        string[] array2 = new string[this.prodPerPopFIDSTypes.Count];
        array2[0] = string.Format("%ModifierCategory{0}Title", SimulationProperties.CityFood);
        array2[1] = string.Format("%ModifierCategory{0}Title", SimulationProperties.CityIndustry);
        array2[2] = string.Format("%ModifierCategory{0}Title", SimulationProperties.CityScience);
        array2[3] = string.Format("%ModifierCategory{0}Title", SimulationProperties.CityDust);
        array2[4] = string.Format("%ModifierCategory{0}Title", SimulationProperties.CityCityPoint);
        string[] array3 = new string[this.prodPerPopFIDSTypes.Count];
        array3[0] = string.Format("{0},{1}", SimulationProperties.DistrictFood, SimulationProperties.DistrictFoodNet);
        array3[1] = string.Format("{0},{1}", SimulationProperties.DistrictIndustry, SimulationProperties.DistrictIndustryNet);
        array3[2] = string.Format("{0},{1}", SimulationProperties.DistrictScience, SimulationProperties.DistrictScienceNet);
        array3[3] = string.Format("{0},{1}", SimulationProperties.DistrictDust, SimulationProperties.DistrictDustNet);
        array3[4] = string.Format("{0},{1}", SimulationProperties.DistrictCityPoint, SimulationProperties.DistrictCityPointNet);
        int num = 0;

        while (num < this.prodPerPopFIDSTypes.Count && !(this.ProdPerPopFIDSValues[num].AgeTransform.AgeTooltip == null))
        {
            this.ProdPerPopFIDSValues[num].AgeTransform.AgeTooltip.Class      = "FIDS";
            this.ProdPerPopFIDSValues[num].AgeTransform.AgeTooltip.Content    = this.prodPerPopFIDSTypes[num];
            this.ProdPerPopFIDSValues[num].AgeTransform.AgeTooltip.ClientData = new SimulationPropertyTooltipData(this.prodPerPopFIDSTypes[num], this.prodPerPopFIDSTypes[num], this.City);
            this.CityTileFIDSValues[num].AgeTransform.AgeTooltip.Class        = "FIDS";
            this.CityTileFIDSValues[num].AgeTransform.AgeTooltip.Content      = this.cityTileFIDSTypes[num];
            this.CityTileFIDSValues[num].AgeTransform.AgeTooltip.ClientData   = new SimulationPropertyTooltipData(this.cityTileFIDSTypes[num], array3[num], this.City);
            this.ModifierFIDSValues[num].AgeTransform.AgeTooltip.Class        = "FIDS";
            this.ModifierFIDSValues[num].AgeTransform.AgeTooltip.Content      = array2[num];
            this.ModifierFIDSValues[num].AgeTransform.AgeTooltip.ClientData   = new SimulationPropertyTooltipData(array2[num], array[num], this.City);
            this.TotalFIDSValues[num].AgeTransform.AgeTooltip.Class           = "FIDS";
            this.TotalFIDSValues[num].AgeTransform.AgeTooltip.Content         = this.totalFIDSTypes[num];
            this.TotalFIDSValues[num].AgeTransform.AgeTooltip.ClientData      = new SimulationPropertyTooltipData(this.totalFIDSTypes[num], GuiSimulation.Instance.FIMSTooltipTotal[num], this.City);
            num++;
        }
        yield break;
    }
 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.");
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #10
0
    protected override IEnumerator OnLoad()
    {
        yield return(base.OnLoad());

        base.UseRefreshLoop = true;
        this.valuesFIDS     = new List <AgePrimitiveLabel>();
        this.deltaFIDS      = new List <AgePrimitiveLabel>();
        this.workersFIDS    = new List <AgePrimitiveLabel>();
        this.previousFIDS   = new List <float>();
        this.typesFIDS      = new List <StaticString>();
        this.typesFIDS.Add(SimulationProperties.NetCityGrowth);
        this.typesFIDS.Add(SimulationProperties.NetCityProduction);
        this.typesFIDS.Add(SimulationProperties.NetCityResearch);
        this.typesFIDS.Add(SimulationProperties.NetCityMoney);
        this.typesFIDS.Add(SimulationProperties.NetCityEmpirePoint);
        this.workerTypes = new List <StaticString>();
        this.workerTypes.Add(SimulationProperties.FoodPopulation);
        this.workerTypes.Add(SimulationProperties.IndustryPopulation);
        this.workerTypes.Add(SimulationProperties.SciencePopulation);
        this.workerTypes.Add(SimulationProperties.DustPopulation);
        this.workerTypes.Add(SimulationProperties.CityPointPopulation);
        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;
                        }
                        else if (child.name == "3Modifier")
                        {
                            this.deltaFIDS.Add(child.GetComponent <AgePrimitiveLabel>());
                        }
                        else if (child.name == "5PopulationValue")
                        {
                            this.workersFIDS.Add(child.GetComponent <AgePrimitiveLabel>());
                        }
                    }
                }
            }
            this.previousFIDS.Add(0f);
        }
        Diagnostics.Assert(this.typesFIDS.Count == this.valuesFIDS.Count, "CITY INFO PANEL : Invalid number of value FIDS");
        Diagnostics.Assert(this.deltaFIDS.Count == this.valuesFIDS.Count, "CITY INFO PANEL : Invalid number of delta FIDS");
        this.CityWorkersPanel.Load();
        base.GuiService.GetGuiPanel <CityManagementPanel>().Load();
        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], GuiSimulation.Instance.FIMSTooltipTotal[k], this.City);
        }
        if (this.ApprovalGaugeTooltip.AgeTooltip != null)
        {
            this.ApprovalGaugeTooltip.AgeTooltip.Class      = "FIDS";
            this.ApprovalGaugeTooltip.AgeTooltip.Content    = "none";
            this.ApprovalGaugeTooltip.AgeTooltip.ClientData = new SimulationPropertyTooltipData(SimulationProperties.NetCityApproval, string.Format("{0},{1},!{2}", SimulationProperties.NetCityApproval, SimulationProperties.CityApproval, SimulationProperties.CityApprovalUpkeep), this.City);
        }
        if (this.ApprovalState.AgeTransform.AgeTooltip != null)
        {
            this.ApprovalState.AgeTransform.AgeTooltip.Class      = "Descriptor";
            this.ApprovalState.AgeTransform.AgeTooltip.ClientData = this.City;
        }
        if (this.GaugePopulationTooltip.AgeTooltip != null)
        {
            this.GaugePopulationTooltip.AgeTooltip.Class      = "CityGrowth";
            this.GaugePopulationTooltip.AgeTooltip.Content    = "none";
            this.GaugePopulationTooltip.AgeTooltip.ClientData = new SimulationPropertyTooltipData(SimulationProperties.NetCityGrowth, string.Format("{0},{1},!{2}", SimulationProperties.WorkedFood, SimulationProperties.CityGrowth, SimulationProperties.CityGrowthUpkeep), this.City);
        }
        if (this.PopulationCountGroup != null && this.PopulationCountGroup.AgeTooltip != null)
        {
            this.PopulationCountGroup.AgeTooltip.Class      = "Population";
            this.PopulationCountGroup.AgeTooltip.Content    = "Population";
            this.PopulationCountGroup.AgeTooltip.ClientData = new SimulationPropertyTooltipData(SimulationProperties.Workers, SimulationProperties.Workers, this.City);
        }
        yield break;
    }
Exemple #11
0
    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();
    }
Exemple #12
0
    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);
    }
    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();
    }
        public void ParseSimulationDescriptor(SimulationDescriptor descriptor, List <EffectDescription> effectDescriptions, StaticString defaultClass, bool displayEmptyDescriptors = false, SimulationObject context = null, bool isContextTheSource = true, bool isForceOn = false, bool parseTitle = false)
        {
            if (descriptor == null)
            {
                throw new ArgumentNullException("descriptor");
            }
            GuiElement guiElement;

            if (this.GuiService.GuiPanelHelper.TryGetGuiElement(descriptor.Name, out guiElement) && guiElement is ExtendedGuiElement)
            {
                ExtendedGuiElement extendedGuiElement = guiElement as ExtendedGuiElement;
                if (extendedGuiElement.TooltipElement != null)
                {
                    if (!string.IsNullOrEmpty(extendedGuiElement.TooltipElement.EffectOverride))
                    {
                        EffectDescription effectDescription = new EffectDescription();
                        effectDescription.Override = AgeLocalizer.Instance.LocalizeString(extendedGuiElement.TooltipElement.EffectOverride);
                        if (extendedGuiElement.Name.ToString().Contains("Bonus1Value"))
                        {
                            effectDescription.Override = effectDescription.Override.Replace("+500", "+" + 500f * (float)this.GetGameSpeed() / 2f);
                        }
                        else if (extendedGuiElement.Name.ToString().Contains("Bonus2Value"))
                        {
                            effectDescription.Override = effectDescription.Override.Replace("+1000", "+" + 1000f * (float)this.GetGameSpeed() / 2f);
                        }
                        if (parseTitle)
                        {
                            effectDescription.Title = AgeLocalizer.Instance.LocalizeString(guiElement.Title);
                        }
                        effectDescriptions.Add(effectDescription);
                    }
                    if (extendedGuiElement.TooltipElement.Ignore)
                    {
                        return;
                    }
                }
            }
            if (descriptor.SimulationModifierDescriptors == null)
            {
                if (this.GuiService.GuiPanelHelper.TryGetGuiElement(descriptor.Name, out guiElement))
                {
                    if (guiElement is ExtendedGuiElement)
                    {
                        ExtendedGuiElement extendedGuiElement2 = guiElement as ExtendedGuiElement;
                        if (extendedGuiElement2.TooltipElement != null && extendedGuiElement2.TooltipElement.Ignore)
                        {
                            return;
                        }
                    }
                    EffectDescription effectDescription2 = new EffectDescription();
                    effectDescription2.Override = AgeLocalizer.Instance.LocalizeString(guiElement.Title);
                    if (guiElement.Name == "TechnologyNecrophages8")
                    {
                        effectDescription2.Override = effectDescription2.Override.Replace("+1", "+" + this.GetGameSpeed());
                    }
                    if (parseTitle)
                    {
                        effectDescription2.Title = AgeLocalizer.Instance.LocalizeString(guiElement.Title);
                    }
                    effectDescription2.On = this.ComputeReadableString(defaultClass, false);
                    effectDescriptions.Add(effectDescription2);
                }
                return;
            }
            bool flag = false;

            if (parseTitle)
            {
                flag = true;
            }
            for (int i = 0; i < descriptor.SimulationModifierDescriptors.Length; i++)
            {
                SimulationModifierDescriptor simulationModifierDescriptor = descriptor.SimulationModifierDescriptors[i];
                if (simulationModifierDescriptor.Operation != SimulationModifierDescriptor.ModifierOperation.Force && !simulationModifierDescriptor.TooltipHidden)
                {
                    EffectDescription effectDescription3 = null;
                    this.ParseModifier(descriptor, simulationModifierDescriptor, defaultClass, context, isContextTheSource, out effectDescription3, isForceOn);
                    if (effectDescription3 != null)
                    {
                        if (context != null && isContextTheSource)
                        {
                            effectDescription3.From = this.ComputeReadableString(descriptor.Name, true);
                        }
                        if (flag)
                        {
                            effectDescription3.Title = AgeLocalizer.Instance.LocalizeString("%" + descriptor.Name + "Title");
                            flag = false;
                        }
                        effectDescriptions.Add(effectDescription3);
                    }
                }
            }
        }
        protected virtual void ParseModifier(SimulationDescriptor simulationDescriptor, SimulationModifierDescriptor modifierDescriptor, StaticString defaultClass, SimulationObject context, bool isContextSource, out EffectDescription effectMapperElementDescription, bool isForceOn = false)
        {
            effectMapperElementDescription = null;
            bool       forcePercent = false;
            GuiElement guiElement;

            if (this.GuiService.GuiPanelHelper.TryGetGuiElement(modifierDescriptor.TargetPropertyName, out guiElement) && guiElement is ExtendedGuiElement)
            {
                ExtendedGuiElement extendedGuiElement = guiElement as ExtendedGuiElement;
                if (extendedGuiElement.TooltipElement != null)
                {
                    if (extendedGuiElement.TooltipElement.Ignore)
                    {
                        return;
                    }
                    forcePercent = extendedGuiElement.TooltipElement.Percent;
                }
            }
            SimulationObject simulationObject = context;

            if (!isContextSource)
            {
                simulationObject = null;
            }
            if (modifierDescriptor is SingleSimulationModifierDescriptor)
            {
                effectMapperElementDescription = this.ParseSingleModifier(simulationDescriptor, modifierDescriptor as SingleSimulationModifierDescriptor, simulationObject, forcePercent);
            }
            else if (modifierDescriptor is BinarySimulationModifierDescriptor)
            {
                effectMapperElementDescription = this.ParseBinaryModifier(simulationDescriptor, modifierDescriptor as BinarySimulationModifierDescriptor, simulationObject, forcePercent);
            }
            else if (modifierDescriptor is CountSimulationModifierDescriptor)
            {
                effectMapperElementDescription = this.ParseCountModifier(simulationDescriptor, modifierDescriptor as CountSimulationModifierDescriptor, simulationObject, forcePercent);
            }
            if (effectMapperElementDescription == null || string.IsNullOrEmpty(effectMapperElementDescription.Value))
            {
                return;
            }
            if (!string.IsNullOrEmpty(modifierDescriptor.TooltipOverride))
            {
                if (modifierDescriptor.LocalizeTooltipOverride)
                {
                    effectMapperElementDescription.Format = AgeLocalizer.Instance.LocalizeString(modifierDescriptor.TooltipOverride);
                }
                else
                {
                    effectMapperElementDescription.Format = modifierDescriptor.TooltipOverride;
                }
            }
            effectMapperElementDescription.Symbol = this.ComputePropertySymbol(modifierDescriptor.TargetPropertyName);
            if (simulationObject != null)
            {
            }
            if (simulationObject == null || isForceOn)
            {
                string on = string.Empty;
                if (modifierDescriptor.Path != null && modifierDescriptor.Path.Length > 0 && modifierDescriptor.Path[0].Length > 0)
                {
                    this.GetScope(modifierDescriptor.Path, out on);
                }
                else
                {
                    on = this.ComputeReadableString(defaultClass, true);
                }
                effectMapperElementDescription.On = on;
            }
            string condition = string.Empty;

            if (modifierDescriptor.Path != null && modifierDescriptor.Path.Length > 0 && modifierDescriptor.Path[0].Length > 0)
            {
                condition = this.ComputeDuringString(modifierDescriptor.Path);
            }
            effectMapperElementDescription.Condition = condition;
        }