示例#1
0
        public async void JoinOrLeave()
        {
            if (isJoin)
            {
                await streamingClient.LeaveAsync();

                InitializeUi();
            }
            else
            {
                var request = new JoinRequest {
                    RoomName = "SampleRoom", UserName = Input.text
                };
                await streamingClient.JoinAsync(request);

                isJoin = true;
                SendMessageButton.interactable = true;
                JoinOrLeaveButtonText.text     = "Leave the room";
                Input.text = string.Empty;
                Input.placeholder.GetComponent <Text>().text = "Please enter a comment.";
                ExceptionButton.interactable = true;
            }
        }
示例#2
0
 // Client -> Server impl
 public async Task JoinAsync(string roomName, string userName) => await chatHub.JoinAsync(new ChatJoinRequest { RoomName = roomName, UserName = userName });
 Task <JoinResult> IHubClient.JoinHubAsync(string roomName, string playerName, string userId)
 {
     return(_streamingHub.JoinAsync(roomName, playerName, userId));
 }