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); }
public TMPlayer(TMClientInfoInRoom clientInfoInRoom) : this() { Client = clientInfoInRoom.Client; RoleId = clientInfoInRoom.SeatIndex; User = clientInfoInRoom.Client.User; }