public void AddScreen(MyGuiScreenBase screen)
 {
     if (!Loaded)
         return;
     MyGuiSandbox.AddScreen(screen);
     _screens.Add(screen);
 }
 /// <summary>
 /// Seamlessly changes between two screens
 /// </summary>
 /// <param name="focusedScreen">Currently focused screen</param>
 /// <param name="exchangedFor">New screen</param>
 private static void SeamlesslyChangeScreen(MyGuiScreenBase focusedScreen, MyGuiScreenBase exchangedFor)
 {
     focusedScreen.SkipTransition = true;
     focusedScreen.CloseScreen();
     exchangedFor.SkipTransition = true;
     MyScreenManager.AddScreenNow(exchangedFor);
 }
        public static MyGuiScreenStartSessionProgress CurrentScreen = null;    //  This is always filled with reference to actual instance of this scree. If there isn't, it's null.


        public MyGuiScreenStartSessionProgress(MyMwcStartSessionRequestTypeEnum sessionType, MyTextsWrapperEnum progressText, MyMwcSectorIdentifier?sectorIdentifier, MyGameplayDifficultyEnum difficulty, string checkpointName, MyGuiScreenBase closeAfter) :
            base(progressText, false)
        {
            // TODO: Not ready yet
            //Debug.Assert(sessionType != MyMwcStartSessionRequestTypeEnum.NEW_STORY && sessionType != MyMwcStartSessionRequestTypeEnum.LOAD_CHECKPOINT, "Invalid operation, call OndrejP");

            m_sectorIdentifier    = sectorIdentifier;
            m_sessionType         = sessionType;
            m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN;
            m_closeAfter          = closeAfter;
            m_difficulty          = difficulty;
            m_checkpointName      = checkpointName;
            CurrentScreen         = this;

            OnSuccessEnter = new Action <MyGuiScreenGamePlayType, MyMwcStartSessionRequestTypeEnum, MyMwcObjectBuilder_Checkpoint>((screenType, sessType, checkpoint) =>
            {
                var newGameplayScreen = new MyGuiScreenGamePlay(screenType, null, checkpoint.CurrentSector, checkpoint.SectorObjectBuilder.Version, sessType);
                var loadScreen        = new MyGuiScreenLoading(newGameplayScreen, MyGuiScreenGamePlay.Static);

                if (sessType == MyMwcStartSessionRequestTypeEnum.NEW_STORY)
                {
                    loadScreen.AddEnterSectorResponse(checkpoint, MyMissionID.EAC_SURVEY_SITE);
                }
                else
                {
                    loadScreen.AddEnterSectorResponse(checkpoint, null);
                }

                MyGuiManager.AddScreen(loadScreen);
            });
        }
Ejemplo n.º 4
0
        public MyGuiIngameEditorControls(MyGuiScreenBase parentScreen) : base(parentScreen)
        {
            m_oreName  = new StringBuilder();
            m_oreCount = new StringBuilder();

            m_lastUpdateTime = 0;
        }
Ejemplo n.º 5
0
 public MyGuiScreenChoosePlay(MyGuiScreenBase closeAfterSuccessfulEnter)
     : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.25f, 0.35f))
 {
     m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
     m_enableBackgroundFade      = true;
     AddCaption(MyTextsWrapperEnum.ChooseGameType, new Vector2(0, 0.005f));
 }
Ejemplo n.º 6
0
 private void joinGameScreen_Closed(MyGuiScreenBase source, bool isUnloading)
 {
     if (source.Cancelled)
     {
         base.State     = MyGuiScreenState.OPENING;
         source.Closed -= joinGameScreen_Closed;
     }
 }
Ejemplo n.º 7
0
 public override void OnScreenOrderChanged(MyGuiScreenBase oldLast, MyGuiScreenBase newLast)
 {
     base.OnScreenOrderChanged(oldLast, newLast);
     if (newLast == this)
     {
         CheckContinueButtonVisibility();
     }
 }
 public MyGuiScreenEditorLoadSectorObjectsProgress(MyGuiScreenBase parentScreen, MyTextsWrapperEnum loadingText, string playerName, MyMwcSectorIdentifier sectorIdentifier)
     : base(loadingText, false)
 {
     CurrentScreen      = this;
     m_parentScreen     = parentScreen;
     m_playerName       = playerName;
     m_sectorIdentifier = sectorIdentifier;
 }
Ejemplo n.º 9
0
        public MyGuiScreenSelectEditor(MyGuiScreenBase closeAfterSuccessfulEnter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 695 / 1200f), false, MyGuiManager.GetSelectEditorBackground())
        {
            m_enableBackgroundFade      = true;
            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;

            AddCaption(MyTextsWrapperEnum.Editor, new Vector2(0, 0.005f));
        }
Ejemplo n.º 10
0
        public MyGuiScreenSelectStory(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;

            AddControls();
        }
Ejemplo n.º 11
0
        static MyTimerBlock()
        {
            m_openedToolbars = new List <MyToolbar>();

            var silent = new MyTerminalControlCheckbox <MyTimerBlock>("Silent", MySpaceTexts.BlockPropertyTitle_Silent, MySpaceTexts.ToolTipTimerBlock_Silent);

            silent.Getter = (x) => x.Silent;
            silent.Setter = (x, v) => x.Silent = v;
            silent.EnableAction();
            MyTerminalControlFactory.AddControl(silent);

            var slider = new MyTerminalControlSlider <MyTimerBlock>("TriggerDelay", MySpaceTexts.TerminalControlPanel_TimerDelay, MySpaceTexts.TerminalControlPanel_TimerDelay);

            slider.SetLogLimits(1, 60 * 60);
            slider.DefaultValue = 10;
            slider.Enabled      = (x) => !x.IsCountingDown;
            slider.Getter       = (x) => x.TriggerDelay;
            slider.Setter       = (x, v) => x.m_timerSync.Value = ((int)(Math.Round(v, 1) * 1000));
            slider.Writer       = (x, sb) => MyValueFormatter.AppendTimeExact(Math.Max(x.m_countdownMsStart, 1000) / 1000, sb);
            slider.EnableActions();
            MyTerminalControlFactory.AddControl(slider);

            var toolbarButton = new MyTerminalControlButton <MyTimerBlock>("OpenToolbar", MySpaceTexts.BlockPropertyTitle_TimerToolbarOpen, MySpaceTexts.BlockPropertyTitle_TimerToolbarOpen,
                                                                           delegate(MyTimerBlock self)
            {
                m_openedToolbars.Add(self.Toolbar);
                if (MyGuiScreenCubeBuilder.Static == null)
                {
                    m_shouldSetOtherToolbars          = true;
                    MyToolbarComponent.CurrentToolbar = self.Toolbar;
                    MyGuiScreenBase screen            = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
                    MyToolbarComponent.AutoUpdate     = false;
                    screen.Closed += (source) =>
                    {
                        MyToolbarComponent.AutoUpdate = true;
                        m_openedToolbars.Clear();
                    };
                    MyGuiSandbox.AddScreen(screen);
                }
            });

            MyTerminalControlFactory.AddControl(toolbarButton);

            var triggerButton = new MyTerminalControlButton <MyTimerBlock>("TriggerNow", MySpaceTexts.BlockPropertyTitle_TimerTrigger, MySpaceTexts.BlockPropertyTitle_TimerTrigger, (x) => x.OnTrigger());

            triggerButton.EnableAction();
            MyTerminalControlFactory.AddControl(triggerButton);

            var startButton = new MyTerminalControlButton <MyTimerBlock>("Start", MySpaceTexts.BlockPropertyTitle_TimerStart, MySpaceTexts.BlockPropertyTitle_TimerStart, (x) => x.StartBtn());

            startButton.EnableAction();
            MyTerminalControlFactory.AddControl(startButton);

            var stopButton = new MyTerminalControlButton <MyTimerBlock>("Stop", MySpaceTexts.BlockPropertyTitle_TimerStop, MySpaceTexts.BlockPropertyTitle_TimerStop, (x) => x.StopBtn());

            stopButton.EnableAction();
            MyTerminalControlFactory.AddControl(stopButton);
        }
 public void RemoveScreen(MyGuiScreenBase screen)
 {
     Scheduler.AddScheduledCallback(dt =>
     {
         screen.CloseScreenNow();
         MyGuiSandbox.RemoveScreen(screen);
     }, 0);
     _screens.Remove(screen);
 }
        public MyGuiEditorControlsBase(MyGuiScreenBase parentScreen)
        {
            m_parentScreen   = parentScreen;
            m_editorControls = new List <MyGuiControlBase>(10);
            m_toolbarButtons = new MyGuiControlButton[Enum.GetValues(typeof(EditorToolBarButtonType)).Length];

            m_isDemoUser           = MyClientServer.LoggedPlayer == null || MyClientServer.LoggedPlayer.IsDemoUser();
            m_canAccessStoryEditor = MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetCanAccessEditorForStory();
        }
Ejemplo n.º 14
0
        private static void OnInventoryScreenClosed(MyGuiScreenBase screen)
        {
            Clear();

            if (InventoryScreenClosed != null)
            {
                InventoryScreenClosed(screen);
            }
        }
        /// <summary>
        /// Button callback for the workshop world button, to open the workshop world screen
        /// </summary>
        /// <param name="myGuiControlButton">Clicked button</param>
        private void OnWorkshopButtonClick(MyGuiControlButton myGuiControlButton)
        {
            MyGuiScreenBase screenWithFocus = MyScreenManager.GetScreenWithFocus();

            if (!(screenWithFocus is MyGuiScreenNewWorkshopGame))
            {
                SeamlesslyChangeScreen(screenWithFocus, new PluginGuiScreenWorkshopGame());
            }
        }
        /// <summary>
        /// Button callback for the custom world button, to open the custom world screen
        /// </summary>
        /// <param name="myGuiControlButton">Clicked button</param>
        private void OnCustomWorldButtonClick(MyGuiControlButton myGuiControlButton)
        {
            MyGuiScreenBase screenWithFocus = MyScreenManager.GetScreenWithFocus();

            if (!(screenWithFocus is MyGuiScreenWorldSettings))
            {
                SeamlesslyChangeScreen(screenWithFocus, new PluginWorldSettings());
            }
        }
        public static MyGuiScreenSelectSandboxProgress CurrentScreen = null;    //  This is always filled with reference to actual instance of this scree. If there isn't, it's null.


        public MyGuiScreenSelectSandboxProgress(MyMwcSelectSectorRequestTypeEnum selectSandboxType, MyTextsWrapperEnum progressText, MyGuiScreenBase openAfterSuccessfulEnter, string findPlayerName, AddResponseDelegate responseHandler) :
            base(progressText, false)
        {
            m_selectSandboxType        = selectSandboxType;
            m_backgroundFadeColor      = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN;
            m_openAfterSuccessfulEnter = openAfterSuccessfulEnter;
            m_findPlayerName           = findPlayerName;
            CurrentScreen     = this;
            m_responseHandler = responseHandler;
        }
Ejemplo n.º 18
0
        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 bool CloseScreen()
        {
            bool ret = base.CloseScreen();

            if (ret == true)
            {
                CurrentScreen = null;
            }

            return(ret);
        }
 public MyGuiScreenEnterFriendSectorMap(MyMwcStartSessionRequestTypeEnum startSessionType, MyTextsWrapperEnum startSessionProgressText, MyGuiScreenBase closeAfterSuccesfullEnter)
     : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(700f / 1600f, 700 / 1200f))
 {
     m_startSessionType          = startSessionType;
     m_startSessionProgressText  = startSessionProgressText;
     m_enableBackgroundFade      = true;
     m_sectorIdentifiers         = null;
     m_closeAfterSuccessfulEnter = closeAfterSuccesfullEnter;
     m_backgroundTexture         = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ConfigWheelBackground", flags: TextureFlags.IgnoreQuality);
     RecreateControls();
 }
        public static T EnsureFocusedScreen <T>() where T : MyGuiScreenBase
        {
            MyGuiScreenBase baseScreen = MyScreenManager.GetScreenWithFocus();

            if (!(baseScreen is T screen))
            {
                throw new InvalidOperationException(
                          $"Screen of type {typeof(T)} does not have focus, {baseScreen} has.");
            }
            return(screen);
        }
Ejemplo n.º 22
0
 public void ScreenAdded(MyGuiScreenBase screenBase)
 {
     if (screenBase.GetType() == MyPerGameSettings.GUI.MainMenu && Configuration.Plugin.Get(c => c.ShowMenuPopup))
     {
         //Configuration.Config.Set(c => c.ShowMenuPopup, false);
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info,
                                                              MyMessageBoxButtonsType.OK,
                                                              new StringBuilder(
                                                                  "Welcome to StreamEngineer\nTo get started you need to do some changes to the 'settings.toml' in the plugin folder.\nYou need to restart after changing any service settings,\nyou don't need to restart for settings related to events."),
                                                              new StringBuilder("StreamEngineer")));
     }
 }
Ejemplo n.º 23
0
        private void ShowRetryDialog(Exception exception)
        {
            var messageBoxCaption = MyTextsWrapper.Get(RetryCaptionText);
            var messageBoxMessage = MyTextsWrapper.Get(RetryMessageText);

            Vector2 buttonSize = new Vector2(MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X * 2.4f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);

            m_retryScreen = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyMessageBoxButtonsType.YES_NO, messageBoxMessage, messageBoxCaption, null, RetryButtonText,
                                                      RetryCancelText, (callbackReturn) => MessageBoxCallback(exception, callbackReturn), false, buttonSize);

            MyGuiManager.AddScreen(m_retryScreen);
        }
Ejemplo n.º 24
0
        public override bool CloseScreen()
        {
            bool ret = base.CloseScreen();

            if (ret == true && m_screenToShowAfter != null)
            {
                //  Screen is loaded so now we can add it to other thread
                MyGuiManager.AddScreen(m_screenToShowAfter);
                m_screenToShowAfter = null;
            }

            return(ret);
        }
        public MyGuiScreenRegisterProgress(string playerName, string password, string email, bool sendMeNewsletters, MyGuiScreenBase openAfterSuccesfullRegistration, MyGuiScreenBase parentScreen)
            : base(MyTextsWrapperEnum.RegistrationInProgressPleaseWait, true)
        {
            CurrentScreen       = this;
            m_playerName        = playerName;
            m_password          = password;
            m_email             = email;
            m_sendMeNewsletters = sendMeNewsletters;
            m_openAfterSuccesfullRegistration = openAfterSuccesfullRegistration;
            m_parentScreen = parentScreen;

            m_phase           = MyGuiScreenRegisterProgressPhases.NOTHING;
            m_lastTimeMessage = MyMinerGame.TotalTimeInMilliseconds;
        }
 public MyGuiScreenTextPanel(
     string missionTitle                = null,
     string currentObjectivePrefix      = null,
     string currentObjective            = null,
     string description                 = null,
     Action <ResultEnum> resultCallback = null,
     Action saveCodeCallback            = null,
     string okButtonCaption             = null,
     bool editable = false,
     MyGuiScreenBase previousScreen = null)
     : base(missionTitle, currentObjectivePrefix, currentObjective, description, resultCallback, okButtonCaption, null, null, editable)
 {
     CanHideOthers = editable;
 }
        public MyGuiScreenChooseDifficulty(MyGuiScreenBase closeAfterSuccessfulEnter, string checkpointName)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 640 / 1200f), false, MyGuiManager.GetSelectEditorBackground())

        {
            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
            m_checkpointName            = checkpointName;

            m_enableBackgroundFade = true;
            m_canHaveFocus         = true;
            m_closeOnEsc           = true;
            m_isTopMostScreen      = true;
            m_drawEvenWithoutFocus = true;

            AddCaption(MyTextsWrapperEnum.DifficultyCaption, new Vector2(0, 0.005f));
        }
        public MyGuiScreenLoginProgress(string playerName, string password, MyGuiScreenBase openAfterSuccessfulLogin, MyGuiScreenBase closeAfterSuccesfulLogin)
            : base(MyTextsWrapperEnum.LoginInProgressPleaseWait, true)
        {
            m_openAfterSuccessfulLogin = openAfterSuccessfulLogin;
            m_closeAfterSuccesfulLogin = closeAfterSuccesfulLogin;

            CurrentScreen = this;

            //  Reset everytime
            LoginResponse = null;

            m_playerName = playerName;
            m_password   = password;
            PasswordHash = MyMwcUtils.GetHashedPassword(m_password);
        }
Ejemplo n.º 29
0
        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyButtonPanel>())
            {
                return;
            }
            base.CreateTerminalControls();
            var checkAccess = new MyTerminalControlCheckbox <MyButtonPanel>("AnyoneCanUse", MySpaceTexts.BlockPropertyText_AnyoneCanUse, MySpaceTexts.BlockPropertyDescription_AnyoneCanUse);

            checkAccess.Getter = (x) => x.AnyoneCanUse;
            checkAccess.Setter = (x, v) => x.AnyoneCanUse = v;
            checkAccess.EnableAction();
            MyTerminalControlFactory.AddControl(checkAccess);

            var toolbarButton = new MyTerminalControlButton <MyButtonPanel>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_SensorToolbarOpen, MySpaceTexts.BlockPropertyDescription_SensorToolbarOpen,
                                                                            delegate(MyButtonPanel self)
            {
                m_openedToolbars.Add(self.Toolbar);
                if (MyGuiScreenCubeBuilder.Static == null)
                {
                    m_shouldSetOtherToolbars          = true;
                    MyToolbarComponent.CurrentToolbar = self.Toolbar;
                    MyGuiScreenBase screen            = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
                    MyToolbarComponent.AutoUpdate     = false;
                    screen.Closed += (source) =>
                    {
                        MyToolbarComponent.AutoUpdate = true;
                        m_openedToolbars.Clear();
                    };
                    MyGuiSandbox.AddScreen(screen);
                }
            });

            MyTerminalControlFactory.AddControl(toolbarButton);

            var buttonsList = new MyTerminalControlListbox <MyButtonPanel>("ButtonText", MySpaceTexts.BlockPropertyText_ButtonList, MySpaceTexts.Blank);

            buttonsList.ListContent  = (x, list1, list2) => x.FillListContent(list1, list2);
            buttonsList.ItemSelected = (x, y) => x.SelectButtonToName(y);
            MyTerminalControlFactory.AddControl(buttonsList);

            var customButtonName = new MyTerminalControlTextbox <MyButtonPanel>("ButtonName", MySpaceTexts.BlockPropertyText_ButtonName, MySpaceTexts.Blank);

            customButtonName.Getter = (x) => x.GetButtonName();
            customButtonName.Setter = (x, v) => x.SetCustomButtonName(v);
            customButtonName.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(customButtonName);
        }
Ejemplo n.º 30
0
        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated <MyAirVent>())
            {
                return;
            }
            base.CreateTerminalControls();
            var isDepressurizing = new MyTerminalControlOnOffSwitch <MyAirVent>("Depressurize", MySpaceTexts.BlockPropertyTitle_Depressurize, MySpaceTexts.BlockPropertyDescription_Depressurize);

            isDepressurizing.Getter = (x) => x.IsDepressurizing;
            isDepressurizing.Setter = (x, v) => { x.IsDepressurizing = v; x.UpdateEmissivity(); };
            isDepressurizing.EnableToggleAction();
            isDepressurizing.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(isDepressurizing);

            var toolbarButton = new MyTerminalControlButton <MyAirVent>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_SensorToolbarOpen, MySpaceTexts.BlockPropertyDescription_SensorToolbarOpen,
                                                                        delegate(MyAirVent self)
            {
                if (self.m_onFullAction != null)
                {
                    self.m_actionToolbar.SetItemAtIndex(0, self.m_onFullAction);
                }
                if (self.m_onEmptyAction != null)
                {
                    self.m_actionToolbar.SetItemAtIndex(1, self.m_onEmptyAction);
                }

                self.m_actionToolbar.ItemChanged += self.Toolbar_ItemChanged;
                if (MyGuiScreenCubeBuilder.Static == null)
                {
                    MyToolbarComponent.CurrentToolbar = self.m_actionToolbar;
                    MyGuiScreenBase screen            = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, self);
                    MyToolbarComponent.AutoUpdate     = false;

                    screen.Closed += (source) =>
                    {
                        MyToolbarComponent.AutoUpdate     = true;
                        self.m_actionToolbar.ItemChanged -= self.Toolbar_ItemChanged;
                        self.m_actionToolbar.Clear();
                    };
                    MyGuiSandbox.AddScreen(screen);
                }
            });

            toolbarButton.SupportsMultipleBlocks = false;
            MyTerminalControlFactory.AddControl(toolbarButton);
        }