// Listen for connection failures void ConnectionStateChanged(OrderManager om) { if (om.Connection.ConnectionState == ConnectionState.NotConnected) { // Show connection failed dialog Ui.CloseWindow(); Action onConnect = () => { Game.OpenWindow("SERVER_LOBBY", new WidgetArgs() { { "onExit", onExit }, { "onStart", onStart }, { "skirmishMode", false } }); }; Action <string> onRetry = password => ConnectionLogic.Connect(om.Host, om.Port, password, onConnect, onExit); var switchPanel = om.ServerExternalMod != null ? "CONNECTION_SWITCHMOD_PANEL" : "CONNECTIONFAILED_PANEL"; Ui.OpenWindow(switchPanel, new WidgetArgs() { { "orderManager", om }, { "onAbort", onExit }, { "onRetry", onRetry } }); } }
void StartSkirmishGame() { var map = WidgetUtils.ChooseInitialMap(Game.Settings.Server.Map); ConnectionLogic.Connect(IPAddress.Loopback.ToString(), Game.CreateLocalServer(map), () => OpenLobbyPanel(MenuType.Main, true), () => { Game.CloseServer(); Menu = MenuType.Main; }); }
void LoadMapIntoEditor(string uid) { ConnectionLogic.Connect(IPAddress.Loopback.ToString(), Game.CreateLocalServer(uid), "", () => { Game.LoadEditor(uid); }, () => { Game.CloseServer(); SwitchMenu(MenuType.MapEditor); }); lastGameState = MenuPanel.MapEditor; }
void StartSkirmishGame() { var map = Game.ModData.MapCache.ChooseInitialMap(Game.Settings.Server.Map, Game.CosmeticRandom); Game.Settings.Server.Map = map; Game.Settings.Save(); ConnectionLogic.Connect(IPAddress.Loopback.ToString(), Game.CreateLocalServer(map), "", OpenSkirmishLobbyPanel, () => { Game.CloseServer(); SwitchMenu(MenuType.Main); }); }
public NewMainMenuLogic(Widget widget, World world, ModData modData) { rootMenu = widget; rootMenu.Get <LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Metadata.Version; // Menu buttons var mainMenu = widget.Get("MAIN_MENU"); mainMenu.IsVisible = () => menuType == MenuType.Main; mainMenu.Get <ButtonWidget>("SINGLEPLAYER_BUTTON").OnClick = () => SwitchMenu(MenuType.Singleplayer); mainMenu.Get <ButtonWidget>("MULTIPLAYER_BUTTON").OnClick = OpenMultiplayerPanel; mainMenu.Get <ButtonWidget>("CONTENT_BUTTON").OnClick = () => { // Switching mods changes the world state (by disposing it), // so we can't do this inside the input handler. Game.RunAfterTick(() => { var content = modData.Manifest.Get <ModContent>(); Game.InitializeMod(content.ContentInstallerMod, new Arguments(new[] { "Content.Mod=" + modData.Manifest.Id })); }); }; mainMenu.Get <ButtonWidget>("SETTINGS_BUTTON").OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("SETTINGS_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Main) } }); }; mainMenu.Get <ButtonWidget>("EXTRAS_BUTTON").OnClick = () => SwitchMenu(MenuType.Extras); mainMenu.Get <ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit; // Singleplayer menu var singleplayerMenu = widget.Get("SINGLEPLAYER_MENU"); singleplayerMenu.IsVisible = () => menuType == MenuType.Singleplayer; var missionsButton = singleplayerMenu.Get <ButtonWidget>("MISSIONS_BUTTON"); missionsButton.OnClick = OpenMissionBrowserPanel; var hasCampaign = modData.Manifest.Missions.Any(); var hasMissions = modData.MapCache .Any(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector)); missionsButton.Disabled = !hasCampaign && !hasMissions; singleplayerMenu.Get <ButtonWidget>("SKIRMISH_BUTTON").OnClick = StartSkirmishGame; singleplayerMenu.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Main); // Extras menu var extrasMenu = widget.Get("EXTRAS_MENU"); extrasMenu.IsVisible = () => menuType == MenuType.Extras; extrasMenu.Get <ButtonWidget>("REPLAYS_BUTTON").OnClick = OpenReplayBrowserPanel; extrasMenu.Get <ButtonWidget>("MUSIC_BUTTON").OnClick = () => { SwitchMenu(MenuType.None); Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, { "world", world } }); }; extrasMenu.Get <ButtonWidget>("MAP_EDITOR_BUTTON").OnClick = () => SwitchMenu(MenuType.MapEditor); var assetBrowserButton = extrasMenu.GetOrNull <ButtonWidget>("ASSETBROWSER_BUTTON"); if (assetBrowserButton != null) { assetBrowserButton.OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("ASSETBROWSER_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, }); } } ; extrasMenu.Get <ButtonWidget>("VOXELBROWSER_BUTTON").OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("VXLBROWSER_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, }); }; extrasMenu.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Main); // Map editor menu var mapEditorMenu = widget.Get("MAP_EDITOR_MENU"); mapEditorMenu.IsVisible = () => menuType == MenuType.MapEditor; // Loading into the map editor Game.BeforeGameStart += RemoveShellmapUI; var onSelect = new Action <string>(uid => LoadMapIntoEditor(modData.MapCache[uid].Uid)); var newMapButton = widget.Get <ButtonWidget>("NEW_MAP_BUTTON"); newMapButton.OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("NEW_MAP_BG", new WidgetArgs() { { "onSelect", onSelect }, { "onExit", () => SwitchMenu(MenuType.MapEditor) } }); }; var loadMapButton = widget.Get <ButtonWidget>("LOAD_MAP_BUTTON"); loadMapButton.OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() { { "initialMap", null }, { "initialTab", MapClassification.User }, { "onExit", () => SwitchMenu(MenuType.MapEditor) }, { "onSelect", onSelect }, { "filter", MapVisibility.Lobby | MapVisibility.Shellmap | MapVisibility.MissionSelector }, }); }; mapEditorMenu.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Extras); var newsBG = widget.GetOrNull("NEWS_BG"); if (newsBG != null) { newsBG.IsVisible = () => Game.Settings.Game.FetchNews && menuType != MenuType.None && menuType != MenuType.SystemInfoPrompt; newsPanel = Ui.LoadWidget <ScrollPanelWidget>("NEWS_PANEL", null, new WidgetArgs()); newsTemplate = newsPanel.Get("NEWS_ITEM_TEMPLATE"); newsPanel.RemoveChild(newsTemplate); newsStatus = newsPanel.Get <LabelWidget>("NEWS_STATUS"); SetNewsStatus("Loading news"); } Game.OnRemoteDirectConnect += OnRemoteDirectConnect; // Check for updates in the background var webServices = modData.Manifest.Get <WebServices>(); if (Game.Settings.Debug.CheckVersion) { webServices.CheckModVersion(); } var updateLabel = rootMenu.GetOrNull("UPDATE_NOTICE"); if (updateLabel != null) { updateLabel.IsVisible = () => !newsOpen && menuType != MenuType.None && menuType != MenuType.SystemInfoPrompt && webServices.ModVersionStatus == ModVersionStatus.Outdated; } var playerProfile = widget.GetOrNull("PLAYER_PROFILE_CONTAINER"); if (playerProfile != null) { Func <bool> minimalProfile = () => Ui.CurrentWindow() != null; Game.LoadWidget(world, "LOCAL_PROFILE_PANEL", playerProfile, new WidgetArgs() { { "minimalProfile", minimalProfile } }); } // System information opt-out prompt var sysInfoPrompt = widget.Get("SYSTEM_INFO_PROMPT"); sysInfoPrompt.IsVisible = () => menuType == MenuType.SystemInfoPrompt; if (Game.Settings.Debug.SystemInformationVersionPrompt < SystemInformationVersion) { menuType = MenuType.SystemInfoPrompt; var sysInfoCheckbox = sysInfoPrompt.Get <CheckboxWidget>("SYSINFO_CHECKBOX"); sysInfoCheckbox.IsChecked = () => Game.Settings.Debug.SendSystemInformation; sysInfoCheckbox.OnClick = () => Game.Settings.Debug.SendSystemInformation ^= true; var sysInfoData = sysInfoPrompt.Get <ScrollPanelWidget>("SYSINFO_DATA"); var template = sysInfoData.Get <LabelWidget>("DATA_TEMPLATE"); sysInfoData.RemoveChildren(); foreach (var info in GetSystemInformation().Values) { var label = template.Clone() as LabelWidget; var text = info.First + ": " + info.Second; label.GetText = () => text; sysInfoData.AddChild(label); } sysInfoPrompt.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => { Game.Settings.Debug.SystemInformationVersionPrompt = SystemInformationVersion; Game.Settings.Save(); SwitchMenu(MenuType.Main); LoadAndDisplayNews(webServices.GameNews, newsBG); }; } else { LoadAndDisplayNews(webServices.GameNews, newsBG); } Game.OnShellmapLoaded += OpenMenuBasedOnLastGame; } void LoadAndDisplayNews(string newsURL, Widget newsBG) { if (newsBG != null && Game.Settings.Game.FetchNews) { var cacheFile = Platform.ResolvePath(Platform.SupportDirPrefix, "news.yaml"); var currentNews = ParseNews(cacheFile); if (currentNews != null) { DisplayNews(currentNews); } var newsButton = newsBG.GetOrNull <DropDownButtonWidget>("NEWS_BUTTON"); if (newsButton != null) { if (!fetchedNews) { // Send the mod and engine version to support version-filtered news (update prompts) newsURL += "?version={0}&mod={1}&modversion={2}".F( Uri.EscapeUriString(Game.EngineVersion), Uri.EscapeUriString(Game.ModData.Manifest.Id), Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version)); // Append system profile data if the player has opted in if (Game.Settings.Debug.SendSystemInformation) { newsURL += "&sysinfoversion={0}&".F(SystemInformationVersion) + GetSystemInformation() .Select(kv => kv.Key + "=" + Uri.EscapeUriString(kv.Value.Second)) .JoinWith("&"); } new Download(newsURL, cacheFile, e => { }, e => NewsDownloadComplete(e, cacheFile, currentNews, () => OpenNewsPanel(newsButton))); } newsButton.OnClick = () => OpenNewsPanel(newsButton); } } } void OpenNewsPanel(DropDownButtonWidget button) { newsOpen = true; button.AttachPanel(newsPanel, () => newsOpen = false); } void OnRemoteDirectConnect(string host, int port) { SwitchMenu(MenuType.None); Ui.OpenWindow("MULTIPLAYER_PANEL", new WidgetArgs { { "onStart", RemoveShellmapUI }, { "onExit", () => SwitchMenu(MenuType.Main) }, { "directConnectHost", host }, { "directConnectPort", port }, }); } void LoadMapIntoEditor(string uid) { ConnectionLogic.Connect(IPAddress.Loopback.ToString(), Game.CreateLocalServer(uid), "", () => { Game.LoadEditor(uid); }, () => { Game.CloseServer(); SwitchMenu(MenuType.MapEditor); }); lastGameState = MenuPanel.MapEditor; } void SetNewsStatus(string message) { message = WidgetUtils.WrapText(message, newsStatus.Bounds.Width, Game.Renderer.Fonts[newsStatus.Font]); newsStatus.GetText = () => message; }
public CustomMainMenuLogic(Widget widget, World world, ModData modData) { rootMenu = widget; rootMenu.Get <LabelWidget>("VERSION_LABEL").Text = modData.Manifest.Metadata.Version; // Menu buttons var mainMenu = widget.Get("MAIN_MENU"); mainMenu.IsVisible = () => menuType == MenuType.Main; mainMenu.Get <ButtonWidget>("SINGLEPLAYER_BUTTON").OnClick = () => SwitchMenu(MenuType.Singleplayer); mainMenu.Get <ButtonWidget>("MULTIPLAYER_BUTTON").OnClick = OpenMultiplayerPanel; mainMenu.Get <ButtonWidget>("CONTENT_BUTTON").OnClick = () => { // Switching mods changes the world state (by disposing it), // so we can't do this inside the input handler. Game.RunAfterTick(() => { var content = modData.Manifest.Get <ModContent>(); Game.InitializeMod(content.ContentInstallerMod, new Arguments(new[] { "Content.Mod=" + modData.Manifest.Id })); }); }; mainMenu.Get <ButtonWidget>("SETTINGS_BUTTON").OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("SETTINGS_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Main) } }); }; mainMenu.Get <ButtonWidget>("EXTRAS_BUTTON").OnClick = () => SwitchMenu(MenuType.Extras); mainMenu.Get <ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit; // Singleplayer menu var singleplayerMenu = widget.Get("SINGLEPLAYER_MENU"); singleplayerMenu.IsVisible = () => menuType == MenuType.Singleplayer; var missionsButton = singleplayerMenu.Get <ButtonWidget>("MISSIONS_BUTTON"); missionsButton.OnClick = OpenMissionBrowserPanel; var hasCampaign = modData.Manifest.Missions.Any(); var hasMissions = modData.MapCache .Any(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector)); missionsButton.Disabled = !hasCampaign && !hasMissions; var hasMaps = modData.MapCache.Any(p => p.Visibility.HasFlag(MapVisibility.Lobby)); var skirmishButton = singleplayerMenu.Get <ButtonWidget>("SKIRMISH_BUTTON"); skirmishButton.OnClick = StartSkirmishGame; skirmishButton.Disabled = !hasMaps; var loadButton = singleplayerMenu.Get <ButtonWidget>("LOAD_BUTTON"); loadButton.IsDisabled = () => !GameSaveBrowserLogic.IsLoadPanelEnabled(modData.Manifest); loadButton.OnClick = OpenGameSaveBrowserPanel; singleplayerMenu.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Main); // Extras menu var extrasMenu = widget.Get("EXTRAS_MENU"); extrasMenu.IsVisible = () => menuType == MenuType.Extras; extrasMenu.Get <ButtonWidget>("REPLAYS_BUTTON").OnClick = OpenReplayBrowserPanel; extrasMenu.Get <ButtonWidget>("MUSIC_BUTTON").OnClick = () => { SwitchMenu(MenuType.None); Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, { "world", world } }); }; extrasMenu.Get <ButtonWidget>("MAP_EDITOR_BUTTON").OnClick = () => SwitchMenu(MenuType.MapEditor); var assetBrowserButton = extrasMenu.GetOrNull <ButtonWidget>("ASSETBROWSER_BUTTON"); if (assetBrowserButton != null) { assetBrowserButton.OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("ASSETBROWSER_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, }); } } ; extrasMenu.Get <ButtonWidget>("CREDITS_BUTTON").OnClick = () => { SwitchMenu(MenuType.None); Ui.OpenWindow("CREDITS_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, }); }; extrasMenu.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Main); // Map editor menu var mapEditorMenu = widget.Get("MAP_EDITOR_MENU"); mapEditorMenu.IsVisible = () => menuType == MenuType.MapEditor; // Loading into the map editor Game.BeforeGameStart += RemoveShellmapUI; var onSelect = new Action <string>(uid => LoadMapIntoEditor(modData.MapCache[uid].Uid)); var newMapButton = widget.Get <ButtonWidget>("NEW_MAP_BUTTON"); newMapButton.OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("NEW_MAP_BG", new WidgetArgs() { { "onSelect", onSelect }, { "onExit", () => SwitchMenu(MenuType.MapEditor) } }); }; var loadMapButton = widget.Get <ButtonWidget>("LOAD_MAP_BUTTON"); loadMapButton.OnClick = () => { SwitchMenu(MenuType.None); Game.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() { { "initialMap", null }, { "initialTab", MapClassification.User }, { "onExit", () => SwitchMenu(MenuType.MapEditor) }, { "onSelect", onSelect }, { "filter", MapVisibility.Lobby | MapVisibility.Shellmap | MapVisibility.MissionSelector }, }); }; loadMapButton.Disabled = !hasMaps; mapEditorMenu.Get <ButtonWidget>("BACK_BUTTON").OnClick = () => SwitchMenu(MenuType.Extras); var newsBG = widget.GetOrNull("NEWS_BG"); if (newsBG != null) { newsBG.IsVisible = () => Game.Settings.Game.FetchNews && menuType != MenuType.None && menuType != MenuType.StartupPrompts; newsPanel = Ui.LoadWidget <ScrollPanelWidget>("NEWS_PANEL", null, new WidgetArgs()); newsTemplate = newsPanel.Get("NEWS_ITEM_TEMPLATE"); newsPanel.RemoveChild(newsTemplate); newsStatus = newsPanel.Get <LabelWidget>("NEWS_STATUS"); SetNewsStatus("Loading news"); } Game.OnRemoteDirectConnect += OnRemoteDirectConnect; // Check for updates in the background var webServices = modData.Manifest.Get <GitHubWebServices>(); if (Game.Settings.Debug.CheckVersion) { webServices.FetchRelease(() => LoadAndDisplayNews(webServices, newsBG)); } var updateLabel = rootMenu.GetOrNull("UPDATE_NOTICE"); if (updateLabel != null) { updateLabel.IsVisible = () => !newsOpen && menuType != MenuType.None && menuType != MenuType.StartupPrompts && webServices.ModVersionStatus == ModVersionStatus.Outdated; } var playerProfile = widget.GetOrNull("PLAYER_PROFILE_CONTAINER"); if (playerProfile != null) { Func <bool> minimalProfile = () => Ui.CurrentWindow() != null; Game.LoadWidget(world, "LOCAL_PROFILE_PANEL", playerProfile, new WidgetArgs() { { "minimalProfile", minimalProfile } }); } menuType = MenuType.StartupPrompts; Action onIntroductionComplete = () => { Action onSysInfoComplete = () => { SwitchMenu(MenuType.Main); }; if (SystemInfoPromptLogic.ShouldShowPrompt()) { Ui.OpenWindow("MAINMENU_SYSTEM_INFO_PROMPT", new WidgetArgs { { "onComplete", onSysInfoComplete } }); } else { onSysInfoComplete(); } }; if (IntroductionPromptLogic.ShouldShowPrompt()) { Game.OpenWindow("MAINMENU_INTRODUCTION_PROMPT", new WidgetArgs { { "onComplete", onIntroductionComplete } }); } else { onIntroductionComplete(); } Game.OnShellmapLoaded += OpenMenuBasedOnLastGame; DiscordService.UpdateStatus(DiscordState.InMenu); } void LoadAndDisplayNews(GitHubWebServices webServices, Widget newsBG) { if (newsBG != null && Game.Settings.Game.FetchNews) { var newsButton = newsBG.GetOrNull <DropDownButtonWidget>("NEWS_BUTTON"); if (newsButton != null) { DisplayNews(webServices); newsButton.OnClick = () => OpenNewsPanel(newsButton); if (webServices.NewsAlert) { OpenNewsPanel(newsButton); } } } } void DisplayNews(GitHubWebServices webServices) { newsPanel.RemoveChildren(); SetNewsStatus(""); var newsWidget = newsTemplate.Clone(); var titleLabel = newsWidget.Get <LabelWidget>("TITLE"); var newsItem = webServices.NewsItem; if (newsItem == null) { SetNewsStatus("Failed to retrieve news"); return; } titleLabel.GetText = () => newsItem.Title; var authorDateTimeLabel = newsWidget.Get <LabelWidget>("AUTHOR_DATETIME"); var authorDateTime = authorDateTimeLabel.Text.F(newsItem.Author, newsItem.DateTime.ToLocalTime()); authorDateTimeLabel.GetText = () => authorDateTime; var contentLabel = newsWidget.Get <LabelWidget>("CONTENT"); var content = newsItem.Content; content = WidgetUtils.WrapText(content, contentLabel.Bounds.Width, Game.Renderer.Fonts[contentLabel.Font]); contentLabel.GetText = () => content; contentLabel.Bounds.Height = Game.Renderer.Fonts[contentLabel.Font].Measure(content).Y; newsWidget.Bounds.Height += contentLabel.Bounds.Height; newsPanel.AddChild(newsWidget); newsPanel.Layout.AdjustChildren(); } void OpenNewsPanel(DropDownButtonWidget button) { newsOpen = true; button.AttachPanel(newsPanel, () => newsOpen = false); } void OnRemoteDirectConnect(ConnectionTarget endpoint) { SwitchMenu(MenuType.None); Ui.OpenWindow("MULTIPLAYER_PANEL", new WidgetArgs { { "onStart", RemoveShellmapUI }, { "onExit", () => SwitchMenu(MenuType.Main) }, { "directConnectEndPoint", endpoint }, }); } void LoadMapIntoEditor(string uid) { ConnectionLogic.Connect(Game.CreateLocalServer(uid), "", () => { Game.LoadEditor(uid); }, () => { Game.CloseServer(); SwitchMenu(MenuType.MapEditor); }); DiscordService.UpdateStatus(DiscordState.InMapEditor); lastGameState = MenuPanel.MapEditor; } void SetNewsStatus(string message) { message = WidgetUtils.WrapText(message, newsStatus.Bounds.Width, Game.Renderer.Fonts[newsStatus.Font]); newsStatus.GetText = () => message; } void RemoveShellmapUI() { rootMenu.Parent.RemoveChild(rootMenu); } void StartSkirmishGame() { var map = Game.ModData.MapCache.ChooseInitialMap(Game.Settings.Server.Map, Game.CosmeticRandom); Game.Settings.Server.Map = map; Game.Settings.Save(); ConnectionLogic.Connect(Game.CreateLocalServer(map), "", OpenSkirmishLobbyPanel, () => { Game.CloseServer(); SwitchMenu(MenuType.Main); }); } void OpenMissionBrowserPanel() { SwitchMenu(MenuType.None); Game.OpenWindow("MISSIONBROWSER_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Singleplayer) }, { "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Missions; } } }); } void OpenSkirmishLobbyPanel() { SwitchMenu(MenuType.None); Game.OpenWindow("SERVER_LOBBY", new WidgetArgs { { "onExit", () => { Game.Disconnect(); SwitchMenu(MenuType.Singleplayer); } }, { "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Skirmish; } }, { "skirmishMode", true } }); } void OpenMultiplayerPanel() { SwitchMenu(MenuType.None); Ui.OpenWindow("MULTIPLAYER_PANEL", new WidgetArgs { { "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Multiplayer; } }, { "onExit", () => SwitchMenu(MenuType.Main) }, { "directConnectEndPoint", null }, }); } void OpenReplayBrowserPanel() { SwitchMenu(MenuType.None); Ui.OpenWindow("REPLAYBROWSER_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Extras) }, { "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.Replays; } } }); } void OpenGameSaveBrowserPanel() { SwitchMenu(MenuType.None); Ui.OpenWindow("GAMESAVE_BROWSER_PANEL", new WidgetArgs { { "onExit", () => SwitchMenu(MenuType.Singleplayer) }, { "onStart", () => { RemoveShellmapUI(); lastGameState = MenuPanel.GameSaves; } }, { "isSavePanel", false }, { "world", null } }); }