Ejemplo n.º 1
0
        private void SetupControls()
        {
            labelpanel        = this.AddUIComponent <UIPanel>();
            labelpanel.height = 20;

            label = labelpanel.AddUIComponent <UILabel>();
            label.relativePosition = new Vector3(80, 0);
            label.width            = 240;
            label.textAlignment    = UIHorizontalAlignment.Center;
            label.text             = "No Settings";

            ricoEnabled = UIUtils.CreateCheckBar(this, "Enable RICO");

            enableRICOPanel           = this.AddUIComponent <UIPanel>();
            enableRICOPanel.height    = 0;
            enableRICOPanel.isVisible = false;
            enableRICOPanel.name      = "OptionsPanel";

            ricoEnabled.eventCheckChanged += (c, state) =>
            {
                if (!state)
                {
                    enableRICOPanel.height    = 0;
                    enableRICOPanel.isVisible = false;
                }

                else
                {
                    enableRICOPanel.height    = 240;
                    enableRICOPanel.isVisible = true;
                }
            };

            service                            = UIUtils.CreateDropDown(enableRICOPanel, 0, "Service");
            service.items                      = Service;
            service.selectedIndex              = 0;
            service.eventSelectedIndexChanged += UpdateService;

            subService = UIUtils.CreateDropDown(enableRICOPanel, 30, "Sub-Service");
            subService.selectedIndex = 0;

            uiCategory = UIUtils.CreateDropDown(enableRICOPanel, 60, "UI Category");
            uiCategory.selectedIndex = 0;
            uiCategory.items         = UICategory;

            level = UIUtils.CreateDropDown(enableRICOPanel, 90, "Level");
            level.selectedIndex = 0;
            level.items         = Level;

            construction = UIUtils.CreateTextField(enableRICOPanel, 120, "Construction Cost");

            manual = UIUtils.CreateTextField(enableRICOPanel, 150, "Worker/Home Count");

            popBalanceEnabled = UIUtils.CreateCheckBox(enableRICOPanel, 180, "Use WG Realistic Pop");

            //popBalanceEnabled = UIUtils.CreateCheckBox(enableRICOPanel, 210, "Use Education Ratios");

            pollutionEnabled = UIUtils.CreateCheckBox(enableRICOPanel, 210, "Enable Pollution");
        }
Ejemplo n.º 2
0
        private void SetupControls()
        {
            ricoEnabled     = UIUtils.CreateCheckBox(this, "Enable RICO");
            enableRICOPanel = UIUtils.CreatePanel(this, 120, ricoEnabled);

            service                            = UIUtils.CreateDropDown(enableRICOPanel, 0, "Service");
            service.items                      = Service;
            service.selectedIndex              = 0;
            service.eventSelectedIndexChanged += UpdateService;

            subService = UIUtils.CreateDropDown(enableRICOPanel, 30, "Sub-Service");
            subService.selectedIndex = 0;

            uiCategory = UIUtils.CreateDropDown(enableRICOPanel, 60, "UI Category");
            uiCategory.selectedIndex = 0;
            uiCategory.items         = UICategory;

            level = UIUtils.CreateDropDown(enableRICOPanel, 90, "Level");
            level.selectedIndex = 0;
            level.items         = Level;

            //Construction Cost
            constructionCostEnabled = UIUtils.CreateCheckBox(this, "Enable Construction Cost");
            constructionPanel       = UIUtils.CreatePanel(this, 30, constructionCostEnabled);
            construction            = UIUtils.CreateTextField(constructionPanel, 0, "Construction Cost");

            //Manual Panel

            manualWorkersEnabled = UIUtils.CreateCheckBox(this, "Enable Manual Worker Count");
            manualPanel          = UIUtils.CreatePanel(this, 30, manualWorkersEnabled);
            manual = UIUtils.CreateTextField(manualPanel, 0, "Worker Count");

            //Manual Homes
            manualHomesEnabled = UIUtils.CreateCheckBox(this, "Enable Manual Home Count");
            manualHomesPanel   = UIUtils.CreatePanel(this, 30, manualHomesEnabled);
            homes = UIUtils.CreateTextField(manualHomesPanel, 0, "Home Count");


            //Education Ratio Panel
            educationRatiosEnabled = UIUtils.CreateCheckBox(this, "Enable Education");
            educationPanel         = UIUtils.CreatePanel(this, 120, educationRatiosEnabled);
            uneducated             = UIUtils.CreateTextField(educationPanel, 0, "Uneducated");
            educated       = UIUtils.CreateTextField(educationPanel, 30, "Educated");
            welleducated   = UIUtils.CreateTextField(educationPanel, 60, "Well Educated");
            highlyeducated = UIUtils.CreateTextField(educationPanel, 90, "Highly Educated");

            pollutionEnabled = UIUtils.CreateCheckBox(this, "Enable Pollution");
            ricoEnabled.eventCheckChanged += ChecksChanged;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Performs initial setup for the panel; we no longer use Start() as that's not sufficiently reliable (race conditions), and is no longer needed, with the new create/destroy process.
        /// </summary>
        internal void Setup()
        {
            // Basic setup.
            isVisible        = true;
            canFocus         = true;
            isInteractive    = true;
            backgroundSprite = "UnlockingPanel";

            // Layout.
            autoLayout              = true;
            autoLayoutDirection     = LayoutDirection.Vertical;
            autoLayoutPadding.top   = 5;
            autoLayoutPadding.right = 5;
            clipChildren            = true;

            // Controls.
            builtinKeyNavigation = true;

            // Subpanels.
            labelpanel        = this.AddUIComponent <UIPanel>();
            labelpanel.height = 20;

            // Title panel.
            label = labelpanel.AddUIComponent <UILabel>();
            label.relativePosition = new Vector3(80, 0);
            label.width            = 270;
            label.textAlignment    = UIHorizontalAlignment.Center;
            label.text             = Translations.Translate("PRR_SET_HASNON");

            // RICO enabled.
            ricoEnabled               = UIUtils.CreateCheckBar(this, Translations.Translate("PRR_OPT_ENA"));
            enableRICOPanel           = this.AddUIComponent <UIPanel>();
            enableRICOPanel.height    = 0;
            enableRICOPanel.isVisible = false;
            enableRICOPanel.name      = "OptionsPanel";
            ricoEnabled.Disable();

            ricoEnabled.eventCheckChanged += (control, isEnabled) =>
            {
                // Show RICO options panel if enabled and there's a valid current selection.
                if (isEnabled)
                {
                    enableRICOPanel.height    = 240;
                    enableRICOPanel.isVisible = true;
                }
                else
                {
                    enableRICOPanel.height    = 0;
                    enableRICOPanel.isVisible = false;
                }
            };

            // Dropdown menu - service.
            service                            = UIUtils.CreateDropDown(enableRICOPanel, 30, Translations.Translate("PRR_OPT_SER"));
            service.items                      = Service;
            service.selectedIndex              = 0;
            service.eventSelectedIndexChanged += UpdateService;

            // Dropdown menu - sub-service.
            subService = UIUtils.CreateDropDown(enableRICOPanel, 60, Translations.Translate("PRR_OPT_SUB"));
            subService.selectedIndex              = 0;
            subService.eventSelectedIndexChanged += UpdateSubService;

            // Dropdown menu - UI category.
            uiCategory = UIUtils.CreateDropDown(enableRICOPanel, 90, Translations.Translate("PRR_OPT_UIC"));
            uiCategory.selectedIndex = 0;
            uiCategory.items         = (new UICategories()).names;

            // Dropdown menu - building level.
            level = UIUtils.CreateDropDown(enableRICOPanel, 120, Translations.Translate("PRR_LEVEL"));
            level.selectedIndex = 0;
            level.items         = Level;

            // Update workplace allocations on level, service, and subservice change.
            level.eventSelectedIndexChanged += (control, value) =>
            {
                UpdateWorkplaceBreakdowns();
            };
            service.eventSelectedIndexChanged += (control, value) =>
            {
                UpdateWorkplaceBreakdowns();
            };
            subService.eventSelectedIndexChanged += (control, value) =>
            {
                UpdateWorkplaceBreakdowns();
            };

            // Base text fields.
            construction = UIUtils.CreateTextField(enableRICOPanel, 150, Translations.Translate("PRR_OPT_CST"));
            manual       = UIUtils.CreateTextField(enableRICOPanel, 180, Translations.Translate("PRR_OPT_CNT"));

            // Base checkboxes.
            growable         = UIUtils.CreateCheckBox(enableRICOPanel, 0, Translations.Translate("PRR_OPT_GRO"));
            pollutionEnabled = UIUtils.CreateCheckBox(enableRICOPanel, 210, Translations.Translate("PRR_OPT_POL"));
            realityIgnored   = UIUtils.CreateCheckBox(enableRICOPanel, 240, Translations.Translate("PRR_OPT_POP"));

            // Workplace breakdown by education level.
            uneducated     = UIUtils.CreateTextField(enableRICOPanel, 300, Translations.Translate("PRR_OPT_JB0"));
            educated       = UIUtils.CreateTextField(enableRICOPanel, 330, Translations.Translate("PRR_OPT_JB1"));
            welleducated   = UIUtils.CreateTextField(enableRICOPanel, 360, Translations.Translate("PRR_OPT_JB2"));
            highlyeducated = UIUtils.CreateTextField(enableRICOPanel, 390, Translations.Translate("PRR_OPT_JB3"));

            // Event handlers to update employment totals on change.
            manual.eventTextChanged         += (control, value) => UpdateWorkplaceBreakdowns();
            uneducated.eventTextChanged     += (control, value) => UpdateTotalJobs();
            educated.eventTextChanged       += (control, value) => UpdateTotalJobs();
            welleducated.eventTextChanged   += (control, value) => UpdateTotalJobs();
            highlyeducated.eventTextChanged += (control, value) => UpdateTotalJobs();
        }