mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] 接入ET8服务端
[+] 接入ET8服务端
This commit is contained in:
43
Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs
Normal file
43
Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
|
||||
namespace ET
|
||||
{
|
||||
// GetComponentSystem有巨大作用,比如每次保存Unit的数据不需要所有组件都保存,只需要保存Unit变化过的组件
|
||||
// 是否变化可以通过判断该组件是否GetComponent,Get了就记录该组件
|
||||
// 这样可以只保存Unit变化过的组件
|
||||
// 再比如传送也可以做此类优化
|
||||
public interface IGetComponent
|
||||
{
|
||||
}
|
||||
|
||||
public interface IGetComponentSystem: ISystemType
|
||||
{
|
||||
void Run(Entity o, Entity component);
|
||||
}
|
||||
|
||||
[EntitySystem]
|
||||
public abstract class GetComponentSystem<T> : IGetComponentSystem where T: Entity, IGetComponent
|
||||
{
|
||||
void IGetComponentSystem.Run(Entity o, Entity component)
|
||||
{
|
||||
this.GetComponent((T)o, component);
|
||||
}
|
||||
|
||||
Type ISystemType.SystemType()
|
||||
{
|
||||
return typeof(IGetComponentSystem);
|
||||
}
|
||||
|
||||
int ISystemType.GetInstanceQueueIndex()
|
||||
{
|
||||
return InstanceQueueIndex.None;
|
||||
}
|
||||
|
||||
Type ISystemType.Type()
|
||||
{
|
||||
return typeof(T);
|
||||
}
|
||||
|
||||
protected abstract void GetComponent(T self, Entity component);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user