// temporary clear the keybindings when the mapview is opened private static void SaveBindings() { KeyBindings.Clear(); var gameSettingsType = typeof(GameSettings); var keyBindingFieldInfos = gameSettingsType.GetFields().Where(predicate: fi => fi.IsStatic && fi.IsPublic && fi.FieldType == typeof(KeyBinding)); foreach (var keyBindingFieldInfo in keyBindingFieldInfos) { var keyBinding = (KeyBinding)keyBindingFieldInfo.GetValue(obj: null); var primaryKeyCode = new KeyCodeExtended(key: keyBinding.primary.code); var secondaryKeyCode = new KeyCodeExtended(key: keyBinding.secondary.code); if (!ManeuverKeys.ContainsKey(key: primaryKeyCode) && !ModifierKeys.ContainsKey(key: primaryKeyCode) && !ManeuverKeys.ContainsKey(key: secondaryKeyCode) && !ModifierKeys.ContainsKey(key: secondaryKeyCode)) { continue; } KeyBindings.Add( key: keyBindingFieldInfo.Name, value: keyBinding ); keyBindingFieldInfo.SetValue( obj: null, value: new KeyBinding() ); // blank keybinding } GameSettings.ApplySettings(); _savedBindings = true; }
public override void HandleInput(InputHelper inputHelper) { titleMenuState.HandleInput(inputHelper); settings.HandleInput(inputHelper); if (apply.Pressed) { GameSettings.ApplySettings(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GameSettings myTarget = (GameSettings)target; if (GUILayout.Button("Apply settings")) { myTarget.ApplySettings(); } }
/// <summary> /// Initialize all our rendermodules and helpers. Done after the Load() function /// </summary> /// <param name="graphicsDevice"></param> /// <param name="assets"></param> public void Initialize(GraphicsDevice graphicsDevice, Assets assets) { _graphicsDevice = graphicsDevice; _quadRenderer = new QuadRenderer(); _spriteBatch = new SpriteBatch(graphicsDevice); _assets = assets; //Apply some base settings to overwrite shader defaults with game settings defaults GameSettings.ApplySettings(); Shaders.GBufferEffectParameter_Material_EnvironmentMap.SetValue(_assets.EnvironmentMap); SetUpRenderTargets(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight, false); }
private void Awake() { GameSettings.ApplySettings(); wsH = Camera.main.orthographicSize * 2; wsW = wsH / Screen.height * Screen.width; if (instance == null) { instance = this; DontDestroyOnLoad(this); } else { Destroy(gameObject); } }
//Handle input from the gamestatemanager protected void HandleInput() { inputHelper.Update(); if (exited) { this.Exit(); } gameStateManager.HandleInput(inputHelper); if (inputHelper.KeyPressed(Keys.F8)) { GameSettings.ApplySettings(); } if (inputHelper.KeyPressed(Keys.Delete)) { } }
void Start() { LoadSettings(); Debug.Log("[NBT] Plugin Initialized"); if (!GameSettings.ADVANCED_TWEAKABLES) { Debug.Log("[NBT] Advanced Tweakables Disabled, Enabling..."); GameSettings.ADVANCED_TWEAKABLES = true; } if (!GameSettings.CAMERA_DOUBLECLICK_MOUSELOOK && !Environment.GetCommandLineArgs().Contains("-no-mouse-look")) { Debug.Log("[NBT] Double-Click Mouse Look Disabled, Enabling..."); GameSettings.CAMERA_DOUBLECLICK_MOUSELOOK = true; } GameSettings.ApplySettings(); GameSettings.SaveSettings(); Debug.Log("[NBT] Advanced Tweakables Enabled, Have a Nice Day"); Debug.Log("[NBT] Double-Click Mouse Look Enabled, Have a Nice Day"); }
// restore keybindings when mapview is closed private static void RestoreBindings() { if (!_savedBindings) { return; } var t = typeof(GameSettings); foreach (var b in KeyBindings) { t.GetField(name: b.Key) .SetValue( obj: null, value: b.Value ); } GameSettings.ApplySettings(); _savedBindings = false; }
public void ApplySettings() { GameSettings.ApplySettings(GameSettings.CurrentSettings); GameSettings.SaveSettings(GameSettings.CurrentSettings); }