临时提交

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-10-19 03:51:59 +08:00
parent 425f2eabea
commit 1315802fa2
162 changed files with 16452 additions and 11111 deletions

View File

@@ -7,17 +7,18 @@ namespace GAS.Runtime
/// </summary>
public class JexGasManager
{
/// <summary>
/// GAS 专用对象池 (只限制当前管理器)
/// </summary>
private JexGasObjectPool ObjectPool = new JexGasObjectPool();
public static void Awake()
{
//初始化 GAS 对象池
JexGasObjectPool.Awake();
}
public static void Destroy()
{
//销毁 GAS 对象池
JexGasObjectPool.Destroy();
}
public static void Update()

View File

@@ -76,52 +76,44 @@ namespace JNGame.Sync.Frame
int deltaTime = TickTime;
dtTotal += deltaTime;
dtInputTotal += deltaTime;
try
int nSyncTime = this.DyTime();
if (nSyncTime > 0)
{
int nSyncTime = this.DyTime();
if (nSyncTime > 0)
this._isLoop = false;
if (dtTotal > nSyncTime && _nFrameQueue.Count > 0)
{
this._isLoop = false;
if (dtTotal > nSyncTime && _nFrameQueue.Count > 0)
{
this.OnRunSimulate();
dtTotal -= nSyncTime;
}
if (_nFrameQueue.Count <= 0)
{
dtTotal = 0;
}
this.OnRunSimulate();
dtTotal -= nSyncTime;
}
else
if (_nFrameQueue.Count <= 0)
{
this._isLoop = true;
//追帧运行 保持前端 15 帧 刷新
long endTime = (new DateTimeOffset(DateTime.UtcNow)).ToUnixTimeMilliseconds() + 100;
while (this.DyTime() == 0 && ((new DateTimeOffset(DateTime.UtcNow)).ToUnixTimeMilliseconds()) < endTime)
{
this.OnRunSimulate();
}
dtTotal = 0;
}
//更新输入
if (dtInputTotal > (_nSyncTime / _nDivideFrame))
{
dtInputTotal = 0;
OnRunInput();
}
}
catch (Exception e)
else
{
Debug.LogError(e.Message);
this._isLoop = true;
//追帧运行 保持前端 15 帧 刷新
long endTime = (new DateTimeOffset(DateTime.UtcNow)).ToUnixTimeMilliseconds() + 100;
while (this.DyTime() == 0 && ((new DateTimeOffset(DateTime.UtcNow)).ToUnixTimeMilliseconds()) < endTime)
{
this.OnRunSimulate();
}
dtTotal = 0;
}
//更新输入
if (dtInputTotal > (_nSyncTime / _nDivideFrame))
{
dtInputTotal = 0;
OnRunInput();
}

View File

@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using JNGame.Sync.Entity;
using System.Collections.Generic;
using JNGame.Sync.Frame.Entity;
using JNGame.Sync.Frame.Entity.Components;
using UnityEngine;
namespace JNGame.Sync.State.Tile.Entity

View File

@@ -1,6 +1,5 @@
using JNGame.Sync.Entity;
using JNGame.Sync.Frame.Entity;
using JNGame.Sync.Frame.Entity.Components;
using JNGame.Sync.State.Tile.Entity.Component;
using JNGame.Sync.System.Data;
using NotImplementedException = System.NotImplementedException;

View File

@@ -1,7 +1,5 @@
using Entitas;
using JNGame.Math;
using JNGame.Math;
using JNGame.Sync.Entity.Component;
using JNGame.Sync.Frame.Entity.Components;
namespace JNGame.Sync.Frame.Entity.Component.Components
{

View File

@@ -4,7 +4,7 @@ using System;
using Entitas;
using JNGame.Runtime.Util.Types;
namespace JNGame.Sync.Frame.Entity.Components
namespace JNGame.Sync.Entity.Component
{
public class JNEntityLookup : JNLookup
{

View File

@@ -3,8 +3,8 @@ using System.Collections.Generic;
using Entitas;
using JNGame.Runtime.Sync;
using JNGame.Sync.Entity;
using JNGame.Sync.Entity.Component;
using JNGame.Sync.Frame.Entity.Component.Components;
using JNGame.Sync.Frame.Entity.Components;
using JNGame.Sync.System;
namespace JNGame.Sync.Frame.Entity

View File

@@ -3,7 +3,6 @@ using JNGame.Math;
using JNGame.Sync.Entity.Component;
using JNGame.Sync.Frame.Entity;
using JNGame.Sync.Frame.Entity.Component.Components;
using JNGame.Sync.Frame.Entity.Components;
using JNGame.Sync.Frame.Service;
using JNGame.Sync.System;

View File

@@ -18,11 +18,19 @@ namespace JNGame.Runtime.Sync
public JNContexts Contexts;
/// <summary>
/// 是否开始游戏
/// </summary>
public abstract bool IsStartGame { get; }
/// <summary>
/// 子线程
/// </summary>
private Thread thread;
//执行时间
/// <summary>
/// 执行时间
/// </summary>
protected int TickTime;
@@ -114,7 +122,7 @@ namespace JNGame.Runtime.Sync
/// <param name="ms"></param>
public void MExecute(int ms = -1)
{
if (ms <= -1) ms = (int)Time.deltaTime * 1000;
if (ms <= -1) ms = (int)(Time.deltaTime * 1000);
TickTime = ms;
Execute();
}
@@ -129,11 +137,11 @@ namespace JNGame.Runtime.Sync
thread = new Thread(() =>
{
while (thread.ThreadState != ThreadState.Aborted)
while (thread is not null && thread.ThreadState != ThreadState.Aborted)
{
Thread.Sleep(ms);
TickTime = ms;
Execute();
if(thread is not null) Execute();
}
});
thread.Start();
@@ -147,7 +155,7 @@ namespace JNGame.Runtime.Sync
/// <summary>
/// 推逻辑帧
/// </summary>
public void Simulate()
protected virtual void Simulate()
{
#if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR)

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5ac3500978fa4ddea0bc31deeeb97fc8
timeCreated: 1729277104

View File

@@ -1,8 +1,8 @@
using System;
using System;
using JNGame.Math;
using UnityEngine;
namespace Game.JNGState.Logic.Data
namespace JNGame.Sync.System.Data.Type
{
[Serializable]
public class DValuePosition
@@ -31,5 +31,16 @@ namespace Game.JNGState.Logic.Data
{
return new LVector3(new LFloat(true,x), new LFloat(true,y), new LFloat(true,z));
}
public static DValuePosition Build(LVector3 vec3)
{
return new DValuePosition()
{
x = vec3.x.rawValue,
y = vec3.y.rawValue,
z = vec3.z.rawValue,
};
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 61dc0f629c2e4039b3d0a3a09a6dd9e4
timeCreated: 1729277108

View File

@@ -0,0 +1,24 @@
using GAS.Runtime;
using JNGame.Sync.System;
namespace JNGame.Runtime.Sync.System.Logic
{
/// <summary>
/// GAS 系统
/// </summary>
public class JNGASSystem : SLogicSystem
{
/// <summary>
/// GAS 管理器
/// </summary>
private JexGasManager _gas = new JexGasManager();
public JexGasManager GAS => _gas;
public override void OnSyncStart()
{
base.OnSyncStart();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a2ad6a2528004e829e468bd37c84b181
timeCreated: 1729280850

View File

@@ -132,7 +132,7 @@ namespace JNGame.Sync.System.View
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public T Input<T>() where T : JNInputBase,new()
public T UIInput<T>() where T : JNInputBase,new()
{
lock (UIInputs)
{
@@ -145,10 +145,10 @@ namespace JNGame.Sync.System.View
}
/// <summary>
/// 移出输入
/// 移出 UI 输入
/// </summary>
/// <returns></returns>
public JNFrameInputs Dequeue()
public JNFrameInputs UIInputDequeue()
{
lock (UIInputs)
{
@@ -169,7 +169,7 @@ namespace JNGame.Sync.System.View
/// <summary>
/// 移入输入
/// </summary>
public void UpdateSInputs()
private void UpdateSInputs()
{
SInputs.Clear();

View File

@@ -49,13 +49,6 @@ namespace JNGame.Sync.System
//数据集
public ConcurrentDictionary<ulong, T> Data = new();
public virtual T[] Datas {
get
{
return Data.Values.ToArray();
}
}
public override void OnSyncStart()
{
//设置数据唯一Id

View File

@@ -3,7 +3,7 @@
namespace JNGame.Sync.System
{
/// <summary>
/// 帧同步 - 视图系统
/// 视图系统
/// </summary>
public class SViewSystem : SBaseSystem,IJNSyncCycle,IExecuteSystem
{

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Collections.Generic;
using JNGame.Sync.System;
using UnityEngine;
@@ -29,9 +30,9 @@ namespace JNGame.Sync.View
{
Update++;
var dataList = GetData();
bool isRest = dataList.Length != views.Count;
var dataList = GetData().Values;
bool isRest = dataList.Count != views.Count;
foreach (var data in dataList){
@@ -68,7 +69,7 @@ namespace JNGame.Sync.View
}
public abstract void ViewUpdate(T data,GameObject view);
public abstract GameObject NewView(T data);
public abstract T[] GetData();
public abstract ConcurrentDictionary<ulong, T> GetData();
public abstract void ViewRemove(GameObject view);

View File

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

View File

@@ -0,0 +1,107 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7403693568755579174
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1418229812123219311}
- component: {fileID: 2195934723901734943}
- component: {fileID: 6293353922950916548}
- component: {fileID: 5607204378896621617}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1418229812123219311
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7403693568755579174}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2195934723901734943
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7403693568755579174}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &6293353922950916548
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7403693568755579174}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &5607204378896621617
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7403693568755579174}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}

View File

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

View File

@@ -209,119 +209,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 28019073}
serializedVersion: 2
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &857251289
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 857251293}
- component: {fileID: 857251292}
- component: {fileID: 857251291}
- component: {fileID: 857251290}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &857251290
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 857251289}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &857251291
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 857251289}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &857251292
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 857251289}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &857251293
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 857251289}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1745439352
GameObject:
m_ObjectHideFlags: 0
@@ -351,6 +246,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0c3aa2f58b904ebe9fc64cc367c63d68, type: 3}
m_Name:
m_EditorClassIdentifier:
World: {fileID: 2144549411}
Box: {fileID: 7403693568755579174, guid: 2e5d0c510b71c714aaccc714aca99afc, type: 3}
--- !u!4 &1745439354
Transform:
m_ObjectHideFlags: 0
@@ -358,13 +255,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1745439352}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2104190881
GameObject:
@@ -450,11 +347,50 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2104190881}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2144549411
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2144549412}
m_Layer: 0
m_Name: World
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2144549412
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2144549411}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 28019075}
- {fileID: 2104190884}
- {fileID: 2144549412}
- {fileID: 1745439354}

View File

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

View File

@@ -0,0 +1,20 @@
{
"name": "GASSamples.Editor",
"rootNamespace": "",
"references": [
"GUID:a6f7937b7f28906409a3ea3ceb2316c6",
"GUID:a035c483e4ff50f4c92f84afd22778cf",
"GUID:5f32be912cdeb7c4f8a601d2040de4e5",
"GUID:5b05c448a9d6e154e8eb3f1ef2291f24",
"GUID:f51ebe6a0ceec4240a699833d6309b23"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

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

View File

@@ -0,0 +1,18 @@
{
"name": "GASSamples",
"rootNamespace": "",
"references": [
"GUID:a035c483e4ff50f4c92f84afd22778cf",
"GUID:a6f7937b7f28906409a3ea3ceb2316c6",
"GUID:f51ebe6a0ceec4240a699833d6309b23"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

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

View File

@@ -0,0 +1,18 @@
using JNGame.Runtime.System;
namespace GASSamples.Scripts
{
public class App
{
public static readonly JNGResService Resource = new JNGResService();
public static SystemBase[] AllSystem()
{
return new SystemBase[]
{
Resource
};
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f3e00a9df020484eb50717285a43b5ef
timeCreated: 1729273609

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 878a2703693549d4b29a70a1977c5dc1
timeCreated: 1729273912

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 948b04fc24754ee587ad380cc15a923a
timeCreated: 1729276738

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Concurrent;
using GASSamples.Scripts.Game.Entity.Contexts;
using JNGame.Sync.System;
using JNGame.Sync.System.Data;
using JNGame.Sync.System.Data.Type;
using NotImplementedException = System.NotImplementedException;
namespace GASSamples.Scripts.Game.Logic.Data
{
public enum JNGASBoxValueCode : int
{
Auth = 201
}
[Serializable]
public class JNGASBoxValue
{
public DValuePosition Position = null;
}
public class JNGASBoxData : ISData
{
public JNGASBoxValue Value;
public override bool IsEquals(ISData data)
{
return true;
}
}
public class JNGASBoxDataSystem : SFrameDataSystem<JNGASBoxData>
{
public JNGASBoxContext NodeContext => Contexts.GetContext<JNGASBoxContext>();
private ConcurrentDictionary<ulong, JNGASBoxData> DataCache = new();
public override ConcurrentDictionary<ulong, JNGASBoxData> GetLatest()
{
DataCache.Clear();
foreach (var entity in NodeContext.GetEntities())
{
DataCache.TryAdd(entity.Id,new JNGASBoxData()
{
Value = new ()
{
Position = DValuePosition.Build(entity.Position)
}
});
}
return DataCache;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 83c5b3168ed74b8e981a1fc232d7330d
timeCreated: 1729276758

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ed36be30121349c08ceeaab6cef326f7
timeCreated: 1729275942

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1887a92680244fa5a4b2035d03a3bc77
timeCreated: 1729276479

View File

@@ -0,0 +1,14 @@
using GASSamples.Scripts.Game.Entity.Nodes;
using JNGame.Sync.Frame.Entity;
namespace GASSamples.Scripts.Game.Entity.Contexts
{
public class JNGASBoxContext : JNContext<JNGASBox>
{
protected override JNGASBox BindComponent(JNGASBox entity)
{
base.BindComponent(entity);
return entity;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: be628b374d154c98b85694955b4cda4b
timeCreated: 1729276498

View File

@@ -0,0 +1,13 @@
using Entitas;
using GASSamples.Scripts.Game.Entity.Contexts;
using JNGame.Sync.Entity;
namespace GASSamples.Scripts.Game.Entity
{
public class EDContexts : JNContexts
{
public override IContext[] allContexts { get; } = { new JNGASBoxContext() };
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 781261aba7f946b297d7c655cf953acd
timeCreated: 1729275955

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c9ed407f62c44feaa88de076fbc503f3
timeCreated: 1729276082

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 52e508ba3ff44352bb0f463042536728
timeCreated: 1729276165

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d7e90ad7c34d49eb90791ea5a1a9ffe8
timeCreated: 1729276182

View File

@@ -0,0 +1,9 @@
using JNGame.Sync.Entity.Component;
namespace GASSamples.Scripts.Game.Entity.Nodes.Component.Lookup
{
public class JNGASBoxLookup : JNEntityLookup
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ee66d5996b334ea1850e8bf9e150e15b
timeCreated: 1729276195

View File

@@ -0,0 +1,14 @@
using GASSamples.Scripts.Game.Entity.Nodes.Component.Lookup;
using JNGame.Sync.Entity;
using JNGame.Sync.Entity.Component;
namespace GASSamples.Scripts.Game.Entity.Nodes
{
public class JNGASBox : JNEntity
{
public override JNEntityLookup NewCLookup()
{
return new JNGASBoxLookup();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 69b1a0b196ea4395990aeabd34fe28fc
timeCreated: 1729276118

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1393a03eb1b743a2a5347cbf505f3692
timeCreated: 1729273918

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using JNGame.Runtime.Util.Types;
using JNGame.Sync.System.View;
namespace Game.Input
{
public class DInputSystem : JNInputSystem
{
private KeyValue<Type, int> _tClass = new KeyValue<Type, int>();
protected override KeyValue<Type, int> TClass => _tClass;
protected override void OnInit()
{
base.OnInit();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a531fb10faef4b5ca7e947adb946d7df
timeCreated: 1729273925

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 21cf75d98dcc4a89855767a1e60af869
timeCreated: 1729275624

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 41ff96ba3e4748b5a1a2114a635f821a
timeCreated: 1729275629

View File

@@ -0,0 +1,19 @@
using GASSamples.Scripts.Game.Entity.Contexts;
using JNGame.Math;
using JNGame.Sync.System;
namespace GASSamples.Scripts.Game.Logic.System
{
public class DWorldSystem : SLogicSystem
{
public JNGASBoxContext BoxContext => Contexts.GetContext<JNGASBoxContext>();
public override void OnSyncStart()
{
base.OnSyncStart();
BoxContext.CreateEntity();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1a28375952b744eb85bae40b66f7ef81
timeCreated: 1729275863

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d7ad083af7024cf7855026315132abe5
timeCreated: 1729277967

View File

@@ -0,0 +1,31 @@
using GASSamples.Scripts.Game.View.Entity;
using JNGame.Runtime.Util;
using JNGame.Sync.System;
using JNGame.Sync.View;
namespace GASSamples.Scripts.Game.View
{
public class DViewSystem : SViewSystem
{
private readonly IViewData[] views;
public DViewSystem()
{
views = new IViewData[] {
new VDBox(this), //显示Demo实体
};
}
public override void OnSyncUpdate(int dt)
{
base.OnSyncUpdate(dt);
foreach (var view in views)
{
//视图逻辑交给主线程运行
UnityMainThreadDispatcher.Instance.Enqueue(view.Execute);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d8f87d86e0a34f3b9719bebe4383fe29
timeCreated: 1729277970

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ca9b410a5ca741b0b90219e999c290c9
timeCreated: 1729278058

View File

@@ -0,0 +1,41 @@
using System.Collections.Concurrent;
using DG.Tweening;
using GASSamples.Scripts.Game.Logic.Data;
using JNGame.Sync.System;
using JNGame.Sync.View;
using UnityEngine;
namespace GASSamples.Scripts.Game.View.Entity
{
public class VDBox : ViewData<JNGASBoxData>
{
public GameObject World => App.Resource.World;
public GameObject Box => App.Resource.Box;
public VDBox(SViewSystem root) : base(root)
{
}
public override void ViewUpdate(JNGASBoxData data, GameObject view)
{
view.transform.DOMove(data.Value.Position.ToVector3(),0.5f);
}
public override GameObject NewView(JNGASBoxData data)
{
var view = Object.Instantiate(Box, World.transform);
view.name = $"Boss_{data.Id}";
return view;
}
public override ConcurrentDictionary<ulong, JNGASBoxData> GetData()
{
return GetService<JNGASBoxDataSystem>().Data;
}
public override void ViewRemove(GameObject view)
{
Object.Destroy(view);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6ad7eb0cc9c84346b06e5c32cda46266
timeCreated: 1729278090

View File

@@ -0,0 +1,21 @@
using System.Threading.Tasks;
using JNGame.Network;
using UnityEngine;
namespace GASSamples.Scripts
{
public class JNGResService : JNServerBase
{
public GameObject World;
//Box
public GameObject Box;
public override Task OnInit()
{
return base.OnInit();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 123c85e1eb584e4682234f65e4fe4ec9
timeCreated: 1729279133

View File

@@ -1,13 +1,55 @@
using UnityEngine;
using System;
using DefaultNamespace;
using JNGame.Runtime;
using UnityEngine;
namespace Demo.Scripts
namespace GASSamples.Scripts
{
public class Main : MonoBehaviour
{
private void Start()
public GameObject World;
public GameObject Box;
private JNGASFrameSystem _frameSystem;
private int _totalTime;
private int _frameIndex;
private async void Awake()
{
await JNetGame.Instance.Init(App.AllSystem());
App.Resource.World = World;
App.Resource.Box = Box;
_frameSystem = new JNGASFrameSystem();
_frameSystem.Initialize();
_frameSystem.TStartExecute();
}
private void Update()
{
if (_frameSystem is null) return;
_totalTime += (int)(Time.deltaTime * 1000);
//自动推帧
if (_totalTime >= _frameSystem.NSyncTime)
{
_frameSystem.AddFrame(new JNFrameInfo()
{
Index = _frameIndex++
});
}
}
private void OnApplicationQuit()
{
_frameSystem?.Dispose();
}
protected void OnDisable()
{
_frameSystem?.Dispose();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: db4b70c6d32f43e596928f4be96e77cb
timeCreated: 1729273692

View File

@@ -0,0 +1,80 @@
using Cysharp.Threading.Tasks;
using Game.Input;
using GASSamples.Scripts.Game.Entity;
using GASSamples.Scripts.Game.Logic.Data;
using GASSamples.Scripts.Game.Logic.System;
using GASSamples.Scripts.Game.View;
using JNGame.Sync.Entity;
using JNGame.Sync.Frame;
using JNGame.Sync.System;
namespace DefaultNamespace
{
public class JNGASFrameSystem : JNSyncFrameService
{
public override bool IsStartGame => true;
public override SLogicSystem[] NewLogicSystems()
{
return new SLogicSystem[]
{
//基础数据
new DInputSystem(), //游戏输入
new DWorldSystem(), //世界逻辑
};
}
public override SDataSystemBase[] NewDataSystems()
{
return new SDataSystemBase[] {
new JNGASBoxDataSystem(),
};
}
public override SViewSystem[] NewViewSystems()
{
return new SViewSystem[]
{
//视图层
new DViewSystem(), //游戏视图
};
}
public override JNContexts CreateContexts()
{
return new EDContexts();
}
//获取输入
protected override JNFrameInputs GetInputs()
{
return new JNFrameInputs();
}
//发送输入
protected override void OnSendInput(JNFrameInputs inputs){}
protected override void OnRunSimulate()
{
if (!(NFrameQueue.TryDequeue(out var frame))) return;
//插入当前输入
foreach (var child in frame.Messages)
{
GetSystem<DInputSystem>().Enqueue(child);
}
Simulate();
}
/// <summary>
/// 追帧数据
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
protected override async UniTask<JNFrameInfos> OnServerData(int start, int end)
{
await UniTask.Delay(1);
return new JNFrameInfos();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fb60ec3a5bba4f57ac82e4862a01860d
timeCreated: 1729273723

View File

@@ -79,7 +79,7 @@ namespace AppGame.Sync
/// <returns></returns>
protected override JNFrameInputs GetInputs()
{
return GetSystem<DInputSystem>().Dequeue();
return GetSystem<DInputSystem>().UIInputDequeue();
}
/// <summary>

Some files were not shown because too many files have changed in this diff Show More