19 private long roomID = 1;
24 public float Timeout = 1f;
26 private static bool ShouldLocalUserCreateRoom
38 localUserId = localUser.
GetID();
58 SharingManagerConnected();
62 SessionTrackerDisconnected();
74 StopCoroutine(AutoConnect());
84 private void SharingManagerConnected(
object sender = null, EventArgs e = null)
93 private void SessionTrackerDisconnected()
100 StartCoroutine(AutoConnect());
104 private IEnumerator AutoConnect()
108 Debug.Log(
"[AutoJoinSessionAndRoom] Attempting to connect...");
111 yield
return new WaitForSeconds(Timeout);
117 Debug.LogWarning(
"[AutoJoinSessionAndRoom] Disconnected from server. Waiting for a connection... ");
127 Debug.Log(
"[AutoJoinSessionAndRoom] Connected!");
135 Debug.LogFormat(
"[AutoJoinSessionAndRoom] Successfully connected to server with {0} Sessions.",
139 yield
return new WaitForEndOfFrame();
141 bool sessionExists =
false;
147 sessionExists =
true;
155 yield
return new WaitForEndOfFrame();
164 Debug.LogFormat(
"[AutoJoinSessionAndRoom] Didn't find session {0}, making a new one...",
SharingStage.
Instance.SessionName);
172 yield
return new WaitForEndOfFrame();
190 yield
return new WaitForEndOfFrame();
195 if (ShouldLocalUserCreateRoom)
217 yield
return new WaitForEndOfFrame();
228 Debug.LogFormat(
"[AutoJoinSessionAndRoom] Joining room {0}...",
SharingStage.
Instance.CurrentRoomManager.GetRoom(i).GetName().GetString());
243 Debug.LogFormat(
"[AutoJoinSessionAndRoom] Joined room {0} successfully!",
SharingStage.
Instance.CurrentRoom.GetName().GetString());
246 yield
return new WaitForEndOfFrame();