Network List Of tasks Support

This commit is contained in:
AnloGames 2023-08-17 14:31:20 +03:00
parent 9568f313fd
commit 7fee10dd29
2 changed files with 25 additions and 25 deletions

View file

@ -174,10 +174,10 @@ namespace DangerousD.GameCore
}
}
public void NetworkSync(NetworkTask networkTask)
public void NetworkSync(List<NetworkTask> networkTasks)
{
foreach (NetworkTask networkTask in networkTasks)
{
//TODO
return;
switch (networkTask.operation)
{
case NetworkTaskOperationEnum.TakeDamage:
@ -199,6 +199,8 @@ namespace DangerousD.GameCore
break;
}
}
}
public void SetMultiplayerState(MultiPlayerStatus multiPlayerStatus)
{
this.multiPlayerStatus = multiPlayerStatus;

View file

@ -10,7 +10,7 @@ namespace DangerousD.GameCore.Network
{
public class NetworkManager
{
public delegate void ReceivingHandler(NetworkTask networkTask);
public delegate void ReceivingHandler(List<NetworkTask> networkTask);
public event ReceivingHandler GetReceivingMessages;
@ -89,8 +89,6 @@ namespace DangerousD.GameCore.Network
}
public void SendMsg(NetworkTask networkTask)
{
//TODO
return;
byte[] Data = Encoding.Unicode.GetBytes(JsonConvert.SerializeObject(networkTask));
int count = Data.Length;
if (state == "Host")
@ -146,7 +144,7 @@ namespace DangerousD.GameCore.Network
}
else
{
GetReceivingMessages(JsonConvert.DeserializeObject<NetworkTask>(so.sb.ToString()));
GetReceivingMessages(JsonConvert.DeserializeObject<List<NetworkTask>>(so.sb.ToString()));
}
}
catch { }