Example #1
0
 public MyGuiScreenFake()
     :base(new Vector2(0.5f, 0.5f), new Vector4(0f, 1f, 0f, 0.5f), new Vector2(1f, 1f))
 {
     MyGuiControlList controlList = new MyGuiControlList(this, new Vector2(0f, 0f), new Vector2(0.8f, 0.5f), MyGuiConstants.DEFAULT_CONTROL_BACKGROUND_COLOR, new StringBuilder("ToolTip"), MyGuiManager.GetBlankTexture());
     Controls.Add(controlList);
     List<MyGuiControlBase> fakeControls = new List<MyGuiControlBase>();
     MyGuiControlParent parent1 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 0f, 1f), new StringBuilder("Parent1"), null);
     parent1.Controls.Add(new MyGuiControlTextbox(parent1, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "AAA", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     parent1.Controls.Add(new MyGuiControlCheckbox(parent1, new Vector2(0f, 0.07f), MyGuiConstants.CHECKBOX_SIZE, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR));            
     fakeControls.Add(parent1);
     MyGuiControlParent parent2 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 1f, 0f, 1f), new StringBuilder("Parent2"), null);
     parent2.Controls.Add(new MyGuiControlTextbox(parent2, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "CCC", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     MyGuiControlCombobox combobox1 = new MyGuiControlCombobox(parent2, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false);
     combobox1.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 "));
     combobox1.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 "));
     combobox1.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 "));
     combobox1.AddItem(3, new StringBuilder("Item4"));
     combobox1.AddItem(4, new StringBuilder("Item5"));
     combobox1.AddItem(5, new StringBuilder("Item6"));
     combobox1.AddItem(6, new StringBuilder("Item7"));
     combobox1.AddItem(7, new StringBuilder("Item8"));
     combobox1.AddItem(8, new StringBuilder("Item9"));
     combobox1.AddItem(9, new StringBuilder("Item10"));
     combobox1.AddItem(10, new StringBuilder("Item11"));
     combobox1.AddItem(11, new StringBuilder("Item12"));
     combobox1.AddItem(12, new StringBuilder("Item13"));
     parent2.Controls.Add(combobox1);
     fakeControls.Add(parent2);
     MyGuiControlParent parent3 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(0f, 0f, 1f, 1f), new StringBuilder("Parent3"), null);
     parent3.Controls.Add(new MyGuiControlTextbox(parent3, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "EEE", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     MyGuiControlCombobox combobox2 = new MyGuiControlCombobox(parent3, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 10, false, true, false);
     combobox2.AddItem(0, new StringBuilder("Item1 Item1 Item1 Item1 Item1 Item1 Item1 "));
     combobox2.AddItem(1, new StringBuilder("Item2 Item2 Item2 Item2 Item2 Item2 Item2 "));
     combobox2.AddItem(2, new StringBuilder("Item3 Item3 Item3 Item3 Item3 Item3 Item3 "));
     combobox2.AddItem(3, new StringBuilder("Item4"));
     combobox2.AddItem(4, new StringBuilder("Item5"));
     combobox2.AddItem(5, new StringBuilder("Item6"));
     combobox2.AddItem(6, new StringBuilder("Item7"));
     combobox2.AddItem(7, new StringBuilder("Item8"));
     combobox2.AddItem(8, new StringBuilder("Item9"));
     combobox2.AddItem(9, new StringBuilder("Item10"));
     combobox2.AddItem(10, new StringBuilder("Item11"));
     combobox2.AddItem(11, new StringBuilder("Item12"));
     combobox2.AddItem(12, new StringBuilder("Item13"));
     parent3.Controls.Add(combobox2);
     fakeControls.Add(parent3);
     MyGuiControlParent parent4 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 0f, 1f, 1f), new StringBuilder("Parent4"), null);
     parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "GGG", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     parent4.Controls.Add(new MyGuiControlTextbox(parent4, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "HHH", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     fakeControls.Add(parent4);
     MyGuiControlParent parent5 = new MyGuiControlParent(this, Vector2.Zero, new Vector2(0.4f, 0.2f), new Vector4(1f, 1f, 0f, 1f), new StringBuilder("Parent5"), null);
     parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0f), MyGuiControlPreDefinedSize.LARGE, "III", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     parent5.Controls.Add(new MyGuiControlTextbox(parent5, new Vector2(0f, 0.07f), MyGuiControlPreDefinedSize.LARGE, "JJJ", 50, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, 0.7f, MyGuiControlTextboxType.NORMAL));
     fakeControls.Add(parent5);
     controlList.InitControls(fakeControls);
 }
        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);
        }