public MyGuiScreenEntityUseSolo(IMyHasGuiControl entity)
     : base(new Vector2(0.505f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.57f, 0.91f), true, MyGuiManager.GetHubBackground())
 {
     m_entity = entity;
     RecreateControls(true);
     MyGuiScreenGamePlay.Static.ReleasedControlOfEntity += OnGameReleasedControlOfEntity;
     MySession.PlayerShip.OnDie += OnPlayerShipDie;
     entity.GetEntity().OnMarkForClose += OnEntityMarkForClose;
 }
 public MyGuiScreenEntityUseSolo(IMyHasGuiControl entity)
     : base(new Vector2(0.505f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.57f, 0.91f), true, MyGuiManager.GetHubBackground()) 
 {
     m_entity = entity;            
     RecreateControls(true);
     MyGuiScreenGamePlay.Static.ReleasedControlOfEntity += OnGameReleasedControlOfEntity;
     MySession.PlayerShip.OnDie += OnPlayerShipDie;
     entity.GetEntity().OnMarkForClose += OnEntityMarkForClose;
 }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            Controls.Clear();

            m_entitiesGuiList = new MyGuiControlList(
                this,
                new Vector2(0.0034f, -0.030f),
                new Vector2(0.489f, 0.65f),
                Vector4.Zero,
                null,//MyTextsWrapper.Get(MyTextsWrapperEnum.SecurityControlHUB),
                MyGuiManager.GetBlankTexture(),
                new Vector2(0.01f, 0.0f));

            if (!contructor)
            {
                foreach (var entityGui in m_entitiesGui)
                {
                    entityGui.ClearAfterRemove();
                }
            }
            m_entitiesGui.Clear();
            foreach (IMyUseableEntity connectedEntity in m_prefabSecurityControlHUB.ConnectedEntities)
            {
                MyEntity entity = connectedEntity as MyEntity;

                if (!entity.Visible)
                {
                    continue;
                }
                Debug.Assert((connectedEntity.UseProperties.UseType & MyUseType.FromHUB) != 0);
                IMyHasGuiControl entityWithGuiControl = connectedEntity as IMyHasGuiControl;
                Debug.Assert(entityWithGuiControl != null);
                // if entity is not hacked and could be hacked from HUB, then try hack it
                if (!connectedEntity.UseProperties.IsHacked &&
                    (connectedEntity.UseProperties.HackType & MyUseType.FromHUB) != 0)
                {
                    if (m_useBy.HackingTool != null &&
                        m_useBy.HackingTool.HackingLevel >= connectedEntity.UseProperties.HackingLevel)
                    {
                        connectedEntity.UseProperties.IsHacked = true;
                    }
                }
                MyGuiControlEntityUse entityGui = entityWithGuiControl.GetGuiControl(m_entitiesGuiList);
                entityGui.ParentScreen = this;
                m_entitiesGui.Add(entityGui);
            }
            m_entitiesGuiList.InitControls(m_entitiesGui);
            Controls.Add(m_entitiesGuiList);

            var exitButton = new MyGuiControlButton(
                this,
                new Vector2(0f, 0.3740f),
                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);
        }