Example #1
0
 public Match(string seed, IEnumerable<string> accountIds, int lobby, MatchType matchType, LogOnService logOnService)
 {
     _lobby = lobby;
       _matchType = matchType;
       _logOnService = logOnService;
       _shuffler = new WallGenerator(seed);
       _firstOyaIndex = _shuffler.GetWall(0).First().Id % 4;
       var playerIndex = 0;
       foreach (var player in accountIds)
       {
     _players.Add(player, new PlayerStatus(playerIndex));
     playerIndex += 1;
       }
       _stateMachine = new StateMachine(new PlayersConnectingState(this));
       _stateMachine.Finished += OnFinished;
 }
Example #2
0
 public void Process(LocalConnection connection, XElement message)
 {
     StateMachine stateMachine;
       lock (_stateMachines)
       {
     if (!_stateMachines.ContainsKey(connection))
     {
       var lobbyConnection = new LobbyConnection(connection, _matchServer, _logOnService);
       stateMachine = new StateMachine(new ConnectionEstablishedState(lobbyConnection));
       stateMachine.Finished += OnConnectionEnded;
       _stateMachines.Add(connection, stateMachine);
     }
     else
     {
       stateMachine = _stateMachines[connection];
     }
       }
       stateMachine.Process(new Message(InvariantConvert.ToString(connection.GetHashCode()), message));
 }