コード例 #1
0
            public ControlWithDescription(MyGameControlEnums control)
            {
                MyControl c = MyGuiManager.GetInput().GetGameControl(control);

                Control     = c.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard);
                Description = MyTextsWrapper.Get(c.GetControlName());
            }
コード例 #2
0
            public ControlWithDescription(MyGameControlEnums control1, MyGameControlEnums control2)
            {
                MyControl c1 = MyGuiManager.GetInput().GetGameControl(control1);
                MyControl c2 = MyGuiManager.GetInput().GetGameControl(control2);

                Control     = new StringBuilder().Append(c1.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard)).Append(", ").Append(c2.GetControlButtonStringBuilder(MyGuiInputDeviceEnum.Keyboard));
                Description = new StringBuilder().Append(MyTextsWrapper.Get(c1.GetControlName())).Append(" / ").Append(MyTextsWrapper.Get(c2.GetControlName()));
            }
コード例 #3
0
 public bool CheckStandardDisapearKey()
 {
     if (MyGuiManager.GetInput().IsGameControlPressed(MyGameControlEnums.NOTIFICATION_CONFIRMATION))
     {
         return(true);
     }
     return(false);
 }
コード例 #4
0
 private void OnResetDefaultsClick(MyGuiControlButton sender)
 {
     //  revert to controls when the screen was first opened and then close.
     MyGuiManager.GetInput().RevertToDefaultControls();
     //  I need refresh text on buttons. Create them again is the easiest way.
     DeactivateControls(m_currentControlType);
     AddControls();
     ActivateControls(m_currentControlType);
 }
コード例 #5
0
 private void AddDroneNotification()
 {
     m_learnToUseDrone = MyScriptWrapper.CreateNotification(
         MyTextsWrapperEnum.HowToControlDrone,
         MyHudConstants.MISSION_FONT, 0,
         new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_DEPLOY), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.DRONE_CONTROL) }
         );
     MyScriptWrapper.AddNotification(m_learnToUseDrone);
 }
コード例 #6
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
        /// <summary>
        /// Return the analog state between 0 (not pressed at all) and 1 (fully pressed).
        /// If a digital button is mapped to an analog control, it can return only 0 or 1.
        /// </summary>
        public float GetAnalogState()
        {
            bool pressed = false;

            if (m_keyboardKey != Keys.None)
            {
                pressed = MyGuiManager.GetInput().IsKeyPress(m_keyboardKey);
                if (pressed == false)
                {
                    pressed = MyGuiManager.GetInput().IsKeyPress(m_keyboardKey2);
                }
            }

            if (m_mouseButton != MyMouseButtonsEnum.None && pressed == false)
            {
                switch (m_mouseButton)
                {
                case MyMouseButtonsEnum.Left:
                    pressed = MyGuiManager.GetInput().IsLeftMousePressed();
                    break;

                case MyMouseButtonsEnum.Middle:
                    pressed = MyGuiManager.GetInput().IsMiddleMousePressed();
                    break;

                case MyMouseButtonsEnum.Right:
                    pressed = MyGuiManager.GetInput().IsRightMousePressed();
                    break;

                case MyMouseButtonsEnum.XButton1:
                    pressed = MyGuiManager.GetInput().IsXButton1MousePressed();
                    break;

                case MyMouseButtonsEnum.XButton2:
                    pressed = MyGuiManager.GetInput().IsXButton2MousePressed();
                    break;
                }
            }

            if (m_joystickButton != MyJoystickButtonsEnum.None && pressed == false)
            {
                pressed = MyGuiManager.GetInput().IsJoystickButtonPressed(m_joystickButton);
            }

            if (pressed)
            {
                return(1);
            }

            if (m_joystickAxis != MyJoystickAxesEnum.None)
            {
                return(MyGuiManager.GetInput().GetJoystickAxisStateForGameplay(m_joystickAxis));
            }
            return(0);
        }
コード例 #7
0
        public MyGuiControlSelectAmmo(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4?backgroundColor)
            : base(parent, position, size, backgroundColor, null)
        {
            Visible       = false;
            m_isPressLast = false;

            m_textValues = new StringBuilder();

            ReloadControlText();
            MyGuiManager.GetInput().ControlsSaved += OnGuiInputControlsSaved;
        }
コード例 #8
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
        public bool WasPressed()
        {
            bool pressed = false;

            if (m_keyboardKey != Keys.None)
            {
                pressed = MyGuiManager.GetInput().WasKeyPressed(m_keyboardKey);
                if (pressed == false)
                {
                    pressed = MyGuiManager.GetInput().WasKeyPressed(m_keyboardKey2);
                }
            }

            if (m_mouseButton != MyMouseButtonsEnum.None && pressed == false)
            {
                switch (m_mouseButton)
                {
                case MyMouseButtonsEnum.Left:
                    pressed = MyGuiManager.GetInput().WasLeftMousePressed();
                    break;

                case MyMouseButtonsEnum.Middle:
                    pressed = MyGuiManager.GetInput().WasMiddleMousePressed();
                    break;

                case MyMouseButtonsEnum.Right:
                    pressed = MyGuiManager.GetInput().WasRightMousePressed();
                    break;

                case MyMouseButtonsEnum.XButton1:
                    pressed = MyGuiManager.GetInput().WasXButton1MousePressed();
                    break;

                case MyMouseButtonsEnum.XButton2:
                    pressed = MyGuiManager.GetInput().WasXButton2MousePressed();
                    break;
                }
            }

            if (m_joystickButton != MyJoystickButtonsEnum.None && pressed == false)
            {
                pressed = MyGuiManager.GetInput().WasJoystickButtonPressed(m_joystickButton);
            }

            if (m_joystickAxis != MyJoystickAxesEnum.None && pressed == false)
            {
                pressed = MyGuiManager.GetInput().WasJoystickAxisPressed(m_joystickAxis);
            }
            return(pressed);
        }
コード例 #9
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
        public bool IsNewReleased()
        {
            bool released = false;

            if (m_keyboardKey != Keys.None)
            {
                released = MyGuiManager.GetInput().IsNewKeyReleased(m_keyboardKey);
                if (released == false)
                {
                    released = MyGuiManager.GetInput().IsNewKeyReleased(m_keyboardKey2);
                }
            }

            if (m_mouseButton != MyMouseButtonsEnum.None && released == false)
            {
                switch (m_mouseButton)
                {
                case MyMouseButtonsEnum.Left:
                    released = MyGuiManager.GetInput().IsNewLeftMouseReleased();
                    break;

                case MyMouseButtonsEnum.Middle:
                    released = MyGuiManager.GetInput().IsNewMiddleMouseReleased();
                    break;

                case MyMouseButtonsEnum.Right:
                    released = MyGuiManager.GetInput().IsNewRightMouseReleased();
                    break;

                case MyMouseButtonsEnum.XButton1:
                    released = MyGuiManager.GetInput().IsNewXButton1MouseReleased();
                    break;

                case MyMouseButtonsEnum.XButton2:
                    released = MyGuiManager.GetInput().IsNewXButton2MouseReleased();
                    break;
                }
            }

            if (m_joystickButton != MyJoystickButtonsEnum.None && released == false)
            {
                released = MyGuiManager.GetInput().IsNewJoystickButtonReleased(m_joystickButton);
            }
            if (m_joystickAxis != MyJoystickAxesEnum.None && released == false)
            {
                released = MyGuiManager.GetInput().IsNewJoystickAxisReleased(m_joystickAxis);
            }

            return(released);
        }
コード例 #10
0
ファイル: MyControl.cs プロジェクト: whztt07/Miner-Wars-2081
        public bool WasReleased()
        {
            bool wasReleased = false;

            if (m_keyboardKey != Keys.None)
            {
                wasReleased = MyGuiManager.GetInput().WasKeyReleased(m_keyboardKey);
                if (wasReleased == false)
                {
                    wasReleased = MyGuiManager.GetInput().WasKeyReleased(m_keyboardKey2);
                }
            }

            if (m_mouseButton != MyMouseButtonsEnum.None && wasReleased == false)
            {
                switch (m_mouseButton)
                {
                case MyMouseButtonsEnum.Left:
                    wasReleased = MyGuiManager.GetInput().WasLeftMouseReleased();
                    break;

                case MyMouseButtonsEnum.Middle:
                    wasReleased = MyGuiManager.GetInput().WasMiddleMouseReleased();
                    break;

                case MyMouseButtonsEnum.Right:
                    wasReleased = MyGuiManager.GetInput().WasRightMouseReleased();
                    break;

                case MyMouseButtonsEnum.XButton1:
                    wasReleased = MyGuiManager.GetInput().WasNewXButton1MouseReleased();
                    break;

                case MyMouseButtonsEnum.XButton2:
                    wasReleased = MyGuiManager.GetInput().WasNewXButton2MouseReleased();
                    break;
                }
            }

            if (m_joystickButton != MyJoystickButtonsEnum.None && wasReleased == false)
            {
                wasReleased = MyGuiManager.GetInput().WasJoystickButtonReleased(m_joystickButton);
            }
            if (m_joystickAxis != MyJoystickAxesEnum.None && wasReleased == false)
            {
                wasReleased = MyGuiManager.GetInput().WasJoystickAxisReleased(m_joystickAxis);
            }

            return(wasReleased);
        }
コード例 #11
0
        private void CloseScreenAndSave()
        {
            MyGuiManager.GetInput().JoystickInstanceName = m_joystickCombobox.GetSelectedIndex() == 0 ? null : m_joystickCombobox.GetSelectedValue().ToString();
            MyGuiManager.GetInput().SetMouseXInversion(m_invertMouseXCheckbox.Checked);
            MyGuiManager.GetInput().SetMouseYInversion(m_invertMouseYCheckbox.Checked);
            MyGuiManager.GetInput().SetMouseSensitivity(m_mouseSensitivitySlider.GetValue());
            MyGuiManager.GetInput().SetJoystickSensitivity(m_joystickSensitivitySlider.GetValue());
            MyGuiManager.GetInput().SetJoystickExponent(m_joystickExponentSlider.GetValue());
            MyGuiManager.GetInput().SetJoystickDeadzone(m_joystickDeadzoneSlider.GetValue());
            MyGuiManager.GetInput().SaveControls();

            //MyGuiScreenGamePlay.Static.SetControlsChange(true);

            CloseScreen();
        }
コード例 #12
0
        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(" / ")
                                      );
        }
コード例 #13
0
        public override bool IsSuccess()
        {
            m_isNearLocation = base.IsSuccess() || IsNearRealLocation();
            if (m_isNearLocation)
            {
                m_notification.SetTextFormatArguments(new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE) });
                m_notification.Appear();
                MyHudNotification.AddNotification(m_notification);
            }
            else
            {
                m_notification.Disappear();
            }

            return(false);
        }
コード例 #14
0
        private void AddJoysticksToComboBox()
        {
            int counter = 0;

            m_joystickCombobox.AddItem(counter++, MyTextsWrapper.Get(MyTextsWrapperEnum.Disabled));
            m_joystickCombobox.SelectItemByIndex(0);

            foreach (string joystickName in MyGuiManager.GetInput().EnumerateJoystickNames())
            {
                m_joystickCombobox.AddItem(counter, new StringBuilder(joystickName));
                if (MyGuiManager.GetInput().JoystickInstanceName == joystickName)
                {
                    m_joystickCombobox.SelectItemByIndex(counter);
                }
                counter++;
            }
        }
コード例 #15
0
        private void DrawControls()
        {
            //  Then draw all screen controls, except opened combobox and drag and drop - must be drawn as last
            // foreach (MyGuiControlBase control in Controls.GetVisibleControls())  //dont use this - allocations
            List <MyGuiControlBase> visibleControls = Controls.GetVisibleControls();

            for (int i = 0; i < visibleControls.Count; i++)
            {
                MyGuiControlBase control = visibleControls[i];
                if (control != m_comboboxHandlingNow && control != m_listboxDragAndDropHandlingNow)
                {
                    if (MyMinerGame.IsPaused() && !control.DrawWhilePaused)
                    {
                        continue;
                    }
                    control.Draw();
                }
            }

            //  Finaly draw opened combobox and dragAndDrop, so it will overdraw all other controls

            if (m_comboboxHandlingNow != null)
            {
                m_comboboxHandlingNow.Draw();
            }

            if (m_listboxDragAndDropHandlingNow != null)
            {
                m_listboxDragAndDropHandlingNow.Draw();
            }

            // draw tooltips only when screen has focus
            if (this == MyGuiManager.GetScreenWithFocus())
            {
                //  Draw tooltips
                for (int i = 0; i < m_controlsVisible.Count; i++)
                {
                    MyGuiControlBase control = m_controlsVisible[i];
                    control.ShowToolTip();
                    if (MyFakes.CONTROLS_MOVE_ENABLED && MyGuiManager.GetInput().IsKeyPress(Keys.M))
                    {
                        DrawControlDebugPosition(control);
                    }
                }
            }
        }
コード例 #16
0
        private void MyScriptWrapperOnFadedOut()
        {
            MyScriptWrapper.FadedOut -= MyScriptWrapperOnFadedOut;

            MyScriptWrapper.FadeIn();

            MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000,
                                                                               new object[] {
                MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT),
                MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT)
            }
                                                                               ));

            MyScriptWrapper.TakeControlOfLargeWeapon(m_madelynTurrets[m_activeTurret]);
            MyScriptWrapper.ForbideDetaching();

            MyScriptWrapper.SwitchTowerPrevious += MyScriptWrapper_SwitchTowerPrevious;
            MyScriptWrapper.SwitchTowerNext     += MyScriptWrapper_SwitchTowerNext;
        }
コード例 #17
0
        public override void Update()
        {
            base.Update();

            if (MyGuiManager.GetInput().GetGameControl(MyGameControlEnums.USE).IsPressed() && (base.IsSuccess() || IsNearRealLocation()))
            {
                if (!m_inUse)
                {
                    StartUse();
                }
                //m_elapsedTime += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                //m_useProgress.UpdateValue((float)(m_elapsedTime) / (float)m_requiredTime);

                //if (m_elapsedTime >= m_requiredTime)
                //{
                //    FinishUse();
                //}
            }
        }
コード例 #18
0
            public MyGuiControlAssignKeyMessageBox(Dictionary <MyControl, MyGuiControlButton> buttonsDictionary, MyGuiInputDeviceEnum deviceType, MyControl control, MyTextsWrapperEnum messageText)
                : base(MyMessageBoxType.NULL, messageText, MyTextsWrapperEnum.SelectControl, null)
            {
                DrawMouseCursor     = false;
                m_isTopMostScreen   = false;
                m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBackground", flags: TextureFlags.IgnoreQuality);
                m_size              = new Vector2(598 / 1600f, 368 / 1200f);
                m_control           = control;
                m_buttonsDictionary = buttonsDictionary;
                m_deviceType        = deviceType;

                MyGuiManager.GetInput().GetListOfPressedKeys(m_oldPressedKeys);
                MyGuiManager.GetInput().GetListOfPressedMouseButtons(m_oldPressedMouseButtons);
                MyGuiManager.GetInput().GetListOfPressedJoystickButtons(m_oldPressedJoystickButtons);
                MyGuiManager.GetInput().GetListOfPressedJoystickAxes(m_oldPressedJoystickAxes);
                m_interferenceVideoColor = Vector4.One;
                m_closeOnEsc             = false;
                m_screenCanHide          = true;
                //Controls.Add(new MyGuiControlRotatingWheel(this, new Vector2(0, 0.05f), Vector4.One, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            }
コード例 #19
0
            private void AssignAlreadyAssignedCommand(MyGuiScreenMessageBoxCallbackEnum r, MyControl control)
            {
                if (r == MyGuiScreenMessageBoxCallbackEnum.YES)
                {
                    switch (m_deviceType)
                    {
                    case MyGuiInputDeviceEnum.Keyboard:
                        m_control.SetControl(control.GetKeyboardControl());
                        control.SetControl(Keys.None);
                        break;

                    case MyGuiInputDeviceEnum.Mouse:
                        m_control.SetControl(control.GetMouseControl());
                        control.SetControl(MyMouseButtonsEnum.None);
                        break;

                    case MyGuiInputDeviceEnum.Joystick:
                        m_control.SetControl(control.GetJoystickControl());
                        control.SetControl(MyJoystickButtonsEnum.None);
                        break;

                    case MyGuiInputDeviceEnum.JoystickAxis:
                        m_control.SetControl(control.GetJoystickAxisControl());
                        control.SetControl(MyJoystickAxesEnum.None);
                        break;
                    }
                    m_buttonsDictionary[m_control].SetText(new StringBuilder(m_control.GetControlButtonName(m_deviceType)));
                    if (m_buttonsDictionary.ContainsKey(control))
                    {
                        m_buttonsDictionary[control].SetText(new StringBuilder(control.GetControlButtonName(m_deviceType)));
                    }
                    CloseScreen();
                }
                else
                {
                    MyGuiManager.GetInput().GetListOfPressedKeys(m_oldPressedKeys);
                    MyGuiManager.GetInput().GetListOfPressedMouseButtons(m_oldPressedMouseButtons);
                    MyGuiManager.GetInput().GetListOfPressedJoystickButtons(m_oldPressedJoystickButtons);
                    MyGuiManager.GetInput().GetListOfPressedJoystickAxes(m_oldPressedJoystickAxes);
                }
            }
コード例 #20
0
        public override void Update()
        {
            base.Update();

            uint entityId = 0;

            if (MyGuiManager.GetInput().GetGameControl(MyGameControlEnums.USE).IsPressed() && IsNearSomeLocation(ref entityId))
            {
                if (!m_inUse)
                {
                    StartUse();
                    m_usingEntityId = entityId;
                }


                //m_elapsedTime += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
                //m_useProgress.UpdateValue((float)(m_elapsedTime) / (float)m_requiredTime);

                //if (m_elapsedTime >= m_requiredTime)
                //{
                //    FinishUse();
                //}
            }
        }
コード例 #21
0
            public void Draw()
            {
                ClearTexts();
                int visibleCount = Math.Min(m_notifications.Count, MyNotificationConstants.MAX_DISPLAYED_NOTIFICATIONS_COUNT);

                for (int i = 0; i < visibleCount; i++)
                {
                    MyNotification actualNotification   = m_notifications[i];
                    StringBuilder  messageStringBuilder = m_textsPool.Allocate();
                    Debug.Assert(actualNotification != null);
                    Debug.Assert(messageStringBuilder != null);

                    bool hasConfirmation = actualNotification.HasDefaultDisappearMessage();

                    messageStringBuilder.Append(actualNotification.GetText());

                    if (hasConfirmation)
                    {
                        messageStringBuilder.AppendLine();
                        messageStringBuilder.ConcatFormat(m_defaultNotificationDisapearMessage, MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.NOTIFICATION_CONFIRMATION));
                    }

                    // draw background:
                    Vector2 textSize = MyGuiManager.GetNormalizedSize(m_usedFont, messageStringBuilder, actualNotification.GetScale());

                    m_textSizes.Add(textSize);
                    m_texts.Add(messageStringBuilder);
                }

                MyGuiManager.BeginSpriteBatch();
                var offset = new Vector2(VideoMode.MyVideoModeManager.IsTripleHead() ? -1 : 0, 0);


                // Draw fog
                Vector2 notificationPosition = Position;

                for (int i = 0; i < visibleCount; i++)
                {
                    Vector2 fogFadeSize = m_textSizes[i] * new Vector2(1.6f, 8.0f);

                    MyGuiManager.DrawSpriteBatch(MyGuiManager.GetFogSmallTexture(), notificationPosition + offset, fogFadeSize,
                                                 m_fogColor,
                                                 MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoModeManager.IsTripleHead());

                    notificationPosition.Y += m_textSizes[i].Y;
                }

                // Draw texts
                notificationPosition = Position;
                for (int i = 0; i < visibleCount; i++)
                {
                    MyNotification actualNotification = m_notifications[i];

                    MyGuiManager.DrawString(actualNotification.GetFont(), m_texts[i], notificationPosition + offset,
                                            actualNotification.GetScale(), Color.White,
                                            MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyVideoModeManager.IsTripleHead());
                    notificationPosition.Y += m_textSizes[i].Y;
                }
                MyGuiManager.EndSpriteBatch();
            }
コード例 #22
0
        public override bool Draw(float backgroundFadeAlpha)
        {
            if (base.Draw(backgroundFadeAlpha) == false)
            {
                return(false);
            }

            float rowDistance = MyGuiConstants.DEBUG_STATISTICS_ROW_DISTANCE;
            float textScale   = MyGuiConstants.DEBUG_STATISTICS_TEXT_SCALE;

            m_stringIndex = 0;
            m_texts.Clear();
            m_rightAlignedtexts.Clear();


            m_texts.Add(StringBuilderCache.GetFormatedFloat("FPS: ", MyFpsManager.GetFps()));

            m_texts.Add(MyGuiManager.GetGuiScreensForDebug());

            m_texts.Add(StringBuilderCache.GetFormatedBool("Paused: ", MyMinerGame.IsPaused()));
            m_texts.Add(StringBuilderCache.GetFormatedDateTimeOffset("System Time: ", TimeUtil.LocalTime));
            m_texts.Add(StringBuilderCache.GetFormatedTimeSpan("Total MISSION Time: ", MyMissions.ActiveMission == null ? TimeSpan.Zero : MyMissions.ActiveMission.MissionTimer.GetElapsedTime()));
            m_texts.Add(StringBuilderCache.GetFormatedTimeSpan("Total GAME-PLAY Time: ", TimeSpan.FromMilliseconds(MyMinerGame.TotalGamePlayTimeInMilliseconds)));
            m_texts.Add(StringBuilderCache.GetFormatedTimeSpan("Total Time: ", TimeSpan.FromMilliseconds(MyMinerGame.TotalTimeInMilliseconds)));

            m_texts.Add(StringBuilderCache.GetFormatedLong("GC.GetTotalMemory: ", GC.GetTotalMemory(false), " bytes"));

//#if MEMORY_PROFILING
            //TODO: I am unable to show this without allocations
            m_texts.Add(StringBuilderCache.GetFormatedLong("Environment.WorkingSet: ", MyWindowsAPIWrapper.WorkingSet, " bytes"));

            m_texts.Add(StringBuilderCache.GetFormatedFloat("Available videomemory: ", MyMinerGame.Static.GraphicsDevice.AvailableTextureMemory / (1024.0f * 1024.0f), " MB"));
            // TODO: Videomem
            //m_texts.Add(StringBuilderCache.GetFormatedFloat("Allocated videomemory: ", MyProgram.GetResourcesSizeInMB(), " MB"));
//#endif

#if PHYSICS_SENSORS_PROFILING
            if (MinerWars.AppCode.Physics.MyPhysics.physicsSystem != null)
            {
                m_texts.Add(StringBuilderCache.GetFormatedInt("Physics sensor - new allocated interactions: ", MinerWars.AppCode.Physics.MyPhysics.physicsSystem.GetSensorInteractionModule().GetNewAllocatedInteractionsCount()));
                m_texts.Add(StringBuilderCache.GetFormatedInt("Physics sensor - interactions in use: ", MinerWars.AppCode.Physics.MyPhysics.physicsSystem.GetSensorInteractionModule().GetInteractionsInUseCount()));
                m_texts.Add(StringBuilderCache.GetFormatedInt("Physics sensor - interactions in use MAX: ", MinerWars.AppCode.Physics.MyPhysics.physicsSystem.GetSensorInteractionModule().GetInteractionsInUseCountMax()));
                m_texts.Add(StringBuilderCache.GetFormatedInt("Physics sensor - all sensors: ", MinerWars.AppCode.Physics.MyPhysics.physicsSystem.GetSensorModule().SensorsCount()));
                m_texts.Add(StringBuilderCache.GetFormatedInt("Physics sensor - active sensors: ", MinerWars.AppCode.Physics.MyPhysics.physicsSystem.GetSensorModule().ActiveSensors.Count));
            }
#endif

            m_texts.Add(StringBuilderCache.GetFormatedInt("Sound Instances Total 2D: ", MyAudio.GetSoundInstancesTotal2D()));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Sound Instances Total 3D: ", MyAudio.GetSoundInstancesTotal3D()));
            m_texts.Add(MyAudio.GetCurrentTransitionForDebug());
            if (MyAudio.GetMusicCue() != null)
            {
                //m_texts.Add(StringBuilderCache.GetStrings("Currently Playing Music Cue: ", MyAudio.GetMusicCue().Value.GetCue().Name));
            }

            m_texts.Add(StringBuilderCache.Clear());
            m_texts.Add(StringBuilderCache.GetFormatedInt("Textures 2D Count: ", MyPerformanceCounter.PerAppLifetime.Textures2DCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Textures 2D Size In Pixels: ", MyPerformanceCounter.PerAppLifetime.Textures2DSizeInPixels));
            m_texts.Add(StringBuilderCache.GetFormatedDecimal("Textures 2D Size In Mb: ", MyPerformanceCounter.PerAppLifetime.Textures2DSizeInMb, 3));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Dxt Compressed Textures Count: ", MyPerformanceCounter.PerAppLifetime.DxtCompressedTexturesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Non Dxt Compressed Textures Count: ", MyPerformanceCounter.PerAppLifetime.NonDxtCompressedTexturesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Non Mip Mapped Textures Count: ", MyPerformanceCounter.PerAppLifetime.NonMipMappedTexturesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Texture Cubes Count: ", MyPerformanceCounter.PerAppLifetime.TextureCubesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Texture Cubes Size In Pixels: ", MyPerformanceCounter.PerAppLifetime.TextureCubesSizeInPixels));
            m_texts.Add(StringBuilderCache.GetFormatedDecimal("Texture Cubes Size In Mb: ", MyPerformanceCounter.PerAppLifetime.TextureCubesSizeInMb, 3));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Non MyModels Count: ", MyPerformanceCounter.PerAppLifetime.ModelsCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("MyModels Count: ", MyPerformanceCounter.PerAppLifetime.MyModelsCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("MyModels Meshes Count: ", MyPerformanceCounter.PerAppLifetime.MyModelsMeshesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("MyModels Vertexes Count: ", MyPerformanceCounter.PerAppLifetime.MyModelsVertexesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("MyModels Triangles Count: ", MyPerformanceCounter.PerAppLifetime.MyModelsTrianglesCount));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Size of Model Vertex Buffers in Mb: ", MyPerformanceCounter.PerAppLifetime.ModelVertexBuffersSize / 1024 / 1024));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Size of Model Index Buffers in Mb: ", MyPerformanceCounter.PerAppLifetime.ModelIndexBuffersSize / 1024 / 1024));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Size of Voxel Vertex Buffers in Mb: ", MyPerformanceCounter.PerAppLifetime.VoxelVertexBuffersSize / 1024 / 1024));
            m_texts.Add(StringBuilderCache.GetFormatedInt("Size of Voxel Index Buffers in Mb: ", MyPerformanceCounter.PerAppLifetime.VoxelIndexBuffersSize / 1024 / 1024));
            m_texts.Add(StringBuilderCache.GetFormatedBool("Paused: ", MyMinerGame.IsPaused()));
            MyGuiManager.GetInput().GetPressedKeys(m_pressedKeys);
            AddPressedKeys("Current keys              : ", m_pressedKeys);

            m_texts.Add(StringBuilderCache.Clear());
            m_texts.Add(m_frameDebugText);


            //This ensures constant max length of right block to avoid flickering when correct max line is changing too often
            m_frameDebugTextRA.AppendLine();
            m_frameDebugTextRA.Append("                                                                  ");
            ////

            m_rightAlignedtexts.Add(m_frameDebugTextRA);

            Vector2 origin             = GetScreenLeftTopPosition();
            Vector2 rightAlignedOrigin = GetScreenRightTopPosition();

            for (int i = 0; i < m_texts.Count; i++)
            {
                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_texts[i], origin + new Vector2(0, i * rowDistance), textScale,
                                        Color.Yellow, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            }
            for (int i = 0; i < m_rightAlignedtexts.Count; i++)
            {
                MyGuiManager.DrawString(MyGuiManager.GetFontMinerWarsWhite(), m_rightAlignedtexts[i], rightAlignedOrigin + new Vector2(0.0f, i * rowDistance), textScale,
                                        Color.Yellow, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            }

            ClearFrameDebugText();

            return(true);
        }
コード例 #23
0
        public override void Load()
        {
            if (!IsMainSector)
            {
                return;
            }

            RemoveFriends();

            MyScriptWrapper.DisableAllGlobalEvents();

            m_attackerBots.Clear();

            m_detectorFirst  = MyScriptWrapper.GetDetector((uint)EntityID.DetectorFirst);
            m_detectorSecond = MyScriptWrapper.GetDetector((uint)EntityID.DetectorSecond);
            m_detectorThird  = MyScriptWrapper.GetDetector((uint)EntityID.DetectorThird);
            m_detectorFirst.SetSensorDetectRigidBodyTypes(null);
            m_detectorSecond.SetSensorDetectRigidBodyTypes(null);
            m_detectorThird.SetSensorDetectRigidBodyTypes(null);

            m_madelyn = MyScriptWrapper.GetEntity("Madelyn");
            //Because she was hidden in previous mission
            MyScriptWrapper.UnhideEntity(m_madelyn);
            m_transporter = MyScriptWrapper.GetEntity((uint)EntityID.Transporter);
            m_transporter.OnContactEvent += new Action <MyEntity>(m_transporter_OnContactEvent);
            m_reassignBotTargets          = false;

            m_motherShipSpeed = MOTHERSHIP_FULLSPEED;

            MyScriptWrapper.PrepareMotherShipForMove(m_transporter);

            MyScriptWrapper.AddNotification(MyScriptWrapper.CreateNotification(Localization.MyTextsWrapperEnum.SwitchInHUBTurrets, MyGuiManager.GetFontMinerWarsGreen(), 60000,
                                                                               new object[] {
                MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_LEFT),
                MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.ROLL_RIGHT)
            }
                                                                               ));

            foreach (var item in m_spawnCompanions)
            {
                MyScriptWrapper.ActivateSpawnPoint(item);
            }

            var pos = MySession.PlayerShip.WorldMatrix.Translation;

            MySession.PlayerShip.WorldMatrix = m_transporter.WorldMatrix;
            Vector3 playerPos = m_transporter.WorldMatrix.Translation - 400 * m_transporter.WorldMatrix.Forward;

            MyScriptWrapper.Move(MySession.PlayerShip, playerPos);
            //MyScriptWrapper.EnablePhysics(MySession.PlayerShip.EntityId.Value.NumericValue, false);
            MyScriptWrapper.HideEntity(MySession.PlayerShip);

            m_towers[0] = MyScriptWrapper.GetEntity((uint)EntityID.Tower1);
            m_towers[1] = MyScriptWrapper.GetEntity((uint)EntityID.Tower2);
            m_towers[2] = MyScriptWrapper.GetEntity((uint)EntityID.Tower3);

            MyScriptWrapper.SetEntityPriority(m_towers[0], -1);
            MyScriptWrapper.SetEntityPriority(m_towers[1], -1);
            MyScriptWrapper.SetEntityPriority(m_towers[2], -1);
            MyScriptWrapper.SetEntityPriority(MyScriptWrapper.GetEntity((uint)EntityID.TowerDown), -1);

            MyScriptWrapper.TakeControlOfLargeWeapon(m_towers[m_activeTower]);
            MyScriptWrapper.ForbideDetaching();
            MyScriptWrapper.ApplyTransition(MyMusicTransitionEnum.Mystery);

            MyScriptWrapper.SwitchTowerPrevious    += MyScriptWrapper_SwitchTowerPrevious;
            MyScriptWrapper.SwitchTowerNext        += MyScriptWrapper_SwitchTowerNext;
            MyScriptWrapper.EntityDeath            += MyScriptWrapper_OnEntityDeath;
            MyScriptWrapper.OnSpawnpointBotSpawned += BotSpawned;

            m_objective01_flyTowardsMadelyn.OnMissionLoaded  += O01FlyTowardsMadelynLoaded;
            m_objective01_flyTowardsMadelyn.OnMissionSuccess += O01FlyTowardsMadelynSuccess;

            m_madelynDestinationReached     = false;
            m_transporterDestinationReached = false;
            m_moveMadelynFlag = false;

            m_towersCount   = 3;
            m_activeTower   = 0;
            m_switchCounter = 0;

            MyScriptWrapper.DrawHealthOfCustomPrefabInLargeWeapon(MyScriptWrapper.GetEntity((uint)EntityID.TransporterShip));
            MyScriptWrapper.DisableShipBackCamera();
            m_detectorFirst.OnEntityEnter += DetectorActionFirst;
            m_detectorFirst.On();

            MyScriptWrapper.OnDialogueFinished += MyScriptWrapper_OnDialogueFinished;
            base.Load();
        }
コード例 #24
0
        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));
            }
        }
コード例 #25
0
        public static StringBuilder GetAmmoSpecialText()
        {
            if (MySession.PlayerShip != null)
            {
                if (MySession.PlayerShip.IsSelectedRemoteCamera() && !MySession.PlayerShip.HasFiredRemoteBombs())
                {
                    return(new StringBuilder().AppendFormat(MyTextsWrapper.Get(MyTextsWrapperEnum.RemoteCameraRotate).ToString(), MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.CONTROL_SECONDARY_CAMERA)));
                }
            }

            return(null);
        }
コード例 #26
0
        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);
        }
コード例 #27
0
 public ControlWithDescription(StringBuilder controlString, MyGameControlEnums control) : this(controlString, MyTextsWrapper.Get(MyGuiManager.GetInput().GetGameControl(control).GetControlName()))
 {
 }
コード例 #28
0
 public ControlWithDescription(MyGameControlEnums control, StringBuilder descriptionString) : this(new StringBuilder(MyGuiManager.GetInput().GetGameControlTextEnum(control)), descriptionString)
 {
 }
コード例 #29
0
        public MyGuiScreenHelp()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(1f, 0.98f))
        {
            m_enableBackgroundFade = true;

            AddCaption(MyTextsWrapperEnum.HelpCaption, captionScale: 1.35f);

            if (MyGuiScreenGamePlay.Static != null)
            {
                MyGuiScreenGamePlay.Static.DrawHud = false;
            }

            List <ControlWithDescription> left  = new List <ControlWithDescription>();
            List <ControlWithDescription> right = new List <ControlWithDescription>();

//            left.Add(new ControlWithDescription(MyGameControlEnums.FORWARD, MyGameControlEnums.REVERSE));
//            left.Add(new ControlWithDescription(MyGameControlEnums.STRAFE_LEFT, MyGameControlEnums.STRAFE_RIGHT));
//            left.Add(new ControlWithDescription(MyGameControlEnums.UP_THRUST, MyGameControlEnums.DOWN_THRUST));
//            left.Add(new ControlWithDescription(MyGameControlEnums.ROLL_LEFT, MyGameControlEnums.ROLL_RIGHT));
            left.Add(new ControlWithDescription(MyGameControlEnums.FORWARD));
            left.Add(new ControlWithDescription(MyGameControlEnums.REVERSE));
            left.Add(new ControlWithDescription(MyGameControlEnums.STRAFE_LEFT));
            left.Add(new ControlWithDescription(MyGameControlEnums.STRAFE_RIGHT));
            left.Add(new ControlWithDescription(MyGameControlEnums.UP_THRUST));
            left.Add(new ControlWithDescription(MyGameControlEnums.DOWN_THRUST));
            left.Add(new ControlWithDescription(MyGameControlEnums.ROLL_LEFT));
            left.Add(new ControlWithDescription(MyGameControlEnums.ROLL_RIGHT));
            left.Add(new ControlWithDescription(MyGameControlEnums.AFTERBURNER));
            left.Add(new ControlWithDescription(MyGameControlEnums.MOVEMENT_SLOWDOWN));
            left.Add(new ControlWithDescription(MyGameControlEnums.AUTO_LEVEL));

            left.Add(new ControlWithDescription("", ""));

            left.Add(new ControlWithDescription(
                         new StringBuilder().
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.FIRE_PRIMARY)).
                         Append(", ").
                         Append(MyGuiManager.GetInput().GetGameControl(MyGameControlEnums.FIRE_PRIMARY).GetControlButtonName(MyGuiInputDeviceEnum.Mouse)),
                         MyGameControlEnums.FIRE_PRIMARY
                         ));
            left.Add(new ControlWithDescription(
                         new StringBuilder().
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.FIRE_SECONDARY)).
                         Append(", ").
                         Append(MyGuiManager.GetInput().GetGameControl(MyGameControlEnums.FIRE_SECONDARY).GetControlButtonName(MyGuiInputDeviceEnum.Mouse)),
                         MyGameControlEnums.FIRE_SECONDARY
                         ));
            left.Add(new ControlWithDescription(
                         new StringBuilder().
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.SELECT_AMMO_BULLET)).
                         Append(",").
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.SELECT_AMMO_MISSILE)).
                         Append(",").
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.SELECT_AMMO_CANNON)).
                         Append(",").
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_FRONT)).
                         Append(",").
                         Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_BACK)),
                         MyTextsWrapper.Get(MyTextsWrapperEnum.SelectAmmo)
                         ));
            left.Add(new ControlWithDescription(MyGameControlEnums.WEAPON_SPECIAL));
            left.Add(new ControlWithDescription(MyGameControlEnums.PREV_TARGET));
            left.Add(new ControlWithDescription(MyGameControlEnums.NEXT_TARGET));

            for (int i = 0; i < specTexts.Length; i++)
            {
                StringBuilder specControl = new StringBuilder();
                if (MyGuiManager.GetInput().GetGameControl(specFront[i]).IsControlAssigned(MyGuiInputDeviceEnum.Keyboard))
                {
                    specControl.Append(MyGuiManager.GetInput().GetGameControlTextEnum(specFront[i]));
                }
                if (MyGuiManager.GetInput().GetGameControl(specBack[i]).IsControlAssigned(MyGuiInputDeviceEnum.Keyboard))
                {
                    if (specControl.Length != 0)
                    {
                        specControl.Append(", ");
                    }
                    specControl.Append(MyGuiManager.GetInput().GetGameControlTextEnum(specBack[i]));
                }
                left.Add(new ControlWithDescription(specControl, MyTextsWrapper.Get(specTexts[i])));
            }

            left.Add(new ControlWithDescription("", ""));

            left.Add(new ControlWithDescription(MyGameControlEnums.USE));
            left.Add(new ControlWithDescription(MyGameControlEnums.GPS));
            //Journal removed
            //left.Add(new ControlWithDescription(MyGameControlEnums.MISSION_DIALOG));
            left.Add(new ControlWithDescription(MyGameControlEnums.INVENTORY));
            left.Add(new ControlWithDescription(MyGameControlEnums.TRAVEL));

            right.Add(new ControlWithDescription(MyGameControlEnums.DRILL));
            right.Add(new ControlWithDescription(MyGameControlEnums.HARVEST));
            right.Add(new ControlWithDescription(MyGameControlEnums.DRONE_DEPLOY));
            right.Add(new ControlWithDescription(MyGameControlEnums.DRONE_CONTROL));
            right.Add(new ControlWithDescription(MyGameControlEnums.CHANGE_DRONE_MODE));
            right.Add(new ControlWithDescription(MyTextsWrapper.Get(MyTextsWrapperEnum.LeftMouseButton), MyTextsWrapper.Get(MyTextsWrapperEnum.DetonateDrone)));
            right.Add(new ControlWithDescription(
                          new StringBuilder().
                          Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.PREVIOUS_CAMERA)).
                          Append(", ").
                          Append(MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.NEXT_CAMERA)),
                          MyTextsWrapper.Get(MyTextsWrapperEnum.CycleSecondaryCamera)
                          ));
            right.Add(new ControlWithDescription(MyGameControlEnums.CONTROL_SECONDARY_CAMERA));

            right.Add(new ControlWithDescription("", ""));

            right.Add(new ControlWithDescription(MyGameControlEnums.QUICK_ZOOM));
            right.Add(new ControlWithDescription(MyGameControlEnums.ZOOM_IN, MyGameControlEnums.ZOOM_OUT));
            right.Add(new ControlWithDescription(MyGameControlEnums.REAR_CAM));
            right.Add(new ControlWithDescription(MyGameControlEnums.HEADLIGHTS));
            right.Add(new ControlWithDescription(MyGameControlEnums.HEADLIGTHS_DISTANCE));
            right.Add(new ControlWithDescription(MyGameControlEnums.VIEW_MODE));
            right.Add(new ControlWithDescription(MyGameControlEnums.WHEEL_CONTROL));
            right.Add(new ControlWithDescription(MyGameControlEnums.CHAT));
            right.Add(new ControlWithDescription(MyGameControlEnums.SCORE));

            right.Add(new ControlWithDescription("", ""));

            right.Add(new ControlWithDescription(new StringBuilder("F1"), MyTextsWrapper.Get(MyTextsWrapperEnum.OpenHelpScreen)));
            right.Add(new ControlWithDescription(
                          new StringBuilder().
                          Append(MyTextsWrapper.Get(MyTextsWrapperEnum.Ctrl)).
                          Append("+F1"),
                          MyTextsWrapper.Get(MyTextsWrapperEnum.OpenCheats)
                          ));
            right.Add(new ControlWithDescription(new StringBuilder("F4"), MyTextsWrapper.Get(MyTextsWrapperEnum.SaveScreenshotToUserFolder)));

            //These keys are to be used just for developers or testing
            if (!SysUtils.MyMwcFinalBuildConstants.IS_PUBLIC)
            {
                right.Add(new ControlWithDescription("", ""));
                //Programmers
                right.Add(new ControlWithDescription("F6", "Switch to player"));
                right.Add(new ControlWithDescription("F7", "Switch to following 3rd person"));
                right.Add(new ControlWithDescription("F9", "Switch to static 3rd person"));
                right.Add(new ControlWithDescription("F8, Ctrl+F8", "Switch to / reset spectator"));
                right.Add(new ControlWithDescription("Ctrl+Space", "Move ship to spectator"));
                right.Add(new ControlWithDescription("F11, Shift+F11", "Game statistics / FPS"));
                right.Add(new ControlWithDescription("F12", "Debug screen (jump to mission)"));
                right.Add(new ControlWithDescription("Ctrl+Del", "Skip current objective"));
                right.Add(new ControlWithDescription("Shift+\\", "Teleport to next obstacle"));
            }

            /*
             * right.Add(new ControlWithDescription("F5","Ship customization screen"));
             * right.Add(new ControlWithDescription("F9","restart current game and reload sounds"));
             * right.Add(new ControlWithDescription("F3","start sun wind"));
             * right.Add(new ControlWithDescription("F8","save all voxel maps into USER FOLDER - only for programmers"));
             * right.Add(new ControlWithDescription("F10","switch camera - only for programmers"));
             * right.Add(new ControlWithDescription("F11","save screenshot(s) into USER FOLDER"));
             * right.Add(new ControlWithDescription("F12","cycle through debug screens - only for programmers"));
             */

#if RENDER_PROFILING
            right.Add(new ControlWithDescription("Alt + Num0", "Enable/Disable render profiler or leave current child node."));
            right.Add(new ControlWithDescription("Alt + Num1-Num9", "Enter child node in render profiler"));
            right.Add(new ControlWithDescription("Alt + Enter", "Pause/Unpause profiler"));
#endif //RENDER_PROFILER

            Vector2 controlPosition     = -m_size.Value / 2.0f + new Vector2(0.06f, 0.125f);
            Vector2 descriptionPosition = -m_size.Value / 2.0f + new Vector2(0.18f, 0.125f);
            foreach (var line in left)
            {
                Controls.Add(new MyGuiControlLabel(this, controlPosition, null, line.Control, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsRed()));
                Controls.Add(new MyGuiControlLabel(this, descriptionPosition, null, line.Description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                controlPosition.Y     += 0.023f;
                descriptionPosition.Y += 0.023f;
            }

            controlPosition     = new Vector2(0.03f, 0.125f - m_size.Value.Y / 2.0f);
            descriptionPosition = new Vector2(0.15f, 0.125f - m_size.Value.Y / 2.0f);

            foreach (var line in right)
            {
                Controls.Add(new MyGuiControlLabel(this, controlPosition, null, line.Control, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsRed()));
                Controls.Add(new MyGuiControlLabel(this, descriptionPosition, null, line.Description, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                controlPosition.Y     += 0.023f;
                descriptionPosition.Y += 0.023f;
            }

            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.06f - m_size.Value.X / 2.0f, -0.085f + m_size.Value.Y / 2.0f), null, new StringBuilder().Append(MyTextsWrapper.Get(MyTextsWrapperEnum.UserFolder)).Append(": ").Append(MyFileSystemUtils.GetApplicationUserDataFolder()), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            Controls.Add(new MyGuiControlButton(this, 0.5f * m_size.Value + new Vector2(-0.14f, -0.085f), MyGuiConstants.BACK_BUTTON_SIZE,
                                                MyGuiConstants.BACK_BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Back, MyGuiConstants.BACK_BUTTON_TEXT_COLOR,
                                                MyGuiConstants.BACK_BUTTON_TEXT_SCALE, OnBackClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            if (MyMultiplayerPeers.Static.Players.Count == 0)
            {
                m_wasPause = MyMinerGame.IsPaused();
                MyMinerGame.SetPause(true);
            }
        }
コード例 #30
0
        public void SetTexts()
        {
            MyMwcUtils.ClearStringBuilder(m_debugText);

            var joy = MyGuiManager.GetInput().GetActualJoystickState();

            if (joy == null)
            {
                m_debugText.Append("No joystick detected.");
                return;
            }

            m_debugText.Append("Supported axes: ");
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.Xpos))
            {
                m_debugText.Append("X ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.Ypos))
            {
                m_debugText.Append("Y ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.Zpos))
            {
                m_debugText.Append("Z ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.RotationXpos))
            {
                m_debugText.Append("Rx ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.RotationYpos))
            {
                m_debugText.Append("Ry ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.RotationZpos))
            {
                m_debugText.Append("Rz ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.Slider1pos))
            {
                m_debugText.Append("S1 ");
            }
            if (MyGuiManager.GetInput().IsJoystickAxisSupported(MyJoystickAxesEnum.Slider2pos))
            {
                m_debugText.Append("S2 ");
            }
            m_debugText.AppendLine();

            m_debugText.Append("accX: "); m_debugText.AppendInt32(joy.AccelerationX); m_debugText.AppendLine();
            m_debugText.Append("accY: "); m_debugText.AppendInt32(joy.AccelerationY); m_debugText.AppendLine();
            m_debugText.Append("accZ: "); m_debugText.AppendInt32(joy.AccelerationZ); m_debugText.AppendLine();
            m_debugText.Append("angAccX: "); m_debugText.AppendInt32(joy.AngularAccelerationX); m_debugText.AppendLine();
            m_debugText.Append("angAccY: "); m_debugText.AppendInt32(joy.AngularAccelerationY); m_debugText.AppendLine();
            m_debugText.Append("angAccZ: "); m_debugText.AppendInt32(joy.AngularAccelerationZ); m_debugText.AppendLine();
            m_debugText.Append("angVelX: "); m_debugText.AppendInt32(joy.AngularVelocityX); m_debugText.AppendLine();
            m_debugText.Append("angVelY: "); m_debugText.AppendInt32(joy.AngularVelocityY); m_debugText.AppendLine();
            m_debugText.Append("angVelZ: "); m_debugText.AppendInt32(joy.AngularVelocityZ); m_debugText.AppendLine();
            m_debugText.Append("forX: "); m_debugText.AppendInt32(joy.ForceX); m_debugText.AppendLine();
            m_debugText.Append("forY: "); m_debugText.AppendInt32(joy.ForceY); m_debugText.AppendLine();
            m_debugText.Append("forZ: "); m_debugText.AppendInt32(joy.ForceZ); m_debugText.AppendLine();
            m_debugText.Append("rotX: "); m_debugText.AppendInt32(joy.RotationX); m_debugText.AppendLine();
            m_debugText.Append("rotY: "); m_debugText.AppendInt32(joy.RotationY); m_debugText.AppendLine();
            m_debugText.Append("rotZ: "); m_debugText.AppendInt32(joy.RotationZ); m_debugText.AppendLine();
            m_debugText.Append("torqX: "); m_debugText.AppendInt32(joy.TorqueX); m_debugText.AppendLine();
            m_debugText.Append("torqY: "); m_debugText.AppendInt32(joy.TorqueY); m_debugText.AppendLine();
            m_debugText.Append("torqZ: "); m_debugText.AppendInt32(joy.TorqueZ); m_debugText.AppendLine();
            m_debugText.Append("velX: "); m_debugText.AppendInt32(joy.VelocityX); m_debugText.AppendLine();
            m_debugText.Append("velY: "); m_debugText.AppendInt32(joy.VelocityY); m_debugText.AppendLine();
            m_debugText.Append("velZ: "); m_debugText.AppendInt32(joy.VelocityZ); m_debugText.AppendLine();
            m_debugText.Append("X: "); m_debugText.AppendInt32(joy.X); m_debugText.AppendLine();
            m_debugText.Append("Y: "); m_debugText.AppendInt32(joy.Y); m_debugText.AppendLine();
            m_debugText.Append("Z: "); m_debugText.AppendInt32(joy.Z); m_debugText.AppendLine();
            m_debugText.AppendLine();
            m_debugText.Append("AccSliders: "); foreach (var i in joy.AccelerationSliders)
            {
                m_debugText.AppendInt32(i); m_debugText.Append(" ");
            }
            m_debugText.AppendLine();
            m_debugText.Append("Buttons: "); foreach (var i in joy.Buttons)
            {
                m_debugText.Append(i ? "#" : "_"); m_debugText.Append(" ");
            }
            m_debugText.AppendLine();
            m_debugText.Append("ForSliders: "); foreach (var i in joy.ForceSliders)
            {
                m_debugText.AppendInt32(i); m_debugText.Append(" ");
            }
            m_debugText.AppendLine();
            m_debugText.Append("POVControllers: "); foreach (var i in joy.PointOfViewControllers)
            {
                m_debugText.AppendInt32(i); m_debugText.Append(" ");
            }
            m_debugText.AppendLine();
            m_debugText.Append("Sliders: "); foreach (var i in joy.Sliders)
            {
                m_debugText.AppendInt32(i); m_debugText.Append(" ");
            }
            m_debugText.AppendLine();
            m_debugText.Append("VelocitySliders: "); foreach (var i in joy.VelocitySliders)
            {
                m_debugText.AppendInt32(i); m_debugText.Append(" ");
            }
            m_debugText.AppendLine();
        }