protected override void OnClosed() { MyGuiScreenGamePlay.ActiveGameplayScreen = null; m_interactedEntity = null; MyAnalyticsHelper.ReportActivityEnd(m_instance.m_user, "show_terminal"); if (MyFakes.ENABLE_GPS) m_controllerGps.Close(); m_controllerControlPanel.Close(); m_controllerInventory.Close(); m_controllerProduction.Close(); m_controllerInfo.Close(); Controls.Clear(); m_terminalTabs = null; m_controllerInventory = null; if (MyFakes.SHOW_FACTIONS_GUI) { m_controllerFactions.Close(); } if (MyFakes.ENABLE_TERMINAL_PROPERTIES) { m_controllerProperties.Close(); m_controllerProperties.ButtonClicked -= PropertiesButtonClicked; m_propertiesTableParent = null; m_propertiesTopMenuParent = null; } if (MyFakes.ENABLE_COMMUNICATION) { m_controllerChat.Close(); } m_instance = null; m_screenOpen = false; base.OnClosed(); }
private void CreateTabs() { m_terminalTabs = new MyGuiControlTabControl() { Position = new Vector2(-0f, -0.36f), Size = new Vector2(0.93f, 0.78f), Name = "TerminalTabs", OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP }; if (MyFakes.ENABLE_COMMUNICATION) { m_terminalTabs.TabButtonScale = 0.875f; } var inventoryPage = m_terminalTabs.GetTabSubControl(0); var controlPanelPage = m_terminalTabs.GetTabSubControl(1); var productionPage = m_terminalTabs.GetTabSubControl(2); var infoPage = m_terminalTabs.GetTabSubControl(3); var factionsPage = m_terminalTabs.GetTabSubControl(4); MyGuiControlTabPage communicationsPage = null; if (MyFakes.ENABLE_COMMUNICATION) { communicationsPage = m_terminalTabs.GetTabSubControl(5); } MyGuiControlTabPage gpsPage = null; if (MyFakes.ENABLE_GPS) { gpsPage = m_terminalTabs.GetTabSubControl(6); m_terminalTabs.TabButtonScale = 0.75f; } CreateInventoryPageControls(inventoryPage); CreateControlPanelPageControls(controlPanelPage); CreateProductionPageControls(productionPage); CreateInfoPageControls(infoPage); CreateFactionsPageControls(factionsPage); if (MyFakes.ENABLE_GPS) CreateGpsPageControls(gpsPage); if (MyFakes.ENABLE_COMMUNICATION) { CreateChatPageControls(communicationsPage); } MyCubeGrid grid = (InteractedEntity != null) ? InteractedEntity.Parent as MyCubeGrid : null; m_colorHelper.Init(grid); if (m_controllerInventory == null) m_controllerInventory = new MyTerminalInventoryController(); else m_controllerInventory.Close(); if (m_controllerControlPanel == null) m_controllerControlPanel = new MyTerminalControlPanel(); else m_controllerControlPanel.Close(); if (m_controllerProduction == null) m_controllerProduction = new MyTerminalProductionController(); else m_controllerProduction.Close(); if (m_controllerInfo == null) m_controllerInfo = new MyTerminalInfoController(); else m_controllerInfo.Close(); if (m_controllerFactions == null) m_controllerFactions = new MyTerminalFactionController(); else m_controllerFactions.Close(); if (MyFakes.ENABLE_GPS) { if (m_controllerGps == null) m_controllerGps = new MyTerminalGpsController(); else m_controllerGps.Close(); } if (MyFakes.ENABLE_COMMUNICATION) { if (m_controllerChat == null) m_controllerChat = new MyTerminalChatController(); else m_controllerChat.Close(); } m_controllerInventory.Init(inventoryPage, m_user, InteractedEntity, m_colorHelper); m_controllerControlPanel.Init(controlPanelPage, MySession.Static.LocalHumanPlayer, grid, InteractedEntity as MyTerminalBlock, m_colorHelper); m_controllerProduction.Init(productionPage, grid); m_controllerInfo.Init(infoPage, InteractedEntity != null ? InteractedEntity.Parent as MyCubeGrid : null); m_controllerFactions.Init(factionsPage); if (MyFakes.ENABLE_GPS) m_controllerGps.Init(gpsPage); if (MyFakes.ENABLE_COMMUNICATION) { m_controllerChat.Init(communicationsPage); } m_terminalTabs.SelectedPage = (int)m_initialPage; if (m_terminalTabs.SelectedPage != (int)MyTerminalPageEnum.Properties && !m_terminalTabs.GetTabSubControl(m_terminalTabs.SelectedPage).Enabled) m_terminalTabs.SelectedPage = m_terminalTabs.Controls.IndexOf(controlPanelPage); CloseButtonEnabled = true; CloseButtonOffset = new Vector2(-0.02f, 0.012f); //SetDefaultCloseButtonOffset(); Controls.Add(m_terminalTabs); if(MyFakes.ENABLE_TERMINAL_PROPERTIES) m_terminalTabs.OnPageChanged += tabs_OnPageChanged; }
public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); string filepath = MakeScreenFilepath("JoinScreen"); MyObjectBuilder_GuiScreen objectBuilder; var fsPath = Path.Combine(MyFileSystem.ContentPath, filepath); MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder); Init(objectBuilder); m_joinGameTabs = Controls.GetControlByName("JoinGameTabs") as MyGuiControlTabControl; MyDebug.AssertDebug(m_joinGameTabs != null); m_joinGameTabs.TabButtonScale = 0.86f; m_joinGameTabs.OnPageChanged += joinGameTabs_OnPageChanged; joinGameTabs_OnPageChanged(); }