示例#1
0
        public PResult Create(Room room)
        {
            string rid  = Utils.MakeRidFromID(room.map);
            int    seed = this._rnd.Next();

            StepLocker stepLocker = new StepLocker(rid);

            int count = room.teamOne.Count;

            for (int i = 0; i < count; i++)
            {
                string userId = room.teamOne[i].id;
                this._uidToLocker[userId] = stepLocker;
                stepLocker.AddUser(userId);
            }

            count = room.teamTwo.Count;
            for (int i = 0; i < count; i++)
            {
                string userId = room.teamTwo[i].id;
                this._uidToLocker[userId] = stepLocker;
                stepLocker.AddUser(userId);
            }

            this._idToLocker[stepLocker.id] = stepLocker;
            _DTO_player_info[] players = DTOHelper.GetPlayerInfoInRoom(room);

            stepLocker.ForeachUser(userId =>
            {
                IUserToken token = BizFactory.USER_BIZ.GetToken(userId);
                token.CALL_BATTLE_ACMD_ENTER_BATTLE(
                    StepLocker.FRAME_RATE, StepLocker.FRAMES_PER_KEYFRAME, rid,
                    players, seed, userId);
            });

            return(PResult.SUCCESS);
        }