Example #1
0
        /// <summary>
        /// Adds growable options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal ComplaintOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_COM"), tabIndex);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            // Add 'ignore low value complaint' checkboxes.
            UIHelperBase valueGroup      = helper.AddGroup(Translations.Translate("PRR_OPTION_VAL"));
            UICheckBox   noValueRicoPlop = (UICheckBox)valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RPL"), ModSettings.noValueRicoPlop, isChecked =>
            {
                ModSettings.noValueRicoPlop = isChecked;
                SettingsUtils.SaveSettings();
            });

            valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noValueRicoGrow, isChecked =>
            {
                ModSettings.noValueRicoGrow = isChecked;
                SettingsUtils.SaveSettings();

                // If this is active, then the checkbox above also needs to be checked if it isn't already.
                if (isChecked && !noValueRicoPlop.isChecked)
                {
                    noValueRicoPlop.isChecked = true;
                }
            });
            valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noValueOther, isChecked =>
            {
                ModSettings.noValueOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add 'ignore too few services complaint' checkboxes.
            UIHelperBase servicesGroup      = helper.AddGroup(Translations.Translate("PRR_OPTION_SVC"));
            UICheckBox   noServicesRicoPlop = (UICheckBox)servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RPL"), ModSettings.noServicesRicoPlop, isChecked =>
            {
                ModSettings.noServicesRicoPlop = isChecked;
                SettingsUtils.SaveSettings();
            });

            servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noServicesRicoGrow, isChecked =>
            {
                ModSettings.noServicesRicoGrow = isChecked;
                SettingsUtils.SaveSettings();

                // If this is active, then the checkbox above also needs to be checked if it isn't already.
                if (isChecked && !noServicesRicoPlop.isChecked)
                {
                    noServicesRicoPlop.isChecked = true;
                }
            });
            servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noServicesOther, isChecked =>
            {
                ModSettings.noServicesOther = isChecked;
                SettingsUtils.SaveSettings();
            });
        }
        /// <summary>
        /// Adds growable options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal GrowableOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_GRO"), tabIndex, true);
            UIHelper helper = new UIHelper(panel);

            // Add plop growables checkboxes.
            UIHelperBase plopGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_PLP"));

            plopGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.plopRico, isChecked =>
            {
                ModSettings.plopRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            plopGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.plopOther, isChecked =>
            {
                ModSettings.plopOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add no zone checks checkboxes.
            UIHelperBase zoneGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_ZON"));

            zoneGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.noZonesRico, isChecked =>
            {
                ModSettings.noZonesRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            zoneGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noZonesOther, isChecked =>
            {
                ModSettings.noZonesOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add no specialisation checks checkboxes.
            UIHelperBase specGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_SPC"));

            specGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.noSpecRico, isChecked =>
            {
                ModSettings.noSpecRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            specGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noSpecOther, isChecked =>
            {
                ModSettings.noSpecOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add 'make plopped growables historical' checkboxes.
            UIHelperBase histGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_HST"));

            histGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.historicalRico, isChecked =>
            {
                ModSettings.historicalRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            histGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.historicalOther, isChecked =>
            {
                ModSettings.historicalOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add level control checkboxes.
            UIHelperBase levelGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_BLC"));

            // If we haven't already, check for Advanced Building Level Control.
            if (ModUtils.ablcLockBuildingLevel == null)
            {
                ModUtils.ABLCReflection();
            }

            // Is it (still) null?
            if (ModUtils.ablcLockBuildingLevel != null)
            {
                // ABLC installed; display checkboxes.
                levelGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RGR"), ModSettings.lockLevelRico, isChecked =>
                {
                    ModSettings.lockLevelRico = isChecked;
                    SettingsUtils.SaveSettings();
                });
                levelGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.lockLevelOther, isChecked =>
                {
                    ModSettings.lockLevelOther = isChecked;
                    SettingsUtils.SaveSettings();
                });
            }
        }
Example #3
0
        /// <summary>
        /// Adds growable options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal GrowableOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_GRO"), tabIndex);
            UIHelper helper = new UIHelper(panel);

            panel.autoLayout = true;

            // Add plop growables checkboxes.
            UIHelperBase plopGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_PLP"));

            plopGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.plopRico, isChecked =>
            {
                ModSettings.plopRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            plopGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.plopOther, isChecked =>
            {
                ModSettings.plopOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add no zone checks checkboxes.
            UIHelperBase zoneGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_ZON"));

            zoneGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noZonesRico, isChecked =>
            {
                ModSettings.noZonesRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            zoneGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noZonesOther, isChecked =>
            {
                ModSettings.noZonesOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add no specialisation checks checkboxes.
            UIHelperBase specGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_SPC"));

            specGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noSpecRico, isChecked =>
            {
                ModSettings.noSpecRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            specGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noSpecOther, isChecked =>
            {
                ModSettings.noSpecOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add 'ignore low value complaint' checkboxes.
            UIHelperBase valueGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_VAL"));

            valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noValueRico, isChecked =>
            {
                ModSettings.noValueRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            valueGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noValueOther, isChecked =>
            {
                ModSettings.noValueOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add 'ignore too few services complaint' checkboxes.
            UIHelperBase servicesGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_SVC"));

            servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.noServicesRico, isChecked =>
            {
                ModSettings.noServicesRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            servicesGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.noServicesOther, isChecked =>
            {
                ModSettings.noServicesOther = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Add 'make plopped growables historical' checkboxes.
            UIHelperBase histGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_HST"));

            histGroup.AddCheckbox(Translations.Translate("PRR_OPTION_RCO"), ModSettings.historicalRico, isChecked =>
            {
                ModSettings.historicalRico = isChecked;
                SettingsUtils.SaveSettings();
            });
            histGroup.AddCheckbox(Translations.Translate("PRR_OPTION_OTH"), ModSettings.historicalOther, isChecked =>
            {
                ModSettings.historicalOther = isChecked;
                SettingsUtils.SaveSettings();
            });
        }
        /// <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 ModOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab and helper.
            UIPanel  panel  = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_MOD"), tabIndex, true);
            UIHelper helper = new UIHelper(panel);


            UIDropDown translationDropDown = (UIDropDown)helper.AddDropdown(Translations.Translate("TRN_CHOICE"), Translations.LanguageList, Translations.Index, (value) =>
            {
                Translations.Index = value;
                SettingsUtils.SaveSettings();
            });

            translationDropDown.autoSize = false;
            translationDropDown.width    = 270f;

            // Game options.

            /*UIHelperBase gameGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_LOA"));
             *
             * // Add reset on load checkbox.
             * gameGroup.AddCheckbox(Translations.Translate("PRR_OPTION_FORCERESET"), ModSettings.resetOnLoad, isChecked =>
             * {
             *  ModSettings.resetOnLoad = isChecked;
             *  SettingsUtils.SaveSettings();
             * });*/

            // Notification options.
            UIHelperBase notificationGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_NOT"));

            // Add logging checkbox.
            notificationGroup.AddCheckbox(Translations.Translate("PRR_OPTION_WHATSNEW"), ModSettings.showWhatsNew, isChecked =>
            {
                ModSettings.showWhatsNew = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Logging options.
            UIHelperBase logGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_LOG"));

            // Add logging checkbox.
            logGroup.AddCheckbox(Translations.Translate("PRR_OPTION_MOREDEBUG"), Logging.detailLogging, isChecked =>
            {
                Logging.detailLogging = isChecked;
                SettingsUtils.SaveSettings();
            });

            // Thumbnail options.
            UIHelperBase thumbGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_TMB"));

            // Add thumbnail background dropdown.
            thumbGroup.AddDropdown(Translations.Translate("PRR_OPTION_THUMBACK"), ModSettings.ThumbBackNames, ModSettings.thumbBacks, (value) =>
            {
                ModSettings.thumbBacks = value;
                SettingsUtils.SaveSettings();
            });

            // Add regenerate thumbnails button.
            thumbGroup.AddButton(Translations.Translate("PRR_OPTION_REGENTHUMBS"), () => PloppableTool.Instance.RegenerateThumbnails());

            // Add speed boost checkbox.
            UIHelperBase speedGroup = helper.AddGroup(Translations.Translate("PRR_OPTION_SPDHDR"));

            speedGroup.AddCheckbox(Translations.Translate("PRR_OPTION_SPEED"), ModSettings.speedBoost, isChecked =>
            {
                ModSettings.speedBoost = isChecked;
                SettingsUtils.SaveSettings();
            });
        }
        /// <summary>
        /// Adds growable options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        internal PloppableOptions(UITabstrip tabStrip, int tabIndex)
        {
            // Y position indicator.
            float currentY     = Margin;
            int   tabbingIndex = 0;

            // Add tab and helper.
            UIPanel panel = PanelUtils.AddTab(tabStrip, Translations.Translate("PRR_OPTION_PLO"), tabIndex, false);

            // Demolition options.
            UILabel demolishLabel = UIControls.AddLabel(panel, TitleMarginX, currentY, Translations.Translate("PRR_OPTION_DEM"), textScale: 1.125f);

            demolishLabel.font     = Resources.FindObjectsOfTypeAll <UIFont>().FirstOrDefault((UIFont f) => f.name == "OpenSans-Semibold");
            demolishLabel.tabIndex = ++tabbingIndex;
            currentY += demolishLabel.height + TitleMarginY;

            // Add 'warn if bulldozing ploppables' checkbox.
            UICheckBox demolishWarnCheck = UIControls.AddPlainCheckBox(panel, Translations.Translate("PRR_OPTION_BDZ"));

            demolishWarnCheck.relativePosition   = new Vector2(LeftMargin, currentY);
            demolishWarnCheck.isChecked          = ModSettings.warnBulldoze;
            demolishWarnCheck.eventCheckChanged += DemolishWarnCheckChanged;
            demolishWarnCheck.tabIndex           = ++tabbingIndex;
            currentY += CheckRowHeight + Margin;

            // Add auto-demolish checkbox.
            UICheckBox demolishAutoCheck = UIControls.AddPlainCheckBox(panel, Translations.Translate("PRR_OPTION_IMP"));

            demolishAutoCheck.relativePosition   = new Vector2(LeftMargin, currentY);
            demolishAutoCheck.isChecked          = ModSettings.autoDemolish;
            demolishAutoCheck.tabIndex           = ++tabbingIndex;
            demolishAutoCheck.eventCheckChanged += DemolishAutoCheckChanged;
            currentY += CheckRowHeight;

            // Auto-demolish sub-label.
            UILabel demolishAutoLabel = UIControls.AddLabel(panel, SubTitleX, currentY, Translations.Translate("PRR_OPTION_IMP2"), textScale: 1.125f);

            demolishAutoLabel.font = Resources.FindObjectsOfTypeAll <UIFont>().FirstOrDefault((UIFont f) => f.name == "OpenSans-Regular");
            currentY += CheckRowHeight + GroupMargin;



            // Cost options.
            UILabel costLabel = UIControls.AddLabel(panel, TitleMarginX, currentY, Translations.Translate("PRR_OPTION_CST"), textScale: 1.125f);

            costLabel.font = Resources.FindObjectsOfTypeAll <UIFont>().FirstOrDefault((UIFont f) => f.name == "OpenSans-Semibold");
            currentY      += costLabel.height + TitleMarginY;

            // Add override cost checkbox.
            UICheckBox overrideCostCheck = UIControls.AddPlainCheckBox(panel, Translations.Translate("PRR_OPTION_COV"));

            overrideCostCheck.relativePosition   = new Vector2(LeftMargin, currentY);
            overrideCostCheck.isChecked          = ModSettings.overrideCost;
            overrideCostCheck.eventCheckChanged += OverrideCostCheckChanged;
            overrideCostCheck.tabIndex           = ++tabbingIndex;
            currentY += CheckRowHeight + Margin;

            // Houshold costs.
            UITextField costPerHouseField     = AddCostTextField(panel, "PRR_OPTION_CPH", ModSettings.costPerHousehold, ref currentY);
            UITextField costMultResLevelField = AddCostTextField(panel, "PRR_OPTION_CHM", ModSettings.costMultResLevel, ref currentY);

            costPerHouseField.eventTextSubmitted     += (control, text) => TextSubmitted(control as UITextField, text, ref ModSettings.costPerHousehold);
            costMultResLevelField.eventTextSubmitted += (control, text) => TextSubmitted(control as UITextField, text, ref ModSettings.costMultResLevel);

            // Workplace costs.
            UITextField costPerJob0Field = AddCostTextField(panel, "PRR_OPTION_CJ0", ModSettings.costPerJob0, ref currentY);
            UITextField costPerJob1Field = AddCostTextField(panel, "PRR_OPTION_CJ1", ModSettings.costPerJob1, ref currentY);
            UITextField costPerJob2Field = AddCostTextField(panel, "PRR_OPTION_CJ2", ModSettings.costPerJob2, ref currentY);
            UITextField costPerJob3Field = AddCostTextField(panel, "PRR_OPTION_CJ3", ModSettings.costPerJob3, ref currentY);

            costPerJob0Field.tabIndex            = ++tabbingIndex;
            costPerJob1Field.tabIndex            = ++tabbingIndex;
            costPerJob2Field.tabIndex            = ++tabbingIndex;
            costPerJob3Field.tabIndex            = ++tabbingIndex;
            costPerJob0Field.eventTextSubmitted += (control, text) => TextSubmitted(control as UITextField, text, ref ModSettings.costPerJob0);
            costPerJob1Field.eventTextSubmitted += (control, text) => TextSubmitted(control as UITextField, text, ref ModSettings.costPerJob1);
            costPerJob2Field.eventTextSubmitted += (control, text) => TextSubmitted(control as UITextField, text, ref ModSettings.costPerJob2);
            costPerJob3Field.eventTextSubmitted += (control, text) => TextSubmitted(control as UITextField, text, ref ModSettings.costPerJob3);
        }