This commit is contained in:
PC-20230316NUNE\Administrator
2024-02-01 19:06:51 +08:00
parent aa4d6c3ce2
commit 877dca3b43
7518 changed files with 653768 additions and 162059 deletions

View File

@@ -0,0 +1,18 @@
{
"name": "App",
"rootNamespace": "",
"references": [
"GUID:7a47da2842efe384ba63b83f4b1471db",
"GUID:f51ebe6a0ceec4240a699833d6309b23",
"GUID:9069ac25d95ca17448a247f3bb1c769f"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cfa590ecbcd6ced438358a8dea07179c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using Plugins.JNGame.System;
using Plugins.JNGame.Util;
namespace Game.Plugins.App
{
public static class 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.118:8080"});
public static readonly EventDispatcher Event = EventDispatcher.Event;
public static SystemBase[] System()
{
return new SystemBase[]
{
Socket,
Sync
};
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 41bc0098f83045f18891ef5190ac6a17
timeCreated: 1705981534

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7c7041250350ad645a506ee45d362da3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cysharp.Threading.Tasks;
using Plugins.JNGame.Network;
namespace Game.Plugins.App
{
public class JNGSocket : JNSocket
{
protected override async UniTask<string> GetUrl()
{
await UniTask.NextFrame();
return "ws://192.168.0.118:8080/websocket";
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6018b3436d0447f18eb907f86db6504e
timeCreated: 1705993176

View File

@@ -0,0 +1,30 @@
using Cysharp.Threading.Tasks;
using Plugins.JNGame.Sync.Frame;
using UnityEngine;
namespace Game.Plugins.App
{
public class JNGSyncFrame : JNSyncFrame
{
protected override void OnSendInput(JNFrameInputs inputs)
{
throw new System.NotImplementedException();
}
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 })
{
JNFrameInfos info = JNFrameInfos.Parser.ParseFrom(data);
Debug.Log($"OnServerData - {start} 结束");
return info;
}
else
{
return new JNFrameInfos();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c3b45cb3cc954a99bface55dd2529ce6
timeCreated: 1706241635

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 18f844bda03d4d0c8dae20659066ca67
timeCreated: 1706519193

View File

@@ -0,0 +1,16 @@
using Plugins.JNGame.Sync.Frame;
using Plugins.JNGame.Sync.Frame.game;
namespace Game.Plugins.App.Sync
{
public abstract class JNGSyncFrame<T> : JNSyncFrameComponent<T>
{
protected override JNSyncFrame GetSync()
{
return App.Sync;
}
public override void OnSyncLoad(){}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 54720b15a706406c974db4ac581e6dbc
timeCreated: 1706519239

View File

@@ -0,0 +1,11 @@
using UnityEngine;
namespace Game.Plugins.App.Sync
{
public class JNGSyncFrameDefault : JNGSyncFrame<Object>
{
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 67efd019640f42afb3840659516d244a
timeCreated: 1706773209

View File

@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Plugins.JNGame.Sync.Frame.game;
using UnityEngine;
namespace Game.Plugins.App.Sync
{
public class JNGSyncFrameEntrust : JNGSyncFrameDefault
{
private IEnumerable<Component> _components;
public IEnumerable<Component> Components => _components;
public Component[] allow;
public override void OnSyncLoad()
{
//获取非同步的组件
_components = this.GetComponents<Component>()
.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)
{
var property = component.GetType().GetProperty("enabled");
if (property == null)
{
Debug.Log($"{this.NID} 有组件不是同步组件 并且没有 enabled 为了防止不同步 直接删除!");
Destroy(component);
continue;
}
property.SetValue(component,false);
}
_components = this.GetComponents<Component>()
.Where(item => !(item.GetType().IsAssignableFrom(typeof(IJNSyncFrameComponent))));
}
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
{
base.OnSyncUpdate(dt, frame, input);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 32f8b8b7207b1a24ea68368f6a1a91b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: