合理化服务器命名,使开发者更容易理解。

Scene的routeId更名为locationId
This commit is contained in:
ALEXTANGXIAO
2023-07-27 00:33:39 +08:00
parent d1c93f15d6
commit b7b2262d53
19 changed files with 134 additions and 150 deletions

View File

@@ -194,14 +194,14 @@ namespace TEngine
public static T Create<T>(Scene scene, bool isRunEvent = true) where T : Entity, new()
{
var entity = Create<T>(scene.RouteId, isRunEvent);
var entity = Create<T>(scene.LocationId, isRunEvent);
entity.Scene = scene;
return entity;
}
public static T Create<T>(Scene scene, long id, bool isRunEvent = true) where T : Entity, new()
{
var entity = Create<T>(id, scene.RouteId, isRunEvent);
var entity = Create<T>(id, scene.LocationId, isRunEvent);
entity.Scene = scene;
return entity;
}
@@ -235,12 +235,12 @@ namespace TEngine
return entity;
}
private static T Create<T>(long id, uint routeId, bool isRunEvent = true) where T : Entity, new()
protected static T Create<T>(long id, uint locationId, bool isRunEvent = true) where T : Entity, new()
{
return Create<T>(id, IdFactory.NextEntityId(routeId), isRunEvent);
return Create<T>(id, IdFactory.NextEntityId(locationId), isRunEvent);
}
private static T Create<T>(long id, long runtimeId, bool isRunEvent = true) where T : Entity, new()
protected static T Create<T>(long id, long runtimeId, bool isRunEvent = true) where T : Entity, new()
{
var entity = Rent<T>(typeof(T));
entity.Id = id;
@@ -264,13 +264,6 @@ namespace TEngine
return entity;
}
protected static Scene CreateScene(long id, bool isRunEvent = true)
{
var entity = Create<Scene>(id, id, isRunEvent);
entity.Scene = entity;
return entity;
}
#endregion
#region Members
@@ -293,12 +286,12 @@ namespace TEngine
[BsonIgnore]
[JsonIgnore]
[IgnoreDataMember]
public Scene Scene { get; private set; }
public Scene Scene { get; protected set; }
[BsonIgnore]
[JsonIgnore]
[IgnoreDataMember]
public Entity Parent { get; private set; }
public Entity Parent { get; protected set; }
[BsonElement("t")]
[BsonIgnoreIfNull]
@@ -321,7 +314,7 @@ namespace TEngine
public T AddComponent<T>() where T : Entity, new()
{
var entity = Create<T>(Id, Scene.RouteId, false);
var entity = Create<T>(Id, Scene.LocationId, false);
AddComponent(entity);
EntitiesSystem.Instance.Awake(entity);
EntitiesSystem.Instance.StartUpdate(entity);
@@ -330,7 +323,7 @@ namespace TEngine
public T AddComponent<T>(long id) where T : Entity, new()
{
var entity = Create<T>(id, Scene.RouteId, false);
var entity = Create<T>(id, Scene.LocationId, false);
AddComponent(entity);
EntitiesSystem.Instance.Awake(entity);
EntitiesSystem.Instance.StartUpdate(entity);
@@ -538,7 +531,7 @@ namespace TEngine
{
Scene = scene;
#if TENGINE_NET
RuntimeId = IdFactory.NextEntityId(scene.RouteId);
RuntimeId = IdFactory.NextEntityId(scene.LocationId);
#else
RuntimeId = IdFactory.NextRunTimeId();
#endif