This commit is contained in:
PC-20230316NUNE\Administrator
2024-02-04 16:17:39 +08:00
parent f04299219c
commit 04043cc6fc
51 changed files with 20366 additions and 2051 deletions

View File

@@ -8,7 +8,7 @@ namespace Game.Plugins.App
public static readonly JNGSocket Socket = new JNGSocket();
public static readonly JNGSyncFrame Sync = new JNGSyncFrame();
public static readonly JAPI Api = new(new JAPIConfig(){BaseURL = "http://192.168.0.120:8080"});
public static readonly JAPI Api = new(new JAPIConfig(){BaseURL = "http://127.0.0.1:8080"});
public static readonly EventDispatcher Event = EventDispatcher.Event;
public static SystemBase[] System()

View File

@@ -8,7 +8,7 @@ namespace Game.Plugins.App
protected override async UniTask<string> GetUrl()
{
await UniTask.NextFrame();
return "ws://192.168.0.120:8080/websocket";
return "ws://127.0.0.1:8080/websocket";
}
}
}

View File

@@ -1,4 +1,5 @@
using Cysharp.Threading.Tasks;
using System;
using Cysharp.Threading.Tasks;
using Plugins.JNGame.Network.Action;
using Plugins.JNGame.Sync.Frame;
using UnityEngine;
@@ -16,17 +17,23 @@ namespace Game.Plugins.App
protected override async UniTask<JNFrameInfos> OnServerData(int start, int end)
{
Debug.Log($"OnServerData - {start}");
var data = (await App.Api.GetByte($"/sync/frame?start={start}"));
if (data is { Length: > 0 })
try
{
JNFrameInfos info = JNFrameInfos.Parser.ParseFrom(data);
Debug.Log($"OnServerData - {start} 结束");
return info;
var data = (await App.Api.GetByte($"/sync/frame?start={start}"));
if (data is { Length: > 0 })
{
JNFrameInfos info = JNFrameInfos.Parser.ParseFrom(data);
Debug.Log($"OnServerData - {start} 结束");
return info;
}
}
else
catch(Exception e)
{
return new JNFrameInfos();
// ignored
Debug.LogError(e.Message);
}
return new JNFrameInfos();
}
}
}

View File

@@ -23,7 +23,7 @@ namespace Game.Plugins.App.Sync
.Where(item => !(item is IJNSyncFrameComponent))
.Where(item => !(item is Transform))
.Where(item => !(allow.Contains(item)));
Debug.Log($"{this.NID} 有{Components.Count()}组件不是同步组件 尝试接管同步 请保证被接管的组件有enabled 同时被接管的组件 enabled 禁止修改");
foreach (var component in Components)