This commit is contained in:
2024-02-23 15:42:38 +02:00
parent 22391dd2bd
commit ddcf2ff24f
6 changed files with 109 additions and 51 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using FlaxEngine;
using FlaxEngine.Networking;
using Console = Game.Console;
@@ -79,14 +80,14 @@ namespace Game
try
{
IsLocalClient = server != null;
IsClient = true;
//IsLocalClient = server != null;
//IsClient = true;
OnClientReadMessage(ref networkEvent);
}
finally
{
IsLocalClient = false;
IsClient = false;
//IsLocalClient = false;
//IsClient = false;
if (networkEvent.EventType == NetworkEventType.Message)
client.RecycleMessage(networkEvent.Message);
}
@@ -120,7 +121,7 @@ namespace Game
}
case NetworkEventType.Message:
{
OnNetworkMessage(ref networkEvent);
OnNetworkMessage(ref networkEvent, CollectionsMarshal.AsSpan(OnClientMessageDelegates));
if (networkEvent.Message.Position > 0 &&
networkEvent.Message.Position < networkEvent.Message.Length)
@@ -146,6 +147,8 @@ namespace Game
default:
throw new ArgumentOutOfRangeException();
}
DebugLastHandledMessage = "";
}
private static void OnClientActorSpawned(Actor actor)