|
|
@@ -5,8 +5,19 @@ using TrueSync;
|
|
|
|
|
|
namespace ET
|
|
|
{
|
|
|
- public static class LSWorldSystem
|
|
|
+ [EntitySystemOf(typeof(LSWorld))]
|
|
|
+ public static partial class LSWorldSystem
|
|
|
{
|
|
|
+ [EntitySystem]
|
|
|
+ private static void Awake(this LSWorld self, SceneType sceneType)
|
|
|
+ {
|
|
|
+ self.Id = self.GetId();
|
|
|
+
|
|
|
+ self.SceneType = sceneType;
|
|
|
+
|
|
|
+ self.Fiber().Info($"LSScene create: {self.Id} {self.InstanceId}");
|
|
|
+ }
|
|
|
+
|
|
|
public static LSWorld LSWorld(this LSEntity entity)
|
|
|
{
|
|
|
return entity.IScene as LSWorld;
|
|
|
@@ -16,31 +27,19 @@ namespace ET
|
|
|
{
|
|
|
return entity.LSWorld().GetId();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static TSRandom GetRandom(this LSEntity entity)
|
|
|
{
|
|
|
return entity.LSWorld().Random;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
[EnableMethod]
|
|
|
[ChildOf]
|
|
|
[ComponentOf]
|
|
|
- public class LSWorld: Entity, IAwake, IScene
|
|
|
+ public class LSWorld: Entity, IAwake<SceneType>, IScene
|
|
|
{
|
|
|
- public LSWorld()
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- public LSWorld(SceneType sceneType)
|
|
|
- {
|
|
|
- this.Id = this.GetId();
|
|
|
-
|
|
|
- this.SceneType = sceneType;
|
|
|
-
|
|
|
- this.Fiber().Info($"LSScene create: {this.Id} {this.InstanceId}");
|
|
|
- }
|
|
|
-
|
|
|
private readonly LSUpdater updater = new();
|
|
|
|
|
|
[BsonIgnore]
|
|
|
@@ -111,5 +110,10 @@ namespace ET
|
|
|
{
|
|
|
return this.AddChildWithId<T, A, B, C>(this.GetId(), a, b, c, isFromPool);
|
|
|
}
|
|
|
+
|
|
|
+ protected override long GetLongHashCode(Type type)
|
|
|
+ {
|
|
|
+ return LSEntitySystemSingleton.Instance.GetLongHashCode(type);
|
|
|
+ }
|
|
|
}
|
|
|
}
|