コード例 #1
0
ファイル: GameClient.cs プロジェクト: icefortress/OceanMars
        /// <summary>
        /// Create a new GameClient.
        /// </summary>
        /// <param name="port">The port to create the GameServer on.</param>
        public GameClient()
            : base(new NetworkClient())
        {
            Lobby = new LobbyClient(this); // Give initial control to the lobby
            Network.RegisterGameDataUpdater(Lobby.UpdateLobbyState);

            // TODO: Once we're done with the lobby, the connections and players will be handed off to the game and the GameDataUpdater re-registered to GameClient.UpdateGameState

            return;
        }
コード例 #2
0
ファイル: LobbyScreen.cs プロジェクト: icefortress/OceanMars
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        /// <param name="host">Whether or not this player is the host.</param>
        /// <param name="multiplayer">Whether or not this game is multiplayer.</param>
        public LobbyScreen(LobbyClient lc)
            : base("Lobby", true)
        {
            this.lc = lc;

            lc.RegisterNewGameUpdater(this.StartGame);

            // Create the single invisible menu entry
            MenuEntry startGameMenuEntry = new MenuEntry(string.Empty, true);
            startGameMenuEntry.Selected += StartGameMenuEntrySelected;
            MenuEntries.Add(startGameMenuEntry);

            return;
        }