コード例 #1
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UICheckBox   checkBox;
                UIHelperBase group = helper.AddGroup(Name);

                checkBox = (UICheckBox)group.AddCheckbox("Disable debug messages logging", DebugUtils.hideDebugMessages.value, (b) =>
                {
                    DebugUtils.hideDebugMessages.value = b;
                });
                checkBox.tooltip = "If checked, debug messages won't be logged.";

                group.AddSpace(10);

                checkBox = (UICheckBox)group.AddCheckbox("Hide the user interface", AdvancedVehicleOptionsUID.hideGUI.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.hideGUI.value = b;
                    AdvancedVehicleOptionsUID.UpdateGUI();
                });
                checkBox.tooltip = "Hide the UI completely if you feel like you are done with it\nand want to save the little bit of memory it takes\nEverything else will still be functional";

                checkBox = (UICheckBox)group.AddCheckbox("Disable warning at map loading", !AdvancedVehicleOptionsUID.onLoadCheck.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.onLoadCheck.value = !b;
                });
                checkBox.tooltip = "Disable service vehicle availability check at the loading of a map";
            }
            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }
コード例 #2
0
        /// <summary>
        /// Called when the level (game, map editor, asset editor) is loaded
        /// </summary>
        public override void OnLevelLoaded(LoadMode mode)
        {
            try
            {
                // Is it an actual game ?
                if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewGameFromScenario)
                {
                    DefaultOptions.Clear();
                    DebugUtils.Log("AVO Incompatible GameMode " + mode);
                    return;
                }

                AdvancedVehicleOptionsUID.isGameLoaded = true;

                if (instance != null)
                {
                    GameObject.DestroyImmediate(instance.gameObject);
                }

                instance = new GameObject("AdvancedVehicleOptionsUID").AddComponent <AdvancedVehicleOptionsUID>();

                try
                {
                    DefaultOptions.BuildVehicleInfoDictionary();
                    VehicleOptions.Clear();
                    DebugUtils.Log("UIMainPanel created");
                }
                catch
                {
                    DebugUtils.Log("Could not create UIMainPanel");

                    if (instance != null)
                    {
                        GameObject.Destroy(instance.gameObject);
                    }

                    return;
                }

                //new EnumerableActionThread(BrokenAssetsFix);
            }
            catch (Exception e)
            {
                if (instance != null)
                {
                    GameObject.Destroy(instance.gameObject);
                }
                DebugUtils.LogException(e);
            }
        }
コード例 #3
0
        public void Start()
        {
            try
            {
                // Loading config
                AdvancedVehicleOptionsUID.InitConfig();

                if (AdvancedVehicleOptionsUID.onLoadCheck)
                {
                    AdvancedVehicleOptionsUID.CheckAllServicesValidity();
                }

                m_mainPanel = GameObject.FindObjectOfType <GUI.UIMainPanel>();
                UpdateGUI();
            }
            catch (Exception e)
            {
                DebugUtils.Log("UI initialization failed.");
                DebugUtils.LogException(e);

                GameObject.Destroy(gameObject);
            }
        }
コード例 #4
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                UICheckBox  checkBox;
                UITextField TextField;
                UIButton    Button;

// Section for General Settings

                UIHelperBase group_general = helper.AddGroup("General Settings                                                   " + Name);

                checkBox = (UICheckBox)group_general.AddCheckbox("Disable debug messages logging", DebugUtils.hideDebugMessages.value, (b) =>
                {
                    DebugUtils.hideDebugMessages.value = b;
                });
                checkBox.tooltip = "If checked, debug messages will not be logged.";

                group_general.AddSpace(10);

                checkBox = (UICheckBox)group_general.AddCheckbox("Hide the user interface", AdvancedVehicleOptionsUID.hideGUI.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.hideGUI.value = b;
                    AdvancedVehicleOptionsUID.UpdateGUI();
                });
                checkBox.tooltip = "Hide the UI completely if you feel like you are done with it and want to save\n" +
                                   "the little bit of memory it takes. Everything else will still be functional.";

                checkBox = (UICheckBox)group_general.AddCheckbox("Disable warning for no available services at map loading", !AdvancedVehicleOptionsUID.onLoadCheck.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.onLoadCheck.value = !b;
                });
                checkBox.tooltip = "Disable the check for missing service vehicles assigned in any category when loading a map.";

// Section for Game Balancing

                UIHelperBase group_balance = helper.AddGroup("Gameplay & Balancing");

// Checkbox for SpeedUnitOption kmh vs mph

                checkBox = (UICheckBox)group_balance.AddCheckbox("Display Miles per Hour (mph) instead of Kilometer per Hour (km/h)", AdvancedVehicleOptionsUID.SpeedUnitOption.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.SpeedUnitOption.value = b;
                });
                checkBox.tooltip = "Changes display of unit of speed from mph to km/h.";

// Checkbox for Game Balancing

                checkBox = (UICheckBox)group_balance.AddCheckbox("Enable various values for non-cargo and non-passenger vehicles", AdvancedVehicleOptionsUID.GameBalanceOptions.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.GameBalanceOptions.value = b;
                });
                checkBox.tooltip = "Allows changes the Firefighting Rate and Capacity for Fire Safety, the Crime Rate Capacity\n" +
                                   "for Police Vehicles and the Maintenance and Pumping Rate for Maintenance Vehicles.\n\n" +
                                   "Can de-balance the intended gameplay. Some values are not documented.";

// Section for Compatibility

                UIHelperBase group_compatibility = helper.AddGroup("Compatibility");

// Checkbox for Overriding Incompability Warnings

                checkBox = (UICheckBox)group_compatibility.AddCheckbox("Display Compatibility Warnings for Mods", AdvancedVehicleOptionsUID.OverrideCompatibilityWarnings.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.OverrideCompatibilityWarnings.value = b;
                });

                checkBox.tooltip = "If enabled, settings which can be modified in Improved Public Transport\n" +
                                   "(by BloodyPenguin) and Transport Lines Manager (by Klyte) will be shown\n" +
                                   "with warning color. Values should be edited in these mods only.\n\n" +
                                   "If disabled, the coloring will not shown.";
                //True, if AVO shall shall color shared mod setting values in red.

// Checkbox for Vehicle Color Expander

                checkBox = (UICheckBox)group_compatibility.AddCheckbox("Vehicle Color Expander: Priority over AVO vehicle coloring", AdvancedVehicleOptionsUID.OverrideVCX.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.OverrideVCX.value = b;
                });

                checkBox.tooltip = "Permanent setting, if Vehicle Color Expander (by Klyte) is active.\n" +
                                   "The color management is controlled by Vehicle Color Expander.\n\n" +
                                   "Values will be configured in Vehicle Color Expander.";

                //True, if AVO shall not override Vehicle Color Expander settings. As there is not Settings for Vehicle Color Expander. AVO will show the option, but user cannot change anything as long readOnly is True.
                checkBox.readOnly        = true;
                checkBox.label.textColor = Color.gray;

                if (!VCXCompatibilityPatch.IsVCXActive())
                {
                    checkBox.enabled = false;                   //Do not show the option Checkbox, if Vehicle Color Expander is not active.
                }

// Checkbox for No Big Trucks

                checkBox = (UICheckBox)group_compatibility.AddCheckbox("No Big Trucks: Classify Generic Industry vehicles as Large Vehicle", AdvancedVehicleOptionsUID.ControlTruckDelivery.value, (b) =>
                {
                    AdvancedVehicleOptionsUID.ControlTruckDelivery.value = b;
                });

                checkBox.tooltip = "If enabled, Delivery Trucks can be tagged as Large Vehicles.\n" +
                                   "Dispatch will be blocked by No Big Trucks (by MacSergey).\n\n" +
                                   "Warning: Experimental feature and may have impact on the simulation.";
                //True, if AVO shall be enabled to classify Generic Industry vehicles as Large Vehicles, so No Big Trucks can suppress the dispatch to small buildings.

                if (!NoBigTruckCompatibilityPatch.IsNBTActive())
                {
                    checkBox.enabled = false;   //Do not show the option Checkbox, if No Big Trucks is not active.
                }

// Add a Spacer
                group_compatibility.AddSpace(20);

// Add Trailer Compatibility Reference

                TextField         = (UITextField)group_compatibility.AddTextfield("Vehicle Trailer compatibility references last updated:", TrailerRef.Revision, (value) => Debug.Log(""), (value) => Debug.Log(""));
                TextField.tooltip = "This field shows the vehicle list revision date for the Bus, Trolley Bus, Fire and Police\n" +
                                    "trailers, which are in real life industry trailers, but have been re-categorized by AVO.";
                TextField.readOnly = true;

                // Support Section with Wiki and Output-Log

                UIHelperBase group_support = helper.AddGroup("Support");

                Button = (UIButton)group_support.AddButton("Open the Advanced Vehicle Options Wiki", () =>
                {
                    SimulationManager.instance.SimulationPaused = true;
                    Application.OpenURL("https://github.com/CityGecko/CS-AdvancedVehicleOptions/wiki");
                });
                Button.textScale = 0.8f;

                Button = (UIButton)group_support.AddButton("Open Cities:Skylines log folder (output_log.txt)", () =>
                {
                    Utils.OpenInFileBrowser(Application.dataPath);
                });
                Button.textScale = 0.8f;
            }

            catch (Exception e)
            {
                DebugUtils.Log("OnSettingsUI failed");
                DebugUtils.LogException(e);
            }
        }