public string GetText() { if (string.IsNullOrEmpty(m_notificationText) || m_isTextDirty) { if (m_textFormatArguments != null && m_textFormatArguments.Length > 0) { if (m_notificationTextID == 0) { m_notificationText = String.Format(m_originalText, m_textFormatArguments); } else { m_notificationText = MyTextsWrapper.GetFormatString(GetTextEnum(), m_textFormatArguments); } } else { if (m_notificationTextID == 0) { m_notificationText = m_originalText; } else { m_notificationText = MyTextsWrapper.GetFormatString(GetTextEnum()); } } m_isTextDirty = false; } return(m_notificationText); }
private static void ShowNetworkError() { var caption = MyTextsWrapper.Get(MyTextsWrapperEnum.MessageBoxNetworkErrorCaption); var msg = new StringBuilder(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.MP_CannotConnectServerJoin, MinerWars.CommonLIB.AppCode.Utils.MyMwcNetworkingConstants.NETWORKING_PORT_MASTER_SERVER)); MyGuiManager.AddModalScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, msg, caption, MyTextsWrapperEnum.Ok, null), null); }
private void FormatName() { m_timeBombArgs[0] = String.Format("{0:0.0}", (TimeToActivate - m_elapsedMiliseconds) / 1000f); var timeBombDisplay = MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.TimeBombHud, m_timeBombArgs); m_timeBombHUDBuilder.Clear(); m_timeBombHUDBuilder.Append(timeBombDisplay); }
private static void UpdateAmmoSpecialText() { m_ammoSpecialText.Clear(); if (!MySession.PlayerShip.HasFiredRemoteBombs()) { m_ammoSpecialText.AppendFormat(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.TimeBombHelp), MySession.PlayerShip.Config.TimeBombTimer.CurrentValue, MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.WEAPON_SPECIAL)); } }
public static StringBuilder GetAmmoSpecialText() { m_ammoSpecialText.Clear(); var remoteBombCount = MySession.PlayerShip.RemoteBombCount; if (remoteBombCount > 0) { m_ammoSpecialText.AppendFormat(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.RemoteBombHelp), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.WEAPON_SPECIAL), remoteBombCount); } return(m_ammoSpecialText); }
public MyGuiScreenDemoAccessInfo() : base(new Vector2(1.0f, 0.0f), null, null, true, null) { m_isTopMostScreen = true; m_drawEvenWithoutFocus = true; m_canHaveFocus = false; m_screenCanHide = false; m_canCloseInCloseAllScreenCalls = false; m_sbInfo = MyTextsWrapper.Get(MyTextsWrapperEnum.MessageYouHaveDemoAccess); m_sbPressToHide = new StringBuilder(); m_sbPressToHide.AppendFormat(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.MessagePressToHide), m_keysToCloseInfo); }
public void ReloadControlText() { m_text = MyTextsWrapper.Get(MyTextsWrapperEnum.AmmoSelectText); MyGuiInput input = MyGuiManager.GetInput(); m_textValues.Clear(); m_textValues.AppendFormat(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.AmmoSelectTextValues), input.GetGameControl(MyGameControlEnums.FIRE_PRIMARY).GetControlButtonStringBuilderCombined(" / "), input.GetGameControl(MyGameControlEnums.FIRE_SECONDARY).GetControlButtonStringBuilderCombined(" / "), input.GetGameControl(MyGameControlEnums.FIRE_THIRD).GetControlButtonStringBuilderCombined(" / "), input.GetGameControl(MyGameControlEnums.FIRE_FOURTH).GetControlButtonStringBuilderCombined(" / "), input.GetGameControl(MyGameControlEnums.FIRE_FIFTH).GetControlButtonStringBuilderCombined(" / ") ); }
public void OnSendClick(MyGuiControlButton sender) { if (m_textbox.Text != "") { if (MyMultiplayerGameplay.IsRunning) { if (m_teamOnly) { m_textbox.Text = MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.MPChatTeamMessagePrefix) + m_textbox.Text; MyMultiplayerGameplay.Static.SendChatMessageToTeam(m_textbox.Text, MySession.Static.Player.Faction); } else { MyMultiplayerGameplay.Static.SendChatMessage(m_textbox.Text); } } MyGuiScreenGamePlay.Static.AddChatMessage(MyClientServer.LoggedPlayer.GetUserId(), m_textbox.Text); } this.CloseScreen(); }
public override void HandleInput(MyGuiInput input, bool receivedFocusInThisUpdate) { base.HandleInput(input, receivedFocusInThisUpdate); if (MyGuiInput.ENABLE_DEVELOPER_KEYS) { if (input.IsNewKeyPress(Keys.C) && input.IsAnyCtrlKeyPressed()) { CopySector(); } if (input.IsNewKeyPress(Keys.V) && input.IsAnyCtrlKeyPressed()) { PasteSector(); } } if (MyFakes.DRAW_FACTION_AREAS_IN_SOLAR_MAP) { MySolarMapAreaInput.HandleInput(m_solarMapRender, input, receivedFocusInThisUpdate); } float rollIndicator = input.GetRoll(); Vector2 rotationIndicator = Vector2.Zero; if (input.IsNewRightMousePressed() && MyVideoModeManager.IsHardwareCursorUsed()) { m_oldRotationIndicator = input.GetRotation(); } if (input.IsRightMousePressed()) { if (MyVideoModeManager.IsHardwareCursorUsed()) { rotationIndicator = m_oldRotationIndicator - input.GetRotation(); m_oldRotationIndicator = input.GetRotation(); } else { rotationIndicator = input.GetRotation(); } } Vector3 moveIndicator = input.GetPositionDelta(); if (input.IsKeyPress(Keys.Left)) { moveIndicator.X = -1; } if (input.IsKeyPress(Keys.Right)) { moveIndicator.X = 1; } if (input.IsKeyPress(Keys.Up)) { moveIndicator.Z = -1; } if (input.IsKeyPress(Keys.Down)) { moveIndicator.Z = 1; } m_camera.Zoom(input.DeltaMouseScrollWheelValue()); m_camera.MoveAndRotate(moveIndicator, rotationIndicator, rollIndicator, 1); bool sectorChanged = false; if (m_lastSector != m_camera.TargetSector) { sectorChanged = true; m_lastSector = m_camera.TargetSector; } MySolarSystemMapNavigationMark navigationMarkUnderMouse = GetNearestNavigationMarkUnderMouseCursor(); const float maxHeightForEnter = MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS * 16; if (sectorChanged) // we have moved camera so deselect sector { m_selectedSector = null; } // tool tips if (m_lastNavigationMarkUnderMouse != navigationMarkUnderMouse) { m_toolTip.ClearToolTips(); if (navigationMarkUnderMouse != null) { m_toolTip.AddToolTip(new StringBuilder(GetSectorName(navigationMarkUnderMouse))); if (!String.IsNullOrEmpty(navigationMarkUnderMouse.Description)) { m_toolTip.AddToolTip(new StringBuilder(navigationMarkUnderMouse.Description), Color.LightGray); } m_toolTip.AddToolTip(new StringBuilder(navigationMarkUnderMouse.Sector.ToString()), Color.LightGray); } m_lastNavigationMarkUnderMouse = navigationMarkUnderMouse; } if (navigationMarkUnderMouse != null) { MyGuiManager.SetMouseCursorTexture(MyGuiManager.GetMouseCursorHandTexture()); if (input.IsNewLeftMousePressed() && !m_travelButton.IsMouseOver()) { MyAudio.AddCue2D(MySoundCuesEnum.GuiMouseClick); if (m_selectedNavigationMark != null) { m_selectedNavigationMark.Highlight = false; } m_selectedNavigationMark = navigationMarkUnderMouse; m_selectedNavigationMark.Highlight = true; sectorChanged = true; m_slectionLocked = true; m_travelButton.Visible = false; } if (input.IsNewLeftMouseDoubleClick()) { TravelToSector(navigationMarkUnderMouse.Sector, navigationMarkUnderMouse.MissionID); } } else if (m_camera.CameraDistance < maxHeightForEnter && !m_slectionLocked) { if (MyGuiScreenGamePlay.CanTravelToSector(m_camera.TargetSector)) { //MyGuiManager.SetMouseCursorTexture(MyGuiManager.GetMouseCursorHandTexture()); if (m_selectedNavigationMark != null) { m_selectedNavigationMark.Highlight = false; } var navigationMarkUnderCamera = GetNavigationMarkUnderCamera(); if (navigationMarkUnderCamera != null && navigationMarkUnderCamera.Sector == m_camera.TargetSector) { m_selectedNavigationMark = navigationMarkUnderCamera; } else { m_selectedNavigationMark = new MySolarSystemMapNavigationMark(m_camera.TargetSector, ""); m_travelButton.Visible = false; } } else { m_selectedNavigationMark = null; } } else if (input.IsNewLeftMousePressed()) { if (m_selectedNavigationMark != null) { m_selectedNavigationMark.Highlight = false; } if (!m_travelButton.IsMouseOver()) { m_selectedNavigationMark = null; } m_slectionLocked = false; } else if (sectorChanged && m_camera.CameraDistance > maxHeightForEnter && !m_slectionLocked) { m_selectedNavigationMark = null; } else { MyGuiManager.SetMouseCursorTexture(MyGuiManager.GetMouseCursorArrowTexture()); } if (m_selectedNavigationMark != null) { if (!m_travelButton.Visible) { m_travelButton.Text.Clear(); string text = GetSectorName(m_selectedNavigationMark); if (text.Length > 21) { text = text.Substring(0, 20); text += "…"; } m_travelButton.Text.Append(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.TravelTo, text)); // float width = MyGuiManager.GetNormalizedSize( MyGuiManager.GetFontMinerWarsBlue(), m_travelButton.Text, 1).X + 0.05f; // m_travelButton.SetSize(new Vector2(width, MyGuiConstants.BACK_BUTTON_SIZE.Y)); m_travelButton.Visible = true; } } else { m_travelButton.Visible = false; } }
public MyHudTextWarning(MyTextsWrapperEnum text, params object[] args) : this(new StringBuilder(MyTextsWrapper.GetFormatString(text, args))) { }
public MyGuiScreenMultiplayerEnterGameRequest(MyGuiScreenGamePlay.MyJoinGameRequest request) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 600 / 1200f), false, MyGuiManager.GetSandboxBackgoround()) { m_enableBackgroundFade = true; m_backgroundFadeColor = new Vector4(0.0f, 0.0f, 0.0f, 0.5f); m_request = request; AddCaption(MyTextsWrapperEnum.JoinRequestTitle); Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f); MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED; Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, null, new StringBuilder(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.JoinRequest, request.Message.PlayerInfo.DisplayName)), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiConstants.DEFAULT_CONTROL_FONT)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.AllowEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAllowEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.DenyEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDenyEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); MyGuiControlLabel lblRememberSetting = new MyGuiControlLabel(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA - new Vector2(0.03f, 0), null, MyTextsWrapperEnum.Remember, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); Controls.Add(lblRememberSetting); m_chkRememberSetting = new MyGuiControlCheckbox(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA + new Vector2(0.05f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, lblRememberSetting); Controls.Add(m_chkRememberSetting); }