示例#1
0
        /// <summary>
        /// Adds education options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal LegacyPanel(UITabstrip parentTabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel panel = PanelUtils.AddTextTab(parentTabStrip, Translations.Translate("RPR_OPT_LEG"), tabIndex, out UIButton tabButton, 100f);

            // Button size and text scale.
            tabButton.textScale = 0.7f;

            // Add tabstrip.
            UITabstrip childTabStrip = panel.AddUIComponent <UITabstrip>();

            childTabStrip.relativePosition = new Vector3(0, 0);
            childTabStrip.size             = new Vector2(744f, 725f);

            // Tab container (the panels underneath each tab).
            UITabContainer tabContainer = panel.AddUIComponent <UITabContainer>();

            tabContainer.relativePosition = new Vector3(0, 30f);
            tabContainer.size             = new Vector3(744f, 720);
            childTabStrip.tabPages        = tabContainer;

            // Add child tabs.
            new LegacyResidentialPanel(childTabStrip, 0);
            new LegacyIndustrialPanel(childTabStrip, 1);
            new LegacyCommercialPanel(childTabStrip, 2);
            new LegacyOfficePanel(childTabStrip, 3);

            // Change tab size and text scale (to differentiate from 'main' tabstrip).
            foreach (UIButton button in childTabStrip.components)
            {
                button.textScale = 0.8f;
                button.width     = 100f;
            }
        }
        /// <summary>
        /// Adds crime options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal CrimePanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_OPT_CRI"), tabIndex, out UIButton _);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            // Add slider component.
            UISlider newSlider = UIControls.AddSlider(panel, Translations.Translate("RPR_OPT_CML"), 1f, 200f, 1f, ModSettings.crimeMultiplier);

            newSlider.tooltipBox = TooltipUtils.TooltipBox;
            newSlider.tooltip    = Translations.Translate("RPR_OPT_CML_TIP");

            // Value label.
            UIPanel sliderPanel = (UIPanel)newSlider.parent;
            UILabel valueLabel  = sliderPanel.AddUIComponent <UILabel>();

            valueLabel.name             = "ValueLabel";
            valueLabel.relativePosition = UIControls.PositionRightOf(newSlider, 8f, 1f);

            // Set initial text.
            PercentSliderText(newSlider, newSlider.value);

            // Slider change event.
            newSlider.eventValueChanged += (control, value) =>
            {
                // Update value label.
                PercentSliderText(control, value);

                // Update setting.
                ModSettings.crimeMultiplier = value;
            };
        }
示例#3
0
        /// <summary>
        /// Adds education options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal CalculationsPanel(UITabstrip parentTabStrip, int tabIndex)
        {
            // Instance reference.
            Instance = this;

            // Add tab and helper.
            UIPanel panel = PanelUtils.AddTextTab(parentTabStrip, Translations.Translate("RPR_PCK_NAM"), tabIndex, out UIButton _);

            panel.autoLayout = false;

            // Add tabstrip.
            UITabstrip childTabStrip = panel.AddUIComponent <UITabstrip>();

            childTabStrip.relativePosition = new Vector3(0, 0);
            childTabStrip.size             = new Vector2(744f, 725f);

            // Tab container (the panels underneath each tab).
            UITabContainer tabContainer = panel.AddUIComponent <UITabContainer>();

            tabContainer.relativePosition = new Vector3(0, 30f);
            tabContainer.size             = new Vector3(744f, 720);
            childTabStrip.tabPages        = tabContainer;

            // Add child tabs.
            int tab = 0;

            resTab = new ResidentialTab(childTabStrip, tab++);
            comTab = new CommercialTab(childTabStrip, tab++);
            offTab = new OfficeTab(childTabStrip, tab++);
            indTab = new IndustrialTab(childTabStrip, tab++);
            schTab = new SchoolTab(childTabStrip, tab++);
            new PopulationPanel(childTabStrip, tab++);
            new FloorPanel(childTabStrip, tab++);
            new LegacyPanel(childTabStrip, tab);
        }
        /// <summary>
        /// Adds residential options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        public LegacyResidentialPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_CAT_RES"), tabIndex, out UIButton _);

            // Set residential flag.
            notResidential = false;

            // Initialise textfield array.
            SetupArrays(NumSubServices);

            for (int i = 0; i < NumSubServices; ++i)
            {
                areaFields[i]       = new UITextField[NumLevels];
                floorFields[i]      = new UITextField[NumLevels];
                powerFields[i]      = new UITextField[NumLevels];
                waterFields[i]      = new UITextField[NumLevels];
                sewageFields[i]     = new UITextField[NumLevels];
                garbageFields[i]    = new UITextField[NumLevels];
                incomeFields[i]     = new UITextField[NumLevels];
                productionFields[i] = new UITextField[NumLevels];
            }

            // Headings.
            AddHeadings(panel);

            // Move currentY up, so we can fit everything.
            currentY -= 30f;

            // Create residential per-person area textfields and labels.
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_RLO"), "ZoningResidentialLow", "Thumbnails");
            AddSubService(panel, LowRes);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_RHI"), "ZoningResidentialHigh", "Thumbnails");
            AddSubService(panel, HighRes);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_ERL"), "IconPolicySelfsufficient", "Ingame");
            AddSubService(panel, LowEcoRes);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_ERH"), "IconPolicySelfsufficient", "Ingame");
            AddSubService(panel, HighEcoRes);

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
示例#5
0
        /// <summary>
        /// Adds industrial options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        public LegacyIndustrialPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_CAT_IND"), tabIndex, out UIButton _);

            // Initialise textfield array.
            SetupArrays(NumSubServices);

            for (int i = 0; i < NumSubServices; i++)
            {
                int levels = i == 0 ? NumLevels : 2;

                areaFields[i]       = new UITextField[levels];
                floorFields[i]      = new UITextField[levels];
                extraFloorFields[i] = new UITextField[levels];
                powerFields[i]      = new UITextField[levels];
                waterFields[i]      = new UITextField[levels];
                sewageFields[i]     = new UITextField[levels];
                garbageFields[i]    = new UITextField[levels];
                incomeFields[i]     = new UITextField[levels];
                productionFields[i] = new UITextField[NumLevels];
            }

            // Headings.
            AddHeadings(panel);

            // Create residential per-person area textfields and labels.
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Generic]), "ZoningIndustrial", "Thumbnails");
            AddSubService(panel, Generic);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Farming]), "IconPolicyFarming", "Ingame");
            AddSubService(panel, Farming, true);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Forestry]), "IconPolicyForest", "Ingame");
            AddSubService(panel, Forestry, true);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Oil]), "IconPolicyOil", "Ingame");
            AddSubService(panel, Oil, true);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Ore]), "IconPolicyOre", "Ingame");
            AddSubService(panel, Ore, true);

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
        /// <summary>
        /// Adds commercial options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        public LegacyCommercialPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_CAT_COM"), tabIndex, out UIButton _);

            // Initialise textfield array.
            SetupArrays(NumSubServices);

            for (int i = 0; i < NumSubServices; i++)
            {
                int levels = i < 2 ? NumLevels : 1;

                areaFields[i]       = new UITextField[levels];
                floorFields[i]      = new UITextField[levels];
                extraFloorFields[i] = new UITextField[levels];
                powerFields[i]      = new UITextField[levels];
                waterFields[i]      = new UITextField[levels];
                sewageFields[i]     = new UITextField[levels];
                garbageFields[i]    = new UITextField[levels];
                incomeFields[i]     = new UITextField[levels];
                productionFields[i] = new UITextField[NumLevels];
            }

            // Headings.
            AddHeadings(panel);

            // Create residential per-person area textfields and labels.
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[LowCom]), "ZoningCommercialLow", "Thumbnails");
            AddSubService(panel, LowCom);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[HighCom]), "ZoningCommercialHigh", "Thumbnails");
            AddSubService(panel, HighCom);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[EcoCom]), "IconPolicyOrganic", "Ingame");
            AddSubService(panel, EcoCom, label: Translations.Translate("RPR_CAT_ECO"));
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Leisure]), "IconPolicyLeisure", "Ingame");
            AddSubService(panel, Leisure, label: Translations.Translate(subServiceLables[Leisure]));
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Tourist]), "IconPolicyTourist", "Ingame");
            AddSubService(panel, Tourist, label: Translations.Translate(subServiceLables[Tourist]));

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
        /// <summary>
        /// Adds mod options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal ModOptionsPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_OPT_MOD"), tabIndex, out UIButton _);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            // Language dropdown.
            UIDropDown languageDrop = UIControls.AddPlainDropDown(panel, Translations.Translate("TRN_CHOICE"), Translations.LanguageList, Translations.Index);

            languageDrop.eventSelectedIndexChanged += (control, index) =>
            {
                Translations.Index = index;
                SettingsUtils.SaveSettings();
            };

            // Hotkey control.
            panel.gameObject.AddComponent <OptionsKeymapping>();
        }
示例#8
0
        /// <summary>
        /// Adds commercial options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        public LegacyOfficePanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_CAT_OFF"), tabIndex, out UIButton _);

            // Initialise textfield array.
            SetupArrays(NumSubServices);

            for (int i = 0; i < NumSubServices; i++)
            {
                int levels = i == 0 ? NumLevels : 1;

                areaFields[i]       = new UITextField[levels];
                floorFields[i]      = new UITextField[levels];
                extraFloorFields[i] = new UITextField[levels];
                powerFields[i]      = new UITextField[levels];
                waterFields[i]      = new UITextField[levels];
                sewageFields[i]     = new UITextField[levels];
                garbageFields[i]    = new UITextField[levels];
                incomeFields[i]     = new UITextField[levels];
                productionFields[i] = new UITextField[NumLevels];
            }

            // Headings.
            AddHeadings(panel);

            // Create residential per-person area textfields and labels.
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[Office]), "ZoningOffice", "Thumbnails");
            AddSubService(panel, Office);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate(subServiceLables[HighTech]), "IconPolicyHightech", "Ingame");
            AddSubService(panel, HighTech, label: Translations.Translate(subServiceLables[HighTech]));

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
示例#9
0
        /// <summary>
        /// Adds school options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal EducationPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTextTab(tabStrip, Translations.Translate("RPR_OPT_SCH"), tabIndex, out UIButton _);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            // Enable realistic schools checkbox.
            UICheckBox schoolCapacityCheck = UIControls.AddPlainCheckBox(panel, Translations.Translate("RPR_OPT_SEN"));

            schoolCapacityCheck.isChecked          = ModSettings.enableSchoolPop;
            schoolCapacityCheck.eventCheckChanged += (control, isChecked) => ModSettings.enableSchoolPop = isChecked;

            // Enable realistic schools checkbox.
            UICheckBox schoolPropertyCheck = UIControls.AddPlainCheckBox(panel, Translations.Translate("RPR_OPT_SEJ"));

            schoolPropertyCheck.isChecked          = ModSettings.enableSchoolProperties;
            schoolPropertyCheck.eventCheckChanged += (control, isChecked) => ModSettings.enableSchoolProperties = isChecked;

            // School default multiplier.  Simple integer.
            UISlider schoolMult = UIControls.AddSliderWithValue(panel, Translations.Translate("RPR_OPT_SDM"), 1f, 5f, 0.5f, ModSettings.DefaultSchoolMult, (value) => { ModSettings.DefaultSchoolMult = value; });
        }