Ejemplo n.º 1
0
 /// <summary>
 /// 自身的进入
 /// </summary>
 /// <param name="roomDTO"></param>
 private void Enter(SelectRoomDTO roomDTO)
 {
     room = roomDTO;
     SendMessage("CloseMask");
     //刷新界面UI
     SelectEventUtil.refreshView(room);
 }
Ejemplo n.º 2
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.º 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 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);
        }