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.UITransparency = m_UITransparencySlider.Value; MySandboxGame.Config.UIBkTransparency = m_UIBkTransparencySlider.Value; MySandboxGame.Config.Save(); }
public override void HandleInput() { if ((this.m_isActive && (MyScreenManager.GetScreenWithFocus() is MyGuiScreenGamePlay)) && ((MyInput.Static.ENABLE_DEVELOPER_KEYS || !MySession.Static.SurvivalMode) || MySession.Static.IsUserAdmin(Sync.MyId))) { base.HandleInput(); if (MyControllerHelper.IsControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PRIMARY_TOOL_ACTION, MyControlStateType.NEW_PRESSED, false)) { this.m_startTime = MySandboxGame.TotalGamePlayTimeInMilliseconds; } if (MyControllerHelper.IsControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PRIMARY_TOOL_ACTION, MyControlStateType.NEW_RELEASED, false)) { MyObjectBuilder_CubeGrid[] gridPrefab = MyPrefabManager.Static.GetGridPrefab(this.CurrentDefinition.PrefabToThrow); Vector3D zero = Vector3D.Zero; Vector3D forward = Vector3D.Zero; if (USE_SPECTATOR_FOR_THROW) { zero = MySpectator.Static.Position; forward = MySpectator.Static.Orientation.Forward; } else if ((MySession.Static.GetCameraControllerEnum() != MyCameraControllerEnum.ThirdPersonSpectator) && (MySession.Static.GetCameraControllerEnum() != MyCameraControllerEnum.Entity)) { zero = MySector.MainCamera.Position; forward = MySector.MainCamera.WorldMatrix.Forward; } else { if (MySession.Static.ControlledEntity == null) { return; } zero = MySession.Static.ControlledEntity.GetHeadMatrix(true, true, false, false).Translation; forward = MySession.Static.ControlledEntity.GetHeadMatrix(true, true, false, false).Forward; } Vector3D vectord3 = zero + forward; Vector3D vectord4 = (forward * MathHelper.Clamp(((((float)(MySandboxGame.TotalGamePlayTimeInMilliseconds - this.m_startTime)) / 1000f) / this.CurrentDefinition.PushTime) * this.CurrentDefinition.MaxSpeed, this.CurrentDefinition.MinSpeed, this.CurrentDefinition.MaxSpeed)) + MySession.Static.ControlledEntity.Entity.Physics.LinearVelocity; float num2 = 0f; if (this.CurrentDefinition.Mass != null) { num2 = MyDestructionHelper.MassToHavok(this.CurrentDefinition.Mass.Value); } gridPrefab[0].EntityId = MyEntityIdentifier.AllocateId(MyEntityIdentifier.ID_OBJECT_TYPE.ENTITY, MyEntityIdentifier.ID_ALLOCATION_METHOD.RANDOM); EndpointId targetEndpoint = new EndpointId(); Vector3D? position = null; MyMultiplayer.RaiseStaticEvent <MyObjectBuilder_CubeGrid, Vector3D, Vector3D, float, MyCueId>(s => new Action <MyObjectBuilder_CubeGrid, Vector3D, Vector3D, float, MyCueId>(MySessionComponentThrower.OnThrowMessageSuccess), gridPrefab[0], vectord3, vectord4, num2, this.CurrentDefinition.ThrowSound, targetEndpoint, position); this.m_startTime = 0; } } }
private void SaveCode(ResultEnum result) { MyGuiScreenGamePlay.ActiveGameplayScreen = MyGuiScreenGamePlay.TmpGameplayScreenHolder; MyGuiScreenGamePlay.TmpGameplayScreenHolder = null; SyncObject.SendCloseEditor(); if (m_editorScreen.TextTooLong() == true) { var messageBox = MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeChanged), messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_TextTooLong), buttonType: MyMessageBoxButtonsType.OK, canHideOthers: false); MyScreenManager.AddScreen(messageBox); return; } DetailedInfo.Clear(); RaisePropertiesChanged(); if (result == ResultEnum.OK) { SaveCode(); } else { string editorText = m_editorScreen.Description.Text.ToString(); if (editorText != m_programData) { var messageBox = MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeChanged), messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_SaveChanges), buttonType: MyMessageBoxButtonsType.YES_NO, canHideOthers: false); messageBox.ResultCallback = delegate(MyGuiScreenMessageBox.ResultEnum result2) { if (result2 == MyGuiScreenMessageBox.ResultEnum.YES) { SaveCode(ResultEnum.OK); } else { m_editorData = m_programData; } }; MyScreenManager.AddScreen(messageBox); } } }
// Start game with some default values public static void QuickstartSandbox(MyObjectBuilder_SessionSettings quickstartSettings, MyWorldGenerator.Args?quickstartArgs) { MyLog.Default.WriteLine("QuickstartSandbox - START"); MyScreenManager.RemoveAllScreensExcept(null); MyGuiScreenGamePlay.StartLoading(delegate { var settings = (quickstartSettings != null) ? quickstartSettings : CreateBasicQuickStartSettings(); var args = (quickstartArgs != null) ? quickstartArgs.Value : CreateBasicQuickstartArgs(); var mods = new List <MyObjectBuilder_Checkpoint.ModItem>(0); MySession.Start("Created " + DateTime.Now.ToString("yyyy-MM-dd HH:mm"), "", "", settings, mods, args); }); MyLog.Default.WriteLine("QuickstartSandbox - END"); }
public override void HandleInput(bool receivedFocusInThisUpdate) { base.HandleInput(receivedFocusInThisUpdate); if (MyInput.Static.IsNewKeyPressed(MyKeys.F11) && MySession.Static.IsServer) { // Show Scripting tools MyScreenManager.AddScreen(new MyGuiScreenScriptingTools()); CloseScreen(); } if (MyInput.Static.IsNewKeyPressed(MyKeys.F12) || MyInput.Static.IsNewKeyPressed(MyKeys.F10)) { this.CloseScreen(); } }
private void SaveCode() { if (m_editorScreen.TextTooLong() == true) { var messageBox = MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeChanged), messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_TextTooLong), buttonType: MyMessageBoxButtonsType.OK, canHideOthers: false); MyScreenManager.AddScreen(messageBox); return; } m_editorData = m_programData = m_editorScreen.Description.Text.ToString(); m_compilerErrors.Clear(); SyncObject.SendUpdateProgramRequest(m_programData, m_storageData); }
public static void LoadMultiplayerSession(MyObjectBuilder_World world, MyMultiplayerBase multiplayerSession) { MyLog.Default.WriteLine("LoadSession() - Start"); if (!MySteamWorkshop.CheckLocalModsAllowed(world.Checkpoint.Mods, false)) { MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError), messageText: MyTexts.Get(MySpaceTexts.DialogTextLocalModsDisabledInMultiplayer), buttonType: MyMessageBoxButtonsType.OK)); MyLog.Default.WriteLine("LoadSession() - End"); return; } MySteamWorkshop.DownloadModsAsync(world.Checkpoint.Mods, onFinishedCallback : delegate(bool success) { if (success) { //Sandbox.Audio.MyAudio.Static.Mute = true; MyScreenManager.CloseAllScreensNowExcept(null); MyGuiSandbox.Update(MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS); // May be called from gameplay, so we must make sure we unload the current game if (MySession.Static != null) { MySession.Static.Unload(); MySession.Static = null; } MyGuiScreenGamePlay.StartLoading(delegate { MySession.LoadMultiplayer(world, multiplayerSession); }); } else { MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError), messageText: MyTexts.Get(MySpaceTexts.DialogTextDownloadModsFailed), buttonType: MyMessageBoxButtonsType.OK)); } MyLog.Default.WriteLine("LoadSession() - End"); }, onCancelledCallback : delegate() { multiplayerSession.Dispose(); }); }
public override void HandleInput() { base.HandleInput(); if (!(MyScreenManager.GetScreenWithFocus() is MyGuiScreenGamePlay)) { return; } if (MyControllerHelper.IsControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PRIMARY_TOOL_ACTION)) { if (MySession.Static.ControlledEntity != null && AreaMarkerDefinition != null) { PlaceAreaMarker(); } } }
void OnEditDescription(MyGuiControlButton button) { m_dialog = new MyGuiBlueprintTextDialog( position : m_position, caption : "Enter new description", defaultName : m_loadedPrefab.ShipBlueprints[0].Description, maxLenght : 8000, callBack : delegate(string result) { if (result != null) { ChangeDescription(result); } } ); MyScreenManager.AddScreen(m_dialog); }
public void OpenEditor() { if (m_editorData == null) { m_editorData = "void Main(string argument)\n{\n}"; } m_editorScreen = new MyGuiScreenEditor(missionTitle: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_CodeEditor_Title), currentObjectivePrefix: "", currentObjective: "", description: m_editorData, resultCallback: SaveCode, saveCodeCallback: SaveCode, okButtonCaption: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_CodeEditor_SaveExit)); MyGuiScreenGamePlay.TmpGameplayScreenHolder = MyGuiScreenGamePlay.ActiveGameplayScreen; MyScreenManager.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = m_editorScreen); }
private static void LoadMission(CheckpointData data) { var checkpoint = data.Checkpoint; MySteamWorkshop.DownloadModsAsync(checkpoint.Mods, delegate(bool success) { if (success || (checkpoint.Settings.OnlineMode == MyOnlineModeEnum.OFFLINE) && MySteamWorkshop.CanRunOffline(checkpoint.Mods)) { //Sandbox.Audio.MyAudio.Static.Mute = true; MyScreenManager.CloseAllScreensNowExcept(null); MyGuiSandbox.Update(VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS); // May be called from gameplay, so we must make sure we unload the current game if (MySession.Static != null) { MySession.Static.Unload(); MySession.Static = null; } //seed 0 has special meaning - please randomize at mission start. New seed will be saved and game will run with it ever since. // if you use this, YOU CANNOT HAVE ANY PROCEDURAL ASTEROIDS ALREADY SAVED if (checkpoint.Settings.ProceduralSeed == 0) checkpoint.Settings.ProceduralSeed = MyRandom.Instance.Next(); MyGuiScreenGamePlay.StartLoading(delegate { checkpoint.Settings.Scenario = true; MySession.LoadMission(data.SessionPath, checkpoint, data.CheckpointSize, data.PersistentEditMode); }); } else { MyLog.Default.WriteLine(MyTexts.Get(MyCommonTexts.DialogTextDownloadModsFailed).ToString()); MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), messageText: MyTexts.Get(MyCommonTexts.DialogTextDownloadModsFailed), buttonType: MyMessageBoxButtonsType.OK, callback: delegate(MyGuiScreenMessageBox.ResultEnum result) { if (MyFakes.QUICK_LAUNCH != null) MyGuiScreenMainMenu.ReturnToMainMenu(); })); } MyLog.Default.WriteLine("LoadSession() - End"); }); }
public void MySyncScenario_InfoAnswer(bool gameAlreadyRunning, bool canJoinGame) { if (canJoinGame) { m_startButton.Enabled = gameAlreadyRunning; //when a client joins into a running game, he needs to have start button enabled (with slightly different meaning than server) } else { var messageBox = MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.GuiScenarioCannotJoinCaption), messageText: MyTexts.Get(MySpaceTexts.GuiScenarioCannotJoin), buttonType: MyMessageBoxButtonsType.OK, canHideOthers: false, callback: (v) => { Canceling(); }); MyScreenManager.AddScreen(messageBox); //start button stays disabled } }
public MyCustomMainMenuBase(bool pauseGame = false) : base(Vector2.Zero) { if (MyScreenManager.IsScreenOfTypeOpen(typeof(MyGuiScreenGamePlay))) { m_pauseGame = pauseGame; if (m_pauseGame && !Sync.MultiplayerActive) { MySandboxGame.PausePush(); } } else { m_closeOnEsc = false; } m_drawEvenWithoutFocus = false; DrawBuildInformation = true; }
private void OnPublishButtonOnClick(MyGuiControlButton myGuiControlButton) { if (m_selectedCampaign == null) { return; } MyCampaignManager.Static.SwitchCampaign(m_selectedCampaign.Name, m_selectedCampaign.IsVanilla, m_selectedCampaign.IsLocalMod); MyScreenManager.AddScreen( MyGuiSandbox.CreateMessageBox( styleEnum: MyMessageBoxStyleEnum.Info, buttonType: MyMessageBoxButtonsType.YES_NO, messageText: MyTexts.Get(MyCommonTexts.MessageBoxTextDoYouWishToPublishCampaign), messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionDoYouWishToPublishCampaign), callback: (e) => MyCampaignManager.Static.PublishActive() ) ); }
public void WaitUntilTheGameLoaded() { const int timeoutMs = 60_000; const int singleSleepMs = 100; const int sleepAfter = 2000; for (var i = 0; i < timeoutMs / singleSleepMs; i++) { Thread.Sleep(singleSleepMs); if (!(MyScreenManager.GetScreenWithFocus() is MyGuiScreenLoading)) { Thread.Sleep(sleepAfter); return; } } throw new TimeoutException(); }
public static void OnJoinScenario(MyGuiScreenProgress progress, Result joinResult, LobbyEnterInfo enterInfo, MyMultiplayerBase multiplayer) { MyLog.Default.WriteLine(String.Format("Lobby join response: {0}, enter state: {1}", joinResult.ToString(), enterInfo.EnterState)); if (joinResult == Result.OK && enterInfo.EnterState == LobbyEnterResponseEnum.Success && multiplayer.GetOwner() != Sync.MyId) { // Create session with empty world if (MySession.Static != null) { MySession.Static.Unload(); MySession.Static = null; } MySession.CreateWithEmptyWorld(multiplayer); progress.CloseScreen(); MyScreenManager.CloseAllScreensNowExcept(null); MyLog.Default.WriteLine("Scenario lobby joined"); if (MyPerGameSettings.GUI.ScenarioLobbyClientScreen != null) { MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ScenarioLobbyClientScreen)); } else { Debug.Fail("No scenario lobby client screen"); } } else { string status = "ServerHasLeft"; if (joinResult != Result.OK) { status = joinResult.ToString(); } else if (enterInfo.EnterState != LobbyEnterResponseEnum.Success) { status = enterInfo.EnterState.ToString(); } OnJoinBattleFailed(progress, multiplayer, status); } }
void OnFlagChanged(MyTrashRemovalFlags flag, bool value) { if (flag == MyTrashRemovalFlags.WithMedBay && value && m_showMedbayNotification) { var msgBox = MyGuiSandbox.CreateMessageBox(messageText: MyTexts.Get(MySpaceTexts.ScreenDebugAdminMenu_MedbayNotification)); MyScreenManager.AddScreen(msgBox); m_showMedbayNotification = false; } if (value) { MyTrashRemoval.PreviewSettings.Flags |= flag; } else { MyTrashRemoval.PreviewSettings.Flags &= ~flag; } RecalcTrash(); }
void OnRename(MyGuiControlButton button) { m_dialog = new MyGuiBlueprintTextDialog( position : m_position, caption : MyTexts.GetString(MySpaceTexts.ProgrammableBlock_NewScriptName), defaultName : m_selectedItem.ScriptName, maxLenght : maxNameLenght, callBack : delegate(string result) { if (result != null) { m_parent.ChangeName(result); } }, textBoxWidth: 0.3f ); MyScreenManager.AddScreen(m_dialog); }
public static void UnloadAndExitToMenu() { MyScreenManager.CloseAllScreensNowExcept(null); MyGuiSandbox.Update(VRage.Game.MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS); if (MySession.Static != null) { MySession.Static.Unload(); MySession.Static = null; } if (MyMultiplayer.Static != null) { MyMultiplayer.Static.Dispose(); } // This will quit actual game-play screen and move us to fly-through with main menu on top MyGuiSandbox.BackToMainMenu(); }
void OnRename(MyGuiControlButton button) { m_dialog = new MyGuiBlueprintTextDialog( position : m_position, caption : "Enter new name", defaultName : m_blueprintName, maxLenght : maxNameLenght, callBack : delegate(string result) { if (result != null) { ChangeName(result); } }, textBoxWidth: 0.3f ); MyScreenManager.AddScreen(m_dialog); }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); // Mini loading screen MyGuiSandbox.AddScreen( new MyGuiScreenProgressAsync( MyCommonTexts.LoadingPleaseWait, null, RunRefreshAsync, (result, async) => { RefreshCampaignList(); MyScreenManager.CloseScreen(typeof(MyGuiScreenProgressAsync)); } ) ); AddCaption(MyCommonTexts.ScreenMenuButtonCampaign); InitCampaignList(); InitRightSide(); m_campaignTypesGroup.SelectByKey(0); }
void OpenEditor() { if (m_editorData == null) { var constructorInfo = ToIndentedComment(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_DefaultScript_Constructor).Trim()); var saveInfo = ToIndentedComment(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_DefaultScript_Save).Trim()); var mainInfo = ToIndentedComment(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_DefaultScript_Main).Trim()); m_editorData = string.Format(DEFAULT_SCRIPT_TEMPLATE, constructorInfo, saveInfo, mainInfo); } m_editorScreen = new MyGuiScreenEditor(missionTitle: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_CodeEditor_Title), currentObjectivePrefix: "", currentObjective: "", description: m_editorData, resultCallback: SaveCode, saveCodeCallback: SaveCode, okButtonCaption: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_CodeEditor_SaveExit)); MyGuiScreenGamePlay.TmpGameplayScreenHolder = MyGuiScreenGamePlay.ActiveGameplayScreen; MyScreenManager.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = m_editorScreen); }
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(); }
public override void HandleInput() { base.HandleInput(); if (!(MyScreenManager.GetScreenWithFocus() is MyGuiScreenGamePlay)) { return; } if (MyControllerHelper.IsControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PRIMARY_TOOL_ACTION)) { if (MySession.ControlledEntity != null && BotToSpawn != null) { TrySpawnBot(); } if (MySession.ControlledEntity != null && CommandDefinition != null) { UseCommand(); } } }
private static void LobbiesRequestCompleted(Result result) { // if the request is ok if (result != Result.OK) { return; } var lobbies = new List <Lobby>(); // Add all lobbies LobbySearch.AddPublicLobbies(lobbies); LobbySearch.AddFriendLobbies(lobbies); // search for new lobby foreach (var lobby in lobbies) { var owner = MyMultiplayerLobby.GetLobbyHostSteamId(lobby); if (owner == m_ownerId && lobby.LobbyId != m_oldLobbyId) { // MyScreenManager.RemoveScreenByType(typeof(MyGuiScreenProgress)); // Join the game MyJoinGameHelper.JoinGame(lobby); return; } } // Exit if the search is taking too long m_elapsedMs += 5000; if (m_elapsedMs > 120000) { // Remove the progress wheel MyScreenManager.RemoveScreenByType(typeof(MyGuiScreenProgress)); return; } // Repeat the search FindLobby(); }
protected virtual void StartQuickstart() { // TODO: Move to derived screen in SpaceEngineers.Game if (MySandboxGame.IsDirectX11) // Running DirectX11, start planet quickstart { QuickstartSandbox(GetQuickstartSettings(), CreatePlanetQuickstartArgs()); } else if (MyDirectXHelper.IsDx11Supported()) // DirectX11 not enabled, messagebox { MyScreenManager.RemoveAllScreensExcept(null); var text = MyTexts.Get(MySpaceTexts.QuickstartDX11SwitchQuestion); MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), buttonType: MyMessageBoxButtonsType.YES_NO, callback: MessageBoxSwitchCallback); MyGuiSandbox.AddScreen(mb); } else // DirectX11 not supported, show message, start easy start 1 { MyScreenManager.RemoveAllScreensExcept(null); var text = MyTexts.Get(MySpaceTexts.QuickstartDX11NotAvailable); MyGuiScreenMessageBox mb = MyGuiSandbox.CreateMessageBox(messageText: text, messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), callback: StartNoPlanetsOK); MyGuiSandbox.AddScreen(mb); } }
public override bool HandleInput() { if (MySession.Static == null) { return(false); } if (MyScreenManager.GetScreenWithFocus() is MyGuiScreenDialogPrefabCheat) { return(false); } if (MyScreenManager.GetScreenWithFocus() is MyGuiScreenDialogRemoveTriangle) { return(false); } if (MyScreenManager.GetScreenWithFocus() is MyGuiScreenDialogViewEdge) { return(false); } return(base.HandleInput()); }
private void SaveCode() { if (m_editorScreen.TextTooLong() == true) { var messageBox = MyGuiSandbox.CreateMessageBox( messageCaption: MyTexts.Get(MySpaceTexts.ProgrammableBlock_CodeChanged), messageText: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_TextTooLong), buttonType: MyMessageBoxButtonsType.OK, canHideOthers: false); MyScreenManager.AddScreen(messageBox); return; } m_editorData = m_programData = m_editorScreen.Description.Text.ToString(); m_compilerErrors.Clear(); // If there is an existing instance, make sure the storage data is updated before sending // an update request if (m_instance != null) { m_storageData = m_instance.Storage; } SyncObject.SendUpdateProgramRequest(m_programData, m_storageData); }
void OnRename(MyGuiControlButton button) { if (m_selectedItem == null) { return; } MyScreenManager.AddScreen(new MyGuiBlueprintTextDialog( position : m_position - new Vector2(SCREEN_SIZE.X, 0.0f), caption : MyTexts.GetString(MySpaceTexts.ProgrammableBlock_NewScriptName), defaultName : m_selectedItem.Text.ToString(), maxLenght : 50, callBack : delegate(string result) { if (result != null) { ChangeName(result); } }, textBoxWidth: 0.3f )); }
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.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(); }