Пример #1
0
        public void MessageRecevie(AceNetFrameWork.ace.UserToken token, AceNetFrameWork.ace.auto.SocketModel message)
        {
            switch (message.command)
            {
            case FightProtocol.ENTER_CREQ:
                enter(token);
                break;

            case FightProtocol.MOVE_CREQ:
                move(token, message.getMessage <MoveDTO>());
                break;

            case FightProtocol.SKILL_UP_CREQ:
                skillUp(token, message.getMessage <int>());
                break;

            case FightProtocol.ATTACK_CREQ:
                attack(token, message.getMessage <int[]>());
                break;

            case FightProtocol.DAMAGE_CREQ:
                damage(token, message.getMessage <DamageDTO>());
                break;
            }
        }
Пример #2
0
 public void offline(AceNetFrameWork.ace.UserToken token)
 {
     if (onlineAccMap.ContainsKey(token))
     {
         onlineAccMap.Remove(token);
     }
 }
Пример #3
0
 public dao.model.User get(AceNetFrameWork.ace.UserToken token)
 {
     if (tokenToId.ContainsKey(token))
     {
         return(idToUser[tokenToId[token]]);
     }
     return(null);
 }
Пример #4
0
 public int getId(AceNetFrameWork.ace.UserToken token)
 {
     if (!onlineAccMap.ContainsKey(token))
     {
         return(-1);
     }
     return(accMap[onlineAccMap[token]].id);
 }
Пример #5
0
        public void ClientClose(AceNetFrameWork.ace.UserToken token, string error)
        {
            DuelRoom room;

            if (roomMap.TryGetValue(token, out room))
            {
                room.ClientClose(token, error);
            }
        }
Пример #6
0
        public void Chat(AceNetFrameWork.ace.UserToken token, SocketModel mes)
        {
            ChatMesDTO dto     = mes.getMessage <ChatMesDTO>();
            string     account = cache.getAccount(token);

            dto.userName = account;
            list         = cache.getGameHallTokenList();
            brocast(TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_CHAT_CREQ, dto);

            // return 1;
        }
Пример #7
0
 public void offline(AceNetFrameWork.ace.UserToken token)
 {
     if (onlineTokenMap.ContainsKey(token))
     {
         string accout = onlineTokenMap[token].account;
         onLineAccountMap.Remove(accout);
         onlineTokenMap.Remove(token);
     }
     removeGameHallAccMap(token);
     removeRoomAccMap(token);
 }
Пример #8
0
        public void online(AceNetFrameWork.ace.UserToken token, string account)
        {
            Account acc = new Account();

            acc.account = account;
            acc.id      = myAtomic.getAndAdd();
            onlineTokenMap.Add(token, acc);
            onLineAccountMap.Add(account, acc);

            addToGameHallAccMap(token);
        }
Пример #9
0
        public void MessageRecevie(AceNetFrameWork.ace.UserToken token, AceNetFrameWork.ace.auto.SocketModel message)
        {
            switch (message.command)
            {
            case MatchProtocol.ENTER_CREQ:
                enter(token);
                break;

            case MatchProtocol.LEAVE_CREQ:
                leave(token);
                break;
            }
        }
Пример #10
0
        public void ClientClose(AceNetFrameWork.ace.UserToken token)
        {
            leave(token);
            int userId = getUserId(token);

            if (teamOneMap.ContainsKey(userId) || teamTwoMap.ContainsKey(userId))
            {
                if (missionId != -1)
                {
                    ScheduleUtil.Instance.removeMission(missionId);
                }
                brocast(SelectProtocol.ROOM_DESTORY_BRO, -3);
                EventUtil.Instance.selectDestory(getArea());
            }
        }
Пример #11
0
        public void ClientClose(AceNetFrameWork.ace.UserToken token)
        {
            base.leave(token);
            int id = getUserId(token);

            if (teamOne.ContainsKey(id) || teamTwo.ContainsKey(id))
            {
                if (!offline.Contains
                        (id))
                {
                    offline.Add(id);
                }
            }
            if (offline.Count == teamOne.Count + teamTwo.Count)
            { //移除战场
                EventUtil.Instance.fightDestory(getArea());
            }
        }
Пример #12
0
        public bool create(AceNetFrameWork.ace.UserToken token, string name)
        {
            int acc = accountBiz.get(token);

            if (acc == -1)
            {
                return(false);
            }
            User user = get(token);

            if (user != null)
            {
                return(false);
            }
            //创建角色
            user = new User(name, id.getAndAdd(), acc);
            accToUid.Add(acc, user.id);
            idToUser.Add(user.id, user);
            return(true);
        }
Пример #13
0
        public void MessageRecevie(AceNetFrameWork.ace.UserToken token, AceNetFrameWork.ace.auto.SocketModel message)
        {
            switch (message.command)
            {
            case SelectProtocol.ENTER_CREQ:
                enter(token);
                break;

            case SelectProtocol.SELECT_CREQ:
                select(token, message.getMessage <int>());
                break;

            case SelectProtocol.TALK_CREQ:
                //预留 不做
                break;

            case SelectProtocol.READY_CREQ:
                ready(token);
                break;
            }
        }
Пример #14
0
        public int CreateRoom(AceNetFrameWork.ace.UserToken token, SocketModel mes)
        {
            string roomName = mes.getMessage <string>();

            MatchRoom matchRoom = new MatchRoom(token);
            int       playerID  = cache.getId(token);
            string    account   = cache.getAccount(token);
            int       roomID    = atomic.getAndAdd();

            matchRoom.HostID      = playerID;
            matchRoom.hostAccount = account;
            if (matchRoomMap.TryAdd(roomID, matchRoom))
            {
                userMatch.TryAdd(playerID, roomID);
            }
            else
            {
                //如果添加房间失败,则发送失败消息
                Console.WriteLine("无法添加房间");
                write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_CREATEROOM_CREQ, 0);
                return(0);
            }
            RoomInfoDTO info = new RoomInfoDTO();

            info.roomID = roomID; info.roomName = roomName; info.roomState = "正在等待"; info.roomOwner = account;
            roomInfoList.Add(info);


            write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_CREATEROOM_CREQ, info);

            cache.removeGameHallAccMap(token);//将用户移除出大厅列表 加入到房间列表中
            cache.addToRoomAccMap(token);

            UpdateRoomListToAll();

            return(1);
        }
Пример #15
0
 public void Messagereceive(AceNetFrameWork.ace.UserToken token, AceNetFrameWork.ace.auto.SocketModel message)
 {
 }
Пример #16
0
 public void Messagereceive(AceNetFrameWork.ace.UserToken token, AceNetFrameWork.ace.auto.SocketModel message)
 {
     roomMap[token].Messagereceive(token, message);
 }
Пример #17
0
 public void ClientConnect(AceNetFrameWork.ace.UserToken token)
 {
 }
Пример #18
0
 public void online(AceNetFrameWork.ace.UserToken token, string account)
 {
     onlineAccMap.Add(token, account);
 }
Пример #19
0
 public void ClientClose(AceNetFrameWork.ace.UserToken token, string error)
 {
 }
Пример #20
0
 public void ClientClose(AceNetFrameWork.ace.UserToken token)
 {
     leave(token);
 }