Beispiel #1
0
 public static GameLevel CreateLevel(Game game, NetworkSessionComponent.Level level)
 {
     switch (level)
     {
         case NetworkSessionComponent.Level.shipMap:
             return CreateShipMapLevel(game);
         case NetworkSessionComponent.Level.Level_1:
             return CreateLevel_1Level(game);
         default:
             throw new ArgumentException("Invalid game level");
     }
 }
Beispiel #2
0
        /// <summary>
        /// Event handler for when the asynchronous join network session
        /// operation has completed.
        /// </summary>
        void JoinSessionOperationCompleted(object sender, OperationCompletedEventArgs e)
        {
            try
            {
                // End the asynchronous join network session operation.
                NetworkSession networkSession = NetworkSession.EndJoin(e.AsyncResult);

                // Create a component that will manage the session we just joined.
                NetworkSessionComponent.Create(ScreenManager, networkSession);

                // Go to the lobby screen.
                ScreenManager.AddScreen(new LobbyScreen(networkSession));

                availableSessions.Dispose();
            }
            catch (NetworkException exception)
            {
                ScreenManager.AddScreen(new NetworkErrorScreen(exception));
            }
            catch (GamerPrivilegeException exception)
            {
                ScreenManager.AddScreen(new NetworkErrorScreen(exception));
            }
        }
Beispiel #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public BackgroundScreen(NetworkSessionComponent.Level currentLevel)
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     this.currentLevel = currentLevel;
 }
Beispiel #4
0
 /// <summary>
 /// Event handler for when the End/Leave Session menu entry is selected.
 /// </summary>
 void LeaveSessionMenuEntrySelected(object sender, EventArgs e)
 {
     NetworkSessionComponent.LeaveSession(ScreenManager);
 }