Esempio n. 1
0
 private void DepartmentOfScience_TechnologyUnlocked(object sender, ConstructibleElementEventArgs e)
 {
     if (base.IsVisible && this.City != null && e.ConstructibleElement.Name == "TechnologyDefinitionNecrophages8")
     {
         CityInfoPanel.ShowHidePopulationSacrificeButton(this.playerControllerRepository.ActivePlayerController.Empire, this.DepartmentOfScience, this.PopulationSacrificeButton);
         CityInfoPanel.RefreshPopulationSacrificeButton(this.playerControllerRepository.ActivePlayerController.Empire, this.City, this.PopulationSacrificeButton);
     }
 }
Esempio n. 2
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);
    }