@@ -54,6 +54,13 @@ public class ConnectionPayload
54
54
/// </summary>
55
55
public class ConnectionManager : MonoBehaviour
56
56
{
57
+ public enum ServerType : byte
58
+ {
59
+ Undefined = 0 ,
60
+ DedicatedServer ,
61
+ ClientHostedServer
62
+ }
63
+
57
64
ConnectionState m_CurrentState ;
58
65
59
66
[ SerializeField ]
@@ -79,7 +86,7 @@ public class ConnectionManager : MonoBehaviour
79
86
internal readonly StartingHostState m_StartingHost = new StartingHostState ( ) ;
80
87
internal readonly HostingState m_Hosting = new HostingState ( ) ;
81
88
82
- public bool IsConnectedToHost { get ; private set ; }
89
+ public ServerType IsConnectedToHost { get ; set ; }
83
90
84
91
void Awake ( )
85
92
{
@@ -88,7 +95,7 @@ void Awake()
88
95
89
96
void Start ( )
90
97
{
91
- List < ConnectionState > states = new ( ) { m_Offline , m_ClientConnecting , m_ClientConnected , m_ClientReconnecting , m_DisconnectingWithReason , m_StartingHost , m_Hosting } ;
98
+ List < ConnectionState > states = new ( ) { m_Offline , m_ClientConnecting , m_ClientConnected , m_ClientReconnecting , m_DisconnectingWithReason , m_StartingHost , m_Hosting , m_ServerListening , m_ServerStarting } ;
92
99
foreach ( var connectionState in states )
93
100
{
94
101
m_Resolver . Inject ( connectionState ) ;
@@ -114,8 +121,6 @@ internal void ChangeState(ConnectionState nextState)
114
121
{
115
122
Debug . Log ( $ "Changed connection state from { m_CurrentState . GetType ( ) . Name } to { nextState . GetType ( ) . Name } .") ;
116
123
117
- IsConnectedToHost = false ;
118
-
119
124
if ( m_CurrentState != null )
120
125
{
121
126
m_CurrentState . Exit ( ) ;
@@ -215,13 +220,13 @@ public static void SendServerToClientSetDisconnectReason(ulong clientID, Connect
215
220
NetworkManager . Singleton . CustomMessagingManager . SendNamedMessage ( nameof ( ReceiveServerToClientSetDisconnectReason_CustomMessage ) , clientID , writer ) ;
216
221
}
217
222
218
- public void ReceiveServertoClientSuccessPayload_CustomMessage ( ulong clientID , FastBufferReader reader )
223
+ internal void ReceiveServertoClientSuccessPayload_CustomMessage ( ulong clientID , FastBufferReader reader )
219
224
{
220
- reader . ReadValueSafe ( out bool isHost ) ;
225
+ reader . ReadValueSafe ( out ServerType isHost ) ;
221
226
IsConnectedToHost = isHost ;
222
227
}
223
228
224
- public static void SendServertoClientSuccessPayload ( ulong clientID , bool isHost )
229
+ internal static void SendServertoClientSuccessPayload ( ulong clientID , ServerType isHost )
225
230
{
226
231
var writer = new FastBufferWriter ( sizeof ( bool ) , Allocator . Temp ) ;
227
232
writer . WriteValueSafe ( isHost ) ;
0 commit comments