示例#1
0
        public TMClientInfoInRoom JoinRoom(TMContext context)
        {
            var info = new TMClientInfoInRoom(context.Client)
            {
                SeatIndex = NextSeatIndex
            };

            ClientInfos.Add(info);

            if (Status == RoomStatus.Created)
            {
                Status = RoomStatus.Waiting;
            }

            info.PropertyChanged += async(sender, e) =>
            {
                switch (e.PropertyName)
                {
                case "ClientStatus":
                    await this.RpcAllAsync("OnClientStatusChanged", context.Client.User.ObjectId, info.SeatIndex, (int)(info.ClientStatus));

                    break;

                case "ScreenName":
                    await this.RpcAllAsync("OnScreenNameChanged", context.Client.User.ObjectId, info.ScreenName);

                    break;

                case "SeatIndex":
                    break;
                }
            };

            this.RpcAllAsync("OnNewClientJoined", info);
            return(info);
        }
示例#2
0
 public TMPlayer(TMClientInfoInRoom clientInfoInRoom) : this()
 {
     Client = clientInfoInRoom.Client;
     RoleId = clientInfoInRoom.SeatIndex;
     User   = clientInfoInRoom.Client.User;
 }