MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
        {
            switch (actionEnum)
            {
            case UseActionEnum.Manipulate:
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToRechargeInMedicalRoom,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE) },
                    IsTextControlHint = true,
                    JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
                });

            case UseActionEnum.OpenTerminal:
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenTerminal,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) },
                    IsTextControlHint = true,
                    JoystickText = MySpaceTexts.NotificationHintJoystickPressToOpenTerminal,
                });

            default:
                Debug.Fail("Invalid branch reached.");
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenTerminal,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) },
                    IsTextControlHint = true
                });
            }
        }
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            m_buttonPanel.Toolbar.UpdateItem(m_index);
            var slot = m_buttonPanel.Toolbar.GetItemAtIndex(m_index);

            switch (actionEnum)
            {
            case UseActionEnum.Manipulate:

                if (m_buttonDesc == null)
                {
                    m_buttonDesc = new MyGps();

                    m_buttonDesc.Description = "";
                    m_buttonDesc.Coords      = ActivationMatrix.Translation;
                    m_buttonDesc.ShowOnHud   = true;
                    m_buttonDesc.DiscardAt   = null;
                }

                MyHud.ButtonPanelMarkers.RegisterMarker(m_buttonDesc);

                SetButtonName(m_buttonPanel.GetCustomButtonName(m_index));

                if (slot != null)
                {
                    return(new MyActionDescription()
                    {
                        Text = MyCommonTexts.NotificationHintPressToUse,
                        FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE), slot.DisplayName },
                        IsTextControlHint = true,
                        JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE), slot.DisplayName },
                    });
                }
                else
                {
                    return(new MyActionDescription()
                    {
                        Text = MySpaceTexts.Blank
                    });
                }

            case UseActionEnum.OpenTerminal:
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenButtonPanel,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) },
                    IsTextControlHint = true,
                    JoystickText = MySpaceTexts.NotificationHintJoystickPressToOpenButtonPanel,
                });

            default:
                Debug.Fail("Invalid branch reached.");
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenButtonPanel,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) },
                    IsTextControlHint = true
                });
            }
        }
Beispiel #3
0
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            MyActionDescription description;

            if (actionEnum == UseActionEnum.Manipulate)
            {
                description = new MyActionDescription {
                    Text = MySpaceTexts.NotificationHintPressToOpenDoor
                };
                description.FormatParams         = new object[] { "[" + MyInput.Static.GetGameControl(MyControlsSpace.USE) + "]", this.Door.DefinitionDisplayNameText };
                description.IsTextControlHint    = true;
                description.JoystickFormatParams = new object[] { "[" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE).ToString() + "]", this.Door.DefinitionDisplayNameText };
                return(description);
            }
            if (actionEnum != UseActionEnum.OpenTerminal)
            {
                description = new MyActionDescription {
                    Text = MySpaceTexts.NotificationHintPressToOpenControlPanel
                };
                description.FormatParams      = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL), this.Door.DefinitionDisplayNameText };
                description.IsTextControlHint = true;
                return(description);
            }
            description = new MyActionDescription {
                Text = MySpaceTexts.NotificationHintPressToOpenControlPanel
            };
            description.FormatParams         = new object[] { "[" + MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) + "]", this.Door.DefinitionDisplayNameText };
            description.IsTextControlHint    = true;
            description.JoystickText         = new MyStringId?(MySpaceTexts.NotificationHintJoystickPressToOpenControlPanel);
            description.JoystickFormatParams = new object[] { this.Door.DefinitionDisplayNameText };
            return(description);
        }
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            switch (actionEnum)
            {
            case UseActionEnum.Manipulate:
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenDoor,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE) },
                    IsTextControlHint = true,
                    JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
                });

            case UseActionEnum.OpenTerminal:
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenControlPanel,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL), Door.DefinitionDisplayNameText },
                    IsTextControlHint = true,
                    JoystickText = MySpaceTexts.NotificationHintJoystickPressToOpenControlPanel,
                    JoystickFormatParams = new object[] { Door.DefinitionDisplayNameText },
                });

            default:
                Debug.Fail("Invalid branch reached.");
                return(new MyActionDescription()
                {
                    Text = MySpaceTexts.NotificationHintPressToOpenControlPanel,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL), Door.DefinitionDisplayNameText },
                    IsTextControlHint = true
                });
            }
        }
        MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
        {
            string key = "";

            switch (actionEnum)
            {
            case UseActionEnum.PickUp:
                key = MyInput.Static.GetGameControl(MyControlsSpace.PICK_UP).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                return(new MyActionDescription()
                {
                    Text = MyCommonTexts.NotificationPickupObject,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.PICK_UP), m_displayedText },
                    IsTextControlHint = false,
                    JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PICK_UP), m_displayedText },
                });

            case UseActionEnum.Manipulate:
                key = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                return(new MyActionDescription()
                {
                    Text = MyCommonTexts.NotificationPickupObject,
                    FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE), m_displayedText },
                    IsTextControlHint = false,
                    JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE), m_displayedText },
                });

            default:
                return(new MyActionDescription());
            }
        }
 MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
 {
     return(new MyActionDescription()
     {
         Text = MySpaceTexts.NotificationHintPressToEnterCockpit,
         FormatParams = new object[] { MyGuiSandbox.GetKeyName(MyControlsSpace.USE) },
         IsTextControlHint = true,
         JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
     });
 }
Beispiel #7
0
 MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
 {
     return(new MyActionDescription()
     {
         Text = MySpaceTexts.NotificationHintPressToUseWardrobe,
         FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE) },
         IsTextControlHint = true,
         JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
     });
 }
Beispiel #8
0
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            MyActionDescription description = new MyActionDescription {
                Text = MySpaceTexts.NotificationHintPressToEnterCockpit
            };

            description.FormatParams         = new object[] { "[" + MyGuiSandbox.GetKeyName(MyControlsSpace.USE) + "]", ((VRage.Game.Entity.MyEntity) this.Cockpit).DisplayNameText };
            description.IsTextControlHint    = true;
            description.JoystickFormatParams = new object[] { "]" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE).ToString() + "]", ((VRage.Game.Entity.MyEntity) this.Cockpit).DisplayNameText };
            return(description);
        }
Beispiel #9
0
        public override MyActionDescription GetActionInfo(UseActionEnum actionEnum)
        {
            MyActionDescription description = new MyActionDescription {
                Text = MySpaceTexts.NotificationHintPressToGetOnLadder
            };

            description.FormatParams         = new object[] { "[" + MyGuiSandbox.GetKeyName(MyControlsSpace.USE) + "]" };
            description.IsTextControlHint    = true;
            description.JoystickFormatParams = new object[] { "[" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE).ToString() + "]" };
            return(description);
        }
 protected override void AddHudInfo()
 {
     if (!MyInput.Static.IsJoystickConnected())
     {
         m_grindingNotification.SetTextFormatArguments(MyInput.Static.GetGameControl(MyControlsSpace.PRIMARY_TOOL_ACTION));
     }
     else
     {
         m_grindingNotification.SetTextFormatArguments(MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PRIMARY_TOOL_ACTION));
     }
     MyHud.Notifications.Add(m_grindingNotification);
 }
        MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
        {
            var key = MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);

            return(new MyActionDescription()
            {
                Text = MySpaceTexts.NotificationPickupObject,
                FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE), m_displayedText },
                IsTextControlHint = false,
                JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE), m_displayedText },
            });
        }
Beispiel #12
0
        private void FormatNotifications(bool forJoystick)
        {
            if (forJoystick)
            {
                var cx_base = MySpaceBindingCreator.CX_BASE;
                var cx_char = MySpaceBindingCreator.CX_CHARACTER;

                var controlMenuCode = MyControllerHelper.GetCodeForControl(cx_base, MyControlsSpace.CONTROL_MENU);
                var nextItemCode    = MyControllerHelper.GetCodeForControl(cx_char, MyControlsSpace.TOOLBAR_NEXT_ITEM);
                var prevItemCode    = MyControllerHelper.GetCodeForControl(cx_char, MyControlsSpace.TOOLBAR_PREV_ITEM);

                Remove(MyNotificationSingletons.HudHideHint);
                if (MyPerGameSettings.Game == GameEnum.ME_GAME)
                {
                    Remove(MyNotificationSingletons.GameplayOptions);
                }

                SetNotificationTextAndArgs(MyNotificationSingletons.HelpHint, MySpaceTexts.NotificationJoystickControlMenuFormat, controlMenuCode);
                SetNotificationTextAndArgs(MyNotificationSingletons.ScreenHint, MySpaceTexts.NotificationJoystickMenus);
                SetNotificationTextAndArgs(MyNotificationSingletons.SlotEquipHint, MySpaceTexts.NotificationJoystickSlotEquipFormat, prevItemCode, nextItemCode);
            }
            else
            {
                var hud            = MyInput.Static.GetGameControl(MyControlsSpace.TOGGLE_HUD);
                var slot1          = MyInput.Static.GetGameControl(MyControlsSpace.SLOT1);
                var slot2          = MyInput.Static.GetGameControl(MyControlsSpace.SLOT2);
                var slot3          = MyInput.Static.GetGameControl(MyControlsSpace.SLOT3);
                var buildScreen    = MyInput.Static.GetGameControl(MyControlsSpace.BUILD_SCREEN);
                var help           = MyInput.Static.GetGameControl(MyControlsSpace.HELP_SCREEN);
                var compoundToggle = MyInput.Static.GetGameControl(MyControlsSpace.SWITCH_COMPOUND);

                Add(MyNotificationSingletons.HudHideHint);
                if (MyPerGameSettings.Game == GameEnum.ME_GAME)
                {
                    Add(MyNotificationSingletons.GameplayOptions);
                    SetNotificationTextAndArgs(MyNotificationSingletons.GameplayOptions, MySpaceTexts.Notification_GameplayOptions, MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL));
                }

                SetNotificationTextAndArgs(MyNotificationSingletons.HelpHint, MySpaceTexts.NotificationNeedShowHelpScreen, help);
                SetNotificationTextAndArgs(MyNotificationSingletons.ScreenHint, MySpaceTexts.NotificationScreenFormat, buildScreen);
                SetNotificationTextAndArgs(MyNotificationSingletons.HudHideHint, MySpaceTexts.NotificationHudHideFormat, hud);
                SetNotificationTextAndArgs(MyNotificationSingletons.SlotEquipHint, MySpaceTexts.NotificationSlotEquipFormat, slot1, slot2, slot3);
            }
        }
Beispiel #13
0
        MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
        {
            MyActionDescription description;

            if (!MySandboxGame.Config.ControlsHints)
            {
                description = new MyActionDescription {
                    Text = MyCommonTexts.CustomText,
                    IsTextControlHint = false
                };
                description.FormatParams = new object[] { this.m_displayedText };
                return(description);
            }
            if (actionEnum == UseActionEnum.Manipulate)
            {
                MyInput.Static.GetGameControl(MyControlsSpace.USE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                description = new MyActionDescription {
                    Text = MyCommonTexts.NotificationPickupObject
                };
                description.FormatParams         = new object[] { "[" + MyInput.Static.GetGameControl(MyControlsSpace.USE) + "]", this.m_displayedText };
                description.IsTextControlHint    = true;
                description.JoystickFormatParams = new object[] { "[" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE).ToString() + "]", this.m_displayedText };
                return(description);
            }
            if (actionEnum != UseActionEnum.PickUp)
            {
                return(new MyActionDescription());
            }
            MyInput.Static.GetGameControl(MyControlsSpace.PICK_UP).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
            description = new MyActionDescription {
                Text = MyCommonTexts.NotificationPickupObject
            };
            description.FormatParams         = new object[] { "[" + MyInput.Static.GetGameControl(MyControlsSpace.PICK_UP) + "]", this.m_displayedText };
            description.IsTextControlHint    = true;
            description.JoystickFormatParams = new object[] { "[" + MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.PICK_UP).ToString() + "]", this.m_displayedText };
            return(description);
        }
        public void CalculateRotationHints(MatrixD drawMatrix, BoundingBoxD worldBox, bool draw, bool fixedAxes = false, bool hideForwardAndUpArrows = false)
        {
            drawMatrix.Translation = Vector3D.Zero;
            MatrixD drawInverse = MatrixD.Invert(drawMatrix);

            drawInverse *= drawMatrix.GetOrientation();
            drawInverse *= MySector.MainCamera.ViewMatrixAtZero;

            MatrixD camWorld = MatrixD.Invert(drawInverse);

            m_viewProjection.ViewAtZero             = MatrixD.CreateLookAt(Vector3D.Zero, camWorld.Forward, camWorld.Up);
            m_viewProjection.ViewAtZero.Translation = new Vector3D(0, 0, -6);
            m_viewProjection.View              = drawInverse;
            m_viewProjection.View.Translation += new Vector3D(0, 0, -10);
            m_viewProjection.CameraPosition    = camWorld.Translation;

            Vector2 screenSize = MyGuiManager.GetScreenSizeFromNormalizedSize(Vector2.One);
            float   previewRatio = 2.5f;
            int     hintsWidth = (int)(screenSize.X / previewRatio), hintsHeight = (int)(screenSize.Y / previewRatio), hintsXOffset = 0, hintsYOffset = 0;

            m_viewProjection.Viewport = new MyViewport(
                (int)MySector.MainCamera.Viewport.Width - hintsWidth - hintsXOffset,
                hintsYOffset,
                hintsWidth,
                hintsHeight);

            m_viewProjection.DepthRead  = false;
            m_viewProjection.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)hintsHeight / hintsWidth, 0.1f, 10);



            worldBox = new BoundingBoxD(-new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large) * 0.5f), new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large)) * 0.5f);


            //m_rotationHintsViewProjection.Projection = MySector.MainCamera.ProjectionMatrix;



            int projectionId = 0;

            VRageRender.MyRenderProxy.AddBillboardViewProjection(projectionId, m_viewProjection);

            //MySimpleObjectDraw.DrawTransparentBox(ref drawMatrix,
            //                ref worldBox, ref Vector4.One, MySimpleObjectRasterizer.Wireframe, 1, 0.04f, null, null, false, 0);
            if (draw)
            {
                var white = Color.White;
                MySimpleObjectDraw.DrawTransparentBox(ref drawMatrix,
                                                      ref worldBox, ref white, MySimpleObjectRasterizer.Solid, 1, 0.04f, "SquareFullColor", null, false, projectionId, 100);
            }

            MyOrientedBoundingBoxD rotateHintsBox = new MyOrientedBoundingBoxD(Vector3D.Transform(worldBox.Center, drawMatrix), worldBox.HalfExtents, Quaternion.CreateFromRotationMatrix(drawMatrix));

            //VRageRender.MyRenderProxy.DebugDrawOBB(rotateHintsBox, Vector3.One, 1, false, false);


            rotateHintsBox.GetCorners(m_cubeVertices, 0);

            //for (int vi = 0; vi < 8; vi++)
            //{
            //    VRageRender.MyRenderProxy.DebugDrawText3D(m_cubeVertices[vi], vi.ToString(), Color.White, 0.7f, false);
            //}

            //for (int vi = 0; vi < 4; vi++)
            //{
            //    VRageRender.MyRenderProxy.DebugDrawText3D((m_cubeVertices[MyOrientedBoundingBox.StartXVertices[vi]] + m_cubeVertices[MyOrientedBoundingBox.EndXVertices[vi]]) * 0.5f, vi.ToString(), Color.Red, 0.7f, false);
            //    VRageRender.MyRenderProxy.DebugDrawText3D((m_cubeVertices[MyOrientedBoundingBox.StartYVertices[vi]] + m_cubeVertices[MyOrientedBoundingBox.EndYVertices[vi]]) * 0.5f, vi.ToString(), Color.Green, 0.7f, false);
            //    VRageRender.MyRenderProxy.DebugDrawText3D((m_cubeVertices[MyOrientedBoundingBox.StartZVertices[vi]] + m_cubeVertices[MyOrientedBoundingBox.EndZVertices[vi]]) * 0.5f, vi.ToString(), Color.Blue, 0.7f, false);
            //}

            int closestXAxis, closestXAxis2;

            GetClosestCubeEdge(m_cubeVertices, MyOrientedBoundingBox.StartXVertices, MyOrientedBoundingBox.EndXVertices, out closestXAxis, out closestXAxis2);
            Vector3D startXVertex  = m_cubeVertices[MyOrientedBoundingBox.StartXVertices[closestXAxis]];
            Vector3D endXVertex    = m_cubeVertices[MyOrientedBoundingBox.EndXVertices[closestXAxis]];
            Vector3D startXVertex2 = m_cubeVertices[MyOrientedBoundingBox.StartXVertices[closestXAxis2]];
            Vector3D endXVertex2   = m_cubeVertices[MyOrientedBoundingBox.EndXVertices[closestXAxis2]];

            int closestYAxis, closestYAxis2;

            GetClosestCubeEdge(m_cubeVertices, MyOrientedBoundingBox.StartYVertices, MyOrientedBoundingBox.EndYVertices, out closestYAxis, out closestYAxis2);
            Vector3D startYVertex  = m_cubeVertices[MyOrientedBoundingBox.StartYVertices[closestYAxis]];
            Vector3D endYVertex    = m_cubeVertices[MyOrientedBoundingBox.EndYVertices[closestYAxis]];
            Vector3D startYVertex2 = m_cubeVertices[MyOrientedBoundingBox.StartYVertices[closestYAxis2]];
            Vector3D endYVertex2   = m_cubeVertices[MyOrientedBoundingBox.EndYVertices[closestYAxis2]];

            int closestZAxis, closestZAxis2;

            GetClosestCubeEdge(m_cubeVertices, MyOrientedBoundingBox.StartZVertices, MyOrientedBoundingBox.EndZVertices, out closestZAxis, out closestZAxis2);
            Vector3D startZVertex  = m_cubeVertices[MyOrientedBoundingBox.StartZVertices[closestZAxis]];
            Vector3D endZVertex    = m_cubeVertices[MyOrientedBoundingBox.EndZVertices[closestZAxis]];
            Vector3D startZVertex2 = m_cubeVertices[MyOrientedBoundingBox.StartZVertices[closestZAxis2]];
            Vector3D endZVertex2   = m_cubeVertices[MyOrientedBoundingBox.EndZVertices[closestZAxis2]];

            m_cubeEdges.Clear();
            m_cubeEdges.Add(new BoxEdge()
            {
                Axis = 0, Edge = new LineD(startXVertex, endXVertex)
            });
            m_cubeEdges.Add(new BoxEdge()
            {
                Axis = 1, Edge = new LineD(startYVertex, endYVertex)
            });
            m_cubeEdges.Add(new BoxEdge()
            {
                Axis = 2, Edge = new LineD(startZVertex, endZVertex)
            });

            if (!fixedAxes)
            {
                int rotDirection;

                RotationRightAxis      = GetBestAxis(m_cubeEdges, MySector.MainCamera.WorldMatrix.Right, out rotDirection);
                RotationRightDirection = rotDirection;

                RotationUpAxis      = GetBestAxis(m_cubeEdges, MySector.MainCamera.WorldMatrix.Up, out rotDirection);
                RotationUpDirection = rotDirection;

                RotationForwardAxis      = GetBestAxis(m_cubeEdges, MySector.MainCamera.WorldMatrix.Forward, out rotDirection);
                RotationForwardDirection = rotDirection;
            }

            string rightControlName1 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard).ToString();
            string rightControlName2 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard).ToString();
            string upControlName1    = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard).ToString();
            string upControlName2    = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard).ToString();
            string forwControlName1  = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard).ToString();
            string forwControlName2  = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard).ToString();

            if (MyInput.Static.IsJoystickConnected())
            {
                rightControlName1 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE).ToString();
                rightControlName2 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE).ToString();
                upControlName1    = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE).ToString();
                upControlName2    = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE).ToString();
                forwControlName1  = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE).ToString();
                forwControlName2  = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE).ToString();
            }

            Vector3D rightStart = Vector3D.Zero;
            Vector3D rightEnd = Vector3D.Zero;
            Vector3D upStart = Vector3D.Zero;
            Vector3D upEnd = Vector3D.Zero;
            Vector3D forwStart = Vector3D.Zero;
            Vector3D forwEnd = Vector3D.Zero;
            Vector3D rightStart2 = Vector3D.Zero;
            Vector3D rightEnd2 = Vector3D.Zero;
            Vector3D upStart2 = Vector3D.Zero;
            Vector3D upEnd2 = Vector3D.Zero;
            Vector3D forwStart2 = Vector3D.Zero;
            Vector3D forwEnd2 = Vector3D.Zero;
            int      rightAxis = -1, upAxis = -1, forwAxis = -1;
            int      closestRightEdge = -1, closestUpEdge = -1, closestForwEdge = -1;
            int      closestRightEdge2 = -1, closestUpEdge2 = -1, closestForwEdge2 = -1;

            if (RotationRightAxis == 0)
            {
                rightStart        = startXVertex;
                rightEnd          = endXVertex;
                rightStart2       = startXVertex2;
                rightEnd2         = endXVertex2;
                rightAxis         = 0;
                closestRightEdge  = closestXAxis;
                closestRightEdge2 = closestXAxis2;
            }
            else
            if (RotationRightAxis == 1)
            {
                rightStart        = startYVertex;
                rightEnd          = endYVertex;
                rightStart2       = startYVertex2;
                rightEnd2         = endYVertex2;
                rightAxis         = 1;
                closestRightEdge  = closestYAxis;
                closestRightEdge2 = closestYAxis2;
            }
            else
            if (RotationRightAxis == 2)
            {
                rightStart        = startZVertex;
                rightEnd          = endZVertex;
                rightStart2       = startZVertex2;
                rightEnd2         = endZVertex2;
                rightAxis         = 2;
                closestRightEdge  = closestZAxis;
                closestRightEdge2 = closestZAxis2;
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "Not defined axis");
            }

            if (RotationUpAxis == 0)
            {
                upStart        = startXVertex;
                upEnd          = endXVertex;
                upStart2       = startXVertex2;
                upEnd2         = endXVertex2;
                upAxis         = 0;
                closestUpEdge  = closestXAxis;
                closestUpEdge2 = closestXAxis2;
            }
            else
            if (RotationUpAxis == 1)
            {
                upStart        = startYVertex;
                upEnd          = endYVertex;
                upStart2       = startYVertex2;
                upEnd2         = endYVertex2;
                upAxis         = 1;
                closestUpEdge  = closestYAxis;
                closestUpEdge2 = closestYAxis2;
            }
            else
            if (RotationUpAxis == 2)
            {
                upStart        = startZVertex;
                upEnd          = endZVertex;
                upStart2       = startZVertex2;
                upEnd2         = endZVertex2;
                upAxis         = 2;
                closestUpEdge  = closestZAxis;
                closestUpEdge2 = closestZAxis2;
            }

            if (RotationForwardAxis == 0)
            {
                forwStart        = startXVertex;
                forwEnd          = endXVertex;
                forwStart2       = startXVertex2;
                forwEnd2         = endXVertex2;
                forwAxis         = 0;
                closestForwEdge  = closestXAxis;
                closestForwEdge2 = closestXAxis2;
            }
            else
            if (RotationForwardAxis == 1)
            {
                forwStart        = startYVertex;
                forwEnd          = endYVertex;
                forwStart2       = startYVertex2;
                forwEnd2         = endYVertex2;
                forwAxis         = 1;
                closestForwEdge  = closestYAxis;
                closestForwEdge2 = closestYAxis2;
            }
            else
            if (RotationForwardAxis == 2)
            {
                forwStart        = startZVertex;
                forwEnd          = endZVertex;
                forwStart2       = startZVertex2;
                forwEnd2         = endZVertex2;
                forwAxis         = 2;
                closestForwEdge  = closestZAxis;
                closestForwEdge2 = closestZAxis2;
            }

            float textScale = 0.7f;

            //Closest axis
            //VRageRender.MyRenderProxy.DebugDrawLine3D(rightStart, rightEnd, Color.Red, Color.Red, false);
            //VRageRender.MyRenderProxy.DebugDrawLine3D(upStart, upEnd, Color.Green, Color.Green, false);
            //VRageRender.MyRenderProxy.DebugDrawLine3D(forwStart, forwEnd, Color.Blue, Color.Blue, false);


            if (draw)
            {
                //if all axis are visible, all are shown on edges
                //if 1 axis is not visible, other 2 must be shown on faces
                //if 2 are not visible, they are shown on faces and the one is shown on face center
                //Vector3 camVector = Vector3.Normalize(rotateHintsBox.Center - MySector.MainCamera.Position);
                Vector3D camVector      = MySector.MainCamera.ForwardVector;
                Vector3D rightDirection = Vector3.Normalize(rightEnd - rightStart);
                Vector3D upDirection    = Vector3.Normalize(upEnd - upStart);
                Vector3D forwDirection  = Vector3.Normalize(forwEnd - forwStart);
                float    dotRight       = Math.Abs(Vector3.Dot(camVector, rightDirection));
                float    dotUp          = Math.Abs(Vector3.Dot(camVector, upDirection));
                float    dotForw        = Math.Abs(Vector3.Dot(camVector, forwDirection));

                bool drawRightOnFace = false, drawUpOnFace = false, drawForwOnFace = false;
                bool drawRightOnFaceCenter = false, drawUpOnFaceCenter = false, drawForwOnFaceCenter = false;

                float dotAngle = 0.4f;

                if (dotRight < dotAngle)
                {
                    if (dotUp < dotAngle)
                    {
                        drawForwOnFaceCenter = true;
                        drawRightOnFace      = true;
                        drawUpOnFace         = true;

                        System.Diagnostics.Debug.Assert(dotForw >= dotAngle);
                    }
                    else if (dotForw < dotAngle)
                    {
                        drawUpOnFaceCenter = true;
                        drawRightOnFace    = true;
                        drawForwOnFace     = true;

                        System.Diagnostics.Debug.Assert(dotUp >= dotAngle);
                    }
                    else
                    {
                        drawUpOnFace   = true;
                        drawForwOnFace = true;
                    }
                }
                else
                if (dotUp < dotAngle)
                {
                    if (dotRight < dotAngle)
                    {
                        drawForwOnFaceCenter = true;
                        drawRightOnFace      = true;
                        drawUpOnFace         = true;

                        System.Diagnostics.Debug.Assert(dotForw >= dotAngle);
                    }
                    else if (dotForw < dotAngle)
                    {
                        drawRightOnFaceCenter = true;
                        drawUpOnFace          = true;
                        drawForwOnFace        = true;

                        System.Diagnostics.Debug.Assert(dotRight >= dotAngle);
                    }
                    else
                    {
                        drawRightOnFace = true;
                        drawForwOnFace  = true;
                    }
                }
                else
                if (dotForw < dotAngle)
                {
                    if (dotRight < dotAngle)
                    {
                        drawUpOnFaceCenter = true;
                        drawRightOnFace    = true;
                        drawForwOnFace     = true;

                        System.Diagnostics.Debug.Assert(dotUp >= dotAngle);
                    }
                    else if (dotUp < dotAngle)
                    {
                        drawUpOnFaceCenter = true;
                        drawRightOnFace    = true;
                        drawForwOnFace     = true;

                        System.Diagnostics.Debug.Assert(dotRight >= dotAngle);
                    }
                    else
                    {
                        drawUpOnFace    = true;
                        drawRightOnFace = true;
                    }
                }

                //Draw according to cube visual appearance

                if (!(hideForwardAndUpArrows && RotationRightAxis != 1))
                {
                    if (drawRightOnFaceCenter)
                    {
                        //                VRageRender.MyRenderProxy.DebugDrawSphere((forwStart + forwEnd + forwStart2 + forwEnd2) * 0.25f, 0.2f, Vector3.Right, 1.0f, false, false);
                        Vector3D faceCenter = (forwStart + forwEnd + forwStart2 + forwEnd2) * 0.25f;

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowLeftGreen",
                            Vector4.One,
                            faceCenter - RotationForwardDirection * forwDirection * 0.2f - RotationRightDirection * rightDirection * 0.01f,
                            -RotationForwardDirection * forwDirection,
                            -RotationUpDirection * upDirection,
                            0.2f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRightGreen",
                            Vector4.One,
                            faceCenter + RotationForwardDirection * forwDirection * 0.2f - RotationRightDirection * rightDirection * 0.01f,
                            RotationForwardDirection * forwDirection,
                            RotationUpDirection * upDirection,
                            0.2f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(faceCenter - RotationForwardDirection * forwDirection * 0.2f - RotationRightDirection * rightDirection * 0.01f, rightControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(faceCenter + RotationForwardDirection * forwDirection * 0.2f - RotationRightDirection * rightDirection * 0.01f, rightControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                    else
                    if (drawRightOnFace)
                    {
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(rightStart2, rightEnd2, Color.Red, Color.Red, false);

                        Vector3 normalRightBack, normalRightForw;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(rightAxis, closestRightEdge, closestRightEdge2, out normalRightForw);
                        Vector3D rightCenter          = (rightStart + rightEnd) * 0.5f;
                        Vector3D rightNormalForwWorld = Vector3D.TransformNormal(normalRightForw, drawMatrix);

                        MyOrientedBoundingBox.GetNormalBetweenEdges(rightAxis, closestRightEdge2, closestRightEdge, out normalRightBack);
                        Vector3D rightCenter2         = (rightStart2 + rightEnd2) * 0.5f;
                        Vector3D rightNormalBackWorld = Vector3D.TransformNormal(normalRightBack, drawMatrix);

                        //VRageRender.MyRenderProxy.DebugDrawLine3D(rightCenter, rightCenter + rightNormalForwWorld, Color.Red, Color.Red, false);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(rightCenter2, rightCenter2 + rightNormalBackWorld, Color.Red, Color.Red, false);

                        int  normalEdge = -1;
                        bool opposite   = false;
                        if (closestRightEdge == 0 && closestRightEdge2 == 3)
                        {
                            normalEdge = closestRightEdge + 1;
                        }
                        else
                        if ((closestRightEdge < closestRightEdge2) || (closestRightEdge == 3 && closestRightEdge2 == 0))
                        {
                            normalEdge = closestRightEdge - 1;
                            opposite   = true;
                        }
                        else
                        {
                            normalEdge = closestRightEdge + 1;
                        }

                        if (RotationRightDirection < 0)
                        {
                            opposite = !opposite;
                        }

                        Vector3 rightOffset;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(rightAxis, closestRightEdge, normalEdge, out rightOffset);
                        Vector3D rightOffsetWorld = Vector3D.TransformNormal(rightOffset, drawMatrix);

                        //VRageRender.MyRenderProxy.DebugDrawText3D(rightCenter + rightNormalForwWorld * 0.6f - rightOffsetWorld * 0.01f, opposite ? rightControlName2 : rightControlName1, Color.White, textScale, false);
                        //VRageRender.MyRenderProxy.DebugDrawText3D(rightCenter2 + rightNormalBackWorld * 0.6f - rightOffsetWorld * 0.01f, opposite ? rightControlName1 : rightControlName2, Color.White, textScale, false);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowGreen",
                            Vector4.One,
                            rightCenter + rightNormalForwWorld * 0.4f - rightOffsetWorld * 0.01f,
                            rightNormalBackWorld,
                            rightDirection,
                            0.5f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowGreen",
                            Vector4.One,
                            rightCenter2 + rightNormalBackWorld * 0.4f - rightOffsetWorld * 0.01f,
                            rightNormalForwWorld,
                            rightDirection,
                            0.5f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(rightCenter + rightNormalForwWorld * 0.3f - rightOffsetWorld * 0.01f, opposite ? rightControlName1 : rightControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(rightCenter2 + rightNormalBackWorld * 0.3f - rightOffsetWorld * 0.01f, opposite ? rightControlName2 : rightControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                    else     //draw on edge
                    {
                        Vector3 normalRightBack, normalRightForw;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(rightAxis, closestRightEdge, closestRightEdge + 1, out normalRightForw);
                        MyOrientedBoundingBox.GetNormalBetweenEdges(rightAxis, closestRightEdge, closestRightEdge - 1, out normalRightBack);
                        Vector3D rightCenter          = (rightStart + rightEnd) * 0.5f;
                        Vector3D rightNormalForwWorld = Vector3D.TransformNormal(normalRightForw, drawMatrix);
                        Vector3D rightNormalBackWorld = Vector3D.TransformNormal(normalRightBack, drawMatrix);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(rightCenter, rightCenter + rightNormalForwWorld, Color.Red, Color.Red, false);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(rightCenter, rightCenter + rightNormalBackWorld, Color.Red, Color.Red, false);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowGreen",
                            Vector4.One,
                            rightCenter + rightNormalForwWorld * 0.3f - rightNormalBackWorld * 0.01f,
                            rightNormalForwWorld,
                            rightDirection,
                            0.5f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowGreen",
                            Vector4.One,
                            rightCenter + rightNormalBackWorld * 0.3f - rightNormalForwWorld * 0.01f,
                            rightNormalBackWorld,
                            rightDirection,
                            0.5f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(rightCenter + rightNormalForwWorld * 0.3f - rightNormalBackWorld * 0.01f, RotationRightDirection < 0 ? rightControlName1 : rightControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(rightCenter + rightNormalBackWorld * 0.3f - rightNormalForwWorld * 0.01f, RotationRightDirection < 0 ? rightControlName2 : rightControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                }

                if (!(hideForwardAndUpArrows && RotationUpAxis != 1))
                {
                    if (drawUpOnFaceCenter)
                    {
                        //VRageRender.MyRenderProxy.DebugDrawSphere((forwStart + forwEnd + forwStart2 + forwEnd2) * 0.25f, 0.2f, Vector3.Up, 1.0f, false, false);

                        Vector3D faceCenter = (forwStart + forwEnd + forwStart2 + forwEnd2) * 0.25f;

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowLeftRed",
                            Vector4.One,
                            faceCenter - RotationRightDirection * rightDirection * 0.2f - RotationUpDirection * upDirection * 0.01f,
                            -RotationRightDirection * rightDirection,
                            -RotationForwardDirection * forwDirection,
                            0.2f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRightRed",
                            Vector4.One,
                            faceCenter + RotationRightDirection * rightDirection * 0.2f - RotationUpDirection * upDirection * 0.01f,
                            RotationRightDirection * rightDirection,
                            RotationForwardDirection * forwDirection,
                            0.2f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(faceCenter - RotationRightDirection * rightDirection * 0.2f - RotationUpDirection * upDirection * 0.01f, upControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(faceCenter + RotationRightDirection * rightDirection * 0.2f - RotationUpDirection * upDirection * 0.01f, upControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                    else
                    if (drawUpOnFace)
                    {
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(upStart2, upEnd2, Color.Green, Color.Green, false);

                        Vector3 normalUpBack, normalUpForw;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(upAxis, closestUpEdge, closestUpEdge2, out normalUpForw);
                        Vector3D upCenter          = (upStart + upEnd) * 0.5f;
                        Vector3  upNormalForwWorld = Vector3.TransformNormal(normalUpForw, drawMatrix);

                        MyOrientedBoundingBox.GetNormalBetweenEdges(upAxis, closestUpEdge2, closestUpEdge, out normalUpBack);
                        Vector3D upCenter2         = (upStart2 + upEnd2) * 0.5f;
                        Vector3  upNormalBackWorld = Vector3.TransformNormal(normalUpBack, drawMatrix);

                        //VRageRender.MyRenderProxy.DebugDrawLine3D(upCenter, upCenter + upNormalForwWorld, Color.Green, Color.Green, false);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(upCenter2, upCenter2 + upNormalBackWorld, Color.Green, Color.Green, false);

                        int  normalEdge = -1;
                        bool opposite   = false;
                        if (closestUpEdge == 0 && closestUpEdge2 == 3)
                        {
                            normalEdge = closestUpEdge + 1;
                        }
                        else
                        if ((closestUpEdge < closestUpEdge2) || (closestUpEdge == 3 && closestUpEdge2 == 0))
                        {
                            normalEdge = closestUpEdge - 1;
                            opposite   = true;
                        }
                        else
                        {
                            normalEdge = closestUpEdge + 1;
                        }

                        if (RotationUpDirection < 0)
                        {
                            opposite = !opposite;
                        }

                        Vector3 upOffset;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(upAxis, closestUpEdge, normalEdge, out upOffset);
                        Vector3 upOffsetWorld = Vector3.TransformNormal(upOffset, drawMatrix);

                        //VRageRender.MyRenderProxy.DebugDrawText3D(upCenter + upNormalForwWorld * 0.6f - upOffsetWorld * 0.01f, opposite ? upControlName1 : upControlName2, Color.White, textScale, false);
                        //VRageRender.MyRenderProxy.DebugDrawText3D(upCenter2 + upNormalBackWorld * 0.6f - upOffsetWorld * 0.01f, opposite ? upControlName2 : upControlName1, Color.White, textScale, false);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRed",
                            Vector4.One,
                            upCenter + upNormalForwWorld * 0.4f - upOffsetWorld * 0.01f,
                            upNormalBackWorld,
                            upDirection,
                            0.5f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRed",
                            Vector4.One,
                            upCenter2 + upNormalBackWorld * 0.4f - upOffsetWorld * 0.01f,
                            upNormalForwWorld,
                            upDirection,
                            0.5f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(upCenter + upNormalForwWorld * 0.3f - upOffsetWorld * 0.01f, opposite ? upControlName2 : upControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(upCenter2 + upNormalBackWorld * 0.3f - upOffsetWorld * 0.01f, opposite ? upControlName1 : upControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                    else     //draw on edge
                    {
                        Vector3 normalUpBack, normalUpForw;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(upAxis, closestUpEdge, closestUpEdge + 1, out normalUpForw);
                        MyOrientedBoundingBox.GetNormalBetweenEdges(upAxis, closestUpEdge, closestUpEdge - 1, out normalUpBack);
                        Vector3D upCenter          = (upStart + upEnd) * 0.5f;
                        Vector3  upNormalForwWorld = Vector3.TransformNormal(normalUpForw, drawMatrix);
                        Vector3  upNormalBackWorld = Vector3.TransformNormal(normalUpBack, drawMatrix);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(upCenter, upCenter + upNormalForwWorld, Color.Green, Color.Green, false);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(upCenter, upCenter + upNormalBackWorld, Color.Green, Color.Green, false);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRed",
                            Vector4.One,
                            upCenter + upNormalForwWorld * 0.3f - upNormalBackWorld * 0.01f,
                            upNormalForwWorld,
                            upDirection,
                            0.5f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRed",
                            Vector4.One,
                            upCenter + upNormalBackWorld * 0.3f - upNormalForwWorld * 0.01f,
                            upNormalBackWorld,
                            upDirection,
                            0.5f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(upCenter + upNormalForwWorld * 0.6f - upNormalBackWorld * 0.01f, RotationUpDirection > 0 ? upControlName1 : upControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(upCenter + upNormalBackWorld * 0.6f - upNormalForwWorld * 0.01f, RotationUpDirection > 0 ? upControlName2 : upControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                }

                if (!(hideForwardAndUpArrows && RotationForwardAxis != 1))
                {
                    if (drawForwOnFaceCenter)
                    {
                        //VRageRender.MyRenderProxy.DebugDrawSphere((rightStart + rightEnd + rightStart2 + rightEnd2) * 0.25f, 0.2f, Vector3.Backward, 1.0f, false, false);

                        Vector3D faceCenter = (rightStart + rightEnd + rightStart2 + rightEnd2) * 0.25f;

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowLeftBlue",
                            Vector4.One,
                            faceCenter + RotationUpDirection * upDirection * 0.2f - RotationForwardDirection * forwDirection * 0.01f,
                            RotationUpDirection * upDirection,
                            -RotationRightDirection * rightDirection,
                            0.2f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowRightBlue",
                            Vector4.One,
                            faceCenter - RotationUpDirection * upDirection * 0.2f - RotationForwardDirection * forwDirection * 0.01f,
                            -RotationUpDirection * upDirection,
                            RotationRightDirection * rightDirection,
                            0.2f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(faceCenter + RotationUpDirection * upDirection * 0.2f - RotationForwardDirection * forwDirection * 0.01f, forwControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(faceCenter - RotationUpDirection * upDirection * 0.2f - RotationForwardDirection * forwDirection * 0.01f, forwControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, projectionId);
                    }
                    else
                    if (drawForwOnFace)
                    {
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(forwStart2, forwEnd2, Color.Blue, Color.Blue, false);

                        Vector3 normalForwBack, normalForwForw;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(forwAxis, closestForwEdge, closestForwEdge2, out normalForwForw);
                        Vector3D forwCenter          = (forwStart + forwEnd) * 0.5f;
                        Vector3  forwNormalForwWorld = Vector3.TransformNormal(normalForwForw, drawMatrix);

                        MyOrientedBoundingBox.GetNormalBetweenEdges(forwAxis, closestForwEdge2, closestForwEdge, out normalForwBack);
                        Vector3D forwCenter2         = (forwStart2 + forwEnd2) * 0.5f;
                        Vector3  forwNormalBackWorld = Vector3.TransformNormal(normalForwBack, drawMatrix);

                        //VRageRender.MyRenderProxy.DebugDrawLine3D(forwCenter, forwCenter + forwNormalForwWorld, Color.Blue, Color.Blue, false);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(forwCenter2, forwCenter2 + forwNormalBackWorld, Color.Blue, Color.Blue, false);

                        int  normalEdge = -1;
                        bool opposite   = false;
                        if (closestForwEdge == 0 && closestForwEdge2 == 3)
                        {
                            normalEdge = closestForwEdge + 1;
                        }
                        else
                        if ((closestForwEdge < closestForwEdge2) || (closestForwEdge == 3 && closestForwEdge2 == 0))
                        {
                            normalEdge = closestForwEdge - 1;
                            opposite   = true;
                        }
                        else
                        {
                            normalEdge = closestForwEdge + 1;
                        }

                        if (RotationForwardDirection < 0)
                        {
                            opposite = !opposite;
                        }

                        Vector3 forwOffset;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(forwAxis, closestForwEdge, normalEdge, out forwOffset);
                        Vector3 forwOffsetWorld = Vector3.TransformNormal(forwOffset, drawMatrix);

                        //VRageRender.MyRenderProxy.DebugDrawText3D(forwCenter + forwNormalForwWorld * 0.6f - forwOffsetWorld * 0.01f, opposite ? forwControlName2 : forwControlName1, Color.White, textScale, false);
                        //VRageRender.MyRenderProxy.DebugDrawText3D(forwCenter2 + forwNormalBackWorld * 0.6f - forwOffsetWorld * 0.01f, opposite ? forwControlName1 : forwControlName2, Color.White, textScale, false);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowBlue",
                            Vector4.One,
                            forwCenter + forwNormalForwWorld * 0.4f - forwOffsetWorld * 0.01f,
                            forwNormalBackWorld,
                            forwDirection,
                            0.5f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowBlue",
                            Vector4.One,
                            forwCenter2 + forwNormalBackWorld * 0.4f - forwOffsetWorld * 0.01f,
                            forwNormalForwWorld,
                            forwDirection,
                            0.5f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(forwCenter + forwNormalForwWorld * 0.3f - forwOffsetWorld * 0.01f, opposite ? forwControlName1 : forwControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(forwCenter2 + forwNormalBackWorld * 0.3f - forwOffsetWorld * 0.01f, opposite ? forwControlName2 : forwControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                    else     //draw on edge
                    {
                        Vector3 normalForwBack, normalForwForw;
                        MyOrientedBoundingBox.GetNormalBetweenEdges(forwAxis, closestForwEdge, closestForwEdge + 1, out normalForwForw);
                        MyOrientedBoundingBox.GetNormalBetweenEdges(forwAxis, closestForwEdge, closestForwEdge - 1, out normalForwBack);
                        Vector3D forwCenter          = (forwStart + forwEnd) * 0.5f;
                        Vector3  forwNormalForwWorld = Vector3.TransformNormal(normalForwForw, drawMatrix);
                        Vector3  forwNormalBackWorld = Vector3.TransformNormal(normalForwBack, drawMatrix);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(forwCenter, forwCenter + forwNormalForwWorld, Color.Blue, Color.Blue, false);
                        //VRageRender.MyRenderProxy.DebugDrawLine3D(forwCenter, forwCenter + forwNormalBackWorld, Color.Blue, Color.Blue, false);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowBlue",
                            Vector4.One,
                            forwCenter + forwNormalForwWorld * 0.3f - forwNormalBackWorld * 0.01f,
                            forwNormalForwWorld,
                            forwDirection,
                            0.5f,
                            110, false, projectionId);

                        MyTransparentGeometry.AddBillboardOriented(
                            "ArrowBlue",
                            Vector4.One,
                            forwCenter + forwNormalBackWorld * 0.3f - forwNormalForwWorld * 0.01f,
                            forwNormalBackWorld,
                            forwDirection,
                            0.5f,
                            110, false, projectionId);

                        VRageRender.MyRenderProxy.DebugDrawText3D(forwCenter + forwNormalForwWorld * 0.3f - forwNormalBackWorld * 0.01f, RotationForwardDirection < 0 ? forwControlName1 : forwControlName2, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                        VRageRender.MyRenderProxy.DebugDrawText3D(forwCenter + forwNormalBackWorld * 0.3f - forwNormalForwWorld * 0.01f, RotationForwardDirection < 0 ? forwControlName2 : forwControlName1, Color.White, textScale, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, projectionId);
                    }
                }
            }
        }
Beispiel #15
0
    private void DrawPerformanceWarning(int xPosition, int yPosition, MyGuiDrawAlignEnum alignment, string texturepath, float length, float width)
    {
        if (!Controls.Contains(m_warningLabel))
        {
            Controls.Add(m_warningLabel);
        }
        if (m_warningNotifications.Count != 0)
        {
            Vector2 position = MyGuiManager.ComputeFullscreenGuiCoordinate(alignment, xPosition, yPosition);
            position -= new Vector2(length / 1.5f, 0f);

            MyGuiManager.DrawSpriteBatch(Path.GetFullPath(Path.Combine(MyFileSystem.UserDataPath, texturepath)), position, new Vector2(length / 1.5f, width / 1.5f), Color.White, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            StringBuilder stringBuilder = new StringBuilder();
            if (MyInput.Static.IsJoystickLastUsed)
            {
                stringBuilder.AppendFormat(MyCommonTexts.PerformanceWarningCombinationGamepad, MyControllerHelper.GetCodeForControl(MyControllerHelper.CX_BASE, MyControlsSpace.WARNING_SCREEN));
            }
            else
            {
                stringBuilder.AppendFormat(MyCommonTexts.PerformanceWarningCombination, MyGuiSandbox.GetKeyName(MyControlsSpace.HELP_SCREEN));
            }
            MyGuiManager.DrawString("White", MyTexts.GetString(m_warningNotifications[0]), position + new Vector2(0.09f, -0.011f), 0.7f, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            MyGuiManager.DrawString("White", stringBuilder.ToString(), position + new Vector2(0.09f, 0.018f), 0.6f, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            stringBuilder.Clear();
            MyGuiManager.DrawString("White", stringBuilder.AppendFormat("({0})", m_warningNotifications.Count).ToString(), position + new Vector2(0.177f, -0.023f), 0.55f, null, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
            m_warningNotifications.RemoveAt(0);
        }
    }
Beispiel #16
0
        public unsafe void CalculateRotationHints(MatrixD drawMatrix, bool draw, bool fixedAxes = false, bool hideForwardAndUpArrows = false)
        {
            int      num6;
            string   controlButtonName;
            string   str2;
            string   str3;
            string   str4;
            string   str5;
            string   str6;
            Vector3D zero;
            Vector3D vectord14;
            Vector3D vectord15;
            Vector3D vectord16;
            Vector3D vectord17;
            Vector3D vectord18;
            Vector3D vectord19;
            Vector3D vectord20;
            Vector3D vectord21;
            Vector3D vectord22;
            Vector3D vectord23;
            Vector3D vectord24;
            int      num13;
            int      num14;
            int      num15;
            int      num16;
            int      num17;
            int      num18;
            int      num20;
            int      num21;
            float    num22;
            Vector3D vectord25;
            Vector3D vectord26;
            Vector3D vectord27;
            bool     flag2;
            bool     flag3;
            bool     flag5;
            bool     flag6;
            Vector3D vectord29;
            Vector3D vectord30;
            Vector3D vectord31;
            Vector3D vectord32;
            int      num28;
            bool     flag7;
            Vector3  vector3;
            Vector3D vectord38;
            Vector3  vector8;
            Vector3D vectord39;
            Vector3  vector9;
            int      num29;
            bool     flag8;
            Vector3  vector10;
            Matrix   viewMatrix = (Matrix)MySector.MainCamera.ViewMatrix;
            MatrixD  matrix     = MatrixD.Invert(viewMatrix);

            if (!drawMatrix.IsValid())
            {
                return;
            }
            else
            {
                if (viewMatrix.IsValid())
                {
                    int      num7;
                    int      num8;
                    int      num9;
                    int      num10;
                    int      num11;
                    int      num12;
                    MatrixD *xdPtr1 = (MatrixD *)ref matrix;
                    xdPtr1.Translation = ((drawMatrix.Translation - (7.0 * matrix.Forward)) + (1.0 * matrix.Left)) - (0.60000002384185791 * matrix.Up);
                    MatrixD *xdPtr2 = (MatrixD *)ref drawMatrix;
                    xdPtr2.Translation -= matrix.Translation;
                    this.m_viewProjection.CameraPosition = matrix.Translation;
                    matrix.Translation = Vector3D.Zero;
                    Matrix matrix2 = (Matrix)MatrixD.Transpose(matrix);
                    this.m_viewProjection.ViewAtZero = matrix2;
                    float   num = 2.75f;
                    Vector2 screenSizeFromNormalizedSize = MyGuiManager.GetScreenSizeFromNormalizedSize(Vector2.One, false);
                    int     num2 = (int)(screenSizeFromNormalizedSize.X / num);
                    int     num3 = (int)(screenSizeFromNormalizedSize.Y / num);
                    int     num4 = 0;
                    int     num5 = 0;
                    this.m_viewProjection.Viewport   = new MyViewport((float)((((int)MySector.MainCamera.Viewport.Width) - num2) - num4), (float)num5, (float)num2, (float)num3);
                    this.m_viewProjection.Projection = Matrix.CreatePerspectiveFieldOfView(0.7853982f, ((float)num2) / ((float)num3), 0.1f, 10f);
                    BoundingBoxD localbox = new BoundingBoxD(-new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large) * 0.5f), new Vector3(MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large)) * 0.5f);
                    num6 = 0;
                    MyRenderProxy.AddBillboardViewProjection(num6, this.m_viewProjection);
                    if (draw)
                    {
                        Color      red          = Color.Red;
                        Color      green        = Color.Green;
                        Color      blue         = Color.Blue;
                        Color      white        = Color.White;
                        Color      color5       = Color.White;
                        Color      color6       = Color.White;
                        Color      wire         = Color.White;
                        MyStringId?lineMaterial = null;
                        MySimpleObjectDraw.DrawTransparentBox(ref drawMatrix, ref localbox, ref red, ref green, ref blue, ref white, ref color5, ref color6, ref wire, MySimpleObjectRasterizer.Solid, 1, 0.04f, new MyStringId?(ID_SQUARE_FULL_COLOR), lineMaterial, false, num6, MyBillboard.BlendTypeEnum.LDR, 1f, null);
                    }
                    new MyOrientedBoundingBoxD(Vector3D.Transform(localbox.Center, drawMatrix), localbox.HalfExtents, Quaternion.CreateFromRotationMatrix(drawMatrix)).GetCorners(this.m_cubeVertices, 0);
                    GetClosestCubeEdge(this.m_cubeVertices, Vector3D.Zero, MyOrientedBoundingBox.StartXVertices, MyOrientedBoundingBox.EndXVertices, out num7, out num8);
                    Vector3D from     = this.m_cubeVertices[MyOrientedBoundingBox.StartXVertices[num7]];
                    Vector3D to       = this.m_cubeVertices[MyOrientedBoundingBox.EndXVertices[num7]];
                    Vector3D vectord3 = this.m_cubeVertices[MyOrientedBoundingBox.StartXVertices[num8]];
                    Vector3D vectord4 = this.m_cubeVertices[MyOrientedBoundingBox.EndXVertices[num8]];
                    GetClosestCubeEdge(this.m_cubeVertices, Vector3D.Zero, MyOrientedBoundingBox.StartYVertices, MyOrientedBoundingBox.EndYVertices, out num9, out num10);
                    Vector3D vectord5 = this.m_cubeVertices[MyOrientedBoundingBox.StartYVertices[num9]];
                    Vector3D vectord6 = this.m_cubeVertices[MyOrientedBoundingBox.EndYVertices[num9]];
                    Vector3D vectord7 = this.m_cubeVertices[MyOrientedBoundingBox.StartYVertices[num10]];
                    Vector3D vectord8 = this.m_cubeVertices[MyOrientedBoundingBox.EndYVertices[num10]];
                    GetClosestCubeEdge(this.m_cubeVertices, Vector3D.Zero, MyOrientedBoundingBox.StartZVertices, MyOrientedBoundingBox.EndZVertices, out num11, out num12);
                    Vector3D vectord9  = this.m_cubeVertices[MyOrientedBoundingBox.StartZVertices[num11]];
                    Vector3D vectord10 = this.m_cubeVertices[MyOrientedBoundingBox.EndZVertices[num11]];
                    Vector3D vectord11 = this.m_cubeVertices[MyOrientedBoundingBox.StartZVertices[num12]];
                    Vector3D vectord12 = this.m_cubeVertices[MyOrientedBoundingBox.EndZVertices[num12]];
                    this.m_cubeEdges.Clear();
                    BoxEdge item = new BoxEdge {
                        Axis = 0,
                        Edge = new LineD(from, to)
                    };
                    this.m_cubeEdges.Add(item);
                    item = new BoxEdge {
                        Axis = 1,
                        Edge = new LineD(vectord5, vectord6)
                    };
                    this.m_cubeEdges.Add(item);
                    item = new BoxEdge {
                        Axis = 2,
                        Edge = new LineD(vectord9, vectord10)
                    };
                    this.m_cubeEdges.Add(item);
                    if (!fixedAxes)
                    {
                        int num23;
                        this.RotationRightAxis        = GetBestAxis(this.m_cubeEdges, MySector.MainCamera.WorldMatrix.Right, out num23);
                        this.RotationRightDirection   = num23;
                        this.RotationUpAxis           = GetBestAxis(this.m_cubeEdges, MySector.MainCamera.WorldMatrix.Up, out num23);
                        this.RotationUpDirection      = num23;
                        this.RotationForwardAxis      = GetBestAxis(this.m_cubeEdges, MySector.MainCamera.WorldMatrix.Forward, out num23);
                        this.RotationForwardDirection = num23;
                    }
                    controlButtonName = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                    str2 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                    str3 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                    str4 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                    str5 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                    str6 = MyInput.Static.GetGameControl(MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE).GetControlButtonName(MyGuiInputDeviceEnum.Keyboard);
                    if (MyInput.Static.IsJoystickConnected() && MyInput.Static.IsJoystickLastUsed)
                    {
                        controlButtonName = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_HORISONTAL_POSITIVE).ToString();
                        str2 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_HORISONTAL_NEGATIVE).ToString();
                        str3 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_VERTICAL_POSITIVE).ToString();
                        str4 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_VERTICAL_NEGATIVE).ToString();
                        str5 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_ROLL_POSITIVE).ToString();
                        str6 = MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_BUILD_MODE, MyControlsSpace.CUBE_ROTATE_ROLL_NEGATIVE).ToString();
                    }
                    zero      = Vector3D.Zero;
                    vectord14 = Vector3D.Zero;
                    vectord15 = Vector3D.Zero;
                    vectord16 = Vector3D.Zero;
                    vectord17 = Vector3D.Zero;
                    vectord18 = Vector3D.Zero;
                    vectord19 = Vector3D.Zero;
                    vectord20 = Vector3D.Zero;
                    vectord21 = Vector3D.Zero;
                    vectord22 = Vector3D.Zero;
                    vectord23 = Vector3D.Zero;
                    vectord24 = Vector3D.Zero;
                    num13     = -1;
                    num14     = -1;
                    num15     = -1;
                    num16     = -1;
                    num17     = -1;
                    num18     = -1;
                    int num19 = -1;
                    num20 = -1;
                    num21 = -1;
                    if (this.RotationRightAxis == 0)
                    {
                        zero      = from;
                        vectord14 = to;
                        vectord19 = vectord3;
                        vectord20 = vectord4;
                        num13     = 0;
                        num16     = num7;
                        num19     = num8;
                    }
                    else if (this.RotationRightAxis == 1)
                    {
                        zero      = vectord5;
                        vectord14 = vectord6;
                        vectord19 = vectord7;
                        vectord20 = vectord8;
                        num13     = 1;
                        num16     = num9;
                        num19     = num10;
                    }
                    else if (this.RotationRightAxis == 2)
                    {
                        zero      = vectord9;
                        vectord14 = vectord10;
                        vectord19 = vectord11;
                        vectord20 = vectord12;
                        num13     = 2;
                        num16     = num11;
                        num19     = num12;
                    }
                    if (this.RotationUpAxis == 0)
                    {
                        vectord15 = from;
                        vectord16 = to;
                        vectord21 = vectord3;
                        vectord22 = vectord4;
                        num14     = 0;
                        num17     = num7;
                        num20     = num8;
                    }
                    else if (this.RotationUpAxis == 1)
                    {
                        vectord15 = vectord5;
                        vectord16 = vectord6;
                        vectord21 = vectord7;
                        vectord22 = vectord8;
                        num14     = 1;
                        num17     = num9;
                        num20     = num10;
                    }
                    else if (this.RotationUpAxis == 2)
                    {
                        vectord15 = vectord9;
                        vectord16 = vectord10;
                        vectord21 = vectord11;
                        vectord22 = vectord12;
                        num14     = 2;
                        num17     = num11;
                        num20     = num12;
                    }
                    if (this.RotationForwardAxis == 0)
                    {
                        vectord17 = from;
                        vectord18 = to;
                        vectord23 = vectord3;
                        vectord24 = vectord4;
                        num15     = 0;
                        num18     = num7;
                        num21     = num8;
                    }
                    else if (this.RotationForwardAxis == 1)
                    {
                        vectord17 = vectord5;
                        vectord18 = vectord6;
                        vectord23 = vectord7;
                        vectord24 = vectord8;
                        num15     = 1;
                        num18     = num9;
                        num21     = num10;
                    }
                    else if (this.RotationForwardAxis == 2)
                    {
                        vectord17 = vectord9;
                        vectord18 = vectord10;
                        vectord23 = vectord11;
                        vectord24 = vectord12;
                        num15     = 2;
                        num18     = num11;
                        num21     = num12;
                    }
                    num22 = 0.5448648f;
                    if (!draw)
                    {
                        return;
                    }
                    else
                    {
                        vectord25 = Vector3.Normalize(vectord14 - zero);
                        vectord26 = Vector3.Normalize(vectord16 - vectord15);
                        vectord27 = Vector3.Normalize(vectord18 - vectord17);
                        Vector3D forwardVector = MySector.MainCamera.ForwardVector;
                        float    num24         = Math.Abs(Vector3.Dot((Vector3)forwardVector, (Vector3)vectord25));
                        float    num25         = Math.Abs(Vector3.Dot((Vector3)forwardVector, (Vector3)vectord26));
                        float    num26         = Math.Abs(Vector3.Dot((Vector3)forwardVector, (Vector3)vectord27));
                        bool     flag          = false;
                        flag2 = false;
                        flag3 = false;
                        bool flag4 = false;
                        flag5 = false;
                        flag6 = false;
                        float num27 = 0.4f;
                        if (num24 < num27)
                        {
                            if (num25 < num27)
                            {
                                flag6 = true;
                                flag  = true;
                                flag2 = true;
                            }
                            else if (num26 >= num27)
                            {
                                flag2 = true;
                                flag3 = true;
                            }
                            else
                            {
                                flag5 = true;
                                flag  = true;
                                flag3 = true;
                            }
                        }
                        else if (num25 < num27)
                        {
                            if (num24 < num27)
                            {
                                flag6 = true;
                                flag  = true;
                                flag2 = true;
                            }
                            else if (num26 >= num27)
                            {
                                flag  = true;
                                flag3 = true;
                            }
                            else
                            {
                                flag4 = true;
                                flag2 = true;
                                flag3 = true;
                            }
                        }
                        else if (num26 < num27)
                        {
                            if (num24 < num27)
                            {
                                flag5 = true;
                                flag  = true;
                                flag3 = true;
                            }
                            else if (num25 >= num27)
                            {
                                flag2 = true;
                                flag  = true;
                            }
                            else
                            {
                                flag5 = true;
                                flag  = true;
                                flag3 = true;
                            }
                        }
                        if (hideForwardAndUpArrows && (this.RotationRightAxis != 1))
                        {
                            goto TR_0025;
                        }
                        if (!flag4)
                        {
                            if (!flag)
                            {
                                Vector3 vector4;
                                Vector3 vector5;
                                MyOrientedBoundingBox.GetNormalBetweenEdges(num13, num16, num16 + 1, out vector5);
                                MyOrientedBoundingBox.GetNormalBetweenEdges(num13, num16, num16 - 1, out vector4);
                                Vector3D vectord34 = (zero + vectord14) * 0.5;
                                Vector3D vectord35 = Vector3D.TransformNormal(vector5, drawMatrix);
                                Vector3D vectord36 = Vector3D.TransformNormal(vector4, drawMatrix);
                                MyTransparentGeometry.AddBillboardOriented(ID_ARROW_GREEN, Vector4.One, (vectord34 + (vectord35 * 0.30000001192092896)) - (vectord36 * 0.0099999997764825821), (Vector3)vectord25, (Vector3)vectord35, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                                MyTransparentGeometry.AddBillboardOriented(ID_ARROW_GREEN, Vector4.One, (vectord34 + (vectord36 * 0.30000001192092896)) - (vectord35 * 0.0099999997764825821), (Vector3)vectord25, (Vector3)vectord36, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                                MyRenderProxy.DebugDrawText3D((vectord34 + (vectord35 * 0.30000001192092896)) - (vectord36 * 0.0099999997764825821), (this.RotationRightDirection < 0) ? controlButtonName : str2, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                                MyRenderProxy.DebugDrawText3D((vectord34 + (vectord36 * 0.30000001192092896)) - (vectord35 * 0.0099999997764825821), (this.RotationRightDirection < 0) ? str2 : controlButtonName, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                                goto TR_0025;
                            }
                            else
                            {
                                Vector3 vector;
                                Vector3 vector2;
                                MyOrientedBoundingBox.GetNormalBetweenEdges(num13, num16, num19, out vector2);
                                vectord29 = (zero + vectord14) * 0.5;
                                vectord30 = Vector3D.TransformNormal(vector2, drawMatrix);
                                MyOrientedBoundingBox.GetNormalBetweenEdges(num13, num19, num16, out vector);
                                vectord31 = (vectord19 + vectord20) * 0.5;
                                vectord32 = Vector3D.TransformNormal(vector, drawMatrix);
                                flag7     = false;
                                if ((num16 == 0) && (num19 == 3))
                                {
                                    num28 = num16 + 1;
                                    goto TR_0029;
                                }
                                if ((num16 >= num19) && ((num16 != 3) || (num19 != 0)))
                                {
                                    num28 = num16 + 1;
                                    goto TR_0029;
                                }
                            }
                        }
                        else
                        {
                            Vector3D vectord28 = (((vectord17 + vectord18) + vectord23) + vectord24) * 0.25;
                            MyTransparentGeometry.AddBillboardOriented(ID_ARROW_LEFT_GREEN, Vector4.One, (vectord28 - ((this.RotationForwardDirection * vectord27) * 0.20000000298023224)) - ((this.RotationRightDirection * vectord25) * 0.0099999997764825821), (Vector3)(-this.RotationUpDirection * vectord26), (Vector3)(-this.RotationForwardDirection * vectord27), 0.2f, num6, MyBillboard.BlendTypeEnum.LDR);
                            MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RIGHT_GREEN, Vector4.One, (vectord28 + ((this.RotationForwardDirection * vectord27) * 0.20000000298023224)) - ((this.RotationRightDirection * vectord25) * 0.0099999997764825821), (Vector3)(this.RotationUpDirection * vectord26), (Vector3)(this.RotationForwardDirection * vectord27), 0.2f, num6, MyBillboard.BlendTypeEnum.LDR);
                            MyRenderProxy.DebugDrawText3D((vectord28 - ((this.RotationForwardDirection * vectord27) * 0.20000000298023224)) - ((this.RotationRightDirection * vectord25) * 0.0099999997764825821), str2, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                            MyRenderProxy.DebugDrawText3D((vectord28 + ((this.RotationForwardDirection * vectord27) * 0.20000000298023224)) - ((this.RotationRightDirection * vectord25) * 0.0099999997764825821), controlButtonName, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                            goto TR_0025;
                        }
                        goto TR_002B;
                    }
                    goto TR_0029;
                }
                else
                {
                    return;
                }
                goto TR_002B;
            }
            goto TR_0029;
TR_0013:
            if (!hideForwardAndUpArrows || (this.RotationForwardAxis == 1))
            {
                if (flag6)
                {
                    Vector3D vectord41 = (((zero + vectord14) + vectord19) + vectord20) * 0.25;
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_LEFT_BLUE, Vector4.One, (vectord41 + ((this.RotationUpDirection * vectord26) * 0.20000000298023224)) - ((this.RotationForwardDirection * vectord27) * 0.0099999997764825821), (Vector3)(-this.RotationRightDirection * vectord25), (Vector3)(this.RotationUpDirection * vectord26), 0.2f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RIGHT_BLUE, Vector4.One, (vectord41 - ((this.RotationUpDirection * vectord26) * 0.20000000298023224)) - ((this.RotationForwardDirection * vectord27) * 0.0099999997764825821), (Vector3)(this.RotationRightDirection * vectord25), (Vector3)(-this.RotationUpDirection * vectord26), 0.2f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyRenderProxy.DebugDrawText3D((vectord41 + ((this.RotationUpDirection * vectord26) * 0.20000000298023224)) - ((this.RotationForwardDirection * vectord27) * 0.0099999997764825821), str5, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, num6, false);
                    MyRenderProxy.DebugDrawText3D((vectord41 - ((this.RotationUpDirection * vectord26) * 0.20000000298023224)) - ((this.RotationForwardDirection * vectord27) * 0.0099999997764825821), str6, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, num6, false);
                    return;
                }
                if (!flag3)
                {
                    Vector3 vector22;
                    Vector3 vector23;
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num15, num18, num18 + 1, out vector23);
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num15, num18, num18 - 1, out vector22);
                    Vector3D vectord44 = (vectord17 + vectord18) * 0.5;
                    Vector3  upVector  = Vector3.TransformNormal(vector23, drawMatrix);
                    Vector3  vector25  = Vector3.TransformNormal(vector22, drawMatrix);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_BLUE, Vector4.One, (vectord44 + (upVector * 0.3f)) - (vector25 * 0.01f), (Vector3)vectord27, upVector, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_BLUE, Vector4.One, (vectord44 + (vector25 * 0.3f)) - (upVector * 0.01f), (Vector3)vectord27, vector25, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyRenderProxy.DebugDrawText3D((vectord44 + (upVector * 0.3f)) - (vector25 * 0.01f), (this.RotationForwardDirection < 0) ? str5 : str6, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                    MyRenderProxy.DebugDrawText3D((vectord44 + (vector25 * 0.3f)) - (upVector * 0.01f), (this.RotationForwardDirection < 0) ? str6 : str5, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                }
                else
                {
                    Vector3 vector16;
                    Vector3 vector17;
                    int     num30;
                    Vector3 vector20;
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num15, num18, num21, out vector17);
                    Vector3D vectord42 = (vectord17 + vectord18) * 0.5;
                    Vector3  upVector  = Vector3.TransformNormal(vector17, drawMatrix);
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num15, num21, num18, out vector16);
                    Vector3D vectord43 = (vectord23 + vectord24) * 0.5;
                    Vector3  vector19  = Vector3.TransformNormal(vector16, drawMatrix);
                    bool     flag9     = false;
                    if ((num18 == 0) && (num21 == 3))
                    {
                        num30 = num18 + 1;
                    }
                    else if ((num18 >= num21) && ((num18 != 3) || (num21 != 0)))
                    {
                        num30 = num18 + 1;
                    }
                    else
                    {
                        num30 = num18 - 1;
                        flag9 = true;
                    }
                    if (this.RotationForwardDirection < 0)
                    {
                        flag9 = !flag9;
                    }
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num15, num18, num30, out vector20);
                    Vector3 vector21 = Vector3.TransformNormal(vector20, drawMatrix);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_BLUE, Vector4.One, (vectord42 + (upVector * 0.4f)) - (vector21 * 0.01f), (Vector3)vectord27, vector19, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_BLUE, Vector4.One, (vectord43 + (vector19 * 0.4f)) - (vector21 * 0.01f), (Vector3)vectord27, upVector, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyRenderProxy.DebugDrawText3D((vectord42 + (upVector * 0.3f)) - (vector21 * 0.01f), flag9 ? str5 : str6, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                    MyRenderProxy.DebugDrawText3D((vectord43 + (vector19 * 0.3f)) - (vector21 * 0.01f), flag9 ? str6 : str5, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                    return;
                }
            }
            return;

TR_0017:
            if (this.RotationUpDirection < 0)
            {
                flag8 = !flag8;
            }
            MyOrientedBoundingBox.GetNormalBetweenEdges(num14, num17, num29, out vector10);
            Vector3 vector11 = Vector3.TransformNormal(vector10, drawMatrix);

            MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RED, Vector4.One, (vectord38 + (vector8 * 0.4f)) - (vector11 * 0.01f), (Vector3)vectord26, vector9, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
            MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RED, Vector4.One, (vectord39 + (vector9 * 0.4f)) - (vector11 * 0.01f), (Vector3)vectord26, vector8, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
            MyRenderProxy.DebugDrawText3D((vectord38 + (vector8 * 0.3f)) - (vector11 * 0.01f), flag8 ? str4 : str3, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
            MyRenderProxy.DebugDrawText3D((vectord39 + (vector9 * 0.3f)) - (vector11 * 0.01f), flag8 ? str3 : str4, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
            goto TR_0013;
TR_0025:
            if (hideForwardAndUpArrows && (this.RotationUpAxis != 1))
            {
                goto TR_0013;
            }
            if (!flag5)
            {
                if (!flag2)
                {
                    Vector3 vector12;
                    Vector3 vector13;
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num14, num17, num17 + 1, out vector13);
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num14, num17, num17 - 1, out vector12);
                    Vector3D vectord40 = (vectord15 + vectord16) * 0.5;
                    Vector3  upVector  = Vector3.TransformNormal(vector13, drawMatrix);
                    Vector3  vector15  = Vector3.TransformNormal(vector12, drawMatrix);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RED, Vector4.One, (vectord40 + (upVector * 0.3f)) - (vector15 * 0.01f), (Vector3)vectord26, upVector, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RED, Vector4.One, (vectord40 + (vector15 * 0.3f)) - (upVector * 0.01f), (Vector3)vectord26, vector15, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
                    MyRenderProxy.DebugDrawText3D((vectord40 + (upVector * 0.6f)) - (vector15 * 0.01f), (this.RotationUpDirection > 0) ? str3 : str4, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                    MyRenderProxy.DebugDrawText3D((vectord40 + (vector15 * 0.6f)) - (upVector * 0.01f), (this.RotationUpDirection > 0) ? str4 : str3, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                    goto TR_0013;
                }
                else
                {
                    Vector3 vector6;
                    Vector3 vector7;
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num14, num17, num20, out vector7);
                    vectord38 = (vectord15 + vectord16) * 0.5;
                    vector8   = Vector3.TransformNormal(vector7, drawMatrix);
                    MyOrientedBoundingBox.GetNormalBetweenEdges(num14, num20, num17, out vector6);
                    vectord39 = (vectord21 + vectord22) * 0.5;
                    vector9   = Vector3.TransformNormal(vector6, drawMatrix);
                    flag8     = false;
                    if ((num17 == 0) && (num20 == 3))
                    {
                        num29 = num17 + 1;
                        goto TR_0017;
                    }
                    if ((num17 >= num20) && ((num17 != 3) || (num20 != 0)))
                    {
                        num29 = num17 + 1;
                        goto TR_0017;
                    }
                }
            }
            else
            {
                Vector3D vectord37 = (((vectord17 + vectord18) + vectord23) + vectord24) * 0.25;
                MyTransparentGeometry.AddBillboardOriented(ID_ARROW_LEFT_RED, Vector4.One, (vectord37 - ((this.RotationRightDirection * vectord25) * 0.20000000298023224)) - ((this.RotationUpDirection * vectord26) * 0.0099999997764825821), (Vector3)(-this.RotationForwardDirection * vectord27), (Vector3)(-this.RotationRightDirection * vectord25), 0.2f, num6, MyBillboard.BlendTypeEnum.LDR);
                MyTransparentGeometry.AddBillboardOriented(ID_ARROW_RIGHT_RED, Vector4.One, (vectord37 + ((this.RotationRightDirection * vectord25) * 0.20000000298023224)) - ((this.RotationUpDirection * vectord26) * 0.0099999997764825821), (Vector3)(this.RotationForwardDirection * vectord27), (Vector3)(this.RotationRightDirection * vectord25), 0.2f, num6, MyBillboard.BlendTypeEnum.LDR);
                MyRenderProxy.DebugDrawText3D((vectord37 - ((this.RotationRightDirection * vectord25) * 0.20000000298023224)) - ((this.RotationUpDirection * vectord26) * 0.0099999997764825821), str3, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                MyRenderProxy.DebugDrawText3D((vectord37 + ((this.RotationRightDirection * vectord25) * 0.20000000298023224)) - ((this.RotationUpDirection * vectord26) * 0.0099999997764825821), str4, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
                goto TR_0013;
            }
            num29 = num17 - 1;
            flag8 = true;
            goto TR_0017;
TR_0029:
            if (this.RotationRightDirection < 0)
            {
                flag7 = !flag7;
            }
            MyOrientedBoundingBox.GetNormalBetweenEdges(num13, num16, num28, out vector3);
            Vector3D vectord33 = Vector3D.TransformNormal(vector3, drawMatrix);

            MyTransparentGeometry.AddBillboardOriented(ID_ARROW_GREEN, Vector4.One, (vectord29 + (vectord30 * 0.40000000596046448)) - (vectord33 * 0.0099999997764825821), (Vector3)vectord25, (Vector3)vectord32, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
            MyTransparentGeometry.AddBillboardOriented(ID_ARROW_GREEN, Vector4.One, (vectord31 + (vectord32 * 0.40000000596046448)) - (vectord33 * 0.0099999997764825821), (Vector3)vectord25, (Vector3)vectord30, 0.5f, num6, MyBillboard.BlendTypeEnum.LDR);
            MyRenderProxy.DebugDrawText3D((vectord29 + (vectord30 * 0.30000001192092896)) - (vectord33 * 0.0099999997764825821), flag7 ? controlButtonName : str2, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
            MyRenderProxy.DebugDrawText3D((vectord31 + (vectord32 * 0.30000001192092896)) - (vectord33 * 0.0099999997764825821), flag7 ? str2 : controlButtonName, Color.White, num22, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, num6, false);
            goto TR_0025;
TR_002B:
            num28 = num16 - 1;
            flag7 = true;
            goto TR_0029;
        }