Пример #1
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 OffConsumptionPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddIconTab(tabStrip, Translations.Translate("RPR_OPT_CON"), tabIndex, tabIconNames, tabAtlasNames);

            // Initialise textfield arrays (first dimension, sub-services).
            SubServiceArrays(NumSubServices);

            // Initialise textfield arrays (second dimension, levels).
            for (int i = 0; i < NumSubServices; i++)
            {
                // Number of levels is either 3 (for the first category, generic offices), or 1 for the remainder.
                int levels = i == 0 ? NumLevels : 1;

                LevelArrays(i, levels);
            }

            // Headings.
            AddHeadings(panel);

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

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
        /// <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);
        }
Пример #3
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);
        }
Пример #5
0
        /// <summary>
        /// Sets up the defaults dropdown menus.
        /// </summary>
        /// <param name="panel">Panel reference</param>
        /// <param name="yPos">Relative Y position for buttons</param>
        /// <returns>Relative Y coordinate below the finished setup</returns>
        private float SetUpMenus(UIPanel panel, float yPos)
        {
            // Starting y position.
            float currentY = yPos + Margin;

            for (int i = 0; i < SubServiceNames.Length; ++i)
            {
                // Row icon and label.
                PanelUtils.RowHeaderIcon(panel, ref currentY, SubServiceNames[i], IconNames[i], AtlasNames[i]);

                // Add any additional controls.
                currentY = SubServiceControls(currentY, i);

                // Next row.
                currentY += RowHeight + Margin;
            }

            // Return finishing Y position.
            return(currentY);
        }
Пример #6
0
        /// <summary>
        /// Sets up the defaults dropdown menus.
        /// </summary>
        /// <param name="yPos">Relative Y position for buttons</param>
        /// <returns>Relative Y coordinate below the finished setup</returns>
        private float SetUpMenus(float yPos)
        {
            // Layout constants.
            const float LeftColumn = 200f;
            const float MenuWidth  = 300f;

            // Starting y position.
            float currentY = yPos + Margin;

            for (int i = 0; i < SubServiceNames.Length; ++i)
            {
                // Row icon and label.
                PanelUtils.RowHeaderIcon(panel, ref currentY, SubServiceNames[i], IconNames[i], AtlasNames[i]);

                // Pop pack dropdown.
                PopMenus[i] = UIControls.AddLabelledDropDown(panel, LeftColumn, currentY, Translations.Translate("RPR_CAL_DEN"), MenuWidth, height: 20f, itemVertPadding: 6, accomodateLabel: false);

                // Save current index in object user data.
                PopMenus[i].objectUserData = i;

                // Event handler.
                PopMenus[i].eventSelectedIndexChanged += PopMenuChanged;

                // Floor pack on next row.
                currentY += RowHeight;

                // Floor pack dropdown.
                FloorMenus[i] = UIControls.AddLabelledDropDown(panel, LeftColumn, currentY, Translations.Translate("RPR_CAL_BFL"), MenuWidth, height: 20f, itemVertPadding: 6, accomodateLabel: false);

                // Add any additional controls.
                currentY = RowAdditions(currentY, i);


                // Next row.
                currentY += RowHeight + Margin;
            }

            // Return finishing Y position.
            return(currentY);
        }
        /// <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 ResConsumptionPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddIconTab(tabStrip, Translations.Translate("RPR_OPT_CON"), tabIndex, tabIconNames, tabAtlasNames);

            // Set residential flag.
            notResidential = false;

            // Initialise textfield arrays (first dimension, sub-services).
            SubServiceArrays(NumSubServices);

            // Initialise textfield arrays (second dimension, levels - five each).
            for (int i = 0; i < NumSubServices; ++i)
            {
                LevelArrays(i, 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, true, LowRes);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_RHI"), "ZoningResidentialHigh", "Thumbnails");
            AddSubService(panel, true, HighRes);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_ERL"), "IconPolicySelfsufficient", "Ingame");
            AddSubService(panel, true, LowEcoRes);
            PanelUtils.RowHeaderIcon(panel, ref currentY, Translations.Translate("RPR_CAT_ERH"), "IconPolicySelfsufficient", "Ingame");
            AddSubService(panel, true, HighEcoRes);

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
Пример #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 commercial options tab to tabstrip.
        /// </summary>
        /// <param name="tabStrip">Tab strip to add to</param>
        /// <param name="tabIndex">Index number of tab</param>
        public ComConsumptionPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddIconTab(tabStrip, Translations.Translate("RPR_OPT_CON"), tabIndex, tabIconNames, tabAtlasNames);

            // Initialise textfield arrays (first dimension, sub-services).
            SubServiceArrays(NumSubServices);

            // Initialise textfield arrays (second dimension, levels).
            for (int i = 0; i < NumSubServices; i++)
            {
                // Number of levels is either 3 (for the first two categories, low and high com), or 1 for the remainder.
                int levels = i < 2 ? NumLevels : 1;

                LevelArrays(i, levels);
            }

            // Headings.
            AddHeadings(panel);

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

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }
        /// <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 IndConsumptionPanel(UITabstrip tabStrip, int tabIndex)
        {
            // Add tab.
            UIPanel panel = PanelUtils.AddIconTab(tabStrip, Translations.Translate("RPR_OPT_CON"), tabIndex, tabIconNames, tabAtlasNames);

            // Initialise textfield arrays (first dimension, sub-services).
            SubServiceArrays(NumSubServices);

            // Initialise textfield arrays (second dimension, levels).
            for (int i = 0; i < NumSubServices; i++)
            {
                // Number of levels is either 3 (for the first category, generic industry), or 2 for the remainder.
                int levels = i == 0 ? NumLevels : 2;

                LevelArrays(i, levels);
            }

            // Headings.
            AddHeadings(panel);

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

            // Populate initial values.
            PopulateFields();

            // Add command buttons.
            AddButtons(panel);
        }