Exemplo n.º 1
0
    public void SetRoomData(qp_server.pb_room_data roomData)
    {
        qp_server.pb_room_cfg roomCfg = roomData.cfg;
        //设置房间信息
        RoomCfg cfg = new RoomCfg(
            roomCfg.room_name,
            roomCfg.is_aa,
            roomCfg.double_down_score,
            roomCfg.is_laizi_playmethod,
            roomCfg.is_ob,
            roomCfg.is_random,
            roomCfg.is_not_voice,
            roomCfg.is_safe_mode,
            roomCfg.lock_userid_list);

        GlobalData.Ins.roomCfg = cfg;
        int selfSeatNumber = -1;

        foreach (var pbRoomUser in roomData.room_users)
        {
            qp_server.pb_user_public_data roomUserPublicData = pbRoomUser.user_public_data;
            RoomUser roomUser = new RoomUser(roomUserPublicData.user_id, roomUserPublicData.nick_name, roomUserPublicData.avatar_url, pbRoomUser.seat_number);
            GlobalData.Ins.allRoomUsers.Add(roomUserPublicData.user_id, roomUser);
            if (roomUserPublicData.user_id == GlobalData.Ins.userId)
            {
                selfSeatNumber = pbRoomUser.seat_number;
            }
        }

        GlobalData.Ins.currentRoomId     = roomData.room_id;
        GlobalData.Ins.currentSeatNumber = selfSeatNumber;
    }
Exemplo n.º 2
0
    void OnJoinRoomPush(qp_server.qp_join_room_push push)
    {
        qp_server.pb_user_public_data publicData = push.public_data;
        Log.Logic("room JoinRoomPush {0}", publicData.user_id);
        //将玩家数据添加到缓存
        if (GlobalData.Ins.allRoomUsers.ContainsKey(publicData.user_id))
        {
            Log.Warning("user_id[{0}] exist.", publicData.user_id);
            return;
        }

        RoomUser newRoomUser = new RoomUser(publicData.user_id, publicData.nick_name, publicData.avatar_url, -1);

        GlobalData.Ins.allRoomUsers[publicData.user_id] = newRoomUser;
    }