protected override void OnOkClick(MyGuiControlButton sender)
        {
            MyMwcSectorTypeEnum sectorType = string.IsNullOrEmpty(m_playerName.Text) ? MyMwcSectorTypeEnum.STORY : MyMwcSectorTypeEnum.SANDBOX;
            bool namedSector = !string.IsNullOrEmpty(m_sector_name.Text);
            MyMwcSectorIdentifier sectorIdentifier;
            if (namedSector)
            {
                sectorIdentifier = new MyMwcSectorIdentifier(sectorType, null, new MyMwcVector3Int(0, 0, 0), m_sector_name.Text);
            }
            else
            {
                int x, y, z;
                if (!int.TryParse(m_sectorIdentifierX.Text, out x) ||
                    !int.TryParse(m_sectorIdentifierY.Text, out y) ||
                    !int.TryParse(m_sectorIdentifierZ.Text, out z))
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, 
                        MyTextsWrapperEnum.BadSectorIdentifierInput, MyTextsWrapperEnum.MessageBoxCaptionError,
                        MyTextsWrapperEnum.Ok, null));
                    return;
                }

                sectorIdentifier = new MyMwcSectorIdentifier(sectorType, null, new MyMwcVector3Int(x, y, z), null);
            }

            // This screen will be closed on successfull load from progress screen
            MyGuiManager.AddScreen(new MyGuiScreenEditorLoadSectorObjectsProgress(
                this, MyTextsWrapperEnum.LoadingPleaseWait, m_playerName.Text, sectorIdentifier));
        }
        void LoadControls()
        {
            // Background texture unloaded in base
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBackground", flags: TextureFlags.IgnoreQuality);
            m_wheelTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Loading", flags: TextureFlags.IgnoreQuality);

            m_size = new Vector2(598 / 1600f, 368 / 1200f);
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0f, -0.05f), null, m_progressText, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE * 0.86f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            float deltaX = (m_enableCancel) ? 0.08f : 0.0f;
            float deltaY = 0.035f;

            Controls.Add(new MyGuiControlRotatingWheel(this, new Vector2(-deltaX, deltaY), MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_wheelTexture));

            //  Sometimes we don't want to allow user to cancel pending progress screen
            if (m_enableCancel)
            {
                var cancelButton = new MyGuiControlButton(this, new Vector2(deltaX, deltaY), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                        Vector4.One,
                        MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Cancel,
                        MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick,
                        true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(cancelButton);
            }
            m_controlsCreated = true;
        }
        protected override void LoadControls()
        {
            Vector2 position = GetNextControlPosition() + new Vector2(0.38f, 0);

            m_onButton = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null,
                MyTextsWrapperEnum.On, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_onButton);
            m_onButton.DrawRedTextureWhenDisabled = false;
            m_onButton.UseSwitchMode = true;

            position.X -= 0.04f;

            m_offButon = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null,
                MyTextsWrapperEnum.Off, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_offButon);
            m_offButon.DrawRedTextureWhenDisabled = false;
            m_offButon.UseSwitchMode = true;

            position.X -= 0.11f;

            m_unpoweredLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.Unpowered, MyGuiConstants.LABEL_TEXT_COLOR, 1.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            m_remoteControlledLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.MP_RemoteControlled, MyGuiConstants.LABEL_TEXT_COLOR, 1.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_unpoweredLabel);
            Controls.Add(m_remoteControlledLabel);

            m_isPrefabElectrified = !Prefab.IsElectrified();
            UpdateVisibility();
            UpdateEnabledState();
        }
 protected override void OnOkClick(MyGuiControlButton sender)
 {
     base.OnOkClick(sender);
     
     MyGuiScreenGamePlay.Static.SetSectorName(m_nameTextbox.Text);
     MyEditor.Static.PerformContextMenuAction(MyGuiContextMenuItemActionType.SAVE_SECTOR);            
 }
        public override void LoadContent()
        {
            base.LoadContent();

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.145f);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;


            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DifficultyEasy, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEasyClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DifficultyNormal, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnNormalClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DifficultyHard, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnHardClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            var exitButton = new MyGuiControlButton(this, new Vector2(0, 0.1460f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(exitButton);


            SetControlIndex(2);
        }
        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(MyTextsWrapperEnum.Options, new Vector2(0, 0.005f));

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f);
            MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            int index = 0;

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Game, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnGameClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Video, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnVideoClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, m_showVideoOption ? (MyTextsWrapperEnum?)null : MyTextsWrapperEnum.FeatureAccessibleOnlyFromMainMenu));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Audio, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAudioClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Controls, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnControlsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            var backButton = new MyGuiControlButton(this, new Vector2(0, 0.178f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(backButton);

        }
 protected override void OnCancelClick(MyGuiControlButton sender)
 {
     if (m_waypointPath != null)
         if (m_newlyAdded)
             MyWayPointGraph.RemovePath(MyWayPointGraph.SelectedPath);
     CloseScreen();
 }
        public MyGuiScreenEditorGroups()
            : base(new Vector2(0.5f, 0.5f), new Vector2(0.6f, 0.9f))
        {
            AddCaption(MyTextsWrapperEnum.EditorGroups, MyGuiConstants.LABEL_TEXT_COLOR, new Vector2(0,0.007f));

            Vector2 groupListTopLeft = new Vector2(MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X*0.7f, CAPTION_OFFSET_Y) - m_size.Value / 2;
            Vector2 groupListSize = m_size.Value - new Vector2(
                MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X * 3 + BUTTON_SIZE.X*0.5f,
                CAPTION_OFFSET_Y + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y * 2 + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);

            m_groupList = new MyGuiControlTreeView(this, groupListTopLeft + groupListSize / 2, groupListSize, MyGuiConstants.TREEVIEW_BACKGROUND_COLOR, true);
            m_groupList.WholeRowHighlight = true;

            Controls.Add(m_groupList);

            int index = 0;
            m_addObjectsButton = AddButton(index++, 0, MyTextsWrapperEnum.EditorGroupsAddObjects, OnAddObjects);
            m_removeObjectsButton = AddButton(index++, 0, MyTextsWrapperEnum.EditorGroupsRemoveObjects, OnRemoveObjects);

            m_selectGroupButton = AddButton(index++, 1, MyTextsWrapperEnum.EditorGroupsSelectGroup, OnSelectGroup);
            m_unselectGroupButton = AddButton(index++, 1, MyTextsWrapperEnum.EditorGroupsUnselectGroup, OnUnselectGroup);

            m_createGroupButton = AddButton(index++, 2, MyTextsWrapperEnum.EditorGroupsCreateGroup, OnCreateGroup);
            m_renameGroupButton = AddButton(index++, 2, MyTextsWrapperEnum.EditorGroupsRenameGroup, OnRenameGroup);
            m_deleteGroupButton = AddButton(index++, 2, MyTextsWrapperEnum.EditorGroupsDeleteGroup, OnDeleteGroup);

            m_loadGroupButton = AddButton(index, 3, MyTextsWrapperEnum.EditorGroupsLoadGroup, OnLoadGroup, true);
            
            AddBackButtonControl(new Vector2(0,-0.03f));

            foreach (var group in MyEditor.Static.ObjectGroups)
            {
                AddGroup(group);
            }
        }
 public override void OnOkClick(MyGuiControlButton sender)
 {
     base.OnOkClick(sender);
     foreach (var v in m_waypoints)
         v.IsSecret = m_secretCheckbox.Checked;
     MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
 }
        void OnAcquireControlClick(MyGuiControlButton sender)
        {
            Debug.Assert(PrefabLargeWeapon.EntityId.HasValue, "EntityID cannot be null");

            if (MyMultiplayerGameplay.IsRunning)
            {
                MyMultiplayerGameplay.Static.LockReponse = (e, success) =>
                {
                    MyMultiplayerGameplay.Static.LockReponse = null;
                    if (PrefabLargeWeapon != e)
                    {
                        Debug.Fail("Something went wrong, locked different entity");
                        MyMultiplayerGameplay.Static.Lock(e, false);
                        return;
                    }

                    if (success)
                    {
                        ParentScreen.Closed += ParentScreenClosed;

                        MyGuiScreenGamePlay.Static.TakeControlOfLargeWeapon(PrefabLargeWeapon);
                        HideHUBScreen();
                    }
                };
                MyMultiplayerGameplay.Static.Lock(PrefabLargeWeapon, true);
            }
            else
            {
                MyGuiScreenGamePlay.Static.TakeControlOfLargeWeapon(PrefabLargeWeapon);
                HideHUBScreen();
            }
        }
        public void OnVideoClick(MyGuiControlButton sender)
        {
            MyMwcLog.WriteLine("MyGuiScreenOptions.OnVideoClick START");

            MyGuiManager.AddScreen(new MyGuiScreenOptionsVideo());

            MyMwcLog.WriteLine("MyGuiScreenOptions.OnVideoClick END");
        }
 private void OnDeleteClick(MyGuiControlButton sender) 
 {
     int? selectedPrefabId = m_connectedPrefabIdsListbox.GetSelectedItemKey();
     if (selectedPrefabId != null) 
     {
         PrefabSecurityControlHUB.DisconnetEntity((uint)selectedPrefabId.Value);
         m_connectedPrefabIdsListbox.RemoveItem(selectedPrefabId.Value);
     }
 }
        public override void OnOkClick(MyGuiControlButton sender)
        {
            base.OnOkClick(sender);

            PrefabContainer.AlarmOn = m_alarmOn.Checked;
            PrefabContainer.Activate(m_activatedCheckbox.Checked, false);

            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);

        }
 public void OnAllowEnter(MyGuiControlButton sender)
 {
     MyMultiplayerGameplay.Static.AllowEnter(ref m_request.Message);
     if (m_chkRememberSetting.Checked)
     {
         MyMultiplayerGameplay.Static.JoinMode = MyJoinMode.Open;
         MyMultiplayerGameplay.Static.UpdateGameInfo();
     }
     CloseScreen();
 }
 void OnSelectAllNone(MyGuiControlButton sender)
 {
     if (m_objectList.GetSelectedItems().Count > 0)
     {
         m_objectList.DeselectAll();
     }
     else
     {
         m_objectList.SelectAll();
     }
 }
 protected override void OnOkClick(MyGuiControlButton sender)
 {
     if (!string.IsNullOrEmpty(m_nameTextbox.Text) && m_myGuiScreenEditorGroups.ChangeGroupName(m_group, m_nameTextbox.Text))
     {
         base.OnOkClick(sender);
     }
     else
     {
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.EditorGroupsNameUsedText, MyTextsWrapperEnum.EditorGroupsNameUsedCaption, MyTextsWrapperEnum.Ok, null));
     }
 }
        public MyGuiScreenHostGame(MyGuiScreenBase closeAfterSuccessfulEnter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 695 / 1200f), false, MyGuiManager.GetSandboxBackgoround())
        {
            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
            m_enableBackgroundFade = true;
            AddCaption(MyTextsWrapperEnum.HostGame, new Vector2(0, 0.005f));

            Debug.Assert(m_size != null, "m_size != null");
            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            MyTextsWrapperEnum? officialSectorsForbidden = null;
            MyTextsWrapperEnum? buttonsForbidden = null;
            MyTextsWrapperEnum? friendsSectorsForbidden = null;
            if (MyClientServer.LoggedPlayer != null)
            {
                if ((MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanSave() == false))
                {
                    officialSectorsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                    buttonsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                    friendsSectorsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                }
                else if (MyClientServer.LoggedPlayer.IsDemoUser())
                {
                    friendsSectorsForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode;
                }
            }

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.SandboxSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnSandboxSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true, officialSectorsForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.YourSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnMySectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true, buttonsForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.FriendsSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnFriendsSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true, friendsSectorsForbidden));

            var backButton = new MyGuiControlButton(this, new Vector2(0, 0.178f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(backButton);

        }
        public override void OnOkClick(MyGuiControlButton sender)
        {
            base.OnOkClick(sender);

            if (PrefabKinematic.CanOpen != m_on.Checked)
            {
                PrefabKinematic.CanOpen = m_on.Checked;
            }

            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);

        }
 protected override void OnOkClick(MyGuiControlButton sender)
 {
     if (!string.IsNullOrEmpty(m_nameTextbox.Text) /* all OK */)
     {
         m_renameHandler(m_oldName, m_nameTextbox.Text, this);
         base.OnOkClick(sender);
     }
     else
     {
         // TODO: change texts
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
     }
 }
 public override void OnOkClick(MyGuiControlButton sender)
 {
     base.OnOkClick(sender);
     foreach (MyPrefabLargeWeapon prefabLargeWeapon in m_prefabLargeWeapons)
     {
         prefabLargeWeapon.SearchingDistance = m_searchingDistance.GetValue();
         if (prefabLargeWeapon.Enabled != m_on.Checked)                 
         {
             prefabLargeWeapon.Enabled = m_on.Checked;
         }
         prefabLargeWeapon.Activate(m_activatedCheckbox.Checked, false);
     }
     MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
 }
        protected override void LoadControls()
        {
            base.LoadControls();
            var pos = GetNextControlPosition() - MyGuiConstants.CONTROLS_DELTA + new Vector2(0.07f, -0.02f);


           m_takeControl = new MyGuiControlButton(this, pos, new Vector2(0.14f, 0.051f),
           Vector4.One,
           MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.AcquireControl,
           MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnControlClick,
           true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, true, true, true, drawCrossTextureWhenDisabled : false);
           Controls.Add(m_takeControl);
           m_takeControl.DrawRedTextureWhenDisabled = false;

           UpdateTakeControlState();
        }
        public void OnSendClick(MyGuiControlButton sender)
        {
            if (m_textbox.Text != "")
            {
                if (MyMultiplayerGameplay.IsRunning)
                {
                    if (m_teamOnly)
                    {
                        m_textbox.Text = MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.MPChatTeamMessagePrefix) + m_textbox.Text;
                        MyMultiplayerGameplay.Static.SendChatMessageToTeam(m_textbox.Text, MySession.Static.Player.Faction);
                    }
                    else
                    {
                        MyMultiplayerGameplay.Static.SendChatMessage(m_textbox.Text);
                    }
                }

                MyGuiScreenGamePlay.Static.AddChatMessage(MyClientServer.LoggedPlayer.GetUserId(), m_textbox.Text);
            }
            this.CloseScreen();
        }
        protected override void OnOkClick(MyGuiControlButton sender)
        {
            if (m_waypointPath != null)
            {
                string name = m_groupNameTextbox.Text;

                // empty or duplicate
                if (m_waypointPath.ChangeName(name) == false)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(
                        MyMessageBoxType.ERROR,
                        name == null || name.Length == 0 ? new StringBuilder("The name can't be empty.") : new StringBuilder().AppendFormat("The name {0} is already used.", name),
                        new StringBuilder("Error"),
                        MyTextsWrapperEnum.Ok,
                        r => { }
                    ));
                    return;
                }
            }
            CloseScreen();
        }
        public MyGuiScreenProfile()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 850 / 1200f))
        {
            m_enableBackgroundFade = true;
            bool displayLogoutButton = !(MyGuiScreenGamePlay.Static != null && (MyGuiScreenGamePlay.Static.IsGameActive() || MyGuiScreenGamePlay.Static.IsEditorActive()));
            displayLogoutButton = displayLogoutButton && !MySteam.IsActive && (MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetUserId() != MyPlayerLocal.OFFLINE_MODE_USERID);

            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProfileBackground", flags: TextureFlags.IgnoreQuality);

            if (displayLogoutButton)
            {
                m_size += new Vector2(0, MyGuiConstants.BACK_BUTTON_SIZE.Y);
            }

            AddCaption(MyTextsWrapperEnum.Profile, new Vector2(0, 0.005f));

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.145f);
            MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            float positionMultiplierY = 0;

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + positionMultiplierY * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.UserInfo, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnInfoClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            positionMultiplierY++;

            if (displayLogoutButton)
            {
                //  Don't display LOGOUT button while player is in active game - because I don't know what to do after logout in this case and it's not needed there
                Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + positionMultiplierY * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                    MyTextsWrapperEnum.Logout, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnLogoutClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
                positionMultiplierY++;
            }
            
            var backButton = new MyGuiControlButton(this, new Vector2(0, 0.2695f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(backButton);
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);
            Controls.Clear();

            if (!contructor) 
            {
                m_entityUseControl.ClearAfterRemove();
            }
            m_entityUseControl = m_entity.GetGuiControl(this);
            m_entityUseControl.SetPosition(new Vector2(-0.013f, -0.27f));
            m_entityUseControl.ParentScreen = this;

            Controls.Add(m_entityUseControl);

            var exitButton = new MyGuiControlButton(this, new Vector2(0f, 0.3490f), new Vector2(0.161f, 0.0637f),
                                                    Vector4.One,
                                                    MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Exit,
                                                    MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnExitClick,
                                                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(exitButton);            
        }
        protected override void LoadControls()
        {
            base.LoadControls();

            var pos = GetNextControlPosition() - MyGuiConstants.CONTROLS_DELTA + new Vector2(0.07f,-0.02f);

            /*
            Controls.Add(m_acquireControl = new MyGuiControlButton(this, pos , new Vector2(MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X * 2f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y), MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.AcquireControl, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAcquireControlClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, true));
            */

            m_acquireControl = new MyGuiControlButton(this, pos, new Vector2(0.14f, 0.051f),
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.AcquireControl,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnAcquireControlClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, true, true);
            m_acquireControl.Enabled = m_entity.Enabled;
            Controls.Add(m_acquireControl);
            m_acquireControl.DrawRedTextureWhenDisabled = false;

            UpdateAcquireState();
        }
        protected override void LoadControls()
        {
            Vector2 position = GetNextControlPosition() + new Vector2(0.38f, 0);

            m_onButon = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null, 
                MyTextsWrapperEnum.On, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_onButon);
            m_onButon.DrawRedTextureWhenDisabled = false;
            m_onButon.UseSwitchMode = true;

            position.X -= 0.04f;

            m_offButon = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null, 
                MyTextsWrapperEnum.Off, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_offButon);
            m_offButon.DrawRedTextureWhenDisabled = false;
            m_offButon.UseSwitchMode = true;

            UpdateEnabledState();
        }
 private void OnPreviousShipButtonClick(MyGuiControlButton sender) 
 {
     int index = m_currentShipBuilderIndex - 1;
     if (index < 0) 
     {
         index = m_smallShipsBuilders.Count - 1;
     }
     SwitchToShip(index);
 }
 private void OnNextShipButtonClick(MyGuiControlButton sender)
 {
     int index = m_currentShipBuilderIndex + 1;
     if (index > m_smallShipsBuilders.Count - 1)
     {
         index = 0;
     }
     SwitchToShip(index);
 }
        private void InitControls(StringBuilder otherSideInventoryName)
        {
            Vector2 topLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.1f);
            Vector2 topRight = new Vector2(m_size.Value.X / 2.0f - 0.05f, -m_size.Value.Y / 2.0f + 0.1f);

            List<MyGuiControlListbox> listboxToDrop = new List<MyGuiControlListbox>();
            m_listboxDropConditions = new Dictionary<MyGuiControlListbox, Predicate<MyInventoryItem>>();

            m_inventoryItemTexture = null;
            m_inventoryScrollBarTexture = MyGuiManager.GetInventoryScreenListboxScrollBarTexture();

            #region my ship's inventory and customization

            // Ship's inventory label
            Controls.Add(new MyGuiControlLabel(this,
                                               new Vector2(0.1959f, -0.357f), null,
                                               MyTextsWrapperEnum.ShipInventory, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                               MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                               MyGuiManager.GetFontMinerWarsBlue()));

            // Ship's inventory capacity label
            m_shipInventoryCapacityLabel = new MyGuiControlLabel(this,
                                                                 new Vector2(0.4f, -0.357f), null, MyTextsWrapperEnum.InventoryCapacityLabel,
                                                                 MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                 MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
            Controls.Add(m_shipInventoryCapacityLabel);

            // Ship inventory listbox
            m_shipInventoryListBox = new MyGuiControlListbox(this,
                                                             new Vector2(0.3211f, -0.1425f),
                                                             MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0,0.003f),
                                                             new Vector4(0f, 0f, 0f, 0f),
                                                             null,
                                                             MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                             INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                             INVENTORY_COLUMNS, true, true, false,
                                                             null,
                                                             null,
                                                             m_inventoryScrollBarTexture,
                                                             null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.016f, -0.017f);
            InitializeListboxDragAndAddToControls(m_shipInventoryListBox);
            listboxToDrop.Add(m_shipInventoryListBox);
            m_listboxDropConditions.Add(m_shipInventoryListBox, ii => true);

            // Left weapons inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.2637f, 0.2903f),
                                               null, MyTextsWrapperEnum.LeftWeapons, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            
            m_leftWeaponListboxes = new List<MyGuiControlListbox>();
            var leftWeapon1InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.3075f, 0.2203f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0.02f, 0f, 0f, 0f, 0, 0, 0);


            leftWeapon1InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon1InventoryListBox);
            leftWeapon1InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon1InventoryListBox);
            listboxToDrop.Add(leftWeapon1InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon1InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon2InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.2363f, 0.2303f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon2InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon2InventoryListBox);
            leftWeapon2InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon2InventoryListBox);
            listboxToDrop.Add(leftWeapon2InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon2InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon3InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.1668f, 0.2303f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon3InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon3InventoryListBox);
            leftWeapon3InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon3InventoryListBox);
            listboxToDrop.Add(leftWeapon3InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon3InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon4InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.1659f, 0.1374f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon4InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon4InventoryListBox);
            leftWeapon4InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon4InventoryListBox);
            listboxToDrop.Add(leftWeapon4InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon4InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            var leftWeapon5InventoryListBox = new MyGuiControlListbox(this,
                                                        new Vector2(-0.0946f, 0.1374f),
                                                        MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                        new Vector4(1f, 1f, 1f, 0f),
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.LeftWeapons),
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                        1, 1,
                                                        1, true, false, false,
                                                        null, null,
                                                        null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            leftWeapon5InventoryListBox.DisplayHighlight = false;
            m_leftWeaponListboxes.Add(leftWeapon5InventoryListBox);
            leftWeapon5InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(leftWeapon5InventoryListBox);
            listboxToDrop.Add(leftWeapon5InventoryListBox);
            m_listboxDropConditions.Add(leftWeapon5InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) ==
                                        false);

            // Right weapons inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.2021f, 0.2909f),
                                               null, MyTextsWrapperEnum.RighWeapons, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            
            m_rightWeaponListboxes = new List<MyGuiControlListbox>();
            var rightWeapon1InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.0877f, 0.1362f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon1InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon1InventoryListBox);
            rightWeapon1InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon1InventoryListBox);
            listboxToDrop.Add(rightWeapon1InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon1InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon2InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.1599f, 0.1362f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon2InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon2InventoryListBox);
            rightWeapon2InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon2InventoryListBox);
            listboxToDrop.Add(rightWeapon2InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon2InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon3InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.1581f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon3InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon3InventoryListBox);
            rightWeapon3InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon3InventoryListBox);
            listboxToDrop.Add(rightWeapon3InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon3InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon4InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.2293f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon4InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon4InventoryListBox);
            rightWeapon4InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon4InventoryListBox);
            listboxToDrop.Add(rightWeapon4InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon4InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            var rightWeapon5InventoryListBox = new MyGuiControlListbox(this,
                                                                     new Vector2(0.2997f, 0.2303f),
                                                                     MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                     new Vector4(1f, 1f, 1f, 0f),
                                                                     MyTextsWrapper.Get(MyTextsWrapperEnum.RighWeapons),
                                                                     MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     1, 1,
                                                                     1, true, false, false,
                                                                     null, m_inventoryItemTexture,
                                                                     null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            rightWeapon5InventoryListBox.DisplayHighlight = false;
            m_rightWeaponListboxes.Insert(0, rightWeapon5InventoryListBox);
            rightWeapon5InventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(rightWeapon5InventoryListBox);
            listboxToDrop.Add(rightWeapon5InventoryListBox);
            m_listboxDropConditions.Add(rightWeapon5InventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value) == false);

            // Engine inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.1846f),
                                               null, MyTextsWrapperEnum.Engine, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Engine inventory listbox
            m_engineInventoryListBox = new MyGuiControlListbox(this,
                                                               new Vector2(-0.0042f, 0.1256f),
                                                               MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                               MyTextsWrapper.Get(MyTextsWrapperEnum.Engine),
                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                               1, 1, 1, true, false, false,
                                                               null, m_inventoryItemTexture,
                                                               null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_engineInventoryListBox.DisplayHighlight = false;
            m_engineInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_engineInventoryListBox);
            listboxToDrop.Add(m_engineInventoryListBox);
            m_listboxDropConditions.Add(m_engineInventoryListBox,
                                        ii => ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Engine);

            // Back universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0626f, 0.3374f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncherBackTitle, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Back universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0626f, 0.3531f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncher, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));


            // Back universal launcher inventory listbox
            m_backUniversalLauncherInventoryListBox = new MyGuiControlListbox(this,
                                                                              new Vector2(-0.0605f, 0.2755f),
                                                                              MyGuiConstants.LISTBOX_SMALL_SIZE,
                                                                              new Vector4(1f, 1f, 1f, 0f),
                                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponUniversalLauncherBack),
                                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                              1, 1, 1, true, false, false,
                                                                              null, m_inventoryItemTexture,
                                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_backUniversalLauncherInventoryListBox.DisplayHighlight = false;
            m_backUniversalLauncherInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_backUniversalLauncherInventoryListBox);
            listboxToDrop.Add(m_backUniversalLauncherInventoryListBox);
            m_listboxDropConditions.Add(m_backUniversalLauncherInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 9);

            // Armor inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0573f, 0.3374f),
                                               null, MyTextsWrapperEnum.Armor, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Armor inventory listbox
            m_armorInventoryListBox = new MyGuiControlListbox(this,
                                                              new Vector2(0.0555f, 0.2755f),
                                                              MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.Armor),
                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                              1, 1, 1, true, false, false,
                                                              null, m_inventoryItemTexture,
                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_armorInventoryListBox.DisplayHighlight = false;
            m_armorInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_armorInventoryListBox);
            listboxToDrop.Add(m_armorInventoryListBox);
            m_listboxDropConditions.Add(m_armorInventoryListBox,
                                        ii => ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Armor);

            // Front universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.0323f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncherFrontTitle, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Front universal launcher inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, 0.0462f),
                                               null, MyTextsWrapperEnum.WeaponUniversalLauncher, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            // Front universal launcher inventory listbox
            m_frontUniversalLauncherInventoryListBox = new MyGuiControlListbox(this,
                                                                               new Vector2(-0.0039f, -0.0287f),
                                                                               MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                                               MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponUniversalLauncherFront),
                                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                               1, 1, 1, true, false, false,
                                                                               null, m_inventoryItemTexture,
                                                                               null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_frontUniversalLauncherInventoryListBox.DisplayHighlight = false;
            m_frontUniversalLauncherInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_frontUniversalLauncherInventoryListBox);
            listboxToDrop.Add(m_frontUniversalLauncherInventoryListBox);
            m_listboxDropConditions.Add(m_frontUniversalLauncherInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 10);

            // Drill inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0920f, 0.0547f),
                                               null, MyTextsWrapperEnum.Drill, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));

            Controls.Add(new MyGuiControlLabel(this, new Vector2(-0.0920f, 0.0715f),
                                   null, MyTextsWrapperEnum.device, MyGuiConstants.LABEL_TEXT_COLOR,
                                   MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Drill inventory listbox
            m_drillInventoryListBox = new MyGuiControlListbox(this,
                                                              new Vector2(-0.0944f, -0.0044f),
                                                              MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                              MyTextsWrapper.Get(MyTextsWrapperEnum.Drill),
                                                              MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                              1, 1, 1, true, false, false,
                                                              null, m_inventoryItemTexture,
                                                              null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_drillInventoryListBox.DisplayHighlight = false;
            m_drillInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_drillInventoryListBox);
            listboxToDrop.Add(m_drillInventoryListBox);
            m_listboxDropConditions.Add(m_drillInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        new int[] { 12, 13, 14, 15, 16, 18 }.Contains(ii.ObjectBuilderId.Value));

            // Harvesting tool inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0861f, 0.0559f),
                                               null, MyTextsWrapperEnum.Harvester, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Harvesting tool inventory label
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0861f, 0.0703f),
                                               null, MyTextsWrapperEnum.device, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()));
            // Harvesting tool inventory listbox
            m_harvestingToolInventoryListBox = new MyGuiControlListbox(this,
                                                                       new Vector2(0.0843f, -0.0044f),
                                                                       MyGuiConstants.LISTBOX_SMALL_SIZE, new Vector4(1f, 1f, 1f, 0f),
                                                                       MyTextsWrapper.Get(MyTextsWrapperEnum.WeaponHarvestingDevice),
                                                                       MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                       1, 1, 1, true, false, false,
                                                                       null, m_inventoryItemTexture,
                                                                       null, null, 0, 0, new Vector4(1f, 1f, 1f, 0f), 0f, 0f, 0f, 0f, 0, 0, 0);
            m_harvestingToolInventoryListBox.DisplayHighlight = false;
            m_harvestingToolInventoryListBox.AddRow();
            InitializeListboxDragAndAddToControls(m_harvestingToolInventoryListBox);
            listboxToDrop.Add(m_harvestingToolInventoryListBox);
            m_listboxDropConditions.Add(m_harvestingToolInventoryListBox,
                                        ii =>
                                        ii.ObjectBuilderType == MyMwcObjectBuilderTypeEnum.SmallShip_Weapon &&
                                        ii.ObjectBuilderId.Value == 11);

            #endregion

            // money information
            m_playersMoneyLabel = new MyGuiControlLabel(this, new Vector2(0.355f, 0.1450f), null,
                                                        MyTextsWrapper.Get(MyTextsWrapperEnum.Cash),
                                                        MyGuiConstants.LABEL_TEXT_COLOR,
                                                        MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE * 1.2f,
                                                        MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                                                        MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_playersMoneyLabel);            


            m_okButton = new MyGuiControlButton(this, new Vector2(0f, 0.4086f), MyGuiConstants.OK_BUTTON_SIZE,
                                   MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                   MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Close,
                                   MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                                   true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_okButton);




            if (!m_tradeForMoney)
            {
                //Take all button
                m_ButtonTakeAll = new MyGuiControlButton(this, new Vector2(-0.3095f, 0.1455f), new Vector2(0.1532f, 0.063f),
                           MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                           MyGuiManager.GetInventoryScreenButtonTextureTakeAll(), null, null, MyTextsWrapperEnum.TakeAll,
                           MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnTakeAllClick,
                           true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(m_ButtonTakeAll);
            }

            if (m_inventoryScreenType == MyGuiScreenInventoryType.GodEditor) 
            {
                m_removeAll = new MyGuiControlButton(this, new Vector2(0.29f, -0.4f), new Vector2(0.1532f, 0.063f),
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetInventoryScreenButtonTextureTakeAll(), null, null, MyTextsWrapperEnum.RemoveAll,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER, MyGuiControlButtonTextAlignment.CENTERED, OnRemoveAllClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(m_removeAll);
            }

            #region other side's inventory

            if (m_otherSideInventoryBuilder != null)
            {
                // Other side's inventory label
                Controls.Add(new MyGuiControlLabel(this,
                                                   new Vector2(-0.4126f, -0.357f), null,
                                                   otherSideInventoryName, MyGuiConstants.LABEL_TEXT_COLOR,
                                                   MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                   MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                                   MyGuiManager.GetFontMinerWarsBlue()));

                // Ship's inventory capacity label
                m_otherSideInventoryCapacityLabel = new MyGuiControlLabel(this,
                                                                     new Vector2(-0.215f, -0.357f), null, MyTextsWrapperEnum.InventoryCapacityLabel,
                                                                     MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                     MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
                Controls.Add(m_otherSideInventoryCapacityLabel);
                
                // Other side inventory listbox
                m_otherSideInventoryListBox = new MyGuiControlListbox(this,
                                                                      new Vector2(-0.2925f, -0.1425f),
                                                                      MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0, 0.003f),
                                                                      new Vector4(1f, 1f, 1f, 0f),
                                                                      null,
                                                                      MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                      INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                                      INVENTORY_COLUMNS, true, true, false,
                                                                      null,
                                                                      null,
                                                                      m_inventoryScrollBarTexture,
                                                                      null, 0, 0, new Vector4(1f, 1f, 1f, 0.0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.0155f, -0.017f);
                InitializeListboxDragAndAddToControls(m_otherSideInventoryListBox);
                listboxToDrop.Add(m_otherSideInventoryListBox);
                m_listboxDropConditions.Add(m_otherSideInventoryListBox, ii => true);                

                m_shipInventoryListBox.ItemDoubleClick += OnShipItemDoubleClick;
                m_otherSideInventoryListBox.ItemDoubleClick += OnOtherSideItemDoubleClick;
            }
            else
            {
                m_otherSideInventoryListBox = new MyGuiControlListbox(this,
                                                                      new Vector2(-0.2925f, -0.1425f),
                                                                      MyGuiConstants.LISTBOX_SMALL_SIZE + new Vector2(0, 0.003f),
                                                                      new Vector4(1f, 1f, 1f, 0f),
                                                                      otherSideInventoryName,
                                                                      MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                                      INVENTORY_COLUMNS, INVENTORY_DISPLAY_ROWS,
                                                                      INVENTORY_COLUMNS, true, true, false,
                                                                      null,
                                                                      null,
                                                                      m_inventoryScrollBarTexture,
                                                                      null, 0, 0, new Vector4(1f, 1f, 1f, 0.0f), 0.03f, 0, 0, 0, -0.005f, -0.01f, -0.0155f, -0.017f);
            }

            //Filters All Items

            const float delta = 0.028f;
            var position = new Vector2(-0.2402f, 0.0684f);
            m_sortAll = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortAllOff(),
                                             MyGuiManager.GetInventoryFilterSortAllOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowAll), true, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortAll);
            position.X -= delta;

            m_sortGods = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortGodsOff(),
                                             MyGuiManager.GetInventoryFilterSortGodsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowGods), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortGods);
            position.X -= delta;

            m_sortOres = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortOresOff(),
                                             MyGuiManager.GetInventoryFilterSortOresOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowOres), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortOres);
            position.X -= delta;

            m_sortConsumables = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortConsumablesOff(),
                                             MyGuiManager.GetInventoryFilterSortConsumablesOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowConsumables), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortConsumables);            
            position.X -= delta;

            m_sortEquipment = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortEquipmentOff(),
                                             MyGuiManager.GetInventoryFilterSortEquipmentOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowEquipment), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortEquipment);            
            position.X -= delta;

            m_sortWeapons = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortWeaponsOff(),
                                             MyGuiManager.GetInventoryFilterSortWeaponsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowWeapons), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);            
            Controls.Add(m_sortWeapons);

            if (m_otherSideInventoryBuilder != null)
            {
                m_sortAll.OnCheck += OnFilterInventorySortClick;
                m_sortGods.OnCheck += OnFilterInventorySortClick;
                m_sortOres.OnCheck += OnFilterInventorySortClick;
                m_sortConsumables.OnCheck += OnFilterInventorySortClick;
                m_sortEquipment.OnCheck += OnFilterInventorySortClick;
                m_sortWeapons.OnCheck += OnFilterInventorySortClick;
            }
            else 
            {
                m_sortAll.Checked = false;
                m_sortAll.Enabled = false;
                m_sortGods.Enabled = false;
                m_sortOres.Enabled = false;
                m_sortConsumables.Enabled = false;
                m_sortEquipment.Enabled = false;
                m_sortWeapons.Enabled = false;
            }

            //Filters My Inventory
            position = new Vector2(0.373f, 0.0684f);

            m_sortAllMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortAllOff(),
                                             MyGuiManager.GetInventoryFilterSortAllOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowAll), true, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortAllMy);
            m_sortAllMy.OnCheck += OnFilterInventoryMySortClick;
            position.X -= delta;

            m_sortGodsMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortGodsOff(),
                                             MyGuiManager.GetInventoryFilterSortGodsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowGods), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortGodsMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortGodsMy);
            position.X -= delta;

            m_sortOresMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortOresOff(),
                                             MyGuiManager.GetInventoryFilterSortOresOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowOres), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            Controls.Add(m_sortOresMy);
            m_sortOresMy.OnCheck += OnFilterInventoryMySortClick;
            position.X -= delta;

            m_sortConsumablesMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortConsumablesOff(),
                                             MyGuiManager.GetInventoryFilterSortConsumablesOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowConsumables), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortConsumablesMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortConsumablesMy);
            position.X -= delta;

            m_sortEquipmentMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortEquipmentOff(),
                                             MyGuiManager.GetInventoryFilterSortEquipmentOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowEquipment), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortEquipmentMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortEquipmentMy);
            position.X -= delta;

            m_sortWeaponsMy = new MyGuiControlCheckbox(this, position, MyGuiConstants.INVENTORY_FILTER_BUTTON_SIZE,
                                             MyGuiManager.GetInventoryFilterSortWeaponsOff(),
                                             MyGuiManager.GetInventoryFilterSortWeaponsOn(),
                                             MyTextsWrapper.Get(MyTextsWrapperEnum.InventoryShowWeapons), false, MyGuiConstants.BACK_BUTTON_TEXT_COLOR, true, null, MyGuiConstants.INVENTORY_FILTER_BUTTON_INNER_SIZE);
            m_sortWeaponsMy.OnCheck += OnFilterInventoryMySortClick;
            Controls.Add(m_sortWeaponsMy);



            #endregion

            #region combobox for select ship to customization
            if (m_smallShipsBuilders.Count > 1 && m_inventoryScreenType != MyGuiScreenInventoryType.Game)
            {
                m_shipsCombobox = new MyGuiControlCombobox(this, new Vector2(0f, topLeft.Y), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                        MyGuiConstants.COMBOBOX_TEXT_SCALE);
                m_shipsCombobox.OnSelect += OnComboboxSelectedItemChanged;
                Controls.Add(m_shipsCombobox);                
            }

            Vector2 shipButtonSize = new Vector2(128 / 1600f, 512 / 1200f) * 0.5f;
            m_previousShipButton = new MyGuiControlButton(this, new Vector2(-0.144f, -0.256f), shipButtonSize, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                               MyGuiManager.GetInventoryPreviousShip(), null, null, MyTextsWrapperEnum.EmptyDescription,
                               Vector4.Zero, 0f, MyGuiControlButtonTextAlignment.CENTERED, OnPreviousShipButtonClick,
                               false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_previousShipButton);

            m_nextShipButton = new MyGuiControlButton(this, new Vector2(0.144f, -0.256f), shipButtonSize, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                               MyGuiManager.GetInventoryNextShip(), null, null, MyTextsWrapperEnum.EmptyDescription,
                               Vector4.Zero, 0f, MyGuiControlButtonTextAlignment.CENTERED, OnNextShipButtonClick,
                               false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(m_nextShipButton);
            #endregion

            // ship's name
            m_shipNameLabel = new MyGuiControlLabel(this, 
                                                    new Vector2(0f, -0.1156f), null, new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR, 
                                                    MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_shipNameLabel);

            // initialize drag and drop
            m_dragAndDrop = new MyGuiControlListboxDragAndDrop(this, listboxToDrop, MyGuiControlPreDefinedSize.SMALL,
                                                               MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR,
                                                               MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR,
                                                               MyGuiConstants.INVENTORY_LABEL_TEXT_SCALE,
                                                               MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true);
            m_dragAndDrop.ListboxItemDropped += OnDrop;
            m_dragAndDrop.DrawBackgroundTexture = false;
            Controls.Add(m_dragAndDrop);
        }