public void AddServer(IPAddress ip) { foreach (var m in MenuEntries) if (m.Text == ip.ToString()) return; MenuEntry server = new MenuEntry(ip.ToString()); server.Selected += ServerMenuEntrySelected; MenuEntries.Add(server); }
/// <summary> /// Constructor. /// </summary> public OptionsMenuScreen() : base("Options") { // Create our menu entries. ungulateMenuEntry = new MenuEntry(string.Empty); languageMenuEntry = new MenuEntry(string.Empty); frobnicateMenuEntry = new MenuEntry(string.Empty); elfMenuEntry = new MenuEntry(string.Empty); SetMenuEntryText(); MenuEntry backMenuEntry = new MenuEntry("Back"); // Hook up menu event handlers. ungulateMenuEntry.Selected += UngulateMenuEntrySelected; languageMenuEntry.Selected += LanguageMenuEntrySelected; frobnicateMenuEntry.Selected += FrobnicateMenuEntrySelected; elfMenuEntry.Selected += ElfMenuEntrySelected; backMenuEntry.Selected += OnCancel; // Add entries to the menu. MenuEntries.Add(ungulateMenuEntry); MenuEntries.Add(languageMenuEntry); MenuEntries.Add(frobnicateMenuEntry); MenuEntries.Add(elfMenuEntry); MenuEntries.Add(backMenuEntry); }
public ClientMenuScreen() : base("Client") { MenuEntry refresh = new MenuEntry("Refresh"); refresh.Selected += RefreshMenuEntrySelected; MenuEntries.Add(refresh); teamMenuEntry = new MenuEntry("Team: 0"); teamMenuEntry.Selected += TeamMenuEntrySelected; MenuEntries.Add(teamMenuEntry); MenuEntry back = new MenuEntry("Back"); back.Selected += OnCancel; MenuEntries.Add(back); MenuEntry text = new MenuEntry("Available host(s): "); MenuEntries.Add(text); var net = (INetworkManager)TankAGame.ThisGame.Services.GetService(typeof(INetworkManager)); net.StartClient(); var client = (ITankAClient)TankAGame.ThisGame.Services.GetService(typeof(ITankAClient)); byte t = client.GetCSTeam(); if (t == 1) teamMenuEntry.Text = "Team: 1"; TankAGame.ThisGame.Services.AddService(typeof(IClientMenu), this); }
public SingleMenuScreen() : base("Single Play") { string[] mapFiles = Directory.GetFiles(@"./Maps/", "*.map"); foreach (var name in mapFiles) { // Create menu entries. var menuEntry = new MenuEntry("Map: " + name.Substring(2)); // Event handlers. menuEntry.Selected += MapSelected; // Add entries to menu. MenuEntries.Add(menuEntry); } MenuEntry backMenuEntry = new MenuEntry("Back"); backMenuEntry.Selected += OnCancel; MenuEntries.Add(backMenuEntry); }
/// <summary> /// Constructor. /// </summary> public PauseMenuScreen() : base("Paused") { // Flag that there is no need for the game to transition // off when the pause menu is on top of it. IsPopup = true; // Create our menu entries. MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game"); MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game"); // Hook up menu event handlers. resumeGameMenuEntry.Selected += OnCancel; quitGameMenuEntry.Selected += QuitGameMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(resumeGameMenuEntry); MenuEntries.Add(quitGameMenuEntry); }
/// <summary> /// Constructor fills in the menu contents. /// </summary> public MainMenuScreen() : base("TankA") { // Create our menu entries. MenuEntry playGameMenuEntry = new MenuEntry("Single play"); MenuEntry hostMenuEntry = new MenuEntry("Host"); MenuEntry clientMenuEntry = new MenuEntry("Client"); MenuEntry exitMenuEntry = new MenuEntry("Exit"); // Hook up menu event handlers. playGameMenuEntry.Selected += PlayGameMenuEntrySelected; hostMenuEntry.Selected += HostMenuEntrySelected; clientMenuEntry.Selected += ClientMenuEntrySelected; exitMenuEntry.Selected += OnCancel; // Add entries to the menu. MenuEntries.Add(playGameMenuEntry); MenuEntries.Add(hostMenuEntry); MenuEntries.Add(clientMenuEntry); MenuEntries.Add(exitMenuEntry); }
public HostMenuScreen() : base("Host new game") { hostModeChooser = new MenuEntry("Host mode: Quake"); hostModeChooser.Selected += HostModeChooserSelected; MenuEntries.Add(hostModeChooser); string[] mapFiles = Directory.GetFiles(@"./", "*.map"); foreach (var name in mapFiles) { // Create menu entries. var menuEntry = new MenuEntry("Map: " + name.Substring(2)); // Event handlers. menuEntry.Selected += MapSelected; // Add entries to menu. MenuEntries.Add(menuEntry); } MenuEntry backMenuEntry = new MenuEntry("Back"); backMenuEntry.Selected += OnCancel; MenuEntries.Add(backMenuEntry); }