コード例 #1
0
ファイル: Room.cs プロジェクト: zd304/ProjectD
        public void JoinRoom(GameClientPeer peer, string userName)
        {
            if (!userNames.Contains(userName))
            {
                return;
            }
            userNames.Remove(userName);

            RoomClient client = new RoomClient();

            client.peer      = peer;
            client.userNamae = userName;
            roomClients.Add(client);

            if (userNames.Count <= 0 && maxClient == roomClients.Count)
            {
                for (int i = 0; i < roomClients.Count; ++i)
                {
                    RoomClient  roomClient = roomClients[i];
                    NullMessage message    = new NullMessage();

                    roomClient.peer.SendEvent(OperationCode.JoinRoom, message);
                }
            }
        }
コード例 #2
0
        protected override PeerBase CreatePeer(InitRequest initRequest)
        {
            GameClientPeer peer = new GameClientPeer(initRequest);

            clientPeerList.Add(peer);
            return(peer);
        }