Exemple #1
0
        private void addTwoBattleRoomRoleModels(UserToken userToken)
        {
            RoleModel roleModel = messageManaer.getUserModel(userToken);

            if (roleModel != null)
            {
                twoBattleRoomRoleModels.Enqueue(roleModel);
                messageManaer.write(roleModel.accountId, BattleRoomProtocol.WAIT_TWO_ROOM_CREATE_S);
                //如果队列中数目大于1
                if (twoBattleRoomRoleModels.Count >= 2)
                {
                    //锁定
                    RoleModel one = null;
                    twoBattleRoomRoleModels.TryDequeue(out one);
                    if (one != null)
                    {
                        RoleModel two;
                        twoBattleRoomRoleModels.TryDequeue(out two);
                        if (two != null)
                        {
                            //创建房间,发送数据
                            roomManager.createTwoRoom(one, two);
                        }
                        else
                        {
                            twoBattleRoomRoleModels.Enqueue(one);
                        }
                    }
                }
            }
        }
Exemple #2
0
 protected void _write(long accontId, int commend, ReturnDTO returnDTO)
 {
     messageManaer.write(accontId, commend, returnDTO);
 }