Пример #1
0
        private void ProcessSessionStateChange(CommandSessionStateChange command)
        {
            if (sessionState == command.NewState)
            {
                return;
            }

            sessionState = command.NewState;

            switch (command.NewState)
            {
            case NetworkSessionState.Ended:

                ResetReady();

                // Have to find an example of how this is used so that I can figure out how to pass
                // the EndReason
                EventHelpers.Raise(this, SessionEnded, new NetworkSessionEndedEventArgs(NetworkSessionEndReason.HostEndedSession));
                break;

            case NetworkSessionState.Playing:

                EventHelpers.Raise(this, GameStarted, new GameStartedEventArgs());
                break;
            }

            // if changing from playing to lobby
            if (command.NewState == NetworkSessionState.Lobby && command.OldState == NetworkSessionState.Playing)
            {
                ResetReady();
                EventHelpers.Raise(this, GameEnded, new GameEndedEventArgs());
            }
        }
Пример #2
0
 private void ProcessSessionStateChange(CommandSessionStateChange command)
 {
   if (this.sessionState == command.NewState)
     return;
   this.sessionState = command.NewState;
   switch (command.NewState)
   {
     case NetworkSessionState.Playing:
       if (this.GameStarted != null)
       {
         this.GameStarted((object) this, new GameStartedEventArgs());
         break;
       }
       else
         break;
     case NetworkSessionState.Ended:
       this.ResetReady();
       if (this.SessionEnded != null)
       {
         this.SessionEnded((object) this, new NetworkSessionEndedEventArgs(NetworkSessionEndReason.HostEndedSession));
         break;
       }
       else
         break;
   }
   if (command.NewState != NetworkSessionState.Lobby || command.OldState != NetworkSessionState.Playing)
     return;
   this.ResetReady();
   if (this.GameEnded == null)
     return;
   this.GameEnded((object) this, new GameEndedEventArgs());
 }
Пример #3
0
 public void EndGame()
 {
     try {
         CommandSessionStateChange ssc = new CommandSessionStateChange(NetworkSessionState.Lobby, sessionState);
         commandQueue.Enqueue(new CommandEvent(ssc));
     } finally {
     }
 }
Пример #4
0
 public void StartGame()
 {
     try {
         CommandSessionStateChange ssc = new CommandSessionStateChange(NetworkSessionState.Playing, sessionState);
         commandQueue.Enqueue(new CommandEvent(ssc));
         //sessionState = NetworkSessionState.Playing;
     } finally {
     }
 }
Пример #5
0
		private void ProcessSessionStateChange(CommandSessionStateChange command)
		{
			if (sessionState == command.NewState)
				return;
			
			sessionState = command.NewState;
			
			switch (command.NewState) {
			case NetworkSessionState.Ended:
				
				ResetReady();
				
				if (SessionEnded != null) {
					// Have to find an example of how this is used so that I can figure out how to pass
					//  the EndReason
					SessionEnded(this, new NetworkSessionEndedEventArgs(NetworkSessionEndReason.HostEndedSession));
					
				}
				break;
			case NetworkSessionState.Playing:
				
				if (GameStarted != null) {
					GameStarted(this, new GameStartedEventArgs());
				}
				break;
			}
			
			// if changing from playing to lobby
			if (command.NewState == NetworkSessionState.Lobby && command.OldState == NetworkSessionState.Playing) {
				
				ResetReady();
				
				if (GameEnded != null) {
					GameEnded(this, new GameEndedEventArgs());
				}
			}
		}
Пример #6
0
		public void StartGame ()
		{
			try {
				CommandSessionStateChange ssc = new CommandSessionStateChange(NetworkSessionState.Playing, sessionState);
				commandQueue.Enqueue(new CommandEvent(ssc));
				//sessionState = NetworkSessionState.Playing;
			} finally {
			}
		}
Пример #7
0
		public void EndGame ()
		{
			try {
				CommandSessionStateChange ssc = new CommandSessionStateChange(NetworkSessionState.Lobby, sessionState);
				commandQueue.Enqueue(new CommandEvent(ssc));

			} finally {
			}
		}