public MainMenuUserInterfaceController(MainMenuUserInterface userInterface) { UserInterface = userInterface; Show(UserInterface.MainPanel); UserInterface.MenuSinglePlayer.Click += (sender, args) => Show(UserInterface.StartGamePanel); UserInterface.MenuMultiPlayer.Click += (sender, args) => Show(UserInterface.MultiPlayerPanel); UserInterface.MultiPlayerCreateGame.Click += (sender, args) => Show(UserInterface.CreateMultiplayerGamePanel); UserInterface.MenuSettings.Click += (sender, args) => Show(UserInterface.SettingsPanel); UserInterface.MenuQuit.Click += (sender, args) => { }; UserInterface.StartGameBack.Click += (sender, args) => ShowLast(); UserInterface.MultiPlayerBack.Click += (sender, args) => ShowLast(); UserInterface.SettingsBack.Click += (sender, args) => ShowLast(); UserInterface.JoinByIpBack.Click += (sender, args) => ShowLast(); UserInterface.MultiPlayerJoinByIp.Click += (sender, args) => Show(UserInterface.JoinByIpPanel); UserInterface.CreateMultiplayerGameCreateGame.Click += (sender, args) => UserInterface.CreateMultiplayerGamePanel.Visible = false; UserInterface.StartGameNewGame.Click += (sender, args) => UserInterface.StartGamePanel.Visible = false; UserInterface.JoinByIpJoin.Click += (sender, args) => UserInterface.JoinByIpPanel.Visible = false; }
public override void Awake() { _networkManager = new SteamNetworkManager(Game1.AppId, new MaydayMessagePackager()); var panel = new MainMenuUserInterface(); var controller = new MainMenuUserInterfaceController(panel); UserInterface = new MyraUserInterface(panel); _networkManager.SetClientNetworkListener(this); panel.StartGameNewGame.Click += (o, e) => StartNewGame(); panel.CreateMultiplayerGameCreateGame.Click += (o, e) => CreateMultiplayerGame(panel.CreateMultiplayerGamePortTextBox.Text); panel.JoinByIpJoin.Click += (o, e) => JoinServer(panel.IpAddressTextBox.Text, panel.PortTextBox.Text); panel.GameLogo.Renderable = new TextureRegion(YetiGame.ContentManager.Load <Texture2D>("MainMenu/logo")); panel.GameLogo.Renderable = new TextureRegion(YetiGame.ContentManager.Load <Texture2D>("MainMenu/logo")); }