BITKit/Src/Unity/Scripts/Entity/Core/IUnityEntity.cs

39 lines
1.3 KiB
C#
Raw Normal View History

2023-06-05 19:57:17 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
2023-11-06 01:17:23 +08:00
using BITKit.Entities;
2023-06-05 19:57:17 +08:00
using UnityEngine;
namespace BITKit.Entities
{
/// <summary>Entity接口用于复杂实体</summary>
2023-11-06 01:17:23 +08:00
public interface IUnityEntity :Entities.IEntity,IGenericEvent<string>, IDatabase
2023-06-05 19:57:17 +08:00
{
2023-11-06 01:17:23 +08:00
void AddService<T>(T service);
void AddService(object service);
void AddService(Type type, object service);
2023-06-05 19:57:17 +08:00
}
2023-11-15 23:55:06 +08:00
// public class IEntityReader : NetMessageReader<IUnityEntity>
// {
// public override IUnityEntity ReadBinary(BinaryReader reader)
// {
// var id = reader.ReadInt32();
// var path = reader.ReadString();
// var entity = DI.Get<IEntitiesService>().Entities[id];
// return (IUnityEntity)entity;
// }
// public override void WriteBinary(BinaryWriter writer, IUnityEntity value)
// {
// writer.Write(value.Id);
// writer.Write(value.Id);
// }
// private IUnityEntity Create(int id, string path)
// {
// var entity = Addressables
// .LoadAssetAsync<GameObject>(path)
// .WaitForCompletion()
// .GetComponent<IUnityEntity>();
// return entity;
// }
// }
2023-06-05 19:57:17 +08:00
}