Exemplo n.º 1
0
    public byte[] UpdateRoom(JObject json)
    {
        byte[] backData = null;

        string    userID   = (string)json[nameof(Register.userID)];
        int       roomID   = (int)json[nameof(RoomInfo.RoomID)];
        GameModel roomType = (GameModel)(int)json[nameof(RoomInfo.RoomType)];
        string    roomName = (string)json[nameof(RoomInfo.RoomName)];

        //房间存在
        if (RoomList.ContainsKey(roomID))
        {
            SingleRoom singleRoom = null;
            if (RoomList.TryGetValue(roomID, out singleRoom) && singleRoom.IsMaster(userID))//发起者是房主
            {
                singleRoom.UpdateRoom(roomType, roomName);
                RoomInfo info = singleRoom.RoomInfo;
                backData = SerializeHelper.Serialize <RoomInfo>(info);
            }
        }
        else
        {
            backData = ClassGroup.ErrorBackByType(ErrorType.roomNotExist);
        }
        return(backData);
    }