Example #1
0
        public override void Load()
        {
            Mods = new List <Mod>();
            if (Main.dedServ)
            {
                return;
            }

            modSettingsUI    = new ModSettingsUI();
            modUserInterface = new UserInterface();
            modUserInterface.SetState(modSettingsUI);

            modSettings = new List <ModSetting>();

            ControlModSettings = RegisterHotKey("Open Mod Settings", "Oem8"); // The ` key

            modSettingsUI.Activate();

            ModSetting setting = ModSettingsAPI.CreateModSettingConfig(this);

            // setting.EnableAutoConfig(this);
            setting.AddComment("This is a barebones framework for modifying supported in-game settings! ");
            setting.AddBool("isday", "Day Time", true);
            setting.AddDouble("dayticks", "Current Time", 0, Main.dayLength, true);
            setting.AddFloat("modifyWidth", "Modify Config Width", 700, 2000, false);
            setting.AddComment("Version " + this.Version);
        }
Example #2
0
        public override void PostUpdateInput()
        {
            ModSetting setting;

            if (ModSettingsAPI.TryGetModSetting(this, out setting))
            {
                setting.Get("isday", ref Main.dayTime);
                setting.Get("dayticks", ref Main.time);
                setting.Get("modifyWidth", ref modSettingsUI.configWidth);
            }

            if (Main.dedServ)
            {
                return;
            }

            if (Main.gameMenu || ControlModSettings == null || modSettingsUI == null)
            {
                return;
            }

            if (Main.playerInventory && modSettingsUI.Visible)
            {
                CloseModSettingsMenu();
            }

            if (ControlModSettings.JustPressed)
            {
                SettingsMenuPressed();
            }
        }