Exemplo n.º 1
0
        public virtual Task <PlayRoom> CreateEmptyRoomAsync(RoomConfig config)
        {
            var room = new StandardPlayRoom(config);

            Rooms.Add(room);
            return(Task.FromResult(room as PlayRoom));
        }
Exemplo n.º 2
0
        public virtual Task <PlayRoom> CreateWithConfigAsync(RoomConfig config, SlarkClientConnection connection)
        {
            var player = new StandardPlayer()
            {
                ClientConnection = connection,
                ActorId          = 1,
            };

            var room = new StandardPlayRoom(config)
            {
                MasterClientId = player.Client.PeerId,
                CreatorId      = player.Client.PeerId,
                Players        = new ConcurrentHashSet <Player>()
                {
                    { player }
                }
            };

            player.Client.RoomId = room.Id;

            Rooms.Add(room);

            return(Task.FromResult(room as PlayRoom));
        }