public override void OnLevelLoaded(LoadMode mode)
 {
     // Check if in-game:
     if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
     {
         DebugUtils.Log($"Mod not loaded: only available in-game, not in editors.");
         return;
     }
     //  Initialize the mod:
     AmericanRoadsignsTool.Initialize();
     //  Load mod config:
     AmericanRoadsignsTool.LoadConfig();
     //  Set assets path:
     AmericanRoadsignsTool.SetModPath();
     //  Init. assets:
     AmericanRoadsignsTool.InitProps();
     //  Localize props?
     if (AmericanRoadsignsTool.config.roadsignpack > 0)
     {
         //  Replace props:
         AmericanRoadsignsTool.ReplacePropsOnLoad();
         //  Retexture props:
         AmericanRoadsignsTool.RetexturePropsOnLoad();
         //  Set prop visibility:
         AmericanRoadsignsTool.HidePropsOnLoad();
     }
     //  Hide props:
     AmericanRoadsignsTool.ChangePropsOnLoad();
     //
     base.OnLevelLoaded(mode);
 }
Esempio n. 2
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            try
            {
                AmericanRoadsignsTool.LoadConfig();

                //  Mod options:
                UIHelperBase group = helper.AddGroup(Name);
                group.AddSpace(10);
                //  Select Options (Road signs):
                group.AddDropdown("Select your preferred keyboard shortcut for toggling the mod panel", new[] { "Shift + A", "Ctrl + A", "Alt + A" }, AmericanRoadsignsTool.config.keyboardshortcut, OnKeyboardShortcutChanged);
                group.AddSpace(10);
                //  Select Options (Road signs):
                group.AddDropdown("Select the road signs pack you want to use in-game", new[] { "Vanilla", "American" }, AmericanRoadsignsTool.config.roadsignpack, OnRoadsignPackChanged);
                group.AddSpace(5);
                group.AddGroup("NOTE: changing the road sign pack you want to use requires a restart of your city.");
                group.AddSpace(10);
                //  Toggle Options (Misc.):
                group.AddCheckbox("Write additional data to debug log", AmericanRoadsignsTool.config.enable_debug, new OnCheckChanged(OnEnableDebugChanged));
                group.AddSpace(5);
                group.AddGroup("WARNING: enabling debug data may increase loading times!\nEnabling this setting is only recommended when you experience problems.");
                group.AddSpace(20);
            }
            catch (Exception e)
            {
                DebugUtils.LogException(e);
            }
        }
 public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     try
     {
         // Create backup:
         AmericanRoadsignsTool.SaveBackup();
     }
     catch (Exception e)
     {
         DebugUtils.LogException(e);
     }
 }
 public override void OnLevelUnloading()
 {
     base.OnLevelUnloading();
     AmericanRoadsignsTool.isGameLoaded = false;
     AmericanRoadsignsTool.Reset();
 }
Esempio n. 5
0
 private void OnEnableDebugChanged(bool c)
 {
     AmericanRoadsignsTool.config.enable_debug = c;
     AmericanRoadsignsTool.SaveConfig();
 }
Esempio n. 6
0
 private void OnKeyboardShortcutChanged(int c)
 {
     AmericanRoadsignsTool.config.keyboardshortcut = c;
     AmericanRoadsignsTool.SaveConfig();
 }
Esempio n. 7
0
 //  Select Options:
 private void OnRoadsignPackChanged(int c)
 {
     AmericanRoadsignsTool.config.roadsignpack = c;
     AmericanRoadsignsTool.SaveConfig();
 }