gg.easy.airship 0.1.1921 → 0.1.1922
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -132,9 +132,13 @@ namespace Code.Bootstrap {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
public void CleanupServer() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
try {
|
|
136
|
+
NetworkServer.UnregisterHandler<RequestScriptsMessage>();
|
|
137
|
+
NetworkServer.UnregisterHandler<ClientFinishedPreparingMessage>();
|
|
138
|
+
NetworkServer.UnregisterHandler<GreetingMessage>();
|
|
139
|
+
} catch (Exception e) {
|
|
140
|
+
Debug.LogException(e);
|
|
141
|
+
}
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
/// <summary>
|
|
@@ -20,6 +20,7 @@ using UnityEngine.Networking;
|
|
|
20
20
|
using UnityEngine.SceneManagement;
|
|
21
21
|
using UnityEngine.Serialization;
|
|
22
22
|
using Debug = UnityEngine.Debug;
|
|
23
|
+
using Random = UnityEngine.Random;
|
|
23
24
|
using SceneManager = UnityEngine.SceneManagement.SceneManager;
|
|
24
25
|
|
|
25
26
|
[Serializable]
|
|
@@ -104,9 +105,11 @@ public class ServerBootstrap : MonoBehaviour
|
|
|
104
105
|
transport.port = port;
|
|
105
106
|
|
|
106
107
|
if (RunCore.IsClient()) {
|
|
108
|
+
// use random port in shared mode
|
|
109
|
+
transport.port = (ushort)Random.Range(7770, 7870);
|
|
110
|
+
print("Listening on port " + transport.port);
|
|
107
111
|
AirshipNetworkManager.singleton.StartHost();
|
|
108
112
|
} else {
|
|
109
|
-
print("Listening on port " + port);
|
|
110
113
|
AirshipNetworkManager.singleton.StartServer();
|
|
111
114
|
}
|
|
112
115
|
} else {
|
|
@@ -129,7 +132,6 @@ public class ServerBootstrap : MonoBehaviour
|
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
private void ProcessExit(object sender, EventArgs args) {
|
|
132
|
-
Debug.Log("----> Process Exit!");
|
|
133
135
|
this.onProcessExit?.Invoke();
|
|
134
136
|
}
|
|
135
137
|
|