public void GameOver(MyTextsWrapperEnum?customMessage) { if (!MyGuiManager.IsScreenOfTypeOpen(typeof(MyGuiScreenGameOver))) { MyGuiManager.AddScreen(new MyGuiScreenGameOver(1.0f, customMessage)); } }
public MyGuiContextMenuItemHelper(MyTextsWrapperEnum description, MyGuiContextMenuItemActionType actionType, bool enabled, MyTextsWrapperEnum? toolTip) : base(description) { ActionType = actionType; Enabled = enabled; m_toolTip = toolTip; }
public MyGuiContextMenuItemHelper(MyTextsWrapperEnum description, MyGuiContextMenuItemActionType actionType, bool enabled, MyTextsWrapperEnum?toolTip) : base(description) { ActionType = actionType; Enabled = enabled; m_toolTip = toolTip; }
public override void Fail(MyTextsWrapperEnum?customMessage = null) { base.Fail(customMessage); MyMwcLog.WriteLine("Submission " + NameTemp + " fail. " + (customMessage.HasValue ? " (" + MyTextsWrapper.Get(customMessage.Value).ToString() + ")" : "")); ParentMission.Fail(customMessage); }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum?accessForbiddenReason) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment, canHandleKeyboardInput, align, implementedFeature) { m_accessForbiddenReason = accessForbiddenReason; m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null; }
public virtual void Fail(MyTextsWrapperEnum?customMessage = null) { if (MyMultiplayerGameplay.IsRunning && MyMultiplayerGameplay.Static.IsHost) { MyMultiplayerGameplay.Static.SendMissionProgress(this, CommonLIB.AppCode.Networking.Multiplayer.MyMissionProgressType.Fail); } //Unloaded in Mission.UpdateActiveObjectives }
public MyGuiScreenHostGame(MyGuiScreenBase closeAfterSuccessfulEnter) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 695 / 1200f), false, MyGuiManager.GetSandboxBackgoround()) { m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter; m_enableBackgroundFade = true; AddCaption(MyTextsWrapperEnum.HostGame, new Vector2(0, 0.005f)); Debug.Assert(m_size != null, "m_size != null"); Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f); const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; MyTextsWrapperEnum?officialSectorsForbidden = null; MyTextsWrapperEnum?buttonsForbidden = null; MyTextsWrapperEnum?friendsSectorsForbidden = null; if (MyClientServer.LoggedPlayer != null) { if ((MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanSave() == false)) { officialSectorsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild; buttonsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild; friendsSectorsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild; } else if (MyClientServer.LoggedPlayer.IsDemoUser()) { friendsSectorsForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode; } } Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.SandboxSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSandboxSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, officialSectorsForbidden)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.YourSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnMySectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, buttonsForbidden)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.FriendsSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnFriendsSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, friendsSectorsForbidden)); var backButton = new MyGuiControlButton(this, new Vector2(0, 0.178f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(backButton); }
public void OnOkClick(MyGuiControlButton sender) { MyTextsWrapperEnum?errorMessage = ValidateInput(); if (errorMessage.HasValue) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, errorMessage.Value, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null)); } else { MyGuiScreenRegisterProgress registerProgressScreen = new MyGuiScreenRegisterProgress(m_usernameTextbox.Text, m_passwordTextbox.Text, m_emailTextbox.Text, m_sendNewslettersCheckbox.Checked, m_openAfterSuccesfullRegistration, this); MyGuiManager.AddScreen(registerProgressScreen); } }
public MyGuiScreenGameOver(float fadeTime, MyTextsWrapperEnum?customMessage = null) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_fadeTime = fadeTime; m_customMessage = customMessage; m_size = MyGuiManager.GetNormalizedSizeFromScreenSize(new Vector2(MyGuiManager.GetSafeFullscreenRectangle().Width, MyGuiManager.GetSafeFullscreenRectangle().Height)); m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\MissionFailed", flags: TextureFlags.IgnoreQuality); if (!MyMultiplayerGameplay.IsRunning || MyMultiplayerGameplay.Static.IsHost) { OnEnterCallback += OnEnter; } // we wan't clear all hud cues when is game over MyHudAudio.Reset(); // 0004862: game over zvuk - vypnut / zadisablovat //MyAudio.AddCue2D(MySoundCuesEnum.SfxGameOver); }
public override void Fail(MyTextsWrapperEnum?customMessage = null) { if (customMessage == null) { customMessage = MyTextsWrapperEnum.MP_YouHaveBeenKilled; } if (m_failReason != null) { customMessage = m_failReason; // first fail reason has priority (usually a custom one from the script) } MyScriptWrapper.Log("Mission {0} fail.", DebugName); base.Fail(customMessage); m_failReason = customMessage; MySession.Static.GameOver(m_failReason); MarkedForUnload = true; }
public MyGuiScreenGameOver(float fadeTime, MyTextsWrapperEnum? customMessage = null) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_fadeTime = fadeTime; m_customMessage = customMessage; m_size = MyGuiManager.GetNormalizedSizeFromScreenSize(new Vector2(MyGuiManager.GetSafeFullscreenRectangle().Width, MyGuiManager.GetSafeFullscreenRectangle().Height)); m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\MissionFailed", flags: TextureFlags.IgnoreQuality); if (!MyMultiplayerGameplay.IsRunning || MyMultiplayerGameplay.Static.IsHost) { OnEnterCallback += OnEnter; } // we wan't clear all hud cues when is game over MyHudAudio.Reset(); // 0004862: game over zvuk - vypnut / zadisablovat //MyAudio.AddCue2D(MySoundCuesEnum.SfxGameOver); }
public void OnMissionProgress(ref MyEventMissionProgress msg) { if (IsStory() && !IsHost) { ClearCountdownNotification(); Debug.Assert(m_followMission != null); switch (msg.ProgressType) { case MyMissionProgressType.Success: MyMission.ShowObjectiveCompleted(); m_followMission.SetObjectives(null); break; case MyMissionProgressType.Fail: { MyTextsWrapperEnum?message = null; if (msg.MessageEnum.HasValue) { message = (MyTextsWrapperEnum)msg.MessageEnum.Value; if (!MyMwcEnums.IsValidValue(message.Value)) { message = null; } } MySession.Static.GameOver(message); } break; case MyMissionProgressType.NewObjective: m_followMission.SetObjectives(msg.MissionId); break; default: Debug.Fail("Unknown MyMissionProgressType"); break; } } }
private MyTextsWrapperEnum?ValidateInput() { MyTextsWrapperEnum?errorMessage = null; if (MyMwcUtils.IsValidUsernameFormat(m_usernameTextbox.Text) == false) { errorMessage = MyTextsWrapperEnum.ValidationUsername; } else if (MyMwcUtils.IsValidPasswordFormat(m_passwordTextbox.Text) == false) { errorMessage = MyTextsWrapperEnum.ValidationPasswordWrong; } else if (MyMwcUtils.IsValidEmailAddress(m_emailTextbox.Text) == false) { errorMessage = MyTextsWrapperEnum.ValidationEmailWrong; } else if (m_passwordTextbox.Text != m_retypePasswordTextbox.Text) { errorMessage = MyTextsWrapperEnum.ValidationPasswordsDoNotMatch; } return(errorMessage); }
void HandleRegisterError(MyMwcRegisterResponseResultEnum faultCode) { MyMwcLog.WriteLine("Error registering. Fault code: " + (int)faultCode + ", Fault code as string: " + faultCode.ToString()); MyTextsWrapperEnum?errorMessage = null; if (faultCode == MyMwcRegisterResponseResultEnum.USERNAME_FORMAT_INVALID) { errorMessage = MyTextsWrapperEnum.ValidationUsername; } else if (faultCode == MyMwcRegisterResponseResultEnum.PASSWORD_FORMAT_INVALID) { errorMessage = MyTextsWrapperEnum.ValidationPasswordWrong; } else if (faultCode == MyMwcRegisterResponseResultEnum.EMAIL_FORMAT_INVALID) { errorMessage = MyTextsWrapperEnum.ValidationEmailWrong; } else if (faultCode == MyMwcRegisterResponseResultEnum.USERNAME_ALREADY_USED) { errorMessage = MyTextsWrapperEnum.ValidationUsernameAlreadyUsed; } else if (faultCode == MyMwcRegisterResponseResultEnum.WRONG_CLIENT_VERSION) { errorMessage = MyTextsWrapperEnum.CantLoginClientVersionIsWrong; } else // MyMwcRegisterResponseResultEnum.UNKNOWN_ERROR or anything else { errorMessage = MyTextsWrapperEnum.CantRegisterServerIsUnavailable; } if (errorMessage.HasValue) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, errorMessage.Value, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null)); } }
public void SendMissionProgress(MyMissionBase mission, MyMissionProgressType progressType, MyTextsWrapperEnum?messageEnum = null) { MyEventMissionProgress message = new MyEventMissionProgress(); message.MissionId = mission != null ? (int)mission.ID : (int?)null; message.ProgressType = progressType; message.MessageEnum = messageEnum.HasValue ? (int)messageEnum.Value : (int?)null; Peers.SendToAll(ref message, NetDeliveryMethod.ReliableOrdered); }
// Constructor for OK message boxes public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum?okButtonText, MessageBoxCallback callback) : this(type, MyMessageBoxButtonsType.OK, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), okButtonText, null, null, callback, false) { }
public override void Fail(MyTextsWrapperEnum? customMessage = null) { if (customMessage == null) customMessage = MyTextsWrapperEnum.MP_YouHaveBeenKilled; if (m_failReason != null) customMessage = m_failReason; // first fail reason has priority (usually a custom one from the script) MyScriptWrapper.Log("Mission {0} fail.", DebugName); base.Fail(customMessage); m_failReason = customMessage; MySession.Static.GameOver(m_failReason); MarkedForUnload = true; }
public MyUseProperties(MyUseType useMask, MyUseType hackMask, MyTextsWrapperEnum?useText = null) { UseMask = useMask; HackMask = hackMask; UseText = useText; }
public MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum? okButtonText, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, bool enableCheckBox, Vector2 buttonSize) : base(new Vector2(0.5f, 0.5f), null, null, true, null) { InstantClose = true; MyMessageBoxConfiguration config = m_typesConfiguration[(int)type]; m_backgroundColor = config.BackgroundColor; m_backgroundTexture = config.Texture; m_textColor = config.TextColor; m_interferenceVideoColor = config.InterferenceVideoColor; m_enableBackgroundFade = true; m_buttonType = buttonType; m_okButtonText = okButtonText; m_yesButtonText = yesButtonText; m_noButtonText = noButtonText; m_callback = callback; m_drawEvenWithoutFocus = true; m_screenCanHide = false; m_buttonSize = buttonSize; // Recalculate heigh of message box screen, so it will auto-adapt to message size and maybe make split it on more lines Vector2 textSize = MyGuiManager.GetNormalizedSize(config.Font, messageText, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE); Vector2 captionSize = MyGuiManager.GetNormalizedSize(config.Font, messageCaption, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE); m_size = new Vector2(Math.Max(2f * m_buttonSize.X + 0.1f, textSize.X) + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X, 3 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y + captionSize.Y + textSize.Y + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y)+ new Vector2(); //if (type == MyMessageBoxType.MESSAGE) m_size = m_size + new Vector2(0.1f, 0.1f); //m_size. =m_size.Value.Y * 1.1f; if (enableCheckBox) { m_size = new Vector2(m_size.Value.X, m_size.Value.Y + 0.05f); } // Message box caption MyGuiControlLabel captionLabel = new MyGuiControlLabel(this, new Vector2(0, -m_size.Value.Y / 2.0f + captionSize.Y / 2.0f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageCaption, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,config.Font); Controls.Add(captionLabel); // Message box text m_messageBoxText = new MyGuiControlLabel(this, new Vector2(0f, captionLabel.GetPosition().Y + textSize.Y / 2.0f + 1.0f * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageText, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font); Controls.Add(m_messageBoxText); float deltaY = 0; if (enableCheckBox) { const float CHECKBOX_DELTA_Y = 0.01f; // CheckBox to not show again this message box m_showAgainCheckBox = new MyGuiControlCheckbox(this, new Vector2(-0.02f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), true, config.ButtonColor); Controls.Add(m_showAgainCheckBox); Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y) + 0 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapper.Get(MyTextsWrapperEnum.DecreaseVideoSettingsCheckBox), m_textColor, MyGuiConstants.LABEL_TEXT_SCALE * 0.75f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, config.Font)); } // Buttons Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - m_buttonSize.Y / 2.0f); if (m_buttonType == MyMessageBoxButtonsType.OK) { //Controls.Add(new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor, //null,null,null, //m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, //true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true)); var okButton = new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, config.ButtonColor, config.ButtonTexture, null, null, m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); } else if ((m_buttonType == MyMessageBoxButtonsType.YES_NO) || (m_buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT)) { var okButton = new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, config.ButtonColor, config.ButtonTexture, null, null, m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); var noButton = new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, config.ButtonColor, config.ButtonTexture, null, null, m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(noButton); //Controls.Add(new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor, // null,null,null, // m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true)); //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor, // null,null,null, // m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true)); } else if (m_buttonType == MyMessageBoxButtonsType.NONE) { } else { throw new MyMwcExceptionApplicationShouldNotGetHere(); } }
// Constructor for YES/NO message boxes public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback) : this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, false) { }
public virtual void Update() { FilterAddObjectTree(MyEditorGizmo.SelectedSnapPoint); // Get editor state and allowed context action var notDragging = !m_addObjectTreeViewdragDrop.Dragging; var editorState = MyEditor.GetCurrentState(); var contextHelper = MyGuiContextMenuHelpers.GetEditorContextMenuHelper(editorState); // Choose editor state dependent textures var cameraText = editorState == MyEditorStateEnum.ATTACHED ? MyTextsWrapperEnum.ToolbarDetachFromCamera : MyTextsWrapperEnum.ToolbarAttachToCamera; var enterPrefabContainerText = CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_EDITING_MODE) ? MyTextsWrapperEnum.ToolbarExitEditingMode : MyTextsWrapperEnum.ToolbarEnterPrefabContainer; var enterVoxelHandText = editorState == MyEditorStateEnum.VOXEL_HAND_ENABLED ? MyTextsWrapperEnum.ToolbarExitVoxelHand : MyTextsWrapperEnum.ToolbarEnterVoxelHand; var showSnapPointsText = MyEditor.Static.ShowSnapPoints ? MyTextsWrapperEnum.ToolbarHideSnapPoints : MyTextsWrapperEnum.ToolbarShowSnapPoints; var linkSnapPointsText = MyEditor.Static.CanUnlinkSnapPoints(MyEditorGizmo.SelectedSnapPoint) ? MyTextsWrapperEnum.ToolbarUnlinkSnapPoints : MyTextsWrapperEnum.ToolbarLinkSnapPoints; // Change look of editor state dependent buttons m_attachToCameraButton.SetTextEnum(cameraText); m_enterPrefabContainerButton.SetTextEnum(enterPrefabContainerText); m_enterVoxelHandButton.SetTextEnum(enterVoxelHandText); m_linkSnapPoints.SetTextEnum(linkSnapPointsText); // Enable/Disable buttons (context) m_addObjectButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ADD_OBJECT) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_VOXEL_HAND)); //m_editObjectsButton.Enabled = notDragging && // ((CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_SELECTED) && MyEditor.Static.CanEditSelected()) || // CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_VOXEL_HAND)); m_editObjectsButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_SELECTED) && MyEditor.Static.CanEditSelected()); m_resetRotationButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.RESET_ROTATION); m_copySelectedButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.COPY_SELECTED); m_switchGizmoSpaceButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SWITCH_GIZMO_SPACE); m_switchGizmoModeButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SWITCH_GIZMO_MODE); m_linkSnapPoints.Enabled = notDragging && MyEditorGizmo.SelectedSnapPoint != null; m_toggleSnapPoints.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.TOGGLE_SNAP_POINTS); m_selectAllObjectsButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SELECT_ALL_OBJECTS); m_exitSelectedButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_SELECTED); m_enterPrefabContainerButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ENTER_PREFAB_CONTAINER) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_EDITING_MODE)); m_attachToCameraButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ATTACH_TO_CAMERA) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.DETACH_FROM_CAMERA)); m_enterVoxelHandButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ENTER_VOXEL_HAND) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_VOXEL_HAND)); m_clearWholeSectorButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.CLEAR_WHOLE_SECTOR); m_loadSectorButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.LOAD_SECTOR) && !m_isDemoUser; m_saveSectorButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SAVE_SECTOR) && MySession.CanBeSaved(false, MyGuiScreenGamePlay.Static.GetSectorIdentifier(), true); MyTextsWrapperEnum?isDemoS = null; if (MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.IsDemoUser()) { isDemoS = MyTextsWrapperEnum.NotAvailableInDemoMode; } m_saveSectorButton.AccessForbiddenReason = isDemoS; m_loadSectorButton.AccessForbiddenReason = isDemoS; //m_adjustGridButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ADJUST_GRID); //m_sunSettingsButton.Enabled = false; // atm. disable, SUN_SETTINGS + FOG_SETTINGS m_groupsButton.Enabled = notDragging; m_copyToolButton.Enabled = notDragging; m_optionsButton.Enabled = notDragging; m_selectAndHideButton.Enabled = notDragging; m_editPropertiesButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_PROPERTIES) && MyGuiScreenEditorEditProperties.CanEditProperties(MyEditorGizmo.SelectedEntities); m_correctSnappedPrefabsButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.CORRECT_SNAPPED_PREFABS); m_selectDeactivatedEntityButton.Enabled = notDragging; m_findEntityButton.Enabled = notDragging; if (!CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ADD_OBJECT) && m_addObjectTreeView.Visible) { SetAddObjectVisibility(false); } SetEditVoxelHandVisibility(CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_VOXEL_HAND)); if (m_editVoxelHand.Visible && MyEditorGizmo.IsAnyEntitySelected()) { if (!MyFakes.MWBUILDER) { if (!(MyEditorVoxelHand.SelectedVoxelMap != null && MyEditorGizmo.SelectedEntities.Count == 1 && MyEditorGizmo.SelectedEntities[0] == MyEditorVoxelHand.SelectedVoxelMap)) { MyEditor.Static.PerformContextMenuAction(MyGuiContextMenuItemActionType.EXIT_SELECTED); if (MyEditorVoxelHand.SelectedVoxelMap != null) { MyEditorGizmo.AddEntityToSelection(MyEditorVoxelHand.SelectedVoxelMap); } } } } }
public MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum?okButtonText, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, bool enableCheckBox, Vector2 buttonSize) : base(new Vector2(0.5f, 0.5f), null, null, true, null) { InstantClose = true; MyMessageBoxConfiguration config = m_typesConfiguration[(int)type]; m_backgroundColor = config.BackgroundColor; m_backgroundTexture = config.Texture; m_textColor = config.TextColor; m_interferenceVideoColor = config.InterferenceVideoColor; m_enableBackgroundFade = true; m_buttonType = buttonType; m_okButtonText = okButtonText; m_yesButtonText = yesButtonText; m_noButtonText = noButtonText; m_callback = callback; m_drawEvenWithoutFocus = true; m_screenCanHide = false; m_buttonSize = buttonSize; // Recalculate heigh of message box screen, so it will auto-adapt to message size and maybe make split it on more lines Vector2 textSize = MyGuiManager.GetNormalizedSize(config.Font, messageText, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE); Vector2 captionSize = MyGuiManager.GetNormalizedSize(config.Font, messageCaption, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE); m_size = new Vector2(Math.Max(2f * m_buttonSize.X + 0.1f, textSize.X) + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X, 3 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y + captionSize.Y + textSize.Y + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y) + new Vector2(); //if (type == MyMessageBoxType.MESSAGE) m_size = m_size + new Vector2(0.1f, 0.1f); //m_size. =m_size.Value.Y * 1.1f; if (enableCheckBox) { m_size = new Vector2(m_size.Value.X, m_size.Value.Y + 0.05f); } // Message box caption MyGuiControlLabel captionLabel = new MyGuiControlLabel(this, new Vector2(0, -m_size.Value.Y / 2.0f + captionSize.Y / 2.0f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageCaption, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font); Controls.Add(captionLabel); // Message box text m_messageBoxText = new MyGuiControlLabel(this, new Vector2(0f, captionLabel.GetPosition().Y + textSize.Y / 2.0f + 1.0f * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageText, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font); Controls.Add(m_messageBoxText); float deltaY = 0; if (enableCheckBox) { const float CHECKBOX_DELTA_Y = 0.01f; // CheckBox to not show again this message box m_showAgainCheckBox = new MyGuiControlCheckbox(this, new Vector2(-0.02f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), true, config.ButtonColor); Controls.Add(m_showAgainCheckBox); Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y) + 0 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapper.Get(MyTextsWrapperEnum.DecreaseVideoSettingsCheckBox), m_textColor, MyGuiConstants.LABEL_TEXT_SCALE * 0.75f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, config.Font)); } // Buttons Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - m_buttonSize.Y / 2.0f); if (m_buttonType == MyMessageBoxButtonsType.OK) { //Controls.Add(new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor, //null,null,null, //m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, //true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true)); var okButton = new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, config.ButtonColor, config.ButtonTexture, null, null, m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); } else if ((m_buttonType == MyMessageBoxButtonsType.YES_NO) || (m_buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT)) { var okButton = new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, config.ButtonColor, config.ButtonTexture, null, null, m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); var noButton = new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL, config.ButtonColor, config.ButtonTexture, null, null, m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(noButton); //Controls.Add(new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor, // null,null,null, // m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true)); //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor, // null,null,null, // m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true)); } else if (m_buttonType == MyMessageBoxButtonsType.NONE) { } else { throw new MyMwcExceptionApplicationShouldNotGetHere(); } }
// Constructor for YES/NO message boxes and checkBox public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum checkBoxMessage, MyTextsWrapperEnum?okButtonText, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, out MyGuiControlCheckbox showAgainCheckBox) : this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, true) { showAgainCheckBox = m_showAgainCheckBox; }
// Constructor for YES/NO message boxes - and text and caption defined by StringBuilder instead of enum public MyGuiScreenMessageBox(MyMessageBoxType type, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback) : this(type, MyMessageBoxButtonsType.YES_NO, messageText, messageCaption, null, yesButtonText, noButtonText, callback, false) { }
public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum? accessForbiddenReason) : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment, canHandleKeyboardInput, align, implementedFeature) { m_accessForbiddenReason = accessForbiddenReason; m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null; }
// Constructor for YES/NO message boxes and TIMEOUT public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, int timeoutInMiliseconds) : this(type, MyMessageBoxButtonsType.YES_NO_TIMEOUT, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, false) { m_timeoutStartedTimeInMiliseconds = MyMinerGame.TotalTimeInMilliseconds; m_timeoutInMiliseconds = timeoutInMiliseconds; }
private MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum?okButtonText, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, bool enableCheckBox) : this(type, buttonType, messageText, messageCaption, okButtonText, yesButtonText, noButtonText, callback, enableCheckBox, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE) { }
private void AddControls() { Controls.Clear(); AddCaption(MyTextsWrapperEnum.PlayStory, new Vector2(0, 0.005f)); Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.147f); Vector2 buttonDelta = new Vector2(0.15f, 0); const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; MyTextsWrapperEnum?otherButtonsForbidden = null; MyTextsWrapperEnum?newGameForbidden = null; //MyTextsWrapperEnum newGameText = MyTextsWrapperEnum.StartDemo; int buttonPositionCounter = 0; if (MyClientServer.LoggedPlayer != null) { if ((MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanSave() == false)) { //Uncomment when other buttons functionality implemented newGameForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode; //otherButtonsForbidden = newGameForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild; } else if (MyClientServer.LoggedPlayer.IsDemoUser()) { //Uncomment when other buttons functionality implemented newGameForbidden = null; otherButtonsForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode; } else if (MyClientServer.LoggedPlayer.GetCanSave() == true) { //newGameText = MyTextsWrapperEnum.NewGame; newGameForbidden = null; } ParallelTasks.Parallel.Start(CheckCheckpointAndChapter); } // New Game / Start Demo var newGameButton = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.NewGame, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnNewGameClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, newGameForbidden); // Continue last game m_continueLastGame = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.ContinueLastGame, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnLoadLastCheckpointClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyFakes.LOAD_LAST_CHECKPOINT_ENABLED, otherButtonsForbidden); m_continueLastGame.DrawRedTextureWhenDisabled = false; // Show load checkpoint first (it's unknown whether checkpoint exists var tmp = newGameButton.GetPosition(); newGameButton.SetPosition(m_continueLastGame.GetPosition()); m_continueLastGame.SetPosition(tmp); Controls.Add(m_continueLastGame); Controls.Add(newGameButton); m_continueLastGame.Enabled = false; // Load Chapter m_loadChapter = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.LoadChapter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnLoadChapterClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, //MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetCanAccessEditorForStory() true /* && !otherButtonsForbidden.HasValue*/, otherButtonsForbidden); m_loadChapter.DrawRedTextureWhenDisabled = false; Controls.Add(m_loadChapter); m_loadChapter.Enabled = false; // Load Checkpoint //var loadCheckpoint = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, // MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, // MyTextsWrapperEnum.LoadCheckpoint, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, // OnLoadCheckpointClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, // MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetCanAccessEditorForStory()/* && !otherButtonsForbidden.HasValue*/, otherButtonsForbidden); //loadCheckpoint.DrawRedTextureWhenDisabled = false; //Controls.Add(loadCheckpoint); // Join friend’s game - Coop mode var join = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.JoinFriendGame, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnJoinFriendGameClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, otherButtonsForbidden); join.DrawRedTextureWhenDisabled = false; Controls.Add(join); var backButton = new MyGuiControlButton(this, new Vector2(0, 0.178f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(backButton); }
// Buttons must be created here because in this screen's constructor we might have not been logged in public override void LoadContent() { base.LoadContent(); Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.145f); const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; MyTextsWrapperEnum?yourSectorsButtonForbidden = null; MyTextsWrapperEnum?storySectorsButtonsForbidden = null; MyTextsWrapperEnum?mmoSectorsButtonsForbidden = null; if (MyClientServer.LoggedPlayer != null) { //if (true/*(MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanAccessStory() == false)*/) //{ // yourSectorsButtonForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild; //} if (!MyClientServer.LoggedPlayer.GetCanAccessEditorForStory()) { storySectorsButtonsForbidden = MyTextsWrapperEnum.AvailableOnlyForAdministrators; } if (true /*MyClientServer.LoggedPlayer.GetCanAccessEditorForMMO() == false*/) { mmoSectorsButtonsForbidden = MyTextsWrapperEnum.AvailableOnlyForAdministrators; } } // Buttons My Sectors and Friends Sectors Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.SandboxSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnSandboxSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, storySectorsButtonsForbidden)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.YourSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnYourSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, yourSectorsButtonForbidden)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.StorySectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnStorySectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, storySectorsButtonsForbidden)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.MmoSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnMmoSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, mmoSectorsButtonsForbidden)); var exitButton = new MyGuiControlButton(this, new Vector2(0, 0.1460f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(exitButton); /* * * Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 3.5f * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, * MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); * */ }
public MyHackingResultMessage(MyTextsWrapperEnum?text, GetFontDelegate getFontDelegate, MySoundCuesEnum?soundCue) { Text = text; GetFontDelegate = getFontDelegate; SoundCue = soundCue; }
public MyUseProperties(MyUseType useMask, MyUseType hackMask, MyTextsWrapperEnum? useText = null) { UseMask = useMask; HackMask = hackMask; UseText = useText; }