|
@@ -1,6 +1,7 @@
|
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
using System;
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
|
|
+using TrueSync;
|
|
|
|
|
|
|
|
namespace ET
|
|
namespace ET
|
|
|
{
|
|
{
|
|
@@ -23,22 +24,68 @@ namespace ET
|
|
|
{
|
|
{
|
|
|
return entity.DomainScene().GetId();
|
|
return entity.DomainScene().GetId();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public static TSRandom GetRandom(this LSEntity entity)
|
|
|
|
|
+ {
|
|
|
|
|
+ return entity.DomainScene().Random;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[EnableMethod]
|
|
[EnableMethod]
|
|
|
[ChildOf]
|
|
[ChildOf]
|
|
|
- public class LSScene: LSEntity, IDeserialize
|
|
|
|
|
|
|
+ public class LSScene: Scene, IDeserialize
|
|
|
{
|
|
{
|
|
|
- public LSScene(long id)
|
|
|
|
|
|
|
+ public LSScene()
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public LSScene(long id, int zone, SceneType sceneType, string name): base(id, IdGenerater.Instance.GenerateInstanceId(), zone, sceneType, name, null)
|
|
|
{
|
|
{
|
|
|
- this.Id = id;
|
|
|
|
|
- this.InstanceId = IdGenerater.Instance.GenerateInstanceId();
|
|
|
|
|
- this.IsCreated = true;
|
|
|
|
|
- this.IsNew = true;
|
|
|
|
|
- this.IsRegister = true;
|
|
|
|
|
|
|
+ this.Updater.Parent = this;
|
|
|
|
|
+
|
|
|
Log.Info($"LSScene create: {this.Id} {this.InstanceId}");
|
|
Log.Info($"LSScene create: {this.Id} {this.InstanceId}");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public new K AddComponent<K>(bool isFromPool = false) where K : LSEntity, IAwake, new()
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddComponentWithId<K>(this.GetId(), isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : LSEntity, IAwake<P1>, new()
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddComponentWithId<K, P1>(this.GetId(), p1, isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2>, new()
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddComponentWithId<K, P1, P2>(this.GetId(), p1, p2, isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2, P3>, new()
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddComponentWithId<K, P1, P2, P3>(this.GetId(), p1, p2, p3, isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new T AddChild<T>(bool isFromPool = false) where T : LSEntity, IAwake
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddChildWithId<T>(this.GetId(), isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new T AddChild<T, A>(A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddChildWithId<T, A>(this.GetId(), a, isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddChildWithId<T, A, B>(this.GetId(), a, b, isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public new T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
|
|
|
|
|
+ {
|
|
|
|
|
+ return this.AddChildWithId<T, A, B, C>(this.GetId(), a, b, c, isFromPool);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
[BsonIgnore]
|
|
[BsonIgnore]
|
|
|
public new Entity Parent
|
|
public new Entity Parent
|
|
|
{
|
|
{
|
|
@@ -48,8 +95,7 @@ namespace ET
|
|
|
}
|
|
}
|
|
|
set
|
|
set
|
|
|
{
|
|
{
|
|
|
- value?.AddChild(this);
|
|
|
|
|
- this.Domain = this;
|
|
|
|
|
|
|
+ base.Parent = value;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -94,5 +140,7 @@ namespace ET
|
|
|
{
|
|
{
|
|
|
return ++this.idGenerator;
|
|
return ++this.idGenerator;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public TSRandom Random { get; set; }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|