Пример #1
0
    public void FinalizeJoinRequest(string matchmakerTicket, UserAccountInfo userInfo, bool approved)
    {
        IClient client = tempTicketMap[matchmakerTicket];

        tempTicketMap.Remove(matchmakerTicket);

        //Respond to client with approval status
        using (DarkRiftWriter writer = DarkRiftWriter.Create()) {
            writer.Write(approved);

            using (Message message = Message.Create(NetworkTags.Connection, writer)) {
                client.SendMessage(message, SendMode.Reliable);
            }
        }

        //Record client in lobby map
        if (LobbyClientAccountMap.ContainsKey(client))
        {
            LobbyClientAccountMap[client] = userInfo;
        }
        else
        {
            LobbyClientAccountMap.Add(client, userInfo);
        }
    }
Пример #2
0
    public void EndGame(GameState gameState)
    {
        //Send current game state to all players
        BroadcastGameState(gameState);

        //Mark all players as back in the lobby
        foreach (KeyValuePair <IClient, UserAccountInfo> client in InGameClientAccountMap)
        {
            LobbyClientAccountMap.Add(client.Key, client.Value);
        }
        InGameClientAccountMap.Clear();
    }