Ejemplo n.º 1
0
 private void enter(SelectRoomDTO dto)
 {
     room = dto;
     SendMessage("closeMask");
     //刷新界面UI
     SelectEventUtil.refreshView(room);
 }
        private new void enter(UserToken token)
        {
            //判断用户所在的房间 并对其进入状态进行修改
            int userId = getUserId(token);

            if (team.ContainsKey(userId))
            {
                team[userId].enter = true;
            }
            else
            {
                return;
            }
            //判断用户是否已经在房间 不在则计算累加 否则无视
            if (base.enter(token))
            {
                enterCount++;
            }
            //进入成功 发送房间信息给进入的玩家 并通知在房间内的其他玩家 有人进入了
            SelectRoomDTO dto = new SelectRoomDTO();

            dto.teamOne = team.Values.ToArray();
            write(token, SelectProtocol.ENTER_SRES, dto);
            brocast(SelectProtocol.ENTER_EXBRO, userId, token);
        }
Ejemplo n.º 3
0
    private void RefreshView(SelectRoomDTO room)
    {
        int team = room.GetTeam(GameData.user.ID);

        if (team == 1)
        {
            for (int i = 0; i < room.TeamOne.Length; i++)
            {
                left[i].Refresh(room.TeamOne[i]);
            }
            for (int i = 0; i < room.TeamTwo.Length; i++)
            {
                right[i].Refresh(room.TeamTwo[i]);
            }
        }
        else
        {
            for (int i = 0; i < room.TeamOne.Length; i++)
            {
                right[i].Refresh(room.TeamOne[i]);
            }
            for (int i = 0; i < room.TeamTwo.Length; i++)
            {
                left[i].Refresh(room.TeamTwo[i]);
            }
        }
        RefreshHeroList(room);
    }
Ejemplo n.º 4
0
 private void myEnter(SelectRoomDTO room)
 {
     Debug.Log("接收到自己进入");
     SendMessage("closeMask");
     myRoom = room;
     SendMessage("refreshView", room);
 }
Ejemplo n.º 5
0
        private void EnterRoom(UserToken token)
        {
            //判断用户所在的房间,并对进入状态就行修改
            int userID = GetUserId(token);

            if (teamOnes.ContainsKey(userID))
            {
                teamOnes[userID].IsEnter = true;
            }
            else if (teamTwos.ContainsKey(userID))
            {
                teamTwos[userID].IsEnter = true;
            }
            else
            {
                return;
            }

            //判断用户是否已经在房间,不在则计算累加,否则无视
            if (base.Enter(token))
            {
                enterCount++;
            }
            //进入成功,发送房间信息给其他玩家,并通知其他玩家有人进入
            SelectRoomDTO dto = new SelectRoomDTO();

            dto.TeamOne = teamOnes.Values.ToArray();
            dto.TeamTwo = teamTwos.Values.ToArray();
            Write(token, SelectProtocol.ENTER_SRES, dto);
            Brocast(SelectProtocol.ENTER_EXBRO, userID, dto);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 自身的进入
 /// </summary>
 /// <param name="roomDTO"></param>
 private void Enter(SelectRoomDTO roomDTO)
 {
     room = roomDTO;
     SendMessage("CloseMask");
     //刷新界面UI
     SelectEventUtil.refreshView(room);
 }
Ejemplo n.º 7
0
        private new void Enter(UserToken token)
        {
            int userId = GetUserId(token);

            if (teamOne.ContainsKey(userId))
            {
                teamOne[userId].isEnter = true;
            }
            else if (teamTwo.ContainsKey(userId))
            {
                teamTwo[userId].isEnter = true;
            }
            else
            {
                return;
            }

            if (base.Enter(token))
            {
                enterCount++;
            }

            SelectRoomDTO dto = new SelectRoomDTO();

            dto.SelfUserId = userId;
            dto.teamOne    = teamOne.Values.ToArray();
            dto.teamTwo    = teamTwo.Values.ToArray();
            Send(token, SelectProtocol.ENTER_SRES, dto);        //向申请登录的玩家发送整个房间的信息
            brocast(SelectProtocol.ENTER_EXBRO, userId, token); //向其他人发送这个玩家登录的信息
        }
Ejemplo n.º 8
0
    void refreshView(SelectRoomDTO room)
    {
        int team = room.GetTeam(GameData.user.id);

        //如果自身在队伍一  则队伍一显示在左边 否则队伍二显示在左边
        if (team == 1)
        {
            for (int i = 0; i < room.teamOne.Length; i++)
            {
                left[i].refresh(room.teamOne[i]);
            }
            for (int i = 0; i < room.teamTwo.Length; i++)
            {
                right[i].refresh(room.teamTwo[i]);
            }
        }
        else
        {
            for (int i = 0; i < room.teamOne.Length; i++)
            {
                right[i].refresh(room.teamOne[i]);
            }
            for (int i = 0; i < room.teamTwo.Length; i++)
            {
                left[i].refresh(room.teamTwo[i]);
            }
        }
        refreshHeroList(room);
    }
Ejemplo n.º 9
0
    void refeshView(SelectRoomDTO room)
    {
        int team = room.getTeam(GameData.user.id);

        if (team == 1)
        {
            for (int i = 0; i < room.teamOne.Length; i++)
            {
                left[i].refesh(room.teamOne[i]);
            }
            for (int i = 0; i < room.teamTwo.Length; i++)
            {
                right[i].refesh(room.teamTwo[i]);
            }
        }
        else if (team == 2)
        {
            for (int i = 0; i < room.teamTwo.Length; i++)
            {
                left[i].refesh(room.teamTwo[i]);
            }
            for (int i = 0; i < room.teamOne.Length; i++)
            {
                right[i].refesh(room.teamOne[i]);
            }
        }
        refeshList(room);
    }
Ejemplo n.º 10
0
    void refreshView(SelectRoomDTO dto)
    {
        int team = dto.inTeam(GameData.user.id);

        if (team == 1)
        {
            for (int i = 0; i < dto.teamOne.Length; i++)
            {
                left[i].setData(dto.teamOne[i]);
            }
            for (int i = 0; i < dto.teamTwo.Length; i++)
            {
                right[i].setData(dto.teamTwo[i]);
            }
        }
        else if (team == 2)
        {
            for (int i = 0; i < dto.teamOne.Length; i++)
            {
                right[i].setData(dto.teamOne[i]);
            }
            for (int i = 0; i < dto.teamTwo.Length; i++)
            {
                left[i].setData(dto.teamTwo[i]);
            }
        }
        refreshHeroList(dto);
    }
Ejemplo n.º 11
0
        private void Enter(UserToken token)
        {
            int userID = getUserID(token);

            if (teamOne.ContainsKey(userID))
            {
                teamOne[userID].enter = true;
            }
            else if (teamTwo.ContainsKey(userID))
            {
                teamTwo[userID].enter = true;
            }
            else
            {
                return;
            }
            //判断用户是否进入,没有则计算累加
            if (base.enter(token))
            {
                enterCount++;
            }

            SelectRoomDTO dto = new SelectRoomDTO();

            dto.teamOne = teamOne.Values.ToArray();
            dto.teamTwo = teamTwo.Values.ToArray();
            //告诉这个玩家房间的信息
            write(token, SelectProtocol.ENTER_SRES, dto);
            //告诉其他玩家这个用户进入房间
            brocast(SelectProtocol.ENTER_EXBRO, userID, token);//申请进入  返回选择的房间
        }
Ejemplo n.º 12
0
 //处理自己进入
 void enter(SelectRoomDTO room)
 {
     ROOM = room;
     //处理UI
     if (refeshSelectUI != null)
     {
         refeshSelectUI(ROOM);
     }
 }
Ejemplo n.º 13
0
 private int teamId;               //自己的队伍Id
 /// <summary>
 /// 设置两队所有玩家的UI
 /// </summary>
 /// <param name="room"></param>
 private void SetPlayers(SelectRoomDTO room)
 {
     selfUserId = room.SelfUserId;
     teamId     = room.GetTeam(room.SelfUserId);
     if (teamId == 1)
     {
         SetTeam(leftList, room.teamOne);
         SetTeam(rightList, room.teamTwo);
     }
     else if (teamId == 2)
     {
         SetTeam(leftList, room.teamTwo);
         SetTeam(rightList, room.teamOne);
     }
 }
Ejemplo n.º 14
0
        void updateInfoDatPhong(string mapd)
        {
            SelectRoomDTO transfer = new SelectRoomDTO(mapd);

            if (SelectRoomDAO.Instance.updateInfoDatPhong(transfer) >= 1)
            {
                messOK();
                loadDsDatPhong();
                disable_edit();
            }
            else
            {
                messWR();
            }
        }
Ejemplo n.º 15
0
        void cancelDatPhong(string mapd)
        {
            SelectRoomDTO transfer = new SelectRoomDTO(mapd);

            if (SelectRoomDAO.Instance.cancelDatPhong(transfer) >= 1)
            {
                loadPhongTrong();
                messOK();
                loadDsDatPhong();
                disable_edit();
            }
            else
            {
                messWR();
            }
        }
Ejemplo n.º 16
0
        void insertInfoDatPhong(string mapd, string makh, string ngayden, string ngaydi, int tongtien, string username)
        {
            SelectRoomDTO transfer = new SelectRoomDTO(mapd, makh, ngayden, ngaydi, tongtien, username);

            if (SelectRoomDAO.Instance.insertInfoDatPhong(transfer) >= 1)
            {
                loadPhongTrong();
                messOK();
                loadDsDatPhong();
                disable_edit();
            }
            else
            {
                messWR();
            }
        }
Ejemplo n.º 17
0
        private bool playerHasEnter = false;//玩家是否已经进入选择

        /// <summary>
        /// 选择网络消息处理
        /// </summary>
        /// <param name="sm"></param>
        public override void OnMessageReceived(SocketModel sm)
        {
            switch (sm.command)
            {
            case SelectProtocol.ENTER_SRES:
                SelectRoomDTO selectRoom = sm.GetMessage <SelectRoomDTO>();
                playerHasEnter = true;
                MgrCenter.Instance.SendMsg(Msgs.GetMsgSelectRoom((ushort)NetEventSelect.EnterSres, selectRoom));
                break;

            case SelectProtocol.ENTER_EXBRO:
                if (playerHasEnter)
                {
                    int enterUserId = sm.GetMessage <int>();
                    MgrCenter.Instance.SendMsg(Msgs.GetMsgInt((ushort)NetEventSelect.SomeOneEntered, enterUserId));
                }
                break;

            case SelectProtocol.SELECT_BRO:
                if (playerHasEnter)
                {
                    SelectDTO selectDTO = sm.GetMessage <SelectDTO>();
                    MgrCenter.Instance.SendMsg(Msgs.GetMsgSelectDTO((ushort)NetEventSelect.SomeOneSelected, selectDTO));
                }
                break;

            case SelectProtocol.SELECT_SRES:

                break;

            case SelectProtocol.READY_BRO:
                if (playerHasEnter)
                {
                    SelectDTO select = sm.GetMessage <SelectDTO>();
                    MgrCenter.Instance.SendMsg(Msgs.GetMsgSelectDTO((ushort)NetEventSelect.SomeOneReady, select));
                }
                break;

            case SelectProtocol.FIGHT_BRO:
                if (playerHasEnter)
                {
                    MgrCenter.Instance.SendMsg(Msgs.GetMsgString((ushort)SceneLoadEvent.LoadScene, "Fight"));
                }
                break;
            }
        }
Ejemplo n.º 18
0
    void refeshList(SelectRoomDTO room)
    {
        if (!ready.interactable)
        {
            foreach (heroGrid item in gridMap.Values)
            {
                item.disable();
            }
            return;
        }
        List <int> selectedHero = new List <int>();
        int        team         = room.getTeam(GameData.user.id);

        if (team == 1)
        {
            foreach (SelectModel item in room.teamOne)
            {
                if (item.hero != -1)
                {
                    selectedHero.Add(item.hero);
                }
            }
        }
        else if (team == 2)
        {
            foreach (SelectModel item in room.teamTwo)
            {
                if (item.hero != -1)
                {
                    selectedHero.Add(item.hero);
                }
            }
        }

        foreach (int item in gridMap.Keys)
        {
            if (selectedHero.Contains(item))
            {
                gridMap[item].disable();
            }
            else
            {
                gridMap[item].enable();
            }
        }
    }
Ejemplo n.º 19
0
    private void refreshHeroList(SelectRoomDTO room)
    {
        int        team     = room.GetTeam(GameData.User.id);
        List <int> selected = new List <int>();

        //获取自己所在的队伍 已经选择了的英雄列表
        if (team == 1)
        {
            foreach (SelectModel item in room.teamOne)
            {
                if (item.hero != -1)
                {
                    selected.Add(item.hero);
                }
            }
        }
        else
        {
            foreach (SelectModel item in room.teamTwo)
            {
                if (item.hero != -1)
                {
                    selected.Add(item.hero);
                }
            }
        }

        //将已选英雄从选择菜单中设置状态为不可选状态
        foreach (int item in gridMap.Keys)
        {
            if (selected.Contains(item) || !ready.interactable)
            {
                gridMap[item].deactive();
            }
            else
            {
                gridMap[item].active();
            }
        }
    }
Ejemplo n.º 20
0
    private void RefreshHeroList(SelectRoomDTO room)
    {
        int        team     = room.GetTeam(GameData.user.ID);
        List <int> selected = new List <int>();

        if (team == 1)
        {
            foreach (SelectModel item in room.TeamOne)
            {
                if (item.Hero != -1)
                {
                    selected.Add(item.Hero);
                }
            }
        }
        else
        {
            foreach (SelectModel item in room.TeamTwo)
            {
                if (item.Hero != -1)
                {
                    selected.Add(item.Hero);
                }
            }
        }

        //将已选的英雄从选择菜单设置状态改为不可选状态
        foreach (int item in gridMap.Keys)
        {
            if (selected.Contains(item) || !ready.interactable)
            {
                gridMap[item].Deactive();
            }
            else
            {
                gridMap[item].Active();
            }
        }
    }
Ejemplo n.º 21
0
    public void refreshHeroList(SelectRoomDTO dto)
    {
        room = dto;
        int        team     = dto.inTeam(GameData.user.id);
        List <int> selected = new List <int>();

        if (team == 1)
        {
            for (int i = 0; i < dto.teamOne.Length; i++)
            {
                if (dto.teamOne[i].heroId != -1)
                {
                    selected.Add(dto.teamOne[i].heroId);
                }
            }
        }
        else
        {
            for (int i = 0; i < dto.teamTwo.Length; i++)
            {
                if (dto.teamTwo[i].heroId != -1)
                {
                    selected.Add(dto.teamTwo[i].heroId);
                }
            }
        }
        foreach (int item in myGrid.Keys)
        {
            if (selected.Contains(item) || !startBtn.enabled)
            {
                myGrid[item].deactive();
            }
            else
            {
                myGrid[item].active();
            }
        }
    }
Ejemplo n.º 22
0
        private new void enter(UserToken token)
        {
            if (base.enter(token))
            {
                inCount++;
            }
            SelectRoomDTO dto    = new SelectRoomDTO();
            int           userId = getUserId(token);

            if (teamOneMap.ContainsKey(userId))
            {
                teamOneMap[userId].entered = true;
            }
            else if (teamTwoMap.ContainsKey(userId))
            {
                teamTwoMap[userId].entered = true;
            }
            dto.teamOne = teamOneMap.Values.ToArray();
            dto.teamTwo = teamTwoMap.Values.ToArray();
            write(token, SelectProtocol.ENTER_SRES, dto);

            exBrocast(token, SelectProtocol.ENTER_BRO, userId);
        }
Ejemplo n.º 23
0
        void createDatPhong(string mapd, string maphong)
        {
            SelectRoomDTO transfer = new SelectRoomDTO(mapd, maphong);

            try
            {
                if (SelectRoomDAO.Instance.createDatPhong(transfer) >= 1)
                {
                    messOK();
                    loadDsDatPhong();
                    enable_edit();
                    loadPhongTrong();
                }
                else
                {
                    messWR();
                }
            }
            catch
            {
                MessageBox.Show("Mã phiếu đặt đã tồn tại");
            }
        }
Ejemplo n.º 24
0
 private void AutoMyEnter(SelectRoomDTO room)
 {
     myRoom = room;
     //SelectEventUtil.selectHero(GameData.user.heroList[0]);
     SelectEventUtil.selectHero(1);
 }
Ejemplo n.º 25
0
 public static MsgSelectRoom GetMsgSelectRoom(ushort msgId, SelectRoomDTO selectRoomDTO)
 {
     msgSelectRoom.SetMsgSelectRoom(msgId, selectRoomDTO);
     return(msgSelectRoom);
 }
Ejemplo n.º 26
0
 public MsgSelectRoom(ushort msgId, SelectRoomDTO selectRoom)
 {
     this.msgId      = msgId;
     this.selectRoom = selectRoom;
 }
Ejemplo n.º 27
0
 public int createDatPhong(SelectRoomDTO transfer)
 {
     object[] parameters = new object[] { transfer.Mapd, transfer.Maphong };
     return(DataProvider.Instance.ExecuteNonQuery("createDatPhong @mapd , @maphong", parameters));
 }
Ejemplo n.º 28
0
 public int insertInfoDatPhong(SelectRoomDTO transfer)
 {
     object[] parameters = new object[] { transfer.Mapd, transfer.Makh, transfer.Ngayden, transfer.Ngaydi, transfer.Tongtiendat, transfer.Username };
     return(DataProvider.Instance.ExecuteNonQuery("insertInfoDatPhong @mapd , @makh , @ngayden , @ngaydi , @tongtiendat , @username", parameters));
 }
Ejemplo n.º 29
0
 public int cancelDatPhongWithStt(SelectRoomDTO transfer)
 {
     return(1);
 }
Ejemplo n.º 30
0
 public int updateInfoDatPhong(SelectRoomDTO transfer)
 {
     object[] parameters = new object[] { transfer.Mapd };
     return(DataProvider.Instance.ExecuteNonQuery("updateDetailDatPhong @mapd", parameters));
 }