Пример #1
0
        protected MyGuiControlCheckbox AddCheckBox(StringBuilder text, MyGuiScreenDebugBase screen, List<MyGuiControlBase> controlGroup = null, Vector4? color = null)
        {
            MyGuiControlCheckbox checkBox = addCheckBox(text, true, controlGroup, color);

            checkBox.Checked = screen.GetState() == MyGuiScreenState.OPENED;
            checkBox.UserData = screen;

            checkBox.OnCheck = delegate(MyGuiControlCheckbox sender)
            {
                MyGuiScreenDebugBase screenSender = sender.UserData as MyGuiScreenDebugBase;
                if (sender.Checked)
                {
                    MyGuiManager.AddScreen(screenSender);
                    screenSender.SetState(MyGuiScreenState.OPENING);
                    screenSender.LoadContent();
                    screenSender.RecreateControls(false);
                }
                else
                {
                    screenSender.CloseScreen();
                }
            };

            return checkBox;
        }
Пример #2
0
        protected MyGuiControlCheckbox AddCheckBox(StringBuilder text, MyGuiScreenDebugBase screen, List <MyGuiControlBase> controlGroup = null, Vector4?color = null)
        {
            MyGuiControlCheckbox checkBox = addCheckBox(text, true, controlGroup, color);

            checkBox.Checked  = screen.GetState() == MyGuiScreenState.OPENED;
            checkBox.UserData = screen;

            checkBox.OnCheck = delegate(MyGuiControlCheckbox sender)
            {
                MyGuiScreenDebugBase screenSender = sender.UserData as MyGuiScreenDebugBase;
                if (sender.Checked)
                {
                    MyGuiManager.AddScreen(screenSender);
                    screenSender.SetState(MyGuiScreenState.OPENING);
                    screenSender.LoadContent();
                    screenSender.RecreateControls(false);
                }
                else
                {
                    screenSender.CloseScreen();
                }
            };

            return(checkBox);
        }
        protected void AddGroupBox(StringBuilder text, MyGuiScreenDebugBase screen, List <MyGuiControlBase> controlGroup = null)
        {
            MyGuiControlCheckbox checkBox = AddCheckBox(text, screen, controlGroup);

            s_groupList.Add(checkBox);

            checkBox.OnCheck += delegate(MyGuiControlCheckbox sender)
            {
                if (sender.Checked)
                {
                    foreach (MyGuiControlCheckbox chb in s_groupList)
                    {
                        if (chb != sender)
                        {
                            chb.Checked = false;
                        }
                    }
                }
            };
        }
        protected void AddGroupBox(StringBuilder text, MyGuiScreenDebugBase screen, List<MyGuiControlBase> controlGroup = null)
        {
            MyGuiControlCheckbox checkBox = AddCheckBox(text, screen, controlGroup);
            s_groupList.Add(checkBox);

            checkBox.OnCheck += delegate(MyGuiControlCheckbox sender)
            {
                if (sender.Checked)
                {
                    foreach (MyGuiControlCheckbox chb in s_groupList)
                    {
                        if (chb != sender)
                            chb.Checked = false;
                    }
                }
            };
        }