void CreateRoom(SocketModel mes) { RoomInfoDTO dto = mes.GetMessage <RoomInfoDTO>(); uiMgr.LoadPerpareUI(); PrepareUI.GetInstance().CreateRoom(dto); }
/// <summary> /// 显示搜索到的卡片 /// </summary> private void ShowSearchRoom(List <RoomInfoDTO> list) { this.gameObject.SetActive(true); if ((list.Count % 9) != 0) { totalPage = list.Count / 9 + 1; } else { totalPage = list.Count / 9; } curPage = 1; currentCardList = list; curShowList = new List <RoomInfoDTO>(); if (currentCardList.Count <= 9) { for (int i = 0; i < currentCardList.Count; i++) { RoomInfoDTO dto = currentCardList[i]; curShowList.Add(dto); } } else { for (int i = 0; i < 9; i++) { RoomInfoDTO dto = currentCardList[i]; curShowList.Add(dto); } } Show(curShowList); UpdateText(); }
/// <summary> /// 创建房间 /// </summary> public void CreateRoom(RoomInfoDTO mes) { Debug.Log("创建房间"); theHost = true; playerAccount.text = mes.roomOwner; myAccount.text = ""; playerToggle.enabled = false; playerToggle.isOn = false; GetDeckList(); }
public void SetText(RoomInfoDTO dto) { if (button == null) { button = GetComponent <Button>(); button.onClick.AddListener(OnButton); } roomID = dto.roomID; string roomName = dto.roomName; string roomOwner = dto.roomOwner; roomState = dto.roomState; text_room.text = roomID.ToString() + "\n" + roomState; text_room1.text = roomOwner + "\n" + roomName; }
/// <summary> /// 显示房间 /// </summary> /// <param name="cardList"></param> private void Show(List <RoomInfoDTO> list) { for (int i = 0; i < list.Count; i++) { Prefeb_Room card_select = roomList[i]; RoomInfoDTO dto = list[i]; card_select.SetText(dto); card_select.SetActive(true); } for (int i = list.Count; i < 9; i++) { Prefeb_Room card_select = roomList[i]; card_select.SetActive(false); } }
public void SendRoomListToUser(UserToken token) { if (roomInfoList.Count == 0) { RoomListDTO listDto = new RoomListDTO(); listDto.roomCount = 0; write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_ENTERGAMEHALL_CREQ, listDto); } else { RoomInfoDTO[] array = new RoomInfoDTO[roomInfoList.Count]; array = roomInfoList.ToArray(); RoomListDTO listDto = new RoomListDTO(); listDto.roomCount = array.Length; listDto.roomList = array; write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_ENTERGAMEHALL_CREQ, listDto); } }
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); }
protected void __brocast_role_skills_cards() { //通知所有的玩家,回合开始,以及那些人回合开始 RoomDTO dto = new RoomDTO(); List <string> ids = new List <string>(); //TODO 设置回合开始的人 dto.roomId = id; dto.map.Add(CommonFieldProtocol.ids, ids); //TODO 发送对应玩家的对应信息和自己的信息 //自己的:自己的ROOM_ID和ROOM_ROLE_ID、初始化的技能ID、卡牌ID、这些用于链接信息的 //别人的:ROOM_ID,角色模型ID,角色模型图片ID,没了。(不应该包含技能吧?) List <RoomInfoDTO> list = new List <RoomInfoDTO>(); //boss采用固定编码,roomId都采用统一制作 foreach (var item in roles) { RoomInfoDTO infoDTO = new RoomInfoDTO(); infoDTO.roomId = id; infoDTO.roomRoleId = item.id; infoDTO.cardIds = new List <int>(); infoDTO.skillIds = new List <int>(); infoDTO.cards = new List <BaseCardDTO>(); infoDTO.skills = new List <BaseSkillDTO>(); foreach (var cardId in item.cardList) { infoDTO.cardIds.Add(cardId.Id); BaseCardDTO baseCardDTO = new BaseCardDTO(); baseCardDTO.id = cardId.Id; baseCardDTO.name = cardId.Name; baseCardDTO.description = cardId.Description; infoDTO.cards.Add(baseCardDTO); } foreach (var skillId in item.skillList) { infoDTO.skillIds.Add(skillId.Id); BaseSkillDTO baseSkillDTO = new BaseSkillDTO(); baseSkillDTO.id = skillId.Id; baseSkillDTO.name = skillId.Name; baseSkillDTO.description = skillId.Description; infoDTO.skills.Add(baseSkillDTO); } list.Add(infoDTO); } foreach (var item in getAllPlayer()) { dto.roomRoleId = item.id; List <RoomInfoDTO> selfInfoDTOs = new List <RoomInfoDTO>(); List <RoomInfoDTO> otherInfoDTOs = new List <RoomInfoDTO>(); foreach (var infoDTO in list) { if (infoDTO.roomRoleId == item.id) { selfInfoDTOs.Add(infoDTO); } else { otherInfoDTOs.Add(infoDTO); } } dto.map.Add(CommonFieldProtocol.battleRoomBaseSelfInfo, selfInfoDTOs); dto.map.Add(CommonFieldProtocol.battleRoomBaseOtherInfo, otherInfoDTOs); _write(item.accontId, BattleRoomProtocol.START_TIME_S, new ReturnDTO(RETURN_CODE.SUCCESS, dto)); } }