private void listRoom(RoomInfo roomInfo) { if (roomInfo.IsOpen && roomInfo.MaxPlayers != 0) { if (publicListing) { if (roomInfo.IsVisible) { GameObject temp = Instantiate(roomButtonPrefab, roomListingPanel); RoomButton roomButton = temp.GetComponent <RoomButton>(); roomButton.roomNameText.text = roomInfo.Name; roomButton.roomCapacityText.text = roomInfo.PlayerCount + "/" + roomInfo.MaxPlayers; } } else { if (!roomInfo.IsVisible) { GameObject temp = Instantiate(roomButtonPrefab, roomListingPanel); RoomButton roomButton = temp.GetComponent <RoomButton>(); roomButton.roomNameText.text = roomInfo.Name; roomButton.roomCapacityText.text = roomInfo.PlayerCount + "/" + roomInfo.MaxPlayers; } } } }
void AddRoomPanel(RoomInfo room) { GameObject gbj = Instantiate(roomListingPrefab, roomsPanel, false); RoomButton rb = gbj.GetComponent <RoomButton>(); rb.SetRoom(room); m_roomPanelList.Add(room.Name, rb); }
private void ListRoom(RoomInfo room) { if (room.IsOpen && room.IsVisible) { GameObject tempListing = Instantiate(roomListingPrefab, roomsContainer); RoomButton tempButton = tempListing.GetComponent <RoomButton>(); tempButton.SetRoom(room.Name, room.MaxPlayers, room.PlayerCount); } }
void ListRoom(RoomInfo room) //displays new room listing for the current Room { if (room.IsOpen && room.IsVisible) { GameObject tempListing = Instantiate(roomsListItem, roomsContainer); RoomButton tempButton = tempListing.GetComponent <RoomButton>(); tempButton.SetRoom(room.Name, room.MaxPlayers, room.PlayerCount); } }
void AddRoomToPanelList(RoomInfo room) { if (room.IsOpen && room.IsVisible) { GameObject newListing = Instantiate(roomSlotPrefab, roomsContainer, true); RoomButton roomButton = newListing.GetComponent <RoomButton>(); roomButton.SetRoom(room.Name, room.MaxPlayers, room.PlayerCount); } }
private void SetButtonText(RoomButton button, string text) { Text[] buttonTexts = button.GetComponentsInChildren <Text> (); if (buttonTexts.Length != 1) { Debug.LogErrorFormat("Number of Text components in button: {0}. " + "This should be one.", buttonTexts.Length); } buttonTexts[0].text = text; }
void ListRoom(RoomInfo room) { if (room.IsOpen && room.IsVisible) { GameObject tempListing = Instantiate(roomListingPrefab, roomsPanel); RoomButton tempButton = tempListing.GetComponent <RoomButton>(); tempButton.roomName = room.Name; tempButton.roomSize = room.MaxPlayers; } }
void ListRoom(RoomInfo room) { if (room.IsOpen && room.IsVisible) { GameObject temp_listing = Instantiate(room_listing_prefab, rooms_panel); RoomButton temp_button = temp_listing.GetComponent <RoomButton>(); temp_button.room_name = room.Name; temp_button.room_max_player = room.MaxPlayers; temp_button.SetRoom(); } }
public void RESPONSE_OTHER_GAME_END(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_OtherGameEndPacketData recvData = new SERVERtoCLIENT_OtherGameEndPacketData(); recvData.Deserialize(packet); RoomButton roomButton = RoomManager.Instance.GetRoomButton(recvData.roomKey); roomButton.EndGame(); } }
public void UpdateRooms(List <RoomInfo> roomList) { HideAll(); foreach (RoomInfo i in roomList) { RoomButton rb = pool.Get(); rb.transform.SetParent(holderPanel); rb.SetData(i.Name, i.PlayerCount.ToString()); rb.gameObject.SetActive(true); } }
void ListRoom(RoomInfo room) { if (room.IsOpen && room.IsVisible) { GameObject tempListing = Instantiate(roomlistingprefab, roomspanel); RoomButton tempbutton = tempListing.GetComponent <RoomButton>(); tempbutton.roomname = room.Name; tempbutton.roomsize = room.MaxPlayers; tempbutton.SetRoom(); } }
public void RemoveRoomButton(string roomKey) { RoomButton removeRoom = this.roomButtons.Find((room) => room.RoomKey == roomKey); if (removeRoom != null) { this.roomButtons.Remove(removeRoom); LobbyGUI.Instance.RemoveRoomButton(removeRoom); LobbyGUI.Instance.LayoutPositionOfRoom(roomButtons); } }
public void ListRoom(RoomInfo room) { if (room.IsOpen && room.IsVisible) { GameObject tempListing = Instantiate(roomListingPrefab, roomsPanel); RoomButton tempButton = tempListing.GetComponent <RoomButton>(); tempButton.roomName = room.Name; tempButton.SetRoom(); roomListEntries.Add(room.Name, tempListing); } }
//display Room in room panel void ListRoom(RoomInfo newRoom) { if (newRoom.IsOpen && newRoom.IsVisible) { GameObject tempListing = Instantiate(roomListingPrefab, roomsPanel); RoomButton tempButton = tempListing.GetComponent <RoomButton>(); tempButton.roomName = newRoom.Name.Substring(roomCodeLength); tempButton.roomSize = newRoom.MaxPlayers; tempButton.SetRoom(); } }
/** * Instantiate a button and */ private void AddButton(string text) { RoomButton button = Instantiate <RoomButton> (roomButtonPrefab); button.transform.SetParent(transform); // Set where the button is and the text it displays SetButtonPos(button.GetComponent <RectTransform> ()); buttonCount += 1; SetButtonText(button, text); button.AddAction(OnRoomButtonPressed); }
private void AddRoom(RoomInfo room) { if (!_currentCustomMatchButtons.ContainsKey(room.Name)) { RoomButton roomButton = Instantiate(_roomTemplatePrefab, transform).GetComponent <RoomButton>(); roomButton.Button.onClick.AddListener(() => OnClicked(roomButton)); roomButton.SetRoomInfo(room); _currentCustomMatchRooms.Add(room.Name, room); _currentCustomMatchButtons.Add(room.Name, roomButton); } }
void ListRoom(RoomInfo room) { if (room.IsOpen == true && room.IsVisible == true && room.PlayerCount < room.MaxPlayers) { string temp = ""; int slimeStage = int.Parse(room.Name[room.Name.Length - 1].ToString()) - 1; int slimeElem = int.Parse(room.Name[room.Name.Length - 3].ToString()); for (int i = 0; i < room.Name.Length - 4; i++) { temp = temp + room.Name[i]; } GameObject tempListing = Instantiate(roomListingPrefab, roomsContainer); RoomButton tempButton = tempListing.GetComponent <RoomButton>(); tempButton.SetRoom(room.Name, temp, slimeSprites[slimeElem], ssl[slimeStage].SlimeStage[slimeElem]); } }
public MainPage(UserDTO userDTO) { InitializeComponent(); CurrentUser = userDTO; foreach (var item in CurrentUser.ParticipantDTO) { if (item.RoomDTO.Messages != null) { RoomButton roomButton = new RoomButton() { UserName = item.RoomDTO.Name, LastMessage = String.Empty }; roomButton.LastMessage = item.RoomDTO.Messages.Last().Sender.UserName + ": " + item.RoomDTO.Messages.Last().Text; roomButton.Icon = item.RoomDTO.Messages.Last().Sender.Icon; roomButton.Click += new System.Windows.RoutedEventHandler((Sender, Args) => { for (int i = 0; i < ButtonsPanel.Children.Count; i++) { if (ButtonsPanel.Children[i] is RoomButton) { (ButtonsPanel.Children[i] as RoomButton).UnSelect(); } } roomButton.Select(); ChatFrame.Content = new ChatControl(item.RoomDTO, CurrentUser); }); roomButton.MouseRightButtonDown += new MouseButtonEventHandler((Sender, Args) => { nameForGroup = roomButton.UserName; ContextMenu cm = this.FindResource("cmButton") as ContextMenu; cm.PlacementTarget = Sender as Button; cm.IsOpen = true; }); roomButton.SetContent(); ButtonsPanel.Children.Add(roomButton); } } }
public void RESPONSE_CREATE_ROOM_OTHER_PLAYER(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.FOR_JOIN_ROOM) { SERVERtoCLIENT_CreateRoomOtherPlayerPacketData recvData = new SERVERtoCLIENT_CreateRoomOtherPlayerPacketData(); recvData.Deserialize(packet); RoomButton roomButton = RoomManager.Instance.CreateRoomButton(recvData.roomKey, recvData.roomName, false, 1); LobbyManager.Instance.AttachRoomButton(roomButton); LobbyManager.Instance.RemoveLobbyPlayer(recvData.playerName); Debug.Log("Create Room By Other Player..."); } else if (packet.header.extra == (int)EXTRA.FAIL) { Debug.Log("FAIL Create Room By Other Player"); } }
public void RESPONSE_LEAVE_ROOM_OTHER_PLAYER(TcpPacket packet) { SERVERtoCLIENT_LeaveRoomOtherPlayerPacketData recvData = new SERVERtoCLIENT_LeaveRoomOtherPlayerPacketData(); recvData.Deserialize(packet); if (GameFramework.Instance.MyPlayer.State == PLAYER_STATE.LOBBY) { LobbyManager.Instance.CreateLobbyPlayer(recvData.playerID); RoomButton roomButton = RoomManager.Instance.GetRoomButton(recvData.roomKey); if (roomButton != null) { roomButton.DecreaseRoomJoinCount(); } } else if (GameFramework.Instance.MyPlayer.State == PLAYER_STATE.IN_ROOM) { RoomManager.Instance.EnteredRoom.LeaveOtherPlayer(recvData.playerID); } }
//================================================================= #region Events public void OnRoomClick(RoomButton button) { _canvas.enabled = false; var game = MetaManager.Instance.Get <GameManager>(); game.Room = button.TargetRoomId; if (button.IsBlocked) { SceneLoader.Instance.GoToQRUnlock("SelectionMenu"); } else if (game.IsReadyToPlay) { game.Play(); } else { Camera.main.GetComponent <Animator>().SetTrigger("ShowBoomons"); } }
public void RESPONSE_JOIN_ROOM_OTHER_PLAYER(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_JoinRoomOtherPlayerPacketData recvData = new SERVERtoCLIENT_JoinRoomOtherPlayerPacketData(); recvData.Deserialize(packet); if (GameFramework.Instance.MyPlayer.State == PLAYER_STATE.LOBBY) { //내가 Lobby에 있을때 다른사람이 Room으로 들어갔으므로 오른쪽 유저 리스트에 해당 유저를 지워야 함 LobbyManager.Instance.RemoveLobbyPlayer(recvData.playerID); //해당 방에 사람이 들어갔으므로 방 참여자수 1 증가 RoomButton roomButton = RoomManager.Instance.GetRoomButton(recvData.roomKey); if (roomButton != null) { roomButton.IncreaseRoomJoinCount(); } } else if (GameFramework.Instance.MyPlayer.State == PLAYER_STATE.IN_ROOM) { //내가 Room에 있을때 다른사람이 Room에서 들어왔으므로 방에 해당 유저를 추가해야 함 string chatMessage = "[Server] : " + recvData.playerID + "님이 방에 입장하였습니다."; RoomGUI.Instance.ShowChatMessage(chatMessage, Color.red); Player player = new OtherPlayer(); player.Initialize(); player.PlayerID = recvData.playerID; RoomPlayer roomPlayer = RoomManager.Instance.CreateRoomPlayer(player); roomPlayer.readyState = false; roomPlayer.isLeader = false; RoomManager.Instance.EnteredRoom.PushRoomPlayer(roomPlayer); RoomGUI.Instance.UpdateRoomPlayerUIElement(RoomManager.Instance.EnteredRoom); } } }
public void RESPONSE_ENTER_LOBBY(TcpPacket packet) { if (packet.header.extra == (int)EXTRA.SUCCESS) { SERVERtoCLIENT_EnterLobbyPacketData recvData = new SERVERtoCLIENT_EnterLobbyPacketData(); recvData.Deserialize(packet); for (int i = 0; i < recvData.roomCount; i++) { RoomButton roomButton = RoomManager.Instance.CreateRoomButton(recvData.roomKeys[i], recvData.roomNames[i], recvData.isStart[i], recvData.joinedRoomPlayerCount[i]); LobbyManager.Instance.AttachRoomButton(roomButton); } for (int i = 0; i < recvData.playerCount; i++) { LobbyManager.Instance.CreateLobbyPlayer(recvData.playerIds[i]); } } else if (packet.header.extra == (int)EXTRA.FAIL) { Debug.Log("FAIL RESPONSE_LOBBY_INFO"); } }
//Setting the RoomButton public override void OnRoomListUpdate(List <RoomInfo> roomList) { foreach (RoomButton rb in allRoomButtons) { Destroy(rb.gameObject); } allRoomButtons.Clear(); roomButton.gameObject.SetActive(false); for (int i = 0; i < roomList.Count; i++) { if (roomList[i].PlayerCount != roomList[i].MaxPlayers && !roomList[i].RemovedFromList) { RoomButton newButton = Instantiate(roomButton, roomButton.transform.parent); newButton.SetButtonDetails(roomList[i]); newButton.gameObject.SetActive(true); allRoomButtons.Add(newButton); } } }
private void MakeRoomButtons() { GameObject buttonPrefab = ResourcesHandler.Instance.RoomJumpRoomButton; WorldData wd = GameManagers.Instance.DataManager.GetWorldData(selectedWorldIndex); float tempX = 0; float tempY = 0; Vector2 buttonSize = new Vector2(200, 30); Vector2 buttonGap = new Vector2(8, 6); foreach (RoomData rd in wd.roomDatas.Values) { RoomButton newButton = Instantiate(buttonPrefab).GetComponent <RoomButton>(); newButton.Initialize(rt_roomButtons, rd, new Vector2(tempX, tempY), buttonSize); tempY -= buttonSize.y + buttonGap.y; if (-tempY + buttonSize.y + buttonGap.y > rt_roomButtons.rect.height) // Loop da loop. { tempY = 0; tempX += buttonSize.x + buttonGap.x; } } }
public void RESPONSE_LEAVE_ROOM(TcpPacket packet) { SERVERtoCLIENT_LeaveRoomPacketData recvData = new SERVERtoCLIENT_LeaveRoomPacketData(); recvData.Deserialize(packet); RoomManager.Instance.EnteredRoom.Leave(); RoomManager.Instance.EnteredRoom = null; LobbySceneGUI.Instance.ChangeRoomToLobby(); for (int i = 0; i < recvData.roomCount; i++) { RoomButton roomButton = RoomManager.Instance.CreateRoomButton(recvData.roomKeys[i], recvData.roomNames[i], recvData.isStart[i], recvData.joinedRoomPlayerCount[i]); LobbyManager.Instance.AttachRoomButton(roomButton); } for (int i = 0; i < recvData.playerCount; i++) { LobbyManager.Instance.CreateLobbyPlayer(recvData.playerNames[i]); } GameFramework.Instance.MyPlayer.State = PLAYER_STATE.LOBBY; }
public RoomButton GetRoomButton(string roomKey) { RoomButton roomButton = this.roomButtons.Find((room) => room.RoomKey == roomKey); return(roomButton); }
private void OnClicked(RoomButton roomButton) { CurrentRoomToJoin = roomButton.TMP_Text.text; Debug.Log(CurrentRoomToJoin); }
public void RemoveRoomButton(RoomButton roomButton) { Destroy(roomButton.gameObject); }
public void MoveToRoomPanel(RoomButton roomButton) { roomButton.GetComponent <RectTransform>().SetParent(roomPanel); }