Esempio n. 1
0
        /// <summary>
        /// Performs required data and configuration setup.
        /// </summary>
        internal static void Setup()
        {
            // Don't initialise PopData if we've already done it, but make sure we do it if we haven't already.
            if (PopData.instance == null)
            {
                PopData.instance = new PopData();
            }

            // Do FloorData as well if we need to.
            if (FloorData.instance == null)
            {
                FloorData.instance = new FloorData();
            }

            // Ditto SchoolData.
            if (SchoolData.instance == null)
            {
                SchoolData.instance = new SchoolData();
            }

            // Ditto Multipliers.
            if (Multipliers.instance == null)
            {
                Multipliers.instance = new Multipliers();
            }

            // Load (volumetric) building settings file if we haven't already..
            if (!ConfigUtils.configRead)
            {
                ConfigUtils.LoadSettings();
            }
        }
        /// <summary>
        /// Adds control buttons to the bottom of the panel.
        /// </summary>
        /// <param name="panel">UI panel instance</param>
        protected void AddButtons(UIPanel panel)
        {
            // Add extra space.
            currentY += Margin;

            // Reset button.
            UIButton resetButton = UIControls.AddButton(panel, Margin, currentY, Translations.Translate("RPR_OPT_RTD"), 150f);

            resetButton.eventClicked += (component, clickEvent) => ResetToDefaults();

            // Revert button.
            UIButton revertToSaveButton = UIControls.AddButton(panel, (Margin * 2) + 150f, currentY, Translations.Translate("RPR_OPT_RTS"), 150f);

            revertToSaveButton.eventClicked += (component, clickEvent) => { ConfigUtils.LoadSettings(); PopulateFields(); };

            // Save button.
            UIButton saveButton = UIControls.AddButton(panel, (Margin * 3) + 300f, currentY, Translations.Translate("RPR_OPT_SAA"), 150f);

            saveButton.eventClicked += (component, clickEvent) => ApplyFields();
        }