@@ -70,6 +70,7 @@ public class ChatApp : MonoBehaviour, IChatAppHubReceiver
70
70
/// </summary>
71
71
private string userName = "名無し" ;
72
72
73
+
73
74
private void Start ( )
74
75
{
75
76
// 画面を非表示
@@ -92,7 +93,8 @@ private void Start()
92
93
var sendButton = chatPage . GetComponentInChildren < Button > ( true ) ;
93
94
sendButton . onClick . AddListener ( OnClick_SendButton ) ;
94
95
95
- Init ( ) ;
96
+ // 入室画面を表示
97
+ joinPage . SetActive ( true ) ;
96
98
}
97
99
98
100
private async void OnDestroy ( )
@@ -116,6 +118,10 @@ private async void OnClick_JoinButton()
116
118
userName = nameInput . text ;
117
119
}
118
120
121
+ // サーバーへ接続
122
+ channel = GrpcChannelx . ForAddress ( "http://192.168.179.4:5001" ) ;
123
+ streamingClient = await StreamingHubClient . ConnectAsync < IChatAppHub , IChatAppHubReceiver > ( channel , this , cancellationToken : shutdownCancellation . Token ) ;
124
+
119
125
await streamingClient . JoinAsync ( roomName , userName ) ;
120
126
joinPage . SetActive ( false ) ;
121
127
chatPage . SetActive ( true ) ;
@@ -131,17 +137,6 @@ private async void OnClick_SendButton()
131
137
}
132
138
#endregion
133
139
134
- /// <summary>
135
- /// 初期処理
136
- /// </summary>
137
- private async void Init ( )
138
- {
139
- // サーバーへ接続
140
- channel = GrpcChannelx . ForAddress ( "http://localhost:5001" ) ;
141
- streamingClient = await StreamingHubClient . ConnectAsync < IChatAppHub , IChatAppHubReceiver > ( channel , this , cancellationToken : shutdownCancellation . Token ) ;
142
- joinPage . SetActive ( true ) ;
143
- }
144
-
145
140
146
141
#region MagicOnion サーバー⇒クライアントの受信
147
142
@@ -174,4 +169,4 @@ public void OnSendMessage(string userName, string message)
174
169
}
175
170
#endregion
176
171
}
177
- }
172
+ }
0 commit comments