void DoChanges()
 {
     MyLanguage.CurrentLanguage = (MyLanguagesEnum)m_languageCombobox.GetSelectedKey();
     if (m_skinCombobox != null)
     {
         MyGuiSkinManager.Static.SelectSkin((int)m_skinCombobox.GetSelectedKey());
     }
     MyScreenManager.RecreateControls();
     MyCubeBuilder.BuildingMode         = (MyCubeBuilder.BuildingModeEnum)m_buildingModeCombobox.GetSelectedKey();
     MySandboxGame.Config.ControlsHints = m_controlHintsCheckbox.IsChecked;
     if (m_rotationHintsCheckbox != null)
     {
         MySandboxGame.Config.RotationHints = m_rotationHintsCheckbox.IsChecked;
     }
     MySandboxGame.Config.AnimatedRotation         = m_animatedRotationCheckbox.IsChecked;
     MySandboxGame.Config.ShowBuildingSizeHint     = m_showBuildingSizeHintCheckbox.IsChecked;
     MySandboxGame.Config.ShowCrosshair            = m_crosshairCheckbox.IsChecked;
     MySandboxGame.Config.DisableHeadbob           = m_disableHeadbobCheckbox.IsChecked;
     MySandboxGame.Config.CompressSaveGames        = m_compressSavesCheckbox.IsChecked;
     MySandboxGame.Config.ShowPlayerNamesOnHud     = m_showPlayerNamesCheckbox.IsChecked;
     MySandboxGame.Config.ReleasingAltResetsCamera = m_releasingAltResetsCameraCheckbox.IsChecked;
     MySandboxGame.Config.UIOpacity   = m_UIOpacitySlider.Value;
     MySandboxGame.Config.UIBkOpacity = m_UIBkOpacitySlider.Value;
     MySandboxGame.Config.Save();
 }
Example #2
0
 void DoChanges()
 {
     MyLanguage.CurrentLanguage = (MyLanguagesEnum)m_languageCombobox.GetSelectedKey();
     MyScreenManager.RecreateControls();
     MyCubeBuilder.BuildingMode                = (MyCubeBuilder.BuildingModeEnum)m_buildingModeCombobox.GetSelectedKey();
     MySandboxGame.Config.ControlsHints        = m_controlHintsCheckbox.IsChecked;
     MySandboxGame.Config.RotationHints        = m_rotationHintsCheckbox.IsChecked;
     MySandboxGame.Config.ShowCrosshair        = m_crosshairCheckbox.IsChecked;
     MySandboxGame.Config.DisableHeadbob       = m_disableHeadbobCheckbox.IsChecked;
     MySandboxGame.Config.CompressSaveGames    = m_compressSavesCheckbox.IsChecked;
     MySandboxGame.Config.ShowPlayerNamesOnHud = m_showPlayerNamesCheckbox.IsChecked;
     MySandboxGame.Config.Save();
 }
        private void CloseScreenAndSave()
        {
            MyInput.Static.SetMouseXInversion(m_invertMouseXCheckbox.IsChecked);
            MyInput.Static.SetMouseYInversion(m_invertMouseYCheckbox.IsChecked);
            MyInput.Static.SetMouseSensitivity(m_mouseSensitivitySlider.Value);

            if (MyFakes.ENABLE_JOYSTICK_SETTINGS)
            {
                MyInput.Static.JoystickInstanceName = m_joystickCombobox.GetSelectedIndex() == 0 ? null : m_joystickCombobox.GetSelectedValue().ToString();
                MyInput.Static.SetJoystickSensitivity(m_joystickSensitivitySlider.Value);
                MyInput.Static.SetJoystickExponent(m_joystickExponentSlider.Value);
                MyInput.Static.SetJoystickDeadzone(m_joystickDeadzoneSlider.Value);
            }

            MyInput.Static.SaveControls(MySandboxGame.Config.ControlsGeneral, MySandboxGame.Config.ControlsButtons);
            MySandboxGame.Config.Save();

            //MyGuiScreenGamePlay.Static.SetControlsChange(true);
            MyScreenManager.RecreateControls();
            CloseScreen();
        }
Example #4
0
        public override bool HandleInput()
        {
            bool handled = false;

            if (MySession.Static == null)
            {
                return(false);// game isn't loaded yet
            }
            // check of autoheal
            CheckAutoHeal();
            //VoxelReading();
            //VoxelPlacement();
            //VoxelCellDrawing();

            //Stats.Timing.Write("Sum of outer loops", OuterSum / (float)Stopwatch.Frequency, VRage.Stats.MyStatTypeEnum.CurrentValue, 100, 4);
            //Stats.Timing.Write("Sum of inner loops", InnerSum / (float)Stopwatch.Frequency, VRage.Stats.MyStatTypeEnum.CurrentValue, 100, 4);

            // All of my keypresses require M to be pressed as well.
#if false
            if (!MyInput.Static.IsKeyPress(MyKeys.M))
            {
                return(handled);
            }

            //foreach (var file in MyFileSystem.GetFiles(Path.Combine(MyFileSystem.ContentPath, "Data", "Screens")))
            //{
            //    MyObjectBuilder_GuiScreen screen;
            //    MyObjectBuilderSerializer.DeserializeXML(file, out screen);
            //}

            if (MySession.Static == null)
            {
                return(handled);
            }

            // Toggle MyCharacter as enemy
            if (MyInput.Static.IsNewKeyPressed(MyKeys.NumPad3))
            {
                MakeCharacterFakeTarget();
                handled = true;
            }

            // Reload definitions.
            if (MyInput.Static.IsKeyPress(MyKeys.NumPad4))
            {
                var inst = MyDefinitionManager.Static;
                inst.UnloadData();
                inst.LoadData(MySession.Static.Mods);
                handled = true;
            }

            if (MyInput.Static.IsNewKeyPressed(MyKeys.R))
            {
                MyScreenManager.RecreateControls();
                handled = true;
            }

            if (MyInput.Static.IsNewKeyPressed(MyKeys.NumPad5))
            {
                MakeScreenWithIconGrid();
                handled = true;
            }

            if (MyInput.Static.IsNewKeyPressed(MyKeys.NumPad6))
            {
                foreach (var entity in MyEntities.GetEntities())
                {
                    if (entity is MyFloatingObject)
                    {
                        entity.Close();
                    }
                }
            }

            if (MyInput.Static.IsNewKeyPressed(MyKeys.NumPad7))
            {
                XDocument document = XDocument.Parse(File.ReadAllText(Path.Combine(MyFileSystem.ContentPath, "Data", "Localization", "MyTexts.resx")));

                var data = document.Element("root").Elements("data").OrderBy(x => x.Attribute("name").Value);
                foreach (var item in data)
                {
                    Console.WriteLine(string.Format("{0}: {1}",
                                                    item.Attribute("name").Value,
                                                    item.Element("value").Value));
                }
            }
#endif

            return(base.HandleInput());

            //return handled;
        }