Ejemplo n.º 1
0
 private void DepartmentOfTheTreasury_ResourcePropertyChange(object sender, ResourcePropertyChangeEventArgs e)
 {
     if (base.IsVisible && this.City != null && e.ResourcePropertyName == SimulationProperties.BankAccount && this.PopulationBuyoutButton.AgeTransform.Visible)
     {
         CityInfoPanel.RefreshPopulationBuyoutButton(this.playerControllerRepository.ActivePlayerController.Empire, this.City, this.PopulationBuyoutButton);
     }
 }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
 private void RefreshButtons()
 {
     if (this.PopulationBuyoutButton.AgeTransform.Visible)
     {
         CityInfoPanel.RefreshPopulationBuyoutButton(this.playerControllerRepository.ActivePlayerController.Empire, this.City, this.PopulationBuyoutButton);
     }
     if (this.PopulationSacrificeButton.AgeTransform.Visible)
     {
         CityInfoPanel.RefreshPopulationSacrificeButton(this.playerControllerRepository.ActivePlayerController.Empire, this.City, this.PopulationSacrificeButton);
     }
 }
Ejemplo n.º 4
0
        public void OnCityInfoClicked(UIComponent comp, UIMouseEventParameter p)
        {
            CityInfoPanel panel = UIView.library.Get <CityInfoPanel>("CityInfoPanel");

            if (panel.isVisible)
            {
                UIView.library.Hide("CityInfoPanel");
            }
            else
            {
                UIView.library.Show <CityInfoPanel>("CityInfoPanel");
                panel.transform.position = p.source.transform.position; // new Vector3(p.source.transform.position.x + 10, p.source.transform.position.y, p.source.transform.position.z);
                panel.SetRenameCallback(new Action(this.SetName));
            }
        }
Ejemplo n.º 5
0
        public void CreateDefaultGui(MiyagiSystem GuiSystem)
        {
            gConsole         = new GameConsole();
            ctrlPanel        = new ControlPanel();
            cityPanel        = new CityInfoPanel();
            DebugPanel       = new DebugPanel();
            ContextMenu      = new ContextMenu();
            bcWindow         = new BuildingCreationWindow();
            topContainer     = new TopContainer();
            bldgPlacePanel   = new BuildingPlacementPanel();
            weatherInfo      = new WeatherInfoWindow();
            bldgSelectWindow = new BuildingSelectionWindow();

            GuiComponents.AddRange(new IGuiComponent[] { gConsole, topContainer, ctrlPanel, cityPanel, debugPanel, contextMenu, bcWindow, bldgPlacePanel, weatherInfo, bldgSelectWindow });

            Gui = new GUI();
            GuiSystem.GUIManager.GUIs.Add(Gui);

            this.InitGui(Gui);
        }
Ejemplo n.º 6
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            timeOffsetTicks_Cache = sim.m_timeOffsetTicks;
            //set time to previously saved value if changed
            if (SavedValues.savedOffset != 0)
            {
                sim.m_timeOffsetTicks = SavedValues.savedOffset;
            }
            else if (gamereload)
            {
                sim.m_timeOffsetTicks = timeOffsetTicks_Cache;
            }
            Debug.Log("Loaded timeOffsetTick value: " + sim.m_timeOffsetTicks);

            CityInfoPanel panel   = UIView.library.Show <CityInfoPanel>("CityInfoPanel");
            UIButton      bButton = panel.component.AddUIComponent <UIButton>();

            //thanks to SamSamTS for the UI code (UIUtils.cs)
            UITextField textField = panel.component.AddUIComponent <UITextField>();

            textField.size    = new Vector2(90f, 17f);
            textField.padding = new RectOffset(6, 6, 3, 3);
            textField.builtinKeyNavigation     = true;
            textField.isInteractive            = true;
            textField.readOnly                 = false;
            textField.horizontalAlignment      = UIHorizontalAlignment.Center;
            textField.selectionSprite          = "EmptySprite";
            textField.selectionBackgroundColor = new Color32(0, 172, 234, 255);
            textField.normalBgSprite           = "TextFieldPanelHovered";
            textField.disabledBgSprite         = "TextFieldPanel";
            textField.textColor                = new Color32(0, 0, 0, 255);
            textField.disabledTextColor        = new Color32(0, 0, 0, 128);
            textField.color = new Color32(255, 255, 255, 255);

            textField.tooltip     = "Date Format: dd/mm/yyyy";
            textField.size        = new Vector2(150f, 27f);
            textField.padding.top = 7;

            textField.relativePosition = new Vector3(140f, 448f);

            //bButton
            bButton.size              = new Vector2(90f, 27f);
            bButton.textScale         = 1f;
            bButton.normalBgSprite    = "ButtonMenu";
            bButton.hoveredBgSprite   = "ButtonMenuHovered";
            bButton.pressedBgSprite   = "ButtonMenuPressed";
            bButton.disabledBgSprite  = "ButtonMenuDisabled";
            bButton.disabledTextColor = new Color32(128, 128, 128, 255);
            bButton.canFocus          = false;

            bButton.width = 80;
            bButton.text  = "Change";

            bButton.relativePosition = new Vector3(310f, 448f);
            panel.component.height   = 321f + 5f + 16f;

            textField.text = "dd/mm/yyyy";

            bButton.eventClick += (component, check) =>
            {
                grabbedGameTime = textField.text;
                Debug.Log(grabbedGameTime);
                //finds extra tick offset that m_timeOffsetTicks doesn't account for

                offsetfactor = 0 - (sim.m_currentGameTime.ToBinary() - sim.m_timeOffsetTicks);

                //checks if grabbed text has three slashes
                if (grabbedGameTime.Split('/').Length == 3)
                {
                    ChangeDate();
                }
                //special command to set year eg. >>3000 sets time to 1/1/3000
                else if (grabbedGameTime.Substring(0, 2) == ">>")
                {
                    ChangeYear();
                }
                else if (grabbedGameTime == "recall")
                {
                    Debug.Log("recall: " + SavedValues.savedOffset); //displays data value stored
                }
                else
                {
                    ErrorFormat();
                }
            };
        }
Ejemplo n.º 7
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.º 8
0
 // Use this for initialization
 void Start()
 {
     cityInfo = GetComponentInChildren <CityInfoPanel> ();
 }