Ejemplo n.º 1
0
 public void Unbind()
 {
     base.GuiService.GetGuiPanel <QueueDragPanel>().Unbind();
     this.GuiEmpire         = null;
     this.GuiPreviousEmpire = null;
     this.constructions     = null;
     this.previousConstructionSurplus.Clear();
     if (this.ConstructionQueue != null)
     {
         this.ConstructionQueue.CollectionChanged -= this.ConstructionQueue_CollectionChanged;
         this.ConstructionQueue = null;
     }
     if (this.Empire != null)
     {
         this.Empire.Refreshed -= this.Simulation_Refreshed;
         this.Empire            = null;
     }
     if (this.City != null)
     {
         this.City = null;
     }
     for (int i = 0; i < this.valuesFIDS.Count; i++)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData != null)
         {
             simulationPropertyTooltipData.Context = null;
         }
     }
     this.IsOtherEmpire = true;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 public override void Unbind()
 {
     if (base.Empire != null)
     {
         this.DepartmentOfTheTreasury = null;
         this.DepartmentOfScience     = null;
         base.Empire.Refreshed       -= this.Simulation_Refreshed;
     }
     if (this.EmpireTreasuryPanel.AgeTooltip != null)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData = this.EmpireTreasuryPanel.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData != null)
         {
             simulationPropertyTooltipData.Context = null;
         }
     }
     if (this.EmpirePointsPanel.AgeTooltip != null)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData = this.EmpirePointsPanel.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData != null)
         {
             simulationPropertyTooltipData.Context = null;
         }
     }
     if (this.EmpireLavapoolStockPanel.AgeTooltip != null)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData = this.EmpireLavapoolStockPanel.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData != null)
         {
             simulationPropertyTooltipData.Context = null;
         }
     }
     base.Unbind();
 }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
 public void Unbind()
 {
     this.DepartmentOfScience     = null;
     this.DepartmentOfTheTreasury = null;
     if (this.City != null)
     {
         this.CityWorkersPanel.Unbind();
         base.GuiService.GetGuiPanel <CityManagementPanel>().Unbind();
         for (int i = 0; i < this.valuesFIDS.Count; i++)
         {
             SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
         }
         if (this.ApprovalGaugeTooltip.AgeTooltip != null)
         {
             SimulationPropertyTooltipData simulationPropertyTooltipData = this.ApprovalGaugeTooltip.AgeTooltip.ClientData as SimulationPropertyTooltipData;
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
         }
         if (this.ApprovalState.AgeTransform.AgeTooltip != null)
         {
             this.ApprovalState.AgeTransform.AgeTooltip.ClientData = null;
         }
         if (this.GaugePopulationTooltip.AgeTooltip != null)
         {
             SimulationPropertyTooltipData simulationPropertyTooltipData = this.GaugePopulationTooltip.AgeTooltip.ClientData as SimulationPropertyTooltipData;
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
         }
         if (this.PopulationCountGroup != null && this.PopulationCountGroup.AgeTooltip != null)
         {
             SimulationPropertyTooltipData simulationPropertyTooltipData = this.PopulationCountGroup.AgeTooltip.ClientData as SimulationPropertyTooltipData;
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
         }
         this.City = null;
     }
 }
Ejemplo n.º 6
0
 public void Unbind()
 {
     this.PlayerController = null;
     if (this.Fortress != null)
     {
         for (int i = 0; i < this.valuesFIDS.Count; i++)
         {
             SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
         }
         this.Fortress = null;
     }
     this.updateFacilityDelegate = null;
 }
Ejemplo n.º 7
0
 public override void Bind(global::Empire empire)
 {
     base.Bind(empire);
     this.ResourceEnumerator.Bind(empire);
     this.DepartmentOfTheTreasury = base.Empire.GetAgency <DepartmentOfTheTreasury>();
     this.DepartmentOfScience     = base.Empire.GetAgency <DepartmentOfScience>();
     base.Empire.Refreshed       += this.Simulation_Refreshed;
     if (this.EmpireTreasuryPanel.AgeTooltip != null)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData = this.EmpireTreasuryPanel.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData != null)
         {
             simulationPropertyTooltipData.Context   = empire;
             simulationPropertyTooltipData.StockName = SimulationProperties.EmpireMoney;
         }
     }
     if (this.EmpirePointsPanel.AgeTooltip != null)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData2 = this.EmpirePointsPanel.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData2 != null)
         {
             simulationPropertyTooltipData2.Context   = empire;
             simulationPropertyTooltipData2.StockName = SimulationProperties.EmpirePoint;
         }
     }
     if (this.EmpireLavapoolStockPanel.AgeTooltip != null)
     {
         SimulationPropertyTooltipData simulationPropertyTooltipData3 = this.EmpireLavapoolStockPanel.AgeTooltip.ClientData as SimulationPropertyTooltipData;
         if (simulationPropertyTooltipData3 != null)
         {
             simulationPropertyTooltipData3.Context   = empire;
             simulationPropertyTooltipData3.StockName = SimulationProperties.LavapoolStock;
         }
     }
     if (base.Empire.Index != base.PlayerController.Empire.Index)
     {
         this.interactionsAllowed = false;
     }
     base.NeedRefresh = true;
 }
Ejemplo n.º 8
0
 public void Unbind()
 {
     if (this.departmentOfEducation != null)
     {
         this.departmentOfEducation.VaultItemsCollectionChange -= this.DepartmentOfEducation_VaultItemsCollectionChange;
         this.departmentOfEducation = null;
     }
     if (this.City != null)
     {
         for (int i = 0; i < this.prodPerPopFIDSTypes.Count; i++)
         {
             SimulationPropertyTooltipData simulationPropertyTooltipData = this.ProdPerPopFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
             simulationPropertyTooltipData = (this.CityTileFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData);
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
             simulationPropertyTooltipData = (this.TotalFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData);
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
             simulationPropertyTooltipData = (this.ModifierFIDSValues[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData);
             if (simulationPropertyTooltipData != null)
             {
                 simulationPropertyTooltipData.Context = null;
             }
         }
         this.City.Refreshed -= this.City_Refreshed;
         this.City            = null;
     }
     this.EndTurnService = null;
 }
Ejemplo n.º 9
0
    public override void RefreshContent()
    {
        if (this.City == null)
        {
            return;
        }
        base.RefreshContent();
        float            num      = 0f;
        WorkersDragPanel guiPanel = base.GuiService.GetGuiPanel <WorkersDragPanel>();

        for (int i = 0; i < this.workerTypes.Count; i++)
        {
            int num2 = Mathf.FloorToInt(this.City.GetPropertyValue(this.workerTypes[i]));
            if (guiPanel.DragInProgress && guiPanel.DragMoved && this.workerTypes[i] == guiPanel.StartingWorkerType)
            {
                num2 -= guiPanel.NumberOfWorkers;
            }
            if (i < this.WorkersGroups.Length)
            {
                this.WorkersGroups[i].RefreshContent(this.City, num2, this.workerTypes[i], guiPanel);
                this.WorkersGroups[i].GetComponent <AgeTransform>().Enable = (this.interactionsAllowed && !this.IsOtherEmpire);
            }
            int num3 = num2 / this.workersPerLine;
            if (num3 * this.workersPerLine != num2)
            {
                num3++;
            }
            if (num3 < 1)
            {
                num3 = 1;
            }
            if (i < this.WorkersGroups.Length && this.WorkersGroups[i] != null)
            {
                AgeTransform workersTable = this.WorkersGroups[i].WorkersTable;
                float        num4         = workersTable.VerticalMargin + (float)num3 * (this.childHeight + workersTable.VerticalSpacing);
                if (num4 > num)
                {
                    num = num4;
                }
            }
        }
        for (int j = 0; j < this.prodPerPopFIDSTypes.Count; j++)
        {
            float num5 = 0f;
            if (j < this.ProdPerPopFIDSValues.Length)
            {
                float propertyValue = this.City.GetPropertyValue(this.prodPerPopFIDSTypes[j]);
                this.ProdPerPopFIDSValues[j].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0);
            }
            float propertyValue2 = this.City.GetPropertyValue(this.workedFIDSTypes[j]);
            if (j < this.CityTileFIDSValues.Length)
            {
                float propertyValue3 = this.City.GetPropertyValue(this.cityTileFIDSTypes[j]);
                this.CityTileFIDSValues[j].Text = GuiFormater.FormatGui(propertyValue3, false, false, false, 0);
            }
            if (j < this.TotalFIDSValues.Length)
            {
                num5 = this.City.GetPropertyValue(this.totalFIDSTypes[j]);
                if (this.City.SimulationObject.Tags.Contains(City.MimicsCity) && this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData != null && this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData is SimulationPropertyTooltipData)
                {
                    SimulationPropertyTooltipData simulationPropertyTooltipData = this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
                    if (simulationPropertyTooltipData.Title == SimulationProperties.NetCityProduction)
                    {
                        num5 = 0f;
                    }
                    else if (simulationPropertyTooltipData.Title == SimulationProperties.NetCityGrowth)
                    {
                        num5 = this.City.GetPropertyValue("AlmostNetCityGrowth");
                    }
                }
                this.TotalFIDSValues[j].Text = GuiFormater.FormatGui(num5, false, false, false, 0);
            }
            if (j < this.ModifierFIDSValues.Length)
            {
                float num6 = num5 - propertyValue2;
                if (Mathf.RoundToInt(num6) != 0)
                {
                    this.ModifierFIDSValues[j].Text = GuiFormater.FormatGui(num6, false, false, true, 0);
                }
                else
                {
                    this.ModifierFIDSValues[j].Text = string.Empty;
                }
            }
        }
        this.WorkerGroupsTable.Height = num;
        this.WorkersTitle.Height      = num;
        for (int k = 0; k < this.WorkersGroups.Length; k++)
        {
            this.WorkersGroups[k].WorkersTable.Height    = num;
            this.WorkersGroups[k].ActiveHighlight.Height = num;
            this.WorkersGroups[k].GetComponent <AgeTransform>().Height = num;
        }
        base.AgeTransform.Height = this.TopMargin * AgeUtils.CurrentUpscaleFactor() + num + this.WorkerGroupsTable.PixelMarginBottom;
        bool flag  = DepartmentOfTheInterior.CanBuyoutPopulation(this.City);
        bool flag2 = this.City.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1);
        bool flag3 = this.City.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics2);
        int  rowIndex;

        Func <WorkersGroup, bool> < > 9__0;
        int rowIndex2;

        for (rowIndex = 0; rowIndex < this.FoodColumnCells.Length; rowIndex = rowIndex2 + 1)
        {
            bool flag4 = false;
            if (this.IsOtherEmpire)
            {
                IEnumerable <WorkersGroup> workersGroups = this.WorkersGroups;
                Func <WorkersGroup, bool>  predicate;
                if ((predicate = < > 9__0) == null)
                {
                    predicate = (< > 9__0 = ((WorkersGroup cell) => cell.GetComponent <AgeTransform>() == this.FoodColumnCells[rowIndex]));
                }
                flag4 = workersGroups.Any(predicate);
            }
            this.FoodColumnCells[rowIndex].Enable     = (!flag && this.interactionsAllowed && !flag4);
            this.ScienceColumnCells[rowIndex].Enable  = (!flag2 && this.interactionsAllowed && !flag4);
            this.IndustryColumnCells[rowIndex].Enable = (!flag3 && this.interactionsAllowed && !flag4);
            rowIndex2 = rowIndex;
        }
        if (this.BoostersTable == null)
        {
            bool highDefinition = AgeUtils.HighDefinition;
            AgeUtils.HighDefinition              = false;
            this.BoostersTable                   = base.AgeTransform.InstanciateChild(this.BoostersEnumerator.BoostersTable.transform, "WorkerPanelBoostersTable1");
            this.BoostersTable.TableArrangement  = false;
            this.BoostersTable2                  = base.AgeTransform.InstanciateChild(this.BoostersEnumerator.BoostersTable.transform, "WorkerPanelBoostersTable2");
            this.BoostersTable2.TableArrangement = false;
            AgeUtils.HighDefinition              = highDefinition;
        }
        this.stackedBoosters.Clear();
        this.stackedBoosters2.Clear();
        float num7  = 0f;
        bool  flag5 = false;
        bool  flag6 = false;
        bool  flag7 = false;
        bool  flag8 = false;
        float num8  = AgeUtils.HighDefinition ? 3f : 2f;

        if (!this.IsOtherEmpire)
        {
            foreach (string text in new List <string>
            {
                "BoosterFood",
                "BoosterCadavers",
                "BoosterIndustry",
                "FlamesIndustryBooster",
                "BoosterScience"
            })
            {
                BoosterDefinition boosterDefinition2;
                if (this.database.TryGetValue(text, out boosterDefinition2))
                {
                    GuiStackedBooster item = new GuiStackedBooster(boosterDefinition2);
                    this.stackedBoosters.Add(item);
                    if (!this.ParentIsCityListScreen && (text == "BoosterCadavers" || text == "FlamesIndustryBooster"))
                    {
                        this.stackedBoosters2.Add(item);
                    }
                }
            }
            bool flag9 = false;
            this.vaultBoosters = this.departmentOfEducation.GetVaultItems <BoosterDefinition>();
            for (int l = 0; l < this.vaultBoosters.Count; l++)
            {
                BoosterDefinition boosterDefinition = this.vaultBoosters[l].Constructible as BoosterDefinition;
                if (boosterDefinition != null)
                {
                    flag9 = true;
                    if (boosterDefinition.Name == "BoosterFood")
                    {
                        flag5 = true;
                    }
                    else if (boosterDefinition.Name == "BoosterIndustry")
                    {
                        flag6 = true;
                    }
                    else if (boosterDefinition.Name == "BoosterCadavers")
                    {
                        flag7 = true;
                    }
                    else if (boosterDefinition.Name == "FlamesIndustryBooster")
                    {
                        flag8 = true;
                    }
                    this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.RewardType == boosterDefinition.RewardType).AddVaultBooster(this.vaultBoosters[l]);
                }
            }
            if (!flag9)
            {
                this.stackedBoosters.Clear();
                this.stackedBoosters2.Clear();
            }
            else
            {
                num7 = this.FidsGroups[0].Height;
                if (!this.ParentIsCityListScreen)
                {
                    if (!flag6)
                    {
                        GuiStackedBooster item2 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterIndustry");
                        this.stackedBoosters.Remove(item2);
                    }
                    else
                    {
                        GuiStackedBooster item3 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "FlamesIndustryBooster");
                        this.stackedBoosters.Remove(item3);
                    }
                    if (!flag5)
                    {
                        GuiStackedBooster item4 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterFood");
                        this.stackedBoosters.Remove(item4);
                    }
                    else
                    {
                        GuiStackedBooster item5 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterCadavers");
                        this.stackedBoosters.Remove(item5);
                    }
                    if (!flag6 && !flag5)
                    {
                        this.stackedBoosters2.Clear();
                    }
                }
                else
                {
                    if (flag8 && !flag6)
                    {
                        GuiStackedBooster item6 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterIndustry");
                        this.stackedBoosters.Remove(item6);
                    }
                    else if (!flag8)
                    {
                        GuiStackedBooster item7 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "FlamesIndustryBooster");
                        this.stackedBoosters.Remove(item7);
                    }
                    if (!flag5 && flag7)
                    {
                        GuiStackedBooster item8 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterFood");
                        this.stackedBoosters.Remove(item8);
                    }
                    else if (!flag7)
                    {
                        GuiStackedBooster item9 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterCadavers");
                        this.stackedBoosters.Remove(item9);
                    }
                }
            }
        }
        this.BoostersTable2.ReserveChildren(this.stackedBoosters2.Count, this.BoostersEnumerator.BoosterStockPrefab, "Item2");
        this.BoostersTable2.RefreshChildrenIList <GuiStackedBooster>(this.stackedBoosters2, this.refreshDelegate, true, true);
        this.BoostersTable.ReserveChildren(this.stackedBoosters.Count, this.BoostersEnumerator.BoosterStockPrefab, "Item");
        this.BoostersTable.RefreshChildrenIList <GuiStackedBooster>(this.stackedBoosters, this.refreshDelegate, true, true);
        this.BoostersTable.PixelMarginTop  = base.AgeTransform.Height;
        this.BoostersTable2.PixelMarginTop = base.AgeTransform.Height + this.FidsGroups[0].Height + num8;
        float num9 = 0f;

        foreach (BoosterStock boosterStock in this.BoostersTable.GetChildren <BoosterStock>(true))
        {
            float num10 = num8;
            if (this.ParentIsCityListScreen && ((flag5 && flag7 && (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterFood" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterCadavers")) || (flag6 && flag8 && (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterIndustry" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "FlamesIndustryBooster"))))
            {
                boosterStock.AgeTransform.Width = this.FidsGroups[0].Width / 2f - 1f;
                if (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterFood" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterIndustry")
                {
                    num10 = 2f;
                }
            }
            else
            {
                boosterStock.AgeTransform.Width = this.FidsGroups[0].Width;
            }
            if (boosterStock.GuiStackedBooster.Quantity == 0 || (flag && (num9 == 0f || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterCadavers")) || (flag2 && boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterScience"))
            {
                boosterStock.AgeTransform.Enable  = false;
                boosterStock.AgeTransform.Visible = false;
            }
            else
            {
                num7 = boosterStock.AgeTransform.Height;
                boosterStock.AgeTransform.Enable  = this.interactionsAllowed;
                boosterStock.AgeTransform.Visible = true;
                boosterStock.QuickActivation      = true;
                boosterStock.Guid = this.City.GUID;
                boosterStock.QuantityLabel.AgeTransform.AttachTop       = true;
                boosterStock.QuantityLabel.AgeTransform.AttachRight     = true;
                boosterStock.QuantityLabel.AgeTransform.PixelMarginLeft = 0f;
                boosterStock.QuantityLabel.Alignement = AgeTextAnchor.AscendMiddleRight;
                if (!this.ParentIsCityListScreen)
                {
                    boosterStock.IconImage.AgeTransform.PixelMarginLeft      = num8 * 2.5f;
                    boosterStock.QuantityLabel.AgeTransform.PixelMarginRight = num8 * 2f;
                }
                else
                {
                    boosterStock.IconImage.AgeTransform.PixelMarginLeft      = ((boosterStock.AgeTransform.Width == this.FidsGroups[0].Width) ? (boosterStock.AgeTransform.Width / 3f) : (boosterStock.AgeTransform.Width / 5f));
                    boosterStock.QuantityLabel.AgeTransform.PixelMarginRight = ((boosterStock.AgeTransform.Width == this.FidsGroups[0].Width) ? (boosterStock.AgeTransform.Width / 3f) : (boosterStock.AgeTransform.Width / 5f));
                }
            }
            boosterStock.AgeTransform.X           = num9;
            boosterStock.AgeTransform.AttachRight = false;
            boosterStock.AgeTransform.AttachLeft  = true;
            num9 += boosterStock.AgeTransform.Width + num10;
        }
        if (this.BoostersTable2.GetChildren <BoosterStock>(true).Count > 0)
        {
            bool flag10 = false;
            num9 = 0f;
            foreach (BoosterStock boosterStock2 in this.BoostersTable2.GetChildren <BoosterStock>(true))
            {
                boosterStock2.AgeTransform.Width = this.FidsGroups[0].Width;
                if (boosterStock2.GuiStackedBooster.Quantity == 0 || (num9 == 0f && !flag5) || (num9 > 0f && !flag6) || (flag && num9 == 0f))
                {
                    boosterStock2.AgeTransform.Enable  = false;
                    boosterStock2.AgeTransform.Visible = false;
                }
                else
                {
                    flag10 = true;
                    boosterStock2.AgeTransform.Enable  = this.interactionsAllowed;
                    boosterStock2.AgeTransform.Visible = true;
                    boosterStock2.QuickActivation      = true;
                    boosterStock2.Guid = this.City.GUID;
                    boosterStock2.IconImage.AgeTransform.PixelMarginLeft      = num8 * 2.5f;
                    boosterStock2.QuantityLabel.AgeTransform.AttachTop        = true;
                    boosterStock2.QuantityLabel.AgeTransform.AttachRight      = true;
                    boosterStock2.QuantityLabel.AgeTransform.PixelMarginLeft  = 0f;
                    boosterStock2.QuantityLabel.AgeTransform.PixelMarginRight = num8 * 2f;
                    boosterStock2.QuantityLabel.Alignement = AgeTextAnchor.AscendMiddleRight;
                }
                boosterStock2.AgeTransform.X           = num9;
                boosterStock2.AgeTransform.AttachRight = false;
                boosterStock2.AgeTransform.AttachLeft  = true;
                num9 += this.FidsGroups[0].Width + this.BoostersTable2.HorizontalSpacing;
            }
            num7 += (flag10 ? (this.FidsGroups[0].Height + num8) : 0f);
        }
        base.AgeTransform.Height          += num7;
        this.AgeModifierPosition.EndHeight = base.AgeTransform.Height;
        foreach (AgeTransform ageTransform in base.AgeTransform.GetChildren())
        {
            if (ageTransform.name.Contains("CityTile") || ageTransform.name.Contains("Total") || ageTransform.name.Contains("Modifiers"))
            {
                ageTransform.PixelMarginBottom = this.OriginalMargins[ageTransform.name] * (AgeUtils.HighDefinition ? 1.5f : 1f) + num7;
            }
        }
    }
Ejemplo n.º 10
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);
    }
Ejemplo n.º 11
0
    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();
    }