Skip to content

Commit 109833d

Browse files
committed
removing GameNetPortal
(cherry picked from commit 532bd10)
1 parent fe1880e commit 109833d

File tree

8 files changed

+38
-916
lines changed

8 files changed

+38
-916
lines changed

Assets/Scripts/Gameplay/ConnectionManagement/ClientGameNetPortal.cs

Lines changed: 0 additions & 322 deletions
This file was deleted.

Assets/Scripts/Gameplay/ConnectionManagement/ClientGameNetPortal.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Assets/Scripts/Gameplay/ConnectionManagement/ConnectionManager.cs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,42 @@ public enum ConnectionStateType
1818
Hosting
1919
}
2020

21+
public enum ConnectStatus
22+
{
23+
Undefined,
24+
Success, //client successfully connected. This may also be a successful reconnect.
25+
ServerFull, //can't join, server is already at capacity.
26+
LoggedInAgain, //logged in on a separate client, causing this one to be kicked out.
27+
UserRequestedDisconnect, //Intentional Disconnect triggered by the user.
28+
GenericDisconnect, //server disconnected, but no specific reason given.
29+
Reconnecting, //client lost connection and is attempting to reconnect.
30+
IncompatibleBuildType, //client build type is incompatible with server.
31+
HostEndedSession, //host intentionally ended the session.
32+
StartHostFailed, // server failed to bind
33+
StartClientFailed // failed to connect to server and/or invalid network endpoint
34+
}
35+
36+
public struct ReconnectMessage
37+
{
38+
public int CurrentAttempt;
39+
public int MaxAttempt;
40+
41+
public ReconnectMessage(int currentAttempt, int maxAttempt)
42+
{
43+
CurrentAttempt = currentAttempt;
44+
MaxAttempt = maxAttempt;
45+
}
46+
}
47+
48+
[Serializable]
49+
public class ConnectionPayload
50+
{
51+
public string playerId;
52+
public int clientScene = -1;
53+
public string playerName;
54+
public bool isDebug;
55+
}
56+
2157
public class ConnectionManager : MonoBehaviour
2258
{
2359
static readonly ConnectionStateType[] k_ConnectionStates = (ConnectionStateType[])Enum.GetValues(typeof(ConnectionStateType));
@@ -157,7 +193,7 @@ public static void SendServerToAllClientsSetDisconnectReason(ConnectStatus statu
157193
{
158194
var writer = new FastBufferWriter(sizeof(ConnectStatus), Allocator.Temp);
159195
writer.WriteValueSafe(status);
160-
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(nameof(ClientGameNetPortal.ReceiveServerToClientSetDisconnectReason_CustomMessage), writer);
196+
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(nameof(ReceiveServerToClientSetDisconnectReason_CustomMessage), writer);
161197
}
162198

163199
/// <summary>
@@ -169,7 +205,7 @@ public static void SendServerToClientSetDisconnectReason(ulong clientID, Connect
169205
{
170206
var writer = new FastBufferWriter(sizeof(ConnectStatus), Allocator.Temp);
171207
writer.WriteValueSafe(status);
172-
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(nameof(ClientGameNetPortal.ReceiveServerToClientSetDisconnectReason_CustomMessage), clientID, writer);
208+
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage(nameof(ReceiveServerToClientSetDisconnectReason_CustomMessage), clientID, writer);
173209
}
174210
}
175211
}

0 commit comments

Comments
 (0)