mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交Unity 联机Pro
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cc4a62c9f984472a75d9dcce3e117bb
|
||||
timeCreated: 1720864778
|
@@ -0,0 +1,12 @@
|
||||
using Entitas;
|
||||
using JNGame.Math;
|
||||
using JNGame.Sync.Entity.Component;
|
||||
using JNGame.Sync.Frame.Entity.Components;
|
||||
|
||||
namespace JNGame.Sync.Frame.Entity.Component.Components
|
||||
{
|
||||
public class JNTransformComponent : JNComponent
|
||||
{
|
||||
public LVector3 Position = new();
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de8c1bdf52c14049b969b7d4ec7052cd
|
||||
timeCreated: 1720700573
|
30
JNFrame2/Assets/JNGame/Sync/Entity/Component/JNComponent.cs
Normal file
30
JNFrame2/Assets/JNGame/Sync/Entity/Component/JNComponent.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Entitas;
|
||||
using JNGame.Sync.System;
|
||||
using NotImplementedException = System.NotImplementedException;
|
||||
|
||||
namespace JNGame.Sync.Entity.Component
|
||||
{
|
||||
/// <summary>
|
||||
/// 组件
|
||||
/// </summary>
|
||||
public class JNComponent : IComponent,IJNSyncCycle
|
||||
{
|
||||
|
||||
public IJNEntity Entity;
|
||||
|
||||
public void OnInit(IJNEntity entity)
|
||||
{
|
||||
this.Entity = entity;
|
||||
}
|
||||
|
||||
public T GetSystem<T>() where T : SLogicSystem
|
||||
{
|
||||
return Entity.GetContext().GetSync().GetSystem<T>();
|
||||
}
|
||||
|
||||
//生命周期
|
||||
public virtual void OnSyncStart(){}
|
||||
public virtual void OnSyncUpdate(){}
|
||||
public virtual void OnSyncDestroy(){}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d7ede39ee1a4ac6a40ea7e0b5334765
|
||||
timeCreated: 1720864842
|
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Entitas;
|
||||
using JNGame.EntitasExtend;
|
||||
using JNGame.Sync.Frame.Entity.Component.Components;
|
||||
using JNGame.Util.Types;
|
||||
|
||||
namespace JNGame.Sync.Frame.Entity.Components
|
||||
{
|
||||
public class JNEntityLookup : EntitasExtend.JNLookup
|
||||
{
|
||||
|
||||
//位置组件
|
||||
public int Transform { get; set; }
|
||||
|
||||
//绑定索引
|
||||
protected override void BindIndex()
|
||||
{
|
||||
Transform = Next();
|
||||
}
|
||||
|
||||
//绑定类型
|
||||
protected override void BindType(KeyValue<int, Type> types)
|
||||
{
|
||||
types.Add(Transform,typeof(JNTransformComponent));
|
||||
}
|
||||
|
||||
//查询组件
|
||||
public T Query<T>(Entitas.Entity entity) where T : class, IComponent
|
||||
{
|
||||
return entity.GetComponent(GetIndex<T>()) as T;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76bb4b74188d47beb992777c9fc19d8c
|
||||
timeCreated: 1720749419
|
Reference in New Issue
Block a user