提交 0fda3a64 编写于 作者: T tanghai

消息的Disposer改成Component

上级 c4930ded
......@@ -44,7 +44,7 @@
required string CollectionName = 2;
required Component Disposer = 3;
required Component Component = 3;
}
......@@ -56,7 +56,7 @@
{
required bool NeedCache = 1;
required string CollectionName = 2;
repeated Component Disposers = 3;
repeated Component Components = 3;
}
message DBSaveResponse // IResponse
......@@ -72,7 +72,7 @@
message DBQueryResponse // IResponse
{
required Component Disposer = 1;
required Component Component = 1;
}
message DBQueryBatchRequest // IRequest
......@@ -84,7 +84,7 @@
message DBQueryBatchResponse // IResponse
{
repeated Component Disposers = 1;
repeated Component Components = 1;
}
message DBQueryJsonRequest // IRequest
......@@ -96,7 +96,7 @@
message DBQueryJsonResponse // IResponse
{
repeated Component Disposers = 1;
repeated Component Components = 1;
}
message ObjectAddRequest // IRequest
......
......@@ -7,7 +7,7 @@ namespace ETModel
public abstract partial class Component : Object, IDisposable
{
[BsonIgnore]
public long InstanceId { get; private set; }
public long InstanceId { get; protected set; }
[BsonIgnore]
private bool isFromPool;
......@@ -68,6 +68,7 @@ namespace ETModel
{
this.InstanceId = IdGenerater.GenerateId();
Game.EventSystem.Add(this);
this.Id = this.InstanceId;
}
protected Component(long instanceId)
......
......@@ -17,14 +17,12 @@ namespace ETModel
protected Entity()
{
this.Id = this.InstanceId;
this.components = new HashSet<Component>();
this.componentDict = new Dictionary<Type, Component>();
}
protected Entity(long id)
protected Entity(long id): base(id)
{
this.Id = id;
this.components = new HashSet<Component>();
this.componentDict = new Dictionary<Type, Component>();
}
......@@ -202,6 +200,8 @@ namespace ETModel
{
try
{
this.InstanceId = IdGenerater.GenerateId();
this.componentDict.Clear();
if (this.components != null)
......
......@@ -8,7 +8,7 @@ namespace ETHotfix
public abstract partial class Component : Object, IDisposable2
{
[BsonIgnore]
public long InstanceId { get; private set; }
public long InstanceId { get; protected set; }
[BsonIgnore]
private bool isFromPool;
......@@ -23,6 +23,7 @@ namespace ETHotfix
set
{
this.isFromPool = value;
if (this.InstanceId == 0)
{
this.InstanceId = IdGenerater.GenerateId();
......@@ -68,6 +69,7 @@ namespace ETHotfix
{
this.InstanceId = IdGenerater.GenerateId();
Game.EventSystem.Add(this);
this.Id = this.InstanceId;
}
protected Component(long instanceId)
......@@ -82,7 +84,7 @@ namespace ETHotfix
{
return;
}
Game.EventSystem.Remove(this.InstanceId);
this.InstanceId = 0;
......
......@@ -18,14 +18,12 @@ namespace ETHotfix
protected Entity()
{
this.Id = IdGenerater.GenerateId();
this.components = new HashSet<Component>();
this.componentDict = new Dictionary<Type, Component>();
}
protected Entity(long id)
protected Entity(long id) : base(id)
{
this.Id = id;
this.components = new HashSet<Component>();
this.componentDict = new Dictionary<Type, Component>();
}
......@@ -203,6 +201,8 @@ namespace ETHotfix
{
try
{
this.InstanceId = IdGenerater.GenerateId();
this.componentDict.Clear();
if (this.components != null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册