diff --git a/Assets/GameScripts/DotNet/Core.meta b/Assets/GameScripts/DotNet/Core.meta deleted file mode 100644 index 1bda6d1c..00000000 --- a/Assets/GameScripts/DotNet/Core.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fdae3569c5cbfe54e97778a1f7e7af21 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer.meta b/Assets/GameScripts/DotNet/Core/Analyzer.meta deleted file mode 100644 index 79703a5b..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8d0854a24c1619b43ace830bfa1b6e69 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/ChildOfAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/ChildOfAttribute.cs deleted file mode 100644 index c28b96c5..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/ChildOfAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class)] - public class ChildOfAttribute : Attribute - { - public Type type; - - public ChildOfAttribute(Type type = null) - { - this.type = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/ChildOfAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/ChildOfAttribute.cs.meta deleted file mode 100644 index 3f8854f4..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/ChildOfAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9e06bd31e846d9a4abe88d5864a0a4d3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/ComponentOfAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/ComponentOfAttribute.cs deleted file mode 100644 index db116da6..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/ComponentOfAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace ET -{ - /// - /// 组件类父级实体类型约束 - /// 父级实体类型唯一的 标记指定父级实体类型[ComponentOf(typeof(parentType)] - /// 不唯一则标记[ComponentOf] - /// - [AttributeUsage(AttributeTargets.Class)] - public class ComponentOfAttribute : Attribute - { - public Type Type; - - public ComponentOfAttribute(Type type = null) - { - this.Type = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/ComponentOfAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/ComponentOfAttribute.cs.meta deleted file mode 100644 index 399efc13..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/ComponentOfAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3e17786fd2fafce4f9d9fbdcdbf5b9fc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EnableAccessEntiyChildAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/EnableAccessEntiyChildAttribute.cs deleted file mode 100644 index 25c5aa2a..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EnableAccessEntiyChildAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace ET -{ - /// - /// 当方法或属性内需要访问Entity类的child和component时 使用此标签 - /// 仅供必要时使用 大多数情况推荐通过Entity的子类访问 - /// - [AttributeUsage(AttributeTargets.Method|AttributeTargets.Property)] - public class EnableAccessEntiyChildAttribute : Attribute - { - - } -} - diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EnableAccessEntiyChildAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/EnableAccessEntiyChildAttribute.cs.meta deleted file mode 100644 index 00d8cd6e..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EnableAccessEntiyChildAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5b4d17f76cb73474e94eb82e30be2560 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EnableClassAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/EnableClassAttribute.cs deleted file mode 100644 index 09ebee32..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EnableClassAttribute.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace ET -{ - public class EnableClassAttribute: BaseAttribute - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EnableClassAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/EnableClassAttribute.cs.meta deleted file mode 100644 index 0f05609b..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EnableClassAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 41028c857d1434bd78bb45a748e476e8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EnableMethodAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/EnableMethodAttribute.cs deleted file mode 100644 index ea60b02c..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EnableMethodAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace ET -{ - /// - /// 对于特殊实体类 允许类内部声明方法的标签 - /// - [AttributeUsage(AttributeTargets.Class, Inherited = false)] - public class EnableMethodAttribute : Attribute - { - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EnableMethodAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/EnableMethodAttribute.cs.meta deleted file mode 100644 index c3efb283..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EnableMethodAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ce20015df46fb774eaf1cacc7cd9e35b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EntitySystemOf.cs b/Assets/GameScripts/DotNet/Core/Analyzer/EntitySystemOf.cs deleted file mode 100644 index 9856cbd4..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EntitySystemOf.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class)] - public class EntitySystemOfAttribute: BaseAttribute - { - public Type type; - - public EntitySystemOfAttribute(Type type) - { - this.type = type; - } - } - - [AttributeUsage(AttributeTargets.Class)] - public class LSEntitySystemOfAttribute: BaseAttribute - { - public Type type; - - public LSEntitySystemOfAttribute(Type type) - { - this.type = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/EntitySystemOf.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/EntitySystemOf.cs.meta deleted file mode 100644 index 1d796f7f..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/EntitySystemOf.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 50901d1f8551c05499583f1a5d362d06 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/FriendOfAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/FriendOfAttribute.cs deleted file mode 100644 index 393ad55d..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/FriendOfAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace ET -{ - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class FriendOfAttribute : Attribute - { - public Type Type; - - public FriendOfAttribute(Type type) - { - this.Type = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/FriendOfAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/FriendOfAttribute.cs.meta deleted file mode 100644 index a7baa5e7..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/FriendOfAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 516811198a72ec541a5f8f0e40454fa5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/StaticFieldAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/StaticFieldAttribute.cs deleted file mode 100644 index f46301cf..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/StaticFieldAttribute.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; - -namespace ET -{ - /// - /// 静态字段需加此标签 - /// valueToAssign: 初始化时的字段值 - /// assignNewTypeInstance: 从默认构造函数初始化 - /// - [AttributeUsage(AttributeTargets.Field)] - public class StaticFieldAttribute: Attribute - { - public readonly object valueToAssign; - - public readonly bool assignNewTypeInstance; - - public StaticFieldAttribute() - { - this.valueToAssign = null; - this.assignNewTypeInstance = false; - } - - public StaticFieldAttribute(object valueToAssign ) - { - this.valueToAssign = valueToAssign ; - this.assignNewTypeInstance = false; - } - - public StaticFieldAttribute(bool assignNewTypeInstance) - { - this.valueToAssign = null; - this.assignNewTypeInstance = assignNewTypeInstance; - } - } -} - diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/StaticFieldAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/StaticFieldAttribute.cs.meta deleted file mode 100644 index cb2b4b82..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/StaticFieldAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f0f1fd366c9df9c439b8e552ac26e607 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/UniqueIdAttribute.cs b/Assets/GameScripts/DotNet/Core/Analyzer/UniqueIdAttribute.cs deleted file mode 100644 index 37a2a749..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/UniqueIdAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace ET -{ - /// - /// 唯一Id标签 - /// 使用此标签标记的类 会检测类内部的 const int 字段成员是否唯一 - /// 可以指定唯一Id的最小值 最大值区间 - /// - [AttributeUsage(AttributeTargets.Class, Inherited = false)] - public class UniqueIdAttribute : Attribute - { - public int Min; - - public int Max; - - public UniqueIdAttribute(int min = int.MinValue, int max = int.MaxValue) - { - this.Min = min; - this.Max = max; - } - } -} - diff --git a/Assets/GameScripts/DotNet/Core/Analyzer/UniqueIdAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Analyzer/UniqueIdAttribute.cs.meta deleted file mode 100644 index 845072df..00000000 --- a/Assets/GameScripts/DotNet/Core/Analyzer/UniqueIdAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 62584bd88ecb9ce439aeaaf2f76605f5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/DoubleMap.cs b/Assets/GameScripts/DotNet/Core/DoubleMap.cs deleted file mode 100644 index 6e10998d..00000000 --- a/Assets/GameScripts/DotNet/Core/DoubleMap.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class DoubleMap - { - private readonly Dictionary kv = new Dictionary(); - private readonly Dictionary vk = new Dictionary(); - - public DoubleMap() - { - } - - public DoubleMap(int capacity) - { - kv = new Dictionary(capacity); - vk = new Dictionary(capacity); - } - - public void ForEach(Action action) - { - if (action == null) - { - return; - } - Dictionary.KeyCollection keys = kv.Keys; - foreach (K key in keys) - { - action(key, kv[key]); - } - } - - public List Keys - { - get - { - return new List(kv.Keys); - } - } - - public List Values - { - get - { - return new List(vk.Keys); - } - } - - public void Add(K key, V value) - { - if (key == null || value == null || kv.ContainsKey(key) || vk.ContainsKey(value)) - { - return; - } - kv.Add(key, value); - vk.Add(value, key); - } - - public V GetValueByKey(K key) - { - if (key != null && kv.ContainsKey(key)) - { - return kv[key]; - } - return default(V); - } - - public K GetKeyByValue(V value) - { - if (value != null && vk.ContainsKey(value)) - { - return vk[value]; - } - return default(K); - } - - public void RemoveByKey(K key) - { - if (key == null) - { - return; - } - V value; - if (!kv.TryGetValue(key, out value)) - { - return; - } - - kv.Remove(key); - vk.Remove(value); - } - - public void RemoveByValue(V value) - { - if (value == null) - { - return; - } - - K key; - if (!vk.TryGetValue(value, out key)) - { - return; - } - - kv.Remove(key); - vk.Remove(value); - } - - public void Clear() - { - kv.Clear(); - vk.Clear(); - } - - public bool ContainsKey(K key) - { - if (key == null) - { - return false; - } - return kv.ContainsKey(key); - } - - public bool ContainsValue(V value) - { - if (value == null) - { - return false; - } - return vk.ContainsKey(value); - } - - public bool Contains(K key, V value) - { - if (key == null || value == null) - { - return false; - } - return kv.ContainsKey(key) && vk.ContainsKey(value); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/DoubleMap.cs.meta b/Assets/GameScripts/DotNet/Core/DoubleMap.cs.meta deleted file mode 100644 index 23dfecd9..00000000 --- a/Assets/GameScripts/DotNet/Core/DoubleMap.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 715c9cf0f50f1fb4c98a8783cb1da714 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity.meta b/Assets/GameScripts/DotNet/Core/Entity.meta deleted file mode 100644 index 29b664c7..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: afe14daee40145d44938d748993f4775 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/ComponentView.cs b/Assets/GameScripts/DotNet/Core/Entity/ComponentView.cs deleted file mode 100644 index 02456b7e..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ComponentView.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if ENABLE_VIEW && UNITY_EDITOR -using UnityEngine; - -namespace ET -{ - public class ComponentView: MonoBehaviour - { - public Entity Component - { - get; - set; - } - } -} -#endif \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/ComponentView.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/ComponentView.cs.meta deleted file mode 100644 index 801fca26..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ComponentView.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 97f627452e3dae143943e08b0c5b20ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/Entity.cs b/Assets/GameScripts/DotNet/Core/Entity/Entity.cs deleted file mode 100644 index 04bb8531..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/Entity.cs +++ /dev/null @@ -1,1011 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; - -namespace ET -{ - [Flags] - public enum EntityStatus: byte - { - None = 0, - IsFromPool = 1, - IsRegister = 1 << 1, - IsComponent = 1 << 2, - IsCreated = 1 << 3, - IsNew = 1 << 4, - } - - public interface IEntitySystem - { - EntitySystem EntitySystem { get; } - } - - public interface IIdGenerater - { - IdGenerater IdGenerater { get; } - } - - public partial class Entity: DisposeObject - { -#if ENABLE_VIEW && UNITY_EDITOR - [UnityEngine.HideInInspector] - public UnityEngine.GameObject ViewGO; -#endif - - [BsonIgnore] - public long InstanceId { get; protected set; } - - protected Entity() - { - } - - [BsonIgnore] - private EntityStatus status = EntityStatus.None; - - [BsonIgnore] - public bool IsFromPool - { - get => (this.status & EntityStatus.IsFromPool) == EntityStatus.IsFromPool; - set - { - if (value) - { - this.status |= EntityStatus.IsFromPool; - } - else - { - this.status &= ~EntityStatus.IsFromPool; - } - } - } - - [BsonIgnore] - protected bool IsRegister - { - get => (this.status & EntityStatus.IsRegister) == EntityStatus.IsRegister; - set - { - if (this.IsRegister == value) - { - return; - } - - if (value) - { - this.status |= EntityStatus.IsRegister; - } - else - { - this.status &= ~EntityStatus.IsRegister; - } - - if (value) - { - this.RegisterSystem(); - } - -#if ENABLE_VIEW && UNITY_EDITOR - if (value) - { - this.ViewGO = new UnityEngine.GameObject(this.ViewName); - this.ViewGO.AddComponent().Component = this; - this.ViewGO.transform.SetParent(this.Parent == null? - UnityEngine.GameObject.Find("Global/Scenes").transform : this.Parent.ViewGO.transform); - } - else - { - UnityEngine.Object.Destroy(this.ViewGO); - } -#endif - } - } - - private EntitySystem GetEntitySystem() - { - return this.iScene.Fiber.EntitySystem; - } - - private IdGenerater GetIdGenerater() - { - return this.iScene.Fiber.IdGenerater; - } - - protected virtual void RegisterSystem() - { - this.GetEntitySystem().RegisterSystem(this); - } - - protected virtual string ViewName - { - get - { - return this.GetType().FullName; - } - } - - [BsonIgnore] - protected bool IsComponent - { - get => (this.status & EntityStatus.IsComponent) == EntityStatus.IsComponent; - set - { - if (value) - { - this.status |= EntityStatus.IsComponent; - } - else - { - this.status &= ~EntityStatus.IsComponent; - } - } - } - - [BsonIgnore] - protected bool IsCreated - { - get => (this.status & EntityStatus.IsCreated) == EntityStatus.IsCreated; - set - { - if (value) - { - this.status |= EntityStatus.IsCreated; - } - else - { - this.status &= ~EntityStatus.IsCreated; - } - } - } - - [BsonIgnore] - protected bool IsNew - { - get => (this.status & EntityStatus.IsNew) == EntityStatus.IsNew; - set - { - if (value) - { - this.status |= EntityStatus.IsNew; - } - else - { - this.status &= ~EntityStatus.IsNew; - } - } - } - - [BsonIgnore] - public bool IsDisposed => this.InstanceId == 0; - - [BsonIgnore] - private Entity parent; - - // 可以改变parent,但是不能设置为null - [BsonIgnore] - public Entity Parent - { - get => this.parent; - protected set - { - if (value == null) - { - throw new Exception($"cant set parent null: {this.GetType().FullName}"); - } - - if (value == this) - { - throw new Exception($"cant set parent self: {this.GetType().FullName}"); - } - - // 严格限制parent必须要有domain,也就是说parent必须在数据树上面 - if (value.IScene == null) - { - throw new Exception($"cant set parent because parent domain is null: {this.GetType().FullName} {value.GetType().FullName}"); - } - - if (this.parent != null) // 之前有parent - { - // parent相同,不设置 - if (this.parent == value) - { - Log.Error($"重复设置了Parent: {this.GetType().FullName} parent: {this.parent.GetType().FullName}"); - return; - } - - this.parent.RemoveFromChildren(this); - } - - this.parent = value; - this.IsComponent = false; - this.parent.AddToChildren(this); - - if (this is IScene scene) - { - scene.Fiber = this.parent.iScene.Fiber; - this.IScene = scene; - } - else - { - this.IScene = this.parent.iScene; - } - -#if ENABLE_VIEW && UNITY_EDITOR - this.ViewGO.GetComponent().Component = this; - this.ViewGO.transform.SetParent(this.Parent == null ? - UnityEngine.GameObject.Find("Global").transform : this.Parent.ViewGO.transform); - foreach (var child in this.Children.Values) - { - child.ViewGO.transform.SetParent(this.ViewGO.transform); - } - foreach (var comp in this.Components.Values) - { - comp.ViewGO.transform.SetParent(this.ViewGO.transform); - } -#endif - } - } - - // 该方法只能在AddComponent中调用,其他人不允许调用 - [BsonIgnore] - private Entity ComponentParent - { - set - { - if (value == null) - { - throw new Exception($"cant set parent null: {this.GetType().FullName}"); - } - - if (value == this) - { - throw new Exception($"cant set parent self: {this.GetType().FullName}"); - } - - // 严格限制parent必须要有domain,也就是说parent必须在数据树上面 - if (value.IScene == null) - { - throw new Exception($"cant set parent because parent domain is null: {this.GetType().FullName} {value.GetType().FullName}"); - } - - if (this.parent != null) // 之前有parent - { - // parent相同,不设置 - if (this.parent == value) - { - Log.Error($"重复设置了Parent: {this.GetType().FullName} parent: {this.parent.GetType().FullName}"); - return; - } - - this.parent.RemoveFromComponents(this); - } - - this.parent = value; - this.IsComponent = true; - this.parent.AddToComponents(this); - - if (this is IScene scene) - { - scene.Fiber = this.parent.iScene.Fiber; - this.IScene = scene; - } - else - { - this.IScene = this.parent.iScene; - } - } - } - - public T GetParent() where T : Entity - { - return this.Parent as T; - } - - [BsonIgnoreIfDefault] - [BsonDefaultValue(0L)] - [BsonElement] - [BsonId] - public long Id { get; protected set; } - - [BsonIgnore] - protected IScene iScene; - - [BsonIgnore] - public IScene IScene - { - get - { - return this.iScene; - } - protected set - { - if (value == null) - { - throw new Exception($"domain cant set null: {this.GetType().FullName}"); - } - - if (this.iScene == value) - { - return; - } - - IScene preScene = this.iScene; - this.iScene = value; - - if (preScene == null) - { - if (this.InstanceId == 0) - { - this.InstanceId = this.GetIdGenerater().GenerateInstanceId(); - } - - this.IsRegister = true; - - // 反序列化出来的需要设置父子关系 - if (this.componentsDB != null) - { - foreach (Entity component in this.componentsDB) - { - component.IsComponent = true; - this.Components.Add(component.GetType().FullName, component); - component.parent = this; - } - } - - if (this.childrenDB != null) - { - foreach (Entity child in this.childrenDB) - { - child.IsComponent = false; - this.Children.Add(child.Id, child); - child.parent = this; - } - } - } - - // 递归设置孩子的Domain - if (this.children != null) - { - foreach (Entity entity in this.children.Values) - { - entity.IScene = this.iScene; - } - } - - if (this.components != null) - { - foreach (Entity component in this.components.Values) - { - component.IScene = this.iScene; - } - } - - if (!this.IsCreated) - { - this.IsCreated = true; - EntitySystemSingleton.Instance.Deserialize(this); - } - } - } - - [BsonElement("Children")] - [BsonIgnoreIfNull] - private List childrenDB; - - [BsonIgnore] - private SortedDictionary children; - - [BsonIgnore] - public SortedDictionary Children - { - get - { - return this.children ??= ObjectPool.Instance.Fetch>(); - } - } - - private void AddToChildren(Entity entity) - { - this.Children.Add(entity.Id, entity); - } - - private void RemoveFromChildren(Entity entity) - { - if (this.children == null) - { - return; - } - - this.children.Remove(entity.Id); - - if (this.children.Count == 0) - { - ObjectPool.Instance.Recycle(this.children); - this.children = null; - } - } - - [BsonElement("C")] - [BsonIgnoreIfNull] - private List componentsDB; - - [BsonIgnore] - private SortedDictionary components; - - [BsonIgnore] - public SortedDictionary Components - { - get - { - return this.components ??= ObjectPool.Instance.Fetch>(); - } - } - - public int ComponentsCount() - { - if (this.components == null) - { - return 0; - } - return this.components.Count; - } - - public int ChildrenCount() - { - if (this.children == null) - { - return 0; - } - return this.children.Count; - } - - public override void Dispose() - { - if (this.IsDisposed) - { - return; - } - - this.IsRegister = false; - this.InstanceId = 0; - - ObjectPool objectPool = ObjectPool.Instance; - // 清理Children - if (this.children != null) - { - foreach (Entity child in this.children.Values) - { - child.Dispose(); - } - - this.children.Clear(); - objectPool.Recycle(this.children); - this.children = null; - - if (this.childrenDB != null) - { - this.childrenDB.Clear(); - // 创建的才需要回到池中,从db中不需要回收 - if (this.IsNew) - { - objectPool.Recycle(this.childrenDB); - this.childrenDB = null; - } - } - } - - // 清理Component - if (this.components != null) - { - foreach (KeyValuePair kv in this.components) - { - kv.Value.Dispose(); - } - - this.components.Clear(); - objectPool.Recycle(this.components); - this.components = null; - - // 创建的才需要回到池中,从db中不需要回收 - if (this.componentsDB != null) - { - this.componentsDB.Clear(); - if (this.IsNew) - { - objectPool.Recycle(this.componentsDB); - this.componentsDB = null; - } - } - } - - // 触发Destroy事件 - if (this is IDestroy) - { - EntitySystemSingleton.Instance.Destroy(this); - } - - this.iScene = null; - - if (this.parent != null && !this.parent.IsDisposed) - { - if (this.IsComponent) - { - this.parent.RemoveComponent(this); - } - else - { - this.parent.RemoveFromChildren(this); - } - } - - this.parent = null; - - base.Dispose(); - - status = EntityStatus.None; - - if (this.IsFromPool) - { - ObjectPool.Instance.Recycle(this); - } - } - - private void AddToComponents(Entity component) - { - this.Components.Add(component.GetType().FullName, component); - } - - private void RemoveFromComponents(Entity component) - { - if (this.components == null) - { - return; - } - - this.components.Remove(component.GetType().FullName); - - if (this.components.Count == 0) - { - ObjectPool.Instance.Recycle(this.components); - this.components = null; - } - } - - public K GetChild(long id) where K : Entity - { - if (this.children == null) - { - return null; - } - - this.children.TryGetValue(id, out Entity child); - return child as K; - } - - public void RemoveChild(long id) - { - if (this.children == null) - { - return; - } - - if (!this.children.TryGetValue(id, out Entity child)) - { - return; - } - - this.children.Remove(id); - child.Dispose(); - } - - public void RemoveComponent() where K : Entity - { - if (this.IsDisposed) - { - return; - } - - if (this.components == null) - { - return; - } - - Type type = typeof (K); - Entity c = this.GetComponent(type); - if (c == null) - { - return; - } - - this.RemoveFromComponents(c); - c.Dispose(); - } - - private void RemoveComponent(Entity component) - { - if (this.IsDisposed) - { - return; - } - - if (this.components == null) - { - return; - } - - Entity c = this.GetComponent(component.GetType()); - if (c == null) - { - return; - } - - if (c.InstanceId != component.InstanceId) - { - return; - } - - this.RemoveFromComponents(c); - c.Dispose(); - } - - public void RemoveComponent(Type type) - { - if (this.IsDisposed) - { - return; - } - - Entity c = this.GetComponent(type); - if (c == null) - { - return; - } - - RemoveFromComponents(c); - c.Dispose(); - } - - public K GetComponent() where K : Entity - { - if (this.components == null) - { - return null; - } - - Entity component; - if (!this.components.TryGetValue(typeof (K).FullName, out component)) - { - return default; - } - - // 如果有IGetComponent接口,则触发GetComponentSystem - if (this is IGetComponent) - { - EntitySystemSingleton.Instance.GetComponent(this, component); - } - - return (K) component; - } - - public Entity GetComponent(Type type) - { - if (this.components == null) - { - return null; - } - - Entity component; - if (!this.components.TryGetValue(type.FullName, out component)) - { - return null; - } - - // 如果有IGetComponent接口,则触发GetComponentSystem - if (this is IGetComponent) - { - EntitySystemSingleton.Instance.GetComponent(this, component); - } - - return component; - } - - private static Entity Create(Type type, bool isFromPool) - { - Entity component; - if (isFromPool) - { - component = (Entity) ObjectPool.Instance.Fetch(type); - } - else - { - component = Activator.CreateInstance(type) as Entity; - } - - component.IsFromPool = isFromPool; - component.IsCreated = true; - component.IsNew = true; - component.Id = 0; - return component; - } - - public Entity AddComponent(Entity component) - { - Type type = component.GetType(); - if (this.components != null && this.components.ContainsKey(type.FullName)) - { - throw new Exception($"entity already has component: {type.FullName}"); - } - - component.ComponentParent = this; - - if (this is IAddComponent) - { - EntitySystemSingleton.Instance.AddComponent(this, component); - } - - return component; - } - - public Entity AddComponent(Type type, bool isFromPool = false) - { - if (this.components != null && this.components.ContainsKey(type.FullName)) - { - throw new Exception($"entity already has component: {type.FullName}"); - } - - Entity component = Create(type, isFromPool); - component.Id = this.Id; - component.ComponentParent = this; - EntitySystemSingleton entitySystemSingleton = EntitySystemSingleton.Instance; - entitySystemSingleton.Awake(component); - - if (this is IAddComponent) - { - entitySystemSingleton.AddComponent(this, component); - } - - return component; - } - - public K AddComponentWithId(long id, bool isFromPool = false) where K : Entity, IAwake, new() - { - Type type = typeof (K); - if (this.components != null && this.components.ContainsKey(type.FullName)) - { - throw new Exception($"entity already has component: {type.FullName}"); - } - - Entity component = Create(type, isFromPool); - component.Id = id; - component.ComponentParent = this; - EntitySystemSingleton entitySystemSingleton = EntitySystemSingleton.Instance; - entitySystemSingleton.Awake(component); - - if (this is IAddComponent) - { - entitySystemSingleton.AddComponent(this, component); - } - - return component as K; - } - - public K AddComponentWithId(long id, P1 p1, bool isFromPool = false) where K : Entity, IAwake, new() - { - Type type = typeof (K); - if (this.components != null && this.components.ContainsKey(type.FullName)) - { - throw new Exception($"entity already has component: {type.FullName}"); - } - - Entity component = Create(type, isFromPool); - component.Id = id; - component.ComponentParent = this; - EntitySystemSingleton entitySystemSingleton = EntitySystemSingleton.Instance; - entitySystemSingleton.Awake(component, p1); - - if (this is IAddComponent) - { - entitySystemSingleton.AddComponent(this, component); - } - - return component as K; - } - - public K AddComponentWithId(long id, P1 p1, P2 p2, bool isFromPool = false) where K : Entity, IAwake, new() - { - Type type = typeof (K); - if (this.components != null && this.components.ContainsKey(type.FullName)) - { - throw new Exception($"entity already has component: {type.FullName}"); - } - - Entity component = Create(type, isFromPool); - component.Id = id; - component.ComponentParent = this; - EntitySystemSingleton entitySystemSingleton = EntitySystemSingleton.Instance; - entitySystemSingleton.Awake(component, p1, p2); - - if (this is IAddComponent) - { - entitySystemSingleton.AddComponent(this, component); - } - - return component as K; - } - - public K AddComponentWithId(long id, P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : Entity, IAwake, new() - { - Type type = typeof (K); - if (this.components != null && this.components.ContainsKey(type.FullName)) - { - throw new Exception($"entity already has component: {type.FullName}"); - } - - Entity component = Create(type, isFromPool); - component.Id = id; - component.ComponentParent = this; - EntitySystemSingleton entitySystemSingleton = EntitySystemSingleton.Instance; - entitySystemSingleton.Awake(component, p1, p2, p3); - - if (this is IAddComponent) - { - entitySystemSingleton.AddComponent(this, component); - } - - return component as K; - } - - public K AddComponent(bool isFromPool = false) where K : Entity, IAwake, new() - { - return this.AddComponentWithId(this.Id, isFromPool); - } - - public K AddComponent(P1 p1, bool isFromPool = false) where K : Entity, IAwake, new() - { - return this.AddComponentWithId(this.Id, p1, isFromPool); - } - - public K AddComponent(P1 p1, P2 p2, bool isFromPool = false) where K : Entity, IAwake, new() - { - return this.AddComponentWithId(this.Id, p1, p2, isFromPool); - } - - public K AddComponent(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : Entity, IAwake, new() - { - return this.AddComponentWithId(this.Id, p1, p2, p3, isFromPool); - } - - public Entity AddChild(Entity entity) - { - entity.Parent = this; - return entity; - } - - public T AddChild(bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = this.GetIdGenerater().GenerateId(); - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component); - return component; - } - - public T AddChild(A a, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = this.GetIdGenerater().GenerateId(); - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component, a); - return component; - } - - public T AddChild(A a, B b, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = this.GetIdGenerater().GenerateId(); - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component, a, b); - return component; - } - - public T AddChild(A a, B b, C c, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = this.GetIdGenerater().GenerateId(); - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component, a, b, c); - return component; - } - - public T AddChildWithId(long id, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = Entity.Create(type, isFromPool) as T; - component.Id = id; - component.Parent = this; - EntitySystemSingleton.Instance.Awake(component); - return component; - } - - public T AddChildWithId(long id, A a, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = id; - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component, a); - return component; - } - - public T AddChildWithId(long id, A a, B b, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = id; - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component, a, b); - return component; - } - - public T AddChildWithId(long id, A a, B b, C c, bool isFromPool = false) where T : Entity, IAwake - { - Type type = typeof (T); - T component = (T) Entity.Create(type, isFromPool); - component.Id = id; - component.Parent = this; - - EntitySystemSingleton.Instance.Awake(component, a, b, c); - return component; - } - - public override void BeginInit() - { - EntitySystemSingleton.Instance.Serialize(this); - - this.componentsDB?.Clear(); - if (this.components != null && this.components.Count != 0) - { - ObjectPool objectPool = ObjectPool.Instance; - foreach (Entity entity in this.components.Values) - { - if (entity is not ISerializeToEntity) - { - continue; - } - - this.componentsDB ??= objectPool.Fetch>(); - this.componentsDB.Add(entity); - - entity.BeginInit(); - } - } - - this.childrenDB?.Clear(); - if (this.children != null && this.children.Count != 0) - { - ObjectPool objectPool = ObjectPool.Instance; - foreach (Entity entity in this.children.Values) - { - if (entity is not ISerializeToEntity) - { - continue; - } - - this.childrenDB ??= objectPool.Fetch>(); - this.childrenDB.Add(entity); - - entity.BeginInit(); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/Entity.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/Entity.cs.meta deleted file mode 100644 index e2fad844..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/Entity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 580c95b9e9aaeba43a04eff4ff74b46e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntityHelper.cs b/Assets/GameScripts/DotNet/Core/Entity/EntityHelper.cs deleted file mode 100644 index 5c08770e..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntityHelper.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace ET -{ - public static class EntityHelper - { - public static int Zone(this Entity entity) - { - return entity.IScene.Fiber.Zone; - } - - public static Scene Scene(this Entity entity) - { - return entity.IScene as Scene; - } - - public static T Scene(this Entity entity) where T: class, IScene - { - return entity.IScene as T; - } - - public static Scene Root(this Entity entity) - { - return entity.IScene.Fiber.Root; - } - - public static Fiber Fiber(this Entity entity) - { - return entity.IScene.Fiber; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntityHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/EntityHelper.cs.meta deleted file mode 100644 index f89547c1..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntityHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ac02684a9489804d80e99f7ae99b548 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntityRef.cs b/Assets/GameScripts/DotNet/Core/Entity/EntityRef.cs deleted file mode 100644 index a0713233..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntityRef.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; - -namespace ET -{ - public readonly struct EntityRef where T: Entity - { - private readonly long instanceId; - private readonly T entity; - - private EntityRef(T t) - { - if (t == null) - { - this.instanceId = 0; - this.entity = null; - return; - } - this.instanceId = t.InstanceId; - this.entity = t; - } - - private T UnWrap - { - get - { - if (this.entity == null) - { - return null; - } - if (this.entity.InstanceId != this.instanceId) - { - return null; - } - return this.entity; - } - } - - public static implicit operator EntityRef(T t) - { - return new EntityRef(t); - } - - public static implicit operator T(EntityRef v) - { - return v.UnWrap; - } - } - - - public struct EntityWeakRef where T: Entity - { - private long instanceId; - // 使用WeakReference,这样不会导致entity dispose了却无法gc的问题 - // 不过暂时没有测试WeakReference的性能 - private readonly WeakReference weakRef; - - private EntityWeakRef(T t) - { - if (t != null) - { - this.instanceId = 0; - this.weakRef = null; - return; - } - this.instanceId = t.InstanceId; - this.weakRef = new WeakReference(t); - } - - private T UnWrap - { - get - { - if (this.instanceId == 0) - { - return null; - } - - if (!this.weakRef.TryGetTarget(out T entity)) - { - this.instanceId = 0; - return null; - } - - if (entity.InstanceId != this.instanceId) - { - this.instanceId = 0; - return null; - } - return entity; - } - } - - public static implicit operator EntityWeakRef(T t) - { - return new EntityWeakRef(t); - } - - public static implicit operator T(EntityWeakRef v) - { - return v.UnWrap; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntityRef.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/EntityRef.cs.meta deleted file mode 100644 index bfdfbaae..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntityRef.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ef22211834964fd8aced938aa4307f76 -timeCreated: 1683206917 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntitySceneFactory.cs b/Assets/GameScripts/DotNet/Core/Entity/EntitySceneFactory.cs deleted file mode 100644 index a7a1d452..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntitySceneFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - public static class EntitySceneFactory - { - public static Scene CreateScene(Entity parent, long id, long instanceId, SceneType sceneType, string name) - { - Scene scene = new(parent.Fiber(), id, instanceId, sceneType, name); - parent?.AddChild(scene); - return scene; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntitySceneFactory.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/EntitySceneFactory.cs.meta deleted file mode 100644 index 906680a3..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntitySceneFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 91cb0fe18962a644b8760cf0191d3da3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemAttribute.cs b/Assets/GameScripts/DotNet/Core/Entity/EntitySystemAttribute.cs deleted file mode 100644 index dd2cc907..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] - public class EntitySystemAttribute: BaseAttribute - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/EntitySystemAttribute.cs.meta deleted file mode 100644 index 56c5f03e..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: da6ad6e58e6b617428d5fa989149b624 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemSingleton.cs b/Assets/GameScripts/DotNet/Core/Entity/EntitySystemSingleton.cs deleted file mode 100644 index 48a9e54c..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemSingleton.cs +++ /dev/null @@ -1,302 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class EntitySystemSingleton: SingletonLock, ISingletonAwake - { - public TypeSystems TypeSystems { get; private set; } - - public void Awake() - { - this.TypeSystems = new TypeSystems(InstanceQueueIndex.Max); - - foreach (Type type in EventSystem.Instance.GetTypes(typeof (EntitySystemAttribute))) - { - object obj = Activator.CreateInstance(type); - - if (obj is ISystemType iSystemType) - { - TypeSystems.OneTypeSystems oneTypeSystems = this.TypeSystems.GetOrCreateOneTypeSystems(iSystemType.Type()); - oneTypeSystems.Map.Add(iSystemType.SystemType(), obj); - int index = iSystemType.GetInstanceQueueIndex(); - if (index > InstanceQueueIndex.None && index < InstanceQueueIndex.Max) - { - oneTypeSystems.QueueFlag[index] = true; - } - } - } - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - public void Serialize(Entity component) - { - if (component is not ISerialize) - { - return; - } - - List iSerializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (ISerializeSystem)); - if (iSerializeSystems == null) - { - return; - } - - foreach (ISerializeSystem serializeSystem in iSerializeSystems) - { - if (serializeSystem == null) - { - continue; - } - - try - { - serializeSystem.Run(component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void Deserialize(Entity component) - { - if (component is not IDeserialize) - { - return; - } - - List iDeserializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDeserializeSystem)); - if (iDeserializeSystems == null) - { - return; - } - - foreach (IDeserializeSystem deserializeSystem in iDeserializeSystems) - { - if (deserializeSystem == null) - { - continue; - } - - try - { - deserializeSystem.Run(component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - // GetComponentSystem - public void GetComponent(Entity entity, Entity component) - { - List iGetSystem = this.TypeSystems.GetSystems(entity.GetType(), typeof (IGetComponentSystem)); - if (iGetSystem == null) - { - return; - } - - foreach (IGetComponentSystem getSystem in iGetSystem) - { - if (getSystem == null) - { - continue; - } - - try - { - getSystem.Run(entity, component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - // AddComponentSystem - public void AddComponent(Entity entity, Entity component) - { - List iAddSystem = this.TypeSystems.GetSystems(entity.GetType(), typeof (IAddComponentSystem)); - if (iAddSystem == null) - { - return; - } - - foreach (IAddComponentSystem addComponentSystem in iAddSystem) - { - if (addComponentSystem == null) - { - continue; - } - - try - { - addComponentSystem.Run(entity, component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void Awake(Entity component) - { - List iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem)); - if (iAwakeSystems == null) - { - return; - } - - foreach (IAwakeSystem aAwakeSystem in iAwakeSystems) - { - if (aAwakeSystem == null) - { - continue; - } - - try - { - aAwakeSystem.Run(component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void Awake(Entity component, P1 p1) - { - if (component is not IAwake) - { - return; - } - - List iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem)); - if (iAwakeSystems == null) - { - return; - } - - foreach (IAwakeSystem aAwakeSystem in iAwakeSystems) - { - if (aAwakeSystem == null) - { - continue; - } - - try - { - aAwakeSystem.Run(component, p1); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void Awake(Entity component, P1 p1, P2 p2) - { - if (component is not IAwake) - { - return; - } - - List iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem)); - if (iAwakeSystems == null) - { - return; - } - - foreach (IAwakeSystem aAwakeSystem in iAwakeSystems) - { - if (aAwakeSystem == null) - { - continue; - } - - try - { - aAwakeSystem.Run(component, p1, p2); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void Awake(Entity component, P1 p1, P2 p2, P3 p3) - { - if (component is not IAwake) - { - return; - } - - List iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem)); - if (iAwakeSystems == null) - { - return; - } - - foreach (IAwakeSystem aAwakeSystem in iAwakeSystems) - { - if (aAwakeSystem == null) - { - continue; - } - - try - { - aAwakeSystem.Run(component, p1, p2, p3); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void Destroy(Entity component) - { - if (component is not IDestroy) - { - return; - } - - List iDestroySystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDestroySystem)); - if (iDestroySystems == null) - { - return; - } - - foreach (IDestroySystem iDestroySystem in iDestroySystems) - { - if (iDestroySystem == null) - { - continue; - } - - try - { - iDestroySystem.Run(component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemSingleton.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/EntitySystemSingleton.cs.meta deleted file mode 100644 index 3239c404..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/EntitySystemSingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ab1220efbaef9ff4ba4b28802b82707d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs deleted file mode 100644 index 87ee18de..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace ET -{ - public interface IAddComponent - { - } - - public interface IAddComponentSystem: ISystemType - { - void Run(Entity o, Entity component); - } - - [EntitySystem] - public abstract class AddComponentSystem : IAddComponentSystem where T: Entity, IAddComponent - { - void IAddComponentSystem.Run(Entity o, Entity component) - { - this.AddComponent((T)o, component); - } - - Type ISystemType.SystemType() - { - return typeof(IAddComponentSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - Type ISystemType.Type() - { - return typeof(T); - } - - protected abstract void AddComponent(T self, Entity component); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs.meta deleted file mode 100644 index c10ab280..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IAddComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 02bfd8725134ded4b9aa4b56067911ca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IAwakeSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/IAwakeSystem.cs deleted file mode 100644 index 91532ec3..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IAwakeSystem.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; - -namespace ET -{ - public interface IAwake - { - } - - public interface IAwake - { - } - - public interface IAwake - { - } - - public interface IAwake - { - } - - public interface IAwake - { - } - - public interface IAwakeSystem: ISystemType - { - void Run(Entity o); - } - - public interface IAwakeSystem: ISystemType - { - void Run(Entity o, A a); - } - - public interface IAwakeSystem: ISystemType - { - void Run(Entity o, A a, B b); - } - - public interface IAwakeSystem: ISystemType - { - void Run(Entity o, A a, B b, C c); - } - - public interface IAwakeSystem: ISystemType - { - void Run(Entity o, A a, B b, C c, D d); - } - - [EntitySystem] - public abstract class AwakeSystem : IAwakeSystem where T: Entity, IAwake - { - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(IAwakeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - void IAwakeSystem.Run(Entity o) - { - this.Awake((T)o); - } - - protected abstract void Awake(T self); - } - - [EntitySystem] - public abstract class AwakeSystem : IAwakeSystem where T: Entity, IAwake - { - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(IAwakeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - void IAwakeSystem.Run(Entity o, A a) - { - this.Awake((T)o, a); - } - - protected abstract void Awake(T self, A a); - } - - [EntitySystem] - public abstract class AwakeSystem : IAwakeSystem where T: Entity, IAwake - { - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(IAwakeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - void IAwakeSystem.Run(Entity o, A a, B b) - { - this.Awake((T)o, a, b); - } - - protected abstract void Awake(T self, A a, B b); - } - - [EntitySystem] - public abstract class AwakeSystem : IAwakeSystem where T: Entity, IAwake - { - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(IAwakeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - void IAwakeSystem.Run(Entity o, A a, B b, C c) - { - this.Awake((T)o, a, b, c); - } - - protected abstract void Awake(T self, A a, B b, C c); - } - - [EntitySystem] - public abstract class AwakeSystem : IAwakeSystem where T: Entity, IAwake - { - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(IAwakeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - void IAwakeSystem.Run(Entity o, A a, B b, C c, D d) - { - this.Awake((T)o, a, b, c, d); - } - - protected abstract void Awake(T self, A a, B b, C c, D d); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/IAwakeSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IAwakeSystem.cs.meta deleted file mode 100644 index d72aa37a..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IAwakeSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0a89095a5a372eb46ab2bec0761147a5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IDeserializeSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/IDeserializeSystem.cs deleted file mode 100644 index 20f29024..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IDeserializeSystem.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; - -namespace ET -{ - public interface IDeserialize - { - } - - public interface IDeserializeSystem: ISystemType - { - void Run(Entity o); - } - - /// - /// 反序列化后执行的System - /// - /// - [EntitySystem] - public abstract class DeserializeSystem : IDeserializeSystem where T: Entity, IDeserialize - { - void IDeserializeSystem.Run(Entity o) - { - this.Deserialize((T)o); - } - - Type ISystemType.SystemType() - { - return typeof(IDeserializeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - Type ISystemType.Type() - { - return typeof(T); - } - - protected abstract void Deserialize(T self); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/IDeserializeSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IDeserializeSystem.cs.meta deleted file mode 100644 index 32114ddc..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IDeserializeSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b3eef0324ea2ae64aa1dbd2eedeb969b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IDestroySystem.cs b/Assets/GameScripts/DotNet/Core/Entity/IDestroySystem.cs deleted file mode 100644 index 322ab799..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IDestroySystem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace ET -{ - public interface IDestroy - { - } - - public interface IDestroySystem: ISystemType - { - void Run(Entity o); - } - - [EntitySystem] - public abstract class DestroySystem : IDestroySystem where T: Entity, IDestroy - { - void IDestroySystem.Run(Entity o) - { - this.Destroy((T)o); - } - - Type ISystemType.SystemType() - { - return typeof(IDestroySystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - Type ISystemType.Type() - { - return typeof(T); - } - - protected abstract void Destroy(T self); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/IDestroySystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IDestroySystem.cs.meta deleted file mode 100644 index 00eb7814..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IDestroySystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a5e8cbd88e2fbf7449f64a9c21902e14 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs deleted file mode 100644 index 7a3553c9..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; - -namespace ET -{ - // GetComponentSystem有巨大作用,比如每次保存Unit的数据不需要所有组件都保存,只需要保存Unit变化过的组件 - // 是否变化可以通过判断该组件是否GetComponent,Get了就记录该组件 - // 这样可以只保存Unit变化过的组件 - // 再比如传送也可以做此类优化 - public interface IGetComponent - { - } - - public interface IGetComponentSystem: ISystemType - { - void Run(Entity o, Entity component); - } - - [EntitySystem] - public abstract class GetComponentSystem : IGetComponentSystem where T: Entity, IGetComponent - { - void IGetComponentSystem.Run(Entity o, Entity component) - { - this.GetComponent((T)o, component); - } - - Type ISystemType.SystemType() - { - return typeof(IGetComponentSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - Type ISystemType.Type() - { - return typeof(T); - } - - protected abstract void GetComponent(T self, Entity component); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs.meta deleted file mode 100644 index 8fdf3553..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IGetComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 29d1c2616b1b96540a5f57836f3175e2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/ILateUpdateSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/ILateUpdateSystem.cs deleted file mode 100644 index 87676d54..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ILateUpdateSystem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace ET -{ - public interface ILateUpdate - { - } - - public interface ILateUpdateSystem: ISystemType - { - void Run(Entity o); - } - - [EntitySystem] - public abstract class LateUpdateSystem : ILateUpdateSystem where T: Entity, ILateUpdate - { - void ILateUpdateSystem.Run(Entity o) - { - this.LateUpdate((T)o); - } - - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(ILateUpdateSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.LateUpdate; - } - - protected abstract void LateUpdate(T self); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/ILateUpdateSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/ILateUpdateSystem.cs.meta deleted file mode 100644 index 675cd713..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ILateUpdateSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b5b9e3fed1722394e93a75aa14151a96 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IScene.cs b/Assets/GameScripts/DotNet/Core/Entity/IScene.cs deleted file mode 100644 index 2d94a371..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IScene.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - public interface IScene - { - Fiber Fiber { get; set; } - SceneType SceneType { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/IScene.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IScene.cs.meta deleted file mode 100644 index b261c702..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IScene.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 18e1047315ac4b4e9d873d9056514569 -timeCreated: 1687171102 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/ISerializeSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/ISerializeSystem.cs deleted file mode 100644 index 531d032c..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ISerializeSystem.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; - -namespace ET -{ - public interface ISerialize - { - } - - public interface ISerializeSystem: ISystemType - { - void Run(Entity o); - } - - /// - /// 序列化前执行的System - /// - /// - [EntitySystem] - public abstract class SerializeSystem : ISerializeSystem where T: Entity, ISerialize - { - void ISerializeSystem.Run(Entity o) - { - this.Serialize((T)o); - } - - Type ISystemType.SystemType() - { - return typeof(ISerializeSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - Type ISystemType.Type() - { - return typeof(T); - } - - protected abstract void Serialize(T self); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/ISerializeSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/ISerializeSystem.cs.meta deleted file mode 100644 index d5fcc0fc..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ISerializeSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9616e34ec2374bd4da31fc60b48d4cb7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/ISerializeToEntity.cs b/Assets/GameScripts/DotNet/Core/Entity/ISerializeToEntity.cs deleted file mode 100644 index d404a488..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ISerializeToEntity.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace ET -{ - public interface ISerializeToEntity - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/ISerializeToEntity.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/ISerializeToEntity.cs.meta deleted file mode 100644 index 0182e539..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ISerializeToEntity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ab4ba4dfcb46e143a33b1e1597cee9a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/ISystemType.cs b/Assets/GameScripts/DotNet/Core/Entity/ISystemType.cs deleted file mode 100644 index 3180a650..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ISystemType.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace ET -{ - public interface ISystemType - { - Type Type(); - Type SystemType(); - int GetInstanceQueueIndex(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/ISystemType.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/ISystemType.cs.meta deleted file mode 100644 index 5fba2890..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ISystemType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f5e007ff607d40c4a94a00007a2cb150 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/ITransfer.cs b/Assets/GameScripts/DotNet/Core/Entity/ITransfer.cs deleted file mode 100644 index d2fdf04a..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ITransfer.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - // Unit的组件有这个接口说明需要传送 - public interface ITransfer - { - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/ITransfer.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/ITransfer.cs.meta deleted file mode 100644 index f3cdad7f..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/ITransfer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 382f25012ae6c8747bb25dd3070bf703 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/IUpdateSystem.cs b/Assets/GameScripts/DotNet/Core/Entity/IUpdateSystem.cs deleted file mode 100644 index 5d379062..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IUpdateSystem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace ET -{ - public interface IUpdate - { - } - - public interface IUpdateSystem: ISystemType - { - void Run(Entity o); - } - - [EntitySystem] - public abstract class UpdateSystem : IUpdateSystem where T: Entity, IUpdate - { - void IUpdateSystem.Run(Entity o) - { - this.Update((T)o); - } - - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(IUpdateSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.Update; - } - - protected abstract void Update(T self); - } -} diff --git a/Assets/GameScripts/DotNet/Core/Entity/IUpdateSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/IUpdateSystem.cs.meta deleted file mode 100644 index 28b2813f..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/IUpdateSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2b8bad203b3067940b9f4264adacecef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/InstanceQueueIndex.cs b/Assets/GameScripts/DotNet/Core/Entity/InstanceQueueIndex.cs deleted file mode 100644 index d5baf533..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/InstanceQueueIndex.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET -{ - public static class InstanceQueueIndex - { - public const int None = -1; - public const int Update = 0; - public const int LateUpdate = 1; - public const int Load = 2; - public const int Max = 3; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/InstanceQueueIndex.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/InstanceQueueIndex.cs.meta deleted file mode 100644 index ce717984..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/InstanceQueueIndex.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 839a3936286df0e46b43323334005d63 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/Scene.cs b/Assets/GameScripts/DotNet/Core/Entity/Scene.cs deleted file mode 100644 index 4ca56c75..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/Scene.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Diagnostics; -using MongoDB.Bson.Serialization.Attributes; - -namespace ET -{ - [EnableMethod] - [ChildOf] - public class Scene: Entity, IScene - { - [BsonIgnore] - public Fiber Fiber { get; set; } - - public string Name { get; } - - public SceneType SceneType - { - get; - set; - } - - public Scene() - { - } - - public Scene(Fiber fiber, long id, long instanceId, SceneType sceneType, string name) - { - this.Id = id; - this.Name = name; - this.InstanceId = instanceId; - this.SceneType = sceneType; - this.IsCreated = true; - this.IsNew = true; - this.Fiber = fiber; - this.IScene = this; - this.IsRegister = true; - Log.Info($"scene create: {this.SceneType} {this.Id} {this.InstanceId}"); - } - - public override void Dispose() - { - base.Dispose(); - - Log.Info($"scene dispose: {this.SceneType} {this.Id} {this.InstanceId}"); - } - - protected override string ViewName - { - get - { - return $"{this.GetType().Name} ({this.SceneType})"; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/Scene.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/Scene.cs.meta deleted file mode 100644 index 7086e103..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/Scene.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b20fe3ac8d3755b4582fbc0751d8cf8b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Entity/SceneType.cs b/Assets/GameScripts/DotNet/Core/Entity/SceneType.cs deleted file mode 100644 index 62fa34be..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/SceneType.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; - -namespace ET -{ - [Flags] - public enum SceneType: long - { - None = 0, - Main = 1, // 主纤程,一个进程一个, 初始化从这里开始 - NetInner = 1 << 2, // 负责进程间消息通信 - Realm = 1 << 3, - Gate = 1 << 4, - Http = 1 << 5, - Location = 1 << 6, - Map = 1 << 7, - Router = 1 << 8, - RouterManager = 1 << 9, - Robot = 1 << 10, - BenchmarkClient = 1 << 11, - BenchmarkServer = 1 << 12, - Benchmark = 1 << 13, - Match = 1 << 14, - Room = 1 << 15, - LockStepClient = 1 << 16, - LockStepServer = 1 << 17, - RoomRoot = 1 << 18, - Watcher = 1 << 19, - - // 客户端 - Demo = 1 << 30, - Current = 1L << 31, - LockStep = 1L << 32, - LockStepView = 1L << 33, - DemoView = 1L << 34, - NetClient = 1L << 35, - - All = long.MaxValue, - } - - public static class SceneTypeHelper - { - public static bool HasSameFlag(this SceneType a, SceneType b) - { - if (((ulong) a & (ulong) b) == 0) - { - return false; - } - return true; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Entity/SceneType.cs.meta b/Assets/GameScripts/DotNet/Core/Entity/SceneType.cs.meta deleted file mode 100644 index 4df55b40..00000000 --- a/Assets/GameScripts/DotNet/Core/Entity/SceneType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b36ca6be079a1bb458f59657482f6260 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber.meta b/Assets/GameScripts/DotNet/Core/Fiber.meta deleted file mode 100644 index fddd1fed..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2fd29b3ff6f09434a9de8b2a26016ea8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/EntitySystem.cs b/Assets/GameScripts/DotNet/Core/Fiber/EntitySystem.cs deleted file mode 100644 index 33b4d693..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/EntitySystem.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class EntitySystem - { - private readonly Queue>[] queues = new Queue>[InstanceQueueIndex.Max]; - - public EntitySystem() - { - for (int i = 0; i < this.queues.Length; i++) - { - this.queues[i] = new Queue>(); - } - } - - - public virtual void RegisterSystem(Entity component) - { - Type type = component.GetType(); - - TypeSystems.OneTypeSystems oneTypeSystems = EntitySystemSingleton.Instance.TypeSystems.GetOneTypeSystems(type); - if (oneTypeSystems == null) - { - return; - } - for (int i = 0; i < oneTypeSystems.QueueFlag.Length; ++i) - { - if (!oneTypeSystems.QueueFlag[i]) - { - continue; - } - this.queues[i].Enqueue(component); - } - } - - public void Update() - { - Queue> queue = this.queues[InstanceQueueIndex.Update]; - int count = queue.Count; - while (count-- > 0) - { - Entity component = queue.Dequeue(); - if (component == null) - { - continue; - } - - if (component.IsDisposed) - { - continue; - } - - if (component is not IUpdate) - { - continue; - } - - try - { - List iUpdateSystems = EntitySystemSingleton.Instance.TypeSystems.GetSystems(component.GetType(), typeof (IUpdateSystem)); - if (iUpdateSystems == null) - { - continue; - } - - queue.Enqueue(component); - - foreach (IUpdateSystem iUpdateSystem in iUpdateSystems) - { - try - { - iUpdateSystem.Run(component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - catch (Exception e) - { - throw new Exception($"entity system update fail: {component.GetType().FullName}", e); - } - - } - } - - public void LateUpdate() - { - Queue> queue = this.queues[InstanceQueueIndex.LateUpdate]; - int count = queue.Count; - while (count-- > 0) - { - Entity component = queue.Dequeue(); - if (component == null) - { - continue; - } - - if (component.IsDisposed) - { - continue; - } - - if (component is not ILateUpdate) - { - continue; - } - - List iLateUpdateSystems = EntitySystemSingleton.Instance.TypeSystems.GetSystems(component.GetType(), typeof (ILateUpdateSystem)); - if (iLateUpdateSystems == null) - { - continue; - } - - queue.Enqueue(component); - - foreach (ILateUpdateSystem iLateUpdateSystem in iLateUpdateSystems) - { - try - { - iLateUpdateSystem.Run(component); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/EntitySystem.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/EntitySystem.cs.meta deleted file mode 100644 index fb0adee9..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/EntitySystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 322c7636f08cf8443b7c6db151a61ce4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Fiber.cs b/Assets/GameScripts/DotNet/Core/Fiber/Fiber.cs deleted file mode 100644 index 2e701ded..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Fiber.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; - -namespace ET -{ - public static class FiberHelper - { - public static ActorId GetActorId(this Entity self) - { - Fiber root = self.Fiber(); - return new ActorId(root.Process, root.Id, self.InstanceId); - } - } - - public class Fiber: IDisposable - { - public bool IsDisposed; - - public int Id; - - public int Zone; - - public Scene Root { get; } - - public Address Address - { - get - { - return new Address(this.Process, this.Id); - } - } - - public int Process { get; } - - public EntitySystem EntitySystem { get; } - public TimeInfo TimeInfo { get; } - public IdGenerater IdGenerater { get; private set; } - public Mailboxes Mailboxes { get; private set; } - public ThreadSynchronizationContext ThreadSynchronizationContext { get; } - - private EntityRef timerCompnent; - public TimerComponent TimerComponent - { - get - { - return this.timerCompnent; - } - set - { - this.timerCompnent = value; - } - } - - private EntityRef coroutineLockComponent; - public CoroutineLockComponent CoroutineLockComponent - { - get - { - return this.coroutineLockComponent; - } - set - { - this.coroutineLockComponent = value; - } - } - - private EntityRef actorInnerComponent; - public ActorInnerComponent ActorInnerComponent - { - get - { - return this.actorInnerComponent; - } - set - { - this.actorInnerComponent = value; - } - } - - private readonly Queue frameFinishTasks = new(); - - internal Fiber(int id, int process, int zone, SceneType sceneType, string name) - { - this.Id = id; - this.Process = process; - this.Zone = zone; - this.EntitySystem = new EntitySystem(); - this.TimeInfo = new TimeInfo(); - this.IdGenerater = new IdGenerater(process, this.TimeInfo); - this.Mailboxes = new Mailboxes(); - this.ThreadSynchronizationContext = new ThreadSynchronizationContext(); - this.Root = new Scene(this, id, 1, sceneType, name); - } - - internal void Update() - { - try - { - this.TimeInfo.Update(); - this.EntitySystem.Update(); - } - catch (Exception e) - { - Log.Error(e); - } - } - - internal void LateUpdate() - { - try - { - this.EntitySystem.LateUpdate(); - FrameFinishUpdate(); - - this.ThreadSynchronizationContext.Update(); - } - catch (Exception e) - { - Log.Error(e); - } - } - - public async ETTask WaitFrameFinish() - { - ETTask task = ETTask.Create(true); - this.frameFinishTasks.Enqueue(task); - await task; - } - - private void FrameFinishUpdate() - { - while (this.frameFinishTasks.Count > 0) - { - ETTask task = this.frameFinishTasks.Dequeue(); - task.SetResult(); - } - } - - public void Dispose() - { - if (this.IsDisposed) - { - return; - } - this.IsDisposed = true; - - FiberManager.Instance.RemoveReal(this.Id); - - this.Root.Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Fiber.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Fiber.cs.meta deleted file mode 100644 index e9d7fd46..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Fiber.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 490d7e982e85adf41a5bfd1307271d25 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/IdGenerater.cs b/Assets/GameScripts/DotNet/Core/Fiber/IdGenerater.cs deleted file mode 100644 index db1845b9..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/IdGenerater.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace ET -{ - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct IdStruct - { - public short Process; // 14bit - public uint Time; // 30bit - public uint Value; // 20bit - - public long ToLong() - { - ulong result = 0; - result |= (ushort) this.Process; - result <<= 14; - result |= this.Time; - result <<= 30; - result |= this.Value; - return (long) result; - } - - public IdStruct(uint time, short process, uint value) - { - this.Process = process; - this.Time = time; - this.Value = value; - } - - public IdStruct(long id) - { - ulong result = (ulong) id; - this.Value = (ushort) (result & IdGenerater.Mask20bit); - result >>= 20; - this.Time = (uint) result & IdGenerater.Mask30bit; - result >>= 30; - this.Process = (short) (result & IdGenerater.Mask14bit); - } - - public override string ToString() - { - return $"process: {this.Process}, time: {this.Time}, value: {this.Value}"; - } - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct InstanceIdStruct - { - public uint Time; // 32bit - public uint Value; // 32bit - - public long ToLong() - { - ulong result = 0; - result |= this.Time; - result <<= 32; - result |= this.Value; - return (long) result; - } - - public InstanceIdStruct(uint time, uint value) - { - this.Time = time; - this.Value = value; - } - - public InstanceIdStruct(long id) - { - ulong result = (ulong) id; - this.Value = (uint)(result & uint.MaxValue); - result >>= 32; - this.Time = (uint)(result & uint.MaxValue); - } - - public override string ToString() - { - return $"time: {this.Time}, value: {this.Value}"; - } - } - - public class IdGenerater - { - public const int MaxZone = 1024; - - public const int Mask14bit = 0x3fff; - public const int Mask30bit = 0x3fffffff; - public const int Mask20bit = 0xfffff; - - private readonly long epoch2022; - private uint value; - private uint lastIdTime; - - private readonly TimeInfo timeInfo; - private readonly int process; - - private uint instanceIdValue; - - public IdGenerater(int process, TimeInfo timeInfo) - { - this.process = process; - this.timeInfo = timeInfo; - - long epoch1970tick = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000; - this.epoch2022 = new DateTime(2022, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000 - epoch1970tick; - this.lastIdTime = TimeSince2022(); - if (this.lastIdTime <= 0) - { - Log.Warning($"lastIdTime less than 0: {this.lastIdTime}"); - this.lastIdTime = 1; - } - } - - private uint TimeSince2022() - { - uint a = (uint)((this.timeInfo.FrameTime - this.epoch2022) / 1000); - return a; - } - - public long GenerateId() - { - uint time = TimeSince2022(); - - // 时间不会倒退 - if (time > this.lastIdTime) - { - this.lastIdTime = time; - } - this.value = IdValueGenerater.Instance.Value; - - IdStruct idStruct = new(this.lastIdTime, (short)this.process, value); - return idStruct.ToLong(); - } - - public long GenerateInstanceId() - { - uint time = this.TimeSince2022(); - - // 时间不会倒退 - if (time > this.lastIdTime) - { - this.lastIdTime = time; - } - ++this.instanceIdValue; - - if (this.instanceIdValue >= int.MaxValue) - { - this.instanceIdValue = 0; - } - - InstanceIdStruct instanceIdStruct = new(this.lastIdTime, this.instanceIdValue); - return instanceIdStruct.ToLong(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/IdGenerater.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/IdGenerater.cs.meta deleted file mode 100644 index 34b87ecc..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/IdGenerater.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 01dd1407fbf957f41a818bcfb700c7ed -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxComponent.cs b/Assets/GameScripts/DotNet/Core/Fiber/MailBoxComponent.cs deleted file mode 100644 index 7063c596..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxComponent.cs +++ /dev/null @@ -1,50 +0,0 @@ -namespace ET -{ - [EntitySystemOf(typeof(MailBoxComponent))] - [FriendOf(typeof(MailBoxComponent))] - public static partial class MailBoxComponentSystem - { - [EntitySystem] - private static void Awake(this MailBoxComponent self, MailBoxType mailBoxType) - { - Fiber fiber = self.Fiber(); - self.MailBoxType = mailBoxType; - self.ParentInstanceId = self.Parent.InstanceId; - fiber.Mailboxes.Add(self); - self.CoroutineLockComponent = fiber.CoroutineLockComponent; - } - - [EntitySystem] - private static void Destroy(this MailBoxComponent self) - { - self.Fiber().Mailboxes.Remove(self.ParentInstanceId); - } - - // 加到mailbox - public static void Add(this MailBoxComponent self, Address fromAddress, MessageObject messageObject) - { - // 根据mailboxType进行分发处理 - EventSystem.Instance.Invoke((long)self.MailBoxType, new MailBoxInvoker() {MailBoxComponent = self, MessageObject = messageObject, FromAddress = fromAddress}); - } - } - - public struct MailBoxInvoker - { - public Address FromAddress; - public MessageObject MessageObject; - public MailBoxComponent MailBoxComponent; - } - - /// - /// 挂上这个组件表示该Entity是一个Actor,接收的消息将会队列处理 - /// - [ComponentOf] - public class MailBoxComponent: Entity, IAwake, IDestroy - { - public long ParentInstanceId { get; set; } - // Mailbox的类型 - public MailBoxType MailBoxType { get; set; } - - public CoroutineLockComponent CoroutineLockComponent { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxComponent.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/MailBoxComponent.cs.meta deleted file mode 100644 index e25eb91f..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c7ab28162e70e0a45b7935f05a5526de -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxType.cs b/Assets/GameScripts/DotNet/Core/Fiber/MailBoxType.cs deleted file mode 100644 index 9158ddfe..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ET -{ - public enum MailBoxType - { - OrderedMessage = 1, - UnOrderedMessage, - GateSession, - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxType.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/MailBoxType.cs.meta deleted file mode 100644 index 0dcc6600..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/MailBoxType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75dc09ab9ad11c744ba5e2a9aba5d848 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Mailboxes.cs b/Assets/GameScripts/DotNet/Core/Fiber/Mailboxes.cs deleted file mode 100644 index b02ccdcb..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Mailboxes.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - public class Mailboxes - { - private readonly Dictionary mailboxes = new(); - - public void Add(MailBoxComponent mailBoxComponent) - { - this.mailboxes.Add(mailBoxComponent.Parent.InstanceId, mailBoxComponent); - } - - public void Remove(long instanceId) - { - this.mailboxes.Remove(instanceId); - } - - public MailBoxComponent Get(long instanceId) - { - this.mailboxes.TryGetValue(instanceId, out MailBoxComponent entity); - return entity; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Mailboxes.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Mailboxes.cs.meta deleted file mode 100644 index c99f0bed..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Mailboxes.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b7748d833ec77144bbadc98f35a923fa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module.meta deleted file mode 100644 index c7a7d330..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ca1c1efa24a1cc648bba7858f5040e69 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor.meta deleted file mode 100644 index b87076a9..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 43270a1ae7e8422458e49f6855475e8c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorHelper.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorHelper.cs deleted file mode 100644 index e01e7bf5..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorHelper.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace ET -{ - public static class ActorHelper - { - public static IActorResponse CreateResponse(IActorRequest iActorRequest, int error) - { - Type responseType = OpcodeType.Instance.GetResponseType(iActorRequest.GetType()); - IActorResponse response = (IActorResponse)ObjectPool.Instance.Fetch(responseType); - response.Error = error; - response.RpcId = iActorRequest.RpcId; - return response; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorHelper.cs.meta deleted file mode 100644 index b831218f..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a98f0108855505546a19aa3fb9aeba48 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponent.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponent.cs deleted file mode 100644 index 8ceb2aad..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - [ComponentOf(typeof(Scene))] - public class ActorInnerComponent: Entity, IAwake, IDestroy, IUpdate - { - public const long TIMEOUT_TIME = 40 * 1000; - - public int RpcId; - - public readonly Dictionary requestCallback = new(); - - public readonly List list = new(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponent.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponent.cs.meta deleted file mode 100644 index d0aafd7d..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d74a2fe39353d9c498e360f72bca8080 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs deleted file mode 100644 index 5e24a5ce..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - [EntitySystemOf(typeof(ActorInnerComponent))] - [FriendOf(typeof(ActorInnerComponent))] - public static partial class ActorInnerComponentSystem - { - [EntitySystem] - private static void Destroy(this ActorInnerComponent self) - { - Fiber fiber = self.Fiber(); - ActorMessageQueue.Instance.RemoveQueue(fiber.Id); - } - - [EntitySystem] - private static void Awake(this ActorInnerComponent self) - { - Fiber fiber = self.Fiber(); - ActorMessageQueue.Instance.AddQueue(fiber.Id); - fiber.ActorInnerComponent = self; - } - - [EntitySystem] - private static void Update(this ActorInnerComponent self) - { - self.list.Clear(); - Fiber fiber = self.Fiber(); - ActorMessageQueue.Instance.Fetch(fiber.Id, 1000, self.list); - - ActorInnerComponent actorInnerComponent = fiber.Root.GetComponent(); - foreach (ActorMessageInfo actorMessageInfo in self.list) - { - if (actorMessageInfo.MessageObject is IActorResponse response) - { - actorInnerComponent.HandleIActorResponse(response); - continue; - } - - ActorId actorId = actorMessageInfo.ActorId; - MessageObject message = actorMessageInfo.MessageObject; - - MailBoxComponent mailBoxComponent = self.Fiber().Mailboxes.Get(actorId.InstanceId); - if (mailBoxComponent == null) - { - Log.Warning($"actor not found mailbox, from: {actorId} current: {fiber.Address} {message}"); - if (message is IActorRequest request) - { - IActorResponse resp = ActorHelper.CreateResponse(request, ErrorCore.ERR_NotFoundActor); - actorInnerComponent.Reply(actorId.Address, resp); - } - return; - } - mailBoxComponent.Add(actorId.Address, message); - } - } - - - public static void HandleIActorResponse(this ActorInnerComponent self, IActorResponse response) - { - if (!self.requestCallback.Remove(response.RpcId, out ActorMessageSender actorMessageSender)) - { - return; - } - Run(actorMessageSender, response); - } - - private static void Run(ActorMessageSender self, IActorResponse response) - { - if (response.Error == ErrorCore.ERR_ActorTimeout) - { - self.Tcs.SetException(new Exception($"Rpc error: request, 注意Actor消息超时,请注意查看是否死锁或者没有reply: actorId: {self.ActorId} {self.Request}, response: {response}")); - return; - } - - if (self.NeedException && ErrorCore.IsRpcNeedThrowException(response.Error)) - { - self.Tcs.SetException(new Exception($"Rpc error: actorId: {self.ActorId} request: {self.Request}, response: {response}")); - return; - } - - self.Tcs.SetResult(response); - } - - public static void Reply(this ActorInnerComponent self, Address fromAddress, IActorResponse message) - { - self.Send(new ActorId(fromAddress, 0), message); - } - - public static void Send(this ActorInnerComponent self, ActorId actorId, IActorMessage message) - { - Fiber fiber = self.Fiber(); - // 如果发向同一个进程,则扔到消息队列中 - if (actorId.Process != fiber.Process) - { - throw new Exception($"actor inner process diff: {actorId.Process} {fiber.Process}"); - } - ActorMessageQueue.Instance.Send(fiber.Address, actorId, (MessageObject)message); - } - - private static void SendInner(this ActorInnerComponent self, ActorId actorId, MessageObject message) - { - Fiber fiber = self.Fiber(); - ActorMessageQueue.Instance.Send(fiber.Address, actorId, message); - } - - public static int GetRpcId(this ActorInnerComponent self) - { - return ++self.RpcId; - } - - public static async ETTask Call( - this ActorInnerComponent self, - ActorId actorId, - IActorRequest request, - bool needException = true - ) - { - request.RpcId = self.GetRpcId(); - - if (actorId == default) - { - throw new Exception($"actor id is 0: {request}"); - } - - return await self.Call(actorId, request.RpcId, request, needException); - } - - public static async ETTask Call( - this ActorInnerComponent self, - ActorId actorId, - int rpcId, - IActorRequest iActorRequest, - bool needException = true - ) - { - if (actorId == default) - { - throw new Exception($"actor id is 0: {iActorRequest}"); - } - Fiber fiber = self.Fiber(); - if (fiber.Process != actorId.Process) - { - throw new Exception($"actor inner process diff: {actorId.Process} {fiber.Process}"); - } - - var tcs = ETTask.Create(true); - - self.requestCallback.Add(rpcId, new ActorMessageSender(actorId, iActorRequest, tcs, needException)); - - self.SendInner(actorId, iActorRequest as MessageObject); - - - async ETTask Timeout() - { - await fiber.TimerComponent.WaitAsync(ActorInnerComponent.TIMEOUT_TIME); - - if (!self.requestCallback.Remove(rpcId, out ActorMessageSender action)) - { - return; - } - - if (needException) - { - action.Tcs.SetException(new Exception($"actor sender timeout: {iActorRequest}")); - } - else - { - IActorResponse response = ActorHelper.CreateResponse(iActorRequest, ErrorCore.ERR_Timeout); - action.Tcs.SetResult(response); - } - } - - Timeout().Coroutine(); - - long beginTime = fiber.TimeInfo.ServerFrameTime(); - - IActorResponse response = await tcs; - - long endTime = fiber.TimeInfo.ServerFrameTime(); - - long costTime = endTime - beginTime; - if (costTime > 200) - { - Log.Warning($"actor rpc time > 200: {costTime} {iActorRequest}"); - } - - return response; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs.meta deleted file mode 100644 index 346e4563..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorInnerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ceb83d81c9c72a340887562f24d51629 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorMessageSender.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorMessageSender.cs deleted file mode 100644 index be1cf4ac..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorMessageSender.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.IO; - -namespace ET -{ - // 知道对方的instanceId,使用这个类发actor消息 - public readonly struct ActorMessageSender - { - public ActorId ActorId { get; } - - public IActorRequest Request { get; } - - public bool NeedException { get; } - - public ETTask Tcs { get; } - - public ActorMessageSender(ActorId actorId, IActorRequest iActorRequest, ETTask tcs, bool needException) - { - this.ActorId = actorId; - this.Request = iActorRequest; - this.Tcs = tcs; - this.NeedException = needException; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorMessageSender.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorMessageSender.cs.meta deleted file mode 100644 index 5f02c9a2..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Actor/ActorMessageSender.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b51d51733a35791478b6a487b5196dd3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock.meta deleted file mode 100644 index 423c6107..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 25135ca97055fb64fa240b23a01794cb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs deleted file mode 100644 index ab77f5a1..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; - -namespace ET -{ - [EntitySystemOf(typeof(CoroutineLock))] - public static partial class CoroutineLockSystem - { - [EntitySystem] - private static void Awake(this CoroutineLock self, int type, long k, int count) - { - self.type = type; - self.key = k; - self.level = count; - } - - [EntitySystem] - private static void Destroy(this CoroutineLock self) - { - self.Scene().RunNextCoroutine(self.type, self.key, self.level + 1); - self.type = CoroutineLockType.None; - self.key = 0; - self.level = 0; - } - } - - [ChildOf(typeof(CoroutineLockQueue))] - public class CoroutineLock: Entity, IAwake, IDestroy - { - public int type; - public long key; - public int level; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs.meta deleted file mode 100644 index 4f458b9e..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLock.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 92e2f035a00b77c498465fbfb5bc4f0d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs deleted file mode 100644 index 3ef4a2d4..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - [EntitySystemOf(typeof(CoroutineLockComponent))] - public static partial class CoroutineLockComponentSystem - { - [EntitySystem] - public static void Awake(this CoroutineLockComponent self) - { - self.Fiber.CoroutineLockComponent = self; - } - - [EntitySystem] - public static void Update(this CoroutineLockComponent self) - { - // 循环过程中会有对象继续加入队列 - while (self.nextFrameRun.Count > 0) - { - (int coroutineLockType, long key, int count) = self.nextFrameRun.Dequeue(); - self.Notify(coroutineLockType, key, count); - } - } - - public static void RunNextCoroutine(this CoroutineLockComponent self, int coroutineLockType, long key, int level) - { - // 一个协程队列一帧处理超过100个,说明比较多了,打个warning,检查一下是否够正常 - if (level == 100) - { - Log.Warning($"too much coroutine level: {coroutineLockType} {key}"); - } - - self.nextFrameRun.Enqueue((coroutineLockType, key, level)); - } - - public static async ETTask Wait(this CoroutineLockComponent self, int coroutineLockType, long key, int time = 60000) - { - CoroutineLockQueueType coroutineLockQueueType = self.GetChild(coroutineLockType) ?? self.AddChildWithId(coroutineLockType); - return await coroutineLockQueueType.Wait(key, time); - } - - private static void Notify(this CoroutineLockComponent self, int coroutineLockType, long key, int level) - { - CoroutineLockQueueType coroutineLockQueueType = self.GetChild(coroutineLockType); - if (coroutineLockQueueType == null) - { - return; - } - coroutineLockQueueType.Notify(key, level); - } - } - - [ComponentOf(typeof(Scene))] - public class CoroutineLockComponent: Entity, IAwake, IScene, IUpdate - { - public Fiber Fiber { get; set; } - public SceneType SceneType { get; set; } - - public readonly Queue<(int, long, int)> nextFrameRun = new(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs.meta deleted file mode 100644 index c1ecfca0..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c025fcd3d7a7add45851a0c7b93c6674 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs deleted file mode 100644 index 978ac854..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - [EntitySystemOf(typeof(CoroutineLockQueue))] - public static partial class CoroutineLockQueueSystem - { - [EntitySystem] - private static void Awake(this CoroutineLockQueue self, int type) - { - self.type = type; - } - - [EntitySystem] - private static void Destroy(this CoroutineLockQueue self) - { - self.queue.Clear(); - self.type = 0; - self.CurrentCoroutineLock = null; - } - - public static async ETTask Wait(this CoroutineLockQueue self, int time) - { - if (self.CurrentCoroutineLock == null) - { - self.CurrentCoroutineLock = self.AddChild(self.type, self.Id, 1, true); - return self.CurrentCoroutineLock; - } - - WaitCoroutineLock waitCoroutineLock = WaitCoroutineLock.Create(); - self.queue.Enqueue(waitCoroutineLock); - if (time > 0) - { - long tillTime = self.Fiber().TimeInfo.ClientFrameTime() + time; - self.Root().GetComponent().NewOnceTimer(tillTime, TimerCoreInvokeType.CoroutineTimeout, waitCoroutineLock); - } - self.CurrentCoroutineLock = await waitCoroutineLock.Wait(); - return self.CurrentCoroutineLock; - } - - public static void Notify(this CoroutineLockQueue self, int level) - { - // 有可能WaitCoroutineLock已经超时抛出异常,所以要找到一个未处理的WaitCoroutineLock - while (self.queue.Count > 0) - { - WaitCoroutineLock waitCoroutineLock = self.queue.Dequeue(); - - if (waitCoroutineLock.IsDisposed()) - { - continue; - } - - CoroutineLock coroutineLock = self.AddChild(self.type, self.Id, level, true); - - waitCoroutineLock.SetResult(coroutineLock); - break; - } - } - } - - [ChildOf(typeof(CoroutineLockQueueType))] - public class CoroutineLockQueue: Entity, IAwake, IDestroy - { - public int type; - - private EntityRef currentCoroutineLock; - - public CoroutineLock CurrentCoroutineLock - { - get - { - return this.currentCoroutineLock; - } - set - { - this.currentCoroutineLock = value; - } - } - - public Queue queue = new(); - - public int Count - { - get - { - return this.queue.Count; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs.meta deleted file mode 100644 index f63506b0..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75bebf4862d839045a78140d260ecc11 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs deleted file mode 100644 index eae7bc39..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - [EntitySystemOf(typeof(CoroutineLockQueueType))] - [FriendOf(typeof(CoroutineLockQueueType))] - public static partial class CoroutineLockQueueTypeSystem - { - [EntitySystem] - private static void Awake(this CoroutineLockQueueType self) - { - } - - public static CoroutineLockQueue Get(this CoroutineLockQueueType self, long key) - { - return self.GetChild(key); - } - - public static CoroutineLockQueue New(this CoroutineLockQueueType self, long key) - { - CoroutineLockQueue queue = self.AddChildWithId(key, (int)self.Id, true); - return queue; - } - - public static void Remove(this CoroutineLockQueueType self, long key) - { - self.RemoveChild(key); - } - - public static async ETTask Wait(this CoroutineLockQueueType self, long key, int time) - { - CoroutineLockQueue queue = self.Get(key) ?? self.New(key); - return await queue.Wait(time); - } - - public static void Notify(this CoroutineLockQueueType self, long key, int level) - { - CoroutineLockQueue queue = self.Get(key); - if (queue == null) - { - return; - } - - if (queue.Count == 0) - { - self.Remove(key); - } - - queue.Notify(level); - } - } - - [ChildOf(typeof(CoroutineLockComponent))] - public class CoroutineLockQueueType: Entity, IAwake - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs.meta deleted file mode 100644 index fa3b7451..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockQueueType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d57848ad9cf65e3478460a513cfb6434 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockType.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockType.cs deleted file mode 100644 index 11acdf37..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockType.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace ET -{ - public static class CoroutineLockType - { - public const int None = 0; - public const int Location = 1; // location进程上使用 - public const int ActorLocationSender = 2; // ActorLocationSender中队列消息 - public const int Mailbox = 3; // Mailbox中队列 - public const int UnitId = 4; // Map服务器上线下线时使用 - public const int DB = 5; - public const int Resources = 6; - public const int ResourcesLoader = 7; - - public const int Max = 100; // 这个必须最大 - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockType.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockType.cs.meta deleted file mode 100644 index 0a197dde..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/CoroutineLockType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d66a751e8de660f4eb57de33db77e33a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs deleted file mode 100644 index eea74440..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Threading; - -namespace ET -{ - [Invoke(TimerCoreInvokeType.CoroutineTimeout)] - public class WaitCoroutineLockTimer: ATimer - { - protected override void Run(WaitCoroutineLock waitCoroutineLock) - { - if (waitCoroutineLock.IsDisposed()) - { - return; - } - waitCoroutineLock.SetException(new Exception("coroutine is timeout!")); - } - } - - public class WaitCoroutineLock - { - public static WaitCoroutineLock Create() - { - WaitCoroutineLock waitCoroutineLock = new WaitCoroutineLock(); - waitCoroutineLock.tcs = ETTask.Create(true); - return waitCoroutineLock; - } - - private ETTask tcs; - - public void SetResult(CoroutineLock coroutineLock) - { - if (this.tcs == null) - { - throw new NullReferenceException("SetResult tcs is null"); - } - var t = this.tcs; - this.tcs = null; - t.SetResult(coroutineLock); - } - - public void SetException(Exception exception) - { - if (this.tcs == null) - { - throw new NullReferenceException("SetException tcs is null"); - } - var t = this.tcs; - this.tcs = null; - t.SetException(exception); - } - - public bool IsDisposed() - { - return this.tcs == null; - } - - public async ETTask Wait() - { - return await this.tcs; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs.meta deleted file mode 100644 index f788f9c8..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 17b1d64d5899f124f9b5df1c2d73e687 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh.meta deleted file mode 100644 index 442f1b1e..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ebde9d58b893f434eaf40d782d2ef41a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh/NavmeshComponent.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh/NavmeshComponent.cs deleted file mode 100644 index 2f9ee4be..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh/NavmeshComponent.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class NavmeshComponent: Singleton, ISingletonAwake - { - public struct RecastFileLoader - { - public string Name { get; set; } - } - - private readonly Dictionary navmeshs = new(); - - public void Awake() - { - } - - public byte[] Get(string name) - { - lock (this) - { - if (this.navmeshs.TryGetValue(name, out byte[] bytes)) - { - return bytes; - } - - byte[] buffer = - EventSystem.Instance.Invoke( - new NavmeshComponent.RecastFileLoader() { Name = name }); - if (buffer.Length == 0) - { - throw new Exception($"no nav data: {name}"); - } - - this.navmeshs[name] = buffer; - return buffer; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh/NavmeshComponent.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh/NavmeshComponent.cs.meta deleted file mode 100644 index 8056eb2c..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Navmesh/NavmeshComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bae9eeb5e7ebfeb4fa7173090cdafaa2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization.meta deleted file mode 100644 index 8975bc1a..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 627f202f7d6eb9e4389a2b719f9edd03 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization/FiberTaskScheduler.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization/FiberTaskScheduler.cs deleted file mode 100644 index fcdaa75b..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization/FiberTaskScheduler.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace ET -{ - public class FiberTaskScheduler: TaskScheduler - { - private readonly ConcurrentQueue queue = new(); - - public void Update() - { - while (true) - { - if (!this.queue.TryDequeue(out Task task)) - { - return; - } - - base.TryExecuteTask(task); - } - } - - protected override IEnumerable GetScheduledTasks() - { - return this.queue; - } - - protected override void QueueTask(Task task) - { - queue.Enqueue(task); - } - - protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) - { - queue.Enqueue(task); - return true; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization/FiberTaskScheduler.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization/FiberTaskScheduler.cs.meta deleted file mode 100644 index 1db92989..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Synchronization/FiberTaskScheduler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 54538c8374bfae744a9a242c227e48ad -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer.meta deleted file mode 100644 index aaea7b27..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3daeaaf059f885443a3575415c6b1ec8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/ATimer.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/ATimer.cs deleted file mode 100644 index 4c536fbe..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/ATimer.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - public abstract class ATimer: AInvokeHandler where T: class - { - public override void Handle(TimerCallback a) - { - this.Run(a.Args as T); - } - - protected abstract void Run(T t); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/ATimer.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/ATimer.cs.meta deleted file mode 100644 index 4f1c32fa..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/ATimer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d537ec4047c7d0c4e872df21040c1823 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/TimerComponent.cs b/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/TimerComponent.cs deleted file mode 100644 index e11ea8ab..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/TimerComponent.cs +++ /dev/null @@ -1,343 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - public enum TimerClass - { - None, - OnceTimer, - OnceWaitTimer, - RepeatedTimer, - } - - public class TimerAction - { - public static TimerAction Create(long id, TimerClass timerClass, long startTime, long time, int type, object obj) - { - TimerAction timerAction = ObjectPool.Instance.Fetch(); - timerAction.Id = id; - timerAction.TimerClass = timerClass; - timerAction.StartTime = startTime; - timerAction.Object = obj; - timerAction.Time = time; - timerAction.Type = type; - return timerAction; - } - - public long Id; - - public TimerClass TimerClass; - - public object Object; - - public long StartTime; - - public long Time; - - public int Type; - - public void Recycle() - { - this.Id = 0; - this.Object = null; - this.StartTime = 0; - this.Time = 0; - this.TimerClass = TimerClass.None; - this.Type = 0; - ObjectPool.Instance.Recycle(this); - } - } - - public struct TimerCallback - { - public object Args; - } - - [EntitySystemOf(typeof(TimerComponent))] - public static partial class TimerComponentSystem - { - [EntitySystem] - private static void Awake(this TimerComponent self) - { - self.Fiber().TimerComponent = self; - } - - [EntitySystem] - private static void Update(this TimerComponent self) - { - if (self.timeId.Count == 0) - { - return; - } - - long timeNow = self.GetNow(); - - if (timeNow < self.minTime) - { - return; - } - - using (var enumerator = self.timeId.GetEnumerator()) - { - while (enumerator.MoveNext()) - { - var kv = enumerator.Current; - long k = kv.Key; - if (k > timeNow) - { - self.minTime = k; - break; - } - - self.timeOutTime.Enqueue(k); - } - } - - while (self.timeOutTime.Count > 0) - { - long time = self.timeOutTime.Dequeue(); - var list = self.timeId[time]; - for (int i = 0; i < list.Count; ++i) - { - long timerId = list[i]; - self.timeOutTimerIds.Enqueue(timerId); - } - self.timeId.Remove(time); - } - - if (self.timeId.Count == 0) - { - self.minTime = long.MaxValue; - } - - while (self.timeOutTimerIds.Count > 0) - { - long timerId = self.timeOutTimerIds.Dequeue(); - - if (!self.timerActions.Remove(timerId, out TimerAction timerAction)) - { - continue; - } - - self.Run(timerAction); - } - } - - private static long GetId(this TimerComponent self) - { - return ++self.idGenerator; - } - - private static long GetNow(this TimerComponent self) - { - return self.Fiber().TimeInfo.ClientFrameTime(); - } - - private static void Run(this TimerComponent self, TimerAction timerAction) - { - switch (timerAction.TimerClass) - { - case TimerClass.OnceTimer: - { - EventSystem.Instance.Invoke(timerAction.Type, new TimerCallback() { Args = timerAction.Object }); - timerAction.Recycle(); - break; - } - case TimerClass.OnceWaitTimer: - { - ETTask tcs = timerAction.Object as ETTask; - tcs.SetResult(); - timerAction.Recycle(); - break; - } - case TimerClass.RepeatedTimer: - { - long timeNow = self.GetNow(); - timerAction.StartTime = timeNow; - self.AddTimer(timerAction); - EventSystem.Instance.Invoke(timerAction.Type, new TimerCallback() { Args = timerAction.Object }); - break; - } - } - } - - private static void AddTimer(this TimerComponent self, TimerAction timer) - { - long tillTime = timer.StartTime + timer.Time; - self.timeId.Add(tillTime, timer.Id); - self.timerActions.Add(timer.Id, timer); - if (tillTime < self.minTime) - { - self.minTime = tillTime; - } - } - - public static bool Remove(this TimerComponent self, ref long id) - { - long i = id; - id = 0; - return self.Remove(i); - } - - private static bool Remove(this TimerComponent self, long id) - { - if (id == 0) - { - return false; - } - - if (!self.timerActions.Remove(id, out TimerAction timerAction)) - { - return false; - } - timerAction.Recycle(); - return true; - } - - public static async ETTask WaitTillAsync(this TimerComponent self, long tillTime, ETCancellationToken cancellationToken = null) - { - long timeNow = self.GetNow(); - if (timeNow >= tillTime) - { - return; - } - - ETTask tcs = ETTask.Create(true); - TimerAction timer = TimerAction.Create(self.GetId(), TimerClass.OnceWaitTimer, timeNow, tillTime - timeNow, 0, tcs); - self.AddTimer(timer); - long timerId = timer.Id; - - void CancelAction() - { - if (self.Remove(timerId)) - { - tcs.SetResult(); - } - } - - try - { - cancellationToken?.Add(CancelAction); - await tcs; - } - finally - { - cancellationToken?.Remove(CancelAction); - } - } - - public static async ETTask WaitFrameAsync(this TimerComponent self, ETCancellationToken cancellationToken = null) - { - await self.WaitAsync(1, cancellationToken); - } - - public static async ETTask WaitAsync(this TimerComponent self, long time, ETCancellationToken cancellationToken = null) - { - if (time == 0) - { - return; - } - - long timeNow = self.GetNow(); - - ETTask tcs = ETTask.Create(true); - TimerAction timer = TimerAction.Create(self.GetId(), TimerClass.OnceWaitTimer, timeNow, time, 0, tcs); - self.AddTimer(timer); - long timerId = timer.Id; - - void CancelAction() - { - if (self.Remove(timerId)) - { - tcs.SetResult(); - } - } - - try - { - cancellationToken?.Add(CancelAction); - await tcs; - } - finally - { - cancellationToken?.Remove(CancelAction); - } - } - - // 用这个优点是可以热更,缺点是回调式的写法,逻辑不连贯。WaitTillAsync不能热更,优点是逻辑连贯。 - // wait时间短并且逻辑需要连贯的建议WaitTillAsync - // wait时间长不需要逻辑连贯的建议用NewOnceTimer - public static long NewOnceTimer(this TimerComponent self, long tillTime, int type, object args) - { - long timeNow = self.GetNow(); - if (tillTime < timeNow) - { - Log.Error($"new once time too small: {tillTime}"); - } - - TimerAction timer = TimerAction.Create(self.GetId(), TimerClass.OnceTimer, timeNow, tillTime - timeNow, type, args); - self.AddTimer(timer); - return timer.Id; - } - - public static long NewFrameTimer(this TimerComponent self, int type, object args) - { -#if DOTNET - return self.NewRepeatedTimerInner(100, type, args); -#else - return self.NewRepeatedTimerInner(0, type, args); -#endif - } - - /// - /// 创建一个RepeatedTimer - /// - private static long NewRepeatedTimerInner(this TimerComponent self, long time, int type, object args) - { -#if DOTNET - if (time < 100) - { - throw new Exception($"repeated timer < 100, timerType: time: {time}"); - } -#endif - - long timeNow = self.GetNow(); - TimerAction timer = TimerAction.Create(self.GetId(), TimerClass.RepeatedTimer, timeNow, time, type, args); - - // 每帧执行的不用加到timerId中,防止遍历 - self.AddTimer(timer); - return timer.Id; - } - - public static long NewRepeatedTimer(this TimerComponent self, long time, int type, object args) - { - if (time < 100) - { - Log.Error($"time too small: {time}"); - return 0; - } - - return self.NewRepeatedTimerInner(time, type, args); - } - } - - [ComponentOf(typeof(Scene))] - public class TimerComponent: Entity, IAwake, IUpdate - { - /// - /// key: time, value: timer id - /// - public readonly MultiMap timeId = new(1000); - - public readonly Queue timeOutTime = new(); - - public readonly Queue timeOutTimerIds = new(); - - public readonly Dictionary timerActions = new(); - - public long idGenerator; - - // 记录最小时间,不用每次都去MultiMap取第一个值 - public long minTime = long.MaxValue; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/TimerComponent.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/TimerComponent.cs.meta deleted file mode 100644 index 3341c533..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/Module/Timer/TimerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2f5224b1db93f7847bb68beec0f232b1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Fiber/TimeInfo.cs b/Assets/GameScripts/DotNet/Core/Fiber/TimeInfo.cs deleted file mode 100644 index 26424b33..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/TimeInfo.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; - -namespace ET -{ - public class TimeInfo - { - private int timeZone; - - public int TimeZone - { - get - { - return this.timeZone; - } - set - { - this.timeZone = value; - dt = dt1970.AddHours(TimeZone); - } - } - - private DateTime dt1970; - private DateTime dt; - - public long ServerMinusClientTime { private get; set; } - - public long FrameTime; - - public TimeInfo() - { - this.dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - this.dt = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); - this.FrameTime = this.ClientNow(); - } - - public void Update() - { - this.FrameTime = this.ClientNow(); - } - - /// - /// 根据时间戳获取时间 - /// - public DateTime ToDateTime(long timeStamp) - { - return dt.AddTicks(timeStamp * 10000); - } - - // 线程安全 - public long ClientNow() - { - return (DateTime.UtcNow.Ticks - this.dt1970.Ticks) / 10000; - } - - public long ServerNow() - { - return ClientNow() + this.ServerMinusClientTime; - } - - public long ClientFrameTime() - { - return this.FrameTime; - } - - public long ServerFrameTime() - { - return this.FrameTime + this.ServerMinusClientTime; - } - - public long Transition(DateTime d) - { - return (d.Ticks - dt.Ticks) / 10000; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Fiber/TimeInfo.cs.meta b/Assets/GameScripts/DotNet/Core/Fiber/TimeInfo.cs.meta deleted file mode 100644 index 4372e4e3..00000000 --- a/Assets/GameScripts/DotNet/Core/Fiber/TimeInfo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c7d04a945232e574f9feb2e685b2c42f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/HashSetComponent.cs b/Assets/GameScripts/DotNet/Core/HashSetComponent.cs deleted file mode 100644 index 3cb50701..00000000 --- a/Assets/GameScripts/DotNet/Core/HashSetComponent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class HashSetComponent: HashSet, IDisposable - { - public HashSetComponent() - { - } - - public static HashSetComponent Create() - { - return ObjectPool.Instance.Fetch(typeof (HashSetComponent)) as HashSetComponent; - } - - public void Dispose() - { - this.Clear(); - ObjectPool.Instance.Recycle(this); - } - - public bool IsFromPool { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/HashSetComponent.cs.meta b/Assets/GameScripts/DotNet/Core/HashSetComponent.cs.meta deleted file mode 100644 index 607b8225..00000000 --- a/Assets/GameScripts/DotNet/Core/HashSetComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c919506426bb2ee4bb9fc54ace00b98a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper.meta b/Assets/GameScripts/DotNet/Core/Helper.meta deleted file mode 100644 index c8cdf2d9..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: af4c2e7b63f02432a9d2658299efa111 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/AssemblyHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/AssemblyHelper.cs deleted file mode 100644 index d035e282..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/AssemblyHelper.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace ET -{ - public static class AssemblyHelper - { - public static Dictionary GetAssemblyTypes(params Assembly[] args) - { - Dictionary types = new Dictionary(); - - foreach (Assembly ass in args) - { - foreach (Type type in ass.GetTypes()) - { - types[type.FullName] = type; - } - } - - return types; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/AssemblyHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/AssemblyHelper.cs.meta deleted file mode 100644 index b8f31910..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/AssemblyHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 63fb0b4a59b5b7a499ae6e2b28f11ebb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/ByteHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/ByteHelper.cs deleted file mode 100644 index af2097e9..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ByteHelper.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System.Text; - -namespace ET -{ - public static class ByteHelper - { - public static string ToHex(this byte b) - { - return b.ToString("X2"); - } - - public static string ToHex(this byte[] bytes) - { - StringBuilder stringBuilder = new StringBuilder(); - foreach (byte b in bytes) - { - stringBuilder.Append(b.ToString("X2")); - } - return stringBuilder.ToString(); - } - - public static string ToHex(this byte[] bytes, string format) - { - StringBuilder stringBuilder = new StringBuilder(); - foreach (byte b in bytes) - { - stringBuilder.Append(b.ToString(format)); - } - return stringBuilder.ToString(); - } - - public static string ToHex(this byte[] bytes, int offset, int count) - { - StringBuilder stringBuilder = new StringBuilder(); - for (int i = offset; i < offset + count; ++i) - { - stringBuilder.Append(bytes[i].ToString("X2")); - } - return stringBuilder.ToString(); - } - - public static string ToStr(this byte[] bytes) - { - return Encoding.Default.GetString(bytes); - } - - public static string ToStr(this byte[] bytes, int index, int count) - { - return Encoding.Default.GetString(bytes, index, count); - } - - public static string Utf8ToStr(this byte[] bytes) - { - return Encoding.UTF8.GetString(bytes); - } - - public static string Utf8ToStr(this byte[] bytes, int index, int count) - { - return Encoding.UTF8.GetString(bytes, index, count); - } - - public static void WriteTo(this byte[] bytes, int offset, uint num) - { - bytes[offset] = (byte)(num & 0xff); - bytes[offset + 1] = (byte)((num & 0xff00) >> 8); - bytes[offset + 2] = (byte)((num & 0xff0000) >> 16); - bytes[offset + 3] = (byte)((num & 0xff000000) >> 24); - } - - public static void WriteTo(this byte[] bytes, int offset, ActorId num) - { - bytes.WriteTo(offset, num.Process); - bytes.WriteTo(offset + 4, num.Fiber); - bytes.WriteTo(offset + 8, num.InstanceId); - } - - public static void WriteTo(this byte[] bytes, int offset, int num) - { - bytes[offset] = (byte)(num & 0xff); - bytes[offset + 1] = (byte)((num & 0xff00) >> 8); - bytes[offset + 2] = (byte)((num & 0xff0000) >> 16); - bytes[offset + 3] = (byte)((num & 0xff000000) >> 24); - } - - public static void WriteTo(this byte[] bytes, int offset, byte num) - { - bytes[offset] = num; - } - - public static void WriteTo(this byte[] bytes, int offset, short num) - { - bytes[offset] = (byte)(num & 0xff); - bytes[offset + 1] = (byte)((num & 0xff00) >> 8); - } - - public static void WriteTo(this byte[] bytes, int offset, ushort num) - { - bytes[offset] = (byte)(num & 0xff); - bytes[offset + 1] = (byte)((num & 0xff00) >> 8); - } - - public static unsafe void WriteTo(this byte[] bytes, int offset, long num) - { - byte* bPoint = (byte*)# - for (int i = 0; i < sizeof(long); ++i) - { - bytes[offset + i] = bPoint[i]; - } - } - - public static long Hash(this byte[] data, int index, int length) - { - const int p = 16777619; - long hash = 2166136261L; - - for (int i = index; i < index + length; i++) - { - hash = (hash ^ data[i]) * p; - } - - hash += hash << 13; - hash ^= hash >> 7; - hash += hash << 3; - hash ^= hash >> 17; - hash += hash << 5; - return hash; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/ByteHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/ByteHelper.cs.meta deleted file mode 100644 index 57ef7b6e..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ByteHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 33f44962744fcd64d98b9bcd0fc41bf9 -timeCreated: 1474942922 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/ETCancelationTokenHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/ETCancelationTokenHelper.cs deleted file mode 100644 index 9b534eaf..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ETCancelationTokenHelper.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace ET -{ - public static class ETCancelationTokenHelper - { - public static async ETTask CancelAfter(this ETCancellationToken self, Fiber fiber, long afterTimeCancel) - { - if (self.IsCancel()) - { - return; - } - - await fiber.TimerComponent.WaitAsync(afterTimeCancel); - - if (self.IsCancel()) - { - return; - } - - self.Cancel(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/ETCancelationTokenHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/ETCancelationTokenHelper.cs.meta deleted file mode 100644 index da22c8e5..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ETCancelationTokenHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 36b3530e4d4b82d49820f4f1a69ef74f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/EnumHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/EnumHelper.cs deleted file mode 100644 index b31b56af..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/EnumHelper.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -namespace ET -{ - public static class EnumHelper - { - public static int EnumIndex(int value) - { - int i = 0; - foreach (object v in Enum.GetValues(typeof (T))) - { - if ((int) v == value) - { - return i; - } - ++i; - } - return -1; - } - - public static T FromString(string str) - { - if (!Enum.IsDefined(typeof(T), str)) - { - return default(T); - } - return (T)Enum.Parse(typeof(T), str); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/EnumHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/EnumHelper.cs.meta deleted file mode 100644 index e6d35e62..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/EnumHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d1f7baecded0cf041bb61181909a1619 -timeCreated: 1474948030 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/FileHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/FileHelper.cs deleted file mode 100644 index 087a414a..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/FileHelper.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - public static class FileHelper - { - public static List GetAllFiles(string dir, string searchPattern = "*") - { - List list = new List(); - GetAllFiles(list, dir, searchPattern); - return list; - } - - public static void GetAllFiles(List files, string dir, string searchPattern = "*") - { - string[] fls = Directory.GetFiles(dir); - foreach (string fl in fls) - { - files.Add(fl); - } - - string[] subDirs = Directory.GetDirectories(dir); - foreach (string subDir in subDirs) - { - GetAllFiles(files, subDir, searchPattern); - } - } - - public static void CleanDirectory(string dir) - { - if (!Directory.Exists(dir)) - { - return; - } - foreach (string subdir in Directory.GetDirectories(dir)) - { - Directory.Delete(subdir, true); - } - - foreach (string subFile in Directory.GetFiles(dir)) - { - File.Delete(subFile); - } - } - - public static void CopyDirectory(string srcDir, string tgtDir) - { - DirectoryInfo source = new DirectoryInfo(srcDir); - DirectoryInfo target = new DirectoryInfo(tgtDir); - - if (target.FullName.StartsWith(source.FullName, StringComparison.CurrentCultureIgnoreCase)) - { - throw new Exception("父目录不能拷贝到子目录!"); - } - - if (!source.Exists) - { - return; - } - - if (!target.Exists) - { - target.Create(); - } - - FileInfo[] files = source.GetFiles(); - - for (int i = 0; i < files.Length; i++) - { - File.Copy(files[i].FullName, Path.Combine(target.FullName, files[i].Name), true); - } - - DirectoryInfo[] dirs = source.GetDirectories(); - - for (int j = 0; j < dirs.Length; j++) - { - CopyDirectory(dirs[j].FullName, Path.Combine(target.FullName, dirs[j].Name)); - } - } - - public static void ReplaceExtensionName(string srcDir, string extensionName, string newExtensionName) - { - if (Directory.Exists(srcDir)) - { - string[] fls = Directory.GetFiles(srcDir); - - foreach (string fl in fls) - { - if (fl.EndsWith(extensionName)) - { - File.Move(fl, fl.Substring(0, fl.IndexOf(extensionName)) + newExtensionName); - File.Delete(fl); - } - } - - string[] subDirs = Directory.GetDirectories(srcDir); - - foreach (string subDir in subDirs) - { - ReplaceExtensionName(subDir, extensionName, newExtensionName); - } - } - } - } -} diff --git a/Assets/GameScripts/DotNet/Core/Helper/FileHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/FileHelper.cs.meta deleted file mode 100644 index 06807d46..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/FileHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 74cc512af7309484fa066b16175c6331 -timeCreated: 1474943113 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/MD5Helper.cs b/Assets/GameScripts/DotNet/Core/Helper/MD5Helper.cs deleted file mode 100644 index 227271d8..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/MD5Helper.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.IO; -using System.Security.Cryptography; - -namespace ET -{ - public static class MD5Helper - { - public static string FileMD5(string filePath) - { - byte[] retVal; - using (FileStream file = new FileStream(filePath, FileMode.Open)) - { - MD5 md5 = MD5.Create(); - retVal = md5.ComputeHash(file); - } - return retVal.ToHex("x2"); - } - } -} diff --git a/Assets/GameScripts/DotNet/Core/Helper/MD5Helper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/MD5Helper.cs.meta deleted file mode 100644 index dd5d68d4..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/MD5Helper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9c37f13dde60869459e624143ae45a3c -timeCreated: 1474942922 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/NetworkHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/NetworkHelper.cs deleted file mode 100644 index 51d91857..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/NetworkHelper.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using System.Runtime.InteropServices; - -namespace ET -{ - public static class NetworkHelper - { - public static string[] GetAddressIPs() - { - List list = new List(); - foreach (NetworkInterface networkInterface in NetworkInterface.GetAllNetworkInterfaces()) - { - if (networkInterface.NetworkInterfaceType != NetworkInterfaceType.Ethernet) - { - continue; - } - foreach (UnicastIPAddressInformation add in networkInterface.GetIPProperties().UnicastAddresses) - { - list.Add(add.Address.ToString()); - } - } - return list.ToArray(); - } - - // 优先获取IPV4的地址 - public static IPAddress GetHostAddress(string hostName) - { - IPAddress[] ipAddresses = Dns.GetHostAddresses(hostName); - IPAddress returnIpAddress = null; - foreach (IPAddress ipAddress in ipAddresses) - { - returnIpAddress = ipAddress; - if (ipAddress.AddressFamily == AddressFamily.InterNetwork) - { - return ipAddress; - } - } - return returnIpAddress; - } - - public static IPEndPoint ToIPEndPoint(string host, int port) - { - return new IPEndPoint(IPAddress.Parse(host), port); - } - - public static IPEndPoint ToIPEndPoint(string address) - { - int index = address.LastIndexOf(':'); - string host = address.Substring(0, index); - string p = address.Substring(index + 1); - int port = int.Parse(p); - return ToIPEndPoint(host, port); - } - - public static void SetSioUdpConnReset(Socket socket) - { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - return; - } - - const uint IOC_IN = 0x80000000; - const uint IOC_VENDOR = 0x18000000; - const int SIO_UDP_CONNRESET = unchecked((int)(IOC_IN | IOC_VENDOR | 12)); - - socket.IOControl(SIO_UDP_CONNRESET, new[] { Convert.ToByte(false) }, null); - } - } -} diff --git a/Assets/GameScripts/DotNet/Core/Helper/NetworkHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/NetworkHelper.cs.meta deleted file mode 100644 index 6126809a..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/NetworkHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: be86584128551415eb1b97047a3ae96e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/ObjectHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/ObjectHelper.cs deleted file mode 100644 index 7b76603e..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ObjectHelper.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ET -{ - public static class ObjectHelper - { - public static void Swap(ref T t1, ref T t2) - { - (t1, t2) = (t2, t1); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/ObjectHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/ObjectHelper.cs.meta deleted file mode 100644 index c9cc7ef2..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ObjectHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 27d07fce480358144b4bf720ff3831ee -timeCreated: 1474942922 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/ProcessHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/ProcessHelper.cs deleted file mode 100644 index 643704d7..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ProcessHelper.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Threading.Tasks; -using Path = System.IO.Path; - -namespace ET -{ - public static class ProcessHelper - { - public static System.Diagnostics.Process Run(string exe, string arguments, string workingDirectory = ".", bool waitExit = false) - { - //Log.Debug($"Process Run exe:{exe} ,arguments:{arguments} ,workingDirectory:{workingDirectory}"); - try - { - bool redirectStandardOutput = true; - bool redirectStandardError = true; - bool useShellExecute = false; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - redirectStandardOutput = false; - redirectStandardError = false; - useShellExecute = true; - } - - if (waitExit) - { - redirectStandardOutput = true; - redirectStandardError = true; - useShellExecute = false; - } - - ProcessStartInfo info = new ProcessStartInfo - { - FileName = exe, - Arguments = arguments, - CreateNoWindow = true, - UseShellExecute = useShellExecute, - WorkingDirectory = workingDirectory, - RedirectStandardOutput = redirectStandardOutput, - RedirectStandardError = redirectStandardError, - }; - - System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); - - if (waitExit) - { - WaitExitAsync(process).Coroutine(); - } - - return process; - } - catch (Exception e) - { - throw new Exception($"dir: {Path.GetFullPath(workingDirectory)}, command: {exe} {arguments}", e); - } - } - - private static async ETTask WaitExitAsync(System.Diagnostics.Process process) - { - await process.WaitForExitAsync(); -#if UNITY - Log.Info($"process exit, exitcode: {process.ExitCode} {process.StandardOutput.ReadToEnd()} {process.StandardError.ReadToEnd()}"); -#endif - } - -#if UNITY - private static async Task WaitForExitAsync(this System.Diagnostics.Process self) - { - if (!self.HasExited) - { - return; - } - - try - { - self.EnableRaisingEvents = true; - } - catch (InvalidOperationException) - { - if (self.HasExited) - { - return; - } - throw; - } - - var tcs = new TaskCompletionSource(); - - void Handler(object s, EventArgs e) => tcs.TrySetResult(true); - - self.Exited += Handler; - - try - { - if (self.HasExited) - { - return; - } - await tcs.Task; - } - finally - { - self.Exited -= Handler; - } - } -#endif - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/ProcessHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/ProcessHelper.cs.meta deleted file mode 100644 index 85e117e1..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ProcessHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8f6f1dd88f9c6457dad5db960404a12b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/RandomGenerator.cs b/Assets/GameScripts/DotNet/Core/Helper/RandomGenerator.cs deleted file mode 100644 index cd80aaaf..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/RandomGenerator.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using Random = System.Random; - -namespace ET -{ - // 支持多线程 - public static class RandomGenerator - { - [StaticField] - [ThreadStatic] - private static Random random; - - private static Random GetRandom() - { - return random ??= new Random(Guid.NewGuid().GetHashCode()); - } - - public static ulong RandUInt64() - { - int r1 = RandInt32(); - int r2 = RandInt32(); - - return ((ulong)r1 << 32) & (ulong)r2; - } - - public static int RandInt32() - { - return GetRandom().Next(); - } - - public static uint RandUInt32() - { - return (uint) GetRandom().Next(); - } - - public static long RandInt64() - { - uint r1 = RandUInt32(); - uint r2 = RandUInt32(); - return (long)(((ulong)r1 << 32) | r2); - } - - /// - /// 获取lower与Upper之间的随机数,包含下限,不包含上限 - /// - /// - /// - /// - public static int RandomNumber(int lower, int upper) - { - int value = GetRandom().Next(lower, upper); - return value; - } - - public static bool RandomBool() - { - return GetRandom().Next(2) == 0; - } - - public static T RandomArray(T[] array) - { - return array[RandomNumber(0, array.Length)]; - } - - public static T RandomArray(List array) - { - return array[RandomNumber(0, array.Count)]; - } - - /// - /// 打乱数组 - /// - /// - /// 要打乱的数组 - public static void BreakRank(List arr) - { - if (arr == null || arr.Count < 2) - { - return; - } - - for (int i = 0; i < arr.Count; i++) - { - int index = GetRandom().Next(0, arr.Count); - (arr[index], arr[i]) = (arr[i], arr[index]); - } - } - - public static float RandFloat01() - { - int a = RandomNumber(0, 1000000); - return a / 1000000f; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/RandomGenerator.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/RandomGenerator.cs.meta deleted file mode 100644 index 03b76a8d..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/RandomGenerator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3fae633c3f0136a49b65fe6e909b4851 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/StringHashHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/StringHashHelper.cs deleted file mode 100644 index d14575eb..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/StringHashHelper.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Text; - -namespace ET -{ - public static class StringHashHelper - { - // bkdr hash - public static long GetLongHashCode(this string str) - { - const uint seed = 1313; // 31 131 1313 13131 131313 etc.. - - ulong hash = 0; - for (int i = 0; i < str.Length; ++i) - { - char c = str[i]; - byte high = (byte)(c >> 8); - byte low = (byte)(c & byte.MaxValue); - hash = hash * seed + high; - hash = hash * seed + low; - } - return (long)hash; - } - - public static int Mode(this string strText, int mode) - { - if (mode <= 0) - { - throw new Exception($"string mode < 0: {strText} {mode}"); - } - return (int)((ulong)strText.GetLongHashCode() % (uint)mode); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/StringHashHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/StringHashHelper.cs.meta deleted file mode 100644 index 162b3e2d..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/StringHashHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 36104fdef2a076547afb95f2edee000c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs deleted file mode 100644 index 64614e58..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; - -namespace ET -{ - public static class StringHelper - { - public static IEnumerable ToBytes(this string str) - { - byte[] byteArray = Encoding.Default.GetBytes(str); - return byteArray; - } - - public static byte[] ToByteArray(this string str) - { - byte[] byteArray = Encoding.Default.GetBytes(str); - return byteArray; - } - - public static byte[] ToUtf8(this string str) - { - byte[] byteArray = Encoding.UTF8.GetBytes(str); - return byteArray; - } - - public static byte[] HexToBytes(this string hexString) - { - if (hexString.Length % 2 != 0) - { - throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number of digits: {0}", hexString)); - } - - var hexAsBytes = new byte[hexString.Length / 2]; - for (int index = 0; index < hexAsBytes.Length; index++) - { - string byteValue = ""; - byteValue += hexString[index * 2]; - byteValue += hexString[index * 2 + 1]; - hexAsBytes[index] = byte.Parse(byteValue, NumberStyles.HexNumber, CultureInfo.InvariantCulture); - } - return hexAsBytes; - } - - public static string Fmt(this string text, params object[] args) - { - return string.Format(text, args); - } - - public static string ListToString(this List list) - { - StringBuilder sb = new StringBuilder(); - foreach (T t in list) - { - sb.Append(t); - sb.Append(","); - } - return sb.ToString(); - } - - public static string ArrayToString(this T[] args) - { - if (args == null) - { - return ""; - } - - string argStr = " ["; - for (int arrIndex = 0; arrIndex < args.Length; arrIndex++) - { - argStr += args[arrIndex]; - if (arrIndex != args.Length - 1) - { - argStr += ", "; - } - } - - argStr += "]"; - return argStr; - } - - public static string ArrayToString(this T[] args, int index, int count) - { - if (args == null) - { - return ""; - } - - string argStr = " ["; - for (int arrIndex = index; arrIndex < count + index; arrIndex++) - { - argStr += args[arrIndex]; - if (arrIndex != args.Length - 1) - { - argStr += ", "; - } - } - - argStr += "]"; - return argStr; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs.meta deleted file mode 100644 index e8ffef27..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d7b4a3306f5899c48966bcc2aea42a61 -timeCreated: 1474947336 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs b/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs deleted file mode 100644 index 7c389101..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.InteropServices; - -namespace ET -{ - public static class WinPeriod - { - // 一般默认的精度不止1毫秒(不同操作系统有所不同),需要调用timeBeginPeriod与timeEndPeriod来设置精度 - [DllImport("winmm")] - private static extern void timeBeginPeriod(int t); - //[DllImport("winmm")] - //static extern void timeEndPeriod(int t); - - public static void Init() - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - timeBeginPeriod(1); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs.meta deleted file mode 100644 index a4e99425..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/WinPeriod.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6ad83b047e765b34ea32c6ca7461406d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Helper/ZipHelper.cs b/Assets/GameScripts/DotNet/Core/Helper/ZipHelper.cs deleted file mode 100644 index 2e670514..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ZipHelper.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.IO; -using ICSharpCode.SharpZipLib.Zip.Compression; - -namespace ET -{ - public static class ZipHelper - { - public static byte[] Compress(byte[] content) - { - //return content; - Deflater compressor = new Deflater(); - compressor.SetLevel(Deflater.BEST_COMPRESSION); - - compressor.SetInput(content); - compressor.Finish(); - - using (MemoryStream bos = new MemoryStream(content.Length)) - { - var buf = new byte[1024]; - while (!compressor.IsFinished) - { - int n = compressor.Deflate(buf); - bos.Write(buf, 0, n); - } - return bos.ToArray(); - } - } - - public static byte[] Decompress(byte[] content) - { - return Decompress(content, 0, content.Length); - } - - public static byte[] Decompress(byte[] content, int offset, int count) - { - //return content; - Inflater decompressor = new Inflater(); - decompressor.SetInput(content, offset, count); - - using (MemoryStream bos = new MemoryStream(content.Length)) - { - var buf = new byte[1024]; - while (!decompressor.IsFinished) - { - int n = decompressor.Inflate(buf); - bos.Write(buf, 0, n); - } - return bos.ToArray(); - } - } - } -} - -/* -using System.IO; -using System.IO.Compression; - -namespace ET -{ - public static class ZipHelper - { - public static byte[] Compress(byte[] content) - { - using (MemoryStream ms = new MemoryStream()) - using (DeflateStream stream = new DeflateStream(ms, CompressionMode.Compress, true)) - { - stream.Write(content, 0, content.Length); - return ms.ToArray(); - } - } - - public static byte[] Decompress(byte[] content) - { - return Decompress(content, 0, content.Length); - } - - public static byte[] Decompress(byte[] content, int offset, int count) - { - using (MemoryStream ms = new MemoryStream()) - using (DeflateStream stream = new DeflateStream(new MemoryStream(content, offset, count), CompressionMode.Decompress, true)) - { - byte[] buffer = new byte[1024]; - while (true) - { - int bytesRead = stream.Read(buffer, 0, 1024); - if (bytesRead == 0) - { - break; - } - ms.Write(buffer, 0, bytesRead); - } - return ms.ToArray(); - } - } - } -} -*/ \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Helper/ZipHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Helper/ZipHelper.cs.meta deleted file mode 100644 index f1761c8f..00000000 --- a/Assets/GameScripts/DotNet/Core/Helper/ZipHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 75d07d90984a5dc4698c98d2fe3809bf -timeCreated: 1474948216 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/ListComponent.cs b/Assets/GameScripts/DotNet/Core/ListComponent.cs deleted file mode 100644 index 2a1f2623..00000000 --- a/Assets/GameScripts/DotNet/Core/ListComponent.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class ListComponent: List, IDisposable - { - public ListComponent() - { - } - - public static ListComponent Create() - { - return ObjectPool.Instance.Fetch(typeof (ListComponent)) as ListComponent; - } - - public void Dispose() - { - this.Clear(); - ObjectPool.Instance.Recycle(this); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/ListComponent.cs.meta b/Assets/GameScripts/DotNet/Core/ListComponent.cs.meta deleted file mode 100644 index 46b2fb87..00000000 --- a/Assets/GameScripts/DotNet/Core/ListComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cb4aba377d4c5614ea4d42ea0d957ef5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Method.meta b/Assets/GameScripts/DotNet/Core/Method.meta deleted file mode 100644 index 7e0740d7..00000000 --- a/Assets/GameScripts/DotNet/Core/Method.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 653a223bbff127d49baf78f578fd1e80 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Method/IStaticMethod.cs b/Assets/GameScripts/DotNet/Core/Method/IStaticMethod.cs deleted file mode 100644 index aec3f468..00000000 --- a/Assets/GameScripts/DotNet/Core/Method/IStaticMethod.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ET -{ - public abstract class IStaticMethod - { - public abstract void Run(); - public abstract void Run(object a); - public abstract void Run(object a, object b); - public abstract void Run(object a, object b, object c); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Method/IStaticMethod.cs.meta b/Assets/GameScripts/DotNet/Core/Method/IStaticMethod.cs.meta deleted file mode 100644 index 7c88abb2..00000000 --- a/Assets/GameScripts/DotNet/Core/Method/IStaticMethod.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f0cc0989ea0c5eb4a874d721f2a0cd17 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Method/StaticMethod.cs b/Assets/GameScripts/DotNet/Core/Method/StaticMethod.cs deleted file mode 100644 index 203e7cf9..00000000 --- a/Assets/GameScripts/DotNet/Core/Method/StaticMethod.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Reflection; - -namespace ET -{ - public class StaticMethod : IStaticMethod - { - private readonly MethodInfo methodInfo; - - private readonly object[] param; - - public StaticMethod(Assembly assembly, string typeName, string methodName) - { - this.methodInfo = assembly.GetType(typeName).GetMethod(methodName); - this.param = new object[this.methodInfo.GetParameters().Length]; - } - - public override void Run() - { - this.methodInfo.Invoke(null, param); - } - - public override void Run(object a) - { - this.param[0] = a; - this.methodInfo.Invoke(null, param); - } - - public override void Run(object a, object b) - { - this.param[0] = a; - this.param[1] = b; - this.methodInfo.Invoke(null, param); - } - - public override void Run(object a, object b, object c) - { - this.param[0] = a; - this.param[1] = b; - this.param[2] = c; - this.methodInfo.Invoke(null, param); - } - } -} - diff --git a/Assets/GameScripts/DotNet/Core/Method/StaticMethod.cs.meta b/Assets/GameScripts/DotNet/Core/Method/StaticMethod.cs.meta deleted file mode 100644 index ea122ab9..00000000 --- a/Assets/GameScripts/DotNet/Core/Method/StaticMethod.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fdd300b0cfa10f74a85807aad908db63 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/MultiDictionary.cs b/Assets/GameScripts/DotNet/Core/MultiDictionary.cs deleted file mode 100644 index 5d977cc4..00000000 --- a/Assets/GameScripts/DotNet/Core/MultiDictionary.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - public class MultiDictionary: Dictionary> - { - public bool TryGetDic(T t, out Dictionary k) - { - return this.TryGetValue(t, out k); - } - - public bool TryGetValue(T t, M m, out N n) - { - n = default; - - if (!this.TryGetValue(t, out Dictionary dic)) - { - return false; - } - - return dic.TryGetValue(m, out n); - } - - public void Add(T t, M m, N n) - { - Dictionary kSet; - this.TryGetValue(t, out kSet); - if (kSet == null) - { - kSet = new Dictionary(); - this[t] = kSet; - } - - kSet.Add(m, n); - } - - public bool Remove(T t, M m) - { - this.TryGetValue(t, out Dictionary dic); - if (dic == null || !dic.Remove(m)) - { - return false; - } - - if (dic.Count == 0) - { - this.Remove(t); - } - - return true; - } - - public bool ContainSubKey(T t, M m) - { - this.TryGetValue(t, out Dictionary dic); - if (dic == null) - { - return false; - } - - return dic.ContainsKey(m); - } - - public bool ContainValue(T t, M m, N n) - { - this.TryGetValue(t, out Dictionary dic); - if (dic == null) - { - return false; - } - - if (!dic.ContainsKey(m)) - { - return false; - } - - return dic.ContainsValue(n); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/MultiDictionary.cs.meta b/Assets/GameScripts/DotNet/Core/MultiDictionary.cs.meta deleted file mode 100644 index f77bca01..00000000 --- a/Assets/GameScripts/DotNet/Core/MultiDictionary.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9c12a0ab646b02a42887ca4fd3b9992e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/MultiMap.cs b/Assets/GameScripts/DotNet/Core/MultiMap.cs deleted file mode 100644 index 04c6add9..00000000 --- a/Assets/GameScripts/DotNet/Core/MultiMap.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class MultiMap: -//#if UNITY -// SortedLinkList> -//#else - SortedDictionary> -//#endif - { - private readonly List Empty = new(); - private readonly int maxPoolCount; - private readonly Queue> pool; - - public MultiMap(int maxPoolCount = 0) - { - this.maxPoolCount = maxPoolCount; - this.pool = new Queue>(maxPoolCount); - } - - private List FetchList() - { - if (this.pool.Count > 0) - { - return this.pool.Dequeue(); - } - return new List(10); - } - - private void Recycle(List list) - { - if (list == null) - { - return; - } - if (this.pool.Count == this.maxPoolCount) - { - return; - } - list.Clear(); - this.pool.Enqueue(list); - } - - public void Add(T t, K k) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - list = this.FetchList(); - this.Add(t, list); - } - list.Add(k); - } - - public bool Remove(T t, K k) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - if (!list.Remove(k)) - { - return false; - } - if (list.Count == 0) - { - this.Remove(t); - } - return true; - } - - public new bool Remove(T t) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - this.Recycle(list); - return base.Remove(t); - } - - /// - /// 不返回内部的list,copy一份出来 - /// - /// - /// - public K[] GetAll(T t) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return Array.Empty(); - } - return list.ToArray(); - } - - /// - /// 返回内部的list - /// - /// - /// - public new List this[T t] - { - get - { - this.TryGetValue(t, out List list); - return list ?? Empty; - } - } - - public K GetOne(T t) - { - List list; - this.TryGetValue(t, out list); - if (list != null && list.Count > 0) - { - return list[0]; - } - return default; - } - - public bool Contains(T t, K k) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - return list.Contains(k); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/MultiMap.cs.meta b/Assets/GameScripts/DotNet/Core/MultiMap.cs.meta deleted file mode 100644 index e9603838..00000000 --- a/Assets/GameScripts/DotNet/Core/MultiMap.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 551a46ca41c86a840a2061737baf5c32 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/MultiMapSet.cs b/Assets/GameScripts/DotNet/Core/MultiMapSet.cs deleted file mode 100644 index 99c06e8a..00000000 --- a/Assets/GameScripts/DotNet/Core/MultiMapSet.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace ET -{ - public class MultiMapSet: SortedDictionary> - { - private readonly HashSet Empty = new HashSet(); - - public void Add(T t, K k) - { - HashSet list; - this.TryGetValue(t, out list); - if (list == null) - { - list = new HashSet(); - this.Add(t, list); - } - list.Add(k); - } - - public bool Remove(T t, K k) - { - HashSet list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - if (!list.Remove(k)) - { - return false; - } - if (list.Count == 0) - { - this.Remove(t); - } - return true; - } - - /// - /// 不返回内部的list,copy一份出来 - /// - /// - /// - public K[] GetAll(T t) - { - HashSet list; - this.TryGetValue(t, out list); - if (list == null) - { - return Array.Empty(); - } - return list.ToArray(); - } - - /// - /// 返回内部的list - /// - /// - /// - public new HashSet this[T t] - { - get - { - this.TryGetValue(t, out var list); - return list ?? Empty; - } - } - - public K GetOne(T t) - { - HashSet list; - this.TryGetValue(t, out list); - if (list != null && list.Count > 0) - { - return list.FirstOrDefault(); - } - return default; - } - - public bool Contains(T t, K k) - { - HashSet list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - return list.Contains(k); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/MultiMapSet.cs.meta b/Assets/GameScripts/DotNet/Core/MultiMapSet.cs.meta deleted file mode 100644 index 9f0d2c74..00000000 --- a/Assets/GameScripts/DotNet/Core/MultiMapSet.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1750c211e8e68d342aade9e95b607640 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network.meta b/Assets/GameScripts/DotNet/Core/Network.meta deleted file mode 100644 index 80423a65..00000000 --- a/Assets/GameScripts/DotNet/Core/Network.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0c06c0635bd8bd84b90c02b96187e575 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/AChannel.cs b/Assets/GameScripts/DotNet/Core/Network/AChannel.cs deleted file mode 100644 index 8efb2800..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/AChannel.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.IO; -using System.Net; - -namespace ET -{ - public enum ChannelType - { - Connect, - Accept, - } - - public struct Packet - { - public const int MinPacketSize = 2; - public const int OpcodeIndex = 16; - public const int KcpOpcodeIndex = 0; - public const int OpcodeLength = 2; - public const int ActorIdIndex = 0; - public const int ActorIdLength = 16; - public const int MessageIndex = 18; - - public ushort Opcode; - public long ActorId; - public MemoryStream MemoryStream; - } - - public abstract class AChannel: IDisposable - { - public long Id; - - public ChannelType ChannelType { get; protected set; } - - public int Error { get; set; } - - - public bool IsDisposed - { - get - { - return this.Id == 0; - } - } - - public abstract void Dispose(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/AChannel.cs.meta b/Assets/GameScripts/DotNet/Core/Network/AChannel.cs.meta deleted file mode 100644 index 3356c192..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/AChannel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 93ca66d00a5a67f42a4e7d53738c125b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/AService.cs b/Assets/GameScripts/DotNet/Core/Network/AService.cs deleted file mode 100644 index f224123d..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/AService.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; - -namespace ET -{ - public abstract class AService: IDisposable - { - public Action AcceptCallback; - public Action ReadCallback; - public Action ErrorCallback; - - public long Id { get; set; } - - public ServiceType ServiceType { get; protected set; } - - public const int MaxCacheBufferSize = 1024; - - private readonly Queue pool = new(); - - public MemoryBuffer Fetch(int size = 0) - { - if (size > MaxCacheBufferSize) - { - return new MemoryBuffer(size); - } - - if (size < MaxCacheBufferSize) - { - size = MaxCacheBufferSize; - } - - if (this.pool.Count == 0) - { - return new MemoryBuffer(size); - } - - return pool.Dequeue(); - } - - public void Recycle(MemoryBuffer memoryBuffer) - { - if (memoryBuffer.Capacity > 1024) - { - return; - } - - if (this.pool.Count > 10) // 这里不需要太大,其实Kcp跟Tcp,这里1就足够了 - { - return; - } - - memoryBuffer.Seek(0, SeekOrigin.Begin); - memoryBuffer.SetLength(0); - - this.pool.Enqueue(memoryBuffer); - } - - public AService() - { - NetServices.Instance.Add(this); - } - - public virtual void Dispose() - { - NetServices.Instance?.Remove(this.Id); - } - - public abstract void Update(); - - public abstract void Remove(long id, int error = 0); - - public abstract bool IsDisposed(); - - public abstract void Create(long id, IPEndPoint address); - - public abstract void Send(long channelId, ActorId actorId, MessageObject message); - - public virtual (uint, uint) GetChannelConn(long channelId) - { - throw new Exception($"default conn throw Exception! {channelId}"); - } - - public virtual void ChangeAddress(long channelId, IPEndPoint ipEndPoint) - { - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/AService.cs.meta b/Assets/GameScripts/DotNet/Core/Network/AService.cs.meta deleted file mode 100644 index 0836aaa9..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/AService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 868f9f49d4ae1e64b8eeb8a81d6fa6e1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/ActorResponse.cs b/Assets/GameScripts/DotNet/Core/Network/ActorResponse.cs deleted file mode 100644 index b9491583..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/ActorResponse.cs +++ /dev/null @@ -1,16 +0,0 @@ -using MemoryPack; - -namespace ET -{ - [Message(ushort.MaxValue)] - [MemoryPackable] - public partial class ActorResponse: MessageObject, IActorResponse - { - [MemoryPackOrder(1)] - public int RpcId { get; set; } - [MemoryPackOrder(2)] - public int Error { get; set; } - [MemoryPackOrder(3)] - public string Message { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/ActorResponse.cs.meta b/Assets/GameScripts/DotNet/Core/Network/ActorResponse.cs.meta deleted file mode 100644 index 8f9211d1..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/ActorResponse.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 82646c1ccd21692429cf45e8d8ba7cd9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/Circularbuffer.cs b/Assets/GameScripts/DotNet/Core/Network/Circularbuffer.cs deleted file mode 100644 index 41005d57..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/Circularbuffer.cs +++ /dev/null @@ -1,306 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - public class CircularBuffer: Stream - { - public int ChunkSize = 8192; - - private readonly Queue bufferQueue = new Queue(); - - private readonly Queue bufferCache = new Queue(); - - public int LastIndex { get; set; } - - public int FirstIndex { get; set; } - - private byte[] lastBuffer; - - public CircularBuffer() - { - this.AddLast(); - } - - public override long Length - { - get - { - int c = 0; - if (this.bufferQueue.Count == 0) - { - c = 0; - } - else - { - c = (this.bufferQueue.Count - 1) * ChunkSize + this.LastIndex - this.FirstIndex; - } - if (c < 0) - { - Log.Error("CircularBuffer count < 0: {0}, {1}, {2}".Fmt(this.bufferQueue.Count, this.LastIndex, this.FirstIndex)); - } - return c; - } - } - - public void AddLast() - { - byte[] buffer; - if (this.bufferCache.Count > 0) - { - buffer = this.bufferCache.Dequeue(); - } - else - { - buffer = new byte[ChunkSize]; - } - this.bufferQueue.Enqueue(buffer); - this.lastBuffer = buffer; - } - - public void RemoveFirst() - { - this.bufferCache.Enqueue(bufferQueue.Dequeue()); - } - - public byte[] First - { - get - { - if (this.bufferQueue.Count == 0) - { - this.AddLast(); - } - return this.bufferQueue.Peek(); - } - } - - public byte[] Last - { - get - { - if (this.bufferQueue.Count == 0) - { - this.AddLast(); - } - return this.lastBuffer; - } - } - - /// - /// 从CircularBuffer读到stream中 - /// - /// - /// - //public async ETTask ReadAsync(Stream stream) - //{ - // long buffLength = this.Length; - // int sendSize = this.ChunkSize - this.FirstIndex; - // if (sendSize > buffLength) - // { - // sendSize = (int)buffLength; - // } - // - // await stream.WriteAsync(this.First, this.FirstIndex, sendSize); - // - // this.FirstIndex += sendSize; - // if (this.FirstIndex == this.ChunkSize) - // { - // this.FirstIndex = 0; - // this.RemoveFirst(); - // } - //} - - // 从CircularBuffer读到stream - public void Read(Stream stream, int count) - { - if (count > this.Length) - { - throw new Exception($"bufferList length < count, {Length} {count}"); - } - - int alreadyCopyCount = 0; - while (alreadyCopyCount < count) - { - int n = count - alreadyCopyCount; - if (ChunkSize - this.FirstIndex > n) - { - stream.Write(this.First, this.FirstIndex, n); - this.FirstIndex += n; - alreadyCopyCount += n; - } - else - { - stream.Write(this.First, this.FirstIndex, ChunkSize - this.FirstIndex); - alreadyCopyCount += ChunkSize - this.FirstIndex; - this.FirstIndex = 0; - this.RemoveFirst(); - } - } - } - - // 从stream写入CircularBuffer - public void Write(Stream stream) - { - int count = (int)(stream.Length - stream.Position); - - int alreadyCopyCount = 0; - while (alreadyCopyCount < count) - { - if (this.LastIndex == ChunkSize) - { - this.AddLast(); - this.LastIndex = 0; - } - - int n = count - alreadyCopyCount; - if (ChunkSize - this.LastIndex > n) - { - stream.Read(this.lastBuffer, this.LastIndex, n); - this.LastIndex += count - alreadyCopyCount; - alreadyCopyCount += n; - } - else - { - stream.Read(this.lastBuffer, this.LastIndex, ChunkSize - this.LastIndex); - alreadyCopyCount += ChunkSize - this.LastIndex; - this.LastIndex = ChunkSize; - } - } - } - - - /// - /// 从stream写入CircularBuffer - /// - /// - /// - //public async ETTask WriteAsync(Stream stream) - //{ - // int size = this.ChunkSize - this.LastIndex; - // - // int n = await stream.ReadAsync(this.Last, this.LastIndex, size); -// - // if (n == 0) - // { - // return 0; - // } -// - // this.LastIndex += n; -// - // if (this.LastIndex == this.ChunkSize) - // { - // this.AddLast(); - // this.LastIndex = 0; - // } -// - // return n; - //} - - // 把CircularBuffer中数据写入buffer - public override int Read(byte[] buffer, int offset, int count) - { - if (buffer.Length < offset + count) - { - throw new Exception($"bufferList length < coutn, buffer length: {buffer.Length} {offset} {count}"); - } - - long length = this.Length; - if (length < count) - { - count = (int)length; - } - - int alreadyCopyCount = 0; - while (alreadyCopyCount < count) - { - int n = count - alreadyCopyCount; - if (ChunkSize - this.FirstIndex > n) - { - Array.Copy(this.First, this.FirstIndex, buffer, alreadyCopyCount + offset, n); - this.FirstIndex += n; - alreadyCopyCount += n; - } - else - { - Array.Copy(this.First, this.FirstIndex, buffer, alreadyCopyCount + offset, ChunkSize - this.FirstIndex); - alreadyCopyCount += ChunkSize - this.FirstIndex; - this.FirstIndex = 0; - this.RemoveFirst(); - } - } - - return count; - } - - // 把buffer写入CircularBuffer中 - public override void Write(byte[] buffer, int offset, int count) - { - int alreadyCopyCount = 0; - while (alreadyCopyCount < count) - { - if (this.LastIndex == ChunkSize) - { - this.AddLast(); - this.LastIndex = 0; - } - - int n = count - alreadyCopyCount; - if (ChunkSize - this.LastIndex > n) - { - Array.Copy(buffer, alreadyCopyCount + offset, this.lastBuffer, this.LastIndex, n); - this.LastIndex += count - alreadyCopyCount; - alreadyCopyCount += n; - } - else - { - Array.Copy(buffer, alreadyCopyCount + offset, this.lastBuffer, this.LastIndex, ChunkSize - this.LastIndex); - alreadyCopyCount += ChunkSize - this.LastIndex; - this.LastIndex = ChunkSize; - } - } - } - - public override void Flush() - { - throw new NotImplementedException(); - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotImplementedException(); - } - - public override void SetLength(long value) - { - throw new NotImplementedException(); - } - - public override bool CanRead - { - get - { - return true; - } - } - - public override bool CanSeek - { - get - { - return false; - } - } - - public override bool CanWrite - { - get - { - return true; - } - } - - public override long Position { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/Circularbuffer.cs.meta b/Assets/GameScripts/DotNet/Core/Network/Circularbuffer.cs.meta deleted file mode 100644 index b6f4c8bd..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/Circularbuffer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 94baaad2aba686c4aa2c1e8e3fec21bc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/ErrorCore.cs b/Assets/GameScripts/DotNet/Core/Network/ErrorCore.cs deleted file mode 100644 index 8259f747..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/ErrorCore.cs +++ /dev/null @@ -1,86 +0,0 @@ -namespace ET -{ - [UniqueId(100000, 500000)] - public static class ErrorCore - { - public const int ERR_MyErrorCode = 110000; - - public const int ERR_KcpConnectTimeout = 100205; - public const int ERR_KcpAcceptTimeout = 100206; - public const int ERR_PeerDisconnect = 100208; - public const int ERR_SocketCantSend = 100209; - public const int ERR_SocketError = 100210; - public const int ERR_KcpWaitSendSizeTooLarge = 100211; - public const int ERR_KcpCreateError = 100212; - public const int ERR_SendMessageNotFoundTChannel = 100213; - public const int ERR_TChannelRecvError = 100214; - public const int ERR_MessageSocketParserError = 100215; - public const int ERR_KcpNotFoundChannel = 100216; - - public const int ERR_WebsocketSendError = 100217; - public const int ERR_WebsocketPeerReset = 100218; - public const int ERR_WebsocketMessageTooBig = 100219; - public const int ERR_WebsocketRecvError = 100220; - - public const int ERR_KcpReadNotSame = 100230; - public const int ERR_KcpSplitError = 100231; - public const int ERR_KcpSplitCountError = 100232; - - public const int ERR_ActorLocationSenderTimeout = 110004; - public const int ERR_PacketParserError = 110005; - public const int ERR_KcpChannelAcceptTimeout = 110206; - public const int ERR_KcpRemoteDisconnect = 110207; - public const int ERR_WebsocketError = 110303; - public const int ERR_WebsocketConnectError = 110304; - public const int ERR_RpcFail = 110307; - public const int ERR_ReloadFail = 110308; - public const int ERR_ConnectGateKeyError = 110309; - public const int ERR_SessionSendOrRecvTimeout = 110311; - public const int ERR_OuterSessionRecvInnerMessage = 110312; - public const int ERR_NotFoundActor = 110313; - public const int ERR_ActorTimeout = 110315; - public const int ERR_UnverifiedSessionSendMessage = 110316; - public const int ERR_ActorLocationSenderTimeout2 = 110317; - public const int ERR_ActorLocationSenderTimeout3 = 110318; - public const int ERR_ActorLocationSenderTimeout4 = 110319; - public const int ERR_ActorLocationSenderTimeout5 = 110320; - - public const int ERR_KcpRouterTimeout = 110401; - public const int ERR_KcpRouterTooManyPackets = 110402; - public const int ERR_KcpRouterSame = 110403; - public const int ERR_KcpRouterConnectFail = 110404; - public const int ERR_KcpRouterRouterSyncCountTooMuchTimes = 110405; - public const int ERR_KcpRouterSyncCountTooMuchTimes = 110406; - - // 110000 以上,避免跟SocketError冲突 - - - //----------------------------------- - - // 小于这个Rpc会抛异常,大于这个异常的error需要自己判断处理,也就是说需要处理的错误应该要大于该值 - public const int ERR_Exception = 200000; - - public const int ERR_Cancel = 200001; - public const int ERR_Timeout = 200002; - - public static bool IsRpcNeedThrowException(int error) - { - if (error == 0) - { - return false; - } - // ws平台返回错误专用的值 - if (error == -1) - { - return false; - } - - if (error > ERR_Exception) - { - return false; - } - - return true; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/ErrorCore.cs.meta b/Assets/GameScripts/DotNet/Core/Network/ErrorCore.cs.meta deleted file mode 100644 index a3974064..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/ErrorCore.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7222eec1269a5cb45bf59dbc34ea3fea -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/Extensions.cs b/Assets/GameScripts/DotNet/Core/Network/Extensions.cs deleted file mode 100644 index 0710ff13..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/Extensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Net; -using System.Net.Sockets; - -namespace ET -{ - public static class Extensions - { - // always pass the same IPEndPointNonAlloc instead of allocating a new - // one each time. - // - // use IPEndPointNonAlloc.temp to get the latest SocketAdddress written - // by ReceiveFrom_Internal! - // - // IMPORTANT: .temp will be overwritten in next call! - // hash or manually copy it if you need to store it, e.g. - // when adding a new connection. - public static int ReceiveFrom_NonAlloc( - this Socket socket, - byte[] buffer, - int offset, - int size, - SocketFlags socketFlags, - EndPoint remoteEndPoint) - { - // call ReceiveFrom with IPEndPointNonAlloc. - // need to wrap this in ReceiveFrom_NonAlloc because it's not - // obvious that IPEndPointNonAlloc.Create does NOT create a new - // IPEndPoint. it saves the result in IPEndPointNonAlloc.temp! -#if UNITY - EndPoint casted = remoteEndPoint; - return socket.ReceiveFrom(buffer, offset, size, socketFlags, ref casted); -#else - return socket.ReceiveFrom(buffer, offset, size, socketFlags, ref remoteEndPoint); -#endif - } - - // same as above, different parameters - public static int ReceiveFrom_NonAlloc(this Socket socket, byte[] buffer, ref EndPoint remoteEndPoint) - { -#if UNITY - EndPoint casted = remoteEndPoint; - return socket.ReceiveFrom(buffer, ref casted); -#else - return socket.ReceiveFrom(buffer, ref remoteEndPoint); -#endif - - } - - // SendTo allocates too: - // https://github.com/mono/mono/blob/f74eed4b09790a0929889ad7fc2cf96c9b6e3757/mcs/class/System/System.Net.Sockets/Socket.cs#L2240 - // -> the allocation is in EndPoint.Serialize() - // NOTE: technically this function isn't necessary. - // could just pass IPEndPointNonAlloc. - // still good for strong typing. - //public static int SendTo_NonAlloc( - // this Socket socket, - // byte[] buffer, - // int offset, - // int size, - // SocketFlags socketFlags, - // IPEndPointNonAlloc remoteEndPoint) - //{ - // EndPoint casted = remoteEndPoint; - // return socket.SendTo(buffer, offset, size, socketFlags, casted); - //} - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/Extensions.cs.meta b/Assets/GameScripts/DotNet/Core/Network/Extensions.cs.meta deleted file mode 100644 index 5afad0ef..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/Extensions.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b60b6ed73c53bbd489c9a3f958c72722 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/IActorLocationMessage.cs b/Assets/GameScripts/DotNet/Core/Network/IActorLocationMessage.cs deleted file mode 100644 index fb788beb..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/IActorLocationMessage.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace ET -{ - public interface IActorLocationMessage: IActorLocationRequest - { - } - - public interface IActorLocationRequest: IActorRequest - { - } - - public interface IActorLocationResponse: IActorResponse - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/IActorLocationMessage.cs.meta b/Assets/GameScripts/DotNet/Core/Network/IActorLocationMessage.cs.meta deleted file mode 100644 index 6bf68894..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/IActorLocationMessage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 572c6f5a92280bb4da6c210e2a1c4fef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/IActorMessage.cs b/Assets/GameScripts/DotNet/Core/Network/IActorMessage.cs deleted file mode 100644 index b2dda84c..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/IActorMessage.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ET -{ - // 不需要返回消息 - public interface IActorMessage: IMessage - { - } - - public interface IActorRequest: IRequest, IActorMessage - { - } - - public interface IActorResponse: IResponse, IActorMessage - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/IActorMessage.cs.meta b/Assets/GameScripts/DotNet/Core/Network/IActorMessage.cs.meta deleted file mode 100644 index 13e37db8..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/IActorMessage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 76f16794a16d10c4e926f472af29d69d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/IPEndPointNonAlloc.cs b/Assets/GameScripts/DotNet/Core/Network/IPEndPointNonAlloc.cs deleted file mode 100644 index 635ab103..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/IPEndPointNonAlloc.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Net; -using System.Net.Sockets; - -namespace ET -{ - public class IPEndPointNonAlloc : IPEndPoint - { -#if UNITY - - // Two steps to remove allocations in ReceiveFrom_Internal: - // - // 1.) remoteEndPoint.Serialize(): - // https://github.com/mono/mono/blob/f74eed4b09790a0929889ad7fc2cf96c9b6e3757/mcs/class/System/System.Net.Sockets/Socket.cs#L1733 - // -> creates an EndPoint for ReceiveFrom_Internal to write into - // -> it's never read from: - // ReceiveFrom_Internal passes it to native: - // https://github.com/mono/mono/blob/f74eed4b09790a0929889ad7fc2cf96c9b6e3757/mcs/class/System/System.Net.Sockets/Socket.cs#L1885 - // native recv populates 'sockaddr* from' with the remote address: - // https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom - // -> can NOT be null. bricks both Unity and Unity Hub otherwise. - // -> it seems as if Serialize() is only called to avoid allocating - // a 'new SocketAddress' in ReceiveFrom. it's up to the EndPoint. - // - // 2.) EndPoint.Create(SocketAddress): - // https://github.com/mono/mono/blob/f74eed4b09790a0929889ad7fc2cf96c9b6e3757/mcs/class/System/System.Net.Sockets/Socket.cs#L1761 - // -> SocketAddress is the remote's address that we want to return - // -> to avoid 'new EndPoint(SocketAddress), it seems up to the user - // to decide how to create a new EndPoint via .Create - // -> SocketAddress is the object that was returned by Serialize() - // - // in other words, all we need is an extra SocketAddress field that we - // can pass to ReceiveFrom_Internal to write the result into. - // => callers can then get the result from the extra field! - // => no allocations - // - // IMPORTANT: remember that IPEndPointNonAlloc is always the same object - // and never changes. only the helper field is changed. - public SocketAddress temp; - - // constructors simply create the field once by calling the base method. - // (our overwritten method would create anything new) - public IPEndPointNonAlloc(long address, int port) : base(address, port) - { - temp = base.Serialize(); - } - public IPEndPointNonAlloc(IPAddress address, int port) : base(address, port) - { - temp = base.Serialize(); - } - - // Serialize simply returns it - public override SocketAddress Serialize() => temp; - - // Create doesn't need to create anything. - // SocketAddress object is already the one we returned in Serialize(). - // ReceiveFrom_Internal simply wrote into it. - public override EndPoint Create(SocketAddress socketAddress) - { - // original IPEndPoint.Create validates: - if (socketAddress.Family != AddressFamily) - throw new ArgumentException($"Unsupported socketAddress.AddressFamily: {socketAddress.Family}. Expected: {AddressFamily}"); - if (socketAddress.Size < 8) - throw new ArgumentException($"Unsupported socketAddress.Size: {socketAddress.Size}. Expected: <8"); - - // double check to guarantee that ReceiveFrom actually did write - // into our 'temp' field. just in case that's ever changed. - if (socketAddress != temp) - { - // well this is fun. - // in the latest mono from the above github links, - // the result of Serialize() is passed as 'ref' so ReceiveFrom - // does in fact write into it. - // - // in Unity 2019 LTS's mono version, it does create a new one - // each time. this is from ILSpy Receive_From: - // - // SocketPal.CheckDualModeReceiveSupport(this); - // ValidateBlockingMode(); - // if (NetEventSource.IsEnabled) - // { - // NetEventSource.Info(this, $"SRC{LocalEndPoint} size:{size} remoteEP:{remoteEP}", "ReceiveFrom"); - // } - // EndPoint remoteEP2 = remoteEP; - // System.Net.Internals.SocketAddress socketAddress = SnapshotAndSerialize(ref remoteEP2); - // System.Net.Internals.SocketAddress socketAddress2 = IPEndPointExtensions.Serialize(remoteEP2); - // int bytesTransferred; - // SocketError socketError = SocketPal.ReceiveFrom(_handle, buffer, offset, size, socketFlags, socketAddress.Buffer, ref socketAddress.InternalSize, out bytesTransferred); - // SocketException ex = null; - // if (socketError != 0) - // { - // ex = new SocketException((int)socketError); - // UpdateStatusAfterSocketError(ex); - // if (NetEventSource.IsEnabled) - // { - // NetEventSource.Error(this, ex, "ReceiveFrom"); - // } - // if (ex.SocketErrorCode != SocketError.MessageSize) - // { - // throw ex; - // } - // } - // if (!socketAddress2.Equals(socketAddress)) - // { - // try - // { - // remoteEP = remoteEP2.Create(socketAddress); - // } - // catch - // { - // } - // if (_rightEndPoint == null) - // { - // _rightEndPoint = remoteEP2; - // } - // } - // if (ex != null) - // { - // throw ex; - // } - // if (NetEventSource.IsEnabled) - // { - // NetEventSource.DumpBuffer(this, buffer, offset, size, "ReceiveFrom"); - // NetEventSource.Exit(this, bytesTransferred, "ReceiveFrom"); - // } - // return bytesTransferred; - // - - // so until they upgrade their mono version, we are stuck with - // some allocations. - // - // for now, let's pass the newly created on to our temp so at - // least we reuse it next time. - - temp = socketAddress; - - // SocketAddress.GetHashCode() depends on SocketAddress.m_changed. - // ReceiveFrom only sets the buffer, it does not seem to set m_changed. - // we need to reset m_changed for two reasons: - // * if m_changed is false, GetHashCode() returns the cahced m_hash - // which is '0'. that would be a problem. - // https://github.com/mono/mono/blob/bdd772531d379b4e78593587d15113c37edd4a64/mcs/class/referencesource/System/net/System/Net/SocketAddress.cs#L262 - // * if we have a cached m_hash, but ReceiveFrom modified the buffer - // then the GetHashCode() should change too. so we need to reset - // either way. - // - // the only way to do that is by _actually_ modifying the buffer: - // https://github.com/mono/mono/blob/bdd772531d379b4e78593587d15113c37edd4a64/mcs/class/referencesource/System/net/System/Net/SocketAddress.cs#L99 - // so let's do that. - // -> unchecked in case it's byte.Max - unchecked - { - temp[0] += 1; - temp[0] -= 1; - } - - // make sure this worked. - // at least throw an Exception to make it obvious if the trick does - // not work anymore, in case ReceiveFrom is ever changed. - if (temp.GetHashCode() == 0) - throw new Exception($"SocketAddress GetHashCode() is 0 after ReceiveFrom. Does the m_changed trick not work anymore?"); - - // in the future, enable this again: - //throw new Exception($"Socket.ReceiveFrom(): passed SocketAddress={socketAddress} but expected {temp}. This should never happen. Did ReceiveFrom() change?"); - } - - // ReceiveFrom sets seed_endpoint to the result of Create(): - // https://github.com/mono/mono/blob/f74eed4b09790a0929889ad7fc2cf96c9b6e3757/mcs/class/System/System.Net.Sockets/Socket.cs#L1764 - // so let's return ourselves at least. - // (seed_endpoint only seems to matter for BeginSend etc.) - return this; - } - - // we need to overwrite GetHashCode() for two reasons. - // https://github.com/mono/mono/blob/bdd772531d379b4e78593587d15113c37edd4a64/mcs/class/referencesource/System/net/System/Net/IPEndPoint.cs#L160 - // * it uses m_Address. but our true SocketAddress is in m_temp. - // m_Address might not be set at all. - // * m_Address.GetHashCode() allocates: - // https://github.com/mono/mono/blob/bdd772531d379b4e78593587d15113c37edd4a64/mcs/class/referencesource/System/net/System/Net/IPAddress.cs#L699 - public override int GetHashCode() => temp.GetHashCode(); - - public int GetThisHashCode() => base.GetHashCode(); - - // helper function to create an ACTUAL new IPEndPoint from this. - // server needs it to store new connections as unique IPEndPoints. - public IPEndPoint DeepCopyIPEndPoint() - { - // we need to create a new IPEndPoint from 'temp' SocketAddress. - // there is no 'new IPEndPoint(SocketAddress) constructor. - // so we need to be a bit creative... - - // allocate a placeholder IPAddress to copy - // our SocketAddress into. - // -> needs to be the same address family. - IPAddress ipAddress; - if (temp.Family == AddressFamily.InterNetworkV6) - ipAddress = IPAddress.IPv6Any; - else if (temp.Family == AddressFamily.InterNetwork) - ipAddress = IPAddress.Any; - else - throw new Exception($"Unexpected SocketAddress family: {temp.Family}"); - - // allocate a placeholder IPEndPoint - // with the needed size form IPAddress. - // (the real class. not NonAlloc) - IPEndPoint placeholder = new IPEndPoint(ipAddress, 0); - - // the real IPEndPoint's .Create function can create a new IPEndPoint - // copy from a SocketAddress. - return (IPEndPoint)placeholder.Create(temp); - } -#else - - public IPEndPointNonAlloc(long address, int port) : base(address, port) - { - } - public IPEndPointNonAlloc(IPAddress address, int port) : base(address, port) - { - } -#endif - - public bool Equals(IPEndPoint ipEndPoint) - { - if (!object.Equals(ipEndPoint.Address, this.Address)) - { - return false; - } - - if (ipEndPoint.Port != this.Port) - { - return false; - } - - return true; - } - } - - public static class EndPointHelper - { - public static IPEndPoint Clone(this EndPoint endPoint) - { -#if UNITY - IPEndPoint ip = ((IPEndPointNonAlloc)endPoint).DeepCopyIPEndPoint(); -#else - IPEndPoint ip = (IPEndPoint)endPoint; - ip = new IPEndPoint(ip.Address, ip.Port); -#endif - return ip; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/IPEndPointNonAlloc.cs.meta b/Assets/GameScripts/DotNet/Core/Network/IPEndPointNonAlloc.cs.meta deleted file mode 100644 index a3081262..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/IPEndPointNonAlloc.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3ebd832de5e3f1041a938a17cb70c51a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/KChannel.cs b/Assets/GameScripts/DotNet/Core/Network/KChannel.cs deleted file mode 100644 index 76a36e50..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/KChannel.cs +++ /dev/null @@ -1,523 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Runtime.InteropServices; - -namespace ET -{ - public class KChannel : AChannel - { - private readonly KService Service; - - private Kcp kcp { get; set; } - - private readonly Queue waitSendMessages = new Queue(); - - public readonly uint CreateTime; - - public uint LocalConn - { - get - { - return (uint)this.Id; - } - private set - { - this.Id = value; - } - } - public uint RemoteConn { get; set; } - - private readonly byte[] sendCache = new byte[2 * 1024]; - - public bool IsConnected { get; set; } - - public string RealAddress { get; set; } - - private MemoryBuffer readMemory; - private int needReadSplitCount; - - private IPEndPoint remoteAddress; - - public IPEndPoint RemoteAddress - { - get - { - return this.remoteAddress; - } - set - { - this.remoteAddress = new IPEndPointNonAlloc(value.Address, value.Port); - } - } - - private void InitKcp() - { - switch (this.Service.ServiceType) - { - case ServiceType.Inner: - this.kcp.SetNoDelay(1, 10, 2, true); - this.kcp.SetWindowSize(1024, 1024); - this.kcp.SetMtu(1400); // 默认1400 - this.kcp.SetMinrto(30); - break; - case ServiceType.Outer: - this.kcp.SetNoDelay(1, 10, 2, true); - this.kcp.SetWindowSize(256, 256); - this.kcp.SetMtu(470); - this.kcp.SetMinrto(30); - break; - } - - } - - // connect - public KChannel(uint localConn, IPEndPoint remoteEndPoint, KService kService) - { - this.LocalConn = localConn; - this.ChannelType = ChannelType.Connect; - - Log.Info($"channel create: {this.LocalConn} {remoteEndPoint} {this.ChannelType}"); - - this.Service = kService; - this.RemoteAddress = remoteEndPoint; - this.CreateTime = kService.TimeNow; - - this.Connect(this.CreateTime); - - } - - // accept - public KChannel(uint localConn, uint remoteConn, IPEndPoint remoteEndPoint, KService kService) - { - this.ChannelType = ChannelType.Accept; - - Log.Info($"channel create: {localConn} {remoteConn} {remoteEndPoint} {this.ChannelType}"); - - this.Service = kService; - this.LocalConn = localConn; - this.RemoteConn = remoteConn; - this.RemoteAddress = remoteEndPoint; - this.kcp = new Kcp(this.RemoteConn, this.Output); - this.InitKcp(); - - this.CreateTime = kService.TimeNow; - } - - - public override void Dispose() - { - if (this.IsDisposed) - { - return; - } - - uint localConn = this.LocalConn; - uint remoteConn = this.RemoteConn; - Log.Info($"channel dispose: {localConn} {remoteConn} {this.Error}"); - - long id = this.Id; - this.Id = 0; - this.Service.Remove(id); - - try - { - if (this.Error != ErrorCore.ERR_PeerDisconnect) - { - this.Service.Disconnect(localConn, remoteConn, this.Error, this.RemoteAddress, 3); - } - } - catch (Exception e) - { - Log.Error(e); - } - - this.kcp = null; - } - - public void HandleConnnect() - { - // 如果连接上了就不用处理了 - if (this.IsConnected) - { - return; - } - - this.kcp = new Kcp(this.RemoteConn, this.Output); - this.InitKcp(); - - Log.Info($"channel connected: {this.LocalConn} {this.RemoteConn} {this.RemoteAddress}"); - this.IsConnected = true; - - while (true) - { - if (this.waitSendMessages.Count <= 0) - { - break; - } - - ActorMessageInfo buffer = this.waitSendMessages.Dequeue(); - this.Send(buffer.ActorId, buffer.MessageObject); - } - } - - private long lastConnectTime = long.MaxValue; - - /// - /// 发送请求连接消息 - /// - private void Connect(uint timeNow) - { - try - { - if (this.IsConnected) - { - return; - } - - // 300毫秒后再次update发送connect请求 - if (timeNow < this.lastConnectTime + 300) - { - this.Service.AddToUpdate(300, this.Id); - return; - } - - // 10秒连接超时 - if (timeNow > this.CreateTime + KService.ConnectTimeoutTime) - { - Log.Error($"kChannel connect timeout: {this.Id} {this.RemoteConn} {timeNow} {this.CreateTime} {this.ChannelType} {this.RemoteAddress}"); - this.OnError(ErrorCore.ERR_KcpConnectTimeout); - return; - } - - byte[] buffer = sendCache; - buffer.WriteTo(0, KcpProtocalType.SYN); - buffer.WriteTo(1, this.LocalConn); - buffer.WriteTo(5, this.RemoteConn); - this.Service.Socket.SendTo(buffer, 0, 9, SocketFlags.None, this.RemoteAddress); - // 这里很奇怪 调用socket.LocalEndPoint会动到this.RemoteAddressNonAlloc里面的temp,这里就不仔细研究了 - Log.Info($"kchannel connect {this.LocalConn} {this.RemoteConn} {this.RealAddress}"); - - this.lastConnectTime = timeNow; - - this.Service.AddToUpdate(300, this.Id); - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_SocketCantSend); - } - } - - public void Update(uint timeNow) - { - if (this.IsDisposed) - { - return; - } - - // 如果还没连接上,发送连接请求 - if (!this.IsConnected && this.ChannelType == ChannelType.Connect) - { - this.Connect(timeNow); - return; - } - - if (this.kcp == null) - { - return; - } - - try - { - this.kcp.Update(timeNow); - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_SocketError); - return; - } - - uint nextUpdateTime = this.kcp.Check(timeNow); - this.Service.AddToUpdate(nextUpdateTime, this.Id); - } - - public unsafe void HandleRecv(byte[] date, int offset, int length) - { - if (this.IsDisposed) - { - return; - } - - this.kcp.Input(date.AsSpan(offset, length)); - this.Service.AddToUpdate(0, this.Id); - while (true) - { - if (this.IsDisposed) - { - break; - } - int n = this.kcp.PeekSize(); - if (n < 0) - { - break; - } - if (n == 0) - { - this.OnError((int)SocketError.NetworkReset); - return; - } - - if (this.needReadSplitCount > 0) // 说明消息分片了 - { - byte[] buffer = readMemory.GetBuffer(); - int count = this.kcp.Receive(buffer.AsSpan((int)(this.readMemory.Length - this.needReadSplitCount), n)); - this.needReadSplitCount -= count; - if (n != count) - { - Log.Error($"kchannel read error1: {this.LocalConn} {this.RemoteConn}"); - this.OnError(ErrorCore.ERR_KcpReadNotSame); - return; - } - - if (this.needReadSplitCount < 0) - { - Log.Error($"kchannel read error2: {this.LocalConn} {this.RemoteConn}"); - this.OnError(ErrorCore.ERR_KcpSplitError); - return; - } - - // 没有读完 - if (this.needReadSplitCount != 0) - { - continue; - } - } - else - { - this.readMemory = this.Service.Fetch(n); - this.readMemory.SetLength(n); - this.readMemory.Seek(0, SeekOrigin.Begin); - - byte[] buffer = readMemory.GetBuffer(); - - int count = this.kcp.Receive(buffer.AsSpan(0, n)); - if (n != count) - { - break; - } - - // 判断是不是分片 - if (n == 8) - { - int headInt = BitConverter.ToInt32(this.readMemory.GetBuffer(), 0); - if (headInt == 0) - { - this.needReadSplitCount = BitConverter.ToInt32(readMemory.GetBuffer(), 4); - if (this.needReadSplitCount <= AService.MaxCacheBufferSize) - { - Log.Error($"kchannel read error3: {this.needReadSplitCount} {this.LocalConn} {this.RemoteConn}"); - this.OnError(ErrorCore.ERR_KcpSplitCountError); - return; - } - this.readMemory.SetLength(this.needReadSplitCount); - this.readMemory.Seek(0, SeekOrigin.Begin); - continue; - } - } - } - - - switch (this.Service.ServiceType) - { - case ServiceType.Inner: - this.readMemory.Seek(Packet.ActorIdLength + Packet.OpcodeLength, SeekOrigin.Begin); - break; - case ServiceType.Outer: - this.readMemory.Seek(Packet.OpcodeLength, SeekOrigin.Begin); - break; - } - MemoryBuffer memoryBuffer = this.readMemory; - this.readMemory = null; - this.OnRead(memoryBuffer); - this.Service.Recycle(memoryBuffer); - } - } - - public void Output(byte[] bytes, int count) - { - if (this.IsDisposed) - { - return; - } - try - { - // 没连接上 kcp不往外发消息, 其实本来没连接上不会调用update,这里只是做一层保护 - if (!this.IsConnected) - { - return; - } - - if (count == 0) - { - Log.Error($"output 0"); - return; - } - - bytes.WriteTo(0, KcpProtocalType.MSG); - // 每个消息头部写下该channel的id; - bytes.WriteTo(1, this.LocalConn); - this.Service.Socket.SendTo(bytes, 0, count + 5, SocketFlags.None, this.RemoteAddress); - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_SocketCantSend); - } - } - - private void KcpSend(ActorId actorId, MemoryBuffer memoryStream) - { - if (this.IsDisposed) - { - return; - } - - switch (this.Service.ServiceType) - { - case ServiceType.Inner: - { - memoryStream.GetBuffer().WriteTo(0, actorId); - break; - } - case ServiceType.Outer: - { - // 外网不需要发送actorId,跳过 - memoryStream.Seek(Packet.ActorIdLength, SeekOrigin.Begin); - break; - } - } - int count = (int) (memoryStream.Length - memoryStream.Position); - - // 超出maxPacketSize需要分片 - if (count <= AService.MaxCacheBufferSize) - { - this.kcp.Send(memoryStream.GetBuffer().AsSpan((int)memoryStream.Position, count)); - } - else - { - // 先发分片信息 - this.sendCache.WriteTo(0, 0); - this.sendCache.WriteTo(4, count); - this.kcp.Send(this.sendCache.AsSpan(0, 8)); - - // 分片发送 - int alreadySendCount = 0; - while (alreadySendCount < count) - { - int leftCount = count - alreadySendCount; - - int sendCount = leftCount < AService.MaxCacheBufferSize? leftCount: AService.MaxCacheBufferSize; - - this.kcp.Send(memoryStream.GetBuffer().AsSpan((int)memoryStream.Position + alreadySendCount, sendCount)); - - alreadySendCount += sendCount; - } - } - - this.Service.AddToUpdate(0, this.Id); - } - - public void Send(ActorId actorId, MessageObject message) - { - if (!this.IsConnected) - { - ActorMessageInfo actorMessageInfo = new() { ActorId = actorId, MessageObject = message }; - this.waitSendMessages.Enqueue(actorMessageInfo); - return; - } - - MemoryBuffer stream = this.Service.Fetch(); - MessageSerializeHelper.MessageToStream(stream, message); - message.Dispose(); - - if (this.kcp == null) - { - throw new Exception("kchannel connected but kcp is zero!"); - } - - // 检查等待发送的消息,如果超出最大等待大小,应该断开连接 - int n = this.kcp.WaitSnd; - int maxWaitSize = 0; - switch (this.Service.ServiceType) - { - case ServiceType.Inner: - maxWaitSize = Kcp.InnerMaxWaitSize; - break; - case ServiceType.Outer: - maxWaitSize = Kcp.OuterMaxWaitSize; - break; - default: - throw new ArgumentOutOfRangeException(); - } - - if (n > maxWaitSize) - { - Log.Error($"kcp wait snd too large: {n}: {this.LocalConn} {this.RemoteConn}"); - this.OnError(ErrorCore.ERR_KcpWaitSendSizeTooLarge); - return; - } - - this.KcpSend(actorId, stream); - - this.Service.Recycle(stream); - } - - private void OnRead(MemoryBuffer memoryStream) - { - try - { - long channelId = this.Id; - object message = null; - ActorId actorId = default; - switch (this.Service.ServiceType) - { - case ServiceType.Outer: - { - ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.KcpOpcodeIndex); - Type type = OpcodeType.Instance.GetType(opcode); - message = MessageSerializeHelper.Deserialize(type, memoryStream); - break; - } - case ServiceType.Inner: - { - byte[] buffer = memoryStream.GetBuffer(); - actorId.Process = BitConverter.ToInt32(buffer, Packet.ActorIdIndex); - actorId.Fiber = BitConverter.ToInt32(buffer, Packet.ActorIdIndex + 4); - actorId.InstanceId = BitConverter.ToInt64(buffer, Packet.ActorIdIndex + 8); - ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.OpcodeIndex); - Type type = OpcodeType.Instance.GetType(opcode); - message = MessageSerializeHelper.Deserialize(type, memoryStream); - break; - } - } - this.Service.ReadCallback(channelId, actorId, message); - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_PacketParserError); - } - } - - public void OnError(int error) - { - long channelId = this.Id; - this.Service.Remove(channelId, error); - this.Service.ErrorCallback(channelId, error); - } - } -} diff --git a/Assets/GameScripts/DotNet/Core/Network/KChannel.cs.meta b/Assets/GameScripts/DotNet/Core/Network/KChannel.cs.meta deleted file mode 100644 index a7388286..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/KChannel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 251e6a92fa54e1a46a4d233e72c458ca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/KService.cs b/Assets/GameScripts/DotNet/Core/Network/KService.cs deleted file mode 100644 index e6ce5971..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/KService.cs +++ /dev/null @@ -1,628 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using System.Runtime.InteropServices; - -namespace ET -{ - public static class KcpProtocalType - { - public const byte SYN = 1; - public const byte ACK = 2; - public const byte FIN = 3; - public const byte MSG = 4; - public const byte RouterReconnectSYN = 5; - public const byte RouterReconnectACK = 6; - public const byte RouterSYN = 7; - public const byte RouterACK = 8; - } - - public enum ServiceType - { - Outer, - Inner, - } - - public sealed class KService: AService - { - public const int ConnectTimeoutTime = 20 * 1000; - - private DateTime dt1970; - // KService创建的时间 - private readonly long startTime; - - // 当前时间 - KService创建的时间, 线程安全 - public uint TimeNow - { - get - { - return (uint)((DateTime.UtcNow.Ticks - this.startTime) / 10000); - } - } - - public Socket Socket; - - public KService(IPEndPoint ipEndPoint, ServiceType serviceType) - { - this.ServiceType = serviceType; - this.startTime = DateTime.UtcNow.Ticks; - this.Socket = new Socket(ipEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); - if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - this.Socket.SendBufferSize = Kcp.OneM * 64; - this.Socket.ReceiveBufferSize = Kcp.OneM * 64; - } - - try - { - this.Socket.Bind(ipEndPoint); - } - catch (Exception e) - { - throw new Exception($"bind error: {ipEndPoint}", e); - } - - NetworkHelper.SetSioUdpConnReset(this.Socket); - } - - public KService(AddressFamily addressFamily, ServiceType serviceType) - { - this.ServiceType = serviceType; - this.startTime = DateTime.UtcNow.Ticks; - this.Socket = new Socket(addressFamily, SocketType.Dgram, ProtocolType.Udp); - - NetworkHelper.SetSioUdpConnReset(this.Socket); - } - - // 保存所有的channel - private readonly Dictionary localConnChannels = new Dictionary(); - private readonly Dictionary waitAcceptChannels = new Dictionary(); - - private readonly byte[] cache = new byte[2048]; - - private EndPoint ipEndPoint = new IPEndPointNonAlloc(IPAddress.Any, 0); - - - - - private readonly List cacheIds = new List(); - -#if !UNITY - // 下帧要更新的channel - private readonly HashSet updateIds = new HashSet(); - // 下次时间更新的channel - private readonly MultiMap timeId = new(); - private readonly List timeOutTime = new List(); - // 记录最小时间,不用每次都去MultiMap取第一个值 - private long minTime; -#endif - - public override bool IsDisposed() - { - return this.Socket == null; - } - - public override void Dispose() - { - if (this.IsDisposed()) - { - return; - } - - base.Dispose(); - - foreach (long channelId in this.localConnChannels.Keys.ToArray()) - { - this.Remove(channelId); - } - - this.Socket.Close(); - this.Socket = null; - } - - public override (uint, uint) GetChannelConn(long channelId) - { - KChannel kChannel = this.Get(channelId); - if (kChannel == null) - { - throw new Exception($"GetChannelConn conn not found KChannel! {channelId}"); - } - return (kChannel.LocalConn, kChannel.RemoteConn); - } - - public override void ChangeAddress(long channelId, IPEndPoint newIPEndPoint) - { - KChannel kChannel = this.Get(channelId); - if (kChannel == null) - { - return; - } - kChannel.RemoteAddress = newIPEndPoint; - } - - private void Recv() - { - if (this.Socket == null) - { - return; - } - - while (this.Socket != null && this.Socket.Available > 0) - { - int messageLength = this.Socket.ReceiveFrom_NonAlloc(this.cache, ref this.ipEndPoint); - - // 长度小于1,不是正常的消息 - if (messageLength < 1) - { - continue; - } - - // accept - byte flag = this.cache[0]; - - // conn从100开始,如果为1,2,3则是特殊包 - uint remoteConn = 0; - uint localConn = 0; - - try - { - KChannel kChannel = null; - switch (flag) - { - case KcpProtocalType.RouterReconnectSYN: - { - // 长度!=5,不是RouterReconnectSYN消息 - if (messageLength != 13) - { - break; - } - - string realAddress = null; - remoteConn = BitConverter.ToUInt32(this.cache, 1); - localConn = BitConverter.ToUInt32(this.cache, 5); - uint connectId = BitConverter.ToUInt32(this.cache, 9); - - this.localConnChannels.TryGetValue(localConn, out kChannel); - if (kChannel == null) - { - Log.Warning($"kchannel reconnect not found channel: {localConn} {remoteConn} {realAddress}"); - break; - } - - // 这里必须校验localConn,客户端重连,localConn一定是一样的 - if (localConn != kChannel.LocalConn) - { - Log.Warning($"kchannel reconnect localconn error: {localConn} {remoteConn} {realAddress} {kChannel.LocalConn}"); - break; - } - - if (remoteConn != kChannel.RemoteConn) - { - Log.Warning($"kchannel reconnect remoteconn error: {localConn} {remoteConn} {realAddress} {kChannel.RemoteConn}"); - break; - } - - // 重连的时候router地址变化, 这个不能放到msg中,必须经过严格的验证才能切换 - if (!this.ipEndPoint.Equals(kChannel.RemoteAddress)) - { - kChannel.RemoteAddress = this.ipEndPoint.Clone(); - } - - try - { - byte[] buffer = this.cache; - buffer.WriteTo(0, KcpProtocalType.RouterReconnectACK); - buffer.WriteTo(1, kChannel.LocalConn); - buffer.WriteTo(5, kChannel.RemoteConn); - buffer.WriteTo(9, connectId); - this.Socket.SendTo(buffer, 0, 13, SocketFlags.None, this.ipEndPoint); - } - catch (Exception e) - { - Log.Error(e); - kChannel.OnError(ErrorCore.ERR_SocketCantSend); - } - - break; - } - case KcpProtocalType.SYN: // accept - { - // 长度!=5,不是SYN消息 - if (messageLength < 9) - { - break; - } - - string realAddress = null; - if (messageLength > 9) - { - realAddress = this.cache.ToStr(9, messageLength - 9); - } - - remoteConn = BitConverter.ToUInt32(this.cache, 1); - localConn = BitConverter.ToUInt32(this.cache, 5); - - this.waitAcceptChannels.TryGetValue(remoteConn, out kChannel); - if (kChannel == null) - { - // accept的localConn不能与connect的localConn冲突,所以设置为一个大的数 - // localConn被人猜出来问题不大,因为remoteConn是随机的,第三方并不知道 - localConn = NetServices.Instance.CreateAcceptChannelId(); - // 已存在同样的localConn,则不处理,等待下次sync - if (this.localConnChannels.ContainsKey(localConn)) - { - break; - } - - kChannel = new KChannel(localConn, remoteConn, this.ipEndPoint.Clone(), this); - this.waitAcceptChannels.Add(kChannel.RemoteConn, kChannel); // 连接上了或者超时后会删除 - this.localConnChannels.Add(kChannel.LocalConn, kChannel); - - kChannel.RealAddress = realAddress; - - IPEndPoint realEndPoint = kChannel.RealAddress == null? kChannel.RemoteAddress : NetworkHelper.ToIPEndPoint(kChannel.RealAddress); - this.AcceptCallback(kChannel.Id, realEndPoint); - } - if (kChannel.RemoteConn != remoteConn) - { - break; - } - - // 地址跟上次的不一致则跳过 - if (kChannel.RealAddress != realAddress) - { - Log.Error($"kchannel syn address diff: {kChannel.Id} {kChannel.RealAddress} {realAddress}"); - break; - } - - try - { - byte[] buffer = this.cache; - buffer.WriteTo(0, KcpProtocalType.ACK); - buffer.WriteTo(1, kChannel.LocalConn); - buffer.WriteTo(5, kChannel.RemoteConn); - Log.Info($"kservice syn: {kChannel.Id} {remoteConn} {localConn}"); - - this.Socket.SendTo(buffer, 0, 9, SocketFlags.None, kChannel.RemoteAddress); - } - catch (Exception e) - { - Log.Error(e); - kChannel.OnError(ErrorCore.ERR_SocketCantSend); - } - - break; - } - case KcpProtocalType.ACK: // connect返回 - // 长度!=9,不是connect消息 - if (messageLength != 9) - { - break; - } - - remoteConn = BitConverter.ToUInt32(this.cache, 1); - localConn = BitConverter.ToUInt32(this.cache, 5); - kChannel = this.Get(localConn); - if (kChannel != null) - { - Log.Info($"kservice ack: {localConn} {remoteConn}"); - kChannel.RemoteConn = remoteConn; - kChannel.HandleConnnect(); - } - - break; - case KcpProtocalType.FIN: // 断开 - // 长度!=13,不是DisConnect消息 - if (messageLength != 13) - { - break; - } - - remoteConn = BitConverter.ToUInt32(this.cache, 1); - localConn = BitConverter.ToUInt32(this.cache, 5); - int error = BitConverter.ToInt32(this.cache, 9); - - // 处理chanel - kChannel = this.Get(localConn); - if (kChannel == null) - { - break; - } - - // 校验remoteConn,防止第三方攻击 - if (kChannel.RemoteConn != remoteConn) - { - break; - } - - Log.Info($"kservice recv fin: {localConn} {remoteConn} {error}"); - kChannel.OnError(ErrorCore.ERR_PeerDisconnect); - - break; - case KcpProtocalType.MSG: // 断开 - // 长度<9,不是Msg消息 - if (messageLength < 9) - { - break; - } - // 处理chanel - remoteConn = BitConverter.ToUInt32(this.cache, 1); - localConn = BitConverter.ToUInt32(this.cache, 5); - - kChannel = this.Get(localConn); - if (kChannel == null) - { - // 通知对方断开 - this.Disconnect(localConn, remoteConn, ErrorCore.ERR_KcpNotFoundChannel, this.ipEndPoint, 1); - break; - } - - // 校验remoteConn,防止第三方攻击 - if (kChannel.RemoteConn != remoteConn) - { - break; - } - - // 对方发来msg,说明kchannel连接完成 - if (!kChannel.IsConnected) - { - kChannel.IsConnected = true; - this.waitAcceptChannels.Remove(kChannel.RemoteConn); - } - - kChannel.HandleRecv(this.cache, 5, messageLength - 5); - break; - } - } - catch (Exception e) - { - Log.Error($"kservice error: {flag} {remoteConn} {localConn}\n{e}"); - } - } - } - - public KChannel Get(long id) - { - KChannel channel; - this.localConnChannels.TryGetValue(id, out channel); - return channel; - } - - public override void Create(long id, IPEndPoint address) - { - if (this.localConnChannels.TryGetValue(id, out KChannel kChannel)) - { - return; - } - - try - { - // 低32bit是localConn - uint localConn = (uint)id; - kChannel = new KChannel(localConn, address, this); - this.localConnChannels.Add(kChannel.LocalConn, kChannel); - } - catch (Exception e) - { - Log.Error($"kservice get error: {id}\n{e}"); - } - } - - public override void Remove(long id, int error = 0) - { - if (!this.localConnChannels.TryGetValue(id, out KChannel kChannel)) - { - return; - } - - kChannel.Error = error; - - Log.Info($"kservice remove channel: {id} {kChannel.LocalConn} {kChannel.RemoteConn} {error}"); - this.localConnChannels.Remove(kChannel.LocalConn); - if (this.waitAcceptChannels.TryGetValue(kChannel.RemoteConn, out KChannel waitChannel)) - { - if (waitChannel.LocalConn == kChannel.LocalConn) - { - this.waitAcceptChannels.Remove(kChannel.RemoteConn); - } - } - - kChannel.Dispose(); - } - - public void Disconnect(uint localConn, uint remoteConn, int error, EndPoint address, int times) - { - try - { - if (this.Socket == null) - { - return; - } - - byte[] buffer = this.cache; - buffer.WriteTo(0, KcpProtocalType.FIN); - buffer.WriteTo(1, localConn); - buffer.WriteTo(5, remoteConn); - buffer.WriteTo(9, (uint) error); - for (int i = 0; i < times; ++i) - { - this.Socket.SendTo(buffer, 0, 13, SocketFlags.None, address); - } - } - catch (Exception e) - { - Log.Error($"Disconnect error {localConn} {remoteConn} {error} {address} {e}"); - } - - Log.Info($"channel send fin: {localConn} {remoteConn} {address} {error}"); - } - - public override void Send(long channelId, ActorId actorId, MessageObject message) - { - KChannel channel = this.Get(channelId); - if (channel == null) - { - return; - } - - channel.Send(actorId, message); - } - - public override void Update() - { - uint timeNow = this.TimeNow; - - this.TimerOut(timeNow); - - this.CheckWaitAcceptChannel(timeNow); - - this.Recv(); - - this.UpdateChannel(timeNow); - } - - private void CheckWaitAcceptChannel(uint timeNow) - { - cacheIds.Clear(); - foreach (var kv in this.waitAcceptChannels) - { - KChannel kChannel = kv.Value; - if (kChannel.IsDisposed) - { - continue; - } - - if (kChannel.IsConnected) - { - continue; - } - - if (timeNow < kChannel.CreateTime + ConnectTimeoutTime) - { - continue; - } - - cacheIds.Add(kChannel.Id); - } - - foreach (long id in this.cacheIds) - { - if (!this.waitAcceptChannels.TryGetValue(id, out KChannel kChannel)) - { - continue; - } - kChannel.OnError(ErrorCore.ERR_KcpAcceptTimeout); - } - } - - private void UpdateChannel(uint timeNow) - { -#if UNITY - // Unity中,每帧更新Channel - this.cacheIds.Clear(); - foreach (var kv in this.waitAcceptChannels) - { - this.cacheIds.Add(kv.Key); - } - foreach (var kv in this.localConnChannels) - { - this.cacheIds.Add(kv.Key); - } - - foreach (long id in this.cacheIds) - { - KChannel kChannel = this.Get(id); - if (kChannel == null) - { - continue; - } - - if (kChannel.Id == 0) - { - continue; - } - kChannel.Update(timeNow); - } - -#else - foreach (long id in this.updateIds) - { - KChannel kChannel = this.Get(id); - if (kChannel == null) - { - continue; - } - - if (kChannel.Id == 0) - { - continue; - } - - kChannel.Update(timeNow); - } - this.updateIds.Clear(); -#endif - } - - // 服务端需要看channel的update时间是否已到 - public void AddToUpdate(long time, long id) - { -#if !UNITY - if (time == 0) - { - this.updateIds.Add(id); - return; - } - if (time < this.minTime) - { - this.minTime = time; - } - this.timeId.Add(time, id); -#endif - } - - - // 计算到期需要update的channel - private void TimerOut(uint timeNow) - { -#if !UNITY - if (this.timeId.Count == 0) - { - return; - } - - - if (timeNow < this.minTime) - { - return; - } - - this.timeOutTime.Clear(); - - foreach (KeyValuePair> kv in this.timeId) - { - long k = kv.Key; - if (k > timeNow) - { - minTime = k; - break; - } - - this.timeOutTime.Add(k); - } - - foreach (long k in this.timeOutTime) - { - foreach (long v in this.timeId[k]) - { - this.updateIds.Add(v); - } - this.timeId.Remove(k); - } -#endif - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/KService.cs.meta b/Assets/GameScripts/DotNet/Core/Network/KService.cs.meta deleted file mode 100644 index fd4d27d0..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/KService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40d9951107a787d4ebe60fd2a63461eb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/MessageAttribute.cs b/Assets/GameScripts/DotNet/Core/Network/MessageAttribute.cs deleted file mode 100644 index 49cb4f48..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/MessageAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ET -{ - public class MessageAttribute: BaseAttribute - { - public ushort Opcode - { - get; - } - - public MessageAttribute(ushort opcode = 0) - { - this.Opcode = opcode; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/MessageAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Network/MessageAttribute.cs.meta deleted file mode 100644 index 4c2824f9..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/MessageAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c9e3a99c677b8744786b52472661a314 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/MessagePool.cs b/Assets/GameScripts/DotNet/Core/Network/MessagePool.cs deleted file mode 100644 index ba02baea..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/MessagePool.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class MessagePool - { - private readonly Dictionary> pool = new(); - - public T Fetch() where T: MessageObject - { - return this.Fetch(typeof (T)) as T; - } - - // 只有客户端才用消息池,服务端不使用 - public MessageObject Fetch(Type type) - { - lock (this.pool) - { - MessageObject messageObject; - Queue queue = null; - if (!pool.TryGetValue(type, out queue)) - { - messageObject = Activator.CreateInstance(type) as MessageObject; - } - else if (queue.Count == 0) - { - messageObject = Activator.CreateInstance(type) as MessageObject; - } - else - { - messageObject = queue.Dequeue(); - } - - messageObject.IsFromPool = true; - return messageObject; - } - } - - public void Recycle(MessageObject obj) - { - if (!obj.IsFromPool) - { - return; - } - Type type = obj.GetType(); - - lock (this.pool) - { - Queue queue = null; - if (!pool.TryGetValue(type, out queue)) - { - queue = new Queue(); - pool.Add(type, queue); - } - - // 一种对象最大为100个 - if (queue.Count > 100) - { - return; - } - queue.Enqueue(obj); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/MessagePool.cs.meta b/Assets/GameScripts/DotNet/Core/Network/MessagePool.cs.meta deleted file mode 100644 index 664746e1..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/MessagePool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 21b73f9512ba740f78c657a1e87792db -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/MessageSerializeHelper.cs b/Assets/GameScripts/DotNet/Core/Network/MessageSerializeHelper.cs deleted file mode 100644 index b3652c5a..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/MessageSerializeHelper.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.IO; - -namespace ET -{ - public static class MessageSerializeHelper - { - public static byte[] Serialize(MessageObject message) - { - return MemoryPackHelper.Serialize(message); - } - - public static void Serialize(MessageObject message, MemoryBuffer stream) - { - MemoryPackHelper.Serialize(message, stream); - } - - public static MessageObject Deserialize(Type type, byte[] bytes, int index, int count) - { - object o = ObjectPool.Instance.Fetch(type); - MemoryPackHelper.Deserialize(type, bytes, index, count, ref o); - return o as MessageObject; - } - - public static MessageObject Deserialize(Type type, MemoryBuffer stream) - { - object o = ObjectPool.Instance.Fetch(type); - MemoryPackHelper.Deserialize(type, stream, ref o); - return o as MessageObject; - } - - public static ushort MessageToStream(MemoryBuffer stream, MessageObject message) - { - int headOffset = Packet.ActorIdLength; - - ushort opcode = OpcodeType.Instance.GetOpcode(message.GetType()); - - stream.Seek(headOffset + Packet.OpcodeLength, SeekOrigin.Begin); - stream.SetLength(headOffset + Packet.OpcodeLength); - - stream.GetBuffer().WriteTo(headOffset, opcode); - - MessageSerializeHelper.Serialize(message, stream); - - stream.Seek(0, SeekOrigin.Begin); - return opcode; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/MessageSerializeHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Network/MessageSerializeHelper.cs.meta deleted file mode 100644 index a56b3213..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/MessageSerializeHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 20170a9502b055949aa3d9afeb5f4b77 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/NetServices.cs b/Assets/GameScripts/DotNet/Core/Network/NetServices.cs deleted file mode 100644 index f5680905..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/NetServices.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; - -namespace ET -{ - public enum NetworkProtocol - { - TCP, - KCP, - Websocket, - } - - public class NetServices: Singleton, ISingletonAwake - { - private readonly ConcurrentDictionary services = new(); - - private long idGenerator; - - public void Awake() - { - } - - protected override void Destroy() - { - foreach (var kv in this.services) - { - kv.Value.Dispose(); - } - } - - public void Add(AService aService) - { - aService.Id = Interlocked.Increment(ref this.idGenerator); - this.services[aService.Id] = aService; - } - - public AService Get(long id) - { - AService aService; - this.services.TryGetValue(id, out aService); - return aService; - } - - public void Remove(long id) - { - this.services.Remove(id, out AService _); - } - - // 这个因为是NetClientComponent中使用,不会与Accept冲突 - public uint CreateConnectChannelId() - { - return RandomGenerator.RandUInt32(); - } - - // 防止与内网进程号的ChannelId冲突,所以设置为一个大的随机数 - private uint acceptIdGenerator = uint.MaxValue; - - public uint CreateAcceptChannelId() - { - return --this.acceptIdGenerator; - } - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/NetServices.cs.meta b/Assets/GameScripts/DotNet/Core/Network/NetServices.cs.meta deleted file mode 100644 index f80c3cb3..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/NetServices.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8d287718ca1c8b1449db4794f0a3524b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/OpcodeHelper.cs b/Assets/GameScripts/DotNet/Core/Network/OpcodeHelper.cs deleted file mode 100644 index 9d7bdbb1..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/OpcodeHelper.cs +++ /dev/null @@ -1,16 +0,0 @@ - -namespace ET -{ - public static class OpcodeHelper - { - public static bool IsOuterMessage(ushort opcode) - { - return opcode < OpcodeRangeDefine.OuterMaxOpcode; - } - - public static bool IsInnerMessage(ushort opcode) - { - return opcode >= OpcodeRangeDefine.InnerMinOpcode; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/OpcodeHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Network/OpcodeHelper.cs.meta deleted file mode 100644 index 8863a061..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/OpcodeHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9f70c945e6c5ab84ab4a50cb0448927b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/OpcodeRangeDefine.cs b/Assets/GameScripts/DotNet/Core/Network/OpcodeRangeDefine.cs deleted file mode 100644 index 4853056b..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/OpcodeRangeDefine.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace ET -{ - public static class OpcodeRangeDefine - { - public const ushort OuterMinOpcode = 10001; - public const ushort OuterMaxOpcode = 20000; - - // 20001-30000 内网pb - public const ushort InnerMinOpcode = 20001; - public const ushort InnerMaxOpcode = 40000; - - public const ushort MaxOpcode = 60000; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/OpcodeRangeDefine.cs.meta b/Assets/GameScripts/DotNet/Core/Network/OpcodeRangeDefine.cs.meta deleted file mode 100644 index 8282e1c2..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/OpcodeRangeDefine.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2c103b75789be07478ca3d6280f28081 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/OpcodeType.cs b/Assets/GameScripts/DotNet/Core/Network/OpcodeType.cs deleted file mode 100644 index a7018e11..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/OpcodeType.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class OpcodeType: SingletonLock, ISingletonAwake - { - // 初始化后不变,所以主线程,网络线程都可以读 - private readonly DoubleMap typeOpcode = new(); - - private readonly HashSet outrActorMessage = new HashSet(); - - private readonly Dictionary requestResponse = new Dictionary(); - - public void Awake() - { - HashSet types = EventSystem.Instance.GetTypes(typeof (MessageAttribute)); - foreach (Type type in types) - { - object[] att = type.GetCustomAttributes(typeof (MessageAttribute), false); - if (att.Length == 0) - { - continue; - } - - MessageAttribute messageAttribute = att[0] as MessageAttribute; - if (messageAttribute == null) - { - continue; - } - - ushort opcode = messageAttribute.Opcode; - if (opcode != 0) - { - this.typeOpcode.Add(type, opcode); - } - - // 检查request response - if (typeof (IRequest).IsAssignableFrom(type)) - { - if (typeof (IActorLocationMessage).IsAssignableFrom(type)) - { - this.requestResponse.Add(type, typeof (ActorResponse)); - continue; - } - - var attrs = type.GetCustomAttributes(typeof (ResponseTypeAttribute), false); - if (attrs.Length == 0) - { - Log.Error($"not found responseType: {type}"); - continue; - } - - ResponseTypeAttribute responseTypeAttribute = attrs[0] as ResponseTypeAttribute; - this.requestResponse.Add(type, EventSystem.Instance.GetType($"ET.{responseTypeAttribute.Type}")); - } - } - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - public ushort GetOpcode(Type type) - { - return this.typeOpcode.GetValueByKey(type); - } - - public Type GetType(ushort opcode) - { - Type type = this.typeOpcode.GetKeyByValue(opcode); - if (type == null) - { - throw new Exception($"OpcodeType not found type: {opcode}"); - } - return type; - } - - public Type GetResponseType(Type request) - { - if (!this.requestResponse.TryGetValue(request, out Type response)) - { - throw new Exception($"not found response type, request type: {request.FullName}"); - } - - return response; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/OpcodeType.cs.meta b/Assets/GameScripts/DotNet/Core/Network/OpcodeType.cs.meta deleted file mode 100644 index 966f052f..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/OpcodeType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6fadd49a69c766241ab3733bd675e308 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/PacketParser.cs b/Assets/GameScripts/DotNet/Core/Network/PacketParser.cs deleted file mode 100644 index 387da86b..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/PacketParser.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.IO; - -namespace ET -{ - public enum ParserState - { - PacketSize, - PacketBody - } - - public class PacketParser - { - private readonly CircularBuffer buffer; - private int packetSize; - private ParserState state; - private readonly AService service; - private readonly byte[] cache = new byte[8]; - public const int InnerPacketSizeLength = 4; - public const int OuterPacketSizeLength = 2; - public MemoryBuffer MemoryBuffer; - - public PacketParser(CircularBuffer buffer, AService service) - { - this.buffer = buffer; - this.service = service; - } - - public bool Parse(out MemoryBuffer memoryBuffer) - { - while (true) - { - switch (this.state) - { - case ParserState.PacketSize: - { - if (this.service.ServiceType == ServiceType.Inner) - { - if (this.buffer.Length < InnerPacketSizeLength) - { - memoryBuffer = null; - return false; - } - - this.buffer.Read(this.cache, 0, InnerPacketSizeLength); - - this.packetSize = BitConverter.ToInt32(this.cache, 0); - if (this.packetSize > ushort.MaxValue * 16 || this.packetSize < Packet.MinPacketSize) - { - throw new Exception($"recv packet size error, 可能是外网探测端口: {this.packetSize}"); - } - } - else - { - if (this.buffer.Length < OuterPacketSizeLength) - { - memoryBuffer = null; - return false; - } - - this.buffer.Read(this.cache, 0, OuterPacketSizeLength); - - this.packetSize = BitConverter.ToUInt16(this.cache, 0); - if (this.packetSize < Packet.MinPacketSize) - { - throw new Exception($"recv packet size error, 可能是外网探测端口: {this.packetSize}"); - } - } - - this.state = ParserState.PacketBody; - break; - } - case ParserState.PacketBody: - { - if (this.buffer.Length < this.packetSize) - { - memoryBuffer = null; - return false; - } - - memoryBuffer = this.service.Fetch(this.packetSize); - this.buffer.Read(memoryBuffer, this.packetSize); - //memoryStream.SetLength(this.packetSize - Packet.MessageIndex); - - if (this.service.ServiceType == ServiceType.Inner) - { - memoryBuffer.Seek(Packet.MessageIndex, SeekOrigin.Begin); - } - else - { - memoryBuffer.Seek(Packet.OpcodeLength, SeekOrigin.Begin); - } - - this.state = ParserState.PacketSize; - return true; - } - default: - throw new ArgumentOutOfRangeException(); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/PacketParser.cs.meta b/Assets/GameScripts/DotNet/Core/Network/PacketParser.cs.meta deleted file mode 100644 index d6271962..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/PacketParser.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0eca8ccff942df7438ebc49e74229f6b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/ResponseTypeAttribute.cs b/Assets/GameScripts/DotNet/Core/Network/ResponseTypeAttribute.cs deleted file mode 100644 index 7b42fb79..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/ResponseTypeAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace ET -{ - public class ResponseTypeAttribute: BaseAttribute - { - public string Type { get; } - - public ResponseTypeAttribute(string type) - { - this.Type = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/ResponseTypeAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/Network/ResponseTypeAttribute.cs.meta deleted file mode 100644 index f29b1096..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/ResponseTypeAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 47e49260dfd00574e9c98a40a30bdbe9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/RpcException.cs b/Assets/GameScripts/DotNet/Core/Network/RpcException.cs deleted file mode 100644 index b9ea62fd..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/RpcException.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace ET -{ - /// - /// RPC异常,带ErrorCode - /// - public class RpcException: Exception - { - public int Error - { - get; - } - - public RpcException(int error, string message): base($"Error: {error} Message: {message}") - { - this.Error = error; - } - - public RpcException(int error, string message, Exception e): base($"Error: {error} Message: {message}", e) - { - this.Error = error; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/RpcException.cs.meta b/Assets/GameScripts/DotNet/Core/Network/RpcException.cs.meta deleted file mode 100644 index 3e260e97..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/RpcException.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7c08a3a7ecb608845a83af0456e11dde -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/TChannel.cs b/Assets/GameScripts/DotNet/Core/Network/TChannel.cs deleted file mode 100644 index 0ed91943..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/TChannel.cs +++ /dev/null @@ -1,414 +0,0 @@ -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; - -namespace ET -{ - /// - /// 封装Socket,将回调push到主线程处理 - /// - public sealed class TChannel: AChannel - { - private readonly TService Service; - private Socket socket; - private SocketAsyncEventArgs innArgs = new(); - private SocketAsyncEventArgs outArgs = new(); - - private readonly CircularBuffer recvBuffer = new(); - private readonly CircularBuffer sendBuffer = new(); - - private bool isSending; - - private bool isConnected; - - private readonly PacketParser parser; - - public IPEndPoint RemoteAddress { get; set; } - - private readonly byte[] sendCache = new byte[Packet.OpcodeLength + Packet.ActorIdLength]; - - private void OnComplete(object sender, SocketAsyncEventArgs e) - { - this.Service.Queue.Enqueue(new TArgs() {ChannelId = this.Id, SocketAsyncEventArgs = e}); - } - - public TChannel(long id, IPEndPoint ipEndPoint, TService service) - { - this.ChannelType = ChannelType.Connect; - this.Id = id; - this.Service = service; - this.socket = new Socket(ipEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - this.socket.NoDelay = true; - this.parser = new PacketParser(this.recvBuffer, this.Service); - this.innArgs.Completed += this.OnComplete; - this.outArgs.Completed += this.OnComplete; - - this.RemoteAddress = ipEndPoint; - this.isConnected = false; - this.isSending = false; - - this.Service.Queue.Enqueue(new TArgs(){Op = TcpOp.Connect,ChannelId = this.Id}); - } - - public TChannel(long id, Socket socket, TService service) - { - this.ChannelType = ChannelType.Accept; - this.Id = id; - this.Service = service; - this.socket = socket; - this.socket.NoDelay = true; - this.parser = new PacketParser(this.recvBuffer, this.Service); - this.innArgs.Completed += this.OnComplete; - this.outArgs.Completed += this.OnComplete; - - this.RemoteAddress = (IPEndPoint)socket.RemoteEndPoint; - this.isConnected = true; - this.isSending = false; - - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartSend, ChannelId = this.Id}); - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartRecv, ChannelId = this.Id}); - } - - - - public override void Dispose() - { - if (this.IsDisposed) - { - return; - } - - Log.Info($"channel dispose: {this.Id} {this.RemoteAddress} {this.Error}"); - - long id = this.Id; - this.Id = 0; - this.Service.Remove(id); - this.socket.Close(); - this.innArgs.Dispose(); - this.outArgs.Dispose(); - this.innArgs = null; - this.outArgs = null; - this.socket = null; - } - - public void Send(ActorId actorId, MessageObject message) - { - if (this.IsDisposed) - { - throw new Exception("TChannel已经被Dispose, 不能发送消息"); - } - - MemoryBuffer stream = this.Service.Fetch(); - MessageSerializeHelper.MessageToStream(stream, message); - message.Dispose(); - - switch (this.Service.ServiceType) - { - case ServiceType.Inner: - { - int messageSize = (int) (stream.Length - stream.Position); - if (messageSize > ushort.MaxValue * 16) - { - throw new Exception($"send packet too large: {stream.Length} {stream.Position}"); - } - - this.sendCache.WriteTo(0, messageSize); - this.sendBuffer.Write(this.sendCache, 0, PacketParser.InnerPacketSizeLength); - - // actorId - stream.GetBuffer().WriteTo(0, actorId); - this.sendBuffer.Write(stream.GetBuffer(), (int)stream.Position, (int)(stream.Length - stream.Position)); - break; - } - case ServiceType.Outer: - { - stream.Seek(Packet.ActorIdLength, SeekOrigin.Begin); // 外网不需要actorId - ushort messageSize = (ushort) (stream.Length - stream.Position); - - this.sendCache.WriteTo(0, messageSize); - this.sendBuffer.Write(this.sendCache, 0, PacketParser.OuterPacketSizeLength); - - this.sendBuffer.Write(stream.GetBuffer(), (int)stream.Position, (int)(stream.Length - stream.Position)); - break; - } - } - - if (!this.isSending) - { - //this.StartSend(); - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartSend, ChannelId = this.Id}); - } - - this.Service.Recycle(stream); - } - - public void ConnectAsync() - { - this.outArgs.RemoteEndPoint = this.RemoteAddress; - if (this.socket.ConnectAsync(this.outArgs)) - { - return; - } - OnConnectComplete(this.outArgs); - } - - public void OnConnectComplete(SocketAsyncEventArgs e) - { - if (this.socket == null) - { - return; - } - - if (e.SocketError != SocketError.Success) - { - this.OnError((int)e.SocketError); - return; - } - - e.RemoteEndPoint = null; - this.isConnected = true; - - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartSend, ChannelId = this.Id}); - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartRecv, ChannelId = this.Id}); - } - - public void OnDisconnectComplete(SocketAsyncEventArgs e) - { - this.OnError((int)e.SocketError); - } - - public void StartRecv() - { - while (true) - { - try - { - if (this.socket == null) - { - return; - } - - int size = this.recvBuffer.ChunkSize - this.recvBuffer.LastIndex; - this.innArgs.SetBuffer(this.recvBuffer.Last, this.recvBuffer.LastIndex, size); - } - catch (Exception e) - { - Log.Error($"tchannel error: {this.Id}\n{e}"); - this.OnError(ErrorCore.ERR_TChannelRecvError); - return; - } - - if (this.socket.ReceiveAsync(this.innArgs)) - { - return; - } - this.HandleRecv(this.innArgs); - } - } - - public void OnRecvComplete(SocketAsyncEventArgs o) - { - this.HandleRecv(o); - - if (this.socket == null) - { - return; - } - - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartRecv, ChannelId = this.Id}); - } - - private void HandleRecv(SocketAsyncEventArgs e) - { - if (this.socket == null) - { - return; - } - if (e.SocketError != SocketError.Success) - { - this.OnError((int)e.SocketError); - return; - } - - if (e.BytesTransferred == 0) - { - this.OnError(ErrorCore.ERR_PeerDisconnect); - return; - } - - this.recvBuffer.LastIndex += e.BytesTransferred; - if (this.recvBuffer.LastIndex == this.recvBuffer.ChunkSize) - { - this.recvBuffer.AddLast(); - this.recvBuffer.LastIndex = 0; - } - - // 收到消息回调 - while (true) - { - // 这里循环解析消息执行,有可能,执行消息的过程中断开了session - if (this.socket == null) - { - return; - } - try - { - bool ret = this.parser.Parse(out MemoryBuffer memoryBuffer); - if (!ret) - { - break; - } - - this.OnRead(memoryBuffer); - - this.Service.Recycle(memoryBuffer); - } - catch (Exception ee) - { - Log.Error($"ip: {this.RemoteAddress} {ee}"); - this.OnError(ErrorCore.ERR_SocketError); - return; - } - } - } - - public void StartSend() - { - if(!this.isConnected) - { - return; - } - - if (this.isSending) - { - return; - } - - while (true) - { - try - { - if (this.socket == null) - { - this.isSending = false; - return; - } - - // 没有数据需要发送 - if (this.sendBuffer.Length == 0) - { - this.isSending = false; - return; - } - - this.isSending = true; - - int sendSize = this.sendBuffer.ChunkSize - this.sendBuffer.FirstIndex; - if (sendSize > this.sendBuffer.Length) - { - sendSize = (int)this.sendBuffer.Length; - } - - this.outArgs.SetBuffer(this.sendBuffer.First, this.sendBuffer.FirstIndex, sendSize); - - if (this.socket.SendAsync(this.outArgs)) - { - return; - } - - HandleSend(this.outArgs); - } - catch (Exception e) - { - throw new Exception($"socket set buffer error: {this.sendBuffer.First.Length}, {this.sendBuffer.FirstIndex}", e); - } - } - } - - public void OnSendComplete(SocketAsyncEventArgs o) - { - HandleSend(o); - - this.isSending = false; - - this.Service.Queue.Enqueue(new TArgs() { Op = TcpOp.StartSend, ChannelId = this.Id}); - } - - private void HandleSend(SocketAsyncEventArgs e) - { - if (this.socket == null) - { - return; - } - - if (e.SocketError != SocketError.Success) - { - this.OnError((int)e.SocketError); - return; - } - - if (e.BytesTransferred == 0) - { - this.OnError(ErrorCore.ERR_PeerDisconnect); - return; - } - - this.sendBuffer.FirstIndex += e.BytesTransferred; - if (this.sendBuffer.FirstIndex == this.sendBuffer.ChunkSize) - { - this.sendBuffer.FirstIndex = 0; - this.sendBuffer.RemoveFirst(); - } - } - - private void OnRead(MemoryBuffer memoryStream) - { - try - { - long channelId = this.Id; - object message = null; - ActorId actorId = default; - switch (this.Service.ServiceType) - { - case ServiceType.Outer: - { - ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.KcpOpcodeIndex); - Type type = OpcodeType.Instance.GetType(opcode); - message = MessageSerializeHelper.Deserialize(type, memoryStream); - break; - } - case ServiceType.Inner: - { - byte[] buffer = memoryStream.GetBuffer(); - actorId.Process = BitConverter.ToInt32(buffer, Packet.ActorIdIndex); - actorId.Fiber = BitConverter.ToInt32(buffer, Packet.ActorIdIndex + 4); - actorId.InstanceId = BitConverter.ToInt64(buffer, Packet.ActorIdIndex + 8); - ushort opcode = BitConverter.ToUInt16(buffer, Packet.OpcodeIndex); - Type type = OpcodeType.Instance.GetType(opcode); - message = MessageSerializeHelper.Deserialize(type, memoryStream); - break; - } - } - this.Service.ReadCallback(channelId, actorId, message); - } - catch (Exception e) - { - Log.Error($"{this.RemoteAddress} {memoryStream.Length} {e}"); - // 出现任何消息解析异常都要断开Session,防止客户端伪造消息 - this.OnError(ErrorCore.ERR_PacketParserError); - } - } - - private void OnError(int error) - { - Log.Info($"TChannel OnError: {error} {this.RemoteAddress}"); - - long channelId = this.Id; - - this.Service.Remove(channelId); - - this.Service.ErrorCallback(channelId, error); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/TChannel.cs.meta b/Assets/GameScripts/DotNet/Core/Network/TChannel.cs.meta deleted file mode 100644 index 9c6ca32e..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/TChannel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fb6fe58f92d2ac444981eb135511618d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/TService.cs b/Assets/GameScripts/DotNet/Core/Network/TService.cs deleted file mode 100644 index b05c3445..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/TService.cs +++ /dev/null @@ -1,285 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Sockets; - -namespace ET -{ - public enum TcpOp - { - StartSend, - StartRecv, - Connect, - } - - public struct TArgs - { - public TcpOp Op; - public long ChannelId; - public SocketAsyncEventArgs SocketAsyncEventArgs; - } - - public sealed class TService : AService - { - private readonly Dictionary idChannels = new(); - - private readonly SocketAsyncEventArgs innArgs = new(); - - private Socket acceptor; - - public ConcurrentQueue Queue = new(); - - public TService(AddressFamily addressFamily, ServiceType serviceType) - { - this.ServiceType = serviceType; - } - - public TService(IPEndPoint ipEndPoint, ServiceType serviceType) - { - this.ServiceType = serviceType; - this.acceptor = new Socket(ipEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - // 容易出问题,先注释掉,按需开启 - //this.acceptor.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); - this.innArgs.Completed += this.OnComplete; - try - { - this.acceptor.Bind(ipEndPoint); - } - catch (Exception e) - { - throw new Exception($"bind error: {ipEndPoint}", e); - } - - this.acceptor.Listen(1000); - - this.AcceptAsync(); - } - - private void OnComplete(object sender, SocketAsyncEventArgs e) - { - switch (e.LastOperation) - { - case SocketAsyncOperation.Accept: - this.Queue.Enqueue(new TArgs() {SocketAsyncEventArgs = e}); - break; - default: - throw new Exception($"socket error: {e.LastOperation}"); - } - } - - private void OnAcceptComplete(SocketError socketError, Socket acceptSocket) - { - if (this.acceptor == null) - { - return; - } - - if (socketError != SocketError.Success) - { - Log.Error($"accept error {socketError}"); - return; - } - - try - { - long id = NetServices.Instance.CreateAcceptChannelId(); - TChannel channel = new TChannel(id, acceptSocket, this); - this.idChannels.Add(channel.Id, channel); - long channelId = channel.Id; - - this.AcceptCallback(channelId, channel.RemoteAddress); - } - catch (Exception exception) - { - Log.Error(exception); - } - - // 开始新的accept - this.AcceptAsync(); - } - - private void AcceptAsync() - { - this.innArgs.AcceptSocket = null; - if (this.acceptor.AcceptAsync(this.innArgs)) - { - return; - } - OnAcceptComplete(this.innArgs.SocketError, this.innArgs.AcceptSocket); - } - - private TChannel Create(IPEndPoint ipEndPoint, long id) - { - TChannel channel = new TChannel(id, ipEndPoint, this); - this.idChannels.Add(channel.Id, channel); - return channel; - } - - public override void Create(long id, IPEndPoint address) - { - if (this.idChannels.TryGetValue(id, out TChannel _)) - { - return; - } - this.Create(address, id); - } - - private TChannel Get(long id) - { - TChannel channel = null; - this.idChannels.TryGetValue(id, out channel); - return channel; - } - - public override void Dispose() - { - base.Dispose(); - - this.acceptor?.Close(); - this.acceptor = null; - this.innArgs.Dispose(); - - foreach (long id in this.idChannels.Keys.ToArray()) - { - TChannel channel = this.idChannels[id]; - channel.Dispose(); - } - this.idChannels.Clear(); - } - - public override void Remove(long id, int error = 0) - { - if (this.idChannels.TryGetValue(id, out TChannel channel)) - { - channel.Error = error; - channel.Dispose(); - } - this.idChannels.Remove(id); - } - - public override void Send(long channelId, ActorId actorId, MessageObject message) - { - try - { - TChannel aChannel = this.Get(channelId); - if (aChannel == null) - { - this.ErrorCallback(channelId, ErrorCore.ERR_SendMessageNotFoundTChannel); - return; - } - - aChannel.Send(actorId, message); - } - catch (Exception e) - { - Log.Error(e); - } - } - - public override void Update() - { - while (true) - { - if (!this.Queue.TryDequeue(out var result)) - { - break; - } - - SocketAsyncEventArgs e = result.SocketAsyncEventArgs; - - if (e == null) - { - switch (result.Op) - { - case TcpOp.StartSend: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.StartSend(); - } - break; - } - case TcpOp.StartRecv: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.StartRecv(); - } - break; - } - case TcpOp.Connect: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.ConnectAsync(); - } - break; - } - } - continue; - } - - switch (e.LastOperation) - { - case SocketAsyncOperation.Accept: - { - SocketError socketError = e.SocketError; - Socket acceptSocket = e.AcceptSocket; - this.OnAcceptComplete(socketError, acceptSocket); - break; - } - case SocketAsyncOperation.Connect: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.OnConnectComplete(e); - } - - break; - } - case SocketAsyncOperation.Disconnect: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.OnDisconnectComplete(e); - } - break; - } - case SocketAsyncOperation.Receive: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.OnRecvComplete(e); - } - break; - } - case SocketAsyncOperation.Send: - { - TChannel tChannel = this.Get(result.ChannelId); - if (tChannel != null) - { - tChannel.OnSendComplete(e); - } - break; - } - default: - throw new ArgumentOutOfRangeException($"{e.LastOperation}"); - } - } - } - - public override bool IsDisposed() - { - return this.acceptor == null; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/TService.cs.meta b/Assets/GameScripts/DotNet/Core/Network/TService.cs.meta deleted file mode 100644 index d97c2a79..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/TService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c86d0145bc0f3904795b74ea77da1c45 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/WChannel.cs b/Assets/GameScripts/DotNet/Core/Network/WChannel.cs deleted file mode 100644 index b1e810f7..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/WChannel.cs +++ /dev/null @@ -1,258 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.WebSockets; -using System.Threading; - -namespace ET -{ - public class WChannel: AChannel - { - public HttpListenerWebSocketContext WebSocketContext { get; } - - private readonly WService Service; - - private readonly WebSocket webSocket; - - private readonly Queue queue = new(); - - private bool isSending; - - private bool isConnected; - - public IPEndPoint RemoteAddress { get; set; } - - private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); - - public WChannel(long id, HttpListenerWebSocketContext webSocketContext, WService service) - { - this.Id = id; - this.Service = service; - this.ChannelType = ChannelType.Accept; - this.WebSocketContext = webSocketContext; - this.webSocket = webSocketContext.WebSocket; - - isConnected = true; - - this.Service.ThreadSynchronizationContext.Post(()=> - { - this.StartRecv().Coroutine(); - this.StartSend().Coroutine(); - }); - } - - public WChannel(long id, WebSocket webSocket, string connectUrl, WService service) - { - this.Id = id; - this.Service = service; - this.ChannelType = ChannelType.Connect; - this.webSocket = webSocket; - - isConnected = false; - - this.Service.ThreadSynchronizationContext.Post(()=>this.ConnectAsync(connectUrl).Coroutine()); - } - - public override void Dispose() - { - if (this.IsDisposed) - { - return; - } - - this.cancellationTokenSource.Cancel(); - this.cancellationTokenSource.Dispose(); - this.cancellationTokenSource = null; - - this.webSocket.Dispose(); - } - - public async ETTask ConnectAsync(string url) - { - try - { - await ((ClientWebSocket) this.webSocket).ConnectAsync(new Uri(url), cancellationTokenSource.Token); - isConnected = true; - - this.StartRecv().Coroutine(); - this.StartSend().Coroutine(); - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_WebsocketConnectError); - } - } - - public void Send(MessageObject message) - { - this.queue.Enqueue(message); - - if (this.isConnected) - { - this.StartSend().Coroutine(); - } - } - - private async ETTask StartSend() - { - if (this.IsDisposed) - { - return; - } - - try - { - if (this.isSending) - { - return; - } - - this.isSending = true; - - while (true) - { - if (this.queue.Count == 0) - { - this.isSending = false; - return; - } - - MessageObject message = this.queue.Dequeue(); - - MemoryBuffer stream = this.Service.Fetch(); - - MessageSerializeHelper.MessageToStream(stream, message); - message.Dispose(); - - switch (this.Service.ServiceType) - { - case ServiceType.Inner: - break; - case ServiceType.Outer: - stream.Seek(Packet.ActorIdLength, SeekOrigin.Begin); - break; - } - - try - { - await this.webSocket.SendAsync(stream.GetMemory(), WebSocketMessageType.Binary, true, cancellationTokenSource.Token); - - this.Service.Recycle(stream); - - if (this.IsDisposed) - { - return; - } - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_WebsocketSendError); - return; - } - } - } - catch (Exception e) - { - Log.Error(e); - } - } - - private readonly byte[] cache = new byte[ushort.MaxValue]; - - public async ETTask StartRecv() - { - if (this.IsDisposed) - { - return; - } - - try - { - while (true) - { - ValueWebSocketReceiveResult receiveResult; - int receiveCount = 0; - do - { - receiveResult = await this.webSocket.ReceiveAsync( - new Memory(cache, receiveCount, this.cache.Length - receiveCount), - cancellationTokenSource.Token); - if (this.IsDisposed) - { - return; - } - - receiveCount += receiveResult.Count; - } - while (!receiveResult.EndOfMessage); - - if (receiveResult.MessageType == WebSocketMessageType.Close) - { - this.OnError(ErrorCore.ERR_WebsocketPeerReset); - return; - } - - if (receiveResult.Count > ushort.MaxValue) - { - await this.webSocket.CloseAsync(WebSocketCloseStatus.MessageTooBig, $"message too big: {receiveCount}", - cancellationTokenSource.Token); - this.OnError(ErrorCore.ERR_WebsocketMessageTooBig); - return; - } - - MemoryBuffer memoryBuffer = this.Service.Fetch(receiveCount); - memoryBuffer.SetLength(receiveCount); - memoryBuffer.Seek(2, SeekOrigin.Begin); - Array.Copy(this.cache, 0, memoryBuffer.GetBuffer(), 0, receiveCount); - this.OnRead(memoryBuffer); - this.Service.Recycle(memoryBuffer); - } - } - catch (Exception e) - { - Log.Error(e); - this.OnError(ErrorCore.ERR_WebsocketRecvError); - } - } - - private void OnRead(MemoryBuffer memoryStream) - { - try - { - long channelId = this.Id; - object message = null; - switch (this.Service.ServiceType) - { - case ServiceType.Outer: - { - ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.KcpOpcodeIndex); - Type type = OpcodeType.Instance.GetType(opcode); - message = MessageSerializeHelper.Deserialize(type, memoryStream); - break; - } - } - this.Service.ReadCallback(channelId, new ActorId(), message); - } - catch (Exception e) - { - Log.Error($"{this.RemoteAddress} {memoryStream.Length} {e}"); - // 出现任何消息解析异常都要断开Session,防止客户端伪造消息 - this.OnError(ErrorCore.ERR_PacketParserError); - } - } - - private void OnError(int error) - { - Log.Info($"WChannel error: {error} {this.RemoteAddress}"); - - long channelId = this.Id; - - this.Service.Remove(channelId); - - this.Service.ErrorCallback(channelId, error); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/WChannel.cs.meta b/Assets/GameScripts/DotNet/Core/Network/WChannel.cs.meta deleted file mode 100644 index 1893718e..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/WChannel.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b1521b5d15359624296c9e2f801bee89 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Network/WService.cs b/Assets/GameScripts/DotNet/Core/Network/WService.cs deleted file mode 100644 index e92e7586..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/WService.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.WebSockets; - -namespace ET -{ - public class WService: AService - { - private long idGenerater = 200000000; - - private HttpListener httpListener; - - private readonly Dictionary channels = new Dictionary(); - - public ThreadSynchronizationContext ThreadSynchronizationContext; - - public WService(IEnumerable prefixs) - { - this.ThreadSynchronizationContext = new ThreadSynchronizationContext(); - - this.httpListener = new HttpListener(); - - StartAccept(prefixs).Coroutine(); - } - - public WService() - { - this.ThreadSynchronizationContext = new ThreadSynchronizationContext(); - } - - private long GetId - { - get - { - return ++this.idGenerater; - } - } - - public WChannel Create(string address, long id) - { - ClientWebSocket webSocket = new ClientWebSocket(); - WChannel channel = new WChannel(id, webSocket, address, this); - this.channels[channel.Id] = channel; - return channel; - } - - public override void Remove(long id, int error = 0) - { - WChannel channel; - if (!this.channels.TryGetValue(id, out channel)) - { - return; - } - - channel.Error = error; - - this.channels.Remove(id); - channel.Dispose(); - } - - public override bool IsDisposed() - { - return this.ThreadSynchronizationContext == null; - } - - protected void Get(long id, string address) - { - if (!this.channels.TryGetValue(id, out _)) - { - this.Create(address, id); - } - } - - public override void Dispose() - { - base.Dispose(); - - this.ThreadSynchronizationContext = null; - this.httpListener?.Close(); - this.httpListener = null; - } - - private async ETTask StartAccept(IEnumerable prefixs) - { - try - { - foreach (string prefix in prefixs) - { - this.httpListener.Prefixes.Add(prefix); - } - - httpListener.Start(); - - while (true) - { - try - { - HttpListenerContext httpListenerContext = await this.httpListener.GetContextAsync(); - - HttpListenerWebSocketContext webSocketContext = await httpListenerContext.AcceptWebSocketAsync(null); - - WChannel channel = new WChannel(this.GetId, webSocketContext, this); - - this.channels[channel.Id] = channel; - - this.AcceptCallback(channel.Id, channel.RemoteAddress); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - catch (HttpListenerException e) - { - if (e.ErrorCode == 5) - { - throw new Exception($"CMD管理员中输入: netsh http add urlacl url=http://*:8080/ user=Everyone", e); - } - - Log.Error(e); - } - catch (Exception e) - { - Log.Error(e); - } - } - - public override void Create(long id, IPEndPoint address) - { - throw new NotImplementedException(); - } - - public override void Send(long channelId, ActorId actorId, MessageObject message) - { - this.channels.TryGetValue(channelId, out WChannel channel); - if (channel == null) - { - return; - } - channel.Send(message); - } - - public override void Update() - { - this.ThreadSynchronizationContext.Update(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Network/WService.cs.meta b/Assets/GameScripts/DotNet/Core/Network/WService.cs.meta deleted file mode 100644 index 6d276295..00000000 --- a/Assets/GameScripts/DotNet/Core/Network/WService.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: edded4e0a631e0347bb019ee35ad5975 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Object.meta b/Assets/GameScripts/DotNet/Core/Object.meta deleted file mode 100644 index db755c08..00000000 --- a/Assets/GameScripts/DotNet/Core/Object.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9e2fbcdb11d7c2144a9c1632f489cf9a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Object/DisposeObject.cs b/Assets/GameScripts/DotNet/Core/Object/DisposeObject.cs deleted file mode 100644 index 60132d89..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/DisposeObject.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.ComponentModel; -using MongoDB.Bson.Serialization.Attributes; - -namespace ET -{ - public abstract class DisposeObject: Object, IDisposable, ISupportInitialize - { - public virtual void Dispose() - { - } - - public virtual void BeginInit() - { - } - - public virtual void EndInit() - { - } - } - - public interface IPool - { - bool IsFromPool - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Object/DisposeObject.cs.meta b/Assets/GameScripts/DotNet/Core/Object/DisposeObject.cs.meta deleted file mode 100644 index d479ffbd..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/DisposeObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ca28b9e6da52d7a4488b584e6ce3c685 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Object/MessageObject.cs b/Assets/GameScripts/DotNet/Core/Object/MessageObject.cs deleted file mode 100644 index 4e6a1208..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/MessageObject.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.ComponentModel; -using MongoDB.Bson.Serialization.Attributes; - -namespace ET -{ - public abstract class MessageObject: ProtoObject, IMessage, IDisposable - { - public virtual void Dispose() - { - } - - [BsonIgnore] - public bool IsFromPool { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Object/MessageObject.cs.meta b/Assets/GameScripts/DotNet/Core/Object/MessageObject.cs.meta deleted file mode 100644 index e8e0ccd9..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/MessageObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a2882ec78c6c471e8e74005e51f985f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Object/Object.cs b/Assets/GameScripts/DotNet/Core/Object/Object.cs deleted file mode 100644 index 880c15c4..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/Object.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET -{ - public abstract class Object - { - public override string ToString() - { - return MongoHelper.ToJson(this); - } - - public string ToJson() - { - return MongoHelper.ToJson(this); - } - - public byte[] ToBson() - { - return MongoHelper.Serialize(this); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Object/Object.cs.meta b/Assets/GameScripts/DotNet/Core/Object/Object.cs.meta deleted file mode 100644 index a7d29064..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/Object.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e034b37d85153fb438be07631a8b9816 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Object/ProtoObject.cs b/Assets/GameScripts/DotNet/Core/Object/ProtoObject.cs deleted file mode 100644 index 4150995d..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/ProtoObject.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace ET -{ - public abstract class ProtoObject: Object, ISupportInitialize - { - public object Clone() - { - byte[] bytes = MongoHelper.Serialize(this); - return MongoHelper.Deserialize(this.GetType(), bytes, 0, bytes.Length); - } - - public virtual void BeginInit() - { - } - - - public virtual void EndInit() - { - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Object/ProtoObject.cs.meta b/Assets/GameScripts/DotNet/Core/Object/ProtoObject.cs.meta deleted file mode 100644 index 83ae1e42..00000000 --- a/Assets/GameScripts/DotNet/Core/Object/ProtoObject.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 90d2aa9a80bc74140bc36eef78a1a34e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Serialize.meta b/Assets/GameScripts/DotNet/Core/Serialize.meta deleted file mode 100644 index 504aff69..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c2783ffa55d881e41b31fbadb828be03 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/Serialize/MemoryBuffer.cs b/Assets/GameScripts/DotNet/Core/Serialize/MemoryBuffer.cs deleted file mode 100644 index 859292f7..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize/MemoryBuffer.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Buffers; -using System.IO; - -namespace ET -{ - public class MemoryBuffer: MemoryStream, IBufferWriter - { - private int origin; - - public MemoryBuffer() - { - } - - public MemoryBuffer(int capacity): base(capacity) - { - } - - public MemoryBuffer(byte[] buffer): base(buffer) - { - } - - public MemoryBuffer(byte[] buffer, int index, int length): base(buffer, index, length) - { - this.origin = index; - } - - public ReadOnlyMemory WrittenMemory => this.GetBuffer().AsMemory(this.origin, (int)this.Position); - - public ReadOnlySpan WrittenSpan => this.GetBuffer().AsSpan(this.origin, (int)this.Position); - - public void Advance(int count) - { - long newLength = this.Position + count; - if (newLength > this.Length) - { - this.SetLength(newLength); - } - this.Position = newLength; - } - - public Memory GetMemory(int sizeHint = 0) - { - if (this.Length - this.Position < sizeHint) - { - this.SetLength(this.Position + sizeHint); - } - var memory = this.GetBuffer().AsMemory((int)this.Position + this.origin, (int)(this.Length - this.Position)); - return memory; - } - - public Span GetSpan(int sizeHint = 0) - { - if (this.Length - this.Position < sizeHint) - { - this.SetLength(this.Position + sizeHint); - } - var span = this.GetBuffer().AsSpan((int)this.Position + this.origin, (int)(this.Length - this.Position)); - return span; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Serialize/MemoryBuffer.cs.meta b/Assets/GameScripts/DotNet/Core/Serialize/MemoryBuffer.cs.meta deleted file mode 100644 index d130c1aa..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize/MemoryBuffer.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9c85a4c0a92b422e9f5c81471a16e64a -timeCreated: 1682481633 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Serialize/MemoryPackHelper.cs b/Assets/GameScripts/DotNet/Core/Serialize/MemoryPackHelper.cs deleted file mode 100644 index 5ade5db1..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize/MemoryPackHelper.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.ComponentModel; -using MemoryPack; - -namespace ET -{ - public static class MemoryPackHelper - { - public static byte[] Serialize(object message) - { - return MemoryPackSerializer.Serialize(message.GetType(), message); - } - - public static void Serialize(object message, MemoryBuffer stream) - { - MemoryPackSerializer.Serialize(message.GetType(), stream, message); - } - - public static object Deserialize(Type type, byte[] bytes, int index, int count) - { - object o = MemoryPackSerializer.Deserialize(type, bytes.AsSpan(index, count)); - if (o is ISupportInitialize supportInitialize) - { - supportInitialize.EndInit(); - } - return o; - } - - public static object Deserialize(Type type, byte[] bytes, int index, int count, ref object o) - { - MemoryPackSerializer.Deserialize(type, bytes.AsSpan(index, count), ref o); - if (o is ISupportInitialize supportInitialize) - { - supportInitialize.EndInit(); - } - return o; - } - - public static object Deserialize(Type type, MemoryBuffer stream) - { - object o = MemoryPackSerializer.Deserialize(type, stream.GetSpan()); - if (o is ISupportInitialize supportInitialize) - { - supportInitialize.EndInit(); - } - return o; - } - - public static object Deserialize(Type type, MemoryBuffer stream, ref object o) - { - MemoryPackSerializer.Deserialize(type, stream.GetSpan(), ref o); - if (o is ISupportInitialize supportInitialize) - { - supportInitialize.EndInit(); - } - return o; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Serialize/MemoryPackHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Serialize/MemoryPackHelper.cs.meta deleted file mode 100644 index 87b89835..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize/MemoryPackHelper.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e48026652b4f4d09ae05581b76e2095b -timeCreated: 1682484738 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Serialize/MongoHelper.cs b/Assets/GameScripts/DotNet/Core/Serialize/MongoHelper.cs deleted file mode 100644 index c2117f00..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize/MongoHelper.cs +++ /dev/null @@ -1,250 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Reflection; -using MongoDB.Bson; -using MongoDB.Bson.IO; -using MongoDB.Bson.Serialization; -using MongoDB.Bson.Serialization.Conventions; -using MongoDB.Bson.Serialization.Serializers; -using TrueSync; -using Unity.Mathematics; - -namespace ET -{ - public static class MongoHelper - { - private class StructBsonSerialize: StructSerializerBase where TValue : struct - { - public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, TValue value) - { - Type nominalType = args.NominalType; - - IBsonWriter bsonWriter = context.Writer; - - bsonWriter.WriteStartDocument(); - - FieldInfo[] fields = nominalType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - foreach (FieldInfo field in fields) - { - bsonWriter.WriteName(field.Name); - BsonSerializer.Serialize(bsonWriter, field.FieldType, field.GetValue(value)); - } - - bsonWriter.WriteEndDocument(); - } - - public override TValue Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args) - { - //boxing is required for SetValue to work - object obj = new TValue(); - Type actualType = args.NominalType; - IBsonReader bsonReader = context.Reader; - - bsonReader.ReadStartDocument(); - - while (bsonReader.State != BsonReaderState.EndOfDocument) - { - switch (bsonReader.State) - { - case BsonReaderState.Name: - { - string name = bsonReader.ReadName(Utf8NameDecoder.Instance); - FieldInfo field = actualType.GetField(name); - if (field != null) - { - object value = BsonSerializer.Deserialize(bsonReader, field.FieldType); - field.SetValue(obj, value); - } - - break; - } - case BsonReaderState.Type: - { - bsonReader.ReadBsonType(); - break; - } - case BsonReaderState.Value: - { - bsonReader.SkipValue(); - break; - } - } - } - - bsonReader.ReadEndDocument(); - - return (TValue)obj; - } - } - - [StaticField] - private static readonly JsonWriterSettings defaultSettings = new() { OutputMode = JsonOutputMode.RelaxedExtendedJson }; - - public static void Register() - { - // 自动注册IgnoreExtraElements - ConventionPack conventionPack = new ConventionPack { new IgnoreExtraElementsConvention(true) }; - - ConventionRegistry.Register("IgnoreExtraElements", conventionPack, type => true); - - RegisterStruct(); - RegisterStruct(); - RegisterStruct(); - RegisterStruct(); - - RegisterStruct(); - RegisterStruct(); - RegisterStruct(); - RegisterStruct(); - RegisterStruct(); - - Dictionary types = EventSystem.Instance.GetTypes(); - foreach (Type type in types.Values) - { - if (!type.IsSubclassOf(typeof (Object))) - { - continue; - } - - if (type.IsGenericType) - { - continue; - } - - BsonClassMap.LookupClassMap(type); - } - } - - public static void RegisterStruct() where T : struct - { - BsonSerializer.RegisterSerializer(typeof (T), new StructBsonSerialize()); - } - - public static string ToJson(object obj) - { - if (obj is ISupportInitialize supportInitialize) - { - supportInitialize.BeginInit(); - } - return obj.ToJson(defaultSettings); - } - - public static string ToJson(object obj, JsonWriterSettings settings) - { - if (obj is ISupportInitialize supportInitialize) - { - supportInitialize.BeginInit(); - } - return obj.ToJson(settings); - } - - public static T FromJson(string str) - { - try - { - return BsonSerializer.Deserialize(str); - } - catch (Exception e) - { - throw new Exception($"{str}\n{e}"); - } - } - - public static object FromJson(Type type, string str) - { - return BsonSerializer.Deserialize(str, type); - } - - public static byte[] Serialize(object obj) - { - if (obj is ISupportInitialize supportInitialize) - { - supportInitialize.BeginInit(); - } - return obj.ToBson(); - } - - public static void Serialize(object message, MemoryStream stream) - { - if (message is ISupportInitialize supportInitialize) - { - supportInitialize.BeginInit(); - } - - using (BsonBinaryWriter bsonWriter = new BsonBinaryWriter(stream, BsonBinaryWriterSettings.Defaults)) - { - BsonSerializationContext context = BsonSerializationContext.CreateRoot(bsonWriter); - BsonSerializationArgs args = default; - args.NominalType = typeof (object); - IBsonSerializer serializer = BsonSerializer.LookupSerializer(args.NominalType); - serializer.Serialize(context, args, message); - } - } - - public static object Deserialize(Type type, byte[] bytes) - { - try - { - return BsonSerializer.Deserialize(bytes, type); - } - catch (Exception e) - { - throw new Exception($"from bson error: {type.FullName} {bytes.Length}", e); - } - } - - public static object Deserialize(Type type, byte[] bytes, int index, int count) - { - try - { - using (MemoryStream memoryStream = new MemoryStream(bytes, index, count)) - { - return BsonSerializer.Deserialize(memoryStream, type); - } - } - catch (Exception e) - { - throw new Exception($"from bson error: {type.FullName} {bytes.Length} {index} {count}", e); - } - } - - public static object Deserialize(Type type, Stream stream) - { - try - { - return BsonSerializer.Deserialize(stream, type); - } - catch (Exception e) - { - throw new Exception($"from bson error: {type.FullName} {stream.Position} {stream.Length}", e); - } - } - - public static T Deserialize(byte[] bytes) - { - try - { - using (MemoryStream memoryStream = new MemoryStream(bytes)) - { - return (T)BsonSerializer.Deserialize(memoryStream, typeof (T)); - } - } - catch (Exception e) - { - throw new Exception($"from bson error: {typeof (T).FullName} {bytes.Length}", e); - } - } - - public static T Deserialize(byte[] bytes, int index, int count) - { - return (T)Deserialize(typeof (T), bytes, index, count); - } - - public static T Clone(T t) - { - return Deserialize(Serialize(t)); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/Serialize/MongoHelper.cs.meta b/Assets/GameScripts/DotNet/Core/Serialize/MongoHelper.cs.meta deleted file mode 100644 index 11a944b8..00000000 --- a/Assets/GameScripts/DotNet/Core/Serialize/MongoHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ea73bf40fc38b474cabda2b211c90155 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/SortedLinkList.cs b/Assets/GameScripts/DotNet/Core/SortedLinkList.cs deleted file mode 100644 index 44e58996..00000000 --- a/Assets/GameScripts/DotNet/Core/SortedLinkList.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace ET -{ - public class SortedLinkList: Dictionary where T: IComparable, IEnumerable - { - //public struct KeyValuePair - //{ - // public SortedLinkList sortedLinkList; - // public T Key; - // public K Value; - // - // public KeyValuePair() - //} - - public class Node - { - public Node Next; - public T Value; - } - - private readonly Queue pool = new(); - - private Node head; - - private Node Fetch() - { - if (this.pool.Count == 0) - { - return new Node(); - } - return this.pool.Dequeue(); - } - - private void Recycle(Node node) - { - node.Next = null; - node.Value = default; - if (this.pool.Count > 1000) - { - return; - } - this.pool.Enqueue(node); - } - - //public new KeyValuePair GetEnumerator() - //{ - // return new - //} - - public T FirstKey() - { - return this.head.Value; - } - - public new void Add(T t, K k) - { - if (this.head == null) - { - Node node = this.Fetch(); - node.Value = t; - this.head = node; - return; - } - if (t.CompareTo(this.head.Value) < 0) - { - Node node = this.Fetch(); - node.Value = t; - node.Next = this.head; - this.head = node; - base.Add(t, k); - return; - } - - Node p = this.head; - while (true) - { - Node node = null; - if (p.Next == null) - { - node = this.Fetch(); - node.Value = t; - p.Next = node; - break; - } - - int ret = t.CompareTo(p.Next.Value); - - if (ret == 0) - { - break; - } - - if (ret > 0) - { - p = p.Next; - continue; - } - - node = this.Fetch(); - node.Value = t; - node.Next = p.Next; - p.Next = node; - } - base.Add(t, k); - } - - public new bool Remove(T t) - { - if (this.head == null) - { - return false; - } - - Node p = this.head; - - while (true) - { - if (p.Next == null) - { - break; - } - - int ret = t.CompareTo(p.Next.Value); - - if (ret == 0) - { - this.Recycle(p.Next); - p.Next = p.Next.Next; - break; - } - - if (ret > 0) - { - p = p.Next; - } - } - return base.Remove(t); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/SortedLinkList.cs.meta b/Assets/GameScripts/DotNet/Core/SortedLinkList.cs.meta deleted file mode 100644 index 511e7e1b..00000000 --- a/Assets/GameScripts/DotNet/Core/SortedLinkList.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ae9d7cf85779e447f9e10e80ad618d49 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/ThreadSynchronizationContext.cs b/Assets/GameScripts/DotNet/Core/ThreadSynchronizationContext.cs deleted file mode 100644 index 80281b79..00000000 --- a/Assets/GameScripts/DotNet/Core/ThreadSynchronizationContext.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Threading; - -namespace ET -{ - public class ThreadSynchronizationContext : SynchronizationContext - { - // 线程同步队列,发送接收socket回调都放到该队列,由poll线程统一执行 - private readonly ConcurrentQueue queue = new(); - - private Action a; - - public void Update() - { - while (true) - { - if (!this.queue.TryDequeue(out a)) - { - return; - } - - try - { - a(); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public override void Post(SendOrPostCallback callback, object state) - { - this.Post(() => callback(state)); - } - - public void Post(Action action) - { - this.queue.Enqueue(action); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/ThreadSynchronizationContext.cs.meta b/Assets/GameScripts/DotNet/Core/ThreadSynchronizationContext.cs.meta deleted file mode 100644 index ba9c5dd6..00000000 --- a/Assets/GameScripts/DotNet/Core/ThreadSynchronizationContext.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b298acf68974f43389f4468ec8d37ff0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/TimerCoreInvokeType.cs b/Assets/GameScripts/DotNet/Core/TimerCoreInvokeType.cs deleted file mode 100644 index ca78bc61..00000000 --- a/Assets/GameScripts/DotNet/Core/TimerCoreInvokeType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - [UniqueId(0, 100)] - public static class TimerCoreInvokeType - { - public const int CoroutineTimeout = 1; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/TimerCoreInvokeType.cs.meta b/Assets/GameScripts/DotNet/Core/TimerCoreInvokeType.cs.meta deleted file mode 100644 index fc83ce1b..00000000 --- a/Assets/GameScripts/DotNet/Core/TimerCoreInvokeType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 31f2b9f56fc39724eb2d371057b5929f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/UnOrderMultiMap.cs b/Assets/GameScripts/DotNet/Core/UnOrderMultiMap.cs deleted file mode 100644 index ea541027..00000000 --- a/Assets/GameScripts/DotNet/Core/UnOrderMultiMap.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class UnOrderMultiMap: Dictionary> - { - public void Add(T t, K k) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - list = new List(); - base[t] = list; - } - list.Add(k); - } - - public bool Remove(T t, K k) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - if (!list.Remove(k)) - { - return false; - } - if (list.Count == 0) - { - this.Remove(t); - } - return true; - } - - /// - /// 不返回内部的list,copy一份出来 - /// - /// - /// - public K[] GetAll(T t) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return Array.Empty(); - } - return list.ToArray(); - } - - /// - /// 返回内部的list - /// - /// - /// - public new List this[T t] - { - get - { - List list; - this.TryGetValue(t, out list); - return list; - } - } - - public K GetOne(T t) - { - List list; - this.TryGetValue(t, out list); - if (list != null && list.Count > 0) - { - return list[0]; - } - return default(K); - } - - public bool Contains(T t, K k) - { - List list; - this.TryGetValue(t, out list); - if (list == null) - { - return false; - } - return list.Contains(k); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/UnOrderMultiMap.cs.meta b/Assets/GameScripts/DotNet/Core/UnOrderMultiMap.cs.meta deleted file mode 100644 index 076328dc..00000000 --- a/Assets/GameScripts/DotNet/Core/UnOrderMultiMap.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 747fe7a9303dd3a40b5385d5a58ffbef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/UnOrderMultiMapSet.cs b/Assets/GameScripts/DotNet/Core/UnOrderMultiMapSet.cs deleted file mode 100644 index 6707f3af..00000000 --- a/Assets/GameScripts/DotNet/Core/UnOrderMultiMapSet.cs +++ /dev/null @@ -1,86 +0,0 @@ -/** - * 多重映射结构 - * - */ - -using System.Collections.Generic; - -namespace ET -{ - public class UnOrderMultiMapSet: Dictionary> - { - // 重用HashSet - public new HashSet this[T t] - { - get - { - HashSet set; - if (!this.TryGetValue(t, out set)) - { - set = new HashSet(); - } - return set; - } - } - - public Dictionary> GetDictionary() - { - return this; - } - - public void Add(T t, K k) - { - HashSet set; - this.TryGetValue(t, out set); - if (set == null) - { - set = new HashSet(); - base[t] = set; - } - set.Add(k); - } - - public bool Remove(T t, K k) - { - HashSet set; - this.TryGetValue(t, out set); - if (set == null) - { - return false; - } - if (!set.Remove(k)) - { - return false; - } - if (set.Count == 0) - { - this.Remove(t); - } - return true; - } - - public bool Contains(T t, K k) - { - HashSet set; - this.TryGetValue(t, out set); - if (set == null) - { - return false; - } - return set.Contains(k); - } - - public new int Count - { - get - { - int count = 0; - foreach (KeyValuePair> kv in this) - { - count += kv.Value.Count; - } - return count; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/UnOrderMultiMapSet.cs.meta b/Assets/GameScripts/DotNet/Core/UnOrderMultiMapSet.cs.meta deleted file mode 100644 index af0621c4..00000000 --- a/Assets/GameScripts/DotNet/Core/UnOrderMultiMapSet.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 297f219f1c03e26429e6d9b2360f0f18 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World.meta b/Assets/GameScripts/DotNet/Core/World.meta deleted file mode 100644 index 95a50fb4..00000000 --- a/Assets/GameScripts/DotNet/Core/World.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9a0977baeb1c8c843b9f3bff411488ab -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/ActorId.cs b/Assets/GameScripts/DotNet/Core/World/ActorId.cs deleted file mode 100644 index 83e2a240..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ActorId.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using MemoryPack; -using MongoDB.Bson.Serialization.Attributes; - -namespace ET -{ - [MemoryPackable] - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public partial struct Address - { - [MemoryPackOrder(0)] - public int Process; - [MemoryPackOrder(1)] - public int Fiber; - - public bool Equals(Address other) - { - return this.Process == other.Process && this.Fiber == other.Fiber; - } - - public override bool Equals(object obj) - { - return obj is Address other && Equals(other); - } - - public override int GetHashCode() - { - return HashCode.Combine(this.Process, this.Fiber); - } - - public Address(int process, int fiber) - { - this.Process = process; - this.Fiber = fiber; - } - - public static bool operator ==(Address left, Address right) - { - return left.Process == right.Process && left.Fiber == right.Fiber; - } - - public static bool operator !=(Address left, Address right) - { - return !(left == right); - } - - public override string ToString() - { - return $"{this.Process}:{this.Fiber}"; - } - } - - [MemoryPackable] - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public partial struct ActorId - { - public bool Equals(ActorId other) - { - return this.Address == other.Address && this.InstanceId == other.InstanceId; - } - - public override bool Equals(object obj) - { - return obj is ActorId other && Equals(other); - } - - public override int GetHashCode() - { - return HashCode.Combine(this.Address, this.InstanceId); - } - - [MemoryPackOrder(0)] - public Address Address; - [MemoryPackOrder(1)] - public long InstanceId; - - [BsonIgnore] - public int Process - { - get - { - return this.Address.Process; - } - set - { - this.Address.Process = value; - } - } - - [BsonIgnore] - public int Fiber - { - get - { - return this.Address.Fiber; - } - set - { - this.Address.Fiber = value; - } - } - - public ActorId(int process, int fiber) - { - this.Address = new Address(process, fiber); - this.InstanceId = 1; - } - - public ActorId(int process, int fiber, long instanceId) - { - this.Address = new Address(process, fiber); - this.InstanceId = instanceId; - } - - public ActorId(Address address): this(address, 1) - { - } - - public ActorId(Address address, long instanceId) - { - this.Address = address; - this.InstanceId = instanceId; - } - - public static bool operator ==(ActorId left, ActorId right) - { - return left.InstanceId == right.InstanceId && left.Address == right.Address; - } - - public static bool operator !=(ActorId left, ActorId right) - { - return !(left == right); - } - - public override string ToString() - { - return $"{this.Process}:{this.Fiber}:{this.InstanceId}"; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/ActorId.cs.meta b/Assets/GameScripts/DotNet/Core/World/ActorId.cs.meta deleted file mode 100644 index 45634127..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ActorId.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9e8f0bd4aa4045ddb59117f81ff62be5 -timeCreated: 1687104833 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/IMessage.cs b/Assets/GameScripts/DotNet/Core/World/IMessage.cs deleted file mode 100644 index 6b6527d8..00000000 --- a/Assets/GameScripts/DotNet/Core/World/IMessage.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace ET -{ - public interface IMessage - { - } - - public interface IRequest: IMessage - { - int RpcId - { - get; - set; - } - } - - public interface IResponse: IMessage - { - int Error - { - get; - set; - } - - string Message - { - get; - set; - } - - int RpcId - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/IMessage.cs.meta b/Assets/GameScripts/DotNet/Core/World/IMessage.cs.meta deleted file mode 100644 index 22cada72..00000000 --- a/Assets/GameScripts/DotNet/Core/World/IMessage.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 21e594d3ffbf71b45ad9577e4c586518 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/ISingletonAwake.cs b/Assets/GameScripts/DotNet/Core/World/ISingletonAwake.cs deleted file mode 100644 index 00c2da1a..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ISingletonAwake.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace ET -{ - public interface ISingletonAwake - { - void Awake(); - } - - public interface ISingletonAwake - { - void Awake(A a); - } - - public interface ISingletonAwake - { - void Awake(A a, B b); - } - - public interface ISingletonAwake - { - void Awake(A a, B b, C c); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/ISingletonAwake.cs.meta b/Assets/GameScripts/DotNet/Core/World/ISingletonAwake.cs.meta deleted file mode 100644 index 4916393d..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ISingletonAwake.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5cc34700016e57b43981e910cb9fc129 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/ISingletonDestroy.cs b/Assets/GameScripts/DotNet/Core/World/ISingletonDestroy.cs deleted file mode 100644 index d5287535..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ISingletonDestroy.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - public interface ISingletonDestroy - { - void Destroy(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/ISingletonDestroy.cs.meta b/Assets/GameScripts/DotNet/Core/World/ISingletonDestroy.cs.meta deleted file mode 100644 index b750d776..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ISingletonDestroy.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 05613b4e63ae5a14887a34e97a0c1a0f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/ISingletonLoad.cs b/Assets/GameScripts/DotNet/Core/World/ISingletonLoad.cs deleted file mode 100644 index 645db1b2..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ISingletonLoad.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - public interface ISingletonLoad - { - void Load(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/ISingletonLoad.cs.meta b/Assets/GameScripts/DotNet/Core/World/ISingletonLoad.cs.meta deleted file mode 100644 index 9ed11a75..00000000 --- a/Assets/GameScripts/DotNet/Core/World/ISingletonLoad.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: a6552160d3164dee967d0dc9db1611a3 -timeCreated: 1687250763 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module.meta b/Assets/GameScripts/DotNet/Core/World/Module.meta deleted file mode 100644 index edd877d3..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 565753fb8d09f4c40903cc0071a3461f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor.meta b/Assets/GameScripts/DotNet/Core/World/Module/Actor.meta deleted file mode 100644 index 846cd792..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 395a79eb78315e84e92fde7209c84fda -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageDispatcherComponent.cs b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageDispatcherComponent.cs deleted file mode 100644 index d694345b..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageDispatcherComponent.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class ActorMessageDispatcherInfo - { - public SceneType SceneType { get; } - - public IMActorHandler IMActorHandler { get; } - - public ActorMessageDispatcherInfo(SceneType sceneType, IMActorHandler imActorHandler) - { - this.SceneType = sceneType; - this.IMActorHandler = imActorHandler; - } - } - - /// - /// Actor消息分发组件 - /// - public class ActorMessageDispatcherComponent: SingletonLock, ISingletonAwake - { - private readonly Dictionary> ActorMessageHandlers = new(); - - public void Awake() - { - HashSet types = EventSystem.Instance.GetTypes(typeof (ActorMessageHandlerAttribute)); - - foreach (Type type in types) - { - this.Register(type); - } - - HashSet types2 = EventSystem.Instance.GetTypes(typeof (ActorMessageLocationHandlerAttribute)); - - foreach (Type type in types2) - { - this.Register(type); - } - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - private void Register(Type type) - { - object obj = Activator.CreateInstance(type); - - IMActorHandler imHandler = obj as IMActorHandler; - if (imHandler == null) - { - throw new Exception($"message handler not inherit IMActorHandler abstract class: {obj.GetType().FullName}"); - } - - object[] attrs = type.GetCustomAttributes(typeof(ActorMessageHandlerAttribute), true); - - foreach (object attr in attrs) - { - ActorMessageHandlerAttribute actorMessageHandlerAttribute = attr as ActorMessageHandlerAttribute; - - Type messageType = imHandler.GetRequestType(); - - Type handleResponseType = imHandler.GetResponseType(); - if (handleResponseType != null) - { - Type responseType = OpcodeType.Instance.GetResponseType(messageType); - if (handleResponseType != responseType) - { - throw new Exception($"message handler response type error: {messageType.FullName}"); - } - } - - ActorMessageDispatcherInfo actorMessageDispatcherInfo = new(actorMessageHandlerAttribute.SceneType, imHandler); - - this.RegisterHandler(messageType, actorMessageDispatcherInfo); - } - } - - private void RegisterHandler(Type type, ActorMessageDispatcherInfo handler) - { - if (!this.ActorMessageHandlers.ContainsKey(type)) - { - this.ActorMessageHandlers.Add(type, new List()); - } - - this.ActorMessageHandlers[type].Add(handler); - } - - public async ETTask Handle(Entity entity, Address fromAddress, MessageObject message) - { - List list; - if (!this.ActorMessageHandlers.TryGetValue(message.GetType(), out list)) - { - throw new Exception($"not found message handler: {message} {entity.GetType().FullName}"); - } - - SceneType sceneType = entity.IScene.SceneType; - foreach (ActorMessageDispatcherInfo actorMessageDispatcherInfo in list) - { - if (!actorMessageDispatcherInfo.SceneType.HasSameFlag(sceneType)) - { - continue; - } - await actorMessageDispatcherInfo.IMActorHandler.Handle(entity, fromAddress, message); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageDispatcherComponent.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageDispatcherComponent.cs.meta deleted file mode 100644 index 24fd022a..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageDispatcherComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 294f1f138d2646e48b9bcbf0735b1e40 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageHandlerAttribute.cs b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageHandlerAttribute.cs deleted file mode 100644 index fe45e290..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageHandlerAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace ET -{ - public class ActorMessageHandlerAttribute: BaseAttribute - { - public SceneType SceneType { get; } - - public ActorMessageHandlerAttribute(SceneType sceneType) - { - this.SceneType = sceneType; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageHandlerAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageHandlerAttribute.cs.meta deleted file mode 100644 index 3e6ea4b2..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageHandlerAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4030c4594ee40704e893482747b7777e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageLocationHandlerAttribute.cs b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageLocationHandlerAttribute.cs deleted file mode 100644 index ad004c8e..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageLocationHandlerAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace ET -{ - public class ActorMessageLocationHandlerAttribute: ActorMessageHandlerAttribute - { - public ActorMessageLocationHandlerAttribute(SceneType sceneType): base(sceneType) - { - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageLocationHandlerAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageLocationHandlerAttribute.cs.meta deleted file mode 100644 index 276d2890..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageLocationHandlerAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 93635a0b30dc9c940af1c28d9614db92 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageQueue.cs b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageQueue.cs deleted file mode 100644 index 649bc06a..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageQueue.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; - -namespace ET -{ - public struct ActorMessageInfo - { - public ActorId ActorId; - public MessageObject MessageObject; - } - - public class ActorMessageQueue: Singleton, ISingletonAwake - { - private readonly ConcurrentDictionary> messages = new(); - - public void Awake() - { - } - - public void Send(ActorId actorId, MessageObject messageObject) - { - this.Send(actorId.Address, actorId, messageObject); - } - - public void Reply(ActorId actorId, MessageObject messageObject) - { - this.Send(actorId.Address, actorId, messageObject); - } - - public void Send(Address fromAddress, ActorId actorId, MessageObject messageObject) - { - if (!this.messages.TryGetValue(actorId.Address.Fiber, out var queue)) - { - return; - } - queue.Enqueue(new ActorMessageInfo() {ActorId = new ActorId(fromAddress, actorId.InstanceId), MessageObject = messageObject}); - } - - public void Fetch(int fiberId, int count, List list) - { - if (!this.messages.TryGetValue(fiberId, out var queue)) - { - return; - } - - for (int i = 0; i < count; ++i) - { - if (!queue.TryDequeue(out ActorMessageInfo message)) - { - break; - } - list.Add(message); - } - } - - public void AddQueue(int fiberId) - { - var queue = new ConcurrentQueue(); - this.messages[fiberId] = queue; - } - - public void RemoveQueue(int fiberId) - { - this.messages.TryRemove(fiberId, out _); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageQueue.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageQueue.cs.meta deleted file mode 100644 index 90a23127..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/ActorMessageQueue.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4bc600297c654056823d9ac4821e69b1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/IMActorHandler.cs b/Assets/GameScripts/DotNet/Core/World/Module/Actor/IMActorHandler.cs deleted file mode 100644 index 99ed8b0c..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/IMActorHandler.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace ET -{ - public interface IMActorHandler - { - ETTask Handle(Entity entity, Address fromAddress, MessageObject actorMessage); - Type GetRequestType(); - Type GetResponseType(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Actor/IMActorHandler.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Actor/IMActorHandler.cs.meta deleted file mode 100644 index 2ce482de..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Actor/IMActorHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b5dc447b842d71c4aa4ff84f98d4f5e4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config.meta b/Assets/GameScripts/DotNet/Core/World/Module/Config.meta deleted file mode 100644 index 4cdad9e8..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fdea67585847303418ec523256daa007 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigAttribute.cs b/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigAttribute.cs deleted file mode 100644 index 137e7339..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class)] - public class ConfigAttribute: BaseAttribute - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigAttribute.cs.meta deleted file mode 100644 index 6a296b1f..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5237b38531c8cea41a44538f14db11c1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigComponent.cs b/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigComponent.cs deleted file mode 100644 index 265df8f9..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigComponent.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace ET -{ - /// - /// Config组件会扫描所有的有ConfigAttribute标签的配置,加载进来 - /// - public class ConfigComponent: Singleton, ISingletonAwake - { - public struct GetAllConfigBytes - { - } - - public struct GetOneConfigBytes - { - public string ConfigName; - } - - private readonly ConcurrentDictionary allConfig = new(); - - public void Awake() - { - } - - public void Reload(Type configType) - { - byte[] oneConfigBytes = - EventSystem.Instance.Invoke(new GetOneConfigBytes() { ConfigName = configType.Name }); - - object category = MongoHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length); - ISingleton singleton = category as ISingleton; - this.allConfig[configType] = singleton; - - singleton.Register(); - } - - public void Load() - { - this.allConfig.Clear(); - Dictionary configBytes = EventSystem.Instance.Invoke>(new GetAllConfigBytes()); - - foreach (Type type in configBytes.Keys) - { - byte[] oneConfigBytes = configBytes[type]; - this.LoadOneInThread(type, oneConfigBytes); - } - } - - public async ETTask LoadAsync() - { - this.allConfig.Clear(); - Dictionary configBytes = EventSystem.Instance.Invoke>(new GetAllConfigBytes()); - - using ListComponent listTasks = ListComponent.Create(); - - foreach (Type type in configBytes.Keys) - { - byte[] oneConfigBytes = configBytes[type]; - Task task = Task.Run(() => LoadOneInThread(type, oneConfigBytes)); - listTasks.Add(task); - } - - await Task.WhenAll(listTasks.ToArray()); - } - - private void LoadOneInThread(Type configType, byte[] oneConfigBytes) - { - object category = MongoHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length); - - lock (this) - { - ISingleton singleton = category as ISingleton; - this.allConfig[configType] = singleton; - - singleton.Register(); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigComponent.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigComponent.cs.meta deleted file mode 100644 index 75c3210f..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f3220f986cb182d4da3952ba65888ae4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigSingleton.cs b/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigSingleton.cs deleted file mode 100644 index f95fe3f9..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigSingleton.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.ComponentModel; - -namespace ET -{ - public abstract class ConfigSingleton: ISingleton, ISupportInitialize where T: ConfigSingleton, new() - { - private bool isDisposed; - - [StaticField] - private static T instance; - - [StaticField] - private static object lockObj = new(); - - public static T Instance - { - get - { - lock (lockObj) - { - return instance; - } - } - private set - { - lock (lockObj) - { - instance = value; - } - } - } - - public virtual void Register() - { - Instance = (T)this; - } - - public bool IsDisposed() - { - return this.isDisposed; - } - - protected virtual void Destroy() - { - - } - - void IDisposable.Dispose() - { - if (this.isDisposed) - { - return; - } - - this.isDisposed = true; - - Instance = null; - - this.Destroy(); - } - - public virtual void BeginInit() - { - } - - public virtual void EndInit() - { - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigSingleton.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigSingleton.cs.meta deleted file mode 100644 index cbcd3fbf..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/ConfigSingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e3f57aff7b8dfc3489d97b45c8423bc8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/IConfig.cs b/Assets/GameScripts/DotNet/Core/World/Module/Config/IConfig.cs deleted file mode 100644 index 253b4e20..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/IConfig.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ET -{ - /// - /// 每个Config的基类 - /// - public interface IConfig - { - int Id { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/IConfig.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Config/IConfig.cs.meta deleted file mode 100644 index fffcfbdf..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/IConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 986a79748635bf741ba4ba0ac5e68d5b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/IMerge.cs b/Assets/GameScripts/DotNet/Core/World/Module/Config/IMerge.cs deleted file mode 100644 index d1c49211..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/IMerge.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - public interface IMerge - { - void Merge(object o); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Config/IMerge.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Config/IMerge.cs.meta deleted file mode 100644 index c24b9d69..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Config/IMerge.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c2d3bd3ce794a884e96904d2f9f5b5b5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem.meta deleted file mode 100644 index 19efeff3..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6f63520dc272ce84894929d06d86966b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/BaseAttribute.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/BaseAttribute.cs deleted file mode 100644 index 06d6e1a9..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/BaseAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class)] - public class BaseAttribute: Attribute - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/BaseAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/BaseAttribute.cs.meta deleted file mode 100644 index 7683857e..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/BaseAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6d33b65898d50804188d439209df30d7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventAttribute.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventAttribute.cs deleted file mode 100644 index db3b6eaa..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace ET -{ - public class EventAttribute: BaseAttribute - { - public SceneType SceneType { get; } - - public EventAttribute(SceneType sceneType) - { - this.SceneType = sceneType; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventAttribute.cs.meta deleted file mode 100644 index 83375bb4..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 68a635393e1b00c489870d0fb6a97f8b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventSystem.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventSystem.cs deleted file mode 100644 index de2e69b3..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventSystem.cs +++ /dev/null @@ -1,250 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class EventSystem: Singleton, ISingletonAwake> - { - private class EventInfo - { - public IEvent IEvent { get; } - - public SceneType SceneType {get; } - - public EventInfo(IEvent iEvent, SceneType sceneType) - { - this.IEvent = iEvent; - this.SceneType = sceneType; - } - } - - private readonly Dictionary allTypes = new(); - - private readonly UnOrderMultiMapSet types = new(); - - private readonly Dictionary> allEvents = new(); - - private Dictionary> allInvokes = new(); - - public void Awake(Dictionary addTypes) - { - this.allTypes.Clear(); - this.types.Clear(); - - foreach ((string fullName, Type type) in addTypes) - { - this.allTypes[fullName] = type; - - if (type.IsAbstract) - { - continue; - } - - // 记录所有的有BaseAttribute标记的的类型 - object[] objects = type.GetCustomAttributes(typeof(BaseAttribute), true); - - foreach (object o in objects) - { - this.types.Add(o.GetType(), type); - } - } - - this.allEvents.Clear(); - foreach (Type type in types[typeof (EventAttribute)]) - { - IEvent obj = Activator.CreateInstance(type) as IEvent; - if (obj == null) - { - throw new Exception($"type not is AEvent: {type.Name}"); - } - - object[] attrs = type.GetCustomAttributes(typeof(EventAttribute), false); - foreach (object attr in attrs) - { - EventAttribute eventAttribute = attr as EventAttribute; - - Type eventType = obj.Type; - - EventInfo eventInfo = new(obj, eventAttribute.SceneType); - - if (!this.allEvents.ContainsKey(eventType)) - { - this.allEvents.Add(eventType, new List()); - } - this.allEvents[eventType].Add(eventInfo); - } - } - - this.allInvokes = new Dictionary>(); - foreach (Type type in types[typeof (InvokeAttribute)]) - { - object obj = Activator.CreateInstance(type); - IInvoke iInvoke = obj as IInvoke; - if (iInvoke == null) - { - throw new Exception($"type not is callback: {type.Name}"); - } - - object[] attrs = type.GetCustomAttributes(typeof(InvokeAttribute), false); - foreach (object attr in attrs) - { - if (!this.allInvokes.TryGetValue(iInvoke.Type, out var dict)) - { - dict = new Dictionary(); - this.allInvokes.Add(iInvoke.Type, dict); - } - - InvokeAttribute invokeAttribute = attr as InvokeAttribute; - - try - { - dict.Add(invokeAttribute.Type, obj); - } - catch (Exception e) - { - throw new Exception($"action type duplicate: {iInvoke.Type.Name} {invokeAttribute.Type}", e); - } - } - } - } - - public HashSet GetTypes(Type systemAttributeType) - { - if (!this.types.ContainsKey(systemAttributeType)) - { - return new HashSet(); - } - - return this.types[systemAttributeType]; - } - - public Dictionary GetTypes() - { - return allTypes; - } - - public Type GetType(string typeName) - { - return this.allTypes[typeName]; - } - - public async ETTask PublishAsync(S scene, T a) where S: class, IScene where T : struct - { - List iEvents; - if (!this.allEvents.TryGetValue(typeof(T), out iEvents)) - { - return; - } - - using ListComponent list = ListComponent.Create(); - - foreach (EventInfo eventInfo in iEvents) - { - if (!scene.SceneType.HasSameFlag(eventInfo.SceneType)) - { - continue; - } - - if (!(eventInfo.IEvent is AEvent aEvent)) - { - Log.Error($"event error: {eventInfo.IEvent.GetType().FullName}"); - continue; - } - - list.Add(aEvent.Handle(scene, a)); - } - - try - { - await ETTaskHelper.WaitAll(list); - } - catch (Exception e) - { - Log.Error(e); - } - } - - public void Publish(S scene, T a) where S: class, IScene where T : struct - { - List iEvents; - if (!this.allEvents.TryGetValue(typeof (T), out iEvents)) - { - return; - } - - SceneType sceneType = scene.SceneType; - foreach (EventInfo eventInfo in iEvents) - { - if (!sceneType.HasSameFlag(eventInfo.SceneType)) - { - continue; - } - - - if (!(eventInfo.IEvent is AEvent aEvent)) - { - Log.Error($"event error: {eventInfo.IEvent.GetType().FullName}"); - continue; - } - - aEvent.Handle(scene, a).Coroutine(); - } - } - - // Invoke跟Publish的区别(特别注意) - // Invoke类似函数,必须有被调用方,否则异常,调用者跟被调用者属于同一模块,比如MoveComponent中的Timer计时器,调用跟被调用的代码均属于移动模块 - // 既然Invoke跟函数一样,那么为什么不使用函数呢? 因为有时候不方便直接调用,比如Config加载,在客户端跟服务端加载方式不一样。比如TimerComponent需要根据Id分发 - // 注意,不要把Invoke当函数使用,这样会造成代码可读性降低,能用函数不要用Invoke - // publish是事件,抛出去可以没人订阅,调用者跟被调用者属于两个模块,比如任务系统需要知道道具使用的信息,则订阅道具使用事件 - public void Invoke(long type, A args) where A: struct - { - if (!this.allInvokes.TryGetValue(typeof(A), out var invokeHandlers)) - { - throw new Exception($"Invoke error1: {type} {typeof(A).FullName}"); - } - if (!invokeHandlers.TryGetValue(type, out var invokeHandler)) - { - throw new Exception($"Invoke error2: {type} {typeof(A).FullName}"); - } - - var aInvokeHandler = invokeHandler as AInvokeHandler; - if (aInvokeHandler == null) - { - throw new Exception($"Invoke error3, not AInvokeHandler: {type} {typeof(A).FullName}"); - } - - aInvokeHandler.Handle(args); - } - - public T Invoke(long type, A args) where A: struct - { - if (!this.allInvokes.TryGetValue(typeof(A), out var invokeHandlers)) - { - throw new Exception($"Invoke error4: {type} {typeof(A).FullName}"); - } - - if (!invokeHandlers.TryGetValue(type, out var invokeHandler)) - { - throw new Exception($"Invoke error5: {type} {typeof(A).FullName}"); - } - - var aInvokeHandler = invokeHandler as AInvokeHandler; - if (aInvokeHandler == null) - { - throw new Exception($"Invoke error6, not AInvokeHandler: {type} {typeof(A).FullName} {typeof(T).FullName} "); - } - - return aInvokeHandler.Handle(args); - } - - public void Invoke(A args) where A: struct - { - Invoke(0, args); - } - - public T Invoke(A args) where A: struct - { - return Invoke(0, args); - } - } -} diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventSystem.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventSystem.cs.meta deleted file mode 100644 index 142fc243..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/EventSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0d55d77ba949f0545a29e965a7a5b2bf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IEvent.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IEvent.cs deleted file mode 100644 index b506e305..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IEvent.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -namespace ET -{ - public interface IEvent - { - Type Type { get; } - } - - public abstract class AEvent: IEvent where S: class, IScene where A: struct - { - public Type Type - { - get - { - return typeof (A); - } - } - - protected abstract ETTask Run(S scene, A a); - - public async ETTask Handle(S scene, A a) - { - try - { - await Run(scene, a); - } - catch (Exception e) - { - Log.Error(e); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IEvent.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IEvent.cs.meta deleted file mode 100644 index c4c05a5a..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IEvent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37f03a5bbacabb74496f35229db66c95 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IInvoke.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IInvoke.cs deleted file mode 100644 index 6cdca284..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IInvoke.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -namespace ET -{ - public interface IInvoke - { - Type Type { get; } - } - - public abstract class AInvokeHandler: IInvoke where A: struct - { - public Type Type - { - get - { - return typeof (A); - } - } - - public abstract void Handle(A args); - } - - public abstract class AInvokeHandler: IInvoke where A: struct - { - public Type Type - { - get - { - return typeof (A); - } - } - - public abstract T Handle(A args); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IInvoke.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IInvoke.cs.meta deleted file mode 100644 index fdf70bb2..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/IInvoke.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fec8a605631db024fa246feb87beb5d0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/InvokeAttribute.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/InvokeAttribute.cs deleted file mode 100644 index d5649130..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/InvokeAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - public class InvokeAttribute: BaseAttribute - { - public long Type { get; } - - public InvokeAttribute(long type = 0) - { - this.Type = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/InvokeAttribute.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/InvokeAttribute.cs.meta deleted file mode 100644 index 5a582da3..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/InvokeAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 31ef4af33bd048f49b0b9b0d9a9a0547 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/TypeSystems.cs b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/TypeSystems.cs deleted file mode 100644 index dd658f7b..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/TypeSystems.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class TypeSystems - { - public class OneTypeSystems - { - public OneTypeSystems(int count) - { - this.QueueFlag = new bool[count]; - } - - public readonly UnOrderMultiMap Map = new(); - // 这里不用hash,数量比较少,直接for循环速度更快 - public readonly bool[] QueueFlag; - } - - private readonly int count; - - public TypeSystems(int count) - { - this.count = count; - } - - private readonly Dictionary typeSystemsMap = new(); - - public OneTypeSystems GetOrCreateOneTypeSystems(Type type) - { - OneTypeSystems systems = null; - this.typeSystemsMap.TryGetValue(type, out systems); - if (systems != null) - { - return systems; - } - - systems = new OneTypeSystems(this.count); - this.typeSystemsMap.Add(type, systems); - return systems; - } - - public OneTypeSystems GetOneTypeSystems(Type type) - { - OneTypeSystems systems = null; - this.typeSystemsMap.TryGetValue(type, out systems); - return systems; - } - - public List GetSystems(Type type, Type systemType) - { - OneTypeSystems oneTypeSystems = null; - if (!this.typeSystemsMap.TryGetValue(type, out oneTypeSystems)) - { - return null; - } - - if (!oneTypeSystems.Map.TryGetValue(systemType, out List systems)) - { - return null; - } - - return systems; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/TypeSystems.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/TypeSystems.cs.meta deleted file mode 100644 index 991b94ff..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/EventSystem/TypeSystems.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e0eda11a6dcbc4874882857077fa35a2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber.meta deleted file mode 100644 index d3139250..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9c7dd8d20e9ef5643a4f3a61fd9cc010 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberInit.cs b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberInit.cs deleted file mode 100644 index 93972781..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberInit.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - - public struct FiberInit - { - public Fiber Fiber { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberInit.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberInit.cs.meta deleted file mode 100644 index cef2487b..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberInit.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 58e3cff11bc93e145b00d4243dcb1538 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberManager.cs b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberManager.cs deleted file mode 100644 index 880c2e68..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberManager.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace ET -{ - public enum SchedulerType - { - Main, - Thread, - ThreadPool, - } - - public class FiberManager: Singleton, ISingletonAwake - { - private readonly IScheduler[] schedulers = new IScheduler[3]; - - private int idGenerator = 10000000; // 10000000以下为保留的用于StartSceneConfig的fiber id, 1个区配置1000个纤程,可以配置10000个区 - private ConcurrentDictionary fibers = new(); - - private MainThreadScheduler mainThreadScheduler; - - public void Awake() - { - this.mainThreadScheduler = new MainThreadScheduler(this); - this.schedulers[(int)SchedulerType.Main] = this.mainThreadScheduler; - -#if ENABLE_VIEW && UNITY_EDITOR - this.schedulers[(int)SchedulerType.Thread] = this.mainThreadScheduler; - this.schedulers[(int)SchedulerType.ThreadPool] = this.mainThreadScheduler; -#else - this.schedulers[(int)SchedulerType.Thread] = new ThreadScheduler(this); - this.schedulers[(int)SchedulerType.ThreadPool] = new ThreadPoolScheduler(this); -#endif - } - - public void Update() - { - this.mainThreadScheduler.Update(); - } - - public void LateUpdate() - { - this.mainThreadScheduler.LateUpdate(); - } - - protected override void Destroy() - { - foreach (IScheduler scheduler in this.schedulers) - { - scheduler.Dispose(); - } - - foreach (var kv in this.fibers) - { - kv.Value.Dispose(); - } - - this.fibers = null; - } - - public async Task Create(SchedulerType schedulerType, int fiberId, int zone, SceneType sceneType, string name) - { - try - { - Fiber fiber = new(fiberId, Options.Instance.Process, zone, sceneType, name); - - this.fibers.TryAdd(fiberId, fiber); - this.schedulers[(int) schedulerType].Add(fiberId); - - TaskCompletionSource tcs = new TaskCompletionSource(); - - fiber.ThreadSynchronizationContext.Post(async () => - { - try - { - // 根据Fiber的SceneType分发Init,必须在Fiber线程中执行 - await EventSystem.Instance.Invoke((long)sceneType, new FiberInit() {Fiber = fiber}); - tcs.SetResult(true); - } - catch (Exception e) - { - Log.Error($"init fiber fail: {sceneType} {e}"); - } - }); - - await tcs.Task; - return fiberId; - } - catch (Exception e) - { - throw new Exception($"create fiber error: {fiberId} {sceneType}", e); - } - } - - public async Task Create(SchedulerType schedulerType, int zone, SceneType sceneType, string name) - { - int fiberId = Interlocked.Increment(ref this.idGenerator); - return await this.Create(schedulerType, fiberId, zone, sceneType, name); - } - - public void Remove(int id) - { - Fiber fiber = this.Get(id); - fiber.ThreadSynchronizationContext.Post(()=>{fiber.Dispose();}); - // 这里不能dispose,因为有可能fiber还在运行,会出现线程竞争 - //fiber.Dispose(); - } - - internal void RemoveReal(int id) - { - this.fibers.Remove(id, out _); - // 这里不能dispose,因为有可能fiber还在运行,会出现线程竞争 - //fiber.Dispose(); - } - - // 不允许外部调用,容易出现多线程问题, 只能通过消息通信,不允许直接获取其它Fiber引用 - internal Fiber Get(int id) - { - this.fibers.TryGetValue(id, out Fiber fiber); - return fiber; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberManager.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberManager.cs.meta deleted file mode 100644 index 786fe1e4..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/FiberManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9f3c27be2da070a4384fb15a77ba2c33 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/IScheduler.cs b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/IScheduler.cs deleted file mode 100644 index f302b1c4..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/IScheduler.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ET -{ - public interface IScheduler: IDisposable - { - void Add(int fiberId); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/IScheduler.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/IScheduler.cs.meta deleted file mode 100644 index edfec6cd..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/IScheduler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a8de74cf443d4f743a98f86531df4360 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/MainThreadScheduler.cs b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/MainThreadScheduler.cs deleted file mode 100644 index 310adf01..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/MainThreadScheduler.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; - -namespace ET -{ - internal class MainThreadScheduler: IScheduler - { - private readonly ConcurrentQueue idQueue = new(); - private readonly ConcurrentQueue addIds = new(); - private readonly FiberManager fiberManager; - private readonly ThreadSynchronizationContext threadSynchronizationContext = new(); - - public MainThreadScheduler(FiberManager fiberManager) - { - SynchronizationContext.SetSynchronizationContext(this.threadSynchronizationContext); - this.fiberManager = fiberManager; - } - - public void Dispose() - { - this.addIds.Clear(); - this.idQueue.Clear(); - } - - public void Update() - { - SynchronizationContext.SetSynchronizationContext(this.threadSynchronizationContext); - this.threadSynchronizationContext.Update(); - - int count = this.idQueue.Count; - while (count-- > 0) - { - if (!this.idQueue.TryDequeue(out int id)) - { - continue; - } - - Fiber fiber = this.fiberManager.Get(id); - if (fiber == null) - { - continue; - } - - if (fiber.IsDisposed) - { - continue; - } - - SynchronizationContext.SetSynchronizationContext(fiber.ThreadSynchronizationContext); - fiber.Update(); - - this.idQueue.Enqueue(id); - } - } - - public void LateUpdate() - { - int count = this.idQueue.Count; - while (count-- > 0) - { - if (!this.idQueue.TryDequeue(out int id)) - { - continue; - } - - Fiber fiber = this.fiberManager.Get(id); - if (fiber == null) - { - continue; - } - - if (fiber.IsDisposed) - { - continue; - } - - SynchronizationContext.SetSynchronizationContext(fiber.ThreadSynchronizationContext); - fiber.LateUpdate(); - - this.idQueue.Enqueue(id); - } - - while (this.addIds.Count > 0) - { - this.addIds.TryDequeue(out int result); - this.idQueue.Enqueue(result); - } - } - - - public void Add(int fiberId = 0) - { - this.addIds.Enqueue(fiberId); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/MainThreadScheduler.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/MainThreadScheduler.cs.meta deleted file mode 100644 index b787c445..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/MainThreadScheduler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bd9f51e035ab0784586df7b7e604072e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadPoolScheduler.cs b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadPoolScheduler.cs deleted file mode 100644 index 31793b85..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadPoolScheduler.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; - -namespace ET -{ - internal class ThreadPoolScheduler: IScheduler - { - private readonly List threads; - - private readonly ConcurrentQueue idQueue = new(); - - private readonly FiberManager fiberManager; - - public ThreadPoolScheduler(FiberManager fiberManager) - { - this.fiberManager = fiberManager; - int threadCount = Environment.ProcessorCount; - this.threads = new List(threadCount); - for (int i = 0; i < threadCount; ++i) - { - Thread thread = new(this.Loop); - this.threads.Add(thread); - thread.Start(); - } - } - - private void Loop() - { - while (true) - { - if (this.fiberManager.IsDisposed()) - { - return; - } - - if (!this.idQueue.TryDequeue(out int id)) - { - Thread.Sleep(1); - continue; - } - - Fiber fiber = this.fiberManager.Get(id); - if (fiber == null) - { - continue; - } - - if (fiber.IsDisposed) - { - continue; - } - SynchronizationContext.SetSynchronizationContext(fiber.ThreadSynchronizationContext); - fiber.Update(); - fiber.LateUpdate(); - SynchronizationContext.SetSynchronizationContext(null); - - this.idQueue.Enqueue(id); - - Thread.Sleep(1); - } - } - - public void Dispose() - { - foreach (Thread thread in this.threads) - { - thread.Join(); - } - } - - public void Add(int fiberId) - { - this.idQueue.Enqueue(fiberId); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadPoolScheduler.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadPoolScheduler.cs.meta deleted file mode 100644 index 78f41752..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadPoolScheduler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d14b7a106ddb98e4f928f6aeef60d86f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadScheduler.cs b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadScheduler.cs deleted file mode 100644 index dcdecafd..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadScheduler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; - -namespace ET -{ - // 一个Fiber一个固定的线程 - internal class ThreadScheduler: IScheduler - { - private readonly ConcurrentDictionary dictionary = new(); - - private readonly FiberManager fiberManager; - - public ThreadScheduler(FiberManager fiberManager) - { - this.fiberManager = fiberManager; - } - - private void Loop(int fiberId) - { - Fiber fiber = fiberManager.Get(fiberId); - SynchronizationContext.SetSynchronizationContext(fiber.ThreadSynchronizationContext); - - while (true) - { - if (this.fiberManager.IsDisposed()) - { - return; - } - - fiber = fiberManager.Get(fiberId); - if (fiber == null) - { - this.dictionary.Remove(fiberId, out _); - return; - } - - if (fiber.IsDisposed) - { - this.dictionary.Remove(fiberId, out _); - return; - } - - fiber.Update(); - fiber.LateUpdate(); - - Thread.Sleep(1); - } - } - - public void Dispose() - { - foreach (var kv in this.dictionary.ToArray()) - { - kv.Value.Join(); - } - } - - public void Add(int fiberId) - { - Thread thread = new(() => this.Loop(fiberId)); - this.dictionary.TryAdd(fiberId, thread); - thread.Start(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadScheduler.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadScheduler.cs.meta deleted file mode 100644 index 82dbeb4f..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Fiber/ThreadScheduler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7267a4e71eb917547afb0bdd52d9a360 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater.meta b/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater.meta deleted file mode 100644 index 8fd2c678..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7e3e2aed9e0845edb35993d7496f871f -timeCreated: 1687098052 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater/IdValueGenerater.cs b/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater/IdValueGenerater.cs deleted file mode 100644 index 27bc869f..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater/IdValueGenerater.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace ET -{ - public class IdValueGenerater: Singleton, ISingletonAwake - { - private uint value; - - public uint Value - { - get - { - lock (this) - { - if (++this.value > IdGenerater.Mask20bit - 1) - { - this.value = 0; - } - return this.value; - } - } - } - - public void Awake() - { - - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater/IdValueGenerater.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater/IdValueGenerater.cs.meta deleted file mode 100644 index c695bf96..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/IdGenerater/IdValueGenerater.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: d4510ce4f5e843f9a9efc99d1714845a -timeCreated: 1687098066 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log.meta b/Assets/GameScripts/DotNet/Core/World/Module/Log.meta deleted file mode 100644 index 06683f90..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 057d576e460d8e44182a6f4b62585eb0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/ILog.cs b/Assets/GameScripts/DotNet/Core/World/Module/Log/ILog.cs deleted file mode 100644 index 14b0ddc8..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/ILog.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ET -{ - public interface ILog - { - void Trace(string message); - void Warning(string message); - void Info(string message); - void Debug(string message); - void Error(string message); - void Fatal(string message); - void Trace(string message, params object[] args); - void Warning(string message, params object[] args); - void Info(string message, params object[] args); - void Debug(string message, params object[] args); - void Error(string message, params object[] args); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/ILog.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Log/ILog.cs.meta deleted file mode 100644 index c0337188..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/ILog.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 63e88312339ec39479bf5054c7f5698b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/Log.cs b/Assets/GameScripts/DotNet/Core/World/Module/Log/Log.cs deleted file mode 100644 index 39df78ea..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/Log.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Diagnostics; - -namespace ET -{ - public static class Log - { - [Conditional("DEBUG")] - public static void Trace(string msg) - { - Logger.Instance.Trace(msg); - } - - [Conditional("DEBUG")] - public static void Debug(string msg) - { - Logger.Instance.Debug(msg); - } - - public static void Info(string msg) - { - Logger.Instance.Info(msg); - } - - [Conditional("DEBUG")] - public static void Warning(string msg) - { - Logger.Instance.Warning(msg); - } - - public static void Error(string msg) - { - Logger.Instance.Error(msg); - } - - public static void Fatal(Exception msg) - { - Logger.Instance.Fatal(msg.Message); - } - - public static void Fatal(string msg) - { - Logger.Instance.Fatal(msg); - } - - public static void Error(Exception msg) - { - Logger.Instance.Error(msg); - } - - [Conditional("DEBUG")] - public static void Console(string msg) - { - Logger.Instance.Console(msg); - } - -#if DOTNET - [Conditional("DEBUG")] - public static void Trace(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Trace(message.ToStringAndClear()); - } - [Conditional("DEBUG")] - public static void Warning(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Warning(message.ToStringAndClear()); - } - - public static void Info(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Info(message.ToStringAndClear()); - } - [Conditional("DEBUG")] - public static void Debug(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Debug(message.ToStringAndClear()); - } - - public static void Error(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Error(message.ToStringAndClear()); - } - [Conditional("DEBUG")] - public static void Console(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Console(message.ToStringAndClear()); - } -#endif - } -} diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/Log.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Log/Log.cs.meta deleted file mode 100644 index 82e53d0a..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/Log.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bdc1761525ecfa642b1780a6b4e0243d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/Logger.cs b/Assets/GameScripts/DotNet/Core/World/Module/Log/Logger.cs deleted file mode 100644 index a598e555..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/Logger.cs +++ /dev/null @@ -1,294 +0,0 @@ -using System.Diagnostics; -using System.Text; - -namespace ET -{ - public class Logger : Singleton, ISingletonAwake - { - private ILog iLog; - - public ILog ILog - { - set { this.iLog = value; } - } - - public enum LogLevel - { - INFO, - SUCCESSED, - ASSERT, - WARNING, - ERROR, - EXCEPTION, - } - - public void Awake() - { - } - - private LogLevel _filterLevel = LogLevel.INFO; - private StringBuilder _stringBuilder = new StringBuilder(); - - private const int TraceLevel = 1; - private const int DebugLevel = 2; - private const int InfoLevel = 3; - private const int WarningLevel = 4; - - private bool CheckLogLevel(int level) - { - if (Options.Instance == null) - { - return true; - } - - return Options.Instance.LogLevel <= level; - } - - public void Trace(string msg) - { - if (!CheckLogLevel(DebugLevel)) - { - return; - } - - StackTrace st = new StackTrace(2, true); - string log = $"{msg}\n{st}"; - this.Log(LogLevel.INFO, log); - this.iLog.Trace(log); - } - - public void Debug(string msg) - { - if (!CheckLogLevel(DebugLevel)) - { - return; - } - this.Log(LogLevel.INFO, msg); - this.iLog.Debug(msg); - } - - public void Info(string msg) - { - if (!CheckLogLevel(InfoLevel)) - { - return; - } - this.Log(LogLevel.INFO, msg); - this.iLog.Info(msg); - } - - public void TraceInfo(string msg) - { - if (!CheckLogLevel(InfoLevel)) - { - return; - } - - StackTrace st = new StackTrace(2, true); - string log = $"{msg}\n{st}"; - this.Log(LogLevel.INFO, msg); - this.iLog.Trace(log); - } - - public void Warning(string msg) - { - if (!CheckLogLevel(WarningLevel)) - { - return; - } - this.Log(LogLevel.WARNING, msg); - this.iLog.Warning(msg); - } - - public void Error(string msg) - { - StackTrace st = new StackTrace(2, true); - string log = $"{msg}\n{st}"; - this.Log(LogLevel.ERROR, log); - this.iLog.Error(log); - } - - public void Error(Exception e) - { - if (e.Data.Contains("StackTrace")) - { - this.iLog.Error($"{e.Data["StackTrace"]}\n{e}"); - return; - } - - string str = e.ToString(); - this.Log(LogLevel.ERROR, str); - this.iLog.Error(str); - } - - public void Fatal(string msg) - { - StackTrace st = new StackTrace(2, true); - this.iLog.Fatal($"{msg}\n{st}"); - } - - public void Trace(string message, params object[] args) - { - if (!CheckLogLevel(TraceLevel)) - { - return; - } - - StackTrace st = new StackTrace(2, true); - this.iLog.Trace($"{string.Format(message, args)}\n{st}"); - } - - public void Warning(string message, params object[] args) - { - if (!CheckLogLevel(WarningLevel)) - { - return; - } - - this.iLog.Warning(string.Format(message, args)); - } - - public void Info(string message, params object[] args) - { - if (!CheckLogLevel(InfoLevel)) - { - return; - } - - this.iLog.Info(string.Format(message, args)); - } - - public void Debug(string message, params object[] args) - { - if (!CheckLogLevel(DebugLevel)) - { - return; - } - - this.iLog.Debug(string.Format(message, args)); - } - - public void Error(string message, params object[] args) - { - StackTrace st = new StackTrace(2, true); - string s = string.Format(message, args) + '\n' + st; - this.iLog.Error(s); - } - - public void Console(string message) - { - if (Options.Instance.Console == 1) - { - this.Log(LogLevel.SUCCESSED, message); - } - - this.iLog.Debug(message); - } - - public void Console(string message, params object[] args) - { - string s = string.Format(message, args); - if (Options.Instance.Console == 1) - { - System.Console.WriteLine(s); - } - - this.iLog.Debug(s); - } - - private StringBuilder GetFormatString(LogLevel logLevel, string logString) - { - _stringBuilder.Clear(); - switch (logLevel) - { - case LogLevel.SUCCESSED: - _stringBuilder.AppendFormat( - "[TEngineServer][SUCCESSED][{0}] - {1}", - System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString); - break; - case LogLevel.INFO: - _stringBuilder.AppendFormat( - "[TEngineServer][INFO][{0}] - {1}", - System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString); - break; - case LogLevel.ASSERT: - _stringBuilder.AppendFormat( - "[TEngineServer][ASSERT][{0}] - {1}", - System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString); - break; - case LogLevel.WARNING: - _stringBuilder.AppendFormat( - "[TEngineServer][WARNING][{0}] - {1}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), - logString); - break; - case LogLevel.ERROR: - _stringBuilder.AppendFormat( - "[TEngineServer][ERROR][{0}] - {1}", - System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString); - break; - case LogLevel.EXCEPTION: - _stringBuilder.AppendFormat( - "[TEngineServer][EXCEPTION][{0}] - {1}", - System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString); - break; - } - - return _stringBuilder; - } - - private void Log(LogLevel type, string logString) - { - if (type < _filterLevel) - { - return; - } - - StringBuilder infoBuilder = GetFormatString(type, logString); - - if (type == LogLevel.ERROR || type == LogLevel.WARNING || type == LogLevel.EXCEPTION) - { - StackFrame[] sf = new StackTrace().GetFrames(); - for (int i = 0; i < sf.Length; i++) - { - StackFrame frame = sf[i]; - string declaringTypeName = frame.GetMethod()?.DeclaringType.FullName; - string methodName = frame.GetMethod()?.Name; - infoBuilder.AppendFormat("[{0}::{1}\n", declaringTypeName, methodName); - } - } - - string logStr = infoBuilder.ToString(); - - if (type == LogLevel.INFO) - { - System.Console.ForegroundColor = ConsoleColor.White; - System.Console.WriteLine(logStr); - } - else if (type == LogLevel.SUCCESSED) - { - System.Console.ForegroundColor = ConsoleColor.Green; - System.Console.WriteLine(logStr); - } - else if (type == LogLevel.WARNING) - { - System.Console.ForegroundColor = ConsoleColor.DarkYellow; - System.Console.WriteLine(logStr); - } - else if (type == LogLevel.ASSERT) - { - System.Console.ForegroundColor = ConsoleColor.Red; - System.Console.WriteLine(logStr); - } - else if (type == LogLevel.ERROR) - { - System.Console.ForegroundColor = ConsoleColor.Red; - System.Console.WriteLine(logStr); - } - else if (type == LogLevel.EXCEPTION) - { - System.Console.ForegroundColor = ConsoleColor.Magenta; - System.Console.WriteLine(logStr); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/Logger.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Log/Logger.cs.meta deleted file mode 100644 index ffb428a0..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/Logger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7d233baf6c97d1c4da67228e2a2e14e8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/NLogger.cs b/Assets/GameScripts/DotNet/Core/World/Module/Log/NLogger.cs deleted file mode 100644 index b64e9e63..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/NLogger.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using NLog; - -namespace ET -{ - public class NLogger: ILog - { - private readonly NLog.Logger logger; - - public NLogger(string name, int process, string configPath) - { - LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(configPath); - LogManager.Configuration.Variables["appIdFormat"] = $"{process:000000}"; - LogManager.Configuration.Variables["currentDir"] = Environment.CurrentDirectory; - this.logger = LogManager.GetLogger(name); - } - - public void Trace(string message) - { - this.logger.Trace(message); - } - - public void Warning(string message) - { - this.logger.Warn(message); - } - - public void Info(string message) - { - this.logger.Info(message); - } - - public void Debug(string message) - { - this.logger.Debug(message); - } - - public void Error(string message) - { - this.logger.Error(message); - } - - public void Fatal(string message) - { - this.logger.Fatal(message); - } - - public void Trace(string message, params object[] args) - { - this.logger.Trace(message, args); - } - - public void Warning(string message, params object[] args) - { - this.logger.Warn(message, args); - } - - public void Info(string message, params object[] args) - { - this.logger.Info(message, args); - } - - public void Debug(string message, params object[] args) - { - this.logger.Debug(message, args); - } - - public void Error(string message, params object[] args) - { - this.logger.Error(message, args); - } - - public void Fatal(string message, params object[] args) - { - this.logger.Fatal(message, args); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Log/NLogger.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Log/NLogger.cs.meta deleted file mode 100644 index 1f4ba62b..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Log/NLogger.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bfdee72346bcdc149b84d5348ba2e350 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool.meta b/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool.meta deleted file mode 100644 index d3cfc0c0..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7d7d79a71ec52a14eb7c9a98c74edf1c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool/ObjectPool.cs b/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool/ObjectPool.cs deleted file mode 100644 index 25686c89..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool/ObjectPool.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class ObjectPool: Singleton, ISingletonAwake - { - private Dictionary> pool; - - public void Awake() - { - lock (this) - { - this.pool = new Dictionary>(); - } - } - - public T Fetch() where T: class - { - return this.Fetch(typeof (T)) as T; - } - - public object Fetch(Type type) - { - lock (this) - { - Queue queue = null; - object o; - if (!pool.TryGetValue(type, out queue)) - { - o = Activator.CreateInstance(type); - } - else if (queue.Count == 0) - { - o = Activator.CreateInstance(type); - } - else - { - o = queue.Dequeue(); - } - - if (o is IPool iPool) - { - iPool.IsFromPool = true; - } - return o; - } - } - - public void Recycle(object obj) - { - if (obj is IPool p) - { - if (!p.IsFromPool) - { - return; - } - // 防止多次入池 - p.IsFromPool = false; - } - - Type type = obj.GetType(); - - RecycleInner(type, obj); - } - - private void RecycleInner(Type type, object obj) - { - lock (this) - { - Queue queue = null; - if (!pool.TryGetValue(type, out queue)) - { - queue = new Queue(); - pool.Add(type, queue); - } - - // 一种对象最大为1000个 - if (queue.Count > 1000) - { - return; - } - - queue.Enqueue(obj); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool/ObjectPool.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool/ObjectPool.cs.meta deleted file mode 100644 index a24cf304..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/ObjectPool/ObjectPool.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9ce562c445bed294d9fa3a5ea333cb7b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Options.meta b/Assets/GameScripts/DotNet/Core/World/Module/Options.meta deleted file mode 100644 index 02e283d0..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Options.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b0ae23f776aa91d40a8d8b6a21ba483f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Options/Options.cs b/Assets/GameScripts/DotNet/Core/World/Module/Options/Options.cs deleted file mode 100644 index 38c30da9..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Options/Options.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CommandLine; -using System; -using System.Collections.Generic; - -namespace ET -{ - public enum AppType - { - Server, - Watcher, // 每台物理机一个守护进程,用来启动该物理机上的所有进程 - GameTool, - ExcelExporter, - Proto2CS, - BenchmarkClient, - BenchmarkServer, - - Demo, - LockStep, - } - - public class Options: Singleton - { - [Option("AppType", Required = false, Default = AppType.Server, HelpText = "AppType enum")] - public AppType AppType { get; set; } - - [Option("StartConfig", Required = false, Default = "StartConfig/Localhost")] - public string StartConfig { get; set; } - - [Option("Process", Required = false, Default = 1)] - public int Process { get; set; } - - [Option("Develop", Required = false, Default = 0, HelpText = "develop mode, 0正式 1开发 2压测")] - public int Develop { get; set; } - - [Option("LogLevel", Required = false, Default = 2)] - public int LogLevel { get; set; } - - [Option("Console", Required = false, Default = 0)] - public int Console { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Module/Options/Options.cs.meta b/Assets/GameScripts/DotNet/Core/World/Module/Options/Options.cs.meta deleted file mode 100644 index d5b0a7d0..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Module/Options/Options.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c6389212976f63749bf647192099cbab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/Singleton.cs b/Assets/GameScripts/DotNet/Core/World/Singleton.cs deleted file mode 100644 index 9715fd85..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Singleton.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Threading; - -namespace ET -{ - public interface ISingleton: IDisposable - { - void Register(); - - } - - public abstract class Singleton: ISingleton where T: Singleton, new() - { - protected bool isDisposed; - - [StaticField] - private static T instance; - - public static T Instance - { - get - { - return instance; - } - private set - { - instance = value; - } - } - - public virtual void Register() - { - Instance = (T)this; - } - - public bool IsDisposed() - { - return this.isDisposed; - } - - protected virtual void Destroy() - { - - } - - void IDisposable.Dispose() - { - if (this.isDisposed) - { - return; - } - - this.isDisposed = true; - - this.Destroy(); - } - } - - public abstract class SingletonLock: ISingleton, ISingletonLoad where T: SingletonLock, new() - { - private bool isDisposed; - - [StaticField] - private static T instance; - - [StaticField] - private static object lockObj = new(); - - public static T Instance - { - get - { - lock (lockObj) - { - return instance; - } - } - private set - { - lock (lockObj) - { - instance = value; - } - } - } - - public virtual void Register() - { - Instance = (T)this; - } - - public bool IsDisposed() - { - return this.isDisposed; - } - - protected virtual void Destroy() - { - - } - - void IDisposable.Dispose() - { - if (this.isDisposed) - { - return; - } - - this.isDisposed = true; - - Instance = null; - - this.Destroy(); - } - - public abstract void Load(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/Singleton.cs.meta b/Assets/GameScripts/DotNet/Core/World/Singleton.cs.meta deleted file mode 100644 index 31386926..00000000 --- a/Assets/GameScripts/DotNet/Core/World/Singleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 101c23054b29c3247bcfcedb81ff4d38 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Core/World/World.cs b/Assets/GameScripts/DotNet/Core/World/World.cs deleted file mode 100644 index ad80eaec..00000000 --- a/Assets/GameScripts/DotNet/Core/World/World.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class World: IDisposable - { - [StaticField] - private static World instance; - - public static World Instance - { - get - { - return instance ??= new World(); - } - } - - private readonly Stack stack = new(); - private readonly Dictionary singletons = new(); - - private World() - { - } - - public void Dispose() - { - instance = null; - - lock (this) - { - while (this.stack.Count > 0) - { - Type type = this.stack.Pop(); - this.singletons[type].Dispose(); - } - } - } - - public T AddSingleton(bool replace = false) where T : class, ISingleton, ISingletonAwake, new() - { - T singleton = new(); - singleton.Awake(); - - AddSingleton(singleton, replace); - return singleton; - } - - public T AddSingleton(A a, bool replace = false) where T : class, ISingleton, ISingletonAwake, new() - { - T singleton = new(); - singleton.Awake(a); - - AddSingleton(singleton, replace); - return singleton; - } - - public T AddSingleton(A a, B b, bool replace = false) where T : class, ISingleton, ISingletonAwake, new() - { - T singleton = new(); - singleton.Awake(a, b); - - AddSingleton(singleton, replace); - return singleton; - } - - public T AddSingleton(A a, B b, C c, bool replace = false) where T : class, ISingleton, ISingletonAwake, new() - { - T singleton = new(); - singleton.Awake(a, b, c); - - AddSingleton(singleton, replace); - return singleton; - } - - public void AddSingleton(ISingleton singleton, bool replace = false) - { - lock (this) - { - Type type = singleton.GetType(); - if (!replace) - { - this.stack.Push(type); - } - singletons[type] = singleton; - } - - singleton.Register(); - } - - public void Load() - { - lock (this) - { - foreach (Type type in this.stack) - { - ISingleton singleton = this.singletons[type]; - - if (singleton is not ISingletonLoad iSingletonLoad) - { - continue; - } - - iSingletonLoad.Load(); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Core/World/World.cs.meta b/Assets/GameScripts/DotNet/Core/World/World.cs.meta deleted file mode 100644 index 238d6367..00000000 --- a/Assets/GameScripts/DotNet/Core/World/World.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 631ee3459f804c34f8662d64e91a65de -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix.meta b/Assets/GameScripts/DotNet/Hotfix.meta deleted file mode 100644 index 5871a0a2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9ba84cf31ac8f984ba492a630b77e730 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client.meta b/Assets/GameScripts/DotNet/Hotfix/Client.meta deleted file mode 100644 index e73e0a5a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e6f4f17f8f98c674f938707b3613d4ce -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo.meta deleted file mode 100644 index 666aa862..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4cb05eea2613caf458483a4ce7afbf94 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI.meta deleted file mode 100644 index 208dabdc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d2c1d7db177785844a4b941708d953b9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_Attack.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_Attack.cs deleted file mode 100644 index ff14358c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_Attack.cs +++ /dev/null @@ -1,43 +0,0 @@ -namespace ET.Client -{ - public class AI_Attack: AAIHandler - { - public override int Check(AIComponent aiComponent, AIConfig aiConfig) - { - long sec = aiComponent.Fiber().TimeInfo.ClientNow() / 1000 % 15; - if (sec >= 10) - { - return 0; - } - return 1; - } - - public override async ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken) - { - Fiber fiber = aiComponent.Fiber(); - - Unit myUnit = UnitHelper.GetMyUnitFromClientScene(fiber.Root); - if (myUnit == null) - { - return; - } - - // 停在当前位置 - fiber.Root.GetComponent().Send(new C2M_Stop()); - - Log.Debug("开始攻击"); - - for (int i = 0; i < 100000; ++i) - { - Log.Debug($"攻击: {i}次"); - - // 因为协程可能被中断,任何协程都要传入cancellationToken,判断如果是中断则要返回 - await fiber.TimerComponent.WaitAsync(1000, cancellationToken); - if (cancellationToken.IsCancel()) - { - return; - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_Attack.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_Attack.cs.meta deleted file mode 100644 index 3c338b54..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_Attack.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: de532cb8e5e687a4bb61aa666459d086 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_XunLuo.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_XunLuo.cs deleted file mode 100644 index ceb6a6f3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_XunLuo.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Unity.Mathematics; - -namespace ET.Client -{ - public class AI_XunLuo: AAIHandler - { - public override int Check(AIComponent aiComponent, AIConfig aiConfig) - { - long sec = aiComponent.Fiber().TimeInfo.ClientNow() / 1000 % 15; - if (sec < 10) - { - return 0; - } - return 1; - } - - public override async ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken) - { - Scene root = aiComponent.Root(); - - Unit myUnit = UnitHelper.GetMyUnitFromClientScene(root); - if (myUnit == null) - { - return; - } - - Log.Debug("开始巡逻"); - - while (true) - { - XunLuoPathComponent xunLuoPathComponent = myUnit.GetComponent(); - float3 nextTarget = xunLuoPathComponent.GetCurrent(); - await myUnit.MoveToAsync(nextTarget, cancellationToken); - if (cancellationToken.IsCancel()) - { - return; - } - xunLuoPathComponent.MoveNext(); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_XunLuo.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_XunLuo.cs.meta deleted file mode 100644 index df7173bf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/AI_XunLuo.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4d77ea7dfe040894aa330386e3b7bb8f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs deleted file mode 100644 index 73bbcc5b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Unity.Mathematics; - -namespace ET.Client -{ - [FriendOf(typeof(XunLuoPathComponent))] - public static partial class XunLuoPathComponentSystem - { - public static float3 GetCurrent(this XunLuoPathComponent self) - { - return self.path[self.Index]; - } - - public static void MoveNext(this XunLuoPathComponent self) - { - self.Index = ++self.Index % self.path.Length; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs.meta deleted file mode 100644 index 3e67e411..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/AI/XunLuoPathComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4293e004a928ffb43bf52f374808d139 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main.meta deleted file mode 100644 index a29d0dda..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2e5141370ec84e1282c5d0a38f2ef25b -timeCreated: 1688537612 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs deleted file mode 100644 index faa34081..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace ET.Client -{ - [EntitySystemOf(typeof(ClientSenderCompnent))] - [FriendOf(typeof(ClientSenderCompnent))] - public static partial class ClientSenderCompnentSystem - { - [EntitySystem] - private static void Awake(this ClientSenderCompnent self) - { - - } - - [EntitySystem] - private static void Destroy(this ClientSenderCompnent self) - { - if (self.fiberId != 0) - { - FiberManager.Instance.Remove(self.fiberId); - } - } - - public static async ETTask LoginAsync(this ClientSenderCompnent self, string account, string password) - { - self.fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, 0, SceneType.NetClient, ""); - self.netClientActorId = new ActorId(self.Fiber().Process, self.fiberId); - - NetClient2Main_Login response = await self.Fiber().ActorInnerComponent.Call(self.netClientActorId, new Main2NetClient_Login() { Account = account, Password = password }) as NetClient2Main_Login; - return response.PlayerId; - } - - public static void Send(this ClientSenderCompnent self, IMessage message) - { - A2NetClient_Message a2NetClientMessage = A2NetClient_Message.Create(); - a2NetClientMessage.MessageObject = message; - self.Fiber().ActorInnerComponent.Send(self.netClientActorId, a2NetClientMessage); - } - - public static async ETTask Call(this ClientSenderCompnent self, IRequest request, bool needException = true) - { - A2NetClient_Request a2NetClientRequest = A2NetClient_Request.Create(); - a2NetClientRequest.MessageObject = request; - A2NetClient_Response response = await self.Fiber().ActorInnerComponent.Call(self.netClientActorId, a2NetClientRequest, needException: needException) as A2NetClient_Response; - return response.MessageObject; - } - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs.meta deleted file mode 100644 index fb8ffc55..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a11bff036359a2143aca1de23150ce40 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login.meta deleted file mode 100644 index f11bf8b3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c38213e2fca6b8b489ffb3fee170c51f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs deleted file mode 100644 index be63639b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; - - -namespace ET.Client -{ - public static partial class EnterMapHelper - { - public static async ETTask EnterMapAsync(Scene root) - { - try - { - G2C_EnterMap g2CEnterMap = await root.GetComponent().Call(new C2G_EnterMap()) as G2C_EnterMap; - - // 等待场景切换完成 - await root.GetComponent().Wait(); - - EventSystem.Instance.Publish(root, new EventType.EnterMapFinish()); - } - catch (Exception e) - { - Log.Error(e); - } - } - - public static async ETTask Match(Fiber fiber) - { - try - { - G2C_Match g2CEnterMap = await fiber.Root.GetComponent().Call(new C2G_Match()) as G2C_Match; - } - catch (Exception e) - { - Log.Error(e); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs.meta deleted file mode 100644 index 0534bd76..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 25a13c7e1f3127848a33352576e747c9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move.meta deleted file mode 100644 index bd7cc1a7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0e5f376ea66398e4f8d5fc5d700b4373 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_PathfindingResultHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_PathfindingResultHandler.cs deleted file mode 100644 index 9e9afbba..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_PathfindingResultHandler.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.Demo)] - public class M2C_PathfindingResultHandler : ActorMessageHandler - { - protected override async ETTask Run(Scene root, M2C_PathfindingResult message) - { - Unit unit = root.CurrentScene().GetComponent().Get(message.Id); - - float speed = unit.GetComponent().GetAsFloat(NumericType.Speed); - - await unit.GetComponent().MoveToAsync(message.Points, speed); - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_PathfindingResultHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_PathfindingResultHandler.cs.meta deleted file mode 100644 index 854c0409..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_PathfindingResultHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 46ac4bf2b7bf6ea468ccbfbf09367733 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_StopHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_StopHandler.cs deleted file mode 100644 index 3701314a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_StopHandler.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Unity.Mathematics; - -namespace ET.Client -{ - [ActorMessageHandler(SceneType.Demo)] - public class M2C_StopHandler : ActorMessageHandler - { - protected override async ETTask Run(Scene root, M2C_Stop message) - { - Unit unit = root.CurrentScene().GetComponent().Get(message.Id); - if (unit == null) - { - return; - } - - MoveComponent moveComponent = unit.GetComponent(); - moveComponent.Stop(message.Error == 0); - unit.Position = message.Position; - unit.Rotation = message.Rotation; - unit.GetComponent()?.Notify(new Wait_UnitStop() {Error = message.Error}); - await ETTask.CompletedTask; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_StopHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_StopHandler.cs.meta deleted file mode 100644 index 58e29521..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/M2C_StopHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eb3ae6bd37192c648b88723824beaaa7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/MoveHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/MoveHelper.cs deleted file mode 100644 index 17478892..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/MoveHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using System.Numerics; -using Unity.Mathematics; - -namespace ET.Client -{ - public static partial class MoveHelper - { - // 可以多次调用,多次调用的话会取消上一次的协程 - public static async ETTask MoveToAsync(this Unit unit, float3 targetPos, ETCancellationToken cancellationToken = null) - { - C2M_PathfindingResult msg = new C2M_PathfindingResult() { Position = targetPos }; - unit.Root().GetComponent().Send(msg); - - ObjectWait objectWait = unit.GetComponent(); - - // 要取消上一次的移动协程 - objectWait.Notify(new Wait_UnitStop() { Error = WaitTypeError.Cancel }); - - // 一直等到unit发送stop - Wait_UnitStop waitUnitStop = await objectWait.Wait(cancellationToken); - if (cancellationToken.IsCancel()) - { - return WaitTypeError.Cancel; - } - return waitUnitStop.Error; - } - - public static async ETTask MoveToAsync(this Unit unit, List path) - { - float speed = unit.GetComponent().GetAsFloat(NumericType.Speed); - MoveComponent moveComponent = unit.GetComponent(); - await moveComponent.MoveToAsync(path, speed); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/MoveHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/MoveHelper.cs.meta deleted file mode 100644 index 9c8f16b1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Move/MoveHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9517a733443387b49a227cfb10aa82d6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/NetClient2Main_SessionDisposeHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/NetClient2Main_SessionDisposeHandler.cs deleted file mode 100644 index 22e19910..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/NetClient2Main_SessionDisposeHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.All)] - public class NetClient2Main_SessionDisposeHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene entity, NetClient2Main_SessionDispose message) - { - Log.Error($"session dispose, error: {message.Error}"); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/NetClient2Main_SessionDisposeHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/NetClient2Main_SessionDisposeHandler.cs.meta deleted file mode 100644 index bce04a8f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/NetClient2Main_SessionDisposeHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9fbd99f39ddd82042af56cdbf9ce8dc3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene.meta deleted file mode 100644 index 2ab30166..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d507c6bfa0e3424380311d17689451c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs deleted file mode 100644 index 957ba610..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace ET.Client -{ - public static class CurrentSceneFactory - { - public static Scene Create(long id, string name, CurrentScenesComponent currentScenesComponent) - { - Scene currentScene = EntitySceneFactory.CreateScene(currentScenesComponent, id, currentScenesComponent.Fiber().IdGenerater.GenerateInstanceId(), SceneType.Current, name); - currentScenesComponent.Scene = currentScene; - - EventSystem.Instance.Publish(currentScene, new EventType.AfterCreateCurrentScene()); - return currentScene; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs.meta deleted file mode 100644 index b9461fa4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d7e7628945100a44193d11f6c86856fb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/M2C_StartSceneChangeHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/M2C_StartSceneChangeHandler.cs deleted file mode 100644 index 0c733cb9..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/M2C_StartSceneChangeHandler.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.Demo)] - public class M2C_StartSceneChangeHandler : ActorMessageHandler - { - protected override async ETTask Run(Scene root, M2C_StartSceneChange message) - { - await SceneChangeHelper.SceneChangeTo(root, message.SceneName, message.SceneInstanceId); - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/M2C_StartSceneChangeHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/M2C_StartSceneChangeHandler.cs.meta deleted file mode 100644 index a3aef18a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/M2C_StartSceneChangeHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5ba66d6939e13bc47b59fe326cac0526 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/SceneChangeHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/SceneChangeHelper.cs deleted file mode 100644 index f485a11e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/SceneChangeHelper.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace ET.Client -{ - public static partial class SceneChangeHelper - { - // 场景切换协程 - public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId) - { - root.RemoveComponent(); - - CurrentScenesComponent currentScenesComponent = root.GetComponent(); - currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的 - Scene currentScene = CurrentSceneFactory.Create(sceneInstanceId, sceneName, currentScenesComponent); - UnitComponent unitComponent = currentScene.AddComponent(); - - // 可以订阅这个事件中创建Loading界面 - EventSystem.Instance.Publish(root, new EventType.SceneChangeStart()); - // 等待CreateMyUnit的消息 - Wait_CreateMyUnit waitCreateMyUnit = await root.GetComponent().Wait(); - M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message; - Unit unit = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit); - unitComponent.Add(unit); - root.RemoveComponent(); - - EventSystem.Instance.Publish(currentScene, new EventType.SceneChangeFinish()); - // 通知等待场景切换的协程 - root.GetComponent().Notify(new Wait_SceneChangeFinish()); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/SceneChangeHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/SceneChangeHelper.cs.meta deleted file mode 100644 index 7948bcf8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Scene/SceneChangeHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eff9697e3de79f54dbfd7996f55c6f47 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit.meta deleted file mode 100644 index d14e721e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b99fb42c78388f147beaf9a963a80458 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateMyUnitHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateMyUnitHandler.cs deleted file mode 100644 index ea7e3030..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateMyUnitHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.Demo)] - public class M2C_CreateMyUnitHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, M2C_CreateMyUnit message) - { - // 通知场景切换协程继续往下走 - root.GetComponent().Notify(new Wait_CreateMyUnit() {Message = message}); - await ETTask.CompletedTask; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateMyUnitHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateMyUnitHandler.cs.meta deleted file mode 100644 index 4e692a54..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateMyUnitHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 69fc464a314f79d46922ca7c44dad617 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateUnitsHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateUnitsHandler.cs deleted file mode 100644 index 80eed4f8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateUnitsHandler.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.Demo)] - public class M2C_CreateUnitsHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, M2C_CreateUnits message) - { - Scene currentScene = root.CurrentScene(); - UnitComponent unitComponent = currentScene.GetComponent(); - - foreach (UnitInfo unitInfo in message.Units) - { - if (unitComponent.Get(unitInfo.UnitId) != null) - { - continue; - } - Unit unit = UnitFactory.Create(currentScene, unitInfo); - } - await ETTask.CompletedTask; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateUnitsHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateUnitsHandler.cs.meta deleted file mode 100644 index 31944487..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_CreateUnitsHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0b8fc07def7b312469c243c3ccad1b39 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_RemoveUnitsHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_RemoveUnitsHandler.cs deleted file mode 100644 index b33fd9a4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_RemoveUnitsHandler.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.Demo)] - public class M2C_RemoveUnitsHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, M2C_RemoveUnits message) - { - UnitComponent unitComponent = root.CurrentScene()?.GetComponent(); - if (unitComponent == null) - { - return; - } - foreach (long unitId in message.Units) - { - unitComponent.Remove(unitId); - } - - await ETTask.CompletedTask; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_RemoveUnitsHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_RemoveUnitsHandler.cs.meta deleted file mode 100644 index 6a477a62..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/M2C_RemoveUnitsHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6c4d413c1206d8844b7f6ccc95dd2ce6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitFactory.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitFactory.cs deleted file mode 100644 index 414f19d5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitFactory.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Unity.Mathematics; - -namespace ET.Client -{ - public static partial class UnitFactory - { - public static Unit Create(Scene currentScene, UnitInfo unitInfo) - { - UnitComponent unitComponent = currentScene.GetComponent(); - Unit unit = unitComponent.AddChildWithId(unitInfo.UnitId, unitInfo.ConfigId); - unitComponent.Add(unit); - - unit.Position = unitInfo.Position; - unit.Forward = unitInfo.Forward; - - NumericComponent numericComponent = unit.AddComponent(); - - foreach (var kv in unitInfo.KV) - { - numericComponent.Set(kv.Key, kv.Value); - } - - unit.AddComponent(); - if (unitInfo.MoveInfo != null) - { - if (unitInfo.MoveInfo.Points.Count > 0) - { - unitInfo.MoveInfo.Points[0] = unit.Position; - unit.MoveToAsync(unitInfo.MoveInfo.Points).Coroutine(); - } - } - - unit.AddComponent(); - - unit.AddComponent(); - - EventSystem.Instance.Publish(unit.Scene(), new EventType.AfterUnitCreate() {Unit = unit}); - return unit; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitFactory.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitFactory.cs.meta deleted file mode 100644 index 1e7dac1e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f76a73cf5e806e9499c3eb92aeeb46d2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitHelper.cs deleted file mode 100644 index cc5b21b7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitHelper.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace ET.Client -{ - public static partial class UnitHelper - { - public static Unit GetMyUnitFromClientScene(Scene root) - { - PlayerComponent playerComponent = root.GetComponent(); - Scene currentScene = root.GetComponent().Scene; - return currentScene.GetComponent().Get(playerComponent.MyId); - } - - public static Unit GetMyUnitFromCurrentScene(Scene currentScene) - { - PlayerComponent playerComponent = currentScene.Root().GetComponent(); - return currentScene.GetComponent().Get(playerComponent.MyId); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitHelper.cs.meta deleted file mode 100644 index 5e9f6a4e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/Main/Unit/UnitHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 90e53c0be7b8aab4c827ed76d193ca42 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient.meta deleted file mode 100644 index 06b64e64..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b9016545e3eb60946afce20928d2d34b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_MessageHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_MessageHandler.cs deleted file mode 100644 index bc3d38a4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_MessageHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.NetClient)] - public class A2NetClient_MessageHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, A2NetClient_Message message) - { - root.GetComponent().Session.Send(message.MessageObject); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_MessageHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_MessageHandler.cs.meta deleted file mode 100644 index 6bdcd6e0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_MessageHandler.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 0f70391ff9eb499db68bae992a9c85b6 -timeCreated: 1688540041 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_RequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_RequestHandler.cs deleted file mode 100644 index 004fe39d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_RequestHandler.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.NetClient)] - public class A2NetClient_RequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, A2NetClient_Request request, A2NetClient_Response response) - { - response.MessageObject = await root.GetComponent().Session.Call(request.MessageObject); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_RequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_RequestHandler.cs.meta deleted file mode 100644 index 925208a1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/A2NetClient_RequestHandler.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f3ac2d21dada4f2b8b51b26e0efe891e -timeCreated: 1688540239 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs deleted file mode 100644 index 39aedfc1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace ET.Client -{ - [Invoke((long)SceneType.NetClient)] - public class FiberInit_NetClient: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs.meta deleted file mode 100644 index 8c63073c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/FiberInit_NetClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dee733932d1381941bc0496fc337341a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/LoginHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/LoginHelper.cs deleted file mode 100644 index e9073e5a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/LoginHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ET.Client -{ - public static class LoginHelper - { - public static async ETTask Login(Scene root, string account, string password) - { - root.RemoveComponent(); - ClientSenderCompnent clientSenderCompnent = root.AddComponent(); - - long playerId = await clientSenderCompnent.LoginAsync(account, password); - - root.GetComponent().MyId = playerId; - - await EventSystem.Instance.PublishAsync(root, new EventType.LoginFinish()); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/LoginHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/LoginHelper.cs.meta deleted file mode 100644 index 632a443f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/LoginHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5d8c6e9a02dc4ab41ad32d56d9594354 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs deleted file mode 100644 index 22a09653..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Net; -using System.Net.Sockets; - -namespace ET.Client -{ - [ActorMessageHandler(SceneType.NetClient)] - public class Main2NetClient_LoginHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, Main2NetClient_Login request, NetClient2Main_Login response) - { - string account = request.Account; - string password = request.Password; - // 创建一个ETModel层的Session - root.RemoveComponent(); - // 获取路由跟realmDispatcher地址 - RouterAddressComponent routerAddressComponent = root.GetComponent(); - if (routerAddressComponent == null) - { - routerAddressComponent = - root.AddComponent(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort); - await routerAddressComponent.Init(); - root.AddComponent(routerAddressComponent.RouterManagerIPAddress.AddressFamily); - } - IPEndPoint realmAddress = routerAddressComponent.GetRealmAddress(account); - - R2C_Login r2CLogin; - using (Session session = await RouterHelper.CreateRouterSession(root, realmAddress)) - { - r2CLogin = (R2C_Login)await session.Call(new C2R_Login() { Account = account, Password = password }); - } - - // 创建一个gate Session,并且保存到SessionComponent中 - Session gateSession = await RouterHelper.CreateRouterSession(root, NetworkHelper.ToIPEndPoint(r2CLogin.Address)); - gateSession.AddComponent(); - root.AddComponent().Session = gateSession; - G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(new C2G_LoginGate() { Key = r2CLogin.Key, GateId = r2CLogin.GateId }); - - Log.Debug("登陆gate成功!"); - - response.PlayerId = g2CLoginGate.PlayerId; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs.meta deleted file mode 100644 index d10937b6..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 02d16f101211408496a7e86b273ed882 -timeCreated: 1688536630 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping.meta deleted file mode 100644 index 8ab1c657..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 657f5f7736369e24786203c1c377ec14 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs deleted file mode 100644 index d1ad4aac..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -namespace ET.Client -{ - [EntitySystemOf(typeof(PingComponent))] - public static partial class PingComponentSystem - { - [EntitySystem] - private static void Awake(this PingComponent self) - { - self.PingAsync().Coroutine(); - } - - [EntitySystem] - private static void Destroy(this PingComponent self) - { - self.Ping = default; - } - - private static async ETTask PingAsync(this PingComponent self) - { - Session session = self.GetParent(); - long instanceId = self.InstanceId; - Fiber fiber = self.Fiber(); - - while (true) - { - if (self.InstanceId != instanceId) - { - return; - } - - long time1 = self.Fiber().TimeInfo.ClientNow(); - try - { - C2G_Ping c2GPing = C2G_Ping.Create(true); - using G2C_Ping response = await session.Call(c2GPing) as G2C_Ping; - - if (self.InstanceId != instanceId) - { - return; - } - - long time2 = self.Fiber().TimeInfo.ClientNow(); - self.Ping = time2 - time1; - - fiber.TimeInfo.ServerMinusClientTime = response.Time + (time2 - time1) / 2 - time2; - - await fiber.TimerComponent.WaitAsync(2000); - } - catch (RpcException e) - { - // session断开导致ping rpc报错,记录一下即可,不需要打成error - Log.Info($"ping error: {self.Id} {e.Error}"); - return; - } - catch (Exception e) - { - Log.Error($"ping error: \n{e}"); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs.meta deleted file mode 100644 index 79c0f299..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: df3747692b8ee23439aa241d5dcfabdc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router.meta deleted file mode 100644 index 73e750c2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0dd08876e79fc2e4e92db27f7a59b403 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/HttpClientHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/HttpClientHelper.cs deleted file mode 100644 index ff4cdeed..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/HttpClientHelper.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.IO; -using System.Net.Http; -using System.Threading; - -namespace ET.Client -{ - public static partial class HttpClientHelper - { - public static async ETTask Get(string link) - { - try - { - using HttpClient httpClient = new(); - HttpResponseMessage response = await httpClient.GetAsync(link); - string result = await response.Content.ReadAsStringAsync(); - return result; - } - catch (Exception e) - { - throw new Exception($"http request fail: {link.Substring(0,link.IndexOf('?'))}\n{e}"); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/HttpClientHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/HttpClientHelper.cs.meta deleted file mode 100644 index c7a6a974..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/HttpClientHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c6ca4a5394922f488127ebb53362456 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs deleted file mode 100644 index 7c103a33..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; - -namespace ET.Client -{ - [EntitySystemOf(typeof(RouterAddressComponent))] - [FriendOf(typeof(RouterAddressComponent))] - public static partial class RouterAddressComponentSystem - { - [EntitySystem] - private static void Awake(this RouterAddressComponent self, string address, int port) - { - self.RouterManagerHost = address; - self.RouterManagerPort = port; - } - - public static async ETTask Init(this RouterAddressComponent self) - { - self.RouterManagerIPAddress = NetworkHelper.GetHostAddress(self.RouterManagerHost); - await self.GetAllRouter(); - } - - private static async ETTask GetAllRouter(this RouterAddressComponent self) - { - string url = $"http://{self.RouterManagerHost}:{self.RouterManagerPort}/get_router?v={RandomGenerator.RandUInt32()}"; - Log.Debug($"start get router info: {url}"); - string routerInfo = await HttpClientHelper.Get(url); - Log.Debug($"recv router info: {routerInfo}"); - HttpGetRouterResponse httpGetRouterResponse = MongoHelper.FromJson(routerInfo); - self.Info = httpGetRouterResponse; - Log.Debug($"start get router info finish: {MongoHelper.ToJson(httpGetRouterResponse)}"); - - // 打乱顺序 - RandomGenerator.BreakRank(self.Info.Routers); - - self.WaitTenMinGetAllRouter().Coroutine(); - } - - // 等10分钟再获取一次 - public static async ETTask WaitTenMinGetAllRouter(this RouterAddressComponent self) - { - await self.Fiber().TimerComponent.WaitAsync(5 * 60 * 1000); - if (self.IsDisposed) - { - return; - } - await self.GetAllRouter(); - } - - public static IPEndPoint GetAddress(this RouterAddressComponent self) - { - if (self.Info.Routers.Count == 0) - { - return null; - } - - string address = self.Info.Routers[self.RouterIndex++ % self.Info.Routers.Count]; - string[] ss = address.Split(':'); - IPAddress ipAddress = IPAddress.Parse(ss[0]); - if (self.RouterManagerIPAddress.AddressFamily == AddressFamily.InterNetworkV6) - { - ipAddress = ipAddress.MapToIPv6(); - } - return new IPEndPoint(ipAddress, int.Parse(ss[1])); - } - - public static IPEndPoint GetRealmAddress(this RouterAddressComponent self, string account) - { - int v = account.Mode(self.Info.Realms.Count); - string address = self.Info.Realms[v]; - string[] ss = address.Split(':'); - IPAddress ipAddress = IPAddress.Parse(ss[0]); - //if (self.IPAddress.AddressFamily == AddressFamily.InterNetworkV6) - //{ - // ipAddress = ipAddress.MapToIPv6(); - //} - return new IPEndPoint(ipAddress, int.Parse(ss[1])); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs.meta deleted file mode 100644 index dcfebc23..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterAddressComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 567a551c7abf2fd4c9b592af991b609e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs deleted file mode 100644 index e4e218b6..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Net; - -namespace ET.Client -{ - [EntitySystemOf(typeof(RouterCheckComponent))] - public static partial class RouterCheckComponentSystem - { - [EntitySystem] - private static void Awake(this RouterCheckComponent self) - { - self.CheckAsync().Coroutine(); - } - - private static async ETTask CheckAsync(this RouterCheckComponent self) - { - Session session = self.GetParent(); - long instanceId = self.InstanceId; - Fiber fiber = self.Fiber(); - Scene root = fiber.Root; - while (true) - { - if (self.InstanceId != instanceId) - { - return; - } - - await fiber.TimerComponent.WaitAsync(1000); - - if (self.InstanceId != instanceId) - { - return; - } - - long time = self.Fiber().TimeInfo.ClientFrameTime(); - - if (time - session.LastRecvTime < 7 * 1000) - { - continue; - } - - try - { - long sessionId = session.Id; - - (uint localConn, uint remoteConn) = session.AService.GetChannelConn(sessionId); - - IPEndPoint realAddress = self.GetParent().RemoteAddress; - Log.Info($"get recvLocalConn start: {root.Id} {realAddress} {localConn} {remoteConn}"); - - (uint recvLocalConn, IPEndPoint routerAddress) = await RouterHelper.GetRouterAddress(root, realAddress, localConn, remoteConn); - if (recvLocalConn == 0) - { - Log.Error($"get recvLocalConn fail: {root.Id} {routerAddress} {realAddress} {localConn} {remoteConn}"); - continue; - } - - Log.Info($"get recvLocalConn ok: {root.Id} {routerAddress} {realAddress} {recvLocalConn} {localConn} {remoteConn}"); - - session.LastRecvTime = self.Fiber().TimeInfo.ClientNow(); - - session.AService.ChangeAddress(sessionId, routerAddress); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs.meta deleted file mode 100644 index ec06861e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterCheckComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 55f4125eddb1aa543bfdce8f42b4d5f9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs deleted file mode 100644 index 2d94dcf2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Net; -using System.Net.Sockets; - -namespace ET.Client -{ - public static partial class RouterHelper - { - // 注册router - public static async ETTask CreateRouterSession(Scene root, IPEndPoint address) - { - (uint recvLocalConn, IPEndPoint routerAddress) = await GetRouterAddress(root, address, 0, 0); - - if (recvLocalConn == 0) - { - throw new Exception($"get router fail: {root.Id} {address}"); - } - - Log.Info($"get router: {recvLocalConn} {routerAddress}"); - - Session routerSession = root.GetComponent().Create(routerAddress, address, recvLocalConn); - routerSession.AddComponent(); - routerSession.AddComponent(); - - return routerSession; - } - - public static async ETTask<(uint, IPEndPoint)> GetRouterAddress(Scene root, IPEndPoint address, uint localConn, uint remoteConn) - { - Log.Info($"start get router address: {root.Id} {address} {localConn} {remoteConn}"); - //return (RandomHelper.RandUInt32(), address); - RouterAddressComponent routerAddressComponent = root.GetComponent(); - IPEndPoint routerInfo = routerAddressComponent.GetAddress(); - - uint recvLocalConn = await Connect(root, routerInfo, address, localConn, remoteConn); - - Log.Info($"finish get router address: {root.Id} {address} {localConn} {remoteConn} {recvLocalConn} {routerInfo}"); - return (recvLocalConn, routerInfo); - } - - // 向router申请 - private static async ETTask Connect(Scene root, IPEndPoint routerAddress, IPEndPoint realAddress, uint localConn, uint remoteConn) - { - uint connectId = RandomGenerator.RandUInt32(); - - using Socket socket = new Socket(routerAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp); - - int count = 20; - byte[] sendCache = new byte[512]; - byte[] recvCache = new byte[512]; - - uint synFlag = localConn == 0? KcpProtocalType.RouterSYN : KcpProtocalType.RouterReconnectSYN; - sendCache.WriteTo(0, synFlag); - sendCache.WriteTo(1, localConn); - sendCache.WriteTo(5, remoteConn); - sendCache.WriteTo(9, connectId); - byte[] addressBytes = realAddress.ToString().ToByteArray(); - Array.Copy(addressBytes, 0, sendCache, 13, addressBytes.Length); - - Log.Info($"router connect: {connectId} {localConn} {remoteConn} {routerAddress} {realAddress}"); - - EndPoint recvIPEndPoint = new IPEndPoint(IPAddress.Any, 0); - - long lastSendTimer = 0; - - Fiber fiber = root.Fiber; - while (true) - { - long timeNow = fiber.TimeInfo.ClientFrameTime(); - if (timeNow - lastSendTimer > 300) - { - if (--count < 0) - { - Log.Error($"router connect timeout fail! {localConn} {remoteConn} {routerAddress} {realAddress}"); - return 0; - } - lastSendTimer = timeNow; - // 发送 - socket.SendTo(sendCache, 0, addressBytes.Length + 13, SocketFlags.None, routerAddress); - } - - await fiber.TimerComponent.WaitFrameAsync(); - - // 接收 - if (socket.Available > 0) - { - int messageLength = socket.ReceiveFrom(recvCache, ref recvIPEndPoint); - if (messageLength != 9) - { - Log.Error($"router connect error1: {connectId} {messageLength} {localConn} {remoteConn} {routerAddress} {realAddress}"); - continue; - } - - byte flag = recvCache[0]; - if (flag != KcpProtocalType.RouterReconnectACK && flag != KcpProtocalType.RouterACK) - { - Log.Error($"router connect error2: {connectId} {synFlag} {flag} {localConn} {remoteConn} {routerAddress} {realAddress}"); - continue; - } - - uint recvRemoteConn = BitConverter.ToUInt32(recvCache, 1); - uint recvLocalConn = BitConverter.ToUInt32(recvCache, 5); - Log.Info($"router connect finish: {connectId} {recvRemoteConn} {recvLocalConn} {localConn} {remoteConn} {routerAddress} {realAddress}"); - return recvLocalConn; - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs.meta deleted file mode 100644 index 691be911..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Demo/NetClient/Router/RouterHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c76c4f4f2b0cbc5458c3a39c18717d31 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep.meta deleted file mode 100644 index 8428ad2e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c99aac44889414b359c3c2427356076f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs deleted file mode 100644 index ccc6a586..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET.Client -{ - [MessageHandler(SceneType.LockStep)] - public class Match2G_NotifyMatchSuccessHandler: MessageHandler - { - protected override async ETTask Run(Session session, Match2G_NotifyMatchSuccess message) - { - await LSSceneChangeHelper.SceneChangeTo(session.Root(), "Map1", message.ActorId.InstanceId); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs.meta deleted file mode 100644 index acb4b86b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cbf8b88a563eb46bfbaf987167d6a451 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs deleted file mode 100644 index 2873384f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET.Client -{ - [MessageHandler(SceneType.LockStep)] - public class G2C_ReconnectHandler: MessageHandler - { - protected override async ETTask Run(Session session, G2C_Reconnect message) - { - await LSSceneChangeHelper.SceneChangeToReconnect(session.Root(), message); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs.meta deleted file mode 100644 index 742dea64..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 41d6bacdbd4ca1843a732fc0144dc8fb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientHelper.cs deleted file mode 100644 index aa97e444..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientHelper.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System.IO; - -namespace ET.Client -{ - public static partial class LSClientHelper - { - public static void RunLSRollbackSystem(Entity entity) - { - if (entity is LSEntity) - { - return; - } - - LSEntitySystemSingleton.Instance.LSRollback(entity); - - if (entity.ComponentsCount() > 0) - { - foreach (var kv in entity.Components) - { - RunLSRollbackSystem(kv.Value); - } - } - - if (entity.ChildrenCount() > 0) - { - foreach (var kv in entity.Children) - { - RunLSRollbackSystem(kv.Value); - } - } - } - - // 回滚 - public static void Rollback(Room room, int frame) - { - room.LSWorld.Dispose(); - FrameBuffer frameBuffer = room.FrameBuffer; - - // 回滚 - room.LSWorld = room.GetLSWorld(SceneType.LockStepClient, frame); - OneFrameInputs authorityFrameInput = frameBuffer.FrameInputs(frame); - // 执行AuthorityFrame - room.Update(authorityFrameInput); - room.SendHash(frame); - - - // 重新执行预测的帧 - for (int i = room.AuthorityFrame + 1; i <= room.PredictionFrame; ++i) - { - OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(i); - LSClientHelper.CopyOtherInputsTo(room, authorityFrameInput, oneFrameInputs); // 重新预测消息 - room.Update(oneFrameInputs); - } - - RunLSRollbackSystem(room); - } - - public static void SendHash(this Room self, int frame) - { - if (frame > self.AuthorityFrame) - { - return; - } - long hash = self.FrameBuffer.GetHash(frame); - C2Room_CheckHash c2RoomCheckHash = C2Room_CheckHash.Create(); - c2RoomCheckHash.Frame = frame; - c2RoomCheckHash.Hash = hash; - self.Root().GetComponent().Send(c2RoomCheckHash); - } - - // 重新调整预测消息,只需要调整其他玩家的输入 - public static void CopyOtherInputsTo(Room room, OneFrameInputs from, OneFrameInputs to) - { - long myId = room.GetComponent().MyId; - foreach (var kv in from.Inputs) - { - if (kv.Key == myId) - { - continue; - } - to.Inputs[kv.Key] = kv.Value; - } - } - - public static void SaveReplay(Room room, string path) - { - if (room.IsReplay) - { - return; - } - Log.Debug($"save replay: {path} frame: {room.Replay.FrameInputs.Count}"); - byte[] bytes = MemoryPackHelper.Serialize(room.Replay); - File.WriteAllBytes(path, bytes); - } - - public static void JumpReplay(Room room, int frame) - { - if (!room.IsReplay) - { - return; - } - - if (frame >= room.Replay.FrameInputs.Count) - { - frame = room.Replay.FrameInputs.Count - 1; - } - - int snapshotIndex = frame / LSConstValue.SaveLSWorldFrameCount; - Log.Debug($"jump replay start {room.AuthorityFrame} {frame} {snapshotIndex}"); - if (snapshotIndex != room.AuthorityFrame / LSConstValue.SaveLSWorldFrameCount || frame < room.AuthorityFrame) - { - room.LSWorld.Dispose(); - // 回滚 - byte[] memoryBuffer = room.Replay.Snapshots[snapshotIndex]; - LSWorld lsWorld = MongoHelper.Deserialize(typeof (LSWorld), memoryBuffer, 0, memoryBuffer.Length) as LSWorld; - room.LSWorld = lsWorld; - room.AuthorityFrame = snapshotIndex * LSConstValue.SaveLSWorldFrameCount; - RunLSRollbackSystem(room); - } - - room.FixedTimeCounter.Reset(room.Fiber.TimeInfo.ServerFrameTime() - frame * LSConstValue.UpdateInterval, 0); - - Log.Debug($"jump replay finish {frame}"); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientHelper.cs.meta deleted file mode 100644 index 5baf5223..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 915aaa51beb994638bd10e0d2ed9d8a7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs deleted file mode 100644 index 1389301e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.IO; - -namespace ET.Client -{ - [EntitySystemOf(typeof(LSClientUpdater))] - [FriendOf(typeof (LSClientUpdater))] - public static partial class LSClientUpdaterSystem - { - [EntitySystem] - private static void Awake(this LSClientUpdater self) - { - Room room = self.GetParent(); - self.MyId = room.Root().GetComponent().MyId; - } - - [EntitySystem] - private static void Update(this LSClientUpdater self) - { - Room room = self.GetParent(); - long timeNow = self.Fiber().TimeInfo.ServerNow(); - Scene root = room.Root(); - - int i = 0; - while (true) - { - if (timeNow < room.FixedTimeCounter.FrameTime(room.PredictionFrame + 1)) - { - return; - } - - // 最多只预测5帧 - if (room.PredictionFrame - room.AuthorityFrame > 5) - { - return; - } - - ++room.PredictionFrame; - OneFrameInputs oneFrameInputs = self.GetOneFrameMessages(room.PredictionFrame); - - room.Update(oneFrameInputs); - room.SendHash(room.PredictionFrame); - - room.SpeedMultiply = ++i; - - FrameMessage frameMessage = FrameMessage.Create(); - frameMessage.Frame = room.PredictionFrame; - frameMessage.Input = self.Input; - root.GetComponent().Send(frameMessage); - - long timeNow2 = self.Fiber().TimeInfo.ServerNow(); - if (timeNow2 - timeNow > 5) - { - break; - } - } - } - - private static OneFrameInputs GetOneFrameMessages(this LSClientUpdater self, int frame) - { - Room room = self.GetParent(); - FrameBuffer frameBuffer = room.FrameBuffer; - - if (frame <= room.AuthorityFrame) - { - return frameBuffer.FrameInputs(frame); - } - - // predict - OneFrameInputs predictionFrame = frameBuffer.FrameInputs(frame); - - frameBuffer.MoveForward(frame); - if (frameBuffer.CheckFrame(room.AuthorityFrame)) - { - OneFrameInputs authorityFrame = frameBuffer.FrameInputs(room.AuthorityFrame); - authorityFrame.CopyTo(predictionFrame); - } - predictionFrame.Inputs[self.MyId] = self.Input; - - return predictionFrame; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs.meta deleted file mode 100644 index ad18f24b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 46f47e16ad6bc417391e3cdee1b5a851 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs deleted file mode 100644 index 180a1e6d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; - -namespace ET.Client -{ - [EntitySystemOf(typeof(LSReplayUpdater))] - [FriendOf(typeof(LSReplayUpdater))] - public static partial class LSReplayUpdaterSystem - { - [EntitySystem] - private static void Awake(this LSReplayUpdater self) - { - - } - - [EntitySystem] - private static void Update(this LSReplayUpdater self) - { - Room room = self.GetParent(); - Fiber fiber = self.Fiber(); - long timeNow = fiber.TimeInfo.ServerNow(); - - int i = 0; - while (true) - { - if (room.AuthorityFrame + 1 >= room.Replay.FrameInputs.Count) - { - break; - } - - if (timeNow < room.FixedTimeCounter.FrameTime(room.AuthorityFrame + 1)) - { - break; - } - - ++room.AuthorityFrame; - - OneFrameInputs oneFrameInputs = room.Replay.FrameInputs[room.AuthorityFrame]; - - room.Update(oneFrameInputs); - room.SpeedMultiply = ++i; - - long timeNow2 = fiber.TimeInfo.ServerNow(); - if (timeNow2 - timeNow > 5) - { - break; - } - } - } - - public static void ChangeReplaySpeed(this LSReplayUpdater self) - { - Room room = self.Room(); - LSReplayUpdater lsReplayUpdater = room.GetComponent(); - if (lsReplayUpdater.ReplaySpeed == 8) - { - lsReplayUpdater.ReplaySpeed = 1; - } - else - { - lsReplayUpdater.ReplaySpeed *= 2; - } - - int updateInterval = LSConstValue.UpdateInterval / lsReplayUpdater.ReplaySpeed; - room.FixedTimeCounter.ChangeInterval(updateInterval, room.AuthorityFrame); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs.meta deleted file mode 100644 index 7ba822ff..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1f2dc3825dd2f4641bce36a7b8b7708e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSSceneChangeHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSSceneChangeHelper.cs deleted file mode 100644 index 8776312b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSSceneChangeHelper.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace ET.Client -{ - - public static partial class LSSceneChangeHelper - { - // 场景切换协程 - public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId) - { - root.RemoveComponent(); - - Room room = root.AddComponentWithId(sceneInstanceId); - room.Name = sceneName; - - // 等待表现层订阅的事件完成 - await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room}); - - root.GetComponent().Send(new C2Room_ChangeSceneFinish()); - - // 等待Room2C_EnterMap消息 - WaitType.Wait_Room2C_Start waitRoom2CStart = await root.GetComponent().Wait(); - - room.LSWorld = new LSWorld(SceneType.LockStepClient); - room.Init(waitRoom2CStart.Message.UnitInfo, waitRoom2CStart.Message.StartTime); - - room.AddComponent(); - - // 这个事件中可以订阅取消loading - EventSystem.Instance.Publish(root, new EventType.LSSceneInitFinish()); - } - - // 场景切换协程 - public static async ETTask SceneChangeToReplay(Scene root, Replay replay) - { - root.RemoveComponent(); - - Room room = root.AddComponent(); - room.Name = "Map1"; - room.IsReplay = true; - room.Replay = replay; - room.LSWorld = new LSWorld(SceneType.LockStepClient); - room.Init(replay.UnitInfos, root.Fiber().TimeInfo.ServerFrameTime()); - - // 等待表现层订阅的事件完成 - await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room}); - - - room.AddComponent(); - // 这个事件中可以订阅取消loading - EventSystem.Instance.Publish(root, new EventType.LSSceneInitFinish()); - } - - // 场景切换协程 - public static async ETTask SceneChangeToReconnect(Scene root, G2C_Reconnect message) - { - root.RemoveComponent(); - - Room room = root.AddComponent(); - room.Name = "Map1"; - - room.LSWorld = new LSWorld(SceneType.LockStepClient); - room.Init(message.UnitInfos, message.StartTime, message.Frame); - - // 等待表现层订阅的事件完成 - await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room}); - - - room.AddComponent(); - // 这个事件中可以订阅取消loading - EventSystem.Instance.Publish(root, new EventType.LSSceneInitFinish()); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSSceneChangeHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSSceneChangeHelper.cs.meta deleted file mode 100644 index ba4f2a49..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/LSSceneChangeHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6b38bd6590f604a9e9bc0360a81fe2b3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/OneFrameInputsHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/OneFrameInputsHandler.cs deleted file mode 100644 index 1581e519..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/OneFrameInputsHandler.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; - -namespace ET.Client -{ - [MessageHandler(SceneType.LockStep)] - public class OneFrameInputsHandler: MessageHandler - { - protected override async ETTask Run(Session session, OneFrameInputs input) - { - using var _ = input ; // 方法结束时回收消息 - - Room room = session.Scene().GetComponent(); - - Log.Debug($"OneFrameInputs: {room.AuthorityFrame + 1} {input.ToJson()}"); - - FrameBuffer frameBuffer = room.FrameBuffer; - - ++room.AuthorityFrame; - // 服务端返回的消息比预测的还早 - if (room.AuthorityFrame > room.PredictionFrame) - { - OneFrameInputs authorityFrame = frameBuffer.FrameInputs(room.AuthorityFrame); - input.CopyTo(authorityFrame); - } - else - { - // 服务端返回来的消息,跟预测消息对比 - OneFrameInputs predictionInput = frameBuffer.FrameInputs(room.AuthorityFrame); - // 对比失败有两种可能, - // 1是别人的输入预测失败,这种很正常, - // 2 自己的输入对比失败,这种情况是自己发送的消息比服务器晚到了,服务器使用了你的上一次输入 - // 回滚重新预测的时候,自己的输入不用变化 - if (input != predictionInput) - { - Log.Debug($"frame diff: {predictionInput} {input}"); - input.CopyTo(predictionInput); - // 回滚到frameBuffer.AuthorityFrame - Log.Debug($"roll back start {room.AuthorityFrame}"); - LSClientHelper.Rollback(room, room.AuthorityFrame); - Log.Debug($"roll back finish {room.AuthorityFrame}"); - } - else // 对比成功 - { - room.Record(room.AuthorityFrame); - room.SendHash(room.AuthorityFrame); - } - } - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/OneFrameInputsHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/OneFrameInputsHandler.cs.meta deleted file mode 100644 index 8b99a994..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/OneFrameInputsHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ce16289caea864b01988193d7ea2e08a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs deleted file mode 100644 index ac48b208..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.LockStep)] - public class Room2C_AdjustUpdateTimeHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, Room2C_AdjustUpdateTime message) - { - Room room = root.GetComponent(); - int newInterval = (1000 + (message.DiffTime - LSConstValue.UpdateInterval)) * LSConstValue.UpdateInterval / 1000; - - if (newInterval < 40) - { - newInterval = 40; - } - - if (newInterval > 66) - { - newInterval = 66; - } - - room.FixedTimeCounter.ChangeInterval(newInterval, room.PredictionFrame); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs.meta deleted file mode 100644 index 322c2960..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e4df743a2d294ae59bf4844174591716 -timeCreated: 1682414000 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs deleted file mode 100644 index 46226f76..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.LockStep)] - public class Room2C_CheckHashFailHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, Room2C_CheckHashFail message) - { - LSWorld serverWorld = MongoHelper.Deserialize(typeof(LSWorld), message.LSWorldBytes, 0, message.LSWorldBytes.Length) as LSWorld; - using (root.AddChild(serverWorld)) - { - Log.Debug($"check hash fail, server: {message.Frame} {serverWorld.ToJson()}"); - } - - Room room = root.GetComponent(); - LSWorld clientWorld = room.GetLSWorld(SceneType.LockStepClient, message.Frame); - using (root.AddChild(clientWorld)) - { - Log.Debug($"check hash fail, client: {message.Frame} {clientWorld.ToJson()}"); - } - - message.Dispose(); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs.meta deleted file mode 100644 index 69d71217..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bd750474e6e5d437e8f1ac8279a7489d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs deleted file mode 100644 index e029dff7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET.Client -{ - [ActorMessageHandler(SceneType.LockStep)] - public class Room2C_EnterMapHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, Room2C_Start message) - { - root.GetComponent().Notify(new WaitType.Wait_Room2C_Start() {Message = message}); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs.meta deleted file mode 100644 index cfcbf6ec..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c61c8470e59f14b9eb2ace115446c1c5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Module.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Module.meta deleted file mode 100644 index e6f4c2fe..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 83e42b45e303e71468c08f3d8f2d271a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message.meta deleted file mode 100644 index d29ef860..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6378fb95ea17e6d46b536062736457a5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs deleted file mode 100644 index a8d398d3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace ET.Client -{ - [EntitySystemOf(typeof(ClientSessionErrorComponent))] - public static partial class ClientSessionErrorComponentSystem - { - [EntitySystem] - private static void Awake(this ClientSessionErrorComponent self) - { - - } - - [EntitySystem] - private static void Destroy(this ClientSessionErrorComponent self) - { - Fiber fiber = self.Fiber(); - if (fiber.IsDisposed) - { - return; - } - NetClient2Main_SessionDispose message = NetClient2Main_SessionDispose.Create(); - message.Error = self.GetParent().Error; - fiber.ActorInnerComponent.Send(new ActorId(fiber.Process, ConstFiberId.Main), message); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs.meta deleted file mode 100644 index 54212586..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b9b509edbaf46e64f97bb6c4b55ccc7c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/NetClientComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/NetClientComponentSystem.cs deleted file mode 100644 index 694a2e35..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/NetClientComponentSystem.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Net; -using System.Net.Sockets; -using MongoDB.Bson; - -namespace ET.Client -{ - [EntitySystemOf(typeof(NetClientComponent))] - [FriendOf(typeof(NetClientComponent))] - public static partial class NetClientComponentSystem - { - [EntitySystem] - private static void Awake(this NetClientComponent self, AddressFamily addressFamily) - { - self.AService = new KService(addressFamily, ServiceType.Outer); - self.AService.ReadCallback = self.OnRead; - self.AService.ErrorCallback = self.OnError; - } - - [EntitySystem] - private static void Destroy(this NetClientComponent self) - { - self.AService.Dispose(); - } - - [EntitySystem] - private static void Update(this NetClientComponent self) - { - self.AService.Update(); - } - - private static void OnRead(this NetClientComponent self, long channelId, ActorId actorId, object message) - { - Session session = self.GetChild(channelId); - if (session == null) - { - return; - } - - session.LastRecvTime = self.Fiber().TimeInfo.ClientNow(); - - switch (message) - { - case IResponse response: - { - session.OnResponse(response); - break; - } - case IActorMessage: - { - // 扔到Main纤程队列中 - ActorMessageQueue.Instance.Send(new ActorId(self.Fiber().Process, ConstFiberId.Main), message as MessageObject); - break; - } - default: - { - // 普通消息或者是Rpc请求消息 - MessageDispatcherComponent.Instance.Handle(session, message); - break; - } - } - } - - private static void OnError(this NetClientComponent self, long channelId, int error) - { - Session session = self.GetChild(channelId); - if (session == null) - { - return; - } - - session.Error = error; - session.Dispose(); - } - - public static Session Create(this NetClientComponent self, IPEndPoint realIPEndPoint) - { - long channelId = NetServices.Instance.CreateConnectChannelId(); - Session session = self.AddChildWithId(channelId, self.AService); - session.RemoteAddress = realIPEndPoint; - if (self.IScene.SceneType != SceneType.Benchmark) - { - session.AddComponent(); - } - self.AService.Create(session.Id, realIPEndPoint); - - return session; - } - - public static Session Create(this NetClientComponent self, IPEndPoint routerIPEndPoint, IPEndPoint realIPEndPoint, uint localConn) - { - long channelId = localConn; - Session session = self.AddChildWithId(channelId, self.AService); - session.RemoteAddress = realIPEndPoint; - if (self.IScene.SceneType != SceneType.Benchmark) - { - session.AddComponent(); - } - self.AService.Create(session.Id, routerIPEndPoint); - return session; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/NetClientComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/NetClientComponentSystem.cs.meta deleted file mode 100644 index 65072c6a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Module/Message/NetClientComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7fb1278bab55fff4789e94463d9cbdab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Plugins.meta deleted file mode 100644 index f379c345..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9fd48acf90b9dd34a9f4d6c3a7ca409b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example.meta deleted file mode 100644 index 42b48507..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a574066b9ea021c4b9d593dad32e2f97 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example/HotfixClient.cs b/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example/HotfixClient.cs deleted file mode 100644 index 8b137891..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example/HotfixClient.cs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example/HotfixClient.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example/HotfixClient.cs.meta deleted file mode 100644 index 181b4626..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Client/Plugins/Example/HotfixClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9e0137fab5357074e8b6dfe36113542e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server.meta b/Assets/GameScripts/DotNet/Hotfix/Server.meta deleted file mode 100644 index 7497e770..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d6891d68b6ff35d44bb7002901e9865b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo.meta deleted file mode 100644 index a21cf96c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 63e762e0ffcdf434a94a4c89cda96bf8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark.meta deleted file mode 100644 index 89bd73cd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 026ceb4c7b1a5b7439ad918fc35f7e0a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs deleted file mode 100644 index 18407219..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using System.Net.Sockets; -using ET.Client; - -namespace ET.Server -{ - [EntitySystemOf(typeof(BenchmarkClientComponent))] - public static partial class BenchmarkClientComponentSystem - { - [EntitySystem] - private static void Awake(this BenchmarkClientComponent self) - { - for (int i = 0; i < 50; ++i) - { - self.Start().Coroutine(); - } - } - - private static async ETTask Start(this BenchmarkClientComponent self) - { - await ETTask.CompletedTask; - /* - await self.Fiber().GetComponent().WaitAsync(1000); - - - - Scene scene = await SceneFactory.CreateServerScene(self, self.Fiber().IdGenerater.GenerateId(), self.Fiber().IdGenerater.GenerateInstanceId(), - self.DomainZone(), "bechmark", SceneType.Benchmark); - - Client.NetClientComponent netClientComponent = scene.AddComponent(AddressFamily.InterNetwork); - - using Session session = netClientComponent.Create(StartSceneConfigCategory.Instance.BenchmarkServer.OuterIPPort); - List list = new List(100000); - - async ETTask Call(Session s) - { - using G2C_Benchmark benchmark = await s.Call(C2G_Benchmark.Create(true)) as G2C_Benchmark; - } - - for (int j = 0; j < 100000000; ++j) - { - list.Clear(); - for (int i = 0; i < list.Capacity; ++i) - { - list.Add(Call(session)); - } - await ETTaskHelper.WaitAll(list); - } - */ - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs.meta deleted file mode 100644 index 7c89557a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a7a85a66452bf3488c137e5c2caaf2a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs deleted file mode 100644 index 443a9da4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace ET.Server -{ - [MessageHandler(SceneType.BenchmarkServer)] - public class C2G_BenchmarkHandler: MessageHandler - { - protected override async ETTask Run(Session session, C2G_Benchmark request, G2C_Benchmark response) - { - using C2G_Benchmark _ = request; - BenchmarkServerComponent benchmarkServerComponent = session.Scene().GetComponent(); - if (benchmarkServerComponent.Count++ % 1000000 == 0) - { - Log.Debug($"benchmark count: {benchmarkServerComponent.Count} {session.Fiber().TimeInfo.ClientNow()}"); - } - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs.meta deleted file mode 100644 index 07722a3e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f26aed201cdde2142bab5f5c301087e9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/EntryEvent2_InitServer.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/EntryEvent2_InitServer.cs deleted file mode 100644 index 963e7cc0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/EntryEvent2_InitServer.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Net; - -namespace ET.Server -{ - [Event(SceneType.Main)] - public class EntryEvent2_InitServer: AEvent - { - protected override async ETTask Run(Scene root, ET.EventType.EntryEvent2 args) - { - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - - switch (Options.Instance.AppType) - { - case AppType.Server: - { - // 根据配置创建纤程 - var processScenes = StartSceneConfigCategory.Instance.GetByProcess(root.Fiber().Process); - foreach (StartSceneConfig startConfig in processScenes) - { - await FiberManager.Instance.Create(SchedulerType.ThreadPool, startConfig.Id, startConfig.Zone, startConfig.Type, startConfig.Name); - } - - break; - } - case AppType.Watcher: - { - root.AddComponent(); - break; - } - case AppType.GameTool: - { - break; - } - } - - if (Options.Instance.Console == 1) - { - root.AddComponent(); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/EntryEvent2_InitServer.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/EntryEvent2_InitServer.cs.meta deleted file mode 100644 index fa738dc0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/EntryEvent2_InitServer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 38ab027e1bcebae4992db7e8e2552667 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate.meta deleted file mode 100644 index 8ed03fda..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1513fb8025bddeb49b07673e0fbcf7b5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs deleted file mode 100644 index 97fc9dce..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace ET.Server -{ - [MessageHandler(SceneType.Gate)] - public class C2G_EnterMapHandler : MessageHandler - { - protected override async ETTask Run(Session session, C2G_EnterMap request, G2C_EnterMap response) - { - Player player = session.GetComponent().Player; - - // 在Gate上动态创建一个Map Scene,把Unit从DB中加载放进来,然后传送到真正的Map中,这样登陆跟传送的逻辑就完全一样了 - GateMapComponent gateMapComponent = player.AddComponent(); - gateMapComponent.Scene = await GateMapFactory.Create(gateMapComponent, player.Id, session.Fiber().IdGenerater.GenerateInstanceId(), "GateMap"); - - Scene scene = gateMapComponent.Scene; - - // 这里可以从DB中加载Unit - Unit unit = UnitFactory.Create(scene, player.Id, UnitType.Player); - - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetBySceneName(session.Zone(), "Map1"); - response.MyId = player.Id; - - // 等到一帧的最后面再传送,先让G2C_EnterMap返回,否则传送消息可能比G2C_EnterMap还早 - TransferHelper.TransferAtFrameFinish(unit, startSceneConfig.ActorId, startSceneConfig.Name).Coroutine(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs.meta deleted file mode 100644 index d77a4bec..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f713fa291a92de45b5676bf54630e83 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs deleted file mode 100644 index 6c003e9a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; - - -namespace ET.Server -{ - [MessageHandler(SceneType.Gate)] - public class C2G_LoginGateHandler : MessageHandler - { - protected override async ETTask Run(Session session, C2G_LoginGate request, G2C_LoginGate response) - { - Scene root = session.Root(); - string account = root.GetComponent().Get(request.Key); - if (account == null) - { - response.Error = ErrorCore.ERR_ConnectGateKeyError; - response.Message = "Gate key验证失败!"; - return; - } - - session.RemoveComponent(); - - PlayerComponent playerComponent = root.GetComponent(); - Player player = playerComponent.GetByAccount(account); - if (player == null) - { - player = playerComponent.AddChild(account); - playerComponent.Add(player); - PlayerSessionComponent playerSessionComponent = player.AddComponent(); - playerSessionComponent.AddComponent(MailBoxType.GateSession); - await playerSessionComponent.AddLocation(LocationType.GateSession); - - player.AddComponent(MailBoxType.UnOrderedMessage); - await player.AddLocation(LocationType.Player); - - session.AddComponent().Player = player; - playerSessionComponent.Session = session; - } - else - { - // 判断是否在战斗 - PlayerRoomComponent playerRoomComponent = player.GetComponent(); - if (playerRoomComponent.RoomActorId != default) - { - CheckRoom(player, session).Coroutine(); - } - else - { - PlayerSessionComponent playerSessionComponent = player.GetComponent(); - playerSessionComponent.Session = session; - } - } - - response.PlayerId = player.Id; - await ETTask.CompletedTask; - } - - private static async ETTask CheckRoom(Player player, Session session) - { - Fiber fiber = player.Fiber(); - await fiber.WaitFrameFinish(); - - using Room2G_Reconnect room2GateReconnect = await fiber.Root.GetComponent().Call( - player.GetComponent().RoomActorId, - new G2Room_Reconnect() { PlayerId = player.Id }) as Room2G_Reconnect; - G2C_Reconnect g2CReconnect = new() { StartTime = room2GateReconnect.StartTime, Frame = room2GateReconnect.Frame }; - g2CReconnect.UnitInfos.AddRange(room2GateReconnect.UnitInfos); - session.Send(g2CReconnect); - - session.AddComponent().Player = player; - player.GetComponent().Session = session; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs.meta deleted file mode 100644 index fea7f9e1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4486ddc371c9d0d4489f7826dbe00eff -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs deleted file mode 100644 index 3e7cd36d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - - -namespace ET.Server -{ - [MessageHandler(SceneType.Gate)] - public class C2G_PingHandler : MessageHandler - { - protected override async ETTask Run(Session session, C2G_Ping request, G2C_Ping response) - { - response.Time = session.Fiber().TimeInfo.ServerNow(); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs.meta deleted file mode 100644 index 70e97d0a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8679dc7d3ea6fe4478111d3d3948d6cc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs deleted file mode 100644 index 33886961..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.Gate)] - public class FiberInit_Gate: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id); - root.AddComponent(startSceneConfig.InnerIPPort); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs.meta deleted file mode 100644 index 2b90c750..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ca25ecd7aaadcc449a2f8417afa3db67 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateMapFactory.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateMapFactory.cs deleted file mode 100644 index cfadc6ed..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateMapFactory.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET.Server -{ - public static class GateMapFactory - { - public static async ETTask Create(Entity parent, long id, long instanceId, string name) - { - await ETTask.CompletedTask; - Scene scene = EntitySceneFactory.CreateScene(parent, id, instanceId, SceneType.Map, name); - - scene.AddComponent(); - scene.AddComponent(); - scene.AddComponent(); - - scene.AddComponent(MailBoxType.UnOrderedMessage); - - return scene; - } - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateMapFactory.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateMapFactory.cs.meta deleted file mode 100644 index e2d4664a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateMapFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b5df8fb8c84869f4ea1310d4a0839013 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs deleted file mode 100644 index c006a512..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace ET.Server -{ - [FriendOf(typeof(GateSessionKeyComponent))] - public static partial class GateSessionKeyComponentSystem - { - public static void Add(this GateSessionKeyComponent self, long key, string account) - { - self.sessionKey.Add(key, account); - self.TimeoutRemoveKey(key).Coroutine(); - } - - public static string Get(this GateSessionKeyComponent self, long key) - { - string account = null; - self.sessionKey.TryGetValue(key, out account); - return account; - } - - public static void Remove(this GateSessionKeyComponent self, long key) - { - self.sessionKey.Remove(key); - } - - private static async ETTask TimeoutRemoveKey(this GateSessionKeyComponent self, long key) - { - await self.Fiber().TimerComponent.WaitAsync(20000); - self.sessionKey.Remove(key); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs.meta deleted file mode 100644 index 88c1df4f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fc5df5d6f1eb16d4fb5aed2972a96bb6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/MailBoxType_GateSessionHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/MailBoxType_GateSessionHandler.cs deleted file mode 100644 index 21bf3c2c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/MailBoxType_GateSessionHandler.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace ET.Server -{ - [Invoke((long)MailBoxType.GateSession)] - public class MailBoxType_GateSessionHandler: AInvokeHandler - { - public override void Handle(MailBoxInvoker args) - { - MailBoxComponent mailBoxComponent = args.MailBoxComponent; - - // 这里messageObject要发送出去,不能回收 - MessageObject messageObject = args.MessageObject; - - if (mailBoxComponent.Parent is PlayerSessionComponent playerSessionComponent) - { - playerSessionComponent.Session?.Send(messageObject); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/MailBoxType_GateSessionHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/MailBoxType_GateSessionHandler.cs.meta deleted file mode 100644 index 11c7d5c4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/MailBoxType_GateSessionHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: abf1c389d130cf6409d8d6a79f11d324 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs deleted file mode 100644 index 1f0e3721..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs +++ /dev/null @@ -1,75 +0,0 @@ -namespace ET.Server -{ - [Event(SceneType.Realm | SceneType.Gate)] - public class NetServerComponentOnReadEvent: AEvent - { - protected override async ETTask Run(Scene scene, NetServerComponentOnRead args) - { - Session session = args.Session; - object message = args.Message; - Scene root = scene.Root(); - - if (message is IResponse response) - { - session.OnResponse(response); - return; - } - - // 根据消息接口判断是不是Actor消息,不同的接口做不同的处理,比如需要转发给Chat Scene,可以做一个IChatMessage接口 - switch (message) - { - case FrameMessage frameMessage: - { - Player player = session.GetComponent().Player; - ActorId roomActorId = player.GetComponent().RoomActorId; - frameMessage.PlayerId = player.Id; - root.GetComponent().Send(roomActorId, frameMessage); - break; - } - case IActorRoom actorRoom: - { - Player player = session.GetComponent().Player; - ActorId roomActorId = player.GetComponent().RoomActorId; - actorRoom.PlayerId = player.Id; - root.GetComponent().Send(roomActorId, actorRoom); - break; - } - case IActorLocationMessage actorLocationMessage: - { - long unitId = session.GetComponent().Player.Id; - root.GetComponent().Get(LocationType.Unit).Send(unitId, actorLocationMessage); - break; - } - case IActorLocationRequest actorLocationRequest: // gate session收到actor rpc消息,先向actor 发送rpc请求,再将请求结果返回客户端 - { - long unitId = session.GetComponent().Player.Id; - int rpcId = actorLocationRequest.RpcId; // 这里要保存客户端的rpcId - long instanceId = session.InstanceId; - IResponse iResponse = await root.GetComponent().Get(LocationType.Unit).Call(unitId, actorLocationRequest); - iResponse.RpcId = rpcId; - // session可能已经断开了,所以这里需要判断 - if (session.InstanceId == instanceId) - { - session.Send(iResponse); - } - break; - } - case IActorRequest actorRequest: // 分发IActorRequest消息,目前没有用到,需要的自己添加 - { - break; - } - case IActorMessage actorMessage: // 分发IActorMessage消息,目前没有用到,需要的自己添加 - { - break; - } - - default: - { - // 非Actor消息 - MessageDispatcherComponent.Instance.Handle(session, message); - break; - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs.meta deleted file mode 100644 index e91c7890..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d8d62222c52da1d43975f204b0d24b07 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerComponentSystem.cs deleted file mode 100644 index 6edc38e9..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerComponentSystem.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Linq; - -namespace ET.Server -{ - [FriendOf(typeof(PlayerComponent))] - public static partial class PlayerComponentSystem - { - public static void Add(this PlayerComponent self, Player player) - { - self.dictionary.Add(player.Account, player); - } - - public static void Remove(this PlayerComponent self, Player player) - { - self.dictionary.Remove(player.Account); - player.Dispose(); - } - - public static Player GetByAccount(this PlayerComponent self, string account) - { - self.dictionary.TryGetValue(account, out Player player); - return player; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerComponentSystem.cs.meta deleted file mode 100644 index 84b64d25..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 140ad5927b1206842a0d4eb4024ec059 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerSystem.cs deleted file mode 100644 index edcbc0bc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerSystem.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace ET.Server -{ - [EntitySystemOf(typeof(Player))] - [FriendOf(typeof(Player))] - public static partial class PlayerSystem - { - [EntitySystem] - private static void Awake(this Player self, string a) - { - self.Account = a; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerSystem.cs.meta deleted file mode 100644 index f7e3ebc5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/PlayerSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3eed1c782eb930d41aa33b6967a6b344 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs deleted file mode 100644 index ae00538c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Gate)] - public class R2G_GetLoginKeyHandler : ActorMessageHandler - { - protected override async ETTask Run(Scene scene, R2G_GetLoginKey request, G2R_GetLoginKey response) - { - long key = RandomGenerator.RandInt64(); - scene.GetComponent().Add(key, request.Account); - response.Key = key; - response.GateId = scene.Id; - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs.meta deleted file mode 100644 index d71e0e8e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a24713aa9a3f4eb47ab569ba6919599c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs deleted file mode 100644 index 0b2d0f66..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace ET.Server -{ - [EntitySystemOf(typeof(SessionPlayerComponent))] - public static partial class SessionPlayerComponentSystem - { - [EntitySystem] - private static void Destroy(this SessionPlayerComponent self) - { - Scene root = self.Root(); - if (root.IsDisposed) - { - return; - } - // 发送断线消息 - root.GetComponent().Get(LocationType.Unit).Send(self.Player.Id, new G2M_SessionDisconnect()); - } - - [EntitySystem] - private static void Awake(this SessionPlayerComponent self) - { - - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs.meta deleted file mode 100644 index 2937afc1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c6ffc219f113f5d4e9b93e02d18e6cee -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/HttpHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/HttpHelper.cs deleted file mode 100644 index b11bb9b2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/HttpHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Net; -using System.Text; - -namespace ET.Server -{ - public static partial class HttpHelper - { - public static void Response(HttpListenerContext context, object response) - { - byte[] bytes = MongoHelper.ToJson(response).ToUtf8(); - context.Response.StatusCode = 200; - context.Response.ContentEncoding = Encoding.UTF8; - context.Response.ContentLength64 = bytes.Length; - context.Response.OutputStream.Write(bytes, 0, bytes.Length); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/HttpHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/HttpHelper.cs.meta deleted file mode 100644 index 1d633754..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/HttpHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d4a6cc30502b32b44b6f536b3fba5756 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map.meta deleted file mode 100644 index 7d439bca..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0beef288928e88b4d8cad09b6a39c25d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI.meta deleted file mode 100644 index 023443ca..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6047e4105251a574695322acaa6ab8b3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI/ChangePosition_NotifyAOI.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI/ChangePosition_NotifyAOI.cs deleted file mode 100644 index 6432b5b4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI/ChangePosition_NotifyAOI.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Unity.Mathematics; - -namespace ET.Server -{ - [Event(SceneType.Map)] - public class ChangePosition_NotifyAOI: AEvent - { - protected override async ETTask Run(Scene scene, ET.EventType.ChangePosition args) - { - Unit unit = args.Unit; - float3 oldPos = args.OldPos; - int oldCellX = (int) (oldPos.x * 1000) / AOIManagerComponent.CellSize; - int oldCellY = (int) (oldPos.z * 1000) / AOIManagerComponent.CellSize; - int newCellX = (int) (unit.Position.x * 1000) / AOIManagerComponent.CellSize; - int newCellY = (int) (unit.Position.z * 1000) / AOIManagerComponent.CellSize; - if (oldCellX == newCellX && oldCellY == newCellY) - { - return; - } - - AOIEntity aoiEntity = unit.GetComponent(); - if (aoiEntity == null) - { - return; - } - - unit.Scene().GetComponent().Move(aoiEntity, newCellX, newCellY); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI/ChangePosition_NotifyAOI.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI/ChangePosition_NotifyAOI.cs.meta deleted file mode 100644 index 9f341f5b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/AOI/ChangePosition_NotifyAOI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 071b14f170a41df40be9d446a366f90e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/C2M_TestRobotCaseHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/C2M_TestRobotCaseHandler.cs deleted file mode 100644 index 372b4177..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/C2M_TestRobotCaseHandler.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageLocationHandler(SceneType.Map)] - public class C2M_TestRobotCaseHandler : ActorMessageLocationHandler - { - protected override async ETTask Run(Unit unit, C2M_TestRobotCase request, M2C_TestRobotCase response) - { - response.N = request.N; - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/C2M_TestRobotCaseHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/C2M_TestRobotCaseHandler.cs.meta deleted file mode 100644 index ef28bdc0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/C2M_TestRobotCaseHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5779b882127d20f41a9e4d9e48bb8dcf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/G2M_SessionDisconnectHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/G2M_SessionDisconnectHandler.cs deleted file mode 100644 index be799533..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/G2M_SessionDisconnectHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ - - -namespace ET.Server -{ - [ActorMessageLocationHandler(SceneType.Map)] - public class G2M_SessionDisconnectHandler : ActorMessageLocationHandler - { - protected override async ETTask Run(Unit unit, G2M_SessionDisconnect message) - { - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/G2M_SessionDisconnectHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/G2M_SessionDisconnectHandler.cs.meta deleted file mode 100644 index 2b37b446..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/G2M_SessionDisconnectHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba011d050583a53499952147c5fad840 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move.meta deleted file mode 100644 index 4d031bb5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3aa2b5e0132eb714ab53a38e8c6f7e10 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_PathfindingResultHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_PathfindingResultHandler.cs deleted file mode 100644 index 5f7264cc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_PathfindingResultHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ - -namespace ET.Server -{ - [ActorMessageLocationHandler(SceneType.Map)] - public class C2M_PathfindingResultHandler : ActorMessageLocationHandler - { - protected override async ETTask Run(Unit unit, C2M_PathfindingResult message) - { - unit.FindPathMoveToAsync(message.Position).Coroutine(); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_PathfindingResultHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_PathfindingResultHandler.cs.meta deleted file mode 100644 index 3b8eb648..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_PathfindingResultHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bedd38d8adf8fb147925d5091bdc6ec7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_StopHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_StopHandler.cs deleted file mode 100644 index 71493b06..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_StopHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET.Server -{ - [ActorMessageLocationHandler(SceneType.Map)] - public class C2M_StopHandler: ActorMessageLocationHandler - { - protected override async ETTask Run(Unit unit, C2M_Stop message) - { - unit.Stop(1); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_StopHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_StopHandler.cs.meta deleted file mode 100644 index c5755b85..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/C2M_StopHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 82030ce8c55952d4281c067ab368ef72 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/MoveHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/MoveHelper.cs deleted file mode 100644 index b0a46a14..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/MoveHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET.Server -{ - public static partial class MoveHelper - { - // 可以多次调用,多次调用的话会取消上一次的协程 - public static async ETTask FindPathMoveToAsync(this Unit unit, float3 target) - { - float speed = unit.GetComponent().GetAsFloat(NumericType.Speed); - if (speed < 0.01) - { - unit.SendStop(2); - return; - } - - M2C_PathfindingResult m2CPathfindingResult = new(); - unit.GetComponent().Find(unit.Position, target, m2CPathfindingResult.Points); - - if (m2CPathfindingResult.Points.Count < 2) - { - unit.SendStop(3); - return; - } - - // 广播寻路路径 - m2CPathfindingResult.Id = unit.Id; - MessageHelper.Broadcast(unit, m2CPathfindingResult); - - MoveComponent moveComponent = unit.GetComponent(); - - bool ret = await moveComponent.MoveToAsync(m2CPathfindingResult.Points, speed); - if (ret) // 如果返回false,说明被其它移动取消了,这时候不需要通知客户端stop - { - unit.SendStop(0); - } - } - - public static void Stop(this Unit unit, int error) - { - unit.GetComponent().Stop(error == 0); - unit.SendStop(error); - } - - // error: 0表示协程走完正常停止 - public static void SendStop(this Unit unit, int error) - { - MessageHelper.Broadcast(unit, new M2C_Stop() - { - Error = error, - Id = unit.Id, - Position = unit.Position, - Rotation = unit.Rotation, - }); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/MoveHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/MoveHelper.cs.meta deleted file mode 100644 index b90be19b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Move/MoveHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1126c2d3180a6f1419a44335fc0f0f12 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer.meta deleted file mode 100644 index 38d84cdf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 976f21a6abc312d42ad4bf8078438054 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/C2M_TransferMapHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/C2M_TransferMapHandler.cs deleted file mode 100644 index 1d6fafa2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/C2M_TransferMapHandler.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageLocationHandler(SceneType.Map)] - public class C2M_TransferMapHandler : ActorMessageLocationHandler - { - protected override async ETTask Run(Unit unit, C2M_TransferMap request, M2C_TransferMap response) - { - await ETTask.CompletedTask; - - string currentMap = unit.Scene().Name; - string toMap = null; - if (currentMap == "Map1") - { - toMap = "Map2"; - } - else - { - toMap = "Map1"; - } - - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetBySceneName(unit.Fiber().Zone, toMap); - - TransferHelper.TransferAtFrameFinish(unit, startSceneConfig.ActorId, toMap).Coroutine(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/C2M_TransferMapHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/C2M_TransferMapHandler.cs.meta deleted file mode 100644 index 784b3194..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/C2M_TransferMapHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 09e1381365665c14aaa410513c72dbb1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs deleted file mode 100644 index b485a3d7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Unity.Mathematics; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Map)] - public class M2M_UnitTransferRequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene scene, M2M_UnitTransferRequest request, M2M_UnitTransferResponse response) - { - UnitComponent unitComponent = scene.GetComponent(); - Unit unit = MongoHelper.Deserialize(request.Unit); - - unitComponent.AddChild(unit); - unitComponent.Add(unit); - - foreach (byte[] bytes in request.Entitys) - { - Entity entity = MongoHelper.Deserialize(bytes); - unit.AddComponent(entity); - } - - unit.AddComponent(); - unit.AddComponent(scene.Name); - unit.Position = new float3(-10, 0, -10); - - unit.AddComponent(MailBoxType.OrderedMessage); - - // 通知客户端开始切场景 - M2C_StartSceneChange m2CStartSceneChange = new() { SceneInstanceId = scene.InstanceId, SceneName = scene.Name }; - MessageHelper.SendToClient(unit, m2CStartSceneChange); - - // 通知客户端创建My Unit - M2C_CreateMyUnit m2CCreateUnits = new(); - m2CCreateUnits.Unit = UnitHelper.CreateUnitInfo(unit); - MessageHelper.SendToClient(unit, m2CCreateUnits); - - // 加入aoi - unit.AddComponent(9 * 1000, unit.Position); - - // 解锁location,可以接收发给Unit的消息 - await scene.Root().GetComponent().UnLock(LocationType.Unit, unit.Id, request.OldActorId, unit.GetActorId()); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs.meta deleted file mode 100644 index 855ff789..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e8e9b12c47eb5ac41b42a6b83817f1d2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs deleted file mode 100644 index 751b5ab5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections.Generic; -using MongoDB.Bson; - -namespace ET.Server -{ - public static partial class TransferHelper - { - public static async ETTask TransferAtFrameFinish(Unit unit, ActorId sceneInstanceId, string sceneName) - { - await unit.Fiber().WaitFrameFinish(); - - await TransferHelper.Transfer(unit, sceneInstanceId, sceneName); - } - - - public static async ETTask Transfer(Unit unit, ActorId sceneInstanceId, string sceneName) - { - Scene root = unit.Root(); - - // location加锁 - long unitId = unit.Id; - - M2M_UnitTransferRequest request = M2M_UnitTransferRequest.Create(); - request.OldActorId = unit.GetActorId(); - request.Unit = unit.ToBson(); - foreach (Entity entity in unit.Components.Values) - { - if (entity is ITransfer) - { - request.Entitys.Add(entity.ToBson()); - } - } - unit.Dispose(); - - await root.GetComponent().Lock(LocationType.Unit, unitId, request.OldActorId); - await root.GetComponent().Call(sceneInstanceId, request); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs.meta deleted file mode 100644 index d5de0dc7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6fe1b54e7a5a88243a60c501d7a71979 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit.meta deleted file mode 100644 index c4bcc2a7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 90f2084c2789e40468c6eb5642275748 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs deleted file mode 100644 index f131762f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace ET.Server -{ - // 进入视野通知 - [Event(SceneType.Map)] - public class UnitEnterSightRange_NotifyClient: AEvent - { - protected override async ETTask Run(Scene scene, EventType.UnitEnterSightRange args) - { - AOIEntity a = args.A; - AOIEntity b = args.B; - if (a.Id == b.Id) - { - return; - } - - Unit ua = a.GetParent(); - if (ua.Type != UnitType.Player) - { - return; - } - - Unit ub = b.GetParent(); - - MessageHelper.NoticeUnitAdd(ua, ub); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs.meta deleted file mode 100644 index 6a923be7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 92a7bfbd50423e64b994beb9fe3ddad2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitFactory.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitFactory.cs deleted file mode 100644 index 9acf2ef6..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitFactory.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using Unity.Mathematics; - -namespace ET.Server -{ - public static partial class UnitFactory - { - public static Unit Create(Scene scene, long id, UnitType unitType) - { - UnitComponent unitComponent = scene.GetComponent(); - switch (unitType) - { - case UnitType.Player: - { - Unit unit = unitComponent.AddChildWithId(id, 1001); - unit.AddComponent(); - unit.Position = new float3(-10, 0, -10); - - NumericComponent numericComponent = unit.AddComponent(); - numericComponent.Set(NumericType.Speed, 6f); // 速度是6米每秒 - numericComponent.Set(NumericType.AOI, 15000); // 视野15米 - - unitComponent.Add(unit); - // 加入aoi - unit.AddComponent(9 * 1000, unit.Position); - return unit; - } - default: - throw new Exception($"not such unit type: {unitType}"); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitFactory.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitFactory.cs.meta deleted file mode 100644 index 899d466f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 359d93a0f7fdfa44bbc572328e9742f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs deleted file mode 100644 index 7a66e89d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET.Server -{ - [FriendOf(typeof(MoveComponent))] - [FriendOf(typeof(NumericComponent))] - public static partial class UnitHelper - { - public static UnitInfo CreateUnitInfo(Unit unit) - { - UnitInfo unitInfo = new(); - NumericComponent nc = unit.GetComponent(); - unitInfo.UnitId = unit.Id; - unitInfo.ConfigId = unit.ConfigId; - unitInfo.Type = (int)unit.Type; - unitInfo.Position = unit.Position; - unitInfo.Forward = unit.Forward; - - MoveComponent moveComponent = unit.GetComponent(); - if (moveComponent != null) - { - if (!moveComponent.IsArrived()) - { - unitInfo.MoveInfo = new MoveInfo(); - unitInfo.MoveInfo.Points.Add(unit.Position); - for (int i = moveComponent.N; i < moveComponent.Targets.Count; ++i) - { - float3 pos = moveComponent.Targets[i]; - unitInfo.MoveInfo.Points.Add(pos); - } - } - } - - foreach ((int key, long value) in nc.NumericDic) - { - unitInfo.KV.Add(key, value); - } - - return unitInfo; - } - - // 获取看见unit的玩家,主要用于广播 - public static Dictionary GetBeSeePlayers(this Unit self) - { - return self.GetComponent().GetBeSeePlayers(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs.meta deleted file mode 100644 index d45fa75d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bcdc9f9c96c0ff146ac609ff97b4903a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs deleted file mode 100644 index 9def7e57..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET.Server -{ - // 离开视野 - [Event(SceneType.Map)] - public class UnitLeaveSightRange_NotifyClient: AEvent - { - protected override async ETTask Run(Scene scene, EventType.UnitLeaveSightRange args) - { - await ETTask.CompletedTask; - AOIEntity a = args.A; - AOIEntity b = args.B; - if (a.Unit.Type != UnitType.Player) - { - return; - } - - MessageHelper.NoticeUnitRemove(a.GetParent(), b.GetParent()); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs.meta deleted file mode 100644 index 8f5f65dd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 10a2365c686050546995d6a3897b9038 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/MessageHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/MessageHelper.cs deleted file mode 100644 index 74ad64df..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/MessageHelper.cs +++ /dev/null @@ -1,49 +0,0 @@ - - -using System.Collections.Generic; -using System.IO; - -namespace ET.Server -{ - public static partial class MessageHelper - { - public static void NoticeUnitAdd(Unit unit, Unit sendUnit) - { - M2C_CreateUnits createUnits = M2C_CreateUnits.Create(); - createUnits.Units.Add(UnitHelper.CreateUnitInfo(sendUnit)); - MessageHelper.SendToClient(unit, createUnits); - } - - public static void NoticeUnitRemove(Unit unit, Unit sendUnit) - { - M2C_RemoveUnits removeUnits = M2C_RemoveUnits.Create(); - removeUnits.Units.Add(sendUnit.Id); - MessageHelper.SendToClient(unit, removeUnits); - } - - public static void Broadcast(Unit unit, IActorMessage message) - { - (message as MessageObject).IsFromPool = false; - Dictionary dict = unit.GetBeSeePlayers(); - // 网络底层做了优化,同一个消息不会多次序列化 - ActorLocationSenderOneType oneTypeLocationType = unit.Root().GetComponent().Get(LocationType.GateSession); - foreach (AOIEntity u in dict.Values) - { - oneTypeLocationType.Send(u.Unit.Id, message); - } - } - - public static void SendToClient(Unit unit, IActorMessage message) - { - unit.Root().GetComponent().Get(LocationType.GateSession).Send(unit.Id, message); - } - - /// - /// 发送协议给Actor - /// - public static void SendActor(Scene root, ActorId actorId, IActorMessage message) - { - root.GetComponent().Send(actorId, message); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/MessageHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/MessageHelper.cs.meta deleted file mode 100644 index 8d9e20f0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/MessageHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f741e13c630658444812d605a1de756f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm.meta deleted file mode 100644 index b3728480..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 80190480a51b8114fb16950142846bd7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs deleted file mode 100644 index 20de4d61..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Net; - - -namespace ET.Server -{ - [MessageHandler(SceneType.Realm)] - public class C2R_LoginHandler : MessageHandler - { - protected override async ETTask Run(Session session, C2R_Login request, R2C_Login response) - { - // 随机分配一个Gate - StartSceneConfig config = RealmGateAddressHelper.GetGate(session.Zone(), request.Account); - Log.Debug($"gate address: {config}"); - - // 向gate请求一个key,客户端可以拿着这个key连接gate - G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await session.Fiber().Root.GetComponent().Call( - config.ActorId, new R2G_GetLoginKey() {Account = request.Account}); - - response.Address = config.InnerIPPort.ToString(); - response.Key = g2RGetLoginKey.Key; - response.GateId = g2RGetLoginKey.GateId; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs.meta deleted file mode 100644 index 8867bee9..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e499cce63c705be489700108cfb56ef2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs deleted file mode 100644 index bec14137..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.Realm)] - public class FiberInit_Realm: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get(root.Fiber.Id); - root.AddComponent(startSceneConfig.InnerIPPort); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs.meta deleted file mode 100644 index 5c50675c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1f15a025727328543b751e037d5c8657 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs deleted file mode 100644 index b1de6ce8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; - - -namespace ET.Server -{ - public static partial class RealmGateAddressHelper - { - public static StartSceneConfig GetGate(int zone, string account) - { - long hash = account.GetLongHashCode(); - - List zoneGates = StartSceneConfigCategory.Instance.Gates[zone]; - - return zoneGates[(int)(hash % zoneGates.Count)]; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs.meta deleted file mode 100644 index 13ae10b6..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cb7be8a992c4c8e4f9c54c0543834360 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot.meta deleted file mode 100644 index 76b874da..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ec1d8ad3c64cebd42950e0400567e918 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Case.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Case.meta deleted file mode 100644 index 32f3ab89..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Case.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 09a50e10da1069b4ca4863e50eb997fa -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console.meta deleted file mode 100644 index c71ecfb1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3df587745c6211c459cafc9574d2efb0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs deleted file mode 100644 index 6b1d3daf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using CommandLine; - -namespace ET.Server -{ - [ConsoleHandler(ConsoleMode.CreateRobot)] - public class CreateRobotConsoleHandler: IConsoleHandler - { - public async ETTask Run(Fiber fiber, ModeContex contex, string content) - { - switch (content) - { - case ConsoleMode.CreateRobot: - Log.Console("CreateRobot args error!"); - break; - default: - CreateRobotArgs options = null; - Parser.Default.ParseArguments(content.Split(' ')) - .WithNotParsed(error => throw new Exception($"CreateRobotArgs error!")) - .WithParsed(o => { options = o; }); - - break; - } - contex.Parent.RemoveComponent(); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs.meta deleted file mode 100644 index a81c8bdd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5933b5c48d0a66e4e92904734aa09739 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/RobotConsoleHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/RobotConsoleHandler.cs deleted file mode 100644 index 345647cc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/RobotConsoleHandler.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Reflection; - -namespace ET.Server -{ - [ConsoleHandler(ConsoleMode.Robot)] - public class RobotConsoleHandler: IConsoleHandler - { - public async ETTask Run(Fiber fiber, ModeContex contex, string content) - { - string[] ss = content.Split(" "); - switch (ss[0]) - { - case ConsoleMode.Robot: - break; - - case "Run": - { - int caseType = int.Parse(ss[1]); - - try - { - RobotLog.Debug($"run case start: {caseType}"); - await EventSystem.Instance.Invoke(caseType, new RobotInvokeArgs() { Fiber = fiber, Content = content }); - RobotLog.Debug($"run case finish: {caseType}"); - } - catch (Exception e) - { - RobotLog.Debug($"run case error: {caseType}\n{e}"); - } - break; - } - case "RunAll": - { - FieldInfo[] fieldInfos = typeof (RobotCaseType).GetFields(); - foreach (FieldInfo fieldInfo in fieldInfos) - { - int caseType = (int)fieldInfo.GetValue(null); - if (caseType > RobotCaseType.MaxCaseType) - { - RobotLog.Debug($"case > {RobotCaseType.MaxCaseType}: {caseType}"); - break; - } - try - { - RobotLog.Debug($"run case start: {caseType}"); - await EventSystem.Instance.Invoke(caseType, new RobotInvokeArgs() { Fiber = fiber, Content = content}); - RobotLog.Debug($"---------run case finish: {caseType}"); - } - catch (Exception e) - { - RobotLog.Debug($"run case error: {caseType}\n{e}"); - break; - } - } - break; - } - } - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/RobotConsoleHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/RobotConsoleHandler.cs.meta deleted file mode 100644 index 79f0362b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/RobotConsoleHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 578bb55fc361d0f4cabd05482892932d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene.meta deleted file mode 100644 index 5ea69e3f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 085b02b7394eec94ba27bf98e11b44b6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs deleted file mode 100644 index 4dde593c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace ET.Server -{ - public static partial class RobotSceneFactory - { - public static async ETTask Create( - Entity parent, - long id, - long instanceId, - int zone, - string name, - SceneType sceneType, - StartSceneConfig startSceneConfig = null - ) - { - /* - await ETTask.CompletedTask; - Log.Info($"create scene: {sceneType} {name} {zone}"); - Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent); - - scene.AddComponent(MailBoxType.UnOrderedMessage); - - switch (scene.SceneType) - { - case SceneType.Robot: - scene.AddComponent(); - break; - } - - return scene; - */ - await ETTask.CompletedTask; - return null; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs.meta deleted file mode 100644 index c82ea552..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8fc5dfc338ad5a34298bedfecf3e902f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router.meta deleted file mode 100644 index 0b1550c1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3475a99ac00ec6a40ac4b9bb6b84ab8c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs deleted file mode 100644 index 15f44668..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Text; - -namespace ET.Server -{ - [HttpHandler(SceneType.RouterManager, "/get_router")] - public class HttpGetRouterHandler : IHttpHandler - { - public async ETTask Handle(Scene scene, HttpListenerContext context) - { - HttpGetRouterResponse response = new(); - foreach (StartSceneConfig startSceneConfig in StartSceneConfigCategory.Instance.Realms) - { - response.Realms.Add(startSceneConfig.InnerIPPort.ToString()); - } - foreach (StartSceneConfig startSceneConfig in StartSceneConfigCategory.Instance.Routers) - { - response.Routers.Add($"{startSceneConfig.StartProcessConfig.OuterIP}:{startSceneConfig.Port}"); - } - HttpHelper.Response(context, response); - await ETTask.CompletedTask; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs.meta deleted file mode 100644 index 66fe7c95..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 112dbe2a31f72854190a5ac197d5e1fe -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher.meta deleted file mode 100644 index 33cbfaec..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5ca381a4c6ce9b64ebd6f0497f8ebdee -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs deleted file mode 100644 index f723d972..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections; -using System.Diagnostics; - -namespace ET.Server -{ - [EntitySystemOf(typeof(WatcherComponent))] - [FriendOf(typeof(WatcherComponent))] - public static partial class WatcherComponentSystem - { - [EntitySystem] - public static void Awake(this WatcherComponent self) - { - string[] localIP = NetworkHelper.GetAddressIPs(); - var processConfigs = StartProcessConfigCategory.Instance.GetAll(); - foreach (StartProcessConfig startProcessConfig in processConfigs.Values) - { - if (!WatcherHelper.IsThisMachine(startProcessConfig.InnerIP, localIP)) - { - continue; - } - System.Diagnostics.Process process = WatcherHelper.StartProcess(startProcessConfig.Id); - self.Processes.Add(startProcessConfig.Id, process); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs.meta deleted file mode 100644 index fb3a473c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 74b099ff0f3523d47af0595ae8bf6b3f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherHelper.cs deleted file mode 100644 index f2902994..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherHelper.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections; -using System.Diagnostics; - -namespace ET.Server -{ - public static partial class WatcherHelper - { - public static StartMachineConfig GetThisMachineConfig() - { - string[] localIP = NetworkHelper.GetAddressIPs(); - StartMachineConfig startMachineConfig = null; - foreach (StartMachineConfig config in StartMachineConfigCategory.Instance.GetAll().Values) - { - if (!WatcherHelper.IsThisMachine(config.InnerIP, localIP)) - { - continue; - } - startMachineConfig = config; - break; - } - - if (startMachineConfig == null) - { - throw new Exception("not found this machine ip config!"); - } - - return startMachineConfig; - } - - public static bool IsThisMachine(string ip, string[] localIPs) - { - if (ip != "127.0.0.1" && ip != "0.0.0.0" && !((IList) localIPs).Contains(ip)) - { - return false; - } - return true; - } - - public static System.Diagnostics.Process StartProcess(int processId, int createScenes = 0) - { - StartProcessConfig startProcessConfig = StartProcessConfigCategory.Instance.Get(processId); - const string exe = "dotnet"; - string arguments = $"App.dll" + - $" --Process={startProcessConfig.Id}" + - $" --AppType=Server" + - $" --StartConfig={Options.Instance.StartConfig}" + - $" --Develop={Options.Instance.Develop}" + - $" --LogLevel={Options.Instance.LogLevel}" + - $" --Console={Options.Instance.Console}"; - Log.Debug($"{exe} {arguments}"); - System.Diagnostics.Process process = ProcessHelper.Run(exe, arguments); - return process; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherHelper.cs.meta deleted file mode 100644 index 637cc473..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Demo/Watcher/WatcherHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 95a7ba0a15340d143a8eb9787899fcc6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep.meta deleted file mode 100644 index 87f393ac..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bad29a92a5a8b41f7b3ec3f4bd23bc34 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate.meta deleted file mode 100644 index d83d5e77..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b29453dd6d8294ba982500d139b81ed5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs deleted file mode 100644 index 5c41753e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace ET.Server -{ - [MessageHandler(SceneType.Gate)] - public class C2G_MatchHandler : MessageHandler - { - protected override async ETTask Run(Session session, C2G_Match request, G2C_Match response) - { - Player player = session.GetComponent().Player; - - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Match; - - await session.Root().GetComponent().Call(startSceneConfig.ActorId, - new G2Match_Match() { Id = player.Id }); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs.meta deleted file mode 100644 index e5cffe1a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04a4b6c3a76cb4d53ab4655a2cc4f7eb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/Match2G_NotifyMatchSuccessHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/Match2G_NotifyMatchSuccessHandler.cs deleted file mode 100644 index 47c76e1d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/Match2G_NotifyMatchSuccessHandler.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Gate)] - public class Match2G_NotifyMatchSuccessHandler : ActorMessageHandler - { - protected override async ETTask Run(Player player, Match2G_NotifyMatchSuccess message) - { - player.AddComponent().RoomActorId = message.ActorId; - - player.GetComponent().Session.Send(message); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/Match2G_NotifyMatchSuccessHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/Match2G_NotifyMatchSuccessHandler.cs.meta deleted file mode 100644 index 421adfcc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Gate/Match2G_NotifyMatchSuccessHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d2320b5939fd246359a4871b18ac94d8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map.meta deleted file mode 100644 index 8ca016f0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a86d2aec3f36c405fa581cf362886820 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs deleted file mode 100644 index 3a5520f6..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using TrueSync; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.RoomRoot)] - [FriendOf(typeof (RoomServerComponent))] - public class C2Room_ChangeSceneFinishHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, C2Room_ChangeSceneFinish message) - { - Room room = root.GetComponent(); - RoomServerComponent roomServerComponent = room.GetComponent(); - RoomPlayer roomPlayer = room.GetComponent().GetChild(message.PlayerId); - roomPlayer.Progress = 100; - - if (!roomServerComponent.IsAllPlayerProgress100()) - { - return; - } - - await room.Fiber.TimerComponent.WaitAsync(1000); - - Room2C_Start room2CStart = new() { StartTime = room.Fiber().TimeInfo.ServerFrameTime() }; - foreach (RoomPlayer rp in roomServerComponent.Children.Values) - { - room2CStart.UnitInfo.Add(new LockStepUnitInfo() - { - PlayerId = rp.Id, Position = new TSVector(20, 0, -10), Rotation = TSQuaternion.identity - }); - } - - room.Init(room2CStart.UnitInfo, room2CStart.StartTime); - - room.AddComponent(); - - RoomMessageHelper.BroadCast(room, room2CStart); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs.meta deleted file mode 100644 index eec92346..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 228e4d43b85774ae08bf5da1f3425627 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FiberInit_Map.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FiberInit_Map.cs deleted file mode 100644 index 2c479b5d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FiberInit_Map.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.Map)] - public class FiberInit_Map: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FiberInit_Map.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FiberInit_Map.cs.meta deleted file mode 100644 index cd1883d7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FiberInit_Map.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5d37c22fa00c59f48a444cc04a1621e4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs deleted file mode 100644 index b028a28d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.RoomRoot)] - public class FrameMessageHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, FrameMessage message) - { - Room room = root.GetComponent(); - FrameBuffer frameBuffer = room.FrameBuffer; - - if (message.Frame % (1000 / LSConstValue.UpdateInterval) == 0) - { - long nowFrameTime = room.FixedTimeCounter.FrameTime(message.Frame); - int diffTime = (int)(nowFrameTime - room.Fiber().TimeInfo.ServerFrameTime()); - - room.Root().GetComponent().Get(LocationType.GateSession).Send(message.PlayerId, new Room2C_AdjustUpdateTime() {DiffTime = diffTime}); - } - - if (message.Frame < room.AuthorityFrame) // 小于AuthorityFrame,丢弃 - { - Log.Warning($"FrameMessage < AuthorityFrame discard: {message}"); - return; - } - - if (message.Frame > room.AuthorityFrame + 10) // 大于AuthorityFrame + 10,丢弃 - { - Log.Warning($"FrameMessage > AuthorityFrame + 10 discard: {message}"); - return; - } - - OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(message.Frame); - if (oneFrameInputs == null) - { - Log.Error($"FrameMessageHandler get frame is null: {message.Frame}, max frame: {frameBuffer.MaxFrame}"); - return; - } - oneFrameInputs.Inputs[message.PlayerId] = message.Input; - - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs.meta deleted file mode 100644 index 3e101260..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40bebd1c111464ddb96d36e4d0966070 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/Match2Map_GetRoomHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/Match2Map_GetRoomHandler.cs deleted file mode 100644 index 5410c4a3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/Match2Map_GetRoomHandler.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Map)] - public class Match2Map_GetRoomHandler : ActorMessageHandler - { - protected override async ETTask Run(Scene root, Match2Map_GetRoom request, Map2Match_GetRoom response) - { - //RoomManagerComponent roomManagerComponent = root.GetComponent(); - - Fiber fiber = root.Fiber(); - int fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, fiber.Zone, SceneType.RoomRoot, "RoomRoot"); - ActorId roomRootActorId = new(fiber.Process, fiberId); - - // 发送消息给房间纤程,初始化 - RoomManager2Room_Init roomManager2RoomInit = RoomManager2Room_Init.Create(); - roomManager2RoomInit.PlayerIds.AddRange(request.PlayerIds); - await root.GetComponent().Call(roomRootActorId, roomManager2RoomInit); - - response.ActorId = roomRootActorId; - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/Match2Map_GetRoomHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/Match2Map_GetRoomHandler.cs.meta deleted file mode 100644 index 15c90dda..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/Match2Map_GetRoomHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7f404c61e317c4fc0ad28508eea3f5f2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs deleted file mode 100644 index cbb2becf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace ET.Server -{ - - public static partial class RoomMessageHelper - { - public static void BroadCast(Room room, IActorMessage message) - { - // 广播的消息不能被池回收 - (message as MessageObject).IsFromPool = false; - - RoomServerComponent roomServerComponent = room.GetComponent(); - - ActorLocationSenderComponent actorLocationSenderComponent = room.Root().GetComponent(); - foreach (var kv in roomServerComponent.Children) - { - RoomPlayer roomPlayer = kv.Value as RoomPlayer; - - if (!roomPlayer.IsOnline) - { - continue; - } - - actorLocationSenderComponent.Get(LocationType.GateSession).Send(roomPlayer.Id, message); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs.meta deleted file mode 100644 index 99abc5de..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 015483a7767f844349026490961481a1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs deleted file mode 100644 index 9d194d4c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - [EntitySystemOf(typeof(RoomServerComponent))] - [FriendOf(typeof(RoomServerComponent))] - public static partial class RoomServerComponentSystem - { - [EntitySystem] - private static void Awake(this RoomServerComponent self, List playerIds) - { - foreach (long id in playerIds) - { - RoomPlayer roomPlayer = self.AddChildWithId(id); - } - } - - public static bool IsAllPlayerProgress100(this RoomServerComponent self) - { - foreach (RoomPlayer roomPlayer in self.Children.Values) - { - if (roomPlayer.Progress != 100) - { - return false; - } - } - return true; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs.meta deleted file mode 100644 index c504056a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6d671f754d680422caba612a77dfdb63 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match.meta deleted file mode 100644 index 27a24824..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 397b1655e0ba94b23abb42a1a3c6cca8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/FiberInit_Match.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/FiberInit_Match.cs deleted file mode 100644 index 37610097..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/FiberInit_Match.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.Match)] - public class FiberInit_Match: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/FiberInit_Match.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/FiberInit_Match.cs.meta deleted file mode 100644 index fbdee6b2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/FiberInit_Match.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a6a6101f02189c643accabb36f52c150 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/G2Match_MatchHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/G2Match_MatchHandler.cs deleted file mode 100644 index c9a87616..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/G2Match_MatchHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Match)] - public class G2Match_MatchHandler : ActorMessageHandler - { - protected override async ETTask Run(Scene scene, G2Match_Match request, Match2G_Match response) - { - MatchComponent matchComponent = scene.GetComponent(); - matchComponent.Match(request.Id).Coroutine(); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/G2Match_MatchHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/G2Match_MatchHandler.cs.meta deleted file mode 100644 index 57658682..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/G2Match_MatchHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 643a9fc2cab3148718708aba9c790f7d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs deleted file mode 100644 index cb0b71e8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - - [FriendOf(typeof(MatchComponent))] - public static partial class MatchComponentSystem - { - public static async ETTask Match(this MatchComponent self, long playerId) - { - if (self.waitMatchPlayers.Contains(playerId)) - { - return; - } - - self.waitMatchPlayers.Add(playerId); - - if (self.waitMatchPlayers.Count < LSConstValue.MatchCount) - { - return; - } - - // 申请一个房间 - StartSceneConfig startSceneConfig = RandomGenerator.RandomArray(StartSceneConfigCategory.Instance.Maps); - Match2Map_GetRoom match2MapGetRoom = new(); - foreach (long id in self.waitMatchPlayers) - { - match2MapGetRoom.PlayerIds.Add(id); - } - - self.waitMatchPlayers.Clear(); - - Scene root = self.Root(); - Map2Match_GetRoom map2MatchGetRoom = await root.GetComponent().Call( - startSceneConfig.ActorId, match2MapGetRoom) as Map2Match_GetRoom; - - Match2G_NotifyMatchSuccess match2GNotifyMatchSuccess = new() { ActorId = map2MatchGetRoom.ActorId }; - ActorLocationSenderComponent actorLocationSenderComponent = root.GetComponent(); - - foreach (long id in match2MapGetRoom.PlayerIds) // 这里发送消息线程不会修改PlayerInfo,所以可以直接使用 - { - actorLocationSenderComponent.Get(LocationType.Player).Send(id, match2GNotifyMatchSuccess); - // 等待进入房间的确认消息,如果超时要通知所有玩家退出房间,重新匹配 - } - } - } - -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs.meta deleted file mode 100644 index cae0aa78..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd80372aeb5d74a3ba66f43bae5613df -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room.meta deleted file mode 100644 index 70ce540c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8795299b519a48719a23f048377da2a9 -timeCreated: 1681817967 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs deleted file mode 100644 index 6a21c572..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace ET.Server -{ - [ActorMessageHandler(SceneType.RoomRoot)] - public class C2Room_CheckHashHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, C2Room_CheckHash message) - { - Room room = root.GetComponent(); - long hash = room.FrameBuffer.GetHash(message.Frame); - if (message.Hash != hash) - { - byte[] bytes = room.FrameBuffer.Snapshot(message.Frame).ToArray(); - Room2C_CheckHashFail room2CCheckHashFail = new() { Frame = message.Frame, LSWorldBytes = bytes }; - room.Root().GetComponent().Get(LocationType.GateSession).Send(message.PlayerId, room2CCheckHashFail); - } - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs.meta deleted file mode 100644 index 4712128a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8f87c1aa12fde40b5afda6ea778cfdf4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs deleted file mode 100644 index 732c7526..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.RoomRoot)] - public class FiberInit_RoomRoot: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - Room room = root.AddChild(); - root.AddComponent(); - root.AddComponent(); - - room.Name = "Server"; - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs.meta deleted file mode 100644 index 5d3f1223..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/FiberInit_RoomRoot.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6975fc1c87e4bcf46bdd02dc8bb89bc4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs deleted file mode 100644 index c099c140..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Room)] - public class G2Room_ReconnectHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, G2Room_Reconnect request, Room2G_Reconnect response) - { - Room room = root.GetComponent(); - response.StartTime = room.StartTime; - LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent(); - foreach (long playerId in room.PlayerIds) - { - LSUnit lsUnit = lsUnitComponent.GetChild(playerId); - response.UnitInfos.Add(new LockStepUnitInfo() {PlayerId = playerId, Position = lsUnit.Position, Rotation = lsUnit.Rotation}); - } - - response.Frame = room.AuthorityFrame; - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs.meta deleted file mode 100644 index 6bf85976..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f78aa3bd3f95d5d4a9b4178c61599dab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs deleted file mode 100644 index 24157665..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - [EntitySystemOf(typeof(LSServerUpdater))] - [FriendOf(typeof(LSServerUpdater))] - public static partial class LSServerUpdaterSystem - { - [EntitySystem] - private static void Awake(this LSServerUpdater self) - { - - } - - [EntitySystem] - private static void Update(this LSServerUpdater self) - { - Room room = self.GetParent(); - long timeNow = room.Fiber().TimeInfo.ServerFrameTime(); - - - int frame = room.AuthorityFrame + 1; - if (timeNow < room.FixedTimeCounter.FrameTime(frame)) - { - return; - } - - OneFrameInputs oneFrameInputs = self.GetOneFrameMessage(frame); - ++room.AuthorityFrame; - - OneFrameInputs sendInput = new(); - oneFrameInputs.CopyTo(sendInput); - - RoomMessageHelper.BroadCast(room, sendInput); - - room.Update(oneFrameInputs); - } - - private static OneFrameInputs GetOneFrameMessage(this LSServerUpdater self, int frame) - { - Room room = self.GetParent(); - FrameBuffer frameBuffer = room.FrameBuffer; - OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(frame); - frameBuffer.MoveForward(frame); - - if (oneFrameInputs.Inputs.Count == LSConstValue.MatchCount) - { - return oneFrameInputs; - } - - OneFrameInputs preFrameInputs = null; - if (frameBuffer.CheckFrame(frame - 1)) - { - preFrameInputs = frameBuffer.FrameInputs(frame - 1); - } - - // 有人输入的消息没过来,给他使用上一帧的操作 - foreach (long playerId in room.PlayerIds) - { - if (oneFrameInputs.Inputs.ContainsKey(playerId)) - { - continue; - } - - if (preFrameInputs != null && preFrameInputs.Inputs.TryGetValue(playerId, out LSInput input)) - { - // 使用上一帧的输入 - oneFrameInputs.Inputs[playerId] = input; - } - else - { - oneFrameInputs.Inputs[playerId] = new LSInput(); - } - } - - return oneFrameInputs; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs.meta deleted file mode 100644 index aeb38dff..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 524fc1d8fab854147a900bad52d3b28f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/RoomManager2Room_InitHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/RoomManager2Room_InitHandler.cs deleted file mode 100644 index 2830a2bc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/RoomManager2Room_InitHandler.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.RoomRoot)] - public class RoomManager2Room_InitHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, RoomManager2Room_Init request, Room2RoomManager_Init response) - { - Room room = root.AddComponent(); - - room.AddComponent>(request.PlayerIds); - - room.LSWorld = new LSWorld(SceneType.LockStepServer); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/RoomManager2Room_InitHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/RoomManager2Room_InitHandler.cs.meta deleted file mode 100644 index 9443281e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/LockStep/Room/RoomManager2Room_InitHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8cd5223c61a80bb4e8470bed8c0f2304 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module.meta deleted file mode 100644 index 2a3ba0c3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 063e5b821422d91469928eec797a86b4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI.meta deleted file mode 100644 index b482751a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 663974eab9143cd4aa7740221e48e4f2 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIEntitySystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIEntitySystem.cs deleted file mode 100644 index bad92483..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIEntitySystem.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET.Server -{ - [EntitySystemOf(typeof(AOIEntity))] - [FriendOf(typeof(AOIEntity))] - public static partial class AOIEntitySystem2 - { - [EntitySystem] - private static void Awake(this AOIEntity self, int distance, float3 pos) - { - self.ViewDistance = distance; - self.Scene().GetComponent().Add(self, pos.x, pos.z); - } - - [EntitySystem] - private static void Destroy(this AOIEntity self) - { - self.Scene().GetComponent()?.Remove(self); - self.ViewDistance = 0; - self.SeeUnits.Clear(); - self.SeePlayers.Clear(); - self.BeSeePlayers.Clear(); - self.BeSeeUnits.Clear(); - self.SubEnterCells.Clear(); - self.SubLeaveCells.Clear(); - } - } - - [FriendOf(typeof(AOIEntity))] - [FriendOf(typeof(Cell))] - public static partial class AOIEntitySystem - { - // 获取在自己视野中的对象 - public static Dictionary GetSeeUnits(this AOIEntity self) - { - return self.SeeUnits; - } - - public static Dictionary GetBeSeePlayers(this AOIEntity self) - { - return self.BeSeePlayers; - } - - public static Dictionary GetSeePlayers(this AOIEntity self) - { - return self.SeePlayers; - } - - // cell中的unit进入self的视野 - public static void SubEnter(this AOIEntity self, Cell cell) - { - cell.SubsEnterEntities.Add(self.Id, self); - foreach (KeyValuePair kv in cell.AOIUnits) - { - if (kv.Key == self.Id) - { - continue; - } - - self.EnterSight(kv.Value); - } - } - - public static void UnSubEnter(this AOIEntity self, Cell cell) - { - cell.SubsEnterEntities.Remove(self.Id); - } - - public static void SubLeave(this AOIEntity self, Cell cell) - { - cell.SubsLeaveEntities.Add(self.Id, self); - } - - // cell中的unit离开self的视野 - public static void UnSubLeave(this AOIEntity self, Cell cell) - { - foreach (KeyValuePair kv in cell.AOIUnits) - { - if (kv.Key == self.Id) - { - continue; - } - - self.LeaveSight(kv.Value); - } - - cell.SubsLeaveEntities.Remove(self.Id); - } - - // enter进入self视野 - public static void EnterSight(this AOIEntity self, AOIEntity enter) - { - // 有可能之前在Enter,后来出了Enter还在LeaveCell,这样仍然没有删除,继续进来Enter,这种情况不需要处理 - if (self.SeeUnits.ContainsKey(enter.Id)) - { - return; - } - - if (!AOISeeCheckHelper.IsCanSee(self, enter)) - { - return; - } - - if (self.Unit.Type == UnitType.Player) - { - if (enter.Unit.Type == UnitType.Player) - { - self.SeeUnits.Add(enter.Id, enter); - enter.BeSeeUnits.Add(self.Id, self); - self.SeePlayers.Add(enter.Id, enter); - enter.BeSeePlayers.Add(self.Id, self); - - } - else - { - self.SeeUnits.Add(enter.Id, enter); - enter.BeSeeUnits.Add(self.Id, self); - enter.BeSeePlayers.Add(self.Id, self); - } - } - else - { - if (enter.Unit.Type == UnitType.Player) - { - self.SeeUnits.Add(enter.Id, enter); - enter.BeSeeUnits.Add(self.Id, self); - self.SeePlayers.Add(enter.Id, enter); - } - else - { - self.SeeUnits.Add(enter.Id, enter); - enter.BeSeeUnits.Add(self.Id, self); - } - } - EventSystem.Instance.Publish(self.Scene(), new EventType.UnitEnterSightRange() { A = self, B = enter }); - } - - // leave离开self视野 - public static void LeaveSight(this AOIEntity self, AOIEntity leave) - { - if (self.Id == leave.Id) - { - return; - } - - if (!self.SeeUnits.ContainsKey(leave.Id)) - { - return; - } - - self.SeeUnits.Remove(leave.Id); - if (leave.Unit.Type == UnitType.Player) - { - self.SeePlayers.Remove(leave.Id); - } - - leave.BeSeeUnits.Remove(self.Id); - if (self.Unit.Type == UnitType.Player) - { - leave.BeSeePlayers.Remove(self.Id); - } - - EventSystem.Instance.Publish(self.Scene(), new EventType.UnitLeaveSightRange { A = self, B = leave }); - } - - /// - /// 是否在Unit视野范围内 - /// - /// - /// - /// - public static bool IsBeSee(this AOIEntity self, long unitId) - { - return self.BeSeePlayers.ContainsKey(unitId); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIEntitySystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIEntitySystem.cs.meta deleted file mode 100644 index f027b9d3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIEntitySystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 652ae649b0d965d44b15b66a2b2a15b2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIHelper.cs deleted file mode 100644 index 14383257..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIHelper.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [FriendOf(typeof(AOIEntity))] - public static partial class AOIHelper - { - public static long CreateCellId(int x, int y) - { - return (long) ((ulong) x << 32) | (uint) y; - } - - public static void CalcEnterAndLeaveCell(AOIEntity aoiEntity, int cellX, int cellY, HashSet enterCell, HashSet leaveCell) - { - enterCell.Clear(); - leaveCell.Clear(); - int r = (aoiEntity.ViewDistance - 1) / AOIManagerComponent.CellSize + 1; - int leaveR = r; - if (aoiEntity.Unit.Type == UnitType.Player) - { - leaveR += 1; - } - - for (int i = cellX - leaveR; i <= cellX + leaveR; ++i) - { - for (int j = cellY - leaveR; j <= cellY + leaveR; ++j) - { - long cellId = CreateCellId(i, j); - leaveCell.Add(cellId); - - if (i > cellX + r || i < cellX - r || j > cellY + r || j < cellY - r) - { - continue; - } - - enterCell.Add(cellId); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIHelper.cs.meta deleted file mode 100644 index 53223687..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37db3276e119c254295c2b6e57aeee57 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs deleted file mode 100644 index b99c986e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs +++ /dev/null @@ -1,187 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [FriendOf(typeof(AOIManagerComponent))] - [FriendOf(typeof(AOIEntity))] - [FriendOf(typeof(Cell))] - public static partial class AOIManagerComponentSystem - { - public static void Add(this AOIManagerComponent self, AOIEntity aoiEntity, float x, float y) - { - int cellX = (int)(x * 1000) / AOIManagerComponent.CellSize; - int cellY = (int)(y * 1000) / AOIManagerComponent.CellSize; - - if (aoiEntity.ViewDistance == 0) - { - aoiEntity.ViewDistance = 1; - } - - AOIHelper.CalcEnterAndLeaveCell(aoiEntity, cellX, cellY, aoiEntity.SubEnterCells, aoiEntity.SubLeaveCells); - - // 遍历EnterCell - foreach (long cellId in aoiEntity.SubEnterCells) - { - Cell cell = self.GetCell(cellId); - aoiEntity.SubEnter(cell); - } - - // 遍历LeaveCell - foreach (long cellId in aoiEntity.SubLeaveCells) - { - Cell cell = self.GetCell(cellId); - aoiEntity.SubLeave(cell); - } - - // 自己加入的Cell - Cell selfCell = self.GetCell(AOIHelper.CreateCellId(cellX, cellY)); - aoiEntity.Cell = selfCell; - selfCell.Add(aoiEntity); - // 通知订阅该Cell Enter的Unit - foreach (KeyValuePair kv in selfCell.SubsEnterEntities) - { - kv.Value.EnterSight(aoiEntity); - } - } - - public static void Remove(this AOIManagerComponent self, AOIEntity aoiEntity) - { - if (aoiEntity.Cell == null) - { - return; - } - - // 通知订阅该Cell Leave的Unit - aoiEntity.Cell.Remove(aoiEntity); - foreach (KeyValuePair kv in aoiEntity.Cell.SubsLeaveEntities) - { - kv.Value.LeaveSight(aoiEntity); - } - - // 通知自己订阅的Enter Cell,清理自己 - foreach (long cellId in aoiEntity.SubEnterCells) - { - Cell cell = self.GetCell(cellId); - aoiEntity.UnSubEnter(cell); - } - - foreach (long cellId in aoiEntity.SubLeaveCells) - { - Cell cell = self.GetCell(cellId); - aoiEntity.UnSubLeave(cell); - } - - // 检查 - if (aoiEntity.SeeUnits.Count > 1) - { - Log.Error($"aoiEntity has see units: {aoiEntity.SeeUnits.Count}"); - } - - if (aoiEntity.BeSeeUnits.Count > 1) - { - Log.Error($"aoiEntity has beSee units: {aoiEntity.BeSeeUnits.Count}"); - } - } - - private static Cell GetCell(this AOIManagerComponent self, long cellId) - { - Cell cell = self.GetChild(cellId); - if (cell == null) - { - cell = self.AddChildWithId(cellId); - } - - return cell; - } - - public static void Move(AOIEntity aoiEntity, Cell newCell, Cell preCell) - { - aoiEntity.Cell = newCell; - preCell.Remove(aoiEntity); - newCell.Add(aoiEntity); - // 通知订阅该newCell Enter的Unit - foreach (KeyValuePair kv in newCell.SubsEnterEntities) - { - if (kv.Value.SubEnterCells.Contains(preCell.Id)) - { - continue; - } - - kv.Value.EnterSight(aoiEntity); - } - - // 通知订阅preCell leave的Unit - foreach (KeyValuePair kv in preCell.SubsLeaveEntities) - { - // 如果新的cell仍然在对方订阅的subleave中 - if (kv.Value.SubLeaveCells.Contains(newCell.Id)) - { - continue; - } - - kv.Value.LeaveSight(aoiEntity); - } - } - - public static void Move(this AOIManagerComponent self, AOIEntity aoiEntity, int cellX, int cellY) - { - long newCellId = AOIHelper.CreateCellId(cellX, cellY); - if (aoiEntity.Cell.Id == newCellId) // cell没有变化 - { - return; - } - - // 自己加入新的Cell - Cell newCell = self.GetCell(newCellId); - Move(aoiEntity, newCell, aoiEntity.Cell); - - AOIHelper.CalcEnterAndLeaveCell(aoiEntity, cellX, cellY, aoiEntity.enterHashSet, aoiEntity.leaveHashSet); - - // 算出自己leave新Cell - foreach (long cellId in aoiEntity.leaveHashSet) - { - if (aoiEntity.SubLeaveCells.Contains(cellId)) - { - continue; - } - - Cell cell = self.GetCell(cellId); - aoiEntity.SubLeave(cell); - } - - // 算出需要通知离开的Cell - aoiEntity.SubLeaveCells.ExceptWith(aoiEntity.leaveHashSet); - foreach (long cellId in aoiEntity.SubLeaveCells) - { - Cell cell = self.GetCell(cellId); - aoiEntity.UnSubLeave(cell); - } - - // 这里交换两个HashSet,提高性能 - ObjectHelper.Swap(ref aoiEntity.SubLeaveCells, ref aoiEntity.leaveHashSet); - - // 算出自己看到的新Cell - foreach (long cellId in aoiEntity.enterHashSet) - { - if (aoiEntity.SubEnterCells.Contains(cellId)) - { - continue; - } - - Cell cell = self.GetCell(cellId); - aoiEntity.SubEnter(cell); - } - - // 离开的Enter - aoiEntity.SubEnterCells.ExceptWith(aoiEntity.enterHashSet); - foreach (long cellId in aoiEntity.SubEnterCells) - { - Cell cell = self.GetCell(cellId); - aoiEntity.UnSubEnter(cell); - } - - // 这里交换两个HashSet,提高性能 - ObjectHelper.Swap(ref aoiEntity.SubEnterCells, ref aoiEntity.enterHashSet); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs.meta deleted file mode 100644 index 0c4c2127..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba627657b5b945f42879a685aa491be8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs deleted file mode 100644 index b849c10f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ET.Server -{ - public static partial class AOISeeCheckHelper - { - public static bool IsCanSee(AOIEntity a, AOIEntity b) - { - return true; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs.meta deleted file mode 100644 index 5b267ebb..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/AOISeeCheckHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 13b8112b4a2e587479d6fe24b8c39c1a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/CellSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/CellSystem.cs deleted file mode 100644 index 748bce08..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/CellSystem.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections.Generic; -using System.Text; - -namespace ET.Server -{ - [EntitySystemOf(typeof(Cell))] - [FriendOf(typeof(Cell))] - public static partial class CellSystem - { - [EntitySystem] - private static void Awake(this ET.Server.Cell self) - { - - } - - [EntitySystem] - private static void Destroy(this Cell self) - { - self.AOIUnits.Clear(); - - self.SubsEnterEntities.Clear(); - - self.SubsLeaveEntities.Clear(); - } - - public static void Add(this Cell self, AOIEntity aoiEntity) - { - self.AOIUnits.Add(aoiEntity.Id, aoiEntity); - } - - public static void Remove(this Cell self, AOIEntity aoiEntity) - { - self.AOIUnits.Remove(aoiEntity.Id); - } - - public static string CellIdToString(this long cellId) - { - int y = (int)(cellId & 0xffffffff); - int x = (int)((ulong)cellId >> 32); - return $"{x}:{y}"; - } - - public static string CellIdToString(this HashSet cellIds) - { - StringBuilder sb = new StringBuilder(); - foreach (long cellId in cellIds) - { - sb.Append(cellId.CellIdToString()); - sb.Append(","); - } - - return sb.ToString(); - } - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/CellSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/CellSystem.cs.meta deleted file mode 100644 index 96299541..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/AOI/CellSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1286ef0bf56acc14dad6dd9a105a2bfc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation.meta deleted file mode 100644 index b039e2ef..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 73a856bb588c88d40b0b0f2131b27027 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs deleted file mode 100644 index 0dc26a92..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs +++ /dev/null @@ -1,310 +0,0 @@ -using System; -using System.IO; -using MongoDB.Bson; - -namespace ET.Server -{ - [EntitySystemOf(typeof(ActorLocationSenderOneType))] - [FriendOf(typeof(ActorLocationSenderOneType))] - [FriendOf(typeof(ActorLocationSender))] - public static partial class ActorLocationSenderComponentSystem - { - [Invoke(TimerInvokeType.ActorLocationSenderChecker)] - public class ActorLocationSenderChecker: ATimer - { - protected override void Run(ActorLocationSenderOneType self) - { - try - { - self.Check(); - } - catch (Exception e) - { - Log.Error($"move timer error: {self.Id}\n{e}"); - } - } - } - - [EntitySystem] - private static void Awake(this ActorLocationSenderOneType self, int locationType) - { - self.LocationType = locationType; - // 每10s扫描一次过期的actorproxy进行回收,过期时间是2分钟 - // 可能由于bug或者进程挂掉,导致ActorLocationSender发送的消息没有确认,结果无法自动删除,每一分钟清理一次这种ActorLocationSender - self.CheckTimer = self.Fiber().TimerComponent.NewRepeatedTimer(10 * 1000, TimerInvokeType.ActorLocationSenderChecker, self); - } - - [EntitySystem] - private static void Destroy(this ActorLocationSenderOneType self) - { - self.Fiber().TimerComponent?.Remove(ref self.CheckTimer); - } - - private static void Check(this ActorLocationSenderOneType self) - { - using (ListComponent list = ListComponent.Create()) - { - long timeNow = self.Fiber().TimeInfo.ServerNow(); - foreach ((long key, Entity value) in self.Children) - { - ActorLocationSender actorLocationMessageSender = (ActorLocationSender) value; - - if (timeNow > actorLocationMessageSender.LastSendOrRecvTime + ActorLocationSenderOneType.TIMEOUT_TIME) - { - list.Add(key); - } - } - - foreach (long id in list) - { - self.Remove(id); - } - } - } - - private static ActorLocationSender GetOrCreate(this ActorLocationSenderOneType self, long id) - { - if (id == 0) - { - throw new Exception($"actor id is 0"); - } - - if (self.Children.TryGetValue(id, out Entity actorLocationSender)) - { - return (ActorLocationSender) actorLocationSender; - } - - actorLocationSender = self.AddChildWithId(id); - return (ActorLocationSender) actorLocationSender; - } - - // 有需要主动删除actorMessageSender的需求,比如断线重连,玩家登录了不同的Gate,这时候需要通知map删掉之前的actorMessageSender - // 然后重新创建新的,重新请求新的ActorId - public static void Remove(this ActorLocationSenderOneType self, long id) - { - if (!self.Children.TryGetValue(id, out Entity actorMessageSender)) - { - return; - } - - actorMessageSender.Dispose(); - } - - // 发给不会改变位置的actorlocation用这个,这种actor消息不会阻塞发送队列,性能更高 - // 发送过去找不到actor不会重试,用此方法,你得保证actor提前注册好了location - public static void Send(this ActorLocationSenderOneType self, long entityId, IActorMessage message) - { - self.SendInner(entityId, message).Coroutine(); - } - - private static async ETTask SendInner(this ActorLocationSenderOneType self, long entityId, IActorMessage message) - { - ActorLocationSender actorLocationSender = self.GetOrCreate(entityId); - - Scene root = self.Root(); - - if (actorLocationSender.ActorId != default) - { - actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow(); - root.GetComponent().Send(actorLocationSender.ActorId, message); - return; - } - - long instanceId = actorLocationSender.InstanceId; - - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.ActorLocationSender; - using (await root.Fiber.CoroutineLockComponent.Wait(coroutineLockType, entityId)) - { - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorTimeout, $"{message}"); - } - - if (actorLocationSender.ActorId == default) - { - actorLocationSender.ActorId = await root.GetComponent().Get(self.LocationType, actorLocationSender.Id); - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{message}"); - } - } - - actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow(); - root.GetComponent().Send(actorLocationSender.ActorId, message); - } - } - - // 发给不会改变位置的actorlocation用这个,这种actor消息不会阻塞发送队列,性能更高,发送过去找不到actor不会重试 - // 发送过去找不到actor不会重试,用此方法,你得保证actor提前注册好了location - public static async ETTask Call(this ActorLocationSenderOneType self, long entityId, IActorRequest request) - { - ActorLocationSender actorLocationSender = self.GetOrCreate(entityId); - - Scene root = self.Root(); - - if (actorLocationSender.ActorId != default) - { - actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow(); - return await root.GetComponent().Call(actorLocationSender.ActorId, request); - } - - long instanceId = actorLocationSender.InstanceId; - - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.ActorLocationSender; - using (await root.Fiber.CoroutineLockComponent.Wait(coroutineLockType, entityId)) - { - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorTimeout, $"{request}"); - } - - if (actorLocationSender.ActorId == default) - { - actorLocationSender.ActorId = await root.GetComponent().Get(self.LocationType, actorLocationSender.Id); - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{request}"); - } - } - } - - actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow(); - return await root.GetComponent().Call(actorLocationSender.ActorId, request); - } - - public static void Send(this ActorLocationSenderOneType self, long entityId, IActorLocationMessage message) - { - self.Call(entityId, message).Coroutine(); - } - - public static async ETTask Call(this ActorLocationSenderOneType self, long entityId, IActorLocationRequest iActorRequest) - { - ActorLocationSender actorLocationSender = self.GetOrCreate(entityId); - - Scene root = self.Root(); - - int rpcId = root.GetComponent().GetRpcId(); - iActorRequest.RpcId = rpcId; - - long actorLocationSenderInstanceId = actorLocationSender.InstanceId; - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.ActorLocationSender; - using (await root.Fiber.CoroutineLockComponent.Wait(coroutineLockType, entityId)) - { - if (actorLocationSender.InstanceId != actorLocationSenderInstanceId) - { - throw new RpcException(ErrorCore.ERR_ActorTimeout, $"{iActorRequest}"); - } - - // 队列中没处理的消息返回跟上个消息一样的报错 - if (actorLocationSender.Error == ErrorCore.ERR_NotFoundActor) - { - return ActorHelper.CreateResponse(iActorRequest, actorLocationSender.Error); - } - - try - { - return await self.CallInner(actorLocationSender, rpcId, iActorRequest); - } - catch (RpcException) - { - self.Remove(actorLocationSender.Id); - throw; - } - catch (Exception e) - { - self.Remove(actorLocationSender.Id); - throw new Exception($"{iActorRequest}", e); - } - } - } - - private static async ETTask CallInner(this ActorLocationSenderOneType self, ActorLocationSender actorLocationSender, int rpcId, IActorRequest iActorRequest) - { - int failTimes = 0; - long instanceId = actorLocationSender.InstanceId; - actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow(); - - Scene root = self.Root(); - - while (true) - { - if (actorLocationSender.ActorId == default) - { - actorLocationSender.ActorId = await root.GetComponent().Get(self.LocationType, actorLocationSender.Id); - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{iActorRequest}"); - } - } - - if (actorLocationSender.ActorId == default) - { - actorLocationSender.Error = ErrorCore.ERR_NotFoundActor; - return ActorHelper.CreateResponse(iActorRequest, ErrorCore.ERR_NotFoundActor); - } - IActorResponse response = await root.GetComponent().Call(actorLocationSender.ActorId, rpcId, iActorRequest, needException: false); - - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout3, $"{iActorRequest}"); - } - - switch (response.Error) - { - case ErrorCore.ERR_NotFoundActor: - { - // 如果没找到Actor,重试 - ++failTimes; - if (failTimes > 20) - { - Log.Debug($"actor send message fail, actorid: {actorLocationSender.Id} {iActorRequest}"); - actorLocationSender.Error = ErrorCore.ERR_NotFoundActor; - // 这里不能删除actor,要让后面等待发送的消息也返回ERR_NotFoundActor,直到超时删除 - return response; - } - - // 等待0.5s再发送 - await root.Fiber.TimerComponent.WaitAsync(500); - if (actorLocationSender.InstanceId != instanceId) - { - throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout4, $"{iActorRequest}"); - } - - actorLocationSender.ActorId = default; - continue; - } - case ErrorCore.ERR_ActorTimeout: - { - throw new RpcException(response.Error, $"{iActorRequest}"); - } - } - - if (ErrorCore.IsRpcNeedThrowException(response.Error)) - { - throw new RpcException(response.Error, $"Message: {response.Message} Request: {iActorRequest}"); - } - - return response; - } - } - } - - [EntitySystemOf(typeof(ActorLocationSenderComponent))] - [FriendOf(typeof (ActorLocationSenderComponent))] - public static partial class ActorLocationSenderManagerComponentSystem - { - [EntitySystem] - private static void Awake(this ActorLocationSenderComponent self) - { - for (int i = 0; i < self.ActorLocationSenderComponents.Length; ++i) - { - self.ActorLocationSenderComponents[i] = self.AddChild(i); - } - } - - public static ActorLocationSenderOneType Get(this ActorLocationSenderComponent self, int locationType) - { - return self.ActorLocationSenderComponents[locationType]; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs.meta deleted file mode 100644 index 0c01f21d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d9c5b5f290f9eb049a98efe57de93c0e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs deleted file mode 100644 index 1456aef2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace ET.Server -{ - [EntitySystemOf(typeof(ActorLocationSender))] - [FriendOf(typeof(ActorLocationSender))] - public static partial class ActorLocationSenderSystem - { - [EntitySystem] - private static void Awake(this ActorLocationSender self) - { - self.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow(); - self.ActorId = default; - self.Error = 0; - } - - [EntitySystem] - private static void Destroy(this ActorLocationSender self) - { - Log.Debug($"actor location remove: {self.Id}"); - self.LastSendOrRecvTime = 0; - self.ActorId = default; - self.Error = 0; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs.meta deleted file mode 100644 index 28c33a7f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c78fb4596a5212845bde1ec4757efa39 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs deleted file mode 100644 index 00b2d84c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; - -namespace ET.Server -{ - [EnableClass] - public abstract class ActorMessageLocationHandler: IMActorHandler where E : Entity where Message : class, IActorLocationMessage - { - protected abstract ETTask Run(E entity, Message message); - - public async ETTask Handle(Entity entity, Address fromAddress, MessageObject actorMessage) - { - if (actorMessage is not Message message) - { - Log.Error($"消息类型转换错误: {actorMessage.GetType().FullName} to {typeof (Message).Name}"); - return; - } - - if (entity is not E e) - { - Log.Error($"Actor类型转换错误: {entity.GetType().FullName} to {typeof (E).FullName} --{typeof (Message).FullName}"); - return; - } - - ActorResponse response = new() {RpcId = message.RpcId}; - entity.Root().GetComponent().Reply(fromAddress, response); - - await this.Run(e, message); - } - - public Type GetRequestType() - { - return typeof (Message); - } - - public Type GetResponseType() - { - return typeof (ActorResponse); - } - } - - - - [EnableClass] - public abstract class ActorMessageLocationHandler: IMActorHandler where E : Entity where Request : MessageObject, IActorLocationRequest where Response : MessageObject, IActorLocationResponse - { - protected abstract ETTask Run(E unit, Request request, Response response); - - public async ETTask Handle(Entity entity, Address fromAddress, MessageObject actorMessage) - { - try - { - if (actorMessage is not Request request) - { - Log.Error($"消息类型转换错误: {actorMessage.GetType().FullName} to {typeof (Request).Name}"); - return; - } - - if (entity is not E ee) - { - Log.Error($"Actor类型转换错误: {entity.GetType().FullName} to {typeof (E).FullName} --{typeof (Request).FullName}"); - return; - } - - int rpcId = request.RpcId; - Response response = ObjectPool.Instance.Fetch(); - - try - { - await this.Run(ee, request, response); - } - catch (Exception exception) - { - Log.Error(exception); - response.Error = ErrorCore.ERR_RpcFail; - response.Message = exception.ToString(); - } - response.RpcId = rpcId; - entity.Root().GetComponent().Reply(fromAddress, response); - } - catch (Exception e) - { - throw new Exception($"解释消息失败: {actorMessage.GetType().FullName}", e); - } - } - - public Type GetRequestType() - { - return typeof (Request); - } - - public Type GetResponseType() - { - return typeof (Response); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs.meta deleted file mode 100644 index 0870444b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1366e4041bf79d1468b108c582082181 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs deleted file mode 100644 index db935b73..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.Location)] - public class FiberInit_Location: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - root.AddComponent(); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs.meta deleted file mode 100644 index 6fed3bab..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: dfa61d7b9671c944c8edbcfffc94b189 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs deleted file mode 100644 index d821c633..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; - -namespace ET.Server -{ - [EntitySystemOf(typeof(LockInfo))] - [FriendOf(typeof(LockInfo))] - public static partial class LockInfoSystem - { - [EntitySystem] - private static void Awake(this LockInfo self, ActorId lockActorId, CoroutineLock coroutineLock) - { - self.CoroutineLock = coroutineLock; - self.LockActorId = lockActorId; - } - - [EntitySystem] - private static void Destroy(this LockInfo self) - { - self.CoroutineLock.Dispose(); - self.LockActorId = default; - } - } - - - [EntitySystemOf(typeof(LocationOneType))] - [FriendOf(typeof(LocationOneType))] - [FriendOf(typeof(LockInfo))] - public static partial class LocationOneTypeSystem - { - [EntitySystem] - private static void Awake(this LocationOneType self, int locationType) - { - self.LocationType = locationType; - } - - public static async ETTask Add(this LocationOneType self, long key, ActorId instanceId) - { - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location; - using (await self.Fiber().CoroutineLockComponent.Wait(coroutineLockType, key)) - { - self.locations[key] = instanceId; - Log.Info($"location add key: {key} instanceId: {instanceId}"); - } - } - - public static async ETTask Remove(this LocationOneType self, long key) - { - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location; - using (await self.Fiber().CoroutineLockComponent.Wait(coroutineLockType, key)) - { - self.locations.Remove(key); - Log.Info($"location remove key: {key}"); - } - } - - public static async ETTask Lock(this LocationOneType self, long key, ActorId actorId, int time = 0) - { - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location; - CoroutineLock coroutineLock = await self.Fiber().CoroutineLockComponent.Wait(coroutineLockType, key); - - LockInfo lockInfo = self.AddChild(actorId, coroutineLock); - self.lockInfos.Add(key, lockInfo); - - Log.Info($"location lock key: {key} instanceId: {actorId}"); - - if (time > 0) - { - async ETTask TimeWaitAsync() - { - long lockInfoInstanceId = lockInfo.InstanceId; - await self.Fiber().TimerComponent.WaitAsync(time); - if (lockInfo.InstanceId != lockInfoInstanceId) - { - return; - } - Log.Info($"location timeout unlock key: {key} instanceId: {actorId} newInstanceId: {actorId}"); - self.UnLock(key, actorId, actorId); - } - TimeWaitAsync().Coroutine(); - } - } - - public static void UnLock(this LocationOneType self, long key, ActorId oldActorId, ActorId newInstanceId) - { - if (!self.lockInfos.TryGetValue(key, out LockInfo lockInfo)) - { - Log.Error($"location unlock not found key: {key} {oldActorId}"); - return; - } - - if (oldActorId != lockInfo.LockActorId) - { - Log.Error($"location unlock oldInstanceId is different: {key} {oldActorId}"); - return; - } - - Log.Info($"location unlock key: {key} instanceId: {oldActorId} newInstanceId: {newInstanceId}"); - - self.locations[key] = newInstanceId; - - self.lockInfos.Remove(key); - - // 解锁 - lockInfo.Dispose(); - } - - public static async ETTask Get(this LocationOneType self, long key) - { - int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location; - using (await self.Fiber().CoroutineLockComponent.Wait(coroutineLockType, key)) - { - self.locations.TryGetValue(key, out ActorId actorId); - Log.Info($"location get key: {key} actorId: {actorId}"); - return actorId; - } - } - } - - [EntitySystemOf(typeof(LocationManagerComoponent))] - [FriendOf(typeof (LocationManagerComoponent))] - public static partial class LocationComoponentSystem - { - [EntitySystem] - private static void Awake(this LocationManagerComoponent self) - { - for (int i = 0; i < self.LocationOneTypes.Length; ++i) - { - self.LocationOneTypes[i] = self.AddChild(i); - } - } - - public static LocationOneType Get(this LocationManagerComoponent self, int locationType) - { - return self.LocationOneTypes[locationType]; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs.meta deleted file mode 100644 index 99a6c0c5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c4a35bb25143640b1a80652d551b4ce9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs deleted file mode 100644 index 6c5f278e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -namespace ET.Server -{ - public static partial class LocationProxyComponentSystem - { - private static ActorId GetLocationSceneId(long key) - { - return StartSceneConfigCategory.Instance.LocationConfig.ActorId; - } - - public static async ETTask Add(this LocationProxyComponent self, int type, long key, ActorId actorId) - { - Log.Info($"location proxy add {key}, {actorId} {self.Fiber().TimeInfo.ServerNow()}"); - await self.Root().GetComponent().Call(GetLocationSceneId(key), - new ObjectAddRequest() { Type = type, Key = key, ActorId = actorId }); - } - - public static async ETTask Lock(this LocationProxyComponent self, int type, long key, ActorId actorId, int time = 60000) - { - Log.Info($"location proxy lock {key}, {actorId} {self.Fiber().TimeInfo.ServerNow()}"); - await self.Root().GetComponent().Call(GetLocationSceneId(key), - new ObjectLockRequest() { Type = type, Key = key, ActorId = actorId, Time = time }); - } - - public static async ETTask UnLock(this LocationProxyComponent self, int type, long key, ActorId oldActorId, ActorId newActorId) - { - Log.Info($"location proxy unlock {key}, {newActorId} {self.Fiber().TimeInfo.ServerNow()}"); - await self.Root().GetComponent().Call(GetLocationSceneId(key), - new ObjectUnLockRequest() { Type = type, Key = key, OldActorId = oldActorId, NewActorId = newActorId }); - } - - public static async ETTask Remove(this LocationProxyComponent self, int type, long key) - { - Log.Info($"location proxy add {key}, {self.Fiber().TimeInfo.ServerNow()}"); - await self.Root().GetComponent().Call(GetLocationSceneId(key), - new ObjectRemoveRequest() { Type = type, Key = key }); - } - - public static async ETTask Get(this LocationProxyComponent self, int type, long key) - { - if (key == 0) - { - throw new Exception($"get location key 0"); - } - - // location server配置到共享区,一个大战区可以配置N多个location server,这里暂时为1 - ObjectGetResponse response = - (ObjectGetResponse) await self.Root().GetComponent().Call(GetLocationSceneId(key), - new ObjectGetRequest() { Type = type, Key = key }); - return response.ActorId; - } - - public static async ETTask AddLocation(this Entity self, int type) - { - await self.Root().GetComponent().Add(type, self.Id, self.GetActorId()); - } - - public static async ETTask RemoveLocation(this Entity self, int type) - { - await self.Root().GetComponent().Remove(type, self.Id); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs.meta deleted file mode 100644 index 097c34c1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 898ea95a00c4c6442bd0bd8322094277 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectAddRequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectAddRequestHandler.cs deleted file mode 100644 index ee17b3bb..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectAddRequestHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Location)] - public class ObjectAddRequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene scene, ObjectAddRequest request, ObjectAddResponse response) - { - await scene.GetComponent().Get(request.Type).Add(request.Key, request.ActorId); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectAddRequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectAddRequestHandler.cs.meta deleted file mode 100644 index af91ebd3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectAddRequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0f6c2757c99f36b459abe314a571260c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectGetRequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectGetRequestHandler.cs deleted file mode 100644 index 64082a53..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectGetRequestHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Location)] - public class ObjectGetRequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene scene, ObjectGetRequest request, ObjectGetResponse response) - { - response.ActorId = await scene.GetComponent().Get(request.Type).Get(request.Key); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectGetRequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectGetRequestHandler.cs.meta deleted file mode 100644 index 71af3eb0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectGetRequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7c7646f47e2c7394ba566e5fda9cd3dc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectLockRequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectLockRequestHandler.cs deleted file mode 100644 index f13f23c3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectLockRequestHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Location)] - public class ObjectLockRequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene scene, ObjectLockRequest request, ObjectLockResponse response) - { - await scene.GetComponent().Get(request.Type).Lock(request.Key, request.ActorId, request.Time); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectLockRequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectLockRequestHandler.cs.meta deleted file mode 100644 index d814c2e2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectLockRequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4be989f429e198044aec36d3fbfef1f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectRemoveRequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectRemoveRequestHandler.cs deleted file mode 100644 index c89ce356..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectRemoveRequestHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Location)] - public class ObjectRemoveRequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene scene, ObjectRemoveRequest request, ObjectRemoveResponse response) - { - await scene.GetComponent().Get(request.Type).Remove(request.Key); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectRemoveRequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectRemoveRequestHandler.cs.meta deleted file mode 100644 index c08069bf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectRemoveRequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9d16c6c9a7661cc4389e5b14d72ff25d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectUnLockRequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectUnLockRequestHandler.cs deleted file mode 100644 index ab21f436..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectUnLockRequestHandler.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.Location)] - public class ObjectUnLockRequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene scene, ObjectUnLockRequest request, ObjectUnLockResponse response) - { - scene.GetComponent().Get(request.Type).UnLock(request.Key, request.OldActorId, request.NewActorId); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectUnLockRequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectUnLockRequestHandler.cs.meta deleted file mode 100644 index 507d821a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/ActorLocation/ObjectUnLockRequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 77b92c4f020a77b4b98b215b660cfe3b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB.meta deleted file mode 100644 index 5eb8b900..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2f3a62c696459cb4894764862b609a46 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBComponentSystem.cs deleted file mode 100644 index 60569f78..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBComponentSystem.cs +++ /dev/null @@ -1,251 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq.Expressions; -using MongoDB.Driver; - -namespace ET.Server -{ - [EntitySystemOf(typeof(DBComponent))] - [FriendOf(typeof(DBComponent))] - public static partial class DBComponentSystem - { - [EntitySystem] - private static void Awake(this DBComponent self, string dbConnection, string dbName, int zone) - { - self.mongoClient = new MongoClient(dbConnection); - self.database = self.mongoClient.GetDatabase(dbName); - } - - private static IMongoCollection GetCollection(this DBComponent self, string collection = null) - { - return self.database.GetCollection(collection ?? typeof (T).Name); - } - - private static IMongoCollection GetCollection(this DBComponent self, string name) - { - return self.database.GetCollection(name); - } - - #region Query - - public static async ETTask Query(this DBComponent self, long id, string collection = null) where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, id % DBComponent.TaskCount)) - { - IAsyncCursor cursor = await self.GetCollection(collection).FindAsync(d => d.Id == id); - - return await cursor.FirstOrDefaultAsync(); - } - } - - public static async ETTask> Query(this DBComponent self, Expression> filter, string collection = null) - where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount)) - { - IAsyncCursor cursor = await self.GetCollection(collection).FindAsync(filter); - - return await cursor.ToListAsync(); - } - } - - public static async ETTask> Query(this DBComponent self, long taskId, Expression> filter, string collection = null) - where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount)) - { - IAsyncCursor cursor = await self.GetCollection(collection).FindAsync(filter); - - return await cursor.ToListAsync(); - } - } - - public static async ETTask Query(this DBComponent self, long id, List collectionNames, List result) - { - if (collectionNames == null || collectionNames.Count == 0) - { - return; - } - - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, id % DBComponent.TaskCount)) - { - foreach (string collectionName in collectionNames) - { - IAsyncCursor cursor = await self.GetCollection(collectionName).FindAsync(d => d.Id == id); - - Entity e = await cursor.FirstOrDefaultAsync(); - - if (e == null) - { - continue; - } - - result.Add(e); - } - } - } - - public static async ETTask> QueryJson(this DBComponent self, string json, string collection = null) where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount)) - { - FilterDefinition filterDefinition = new JsonFilterDefinition(json); - IAsyncCursor cursor = await self.GetCollection(collection).FindAsync(filterDefinition); - return await cursor.ToListAsync(); - } - } - - public static async ETTask> QueryJson(this DBComponent self, long taskId, string json, string collection = null) where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount)) - { - FilterDefinition filterDefinition = new JsonFilterDefinition(json); - IAsyncCursor cursor = await self.GetCollection(collection).FindAsync(filterDefinition); - return await cursor.ToListAsync(); - } - } - - #endregion - - #region Insert - - public static async ETTask InsertBatch(this DBComponent self, IEnumerable list, string collection = null) where T: Entity - { - if (collection == null) - { - collection = typeof (T).Name; - } - - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount)) - { - await self.GetCollection(collection).InsertManyAsync(list); - } - } - - #endregion - - #region Save - - public static async ETTask Save(this DBComponent self, T entity, string collection = null) where T : Entity - { - if (entity == null) - { - Log.Error($"save entity is null: {typeof (T).Name}"); - - return; - } - - if (collection == null) - { - collection = entity.GetType().FullName; - } - - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, entity.Id % DBComponent.TaskCount)) - { - await self.GetCollection(collection).ReplaceOneAsync(d => d.Id == entity.Id, entity, new ReplaceOptions { IsUpsert = true }); - } - } - - public static async ETTask Save(this DBComponent self, long taskId, T entity, string collection = null) where T : Entity - { - if (entity == null) - { - Log.Error($"save entity is null: {typeof (T).Name}"); - - return; - } - - if (collection == null) - { - collection = entity.GetType().FullName; - } - - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount)) - { - await self.GetCollection(collection).ReplaceOneAsync(d => d.Id == entity.Id, entity, new ReplaceOptions { IsUpsert = true }); - } - } - - public static async ETTask Save(this DBComponent self, long id, List entities) - { - if (entities == null) - { - Log.Error($"save entity is null"); - return; - } - - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, id % DBComponent.TaskCount)) - { - foreach (Entity entity in entities) - { - if (entity == null) - { - continue; - } - - await self.GetCollection(entity.GetType().FullName) - .ReplaceOneAsync(d => d.Id == entity.Id, entity, new ReplaceOptions { IsUpsert = true }); - } - } - } - - public static async ETTask SaveNotWait(this DBComponent self, T entity, long taskId = 0, string collection = null) where T : Entity - { - if (taskId == 0) - { - await self.Save(entity, collection); - - return; - } - - await self.Save(taskId, entity, collection); - } - - #endregion - - #region Remove - - public static async ETTask Remove(this DBComponent self, long id, string collection = null) where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, id % DBComponent.TaskCount)) - { - DeleteResult result = await self.GetCollection(collection).DeleteOneAsync(d => d.Id == id); - - return result.DeletedCount; - } - } - - public static async ETTask Remove(this DBComponent self, long taskId, long id, string collection = null) where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount)) - { - DeleteResult result = await self.GetCollection(collection).DeleteOneAsync(d => d.Id == id); - - return result.DeletedCount; - } - } - - public static async ETTask Remove(this DBComponent self, Expression> filter, string collection = null) where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount)) - { - DeleteResult result = await self.GetCollection(collection).DeleteManyAsync(filter); - - return result.DeletedCount; - } - } - - public static async ETTask Remove(this DBComponent self, long taskId, Expression> filter, string collection = null) - where T : Entity - { - using (await self.Fiber().CoroutineLockComponent.Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount)) - { - DeleteResult result = await self.GetCollection(collection).DeleteManyAsync(filter); - - return result.DeletedCount; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBComponentSystem.cs.meta deleted file mode 100644 index 02c74304..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f19e3330918fd704a90558bf305e8be6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs deleted file mode 100644 index 351aa43b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; - -namespace ET.Server -{ - [FriendOf(typeof(DBManagerComponent))] - public static partial class DBManagerComponentSystem - { - public static DBComponent GetZoneDB(this DBManagerComponent self, int zone) - { - DBComponent dbComponent = self.DBComponents[zone]; - if (dbComponent != null) - { - return dbComponent; - } - - StartZoneConfig startZoneConfig = StartZoneConfigCategory.Instance.Get(zone); - if (startZoneConfig.DBConnection == "") - { - throw new Exception($"zone: {zone} not found mongo connect string"); - } - - dbComponent = self.AddChild(startZoneConfig.DBConnection, startZoneConfig.DBName, zone); - self.DBComponents[zone] = dbComponent; - return dbComponent; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs.meta deleted file mode 100644 index 9f27827d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 46065c60cd29636488a1ef3c436ce6bc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http.meta deleted file mode 100644 index 3d7a0e24..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cd3c768fde72d464094ec6d867788cf7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http/HttpComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http/HttpComponentSystem.cs deleted file mode 100644 index 2efa3c58..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http/HttpComponentSystem.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; - -namespace ET.Server -{ - [EntitySystemOf(typeof(HttpComponent))] - [FriendOf(typeof(HttpComponent))] - public static partial class HttpComponentSystem - { - [EntitySystem] - private static void Awake(this HttpComponent self, string address) - { - try - { - self.Listener = new HttpListener(); - - foreach (string s in address.Split(';')) - { - if (s.Trim() == "") - { - continue; - } - self.Listener.Prefixes.Add(s); - } - - self.Listener.Start(); - - self.Accept().Coroutine(); - } - catch (HttpListenerException e) - { - throw new Exception($"请先在cmd中运行: netsh http add urlacl url=http://*:你的address中的端口/ user=Everyone, address: {address}", e); - } - } - - [EntitySystem] - private static void Destroy(this HttpComponent self) - { - self.Listener.Stop(); - self.Listener.Close(); - } - - private static async ETTask Accept(this HttpComponent self) - { - long instanceId = self.InstanceId; - while (self.InstanceId == instanceId) - { - try - { - HttpListenerContext context = await self.Listener.GetContextAsync(); - self.Handle(context).Coroutine(); - } - catch (ObjectDisposedException) - { - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - private static async ETTask Handle(this HttpComponent self, HttpListenerContext context) - { - try - { - IHttpHandler handler = HttpDispatcher.Instance.Get(self.IScene.SceneType, context.Request.Url.AbsolutePath); - await handler.Handle(self.Scene(), context); - } - catch (Exception e) - { - Log.Error(e); - } - context.Request.InputStream.Dispose(); - context.Response.OutputStream.Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http/HttpComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http/HttpComponentSystem.cs.meta deleted file mode 100644 index f5c36165..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Http/HttpComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 70f2ab9b9fd4f114795f68e7e8311ac5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message.meta deleted file mode 100644 index a9736748..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 34561c39c6a10754abfb53da3becd29b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs deleted file mode 100644 index 8935bb90..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.NetInner)] - public class A2NetInner_MessageHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, A2NetInner_Message innerMessage) - { - root.GetComponent().Send(innerMessage.ActorId, innerMessage.MessageObject); - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs.meta deleted file mode 100644 index 233e7926..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c88c8f9b180ab7f4b8c92e3cbdd3260f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs deleted file mode 100644 index 73ac94cf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ActorMessageHandler(SceneType.NetInner)] - public class A2NetInner_RequestHandler: ActorMessageHandler - { - protected override async ETTask Run(Scene root, A2NetInner_Request request, A2NetInner_Response response) - { - response.MessageObject = await root.GetComponent().Call(request.ActorId, request.MessageObject, request.NeedException); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs.meta deleted file mode 100644 index b1549de4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/A2NetInner_RequestHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd158674e3aca934cb0bf40359f60577 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs deleted file mode 100644 index 81651cd4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Net; - -namespace ET.Server -{ - [EntitySystemOf(typeof(ActorOuterComponent))] - [FriendOf(typeof(ActorOuterComponent))] - public static partial class ActorOuterComponentSystem - { - [EntitySystem] - private static void Awake(this ActorOuterComponent self, IPEndPoint address) - { - switch (self.InnerProtocol) - { - case NetworkProtocol.TCP: - { - self.AService = new TService(address, ServiceType.Inner); - break; - } - case NetworkProtocol.KCP: - { - self.AService = new KService(address, ServiceType.Inner); - break; - } - } - - self.AService.AcceptCallback = self.OnAccept; - self.AService.ReadCallback = self.OnRead; - self.AService.ErrorCallback = self.OnError; - } - - [EntitySystem] - private static void Update(this ActorOuterComponent self) - { - self.AService.Update(); - } - - [EntitySystem] - private static void Destroy(this ActorOuterComponent self) - { - self.AService.Dispose(); - } - - private static void OnRead(this ActorOuterComponent self, long channelId, ActorId actorId, object message) - { - Session session = self.GetChild(channelId); - if (session == null) - { - return; - } - - session.LastRecvTime = self.Fiber().TimeInfo.ClientFrameTime(); - - self.HandleMessage(actorId, message).Coroutine(); - } - - private static async ETTask HandleMessage(this ActorOuterComponent self, ActorId actorId, object message) - { - Fiber fiber = self.Fiber(); - int fromProcess = actorId.Process; - actorId.Process = fiber.Process; - - switch (message) - { - case IActorResponse iActorResponse: - { - self.HandleIActorResponse(iActorResponse); - return; - } - case IActorLocationRequest iActorRequest: - { - IActorResponse response = await fiber.ActorInnerComponent.Call(actorId, iActorRequest, false); - actorId.Process = fromProcess; - self.Send(actorId, response); - break; - } - case IActorRequest iActorRequest: - { - IActorResponse response = await fiber.ActorInnerComponent.Call(actorId, iActorRequest); - actorId.Process = fromProcess; - self.Send(actorId, response); - break; - } - default: - { - ActorMessageQueue.Instance.Send(actorId, (MessageObject)message); - break; - } - } - } - - private static void OnError(this ActorOuterComponent self, long channelId, int error) - { - Session session = self.GetChild(channelId); - if (session == null) - { - return; - } - - session.Error = error; - session.Dispose(); - } - - // 这个channelId是由CreateAcceptChannelId生成的 - private static void OnAccept(this ActorOuterComponent self, long channelId, IPEndPoint ipEndPoint) - { - Session session = self.AddChildWithId(channelId, self.AService); - session.RemoteAddress = ipEndPoint; - //session.AddComponent(NetThreadComponent.checkInteral, NetThreadComponent.recvMaxIdleTime, NetThreadComponent.sendMaxIdleTime); - } - - private static Session CreateInner(this ActorOuterComponent self, long channelId, IPEndPoint ipEndPoint) - { - Session session = self.AddChildWithId(channelId, self.AService); - session.RemoteAddress = ipEndPoint; - self.AService.Create(channelId, ipEndPoint); - - //session.AddComponent(); - //session.AddComponent(NetThreadComponent.checkInteral, NetThreadComponent.recvMaxIdleTime, NetThreadComponent.sendMaxIdleTime); - - return session; - } - - // 内网actor session,channelId是进程号 - private static Session Get(this ActorOuterComponent self, long channelId) - { - Session session = self.GetChild(channelId); - if (session != null) - { - return session; - } - - IPEndPoint ipEndPoint = StartSceneConfigCategory.Instance.Get((int) channelId).InnerIPPort; - session = self.CreateInner(channelId, ipEndPoint); - return session; - } - - public static void HandleIActorResponse(this ActorOuterComponent self, IActorResponse response) - { - if (!self.requestCallback.Remove(response.RpcId, out ActorMessageSender actorMessageSender)) - { - return; - } - Run(actorMessageSender, response); - } - - private static void Run(ActorMessageSender self, IActorResponse response) - { - if (response.Error == ErrorCore.ERR_ActorTimeout) - { - self.Tcs.SetException(new Exception($"Rpc error: request, 注意Actor消息超时,请注意查看是否死锁或者没有reply: actorId: {self.ActorId} {self.Request}, response: {response}")); - return; - } - - if (self.NeedException && ErrorCore.IsRpcNeedThrowException(response.Error)) - { - self.Tcs.SetException(new Exception($"Rpc error: actorId: {self.ActorId} request: {self.Request}, response: {response}")); - return; - } - - self.Tcs.SetResult(response); - } - - public static void Send(this ActorOuterComponent self, ActorId actorId, IActorMessage message) - { - self.SendInner(actorId, message as MessageObject); - } - - private static void SendInner(this ActorOuterComponent self, ActorId actorId, MessageObject message) - { - if (actorId == default) - { - throw new Exception($"actor id is 0: {message}"); - } - - Fiber fiber = self.Fiber(); - // 如果发向同一个进程,则报错 - if (actorId.Process == fiber.Process) - { - throw new Exception($"actor is the same process: {fiber.Process} {actorId.Process}"); - } - - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.NetInners[actorId.Process]; - Session session = self.Get(startSceneConfig.Id); - actorId.Process = fiber.Process; - session.Send(actorId, message); - } - - private static int GetRpcId(this ActorOuterComponent self) - { - return ++self.RpcId; - } - - public static async ETTask Call(this ActorOuterComponent self, ActorId actorId, IActorRequest iActorRequest, bool needException = true) - { - if (actorId == default) - { - throw new Exception($"actor id is 0: {iActorRequest}"); - } - Fiber fiber = self.Fiber(); - - int rpcId = self.GetRpcId(); - - var tcs = ETTask.Create(true); - - self.requestCallback.Add(self.RpcId, new ActorMessageSender(actorId, iActorRequest, tcs, needException)); - - self.SendInner(actorId, iActorRequest as MessageObject); - - async ETTask Timeout() - { - await fiber.TimerComponent.WaitAsync(ActorOuterComponent.TIMEOUT_TIME); - if (!self.requestCallback.Remove(rpcId, out ActorMessageSender action)) - { - return; - } - - if (needException) - { - action.Tcs.SetException(new Exception($"actor sender timeout: {iActorRequest}")); - } - else - { - IActorResponse response = ActorHelper.CreateResponse(iActorRequest, ErrorCore.ERR_Timeout); - action.Tcs.SetResult(response); - } - } - - Timeout().Coroutine(); - - long beginTime = fiber.TimeInfo.ServerFrameTime(); - - IActorResponse response = await tcs; - - long endTime = fiber.TimeInfo.ServerFrameTime(); - - long costTime = endTime - beginTime; - if (costTime > 200) - { - Log.Warning($"actor rpc time > 200: {costTime} {iActorRequest}"); - } - - return response; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs.meta deleted file mode 100644 index a3d016f0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorOuterComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5950c6f1f1733d846864c5f87cc48038 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorSenderComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorSenderComponentSystem.cs deleted file mode 100644 index 78ade9cd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorSenderComponentSystem.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - [FriendOf(typeof(ActorSenderComponent))] - public static partial class ActorSenderComponentSystem - { - public static void Send(this ActorSenderComponent self, ActorId actorId, IActorMessage message) - { - Fiber fiber = self.Fiber(); - // 如果发向同一个进程,则扔到消息队列中 - if (actorId.Process == fiber.Process) - { - ActorMessageQueue.Instance.Send(fiber.Address, actorId, (MessageObject)message); - return; - } - - // 发给NetInner纤程 - A2NetInner_Message a2NetInnerMessage = A2NetInner_Message.Create(); - a2NetInnerMessage.FromAddress = fiber.Address; - a2NetInnerMessage.ActorId = actorId; - a2NetInnerMessage.MessageObject = message; - - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.NetInners[fiber.Process]; - ActorMessageQueue.Instance.Send(startSceneConfig.ActorId, a2NetInnerMessage); - } - - public static int GetRpcId(this ActorSenderComponent self) - { - return ++self.RpcId; - } - - public static async ETTask Call( - this ActorSenderComponent self, - ActorId actorId, - IActorRequest request, - bool needException = true - ) - { - request.RpcId = self.GetRpcId(); - - if (actorId == default) - { - throw new Exception($"actor id is 0: {request}"); - } - - return await self.Call(actorId, request.RpcId, request, needException); - } - - public static async ETTask Call( - this ActorSenderComponent self, - ActorId actorId, - int rpcId, - IActorRequest iActorRequest, - bool needException = true - ) - { - if (actorId == default) - { - throw new Exception($"actor id is 0: {iActorRequest}"); - } - Fiber fiber = self.Fiber(); - if (fiber.Process == actorId.Process) - { - return await fiber.Root.GetComponent().Call(actorId, rpcId, iActorRequest, needException); - } - - // 发给NetInner纤程 - A2NetInner_Request a2NetInner_Request = A2NetInner_Request.Create(); - a2NetInner_Request.ActorId = actorId; - a2NetInner_Request.MessageObject = iActorRequest; - a2NetInner_Request.NeedException = needException; - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.NetInners[fiber.Process]; - A2NetInner_Response response = await fiber.Root.GetComponent().Call( - startSceneConfig.ActorId, a2NetInner_Request, needException: a2NetInner_Request.NeedException) as A2NetInner_Response; - return response.MessageObject; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorSenderComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorSenderComponentSystem.cs.meta deleted file mode 100644 index bfec5a75..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/ActorSenderComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1dbffb76761f34144a9e283ec16a499a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/NetServerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/NetServerComponentSystem.cs deleted file mode 100644 index 32bbeec8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/NetServerComponentSystem.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Net; -using MongoDB.Bson; - -namespace ET.Server -{ - [EntitySystemOf(typeof(NetServerComponent))] - [FriendOf(typeof(NetServerComponent))] - public static partial class NetServerComponentSystem - { - [EntitySystem] - private static void Awake(this NetServerComponent self, IPEndPoint address) - { - self.AService = new KService(address, ServiceType.Outer); - self.AService.AcceptCallback = self.OnAccept; - self.AService.ReadCallback = self.OnRead; - self.AService.ErrorCallback = self.OnError; - } - - [EntitySystem] - private static void Update(this NetServerComponent self) - { - self.AService.Update(); - } - - [EntitySystem] - private static void Destroy(this NetServerComponent self) - { - self.AService.Dispose(); - } - - private static void OnError(this NetServerComponent self, long channelId, int error) - { - Session session = self.GetChild(channelId); - if (session == null) - { - return; - } - - session.Error = error; - session.Dispose(); - } - - // 这个channelId是由CreateAcceptChannelId生成的 - private static void OnAccept(this NetServerComponent self, long channelId, IPEndPoint ipEndPoint) - { - Session session = self.AddChildWithId(channelId, self.AService); - session.RemoteAddress = ipEndPoint; - - if (self.IScene.SceneType != SceneType.BenchmarkServer) - { - // 挂上这个组件,5秒就会删除session,所以客户端验证完成要删除这个组件。该组件的作用就是防止外挂一直连接不发消息也不进行权限验证 - session.AddComponent(); - // 客户端连接,2秒检查一次recv消息,10秒没有消息则断开 - session.AddComponent(); - } - } - - private static void OnRead(this NetServerComponent self, long channelId, ActorId actorId, object message) - { - Session session = self.GetChild(channelId); - if (session == null) - { - return; - } - session.LastRecvTime = self.Fiber().TimeInfo.ClientNow(); - - Log.Debug(message.ToJson()); - - EventSystem.Instance.Publish(self.Scene(), new NetServerComponentOnRead() {Session = session, Message = message}); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/NetServerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/NetServerComponentSystem.cs.meta deleted file mode 100644 index 2eb3a745..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Message/NetServerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40d0bddfefa8ce34a8349977968fc0cd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner.meta deleted file mode 100644 index d2d1f409..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7b4dd22515474c148af1637fe0a85045 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs deleted file mode 100644 index 0ff6123a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.NetInner)] - public class FiberInit_NetInner: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - root.AddComponent(); - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get(fiberInit.Fiber.Id); - root.AddComponent(startSceneConfig.InnerIPPort); - root.AddComponent(); - //root.AddComponent(); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs.meta deleted file mode 100644 index fc0f5f17..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e9246ca7a67d1d74283089a148b9ab16 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase.meta deleted file mode 100644 index 40808138..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a6633f9840ed3f84c84cd67e5f4912b6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/ARobotCase.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/ARobotCase.cs deleted file mode 100644 index 1c8d6afd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/ARobotCase.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace ET.Server -{ - // 这里为什么能定义class呢?因为这里只有逻辑,热重载后新的handler替换旧的,仍然没有问题 - [EnableClass] - public abstract class ARobotCase: AInvokeHandler - { - protected abstract ETTask Run(RobotCase robotCase); - - public override async ETTask Handle(RobotInvokeArgs a) - { - using RobotCase robotCase = await a.Fiber.Root.GetComponent().New(); - - try - { - await this.Run(robotCase); - } - catch (System.Exception e) - { - Log.Error($"{robotCase.Zone()} {e}"); - RobotLog.Console($"RobotCase Error {this.GetType().FullName}:\n\t{e}"); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/ARobotCase.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/ARobotCase.cs.meta deleted file mode 100644 index ce8303b9..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/ARobotCase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 34e94a083d078d541976cd51eb64b8c2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs deleted file mode 100644 index 4378efd8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - [FriendOf(typeof(RobotCaseComponent))] - public static partial class RobotCaseComponentSystem - { - public static int GetN(this RobotCaseComponent self) - { - return ++self.N; - } - - public static async ETTask New(this RobotCaseComponent self) - { - await ETTask.CompletedTask; - RobotCase robotCase = self.AddChild(); - return robotCase; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs.meta deleted file mode 100644 index 77cbd237..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/RobotCase/RobotCaseComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3fc65a37e69f17e43b4c2371e7f71ee6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router.meta deleted file mode 100644 index 62af223d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4e0e953d25e2c6e46960acc2bc16755f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_Router.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_Router.cs deleted file mode 100644 index 36b6b31a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_Router.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.Router)] - public class FiberInit_Router: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id); - - // 开发期间使用OuterIPPort,云服务器因为本机没有OuterIP,所以要改成InnerIPPort,然后在云防火墙中端口映射到InnerIPPort - root.AddComponent(startSceneConfig.OuterIPPort, startSceneConfig.StartProcessConfig.InnerIP); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_Router.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_Router.cs.meta deleted file mode 100644 index 931d7ca3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_Router.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c074f6c8ded9714399f7c1a900c657f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs deleted file mode 100644 index 24c81a83..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - [Invoke((long)SceneType.RouterManager)] - public class FiberInit_RouterManager: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id); - root.AddComponent($"http://*:{startSceneConfig.Port}/"); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs.meta deleted file mode 100644 index e77de319..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ce88e327d4106944f82129077d984047 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterComponentSystem.cs deleted file mode 100644 index 8eaa927a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterComponentSystem.cs +++ /dev/null @@ -1,646 +0,0 @@ -using System; -using System.Net; -using System.Net.Sockets; -using System.Runtime.InteropServices; - -namespace ET.Server -{ - [EntitySystemOf(typeof(RouterComponent))] - [FriendOf(typeof (RouterComponent))] - [FriendOf(typeof (RouterNode))] - public static partial class RouterComponentSystem - { - [EntitySystem] - private static void Awake(this RouterComponent self, IPEndPoint outerAddress, string innerIP) - { - self.OuterSocket = new Socket(outerAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp); - self.OuterSocket.Bind(outerAddress); - if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - self.OuterSocket.SendBufferSize = 16 * Kcp.OneM; - self.OuterSocket.ReceiveBufferSize = 16 * Kcp.OneM; - } - - self.InnerSocket = new Socket(outerAddress.AddressFamily, SocketType.Dgram, ProtocolType.Udp); - self.InnerSocket.Bind(new IPEndPoint(IPAddress.Parse(innerIP), 0)); - - if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - self.InnerSocket.SendBufferSize = 16 * Kcp.OneM; - self.InnerSocket.ReceiveBufferSize = 16 * Kcp.OneM; - } - - NetworkHelper.SetSioUdpConnReset(self.OuterSocket); - NetworkHelper.SetSioUdpConnReset(self.InnerSocket); - } - - [EntitySystem] - private static void Destroy(this RouterComponent self) - { - self.OuterSocket.Dispose(); - self.InnerSocket.Dispose(); - self.OuterNodes.Clear(); - self.IPEndPoint = null; - } - - [EntitySystem] - private static void Update(this RouterComponent self) - { - long timeNow = self.Fiber().TimeInfo.ClientNow(); - self.RecvOuter(timeNow); - self.RecvInner(timeNow); - - // 每秒钟检查一次 - if (timeNow - self.LastCheckTime > 1000) - { - self.CheckConnectTimeout(timeNow); - self.LastCheckTime = timeNow; - } - } - - private static IPEndPoint CloneAddress(this RouterComponent self) - { - IPEndPoint ipEndPoint = (IPEndPoint) self.IPEndPoint; - return new IPEndPoint(ipEndPoint.Address, ipEndPoint.Port); - } - - // 接收udp消息 - private static void RecvOuter(this RouterComponent self, long timeNow) - { - while (self.OuterSocket != null && self.OuterSocket.Available > 0) - { - try - { - int messageLength = self.OuterSocket.ReceiveFrom(self.Cache, ref self.IPEndPoint); - self.RecvOuterHandler(messageLength, timeNow); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - private static void CheckConnectTimeout(this RouterComponent self, long timeNow) - { - // 检查连接过程超时 - using (ListComponent listComponent = ListComponent.Create()) - { - foreach (var kv in self.ConnectIdNodes) - { - if (timeNow < kv.Value.LastRecvOuterTime + 10 * 1000) - { - continue; - } - - listComponent.Add(kv.Value.Id); - } - - foreach (long id in listComponent) - { - self.OnError(id, ErrorCore.ERR_KcpRouterConnectFail); - } - } - - // 外网消息超时就断开,内网因为会一直重发,没有重连之前内网连接一直存在,会导致router一直收到内网消息 - using (ListComponent listComponent = ListComponent.Create()) - { - foreach (var kv in self.OuterNodes) - { - // 比session超时应该多10秒钟 - if (timeNow < kv.Value.LastRecvOuterTime + ConstValue.SessionTimeoutTime + 10 * 1000) - { - continue; - } - - listComponent.Add(kv.Value.Id); - } - - foreach (long id in listComponent) - { - self.OnError(id, ErrorCore.ERR_KcpRouterTimeout); - } - } - } - - private static void RecvInner(this RouterComponent self, long timeNow) - { - while (self.InnerSocket != null && self.InnerSocket.Available > 0) - { - try - { - int messageLength = self.InnerSocket.ReceiveFrom(self.Cache, ref self.IPEndPoint); - self.RecvInnerHandler(messageLength, timeNow); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - private static void RecvOuterHandler(this RouterComponent self, int messageLength, long timeNow) - { - // 长度小于1,不是正常的消息 - if (messageLength < 1) - { - return; - } - - // accept - byte flag = self.Cache[0]; - switch (flag) - { - case KcpProtocalType.RouterReconnectSYN: - { - if (messageLength < 13) - { - break; - } - - uint outerConn = BitConverter.ToUInt32(self.Cache, 1); - uint innerConn = BitConverter.ToUInt32(self.Cache, 5); - uint connectId = BitConverter.ToUInt32(self.Cache, 9); - string realAddress = self.Cache.ToStr(13, messageLength - 13); - - RouterNode routerNode; - - // RouterAck之后ConnectIdNodes会删除,加入到OuterNodes中来 - if (!self.OuterNodes.TryGetValue(outerConn, out routerNode)) - { - self.ConnectIdNodes.TryGetValue(connectId, out routerNode); - if (routerNode == null) - { - Log.Info($"router create reconnect: {self.IPEndPoint} {realAddress} {connectId} {outerConn} {innerConn}"); - routerNode = self.New(realAddress, connectId, outerConn, innerConn, self.CloneAddress()); - // self.OuterNodes 这里不能add,因为还没验证完成,要在RouterAck中加入 - } - } - - if (routerNode.ConnectId != connectId) - { - Log.Warning($"kcp router router reconnect connectId diff1: {routerNode.SyncIpEndPoint} {(IPEndPoint) self.IPEndPoint}"); - break; - } - - // 不是自己的,outerConn冲突, 直接break,也就是说这个软路由上有个跟自己outerConn冲突的连接,就不能连接了 - // 这个路由连接不上,客户端会换个软路由,所以没关系 - if (routerNode.InnerConn != innerConn) - { - Log.Warning($"kcp router router reconnect inner conn diff1: {routerNode.SyncIpEndPoint} {(IPEndPoint) self.IPEndPoint}"); - break; - } - - if (routerNode.OuterConn != outerConn) - { - Log.Warning($"kcp router router reconnect outer conn diff1: {routerNode.SyncIpEndPoint} {(IPEndPoint) self.IPEndPoint}"); - break; - } - - // 校验ip,连接过程中ip不能变化 - if (!Equals(routerNode.SyncIpEndPoint, self.IPEndPoint)) - { - Log.Warning($"kcp router syn ip is diff1: {routerNode.SyncIpEndPoint} {(IPEndPoint) self.IPEndPoint}"); - break; - } - - // 校验内网地址 - if (routerNode.InnerAddress != realAddress) - { - Log.Warning($"router sync error2: {routerNode.OuterConn} {routerNode.InnerAddress} {outerConn} {realAddress}"); - break; - } - - if (++routerNode.RouterSyncCount > 40) - { - self.OnError(routerNode.Id, ErrorCore.ERR_KcpRouterRouterSyncCountTooMuchTimes); - break; - } - - // 转发到内网 - self.Cache.WriteTo(0, KcpProtocalType.RouterReconnectSYN); - self.Cache.WriteTo(1, outerConn); - self.Cache.WriteTo(5, innerConn); - self.Cache.WriteTo(9, connectId); - self.InnerSocket.SendTo(self.Cache, 0, 13, SocketFlags.None, routerNode.InnerIpEndPoint); - - if (!routerNode.CheckOuterCount(timeNow)) - { - self.OnError(routerNode.Id, ErrorCore.ERR_KcpRouterTooManyPackets); - } - - break; - } - case KcpProtocalType.RouterSYN: - { - if (messageLength < 13) - { - break; - } - - uint outerConn = BitConverter.ToUInt32(self.Cache, 1); - uint innerConn = BitConverter.ToUInt32(self.Cache, 5); - uint connectId = BitConverter.ToUInt32(self.Cache, 9); - string realAddress = self.Cache.ToStr(13, messageLength - 13); - - RouterNode routerNode; - - self.ConnectIdNodes.TryGetValue(connectId, out routerNode); - if (routerNode == null) - { - outerConn = NetServices.Instance.CreateConnectChannelId(); - routerNode = self.New(realAddress, connectId, outerConn, innerConn, self.CloneAddress()); - Log.Info($"router create: {realAddress} {connectId} {outerConn} {innerConn} {routerNode.SyncIpEndPoint}"); - self.OuterNodes.Add(routerNode.OuterConn, routerNode); - } - - if (++routerNode.RouterSyncCount > 40) - { - self.OnError(routerNode.Id, ErrorCore.ERR_KcpRouterRouterSyncCountTooMuchTimes); - break; - } - - // 校验ip,连接过程中ip不能变化 - if (!Equals(routerNode.SyncIpEndPoint, self.IPEndPoint)) - { - Log.Warning($"kcp router syn ip is diff1: {routerNode.SyncIpEndPoint} {self.IPEndPoint}"); - break; - } - - // 校验内网地址 - if (routerNode.InnerAddress != realAddress) - { - Log.Warning($"router sync error2: {routerNode.OuterConn} {routerNode.InnerAddress} {outerConn} {realAddress}"); - break; - } - - self.Cache.WriteTo(0, KcpProtocalType.RouterACK); - self.Cache.WriteTo(1, routerNode.InnerConn); - self.Cache.WriteTo(5, routerNode.OuterConn); - self.OuterSocket.SendTo(self.Cache, 0, 9, SocketFlags.None, routerNode.SyncIpEndPoint); - - if (!routerNode.CheckOuterCount(timeNow)) - { - self.OnError(routerNode.Id, ErrorCore.ERR_KcpRouterTooManyPackets); - } - - break; - } - case KcpProtocalType.SYN: - { - // 长度!=13,不是accpet消息 - if (messageLength != 9) - { - break; - } - - uint outerConn = BitConverter.ToUInt32(self.Cache, 1); // remote - uint innerConn = BitConverter.ToUInt32(self.Cache, 5); - - if (!self.OuterNodes.TryGetValue(outerConn, out RouterNode kcpRouter)) - { - Log.Warning($"kcp router syn not found outer nodes: {outerConn} {innerConn}"); - break; - } - - if (++kcpRouter.SyncCount > 20) - { - self.OnError(kcpRouter.Id, ErrorCore.ERR_KcpRouterSyncCountTooMuchTimes); - break; - } - - // 校验ip,连接过程中ip不能变化 - IPEndPoint ipEndPoint = (IPEndPoint) self.IPEndPoint; - if (!Equals(kcpRouter.SyncIpEndPoint.Address, ipEndPoint.Address)) - { - Log.Warning($"kcp router syn ip is diff3: {kcpRouter.SyncIpEndPoint.Address} {ipEndPoint.Address}"); - break; - } - - // 发了syn过来,那么RouterSyn就成功了,可以删除ConnectId - self.ConnectIdNodes.Remove(kcpRouter.ConnectId); - - kcpRouter.LastRecvOuterTime = timeNow; - kcpRouter.OuterIpEndPoint = self.CloneAddress(); - // 转发到内网, 带上客户端的地址 - self.Cache.WriteTo(0, KcpProtocalType.SYN); - self.Cache.WriteTo(1, outerConn); - self.Cache.WriteTo(5, innerConn); - byte[] addressBytes = ipEndPoint.ToString().ToByteArray(); - Array.Copy(addressBytes, 0, self.Cache, 9, addressBytes.Length); - Log.Info($"kcp router syn: {outerConn} {innerConn} {kcpRouter.InnerIpEndPoint} {kcpRouter.OuterIpEndPoint}"); - self.InnerSocket.SendTo(self.Cache, 0, 9 + addressBytes.Length, SocketFlags.None, kcpRouter.InnerIpEndPoint); - - if (!kcpRouter.CheckOuterCount(timeNow)) - { - self.OnError(kcpRouter.Id, ErrorCore.ERR_KcpRouterTooManyPackets); - } - - break; - } - case KcpProtocalType.FIN: // 断开 - { - // 长度!=13,不是DisConnect消息 - if (messageLength != 13) - { - break; - } - - uint outerConn = BitConverter.ToUInt32(self.Cache, 1); - uint innerConn = BitConverter.ToUInt32(self.Cache, 5); - - if (!self.OuterNodes.TryGetValue(outerConn, out RouterNode kcpRouter)) - { - Log.Warning($"kcp router outer fin not found outer nodes: {outerConn} {innerConn}"); - break; - } - - // 比对innerConn - if (kcpRouter.InnerConn != innerConn) - { - Log.Warning($"router node innerConn error: {innerConn} {outerConn} {kcpRouter.Status}"); - break; - } - - kcpRouter.LastRecvOuterTime = timeNow; - Log.Info($"kcp router outer fin: {outerConn} {innerConn} {kcpRouter.InnerIpEndPoint}"); - self.InnerSocket.SendTo(self.Cache, 0, messageLength, SocketFlags.None, kcpRouter.InnerIpEndPoint); - - if (!kcpRouter.CheckOuterCount(timeNow)) - { - self.OnError(kcpRouter.Id, ErrorCore.ERR_KcpRouterTooManyPackets); - } - - break; - } - case KcpProtocalType.MSG: - { - // 长度<9,不是Msg消息 - if (messageLength < 9) - { - break; - } - - // 处理chanel - uint outerConn = BitConverter.ToUInt32(self.Cache, 1); // remote - uint innerConn = BitConverter.ToUInt32(self.Cache, 5); // local - - if (!self.OuterNodes.TryGetValue(outerConn, out RouterNode kcpRouter)) - { - Log.Warning($"kcp router msg not found outer nodes: {outerConn} {innerConn}"); - break; - } - - if (kcpRouter.Status != RouterStatus.Msg) - { - Log.Warning($"router node status error: {innerConn} {outerConn} {kcpRouter.Status}"); - break; - } - - // 比对innerConn - if (kcpRouter.InnerConn != innerConn) - { - Log.Warning($"router node innerConn error: {innerConn} {outerConn} {kcpRouter.Status}"); - break; - } - - // 重连的时候,没有经过syn阶段,可能没有设置OuterIpEndPoint,重连请求Router的Socket跟发送消息的Socket不是同一个,所以udp出来的公网地址可能会变化 - if (!Equals(kcpRouter.OuterIpEndPoint, self.IPEndPoint)) - { - kcpRouter.OuterIpEndPoint = self.CloneAddress(); - } - - kcpRouter.LastRecvOuterTime = timeNow; - - self.InnerSocket.SendTo(self.Cache, 0, messageLength, SocketFlags.None, kcpRouter.InnerIpEndPoint); - - if (!kcpRouter.CheckOuterCount(timeNow)) - { - self.OnError(kcpRouter.Id, ErrorCore.ERR_KcpRouterTooManyPackets); - } - - break; - } - } - } - - private static void RecvInnerHandler(this RouterComponent self, int messageLength, long timeNow) - { - // 长度小于1,不是正常的消息 - if (messageLength < 1) - { - return; - } - - // accept - byte flag = self.Cache[0]; - - switch (flag) - { - case KcpProtocalType.RouterReconnectACK: - { - uint innerConn = BitConverter.ToUInt32(self.Cache, 1); - uint outerConn = BitConverter.ToUInt32(self.Cache, 5); - uint connectId = BitConverter.ToUInt32(self.Cache, 9); - if (!self.ConnectIdNodes.TryGetValue(connectId, out RouterNode kcpRouterNode)) - { - Log.Warning($"router node error: {innerConn} {connectId}"); - break; - } - - // 必须校验innerConn,防止伪造 - if (innerConn != kcpRouterNode.InnerConn) - { - Log.Warning( - $"router node innerConn error: {innerConn} {kcpRouterNode.InnerConn} {outerConn} {kcpRouterNode.OuterConn} {kcpRouterNode.Status}"); - break; - } - - // 必须校验outerConn,防止伪造 - if (outerConn != kcpRouterNode.OuterConn) - { - Log.Warning( - $"router node outerConn error: {innerConn} {kcpRouterNode.InnerConn} {outerConn} {kcpRouterNode.OuterConn} {kcpRouterNode.Status}"); - break; - } - - kcpRouterNode.Status = RouterStatus.Msg; - - kcpRouterNode.LastRecvInnerTime = timeNow; - - // 校验成功才加到outerNodes中, 如果这里有冲突,外网将连接失败,不过几率极小 - if (!self.OuterNodes.ContainsKey(outerConn)) - { - self.OuterNodes.Add(outerConn, kcpRouterNode); - self.ConnectIdNodes.Remove(connectId); - } - - // 转发出去 - self.Cache.WriteTo(0, KcpProtocalType.RouterReconnectACK); - self.Cache.WriteTo(1, kcpRouterNode.InnerConn); - self.Cache.WriteTo(5, kcpRouterNode.OuterConn); - Log.Info($"kcp router RouterAck: {outerConn} {innerConn} {kcpRouterNode.SyncIpEndPoint}"); - self.OuterSocket.SendTo(self.Cache, 0, 9, SocketFlags.None, kcpRouterNode.SyncIpEndPoint); - break; - } - - case KcpProtocalType.ACK: - { - uint innerConn = BitConverter.ToUInt32(self.Cache, 1); // remote - uint outerConn = BitConverter.ToUInt32(self.Cache, 5); // local - - if (!self.OuterNodes.TryGetValue(outerConn, out RouterNode kcpRouterNode)) - { - Log.Warning($"kcp router ack not found outer nodes: {outerConn} {innerConn}"); - break; - } - - kcpRouterNode.Status = RouterStatus.Msg; - - kcpRouterNode.InnerConn = innerConn; - - kcpRouterNode.LastRecvInnerTime = timeNow; - // 转发出去 - Log.Info($"kcp router ack: {outerConn} {innerConn} {kcpRouterNode.OuterIpEndPoint}"); - self.OuterSocket.SendTo(self.Cache, 0, messageLength, SocketFlags.None, kcpRouterNode.OuterIpEndPoint); - break; - } - case KcpProtocalType.FIN: // 断开 - { - // 长度!=13,不是DisConnect消息 - if (messageLength != 13) - { - break; - } - - uint innerConn = BitConverter.ToUInt32(self.Cache, 1); - uint outerConn = BitConverter.ToUInt32(self.Cache, 5); - - if (!self.OuterNodes.TryGetValue(outerConn, out RouterNode kcpRouterNode)) - { - Log.Warning($"kcp router inner fin not found outer nodes: {outerConn} {innerConn}"); - break; - } - - // 比对innerConn - if (kcpRouterNode.InnerConn != innerConn) - { - Log.Warning($"router node innerConn error: {innerConn} {outerConn} {kcpRouterNode.Status}"); - break; - } - - // 重连,这个字段可能为空,需要客户端发送消息上来才能设置 - if (kcpRouterNode.OuterIpEndPoint == null) - { - break; - } - - kcpRouterNode.LastRecvInnerTime = timeNow; - Log.Info($"kcp router inner fin: {outerConn} {innerConn} {kcpRouterNode.OuterIpEndPoint}"); - self.OuterSocket.SendTo(self.Cache, 0, messageLength, SocketFlags.None, kcpRouterNode.OuterIpEndPoint); - - break; - } - case KcpProtocalType.MSG: - { - // 长度<9,不是Msg消息 - if (messageLength < 9) - { - break; - } - - // 处理chanel - uint innerConn = BitConverter.ToUInt32(self.Cache, 1); // remote - uint outerConn = BitConverter.ToUInt32(self.Cache, 5); // local - - if (!self.OuterNodes.TryGetValue(outerConn, out RouterNode kcpRouterNode)) - { - Log.Warning($"kcp router inner msg not found outer nodes: {outerConn} {innerConn}"); - break; - } - - // 比对innerConn - if (kcpRouterNode.InnerConn != innerConn) - { - Log.Warning($"router node innerConn error: {innerConn} {outerConn} {kcpRouterNode.Status}"); - break; - } - - // 重连,这个字段可能为空,需要客户端发送消息上来才能设置 - if (kcpRouterNode.OuterIpEndPoint == null) - { - break; - } - - kcpRouterNode.LastRecvInnerTime = timeNow; - self.OuterSocket.SendTo(self.Cache, 0, messageLength, SocketFlags.None, kcpRouterNode.OuterIpEndPoint); - break; - } - } - } - - public static RouterNode Get(this RouterComponent self, uint outerConn) - { - RouterNode routerNode = null; - self.OuterNodes.TryGetValue(outerConn, out routerNode); - return routerNode; - } - - private static RouterNode New(this RouterComponent self, string innerAddress, uint connectId, uint outerConn, uint innerConn, IPEndPoint syncEndPoint) - { - RouterNode routerNode = self.AddChild(); - routerNode.ConnectId = connectId; - routerNode.OuterConn = outerConn; - routerNode.InnerConn = innerConn; - - routerNode.InnerIpEndPoint = NetworkHelper.ToIPEndPoint(innerAddress); - routerNode.SyncIpEndPoint = syncEndPoint; - routerNode.InnerAddress = innerAddress; - routerNode.LastRecvInnerTime = self.Fiber().TimeInfo.ClientNow(); - - self.ConnectIdNodes.Add(connectId, routerNode); - - routerNode.Status = RouterStatus.Sync; - - Log.Info($"router new: outerConn: {outerConn} innerConn: {innerConn} {syncEndPoint}"); - - return routerNode; - } - - public static void OnError(this RouterComponent self, long id, int error) - { - RouterNode routerNode = self.GetChild(id); - if (routerNode == null) - { - return; - } - - Log.Info($"router node remove: {routerNode.OuterConn} {routerNode.InnerConn} {error}"); - self.Remove(id); - } - - private static void Remove(this RouterComponent self, long id) - { - RouterNode routerNode = self.GetChild(id); - if (routerNode == null) - { - return; - } - - self.OuterNodes.Remove(routerNode.OuterConn); - - RouterNode connectRouterNode; - if (self.ConnectIdNodes.TryGetValue(routerNode.ConnectId, out connectRouterNode)) - { - if (connectRouterNode.Id == routerNode.Id) - { - self.ConnectIdNodes.Remove(routerNode.ConnectId); - } - } - - Log.Info($"router remove: {routerNode.Id} outerConn: {routerNode.OuterConn} innerConn: {routerNode.InnerConn}"); - - routerNode.Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterComponentSystem.cs.meta deleted file mode 100644 index ee6ec1fe..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 295da4f243f6ef64eaf46a00c63fa964 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterNodeSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterNodeSystem.cs deleted file mode 100644 index 3591fef0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterNodeSystem.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace ET.Server -{ - [EntitySystemOf(typeof(RouterNode))] - [FriendOf(typeof(RouterNode))] - public static partial class RouterNodeSystem - { - [EntitySystem] - private static void Awake(this RouterNode self) - { - long timeNow = self.Fiber().TimeInfo.ServerNow(); - self.LastRecvInnerTime = timeNow; - self.LastRecvOuterTime = timeNow; - self.OuterIpEndPoint = null; - self.InnerIpEndPoint = null; - self.RouterSyncCount = 0; - self.OuterConn = 0; - self.InnerConn = 0; - } - - [EntitySystem] - private static void Destroy(this RouterNode self) - { - self.OuterConn = 0; - self.InnerConn = 0; - self.LastRecvInnerTime = 0; - self.LastRecvOuterTime = 0; - self.OuterIpEndPoint = null; - self.InnerIpEndPoint = null; - self.InnerAddress = null; - self.RouterSyncCount = 0; - self.SyncCount = 0; - } - - public static bool CheckOuterCount(this RouterNode self, long timeNow) - { - if (self.LastCheckTime == 0) - { - self.LastCheckTime = timeNow; - } - - if (timeNow - self.LastCheckTime > 1000) - { - //Log.Debug($"router recv packet per second: {self.LimitCountPerSecond}"); - self.LimitCountPerSecond = 0; - self.LastCheckTime = timeNow; - } - - if (++self.LimitCountPerSecond > 1000) - { - return false; - } - - return true; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterNodeSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterNodeSystem.cs.meta deleted file mode 100644 index 560256db..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Module/Router/RouterNodeSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 17f639ceedd49c044aa375dee0e96c0f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Plugins.meta deleted file mode 100644 index dfd0eaa5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 337bf31669284174ba505282863741f6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example.meta deleted file mode 100644 index 97c030b3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 104b44fc093478b4c84ca77939c9c073 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example/HotfixServer.cs b/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example/HotfixServer.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example/HotfixServer.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example/HotfixServer.cs.meta deleted file mode 100644 index 2729f11e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Server/Plugins/Example/HotfixServer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b4c6cd5890235a44586579650c6b4b20 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share.meta b/Assets/GameScripts/DotNet/Hotfix/Share.meta deleted file mode 100644 index 425c020b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 684838d287dcf8641a1d4eace4de771d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/ConstValue.cs b/Assets/GameScripts/DotNet/Hotfix/Share/ConstValue.cs deleted file mode 100644 index 69e58704..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/ConstValue.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET -{ - public static partial class ConstValue - { - public const string RouterHttpHost = "127.0.0.1"; - public const int RouterHttpPort = 30300; - public const int SessionTimeoutTime = 30 * 1000; - - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/ConstValue.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/ConstValue.cs.meta deleted file mode 100644 index dc9310cf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/ConstValue.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9cd7e8c26c42593488e310f010368be9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Demo.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Demo.meta deleted file mode 100644 index bb687150..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4f3d5e7dba710ad42bc820d88c6beeec -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Demo/EntryEvent1_InitShare.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Demo/EntryEvent1_InitShare.cs deleted file mode 100644 index c101767b..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Demo/EntryEvent1_InitShare.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ET -{ - [Event(SceneType.Main)] - public class EntryEvent1_InitShare: AEvent - { - protected override async ETTask Run(Scene root, EventType.EntryEvent1 args) - { - await World.Instance.AddSingleton().LoadAsync(); - - root.AddComponent(); - root.AddComponent(MailBoxType.UnOrderedMessage); - root.AddComponent(); - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Demo/EntryEvent1_InitShare.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Demo/EntryEvent1_InitShare.cs.meta deleted file mode 100644 index 398e7eb0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Demo/EntryEvent1_InitShare.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a89652a7d79467f478370ea880290c8c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/FiberInit_Main.cs b/Assets/GameScripts/DotNet/Hotfix/Share/FiberInit_Main.cs deleted file mode 100644 index 748f7b2e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/FiberInit_Main.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace ET -{ - [Invoke((long)SceneType.Main)] - public class FiberInit_Main: AInvokeHandler - { - public override async ETTask Handle(FiberInit fiberInit) - { - Scene root = fiberInit.Fiber.Root; - await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent1()); - await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent2()); - await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent3()); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/FiberInit_Main.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/FiberInit_Main.cs.meta deleted file mode 100644 index 97c606bd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/FiberInit_Main.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 62d95081b9d849642bd346348b28c3ee -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep.meta b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep.meta deleted file mode 100644 index 04f5275a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9ac96337bfa5b4a7c8385ab25b8d36af -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSInputComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSInputComponentSystem.cs deleted file mode 100644 index 150497ad..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSInputComponentSystem.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using ET.Client; -using TrueSync; - -namespace ET -{ - [EntitySystemOf(typeof(LSInputComponent))] - [LSEntitySystemOf(typeof(LSInputComponent))] - public static partial class LSInputComponentSystem - { - [EntitySystem] - private static void Awake(this LSInputComponent self) - { - - } - - [LSEntitySystem] - private static void LSUpdate(this LSInputComponent self) - { - LSUnit unit = self.GetParent(); - - TSVector2 v2 = self.LSInput.V * 6 * 50 / 1000; - if (v2.LengthSquared() < 0.0001f) - { - return; - } - TSVector oldPos = unit.Position; - unit.Position += new TSVector(v2.x, 0, v2.y); - unit.Forward = unit.Position - oldPos; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSInputComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSInputComponentSystem.cs.meta deleted file mode 100644 index cb17e32f..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSInputComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4fa48744575ea4fd2a4f6e111ce26f11 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSUnitFactory.cs b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSUnitFactory.cs deleted file mode 100644 index b9855ea2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSUnitFactory.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ET -{ - public static partial class LSUnitFactory - { - public static LSUnit Init(LSWorld lsWorld, LockStepUnitInfo unitInfo) - { - LSUnitComponent lsUnitComponent = lsWorld.GetComponent(); - LSUnit lsUnit = lsUnitComponent.AddChildWithId(unitInfo.PlayerId); - - lsUnit.Position = unitInfo.Position; - lsUnit.Rotation = unitInfo.Rotation; - - lsUnit.AddComponent(); - return lsUnit; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSUnitFactory.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSUnitFactory.cs.meta deleted file mode 100644 index b1de3d58..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/LSUnitFactory.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1a93a389ec0e241f099646159dae6dcd -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/RoomSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/RoomSystem.cs deleted file mode 100644 index 239a0411..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/RoomSystem.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - [FriendOf(typeof(Room))] - public static partial class RoomSystem - { - public static Room Room(this Entity entity) - { - return entity.IScene as Room; - } - - public static void Init(this Room self, List unitInfos, long startTime, int frame = -1) - { - self.StartTime = startTime; - self.AuthorityFrame = frame; - self.PredictionFrame = frame; - self.Replay.UnitInfos = unitInfos; - self.FrameBuffer = new FrameBuffer(frame); - self.FixedTimeCounter = new FixedTimeCounter(self.StartTime, 0, LSConstValue.UpdateInterval); - LSWorld lsWorld = self.LSWorld; - lsWorld.Frame = frame + 1; - lsWorld.AddComponent(); - for (int i = 0; i < unitInfos.Count; ++i) - { - LockStepUnitInfo unitInfo = unitInfos[i]; - LSUnitFactory.Init(lsWorld, unitInfo); - self.PlayerIds.Add(unitInfo.PlayerId); - } - } - - public static void Update(this Room self, OneFrameInputs oneFrameInputs) - { - LSWorld lsWorld = self.LSWorld; - // 设置输入到每个LSUnit身上 - LSUnitComponent unitComponent = lsWorld.GetComponent(); - foreach (var kv in oneFrameInputs.Inputs) - { - LSUnit lsUnit = unitComponent.GetChild(kv.Key); - LSInputComponent lsInputComponent = lsUnit.GetComponent(); - lsInputComponent.LSInput = kv.Value; - } - - if (!self.IsReplay) - { - // 保存当前帧场景数据 - self.SaveLSWorld(); - self.Record(self.LSWorld.Frame); - } - - lsWorld.Update(); - } - - public static LSWorld GetLSWorld(this Room self, SceneType sceneType, int frame) - { - MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame); - memoryBuffer.Seek(0, SeekOrigin.Begin); - LSWorld lsWorld = MongoHelper.Deserialize(typeof (LSWorld), memoryBuffer) as LSWorld; - lsWorld.SceneType = sceneType; - memoryBuffer.Seek(0, SeekOrigin.Begin); - return lsWorld; - } - - private static void SaveLSWorld(this Room self) - { - int frame = self.LSWorld.Frame; - MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame); - memoryBuffer.Seek(0, SeekOrigin.Begin); - memoryBuffer.SetLength(0); - - MongoHelper.Serialize(self.LSWorld, memoryBuffer); - memoryBuffer.Seek(0, SeekOrigin.Begin); - - long hash = memoryBuffer.GetBuffer().Hash(0, (int) memoryBuffer.Length); - - self.FrameBuffer.SetHash(frame, hash); - } - - // 记录需要存档的数据 - public static void Record(this Room self, int frame) - { - if (frame > self.AuthorityFrame) - { - return; - } - OneFrameInputs oneFrameInputs = self.FrameBuffer.FrameInputs(frame); - OneFrameInputs saveInput = new(); - oneFrameInputs.CopyTo(saveInput); - self.Replay.FrameInputs.Add(saveInput); - if (frame % LSConstValue.SaveLSWorldFrameCount == 0) - { - MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame); - byte[] bytes = memoryBuffer.ToArray(); - self.Replay.Snapshots.Add(bytes); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/RoomSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/RoomSystem.cs.meta deleted file mode 100644 index 6f9f42c5..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/LockStep/RoomSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4a0ef11394d28492caa3959412027a17 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module.meta deleted file mode 100644 index 4f61ed3c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 524c1cf3137abd64499ebf1a42a7f879 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI.meta deleted file mode 100644 index cb2248c0..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a2809a97c6cbc7b42b7df4abc77cb1f7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI/AIComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI/AIComponentSystem.cs deleted file mode 100644 index 3f8fe3e2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI/AIComponentSystem.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; - -namespace ET -{ - [EntitySystemOf(typeof(AIComponent))] - [FriendOf(typeof(AIComponent))] - [FriendOf(typeof(AIDispatcherComponent))] - public static partial class AIComponentSystem - { - [Invoke(TimerInvokeType.AITimer)] - public class AITimer: ATimer - { - protected override void Run(AIComponent self) - { - try - { - self.Check(); - } - catch (Exception e) - { - Log.Error($"move timer error: {self.Id}\n{e}"); - } - } - } - - [EntitySystem] - private static void Awake(this AIComponent self, int aiConfigId) - { - self.AIConfigId = aiConfigId; - self.Timer = self.Fiber().TimerComponent.NewRepeatedTimer(1000, TimerInvokeType.AITimer, self); - } - - [EntitySystem] - private static void Destroy(this AIComponent self) - { - self.Fiber().TimerComponent?.Remove(ref self.Timer); - self.CancellationToken?.Cancel(); - self.CancellationToken = null; - self.Current = 0; - } - - private static void Check(this AIComponent self) - { - if (self.Parent == null) - { - self.Fiber().TimerComponent.Remove(ref self.Timer); - return; - } - - var oneAI = AIConfigCategory.Instance.AIConfigs[self.AIConfigId]; - - foreach (AIConfig aiConfig in oneAI.Values) - { - - AAIHandler aaiHandler = AIDispatcherComponent.Instance.Get(aiConfig.Name); - - if (aaiHandler == null) - { - Log.Error($"not found aihandler: {aiConfig.Name}"); - continue; - } - - int ret = aaiHandler.Check(self, aiConfig); - if (ret != 0) - { - continue; - } - - if (self.Current == aiConfig.Id) - { - break; - } - - self.Cancel(); // 取消之前的行为 - ETCancellationToken cancellationToken = new ETCancellationToken(); - self.CancellationToken = cancellationToken; - self.Current = aiConfig.Id; - - aaiHandler.Execute(self, aiConfig, cancellationToken).Coroutine(); - return; - } - - } - - private static void Cancel(this AIComponent self) - { - self.CancellationToken?.Cancel(); - self.Current = 0; - self.CancellationToken = null; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI/AIComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI/AIComponentSystem.cs.meta deleted file mode 100644 index 1c113061..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/AI/AIComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fc49c73c647c3cb47974ecfc4bd8121f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor.meta deleted file mode 100644 index d40392ae..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ee3a9e6a195849ee8792a8793fb0bdd6 -timeCreated: 1687789835 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorHandleHelper.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorHandleHelper.cs deleted file mode 100644 index 2f50cfcd..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorHandleHelper.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; - -namespace ET -{ - public static partial class ActorHandleHelper - { - [EnableAccessEntiyChild] - public static async ETTask HandleMessage(Fiber fiber, ActorId actorId, MessageObject message) - { - await ETTask.CompletedTask; - /* - // 收到actor消息,放入actor队列 - switch (message) - { - case IActorRequest iActorRequest: - { - - - switch (mailBoxComponent.MailboxType) - { - case MailboxType.OrderedMessage: - { - using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.Mailbox, actorId.InstanceId)) - { - if (entity.InstanceId != actorId.InstanceId) - { - IActorResponse response = ActorHelper.CreateResponse(iActorRequest, ErrorCore.ERR_NotFoundActor); - ActorMessageSenderComponent.Instance.Reply(actorId, response); - break; - } - - await ActorMessageDispatcherComponent.Instance.Handle(entity, actorId, iActorRequest); - } - - break; - } - case MailboxType.UnOrderMessageDispatcher: - { - await ActorMessageDispatcherComponent.Instance.Handle(entity, actorId, iActorRequest); - break; - } - default: - throw new Exception($"no mailboxtype: {mailBoxComponent.MailboxType} {iActorRequest}"); - } - break; - } - case IActorMessage iActorMessage: - { - mailBoxComponent = Fiber.Instance.Mailboxes.Get(actorId.InstanceId); - if (mailBoxComponent == null) - { - Log.Error($"actor not found mailbox: {actorId} {iActorMessage}"); - return; - } - mailBoxComponent.Add(iActorMessage as MessageObject); - - switch (mailBoxComponent.MailboxType) - { - case MailboxType.OrderedMessage: - { - using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.Mailbox, actorId.InstanceId)) - { - if (entity.InstanceId != actorId.InstanceId) - { - break; - } - - await ActorMessageDispatcherComponent.Instance.Handle(entity, actorId, iActorMessage); - } - - break; - } - case MailboxType.UnOrderMessageDispatcher: - { - await ActorMessageDispatcherComponent.Instance.Handle(entity, actorId, iActorMessage); - break; - } - case MailboxType.GateSession: - { - if (entity is PlayerSessionComponent playerSessionComponent) - { - playerSessionComponent.Session?.Send(iActorMessage); - } - - break; - } - default: - throw new Exception($"no mailboxtype: {mailBoxComponent.MailboxType} {iActorMessage}"); - } - - break; - - } - - } - */ - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorHandleHelper.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorHandleHelper.cs.meta deleted file mode 100644 index 95378fe2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorHandleHelper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: db010549ca0dacb4aad130643706b6f8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorMessageHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorMessageHandler.cs deleted file mode 100644 index f6526a88..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorMessageHandler.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; - -namespace ET -{ - [EnableClass] - public abstract class ActorMessageHandler: IMActorHandler where E : Entity where Message : class, IActorMessage - { - protected abstract ETTask Run(E entity, Message message); - - public async ETTask Handle(Entity entity, Address fromAddress, MessageObject actorMessage) - { - if (actorMessage is not Message msg) - { - Log.Error($"消息类型转换错误: {actorMessage.GetType().FullName} to {typeof (Message).Name}"); - return; - } - - if (entity is not E e) - { - Log.Error($"Actor类型转换错误: {entity.GetType().FullName} to {typeof (E).Name} --{typeof (Message).FullName}"); - return; - } - - await this.Run(e, msg); - } - - public Type GetRequestType() - { - if (typeof (IActorLocationMessage).IsAssignableFrom(typeof (Message))) - { - Log.Error($"message is IActorLocationMessage but handler is AMActorHandler: {typeof (Message)}"); - } - - return typeof (Message); - } - - public Type GetResponseType() - { - return null; - } - } - - - - [EnableClass] - public abstract class ActorMessageHandler: IMActorHandler where E : Entity where Request : MessageObject, IActorRequest where Response : MessageObject, IActorResponse - { - protected abstract ETTask Run(E unit, Request request, Response response); - - public async ETTask Handle(Entity entity, Address fromAddress, MessageObject actorMessage) - { - try - { - if (actorMessage is not Request request) - { - Log.Error($"消息类型转换错误: {actorMessage.GetType().FullName} to {typeof (Request).Name}"); - return; - } - - if (entity is not E ee) - { - Log.Error($"Actor类型转换错误: {entity.GetType().FullName} to {typeof (E).FullName} --{typeof (Request).FullName}"); - return; - } - - int rpcId = request.RpcId; - Response response = ObjectPool.Instance.Fetch(); - - try - { - await this.Run(ee, request, response); - } - catch (Exception exception) - { - Log.Error(exception); - response.Error = ErrorCore.ERR_RpcFail; - response.Message = exception.ToString(); - } - - response.RpcId = rpcId; - entity.Root().GetComponent().Reply(fromAddress, response); - } - catch (Exception e) - { - throw new Exception($"解释消息失败: {actorMessage.GetType().FullName}", e); - } - } - - public Type GetRequestType() - { - if (typeof (IActorLocationRequest).IsAssignableFrom(typeof (Request))) - { - Log.Error($"message is IActorLocationMessage but handler is AMActorRpcHandler: {typeof (Request)}"); - } - - return typeof (Request); - } - - public Type GetResponseType() - { - return typeof (Response); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorMessageHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorMessageHandler.cs.meta deleted file mode 100644 index 5018c0a6..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/ActorMessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 04b4a2b11a349624bb67b2fe9a0ff8da -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs deleted file mode 100644 index eb8cb6d1..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace ET -{ - [Invoke((long)MailBoxType.OrderedMessage)] - public class MailBoxType_OrderedMessageHandler: AInvokeHandler - { - public override void Handle(MailBoxInvoker args) - { - HandleInner(args).Coroutine(); - } - - private static async ETTask HandleInner(MailBoxInvoker args) - { - MailBoxComponent mailBoxComponent = args.MailBoxComponent; - - // 对象池回收 - using MessageObject messageObject = args.MessageObject; - - CoroutineLockComponent coroutineLockComponent = mailBoxComponent.CoroutineLockComponent; - if (coroutineLockComponent == null) - { - return; - } - - long instanceId = mailBoxComponent.InstanceId; - using (await coroutineLockComponent.Wait(CoroutineLockType.Mailbox, mailBoxComponent.ParentInstanceId)) - { - if (mailBoxComponent.InstanceId != instanceId) - { - if (messageObject is IActorRequest request) - { - IActorResponse resp = ActorHelper.CreateResponse(request, ErrorCore.ERR_NotFoundActor); - mailBoxComponent.Root().GetComponent().Reply(args.FromAddress, resp); - } - return; - } - await ActorMessageDispatcherComponent.Instance.Handle(mailBoxComponent.Parent, args.FromAddress, messageObject); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs.meta deleted file mode 100644 index 25383585..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9b1a21d2bb4831842b09143fd143efe7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_UnOrderedMessageHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_UnOrderedMessageHandler.cs deleted file mode 100644 index 10b3fda7..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_UnOrderedMessageHandler.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET -{ - [Invoke((long)MailBoxType.UnOrderedMessage)] - public class MailBoxType_UnOrderedMessageHandler: AInvokeHandler - { - public override void Handle(MailBoxInvoker args) - { - HandleAsync(args).Coroutine(); - } - - private static async ETTask HandleAsync(MailBoxInvoker args) - { - MailBoxComponent mailBoxComponent = args.MailBoxComponent; - - using MessageObject messageObject = args.MessageObject; - - await ActorMessageDispatcherComponent.Instance.Handle(mailBoxComponent.Parent, args.FromAddress, messageObject); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_UnOrderedMessageHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_UnOrderedMessageHandler.cs.meta deleted file mode 100644 index 501b1771..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Actor/MailBoxType_UnOrderedMessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7552d478fb2b3534e967630e8c63e8b1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console.meta deleted file mode 100644 index 369a7a89..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fe0c2296b8e188a4cae9c6f010fd0d77 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs deleted file mode 100644 index 92f9ef84..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace ET -{ - [EntitySystemOf(typeof(ConsoleComponent))] - [FriendOf(typeof(ConsoleComponent))] - [FriendOf(typeof(ModeContex))] - public static partial class ConsoleComponentSystem - { - [EntitySystem] - private static void Awake(this ConsoleComponent self) - { - self.Start().Coroutine(); - } - - - private static async ETTask Start(this ConsoleComponent self) - { - self.CancellationTokenSource = new CancellationTokenSource(); - - while (true) - { - try - { - ModeContex modeContex = self.GetComponent(); - string line = await Task.Factory.StartNew(() => - { - Console.Write($"{modeContex?.Mode ?? ""}> "); - return Console.In.ReadLine(); - }, self.CancellationTokenSource.Token); - - line = line.Trim(); - - switch (line) - { - case "": - break; - case "exit": - self.RemoveComponent(); - break; - default: - { - string[] lines = line.Split(" "); - string mode = modeContex == null? lines[0] : modeContex.Mode; - - IConsoleHandler iConsoleHandler = ConsoleDispatcher.Instance.Get(mode); - if (modeContex == null) - { - modeContex = self.AddComponent(); - modeContex.Mode = mode; - } - await iConsoleHandler.Run(self.Fiber(), modeContex, line); - break; - } - } - - - } - catch (Exception e) - { - Log.Console(e.ToString()); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs.meta deleted file mode 100644 index cc75edea..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3bdd9b39878d7e04685a85d38bc88950 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs deleted file mode 100644 index 3069c04d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -namespace ET -{ - [ConsoleHandler(ConsoleMode.ReloadConfig)] - public class ReloadConfigConsoleHandler: IConsoleHandler - { - public async ETTask Run(Fiber fiber, ModeContex contex, string content) - { - switch (content) - { - case ConsoleMode.ReloadConfig: - contex.Parent.RemoveComponent(); - Log.Console("C must have config name, like: C UnitConfig"); - break; - default: - string[] ss = content.Split(" "); - string configName = ss[1]; - string category = $"{configName}Category"; - Type type = EventSystem.Instance.GetType($"ET.{category}"); - if (type == null) - { - Log.Console($"reload config but not find {category}"); - return; - } - ConfigComponent.Instance.Reload(type); - Log.Console($"reload config {configName} finish!"); - break; - } - - await ETTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs.meta deleted file mode 100644 index 7b4c1c27..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4bf64d72d2f1cc445ad8fb13eeef331b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs deleted file mode 100644 index 05e59c0a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - [ConsoleHandler(ConsoleMode.ReloadDll)] - public class ReloadDllConsoleHandler: IConsoleHandler - { - public async ETTask Run(Fiber fiber, ModeContex contex, string content) - { - await ETTask.CompletedTask; - CodeLoader.Instance.LoadHotfix(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs.meta deleted file mode 100644 index 6a2c1383..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ffe8f82cde98483438673415feab109a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message.meta deleted file mode 100644 index b67e43e2..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d247feb1f882fa24094546d5699183d9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs deleted file mode 100644 index 8775bf25..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; - -namespace ET -{ - [EntitySystemOf(typeof(SessionAcceptTimeoutComponent))] - [FriendOf(typeof(SessionAcceptTimeoutComponent))] - public static partial class SessionAcceptTimeoutComponentHelper - { - [Invoke(TimerInvokeType.SessionAcceptTimeout)] - public class SessionAcceptTimeout: ATimer - { - protected override void Run(SessionAcceptTimeoutComponent self) - { - try - { - self.Parent.Dispose(); - } - catch (Exception e) - { - Log.Error($"move timer error: {self.Id}\n{e}"); - } - } - } - - [EntitySystem] - private static void Awake(this SessionAcceptTimeoutComponent self) - { - self.Timer = self.Fiber().TimerComponent.NewOnceTimer(self.Fiber().TimeInfo.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self); - } - - [EntitySystem] - private static void Destroy(this SessionAcceptTimeoutComponent self) - { - self.Fiber().TimerComponent?.Remove(ref self.Timer); - } - - } - - -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs.meta deleted file mode 100644 index 2d614137..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 389d0d5a5107d864782d45a819b8fcd5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs deleted file mode 100644 index d4f9d343..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; - -namespace ET -{ - [EntitySystemOf(typeof(SessionIdleCheckerComponent))] - [FriendOf(typeof(SessionIdleCheckerComponent))] - public static partial class SessionIdleCheckerComponentSystem - { - [Invoke(TimerInvokeType.SessionIdleChecker)] - public class SessionIdleChecker: ATimer - { - protected override void Run(SessionIdleCheckerComponent self) - { - try - { - self.Check(); - } - catch (Exception e) - { - Log.Error($"session idle checker timer error: {self.Id}\n{e}"); - } - } - } - - [EntitySystem] - private static void Awake(this SessionIdleCheckerComponent self) - { - self.RepeatedTimer = self.Fiber().TimerComponent.NewRepeatedTimer(CheckInteral, TimerInvokeType.SessionIdleChecker, self); - } - - [EntitySystem] - private static void Destroy(this SessionIdleCheckerComponent self) - { - self.Fiber().TimerComponent?.Remove(ref self.RepeatedTimer); - } - - public const int CheckInteral = 2000; - - private static void Check(this SessionIdleCheckerComponent self) - { - Session session = self.GetParent(); - long timeNow = self.Fiber().TimeInfo.ClientNow(); - - if (timeNow - session.LastRecvTime < ConstValue.SessionTimeoutTime && timeNow - session.LastSendTime < ConstValue.SessionTimeoutTime) - { - return; - } - - Log.Info($"session timeout: {session.Id} {timeNow} {session.LastRecvTime} {session.LastSendTime} {timeNow - session.LastRecvTime} {timeNow - session.LastSendTime}"); - session.Error = ErrorCore.ERR_SessionSendOrRecvTimeout; - - session.Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs.meta deleted file mode 100644 index f3f75dd8..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a68abadd37d72f14393cf250c23e1164 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move.meta deleted file mode 100644 index 96eec375..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 069fa286008182847950a814f31931e3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move/MoveComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move/MoveComponentSystem.cs deleted file mode 100644 index 8aa38959..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move/MoveComponentSystem.cs +++ /dev/null @@ -1,294 +0,0 @@ -using System; -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET -{ - [EntitySystemOf(typeof(MoveComponent))] - [FriendOf(typeof(MoveComponent))] - public static partial class MoveComponentSystem - { - [Invoke(TimerInvokeType.MoveTimer)] - public class MoveTimer: ATimer - { - protected override void Run(MoveComponent self) - { - try - { - self.MoveForward(true); - } - catch (Exception e) - { - Log.Error($"move timer error: {self.Id}\n{e}"); - } - } - } - - - [EntitySystem] - private static void Destroy(this MoveComponent self) - { - self.MoveFinish(false); - } - - [EntitySystem] - private static void Awake(this MoveComponent self) - { - self.StartTime = 0; - self.StartPos = float3.zero; - self.NeedTime = 0; - self.MoveTimer = 0; - self.tcs = null; - self.Targets.Clear(); - self.Speed = 0; - self.N = 0; - self.TurnTime = 0; - } - - public static bool IsArrived(this MoveComponent self) - { - return self.Targets.Count == 0; - } - - public static bool ChangeSpeed(this MoveComponent self, float speed) - { - if (self.IsArrived()) - { - return false; - } - - if (speed < 0.0001) - { - return false; - } - - Unit unit = self.GetParent(); - - using ListComponent path = ListComponent.Create(); - - self.MoveForward(false); - - path.Add(unit.Position); // 第一个是Unit的pos - for (int i = self.N; i < self.Targets.Count; ++i) - { - path.Add(self.Targets[i]); - } - self.MoveToAsync(path, speed).Coroutine(); - return true; - } - - // 该方法不需要用cancelToken的方式取消,因为即使不传入cancelToken,多次调用该方法也要取消之前的移动协程,上层可以stop取消 - public static async ETTask MoveToAsync(this MoveComponent self, List target, float speed, int turnTime = 100) - { - self.Stop(false); - - foreach (float3 v in target) - { - self.Targets.Add(v); - } - - self.IsTurnHorizontal = true; - self.TurnTime = turnTime; - self.Speed = speed; - self.tcs = ETTask.Create(true); - - EventSystem.Instance.Publish(self.Scene(), new EventType.MoveStart() {Unit = self.GetParent()}); - - self.StartMove(); - - bool moveRet = await self.tcs; - - if (moveRet) - { - EventSystem.Instance.Publish(self.Scene(), new EventType.MoveStop() {Unit = self.GetParent()}); - } - return moveRet; - } - - // ret: 停止的时候,移动协程的返回值 - private static void MoveForward(this MoveComponent self, bool ret) - { - Unit unit = self.GetParent(); - - long timeNow = self.Fiber().TimeInfo.ClientNow(); - long moveTime = timeNow - self.StartTime; - - while (true) - { - if (moveTime <= 0) - { - return; - } - - // 计算位置插值 - if (moveTime >= self.NeedTime) - { - unit.Position = self.NextTarget; - if (self.TurnTime > 0) - { - unit.Rotation = self.To; - } - } - else - { - // 计算位置插值 - float amount = moveTime * 1f / self.NeedTime; - if (amount > 0) - { - float3 newPos = math.lerp(self.StartPos, self.NextTarget, amount); - unit.Position = newPos; - } - - // 计算方向插值 - if (self.TurnTime > 0) - { - amount = moveTime * 1f / self.TurnTime; - if (amount > 1) - { - amount = 1f; - } - quaternion q = math.slerp(self.From, self.To, amount); - unit.Rotation = q; - } - } - - moveTime -= self.NeedTime; - - // 表示这个点还没走完,等下一帧再来 - if (moveTime < 0) - { - return; - } - - // 到这里说明这个点已经走完 - - // 如果是最后一个点 - if (self.N >= self.Targets.Count - 1) - { - unit.Position = self.NextTarget; - unit.Rotation = self.To; - - self.MoveFinish(ret); - return; - } - - self.SetNextTarget(); - } - } - - private static void StartMove(this MoveComponent self) - { - self.BeginTime = self.Fiber().TimeInfo.ClientNow(); - self.StartTime = self.BeginTime; - self.SetNextTarget(); - - self.MoveTimer = self.Fiber().TimerComponent.NewFrameTimer(TimerInvokeType.MoveTimer, self); - } - - private static void SetNextTarget(this MoveComponent self) - { - - Unit unit = self.GetParent(); - - ++self.N; - - // 时间计算用服务端的位置, 但是移动要用客户端的位置来插值 - float3 v = self.GetFaceV(); - float distance = math.length(v); - - // 插值的起始点要以unit的真实位置来算 - self.StartPos = unit.Position; - - self.StartTime += self.NeedTime; - - self.NeedTime = (long) (distance / self.Speed * 1000); - - if (self.TurnTime > 0) - { - // 要用unit的位置 - float3 faceV = self.GetFaceV(); - if (math.lengthsq(faceV) < 0.0001f) - { - return; - } - self.From = unit.Rotation; - - if (self.IsTurnHorizontal) - { - faceV.y = 0; - } - - if (Math.Abs(faceV.x) > 0.01 || Math.Abs(faceV.z) > 0.01) - { - self.To = quaternion.LookRotation(faceV, math.up()); - } - - return; - } - - if (self.TurnTime == 0) // turn time == 0 立即转向 - { - float3 faceV = self.GetFaceV(); - if (self.IsTurnHorizontal) - { - faceV.y = 0; - } - - if (Math.Abs(faceV.x) > 0.01 || Math.Abs(faceV.z) > 0.01) - { - self.To = quaternion.LookRotation(faceV, math.up()); - unit.Rotation = self.To; - } - } - } - - private static float3 GetFaceV(this MoveComponent self) - { - return self.NextTarget - self.PreTarget; - } - - public static bool FlashTo(this MoveComponent self, float3 target) - { - Unit unit = self.GetParent(); - unit.Position = target; - return true; - } - - // ret: 停止的时候,移动协程的返回值 - public static void Stop(this MoveComponent self, bool ret) - { - if (self.Targets.Count > 0) - { - self.MoveForward(ret); - } - - self.MoveFinish(ret); - } - - private static void MoveFinish(this MoveComponent self, bool ret) - { - if (self.StartTime == 0) - { - return; - } - - self.StartTime = 0; - self.StartPos = float3.zero; - self.BeginTime = 0; - self.NeedTime = 0; - self.Targets.Clear(); - self.Speed = 0; - self.N = 0; - self.TurnTime = 0; - self.IsTurnHorizontal = false; - self.Fiber().TimerComponent?.Remove(ref self.MoveTimer); - - if (self.tcs != null) - { - var tcs = self.tcs; - self.tcs = null; - tcs.SetResult(ret); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move/MoveComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move/MoveComponentSystem.cs.meta deleted file mode 100644 index d9f7a542..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Move/MoveComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2c9d0c7894766af4290b1cf3bac03841 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric.meta deleted file mode 100644 index 48eb1d0d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ad2461a885cf71940812b6f3ca8cb6a5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs deleted file mode 100644 index b6501f99..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace ET -{ - // 分发数值监听 - [Event(SceneType.All)] // 服务端Map需要分发, 客户端CurrentScene也要分发 - public class NumericChangeEvent_NotifyWatcher: AEvent - { - protected override async ETTask Run(Scene scene, EventType.NumbericChange args) - { - NumericWatcherComponent.Instance.Run(args.Unit, args); - await ETTask.CompletedTask; - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs.meta deleted file mode 100644 index ce341f41..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e4ee1a86c772c6d42a5d25c36004720e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericWatcher_Hp_ShowUI.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericWatcher_Hp_ShowUI.cs deleted file mode 100644 index d2050573..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericWatcher_Hp_ShowUI.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace ET -{ - /// - /// 客户端监视hp数值变化,改变血条值 - /// - [NumericWatcher(SceneType.Current, NumericType.Hp)] - public class NumericWatcher_Hp_ShowUI : INumericWatcher - { - public void Run(Unit unit, EventType.NumbericChange args) - { - } - } -} diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericWatcher_Hp_ShowUI.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericWatcher_Hp_ShowUI.cs.meta deleted file mode 100644 index 55a9f764..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Numeric/NumericWatcher_Hp_ShowUI.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e1215d410dbbdb144be73a6410148c59 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast.meta deleted file mode 100644 index efa9d4dc..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ce6c6236ff156ac47a06c57952ca1abb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs deleted file mode 100644 index 35b49f96..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System; -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET -{ - [EntitySystemOf(typeof(PathfindingComponent))] - [FriendOf(typeof(PathfindingComponent))] - public static partial class PathfindingComponentSystem - { - [EntitySystem] - private static void Awake(this PathfindingComponent self, string name) - { - self.Name = name; - byte[] buffer = NavmeshComponent.Instance.Get(name); - self.navMesh = Recast.RecastLoad(buffer, buffer.Length); - if (self.navMesh == IntPtr.Zero) - { - throw new Exception($"nav load fail: {name}"); - } - } - - [EntitySystem] - private static void Destroy(this PathfindingComponent self) - { - self.Name = string.Empty; - - Recast.RecastClear(self.navMesh); - - self.navMesh = IntPtr.Zero; - } - - public static void Find(this PathfindingComponent self, float3 start, float3 target, List result) - { - if (self.navMesh == IntPtr.Zero) - { - Log.Debug("寻路| Find 失败 pathfinding ptr is zero"); - throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}"); - } - - self.StartPos[0] = -start.x; - self.StartPos[1] = start.y; - self.StartPos[2] = start.z; - - self.EndPos[0] = -target.x; - self.EndPos[1] = target.y; - self.EndPos[2] = target.z; - //Log.Debug($"start find path: {self.GetParent().Id}"); - int n = Recast.RecastFind(self.navMesh, self.extents, self.StartPos, self.EndPos, self.Result); - if (n < 0) - { - throw new Exception($"find path error: {n}"); - } - - for (int i = 0; i < n; ++i) - { - int index = i * 3; - result.Add(new float3(-self.Result[index], self.Result[index + 1], self.Result[index + 2])); - } - //Log.Debug($"finish find path: {self.GetParent().Id} {result.ListToString()}"); - } - - public static void FindWithAdjust(this PathfindingComponent self, float3 start, float3 target, List result,float adjustRaduis) - { - self.Find(start, target, result); - for (int i = 0; i < result.Count; i++) - { - float3 adjust = self.FindRandomPointWithRaduis(result[i], adjustRaduis); - result[i] = adjust; - } - } - - public static float3 FindRandomPointWithRaduis(this PathfindingComponent self, float3 pos, float raduis) - { - if (self.navMesh == IntPtr.Zero) - { - throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}"); - } - - if (raduis > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f) - { - throw new Exception($"pathfinding raduis is too large,cur: {raduis}, max: {PathfindingComponent.FindRandomNavPosMaxRadius}"); - } - - int degrees = RandomGenerator.RandomNumber(0, 360); - float r = RandomGenerator.RandomNumber(0, (int) (raduis * 1000)) / 1000f; - - float x = r * math.cos(math.radians(degrees)); - float z = r * math.sin(math.radians(degrees)); - - float3 findpos = new float3(pos.x + x, pos.y, pos.z + z); - - return self.RecastFindNearestPoint(findpos); - } - - /// - /// 以pos为中心各自在宽和高的左右 前后两个方向延伸 - /// - /// - /// - /// - /// - /// - /// - public static float3 FindRandomPointWithRectangle(this PathfindingComponent self, float3 pos, int width, int height) - { - if (self.navMesh == IntPtr.Zero) - { - throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}"); - } - - if (width > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f || height > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f) - { - throw new Exception($"pathfinding rectangle is too large,width: {width} height: {height}, max: {PathfindingComponent.FindRandomNavPosMaxRadius}"); - } - - float x = RandomGenerator.RandomNumber(-width, width); - float z = RandomGenerator.RandomNumber(-height, height); - - float3 findpos = new float3(pos.x + x, pos.y, pos.z + z); - - return self.RecastFindNearestPoint(findpos); - } - - public static float3 FindRandomPointWithRaduis(this PathfindingComponent self, float3 pos, float minRadius, float maxRadius) - { - if (self.navMesh == IntPtr.Zero) - { - throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}"); - } - - if (maxRadius > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f) - { - throw new Exception($"pathfinding raduis is too large,cur: {maxRadius}, max: {PathfindingComponent.FindRandomNavPosMaxRadius}"); - } - - int degrees = RandomGenerator.RandomNumber(0, 360); - float r = RandomGenerator.RandomNumber((int) (minRadius * 1000), (int) (maxRadius * 1000)) / 1000f; - - float x = r * math.cos(math.radians(degrees)); - float z = r * math.sin(math.radians(degrees)); - - float3 findpos = new float3(pos.x + x, pos.y, pos.z + z); - - return self.RecastFindNearestPoint(findpos); - } - - public static float3 RecastFindNearestPoint(this PathfindingComponent self, float3 pos) - { - if (self.navMesh == IntPtr.Zero) - { - throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}"); - } - - self.StartPos[0] = -pos.x; - self.StartPos[1] = pos.y; - self.StartPos[2] = pos.z; - - int ret = Recast.RecastFindNearestPoint(self.navMesh, self.extents, self.StartPos, self.EndPos); - if (ret == 0) - { - throw new Exception($"RecastFindNearestPoint fail, 可能是位置配置有问题: sceneName:{self.Scene().Name} {pos} {self.Name} {self.GetParent().Id} {self.GetParent().Config.Id} {self.EndPos.ArrayToString()}"); - } - - return new float3(-self.EndPos[0], self.EndPos[1], self.EndPos[2]); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs.meta deleted file mode 100644 index 23e184c3..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0bdc5a9258f99554b92e5fb56e8eb1c8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene.meta deleted file mode 100644 index 77f99933..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b58e79ff7cee3ce458b0d0aa593faf69 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs deleted file mode 100644 index 9903d62c..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace ET -{ - public static partial class CurrentScenesComponentSystem - { - public static Scene CurrentScene(this Scene root) - { - return root.GetComponent()?.Scene; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs.meta deleted file mode 100644 index addf9cec..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: bcdaee383c510da42bff4aa0620ed28b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit.meta deleted file mode 100644 index a18b76c4..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 151803197aee1fd4c9eed75afb1b6b12 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitComponentSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitComponentSystem.cs deleted file mode 100644 index 0f083810..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitComponentSystem.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace ET -{ - public static partial class UnitComponentSystem - { - public static void Add(this UnitComponent self, Unit unit) - { - } - - public static Unit Get(this UnitComponent self, long id) - { - Unit unit = self.GetChild(id); - return unit; - } - - public static void Remove(this UnitComponent self, long id) - { - Unit unit = self.GetChild(id); - unit?.Dispose(); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitComponentSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitComponentSystem.cs.meta deleted file mode 100644 index e78a55cf..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitComponentSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f7fbe1de137b21e4e88024c1411f792d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitSystem.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitSystem.cs deleted file mode 100644 index 7c07962d..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitSystem.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - [EntitySystemOf(typeof(Unit))] - public static partial class UnitSystem - { - [EntitySystem] - private static void Awake(this Unit self, int configId) - { - self.ConfigId = configId; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitSystem.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitSystem.cs.meta deleted file mode 100644 index 36999a75..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Module/Unit/UnitSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9af1ba2890c2e524ca5fc31a4c2ee406 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Plugins.meta deleted file mode 100644 index 28867e52..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8b9b9a883d974a14499c157e3863dc3e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example.meta deleted file mode 100644 index 7fdb2f6e..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1b03ed498c4dcf04c935c7b7962384da -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example/HotfixShare.cs b/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example/HotfixShare.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example/HotfixShare.cs.meta b/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example/HotfixShare.cs.meta deleted file mode 100644 index ae6af33a..00000000 --- a/Assets/GameScripts/DotNet/Hotfix/Share/Plugins/Example/HotfixShare.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f3d32203190d1d142850fad30c9d2512 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model.meta b/Assets/GameScripts/DotNet/Model.meta deleted file mode 100644 index 81984478..00000000 --- a/Assets/GameScripts/DotNet/Model.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 381d1b1e7a8488647ba7d45b108caf8a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client.meta b/Assets/GameScripts/DotNet/Model/Client.meta deleted file mode 100644 index 3994915e..00000000 --- a/Assets/GameScripts/DotNet/Model/Client.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 27633f406535aa447b15a96d66f67988 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo.meta b/Assets/GameScripts/DotNet/Model/Client/Demo.meta deleted file mode 100644 index 8746164a..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9ef4e1ca3e9157243b9b99177b8b9807 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/AI.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/AI.meta deleted file mode 100644 index 14d6c719..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/AI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 885e50cc17c2b9345bcf5e8bac46ae03 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/AI/XunLuoPathComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/AI/XunLuoPathComponent.cs deleted file mode 100644 index f6682d56..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/AI/XunLuoPathComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Unity.Mathematics; - -namespace ET.Client -{ - [ComponentOf(typeof(Unit))] - public class XunLuoPathComponent: Entity, IAwake - { - public float3[] path = new float3[] { new float3(0, 0, 0), new float3(20, 0, 0), new float3(20, 0, 20), new float3(0, 0, 20), }; - public int Index; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/AI/XunLuoPathComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/AI/XunLuoPathComponent.cs.meta deleted file mode 100644 index 0845e337..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/AI/XunLuoPathComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9cf32cd19c3004b4a8e0651fc3047743 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main.meta deleted file mode 100644 index d52db671..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c247787106f44a8f99a58bd0037a2c5e -timeCreated: 1688537682 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/ClientSenderCompnent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/ClientSenderCompnent.cs deleted file mode 100644 index f27eb02f..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/ClientSenderCompnent.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Scene))] - public class ClientSenderCompnent: Entity, IAwake, IDestroy - { - public int fiberId; - - public ActorId netClientActorId; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/ClientSenderCompnent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/ClientSenderCompnent.cs.meta deleted file mode 100644 index 494619be..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/ClientSenderCompnent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 382c2c68ed7679d46a55104e0cc8b994 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move.meta deleted file mode 100644 index 3f057191..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2ba262f8f3390b14a9c060648c1f111c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move/Wait_UnitStop.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move/Wait_UnitStop.cs deleted file mode 100644 index 4d54892b..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move/Wait_UnitStop.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET.Client -{ - public struct Wait_UnitStop: IWaitType - { - public int Error - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move/Wait_UnitStop.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move/Wait_UnitStop.cs.meta deleted file mode 100644 index 3eab455d..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Move/Wait_UnitStop.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 520adb45ec50ad341ac0c4171753c4f8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene.meta deleted file mode 100644 index 6f5ac01f..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ee0ba587d7adcf64d82168e16492d92c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_CreateMyUnit.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_CreateMyUnit.cs deleted file mode 100644 index 513f8597..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_CreateMyUnit.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace ET.Client -{ - public struct Wait_CreateMyUnit: IWaitType - { - public int Error - { - get; - set; - } - - public M2C_CreateMyUnit Message; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_CreateMyUnit.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_CreateMyUnit.cs.meta deleted file mode 100644 index 1ad35860..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_CreateMyUnit.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5ee3513937137ce40ac8d9f05a872cff -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_SceneChangeFinish.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_SceneChangeFinish.cs deleted file mode 100644 index 86e9ec73..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_SceneChangeFinish.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET.Client -{ - public struct Wait_SceneChangeFinish: IWaitType - { - public int Error - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_SceneChangeFinish.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_SceneChangeFinish.cs.meta deleted file mode 100644 index 0ad40673..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Scene/Wait_SceneChangeFinish.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2ecf2f6b630b07247baf109cfe70ea9d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit.meta deleted file mode 100644 index 57aa1609..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 66440581c9e2d1e41b9eecfdb4dca84d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit/PlayerComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit/PlayerComponent.cs deleted file mode 100644 index b50144d7..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit/PlayerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Scene))] - public class PlayerComponent: Entity, IAwake - { - public long MyId { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit/PlayerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit/PlayerComponent.cs.meta deleted file mode 100644 index 107849df..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/Main/Unit/PlayerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cbdfe4506c381a9499048ef022e91c70 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient.meta deleted file mode 100644 index 8f6aa2ac..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ec90b5e546bd6de47a19d79b92c28ae4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/A2NetClient_Message.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/A2NetClient_Message.cs deleted file mode 100644 index 7705cd14..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/A2NetClient_Message.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace ET -{ - [Message] - public class A2NetClient_Message: MessageObject, IActorMessage - { - public static A2NetClient_Message Create() - { - return ObjectPool.Instance.Fetch(typeof(A2NetClient_Message)) as A2NetClient_Message; - } - - public override void Dispose() - { - this.MessageObject = default; - ObjectPool.Instance.Recycle(this); - } - - public IMessage MessageObject; - } - - [Message] - [ResponseType(nameof(A2NetClient_Response))] - public class A2NetClient_Request: MessageObject, IActorRequest - { - public static A2NetClient_Request Create() - { - return ObjectPool.Instance.Fetch(typeof(A2NetClient_Request)) as A2NetClient_Request; - } - - public override void Dispose() - { - this.RpcId = default; - this.MessageObject = default; - ObjectPool.Instance.Recycle(this); - } - - public int RpcId { get; set; } - public IRequest MessageObject; - } - - [Message] - public class A2NetClient_Response: MessageObject, IActorResponse - { - public static A2NetClient_Response Create() - { - return ObjectPool.Instance.Fetch(typeof(A2NetClient_Response)) as A2NetClient_Response; - } - - public override void Dispose() - { - this.RpcId = default; - this.Error = default; - this.Message = default; - this.MessageObject = default; - ObjectPool.Instance.Recycle(this); - } - - public int RpcId { get; set; } - public int Error { get; set; } - public string Message { get; set; } - - public IResponse MessageObject; - } - - [Message] - public class NetClient2Main_SessionDispose: MessageObject, IActorMessage - { - public static NetClient2Main_SessionDispose Create() - { - return ObjectPool.Instance.Fetch(typeof(NetClient2Main_SessionDispose)) as NetClient2Main_SessionDispose; - } - - public override void Dispose() - { - ObjectPool.Instance.Recycle(this); - } - - public int Error { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/A2NetClient_Message.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/A2NetClient_Message.cs.meta deleted file mode 100644 index 70060b0f..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/A2NetClient_Message.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e50ffa067a184f40894c598dea0d7020 -timeCreated: 1688538532 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping.meta deleted file mode 100644 index 12381fa9..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6914febd67328304487999002f752ebd -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping/PingComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping/PingComponent.cs deleted file mode 100644 index 7b5ac068..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping/PingComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Session))] - public class PingComponent: Entity, IAwake, IDestroy - { - public long Ping { get; set; } //延迟值 - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping/PingComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping/PingComponent.cs.meta deleted file mode 100644 index 3c40d706..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Ping/PingComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f524589ddb21a4646bfd9cea4ba9bb1b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router.meta deleted file mode 100644 index 73a88d8d..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 99a94f39eb3226047842c238ef0faa44 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterAddressComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterAddressComponent.cs deleted file mode 100644 index c5f9ea15..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterAddressComponent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; - -namespace ET.Client -{ - [ComponentOf(typeof(Scene))] - public class RouterAddressComponent: Entity, IAwake - { - public IPAddress RouterManagerIPAddress { get; set; } - public string RouterManagerHost; - public int RouterManagerPort; - public HttpGetRouterResponse Info; - public int RouterIndex; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterAddressComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterAddressComponent.cs.meta deleted file mode 100644 index acd80941..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterAddressComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 72763524f54cbb041a158edfd63a2327 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterCheckComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterCheckComponent.cs deleted file mode 100644 index 9185b4c3..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterCheckComponent.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Session))] - public class RouterCheckComponent: Entity, IAwake - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterCheckComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterCheckComponent.cs.meta deleted file mode 100644 index 0d5339c9..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Router/RouterCheckComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8a276930801a4a645b9be22f59d120c2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session.meta deleted file mode 100644 index 45d66555..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b1905dc63000e9e4daf62b35dc071f8d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session/SessionComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session/SessionComponent.cs deleted file mode 100644 index c643ed25..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session/SessionComponent.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Scene))] - public class SessionComponent: Entity, IAwake, IDestroy - { - private EntityRef session; - - public Session Session - { - get - { - return this.session; - } - set - { - this.session = value; - } - } - } -} diff --git a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session/SessionComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session/SessionComponent.cs.meta deleted file mode 100644 index 7556bc3f..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Demo/NetClient/Session/SessionComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fb5344cdadfc80c4d8da7b51c7162fa2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep.meta b/Assets/GameScripts/DotNet/Model/Client/LockStep.meta deleted file mode 100644 index 57d357c8..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 913d59a68856e4244ab6a43c8f55c5fb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/EventType.cs b/Assets/GameScripts/DotNet/Model/Client/LockStep/EventType.cs deleted file mode 100644 index c8afdf5c..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/EventType.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace ET -{ - namespace EventType - { - public struct LSSceneChangeStart - { - public Room Room; - } - - public struct LSSceneInitFinish - { - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/EventType.cs.meta b/Assets/GameScripts/DotNet/Model/Client/LockStep/EventType.cs.meta deleted file mode 100644 index 040bb5ca..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/EventType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 02de10d07ce524cb9bc79e666f460484 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSClientUpdater.cs b/Assets/GameScripts/DotNet/Model/Client/LockStep/LSClientUpdater.cs deleted file mode 100644 index e0bf0ab8..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSClientUpdater.cs +++ /dev/null @@ -1,12 +0,0 @@ -using TrueSync; - -namespace ET.Client -{ - [ComponentOf(typeof(Room))] - public class LSClientUpdater: Entity, IAwake, IUpdate - { - public LSInput Input = new(); - - public long MyId { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSClientUpdater.cs.meta b/Assets/GameScripts/DotNet/Model/Client/LockStep/LSClientUpdater.cs.meta deleted file mode 100644 index 5c4e10b9..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSClientUpdater.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: df98480c286284118a69673bd00cc110 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSReplayUpdater.cs b/Assets/GameScripts/DotNet/Model/Client/LockStep/LSReplayUpdater.cs deleted file mode 100644 index 0e9be86e..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSReplayUpdater.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Room))] - public class LSReplayUpdater: Entity, IAwake, IUpdate - { - public int ReplaySpeed { get; set; } = 1; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSReplayUpdater.cs.meta b/Assets/GameScripts/DotNet/Model/Client/LockStep/LSReplayUpdater.cs.meta deleted file mode 100644 index 624c46c3..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/LSReplayUpdater.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6f2c0f572224746eba69f60e57c595bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/WaitType.cs b/Assets/GameScripts/DotNet/Model/Client/LockStep/WaitType.cs deleted file mode 100644 index 0e68e5f2..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/WaitType.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - namespace WaitType - { - public struct Wait_Room2C_Start: IWaitType - { - public int Error { get; set; } - - public Room2C_Start Message; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/LockStep/WaitType.cs.meta b/Assets/GameScripts/DotNet/Model/Client/LockStep/WaitType.cs.meta deleted file mode 100644 index d8e6bd64..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/LockStep/WaitType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fa3a181fb8c154cf4a6c4e4063dbc0a5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Module.meta b/Assets/GameScripts/DotNet/Model/Client/Module.meta deleted file mode 100644 index 0c1b0db2..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fe67eebe4207d0546b2db501476bba9a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Module/Message.meta b/Assets/GameScripts/DotNet/Model/Client/Module/Message.meta deleted file mode 100644 index 4a312fc4..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Module/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 71ea1d85c7ee84e489f24a3f6e9a1f63 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Module/Message/ClientSessionErrorComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Module/Message/ClientSessionErrorComponent.cs deleted file mode 100644 index a70c42ff..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Module/Message/ClientSessionErrorComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Client -{ - [ComponentOf(typeof(Session))] - public class ClientSessionErrorComponent: Entity, IAwake, IDestroy - { - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Module/Message/ClientSessionErrorComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Module/Message/ClientSessionErrorComponent.cs.meta deleted file mode 100644 index b84bcde8..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Module/Message/ClientSessionErrorComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9b92500790ca28e4083361a39c779d1a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Module/Message/NetClientComponent.cs b/Assets/GameScripts/DotNet/Model/Client/Module/Message/NetClientComponent.cs deleted file mode 100644 index ef32d779..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Module/Message/NetClientComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Net.Sockets; - -namespace ET.Client -{ - [ComponentOf(typeof(Scene))] - public class NetClientComponent: Entity, IAwake, IDestroy, IUpdate - { - public AService AService; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Client/Module/Message/NetClientComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Module/Message/NetClientComponent.cs.meta deleted file mode 100644 index 81d6523d..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Module/Message/NetClientComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f48eeb5d55c27fc4c8d2babf0d08e471 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Plugins.meta b/Assets/GameScripts/DotNet/Model/Client/Plugins.meta deleted file mode 100644 index f4859c8d..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7976479ae6841ce488441aac409b8304 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Plugins/Example.meta b/Assets/GameScripts/DotNet/Model/Client/Plugins/Example.meta deleted file mode 100644 index abeec4f8..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Plugins/Example.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f2bf6ba098db29b48a7c2991ac8416d3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Client/Plugins/Example/ModelClient.cs b/Assets/GameScripts/DotNet/Model/Client/Plugins/Example/ModelClient.cs deleted file mode 100644 index 8b137891..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Plugins/Example/ModelClient.cs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Assets/GameScripts/DotNet/Model/Client/Plugins/Example/ModelClient.cs.meta b/Assets/GameScripts/DotNet/Model/Client/Plugins/Example/ModelClient.cs.meta deleted file mode 100644 index 8b465d4a..00000000 --- a/Assets/GameScripts/DotNet/Model/Client/Plugins/Example/ModelClient.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6caec67390eebf04b8231ce4a4800845 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate.meta b/Assets/GameScripts/DotNet/Model/Generate.meta deleted file mode 100644 index 9fab0fad..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 45bbe48eea3422945a554d1b4f923a6f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client.meta b/Assets/GameScripts/DotNet/Model/Generate/Client.meta deleted file mode 100644 index 98525902..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 67d21a80f9f5d4a45823f7d0d16eb933 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Config.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Config.meta deleted file mode 100644 index 631a92e6..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Config.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dfd2cd1dd4c952e4981fd41b1c098de5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/AIConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Client/Config/AIConfig.cs deleted file mode 100644 index 6623d53d..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/AIConfig.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class AIConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - AIConfigCategory s = o as AIConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public AIConfig Get(int id) - { - this.dict.TryGetValue(id, out AIConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (AIConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public AIConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class AIConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属ai - public int AIConfigId { get; set; } - /// 此ai中的顺序 - public int Order { get; set; } - /// 节点名字 - public string Name { get; set; } - /// 节点参数 - public int[] NodeParams { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/AIConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Config/AIConfig.cs.meta deleted file mode 100644 index ce1d4b7b..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/AIConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 63eb883aff2778247b4f5781cc9a649f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/UnitConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Client/Config/UnitConfig.cs deleted file mode 100644 index d5231575..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/UnitConfig.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class UnitConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - UnitConfigCategory s = o as UnitConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public UnitConfig Get(int id) - { - this.dict.TryGetValue(id, out UnitConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public UnitConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class UnitConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// Type - public int Type { get; set; } - /// 名字 - public string Name { get; set; } - /// 位置 - public int Position { get; set; } - /// 身高 - public int Height { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/UnitConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Config/UnitConfig.cs.meta deleted file mode 100644 index b1d20bc1..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Config/UnitConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cdf9536c3f3537648aa2f29d89f179eb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Message.meta deleted file mode 100644 index 7e77e5f0..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 39784f35f926de34b866f949b0e4d8ce -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/ClientMessage_C_1000.cs b/Assets/GameScripts/DotNet/Model/Generate/Client/Message/ClientMessage_C_1000.cs deleted file mode 100644 index 413b71b9..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/ClientMessage_C_1000.cs +++ /dev/null @@ -1,77 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// using - [ResponseType(nameof(NetClient2Main_Login))] - [Message(ClientMessage.Main2NetClient_Login)] - [MemoryPackable] - public partial class Main2NetClient_Login: MessageObject, IActorRequest - { - public static Main2NetClient_Login Create(bool isFromPool = true) - { - return !isFromPool? new Main2NetClient_Login() : ObjectPool.Instance.Fetch(typeof(Main2NetClient_Login)) as Main2NetClient_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(ClientMessage.NetClient2Main_Login)] - [MemoryPackable] - public partial class NetClient2Main_Login: MessageObject, IActorResponse - { - public static NetClient2Main_Login Create(bool isFromPool = true) - { - return !isFromPool? new NetClient2Main_Login() : ObjectPool.Instance.Fetch(typeof(NetClient2Main_Login)) as NetClient2Main_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class ClientMessage - { - public const ushort Main2NetClient_Login = 1001; - public const ushort NetClient2Main_Login = 1002; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/ClientMessage_C_1000.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Message/ClientMessage_C_1000.cs.meta deleted file mode 100644 index 58295f98..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/ClientMessage_C_1000.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1147a7510cf76e6448f555a15d20757f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/LockStepOuter_C_11001.cs b/Assets/GameScripts/DotNet/Model/Generate/Client/Message/LockStepOuter_C_11001.cs deleted file mode 100644 index e2f43d39..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/LockStepOuter_C_11001.cs +++ /dev/null @@ -1,342 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ - [ResponseType(nameof(G2C_Match))] - [Message(LockStepOuter.C2G_Match)] - [MemoryPackable] - public partial class C2G_Match: MessageObject, IRequest - { - public static C2G_Match Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Match() : ObjectPool.Instance.Fetch(typeof(C2G_Match)) as C2G_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.G2C_Match)] - [MemoryPackable] - public partial class G2C_Match: MessageObject, IResponse - { - public static G2C_Match Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Match() : ObjectPool.Instance.Fetch(typeof(G2C_Match)) as G2C_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 匹配成功,通知客户端切换场景 - [Message(LockStepOuter.Match2G_NotifyMatchSuccess)] - [MemoryPackable] - public partial class Match2G_NotifyMatchSuccess: MessageObject, IActorMessage - { - public static Match2G_NotifyMatchSuccess Create(bool isFromPool = true) - { - return !isFromPool? new Match2G_NotifyMatchSuccess() : ObjectPool.Instance.Fetch(typeof(Match2G_NotifyMatchSuccess)) as Match2G_NotifyMatchSuccess; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - -// 房间的ActorId - [MemoryPackOrder(1)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 客户端通知房间切换场景完成 - [Message(LockStepOuter.C2Room_ChangeSceneFinish)] - [MemoryPackable] - public partial class C2Room_ChangeSceneFinish: MessageObject, IActorRoom - { - public static C2Room_ChangeSceneFinish Create(bool isFromPool = true) - { - return !isFromPool? new C2Room_ChangeSceneFinish() : ObjectPool.Instance.Fetch(typeof(C2Room_ChangeSceneFinish)) as C2Room_ChangeSceneFinish; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.LockStepUnitInfo)] - [MemoryPackable] - public partial class LockStepUnitInfo: MessageObject - { - public static LockStepUnitInfo Create(bool isFromPool = true) - { - return !isFromPool? new LockStepUnitInfo() : ObjectPool.Instance.Fetch(typeof(LockStepUnitInfo)) as LockStepUnitInfo; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - [MemoryPackOrder(1)] - public TrueSync.TSVector Position { get; set; } - - [MemoryPackOrder(2)] - public TrueSync.TSQuaternion Rotation { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - this.Position = default; - this.Rotation = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 房间通知客户端进入战斗 - [Message(LockStepOuter.Room2C_Start)] - [MemoryPackable] - public partial class Room2C_Start: MessageObject, IActorMessage - { - public static Room2C_Start Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_Start() : ObjectPool.Instance.Fetch(typeof(Room2C_Start)) as Room2C_Start; - } - - [MemoryPackOrder(0)] - public long StartTime { get; set; } - - [MemoryPackOrder(1)] - public List UnitInfo { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.StartTime = default; - this.UnitInfo.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.FrameMessage)] - [MemoryPackable] - public partial class FrameMessage: MessageObject, IActorMessage - { - public static FrameMessage Create(bool isFromPool = true) - { - return !isFromPool? new FrameMessage() : ObjectPool.Instance.Fetch(typeof(FrameMessage)) as FrameMessage; - } - - [MemoryPackOrder(0)] - public int Frame { get; set; } - - [MemoryPackOrder(1)] - public long PlayerId { get; set; } - - [MemoryPackOrder(2)] - public LSInput Input { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Frame = default; - this.PlayerId = default; - this.Input = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.OneFrameInputs)] - [MemoryPackable] - public partial class OneFrameInputs: MessageObject, IActorMessage - { - public static OneFrameInputs Create(bool isFromPool = true) - { - return !isFromPool? new OneFrameInputs() : ObjectPool.Instance.Fetch(typeof(OneFrameInputs)) as OneFrameInputs; - } - - [MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)] - [MemoryPackOrder(1)] - public Dictionary Inputs { get; set; } = new(); - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Inputs.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.Room2C_AdjustUpdateTime)] - [MemoryPackable] - public partial class Room2C_AdjustUpdateTime: MessageObject, IActorMessage - { - public static Room2C_AdjustUpdateTime Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_AdjustUpdateTime() : ObjectPool.Instance.Fetch(typeof(Room2C_AdjustUpdateTime)) as Room2C_AdjustUpdateTime; - } - - [MemoryPackOrder(0)] - public int DiffTime { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.DiffTime = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.C2Room_CheckHash)] - [MemoryPackable] - public partial class C2Room_CheckHash: MessageObject, IActorRoom - { - public static C2Room_CheckHash Create(bool isFromPool = true) - { - return !isFromPool? new C2Room_CheckHash() : ObjectPool.Instance.Fetch(typeof(C2Room_CheckHash)) as C2Room_CheckHash; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - [MemoryPackOrder(1)] - public int Frame { get; set; } - - [MemoryPackOrder(2)] - public long Hash { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - this.Frame = default; - this.Hash = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.Room2C_CheckHashFail)] - [MemoryPackable] - public partial class Room2C_CheckHashFail: MessageObject, IActorMessage - { - public static Room2C_CheckHashFail Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_CheckHashFail() : ObjectPool.Instance.Fetch(typeof(Room2C_CheckHashFail)) as Room2C_CheckHashFail; - } - - [MemoryPackOrder(0)] - public int Frame { get; set; } - - [MemoryPackOrder(1)] - public byte[] LSWorldBytes { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Frame = default; - this.LSWorldBytes = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.G2C_Reconnect)] - [MemoryPackable] - public partial class G2C_Reconnect: MessageObject, IActorMessage - { - public static G2C_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2C_Reconnect)) as G2C_Reconnect; - } - - [MemoryPackOrder(0)] - public long StartTime { get; set; } - - [MemoryPackOrder(1)] - public List UnitInfos { get; set; } = new(); - - [MemoryPackOrder(2)] - public int Frame { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.StartTime = default; - this.UnitInfos.Clear(); - this.Frame = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class LockStepOuter - { - public const ushort C2G_Match = 11002; - public const ushort G2C_Match = 11003; - public const ushort Match2G_NotifyMatchSuccess = 11004; - public const ushort C2Room_ChangeSceneFinish = 11005; - public const ushort LockStepUnitInfo = 11006; - public const ushort Room2C_Start = 11007; - public const ushort FrameMessage = 11008; - public const ushort OneFrameInputs = 11009; - public const ushort Room2C_AdjustUpdateTime = 11010; - public const ushort C2Room_CheckHash = 11011; - public const ushort Room2C_CheckHashFail = 11012; - public const ushort G2C_Reconnect = 11013; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/LockStepOuter_C_11001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Message/LockStepOuter_C_11001.cs.meta deleted file mode 100644 index fe7ded29..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/LockStepOuter_C_11001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f13c8ac43732d4554b0f3ecbf6fb71d5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/OuterMessage_C_10001.cs b/Assets/GameScripts/DotNet/Model/Generate/Client/Message/OuterMessage_C_10001.cs deleted file mode 100644 index fe702046..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/OuterMessage_C_10001.cs +++ /dev/null @@ -1,1068 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ - [Message(OuterMessage.HttpGetRouterResponse)] - [MemoryPackable] - public partial class HttpGetRouterResponse: MessageObject - { - public static HttpGetRouterResponse Create(bool isFromPool = true) - { - return !isFromPool? new HttpGetRouterResponse() : ObjectPool.Instance.Fetch(typeof(HttpGetRouterResponse)) as HttpGetRouterResponse; - } - - [MemoryPackOrder(0)] - public List Realms { get; set; } = new(); - - [MemoryPackOrder(1)] - public List Routers { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Realms.Clear(); - this.Routers.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.RouterSync)] - [MemoryPackable] - public partial class RouterSync: MessageObject - { - public static RouterSync Create(bool isFromPool = true) - { - return !isFromPool? new RouterSync() : ObjectPool.Instance.Fetch(typeof(RouterSync)) as RouterSync; - } - - [MemoryPackOrder(0)] - public uint ConnectId { get; set; } - - [MemoryPackOrder(1)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.ConnectId = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TestResponse))] - [Message(OuterMessage.C2M_TestRequest)] - [MemoryPackable] - public partial class C2M_TestRequest: MessageObject, IActorLocationRequest - { - public static C2M_TestRequest Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRequest() : ObjectPool.Instance.Fetch(typeof(C2M_TestRequest)) as C2M_TestRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string request { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.request = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestResponse)] - [MemoryPackable] - public partial class M2C_TestResponse: MessageObject, IActorResponse - { - public static M2C_TestResponse Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestResponse() : ObjectPool.Instance.Fetch(typeof(M2C_TestResponse)) as M2C_TestResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public string response { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.response = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Actor_TransferResponse))] - [Message(OuterMessage.Actor_TransferRequest)] - [MemoryPackable] - public partial class Actor_TransferRequest: MessageObject, IActorLocationRequest - { - public static Actor_TransferRequest Create(bool isFromPool = true) - { - return !isFromPool? new Actor_TransferRequest() : ObjectPool.Instance.Fetch(typeof(Actor_TransferRequest)) as Actor_TransferRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int MapIndex { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.MapIndex = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.Actor_TransferResponse)] - [MemoryPackable] - public partial class Actor_TransferResponse: MessageObject, IActorLocationResponse - { - public static Actor_TransferResponse Create(bool isFromPool = true) - { - return !isFromPool? new Actor_TransferResponse() : ObjectPool.Instance.Fetch(typeof(Actor_TransferResponse)) as Actor_TransferResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_EnterMap))] - [Message(OuterMessage.C2G_EnterMap)] - [MemoryPackable] - public partial class C2G_EnterMap: MessageObject, IRequest - { - public static C2G_EnterMap Create(bool isFromPool = true) - { - return !isFromPool? new C2G_EnterMap() : ObjectPool.Instance.Fetch(typeof(C2G_EnterMap)) as C2G_EnterMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_EnterMap)] - [MemoryPackable] - public partial class G2C_EnterMap: MessageObject, IResponse - { - public static G2C_EnterMap Create(bool isFromPool = true) - { - return !isFromPool? new G2C_EnterMap() : ObjectPool.Instance.Fetch(typeof(G2C_EnterMap)) as G2C_EnterMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - -// 自己unitId - [MemoryPackOrder(3)] - public long MyId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.MyId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.MoveInfo)] - [MemoryPackable] - public partial class MoveInfo: MessageObject - { - public static MoveInfo Create(bool isFromPool = true) - { - return !isFromPool? new MoveInfo() : ObjectPool.Instance.Fetch(typeof(MoveInfo)) as MoveInfo; - } - - [MemoryPackOrder(0)] - public List Points { get; set; } = new(); - - [MemoryPackOrder(1)] - public Unity.Mathematics.quaternion Rotation { get; set; } - - [MemoryPackOrder(2)] - public int TurnSpeed { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Points.Clear(); - this.Rotation = default; - this.TurnSpeed = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.UnitInfo)] - [MemoryPackable] - public partial class UnitInfo: MessageObject - { - public static UnitInfo Create(bool isFromPool = true) - { - return !isFromPool? new UnitInfo() : ObjectPool.Instance.Fetch(typeof(UnitInfo)) as UnitInfo; - } - - [MemoryPackOrder(0)] - public long UnitId { get; set; } - - [MemoryPackOrder(1)] - public int ConfigId { get; set; } - - [MemoryPackOrder(2)] - public int Type { get; set; } - - [MemoryPackOrder(3)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(4)] - public Unity.Mathematics.float3 Forward { get; set; } - - [MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)] - [MemoryPackOrder(5)] - public Dictionary KV { get; set; } = new(); - [MemoryPackOrder(6)] - public MoveInfo MoveInfo { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.UnitId = default; - this.ConfigId = default; - this.Type = default; - this.Position = default; - this.Forward = default; - this.KV.Clear(); - this.MoveInfo = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_CreateUnits)] - [MemoryPackable] - public partial class M2C_CreateUnits: MessageObject, IActorMessage - { - public static M2C_CreateUnits Create(bool isFromPool = true) - { - return !isFromPool? new M2C_CreateUnits() : ObjectPool.Instance.Fetch(typeof(M2C_CreateUnits)) as M2C_CreateUnits; - } - - [MemoryPackOrder(0)] - public List Units { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Units.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_CreateMyUnit)] - [MemoryPackable] - public partial class M2C_CreateMyUnit: MessageObject, IActorMessage - { - public static M2C_CreateMyUnit Create(bool isFromPool = true) - { - return !isFromPool? new M2C_CreateMyUnit() : ObjectPool.Instance.Fetch(typeof(M2C_CreateMyUnit)) as M2C_CreateMyUnit; - } - - [MemoryPackOrder(0)] - public UnitInfo Unit { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Unit = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_StartSceneChange)] - [MemoryPackable] - public partial class M2C_StartSceneChange: MessageObject, IActorMessage - { - public static M2C_StartSceneChange Create(bool isFromPool = true) - { - return !isFromPool? new M2C_StartSceneChange() : ObjectPool.Instance.Fetch(typeof(M2C_StartSceneChange)) as M2C_StartSceneChange; - } - - [MemoryPackOrder(0)] - public long SceneInstanceId { get; set; } - - [MemoryPackOrder(1)] - public string SceneName { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.SceneInstanceId = default; - this.SceneName = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_RemoveUnits)] - [MemoryPackable] - public partial class M2C_RemoveUnits: MessageObject, IActorMessage - { - public static M2C_RemoveUnits Create(bool isFromPool = true) - { - return !isFromPool? new M2C_RemoveUnits() : ObjectPool.Instance.Fetch(typeof(M2C_RemoveUnits)) as M2C_RemoveUnits; - } - - [MemoryPackOrder(0)] - public List Units { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Units.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_PathfindingResult)] - [MemoryPackable] - public partial class C2M_PathfindingResult: MessageObject, IActorLocationMessage - { - public static C2M_PathfindingResult Create(bool isFromPool = true) - { - return !isFromPool? new C2M_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(C2M_PathfindingResult)) as C2M_PathfindingResult; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public Unity.Mathematics.float3 Position { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Position = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_Stop)] - [MemoryPackable] - public partial class C2M_Stop: MessageObject, IActorLocationMessage - { - public static C2M_Stop Create(bool isFromPool = true) - { - return !isFromPool? new C2M_Stop() : ObjectPool.Instance.Fetch(typeof(C2M_Stop)) as C2M_Stop; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_PathfindingResult)] - [MemoryPackable] - public partial class M2C_PathfindingResult: MessageObject, IActorMessage - { - public static M2C_PathfindingResult Create(bool isFromPool = true) - { - return !isFromPool? new M2C_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(M2C_PathfindingResult)) as M2C_PathfindingResult; - } - - [MemoryPackOrder(0)] - public long Id { get; set; } - - [MemoryPackOrder(1)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(2)] - public List Points { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Id = default; - this.Position = default; - this.Points.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_Stop)] - [MemoryPackable] - public partial class M2C_Stop: MessageObject, IActorMessage - { - public static M2C_Stop Create(bool isFromPool = true) - { - return !isFromPool? new M2C_Stop() : ObjectPool.Instance.Fetch(typeof(M2C_Stop)) as M2C_Stop; - } - - [MemoryPackOrder(0)] - public int Error { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(3)] - public Unity.Mathematics.quaternion Rotation { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Error = default; - this.Id = default; - this.Position = default; - this.Rotation = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_Ping))] - [Message(OuterMessage.C2G_Ping)] - [MemoryPackable] - public partial class C2G_Ping: MessageObject, IRequest - { - public static C2G_Ping Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Ping() : ObjectPool.Instance.Fetch(typeof(C2G_Ping)) as C2G_Ping; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Ping)] - [MemoryPackable] - public partial class G2C_Ping: MessageObject, IResponse - { - public static G2C_Ping Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Ping() : ObjectPool.Instance.Fetch(typeof(G2C_Ping)) as G2C_Ping; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long Time { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Time = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Test)] - [MemoryPackable] - public partial class G2C_Test: MessageObject, IMessage - { - public static G2C_Test Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Test() : ObjectPool.Instance.Fetch(typeof(G2C_Test)) as G2C_Test; - } - - public override void Dispose() - { - if (!this.IsFromPool) return; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_Reload))] - [Message(OuterMessage.C2M_Reload)] - [MemoryPackable] - public partial class C2M_Reload: MessageObject, IRequest - { - public static C2M_Reload Create(bool isFromPool = true) - { - return !isFromPool? new C2M_Reload() : ObjectPool.Instance.Fetch(typeof(C2M_Reload)) as C2M_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_Reload)] - [MemoryPackable] - public partial class M2C_Reload: MessageObject, IResponse - { - public static M2C_Reload Create(bool isFromPool = true) - { - return !isFromPool? new M2C_Reload() : ObjectPool.Instance.Fetch(typeof(M2C_Reload)) as M2C_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(R2C_Login))] - [Message(OuterMessage.C2R_Login)] - [MemoryPackable] - public partial class C2R_Login: MessageObject, IRequest - { - public static C2R_Login Create(bool isFromPool = true) - { - return !isFromPool? new C2R_Login() : ObjectPool.Instance.Fetch(typeof(C2R_Login)) as C2R_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.R2C_Login)] - [MemoryPackable] - public partial class R2C_Login: MessageObject, IResponse - { - public static R2C_Login Create(bool isFromPool = true) - { - return !isFromPool? new R2C_Login() : ObjectPool.Instance.Fetch(typeof(R2C_Login)) as R2C_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public string Address { get; set; } - - [MemoryPackOrder(4)] - public long Key { get; set; } - - [MemoryPackOrder(5)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Address = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_LoginGate))] - [Message(OuterMessage.C2G_LoginGate)] - [MemoryPackable] - public partial class C2G_LoginGate: MessageObject, IRequest - { - public static C2G_LoginGate Create(bool isFromPool = true) - { - return !isFromPool? new C2G_LoginGate() : ObjectPool.Instance.Fetch(typeof(C2G_LoginGate)) as C2G_LoginGate; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Key { get; set; } - - [MemoryPackOrder(2)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_LoginGate)] - [MemoryPackable] - public partial class G2C_LoginGate: MessageObject, IResponse - { - public static G2C_LoginGate Create(bool isFromPool = true) - { - return !isFromPool? new G2C_LoginGate() : ObjectPool.Instance.Fetch(typeof(G2C_LoginGate)) as G2C_LoginGate; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_TestHotfixMessage)] - [MemoryPackable] - public partial class G2C_TestHotfixMessage: MessageObject, IMessage - { - public static G2C_TestHotfixMessage Create(bool isFromPool = true) - { - return !isFromPool? new G2C_TestHotfixMessage() : ObjectPool.Instance.Fetch(typeof(G2C_TestHotfixMessage)) as G2C_TestHotfixMessage; - } - - [MemoryPackOrder(0)] - public string Info { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Info = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TestRobotCase))] - [Message(OuterMessage.C2M_TestRobotCase)] - [MemoryPackable] - public partial class C2M_TestRobotCase: MessageObject, IActorLocationRequest - { - public static C2M_TestRobotCase Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase)) as C2M_TestRobotCase; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestRobotCase)] - [MemoryPackable] - public partial class M2C_TestRobotCase: MessageObject, IActorLocationResponse - { - public static M2C_TestRobotCase Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase)) as M2C_TestRobotCase; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_TestRobotCase2)] - [MemoryPackable] - public partial class C2M_TestRobotCase2: MessageObject, IActorLocationMessage - { - public static C2M_TestRobotCase2 Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase2)) as C2M_TestRobotCase2; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestRobotCase2)] - [MemoryPackable] - public partial class M2C_TestRobotCase2: MessageObject, IActorLocationMessage - { - public static M2C_TestRobotCase2 Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase2)) as M2C_TestRobotCase2; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TransferMap))] - [Message(OuterMessage.C2M_TransferMap)] - [MemoryPackable] - public partial class C2M_TransferMap: MessageObject, IActorLocationRequest - { - public static C2M_TransferMap Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TransferMap() : ObjectPool.Instance.Fetch(typeof(C2M_TransferMap)) as C2M_TransferMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TransferMap)] - [MemoryPackable] - public partial class M2C_TransferMap: MessageObject, IActorLocationResponse - { - public static M2C_TransferMap Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TransferMap() : ObjectPool.Instance.Fetch(typeof(M2C_TransferMap)) as M2C_TransferMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_Benchmark))] - [Message(OuterMessage.C2G_Benchmark)] - [MemoryPackable] - public partial class C2G_Benchmark: MessageObject, IRequest - { - public static C2G_Benchmark Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Benchmark() : ObjectPool.Instance.Fetch(typeof(C2G_Benchmark)) as C2G_Benchmark; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Benchmark)] - [MemoryPackable] - public partial class G2C_Benchmark: MessageObject, IResponse - { - public static G2C_Benchmark Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Benchmark() : ObjectPool.Instance.Fetch(typeof(G2C_Benchmark)) as G2C_Benchmark; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class OuterMessage - { - public const ushort HttpGetRouterResponse = 10002; - public const ushort RouterSync = 10003; - public const ushort C2M_TestRequest = 10004; - public const ushort M2C_TestResponse = 10005; - public const ushort Actor_TransferRequest = 10006; - public const ushort Actor_TransferResponse = 10007; - public const ushort C2G_EnterMap = 10008; - public const ushort G2C_EnterMap = 10009; - public const ushort MoveInfo = 10010; - public const ushort UnitInfo = 10011; - public const ushort M2C_CreateUnits = 10012; - public const ushort M2C_CreateMyUnit = 10013; - public const ushort M2C_StartSceneChange = 10014; - public const ushort M2C_RemoveUnits = 10015; - public const ushort C2M_PathfindingResult = 10016; - public const ushort C2M_Stop = 10017; - public const ushort M2C_PathfindingResult = 10018; - public const ushort M2C_Stop = 10019; - public const ushort C2G_Ping = 10020; - public const ushort G2C_Ping = 10021; - public const ushort G2C_Test = 10022; - public const ushort C2M_Reload = 10023; - public const ushort M2C_Reload = 10024; - public const ushort C2R_Login = 10025; - public const ushort R2C_Login = 10026; - public const ushort C2G_LoginGate = 10027; - public const ushort G2C_LoginGate = 10028; - public const ushort G2C_TestHotfixMessage = 10029; - public const ushort C2M_TestRobotCase = 10030; - public const ushort M2C_TestRobotCase = 10031; - public const ushort C2M_TestRobotCase2 = 10032; - public const ushort M2C_TestRobotCase2 = 10033; - public const ushort C2M_TransferMap = 10034; - public const ushort M2C_TransferMap = 10035; - public const ushort C2G_Benchmark = 10036; - public const ushort G2C_Benchmark = 10037; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/OuterMessage_C_10001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Message/OuterMessage_C_10001.cs.meta deleted file mode 100644 index 8f0b9049..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Message/OuterMessage_C_10001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 64806f5ea712581408fecb08728105c0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Unity.GenerateClient.asmdef b/Assets/GameScripts/DotNet/Model/Generate/Client/Unity.GenerateClient.asmdef deleted file mode 100644 index 3b4f277c..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Unity.GenerateClient.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Unity.GenerateClient", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "IGNORE" - ], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Generate/Client/Unity.GenerateClient.asmdef.meta b/Assets/GameScripts/DotNet/Model/Generate/Client/Unity.GenerateClient.asmdef.meta deleted file mode 100644 index 48c9583c..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Client/Unity.GenerateClient.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ee89d158d8fb55845b395c884f8fed45 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer.meta deleted file mode 100644 index d88462ce..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f6cb781d7426010449c63c186cc69c24 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config.meta deleted file mode 100644 index 511b7599..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 027f4382299e1a7499130098fd865aa1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/AIConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/AIConfig.cs deleted file mode 100644 index 6623d53d..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/AIConfig.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class AIConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - AIConfigCategory s = o as AIConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public AIConfig Get(int id) - { - this.dict.TryGetValue(id, out AIConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (AIConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public AIConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class AIConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属ai - public int AIConfigId { get; set; } - /// 此ai中的顺序 - public int Order { get; set; } - /// 节点名字 - public string Name { get; set; } - /// 节点参数 - public int[] NodeParams { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/AIConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/AIConfig.cs.meta deleted file mode 100644 index 9c39670c..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/AIConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d630eb5b27169034c960192b72954e6b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartMachineConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartMachineConfig.cs deleted file mode 100644 index 39a082c8..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartMachineConfig.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartMachineConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartMachineConfigCategory s = o as StartMachineConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartMachineConfig Get(int id) - { - this.dict.TryGetValue(id, out StartMachineConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartMachineConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartMachineConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartMachineConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 内网地址 - public string InnerIP { get; set; } - /// 外网地址 - public string OuterIP { get; set; } - /// 守护进程端口 - public string WatcherPort { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartMachineConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartMachineConfig.cs.meta deleted file mode 100644 index b955d5e7..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartMachineConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 494fbdb8b84798344b40e09cf5e85ba6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartProcessConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartProcessConfig.cs deleted file mode 100644 index c0996410..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartProcessConfig.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartProcessConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartProcessConfigCategory s = o as StartProcessConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartProcessConfig Get(int id) - { - this.dict.TryGetValue(id, out StartProcessConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartProcessConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartProcessConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartProcessConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属机器 - public int MachineId { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartProcessConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartProcessConfig.cs.meta deleted file mode 100644 index 76ca3112..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartProcessConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 85b6d198d898a3e4cac5731a559ccdab -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartSceneConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartSceneConfig.cs deleted file mode 100644 index 319f3f36..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartSceneConfig.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartSceneConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartSceneConfigCategory s = o as StartSceneConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartSceneConfig Get(int id) - { - this.dict.TryGetValue(id, out StartSceneConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartSceneConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartSceneConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartSceneConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属进程 - public int Process { get; set; } - /// 所属区 - public int Zone { get; set; } - /// 类型 - public string SceneType { get; set; } - /// 名字 - public string Name { get; set; } - /// 外网端口 - public int Port { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartSceneConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartSceneConfig.cs.meta deleted file mode 100644 index c4fd00df..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartSceneConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8dafae098a596734889a32e7c3785118 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartZoneConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartZoneConfig.cs deleted file mode 100644 index a6b64337..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartZoneConfig.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartZoneConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartZoneConfigCategory s = o as StartZoneConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartZoneConfig Get(int id) - { - this.dict.TryGetValue(id, out StartZoneConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartZoneConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartZoneConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartZoneConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 数据库地址 - public string DBConnection { get; set; } - /// 数据库名 - public string DBName { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartZoneConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartZoneConfig.cs.meta deleted file mode 100644 index 8d2182ed..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/StartZoneConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b6b2c5008672ef8499364a33a5cf7e43 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/UnitConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/UnitConfig.cs deleted file mode 100644 index abcbc800..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/UnitConfig.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class UnitConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - UnitConfigCategory s = o as UnitConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public UnitConfig Get(int id) - { - this.dict.TryGetValue(id, out UnitConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public UnitConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class UnitConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// Type - public int Type { get; set; } - /// 名字 - public string Name { get; set; } - /// 位置 - public int Position { get; set; } - /// 身高 - public int Height { get; set; } - /// 体重 - public int Weight { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/UnitConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/UnitConfig.cs.meta deleted file mode 100644 index 4e52aacd..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Config/UnitConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d22b59afb6cead442811e7f8957781a8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial.meta deleted file mode 100644 index 03778947..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 390f281261413d847bd6ceb803f5c38a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs deleted file mode 100644 index c3e67331..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Net; - -namespace ET -{ - public partial class StartProcessConfig - { - public string InnerIP => this.StartMachineConfig.InnerIP; - - public string OuterIP => this.StartMachineConfig.OuterIP; - - public StartMachineConfig StartMachineConfig => StartMachineConfigCategory.Instance.Get(this.MachineId); - - public override void EndInit() - { - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs.meta deleted file mode 100644 index a7217acd..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9685de03e39fb524baead6e580a0f4c0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs deleted file mode 100644 index e8ac9ef1..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using System.Net; - -namespace ET -{ - public partial class StartSceneConfigCategory - { - public MultiMap Gates = new(); - - public MultiMap ProcessScenes = new(); - - public Dictionary NetInners = new(); - - public Dictionary> ClientScenesByName = new(); - - public StartSceneConfig LocationConfig; - - public List Realms = new(); - - public List Routers = new(); - - public List Robots = new(); - - public List Maps = new(); - - public StartSceneConfig Match; - - public List GetByProcess(int process) - { - return this.ProcessScenes[process]; - } - - public StartSceneConfig GetBySceneName(int zone, string name) - { - return this.ClientScenesByName[zone][name]; - } - - public override void EndInit() - { - foreach (StartSceneConfig startSceneConfig in this.GetAll().Values) - { - this.ProcessScenes.Add(startSceneConfig.Process, startSceneConfig); - - if (!this.ClientScenesByName.ContainsKey(startSceneConfig.Zone)) - { - this.ClientScenesByName.Add(startSceneConfig.Zone, new Dictionary()); - } - this.ClientScenesByName[startSceneConfig.Zone].Add(startSceneConfig.Name, startSceneConfig); - - switch (startSceneConfig.Type) - { - case SceneType.NetInner: - this.NetInners.Add(startSceneConfig.Process, startSceneConfig); - break; - case SceneType.Realm: - this.Realms.Add(startSceneConfig); - break; - case SceneType.Gate: - this.Gates.Add(startSceneConfig.Zone, startSceneConfig); - break; - case SceneType.Location: - this.LocationConfig = startSceneConfig; - break; - case SceneType.Robot: - this.Robots.Add(startSceneConfig); - break; - case SceneType.Router: - this.Routers.Add(startSceneConfig); - break; - case SceneType.Map: - this.Maps.Add(startSceneConfig); - break; - case SceneType.Match: - this.Match = startSceneConfig; - break; - } - } - } - } - - public partial class StartSceneConfig: ISupportInitialize - { - public ActorId ActorId; - - public SceneType Type; - - public StartProcessConfig StartProcessConfig - { - get - { - return StartProcessConfigCategory.Instance.Get(this.Process); - } - } - - public StartZoneConfig StartZoneConfig - { - get - { - return StartZoneConfigCategory.Instance.Get(this.Zone); - } - } - - // 内网地址外网端口,通过防火墙映射端口过来 - private IPEndPoint innerIPPort; - - public IPEndPoint InnerIPPort - { - get - { - if (innerIPPort == null) - { - this.innerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.InnerIP}:{this.Port}"); - } - - return this.innerIPPort; - } - } - - private IPEndPoint outerIPPort; - - // 外网地址外网端口 - public IPEndPoint OuterIPPort - { - get - { - if (this.outerIPPort == null) - { - this.outerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.OuterIP}:{this.Port}"); - } - - return this.outerIPPort; - } - } - - public override void EndInit() - { - this.ActorId = new ActorId(this.Process, this.Id, 1); - this.Type = EnumHelper.FromString(this.SceneType); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs.meta deleted file mode 100644 index 7445bc44..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 34e8a007b50be614b91a9f397091514c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message.meta deleted file mode 100644 index e41a3f1f..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 10f8fc000e4c48948a66c02e4b373a92 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/ClientMessage_C_1000.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/ClientMessage_C_1000.cs deleted file mode 100644 index 413b71b9..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/ClientMessage_C_1000.cs +++ /dev/null @@ -1,77 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// using - [ResponseType(nameof(NetClient2Main_Login))] - [Message(ClientMessage.Main2NetClient_Login)] - [MemoryPackable] - public partial class Main2NetClient_Login: MessageObject, IActorRequest - { - public static Main2NetClient_Login Create(bool isFromPool = true) - { - return !isFromPool? new Main2NetClient_Login() : ObjectPool.Instance.Fetch(typeof(Main2NetClient_Login)) as Main2NetClient_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(ClientMessage.NetClient2Main_Login)] - [MemoryPackable] - public partial class NetClient2Main_Login: MessageObject, IActorResponse - { - public static NetClient2Main_Login Create(bool isFromPool = true) - { - return !isFromPool? new NetClient2Main_Login() : ObjectPool.Instance.Fetch(typeof(NetClient2Main_Login)) as NetClient2Main_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class ClientMessage - { - public const ushort Main2NetClient_Login = 1001; - public const ushort NetClient2Main_Login = 1002; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/ClientMessage_C_1000.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/ClientMessage_C_1000.cs.meta deleted file mode 100644 index d8cd2b0a..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/ClientMessage_C_1000.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 92edc085102634d49b0441de1f600ce7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/InnerMessage_S_20001.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/InnerMessage_S_20001.cs deleted file mode 100644 index 44d19c63..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/InnerMessage_S_20001.cs +++ /dev/null @@ -1,758 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// using - [ResponseType(nameof(ObjectQueryResponse))] - [Message(InnerMessage.ObjectQueryRequest)] - [MemoryPackable] - public partial class ObjectQueryRequest: MessageObject, IActorRequest - { - public static ObjectQueryRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectQueryRequest() : ObjectPool.Instance.Fetch(typeof(ObjectQueryRequest)) as ObjectQueryRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Key { get; set; } - - [MemoryPackOrder(2)] - public long InstanceId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Key = default; - this.InstanceId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(A2M_Reload))] - [Message(InnerMessage.M2A_Reload)] - [MemoryPackable] - public partial class M2A_Reload: MessageObject, IActorRequest - { - public static M2A_Reload Create(bool isFromPool = true) - { - return !isFromPool? new M2A_Reload() : ObjectPool.Instance.Fetch(typeof(M2A_Reload)) as M2A_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.A2M_Reload)] - [MemoryPackable] - public partial class A2M_Reload: MessageObject, IActorResponse - { - public static A2M_Reload Create(bool isFromPool = true) - { - return !isFromPool? new A2M_Reload() : ObjectPool.Instance.Fetch(typeof(A2M_Reload)) as A2M_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2G_LockResponse))] - [Message(InnerMessage.G2G_LockRequest)] - [MemoryPackable] - public partial class G2G_LockRequest: MessageObject, IActorRequest - { - public static G2G_LockRequest Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockRequest() : ObjectPool.Instance.Fetch(typeof(G2G_LockRequest)) as G2G_LockRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Id = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2G_LockResponse)] - [MemoryPackable] - public partial class G2G_LockResponse: MessageObject, IActorResponse - { - public static G2G_LockResponse Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockResponse() : ObjectPool.Instance.Fetch(typeof(G2G_LockResponse)) as G2G_LockResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2G_LockReleaseResponse))] - [Message(InnerMessage.G2G_LockReleaseRequest)] - [MemoryPackable] - public partial class G2G_LockReleaseRequest: MessageObject, IActorRequest - { - public static G2G_LockReleaseRequest Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockReleaseRequest() : ObjectPool.Instance.Fetch(typeof(G2G_LockReleaseRequest)) as G2G_LockReleaseRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Id = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2G_LockReleaseResponse)] - [MemoryPackable] - public partial class G2G_LockReleaseResponse: MessageObject, IActorResponse - { - public static G2G_LockReleaseResponse Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockReleaseResponse() : ObjectPool.Instance.Fetch(typeof(G2G_LockReleaseResponse)) as G2G_LockReleaseResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectAddResponse))] - [Message(InnerMessage.ObjectAddRequest)] - [MemoryPackable] - public partial class ObjectAddRequest: MessageObject, IActorRequest - { - public static ObjectAddRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectAddRequest() : ObjectPool.Instance.Fetch(typeof(ObjectAddRequest)) as ObjectAddRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - [MemoryPackOrder(3)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectAddResponse)] - [MemoryPackable] - public partial class ObjectAddResponse: MessageObject, IActorResponse - { - public static ObjectAddResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectAddResponse() : ObjectPool.Instance.Fetch(typeof(ObjectAddResponse)) as ObjectAddResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectLockResponse))] - [Message(InnerMessage.ObjectLockRequest)] - [MemoryPackable] - public partial class ObjectLockRequest: MessageObject, IActorRequest - { - public static ObjectLockRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectLockRequest() : ObjectPool.Instance.Fetch(typeof(ObjectLockRequest)) as ObjectLockRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - [MemoryPackOrder(3)] - public ActorId ActorId { get; set; } - - [MemoryPackOrder(4)] - public int Time { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - this.ActorId = default; - this.Time = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectLockResponse)] - [MemoryPackable] - public partial class ObjectLockResponse: MessageObject, IActorResponse - { - public static ObjectLockResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectLockResponse() : ObjectPool.Instance.Fetch(typeof(ObjectLockResponse)) as ObjectLockResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectUnLockResponse))] - [Message(InnerMessage.ObjectUnLockRequest)] - [MemoryPackable] - public partial class ObjectUnLockRequest: MessageObject, IActorRequest - { - public static ObjectUnLockRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectUnLockRequest() : ObjectPool.Instance.Fetch(typeof(ObjectUnLockRequest)) as ObjectUnLockRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - [MemoryPackOrder(3)] - public ActorId OldActorId { get; set; } - - [MemoryPackOrder(4)] - public ActorId NewActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - this.OldActorId = default; - this.NewActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectUnLockResponse)] - [MemoryPackable] - public partial class ObjectUnLockResponse: MessageObject, IActorResponse - { - public static ObjectUnLockResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectUnLockResponse() : ObjectPool.Instance.Fetch(typeof(ObjectUnLockResponse)) as ObjectUnLockResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectRemoveResponse))] - [Message(InnerMessage.ObjectRemoveRequest)] - [MemoryPackable] - public partial class ObjectRemoveRequest: MessageObject, IActorRequest - { - public static ObjectRemoveRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectRemoveRequest() : ObjectPool.Instance.Fetch(typeof(ObjectRemoveRequest)) as ObjectRemoveRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectRemoveResponse)] - [MemoryPackable] - public partial class ObjectRemoveResponse: MessageObject, IActorResponse - { - public static ObjectRemoveResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectRemoveResponse() : ObjectPool.Instance.Fetch(typeof(ObjectRemoveResponse)) as ObjectRemoveResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectGetResponse))] - [Message(InnerMessage.ObjectGetRequest)] - [MemoryPackable] - public partial class ObjectGetRequest: MessageObject, IActorRequest - { - public static ObjectGetRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectGetRequest() : ObjectPool.Instance.Fetch(typeof(ObjectGetRequest)) as ObjectGetRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectGetResponse)] - [MemoryPackable] - public partial class ObjectGetResponse: MessageObject, IActorResponse - { - public static ObjectGetResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectGetResponse() : ObjectPool.Instance.Fetch(typeof(ObjectGetResponse)) as ObjectGetResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public int Type { get; set; } - - [MemoryPackOrder(4)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Type = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2R_GetLoginKey))] - [Message(InnerMessage.R2G_GetLoginKey)] - [MemoryPackable] - public partial class R2G_GetLoginKey: MessageObject, IActorRequest - { - public static R2G_GetLoginKey Create(bool isFromPool = true) - { - return !isFromPool? new R2G_GetLoginKey() : ObjectPool.Instance.Fetch(typeof(R2G_GetLoginKey)) as R2G_GetLoginKey; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2R_GetLoginKey)] - [MemoryPackable] - public partial class G2R_GetLoginKey: MessageObject, IActorResponse - { - public static G2R_GetLoginKey Create(bool isFromPool = true) - { - return !isFromPool? new G2R_GetLoginKey() : ObjectPool.Instance.Fetch(typeof(G2R_GetLoginKey)) as G2R_GetLoginKey; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long Key { get; set; } - - [MemoryPackOrder(4)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2M_SessionDisconnect)] - [MemoryPackable] - public partial class G2M_SessionDisconnect: MessageObject, IActorLocationMessage - { - public static G2M_SessionDisconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2M_SessionDisconnect() : ObjectPool.Instance.Fetch(typeof(G2M_SessionDisconnect)) as G2M_SessionDisconnect; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectQueryResponse)] - [MemoryPackable] - public partial class ObjectQueryResponse: MessageObject, IActorResponse - { - public static ObjectQueryResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectQueryResponse() : ObjectPool.Instance.Fetch(typeof(ObjectQueryResponse)) as ObjectQueryResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public byte[] Entity { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Entity = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2M_UnitTransferResponse))] - [Message(InnerMessage.M2M_UnitTransferRequest)] - [MemoryPackable] - public partial class M2M_UnitTransferRequest: MessageObject, IActorRequest - { - public static M2M_UnitTransferRequest Create(bool isFromPool = true) - { - return !isFromPool? new M2M_UnitTransferRequest() : ObjectPool.Instance.Fetch(typeof(M2M_UnitTransferRequest)) as M2M_UnitTransferRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public ActorId OldActorId { get; set; } - - [MemoryPackOrder(2)] - public byte[] Unit { get; set; } - - [MemoryPackOrder(3)] - public List Entitys { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.OldActorId = default; - this.Unit = default; - this.Entitys.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.M2M_UnitTransferResponse)] - [MemoryPackable] - public partial class M2M_UnitTransferResponse: MessageObject, IActorResponse - { - public static M2M_UnitTransferResponse Create(bool isFromPool = true) - { - return !isFromPool? new M2M_UnitTransferResponse() : ObjectPool.Instance.Fetch(typeof(M2M_UnitTransferResponse)) as M2M_UnitTransferResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class InnerMessage - { - public const ushort ObjectQueryRequest = 20002; - public const ushort M2A_Reload = 20003; - public const ushort A2M_Reload = 20004; - public const ushort G2G_LockRequest = 20005; - public const ushort G2G_LockResponse = 20006; - public const ushort G2G_LockReleaseRequest = 20007; - public const ushort G2G_LockReleaseResponse = 20008; - public const ushort ObjectAddRequest = 20009; - public const ushort ObjectAddResponse = 20010; - public const ushort ObjectLockRequest = 20011; - public const ushort ObjectLockResponse = 20012; - public const ushort ObjectUnLockRequest = 20013; - public const ushort ObjectUnLockResponse = 20014; - public const ushort ObjectRemoveRequest = 20015; - public const ushort ObjectRemoveResponse = 20016; - public const ushort ObjectGetRequest = 20017; - public const ushort ObjectGetResponse = 20018; - public const ushort R2G_GetLoginKey = 20019; - public const ushort G2R_GetLoginKey = 20020; - public const ushort G2M_SessionDisconnect = 20021; - public const ushort ObjectQueryResponse = 20022; - public const ushort M2M_UnitTransferRequest = 20023; - public const ushort M2M_UnitTransferResponse = 20024; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/InnerMessage_S_20001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/InnerMessage_S_20001.cs.meta deleted file mode 100644 index 2eedb708..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/InnerMessage_S_20001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e0b72155012589840a78d9d64f29bdce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepInner_S_21001.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepInner_S_21001.cs deleted file mode 100644 index c4b6943c..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepInner_S_21001.cs +++ /dev/null @@ -1,263 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// 请求匹配 - [ResponseType(nameof(Match2G_Match))] - [Message(LockStepInner.G2Match_Match)] - [MemoryPackable] - public partial class G2Match_Match: MessageObject, IActorRequest - { - public static G2Match_Match Create(bool isFromPool = true) - { - return !isFromPool? new G2Match_Match() : ObjectPool.Instance.Fetch(typeof(G2Match_Match)) as G2Match_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Id = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Match2G_Match)] - [MemoryPackable] - public partial class Match2G_Match: MessageObject, IActorResponse - { - public static Match2G_Match Create(bool isFromPool = true) - { - return !isFromPool? new Match2G_Match() : ObjectPool.Instance.Fetch(typeof(Match2G_Match)) as Match2G_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Map2Match_GetRoom))] - [Message(LockStepInner.Match2Map_GetRoom)] - [MemoryPackable] - public partial class Match2Map_GetRoom: MessageObject, IActorRequest - { - public static Match2Map_GetRoom Create(bool isFromPool = true) - { - return !isFromPool? new Match2Map_GetRoom() : ObjectPool.Instance.Fetch(typeof(Match2Map_GetRoom)) as Match2Map_GetRoom; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public List PlayerIds { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.PlayerIds.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Map2Match_GetRoom)] - [MemoryPackable] - public partial class Map2Match_GetRoom: MessageObject, IActorResponse - { - public static Map2Match_GetRoom Create(bool isFromPool = true) - { - return !isFromPool? new Map2Match_GetRoom() : ObjectPool.Instance.Fetch(typeof(Map2Match_GetRoom)) as Map2Match_GetRoom; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - -// 房间的ActorId - [MemoryPackOrder(3)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Room2G_Reconnect))] - [Message(LockStepInner.G2Room_Reconnect)] - [MemoryPackable] - public partial class G2Room_Reconnect: MessageObject, IActorRequest - { - public static G2Room_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2Room_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2Room_Reconnect)) as G2Room_Reconnect; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Room2G_Reconnect)] - [MemoryPackable] - public partial class Room2G_Reconnect: MessageObject, IActorResponse - { - public static Room2G_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new Room2G_Reconnect() : ObjectPool.Instance.Fetch(typeof(Room2G_Reconnect)) as Room2G_Reconnect; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long StartTime { get; set; } - - [MemoryPackOrder(4)] - public List UnitInfos { get; set; } = new(); - - [MemoryPackOrder(5)] - public int Frame { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.StartTime = default; - this.UnitInfos.Clear(); - this.Frame = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Room2RoomManager_Init))] - [Message(LockStepInner.RoomManager2Room_Init)] - [MemoryPackable] - public partial class RoomManager2Room_Init: MessageObject, IActorRequest - { - public static RoomManager2Room_Init Create(bool isFromPool = true) - { - return !isFromPool? new RoomManager2Room_Init() : ObjectPool.Instance.Fetch(typeof(RoomManager2Room_Init)) as RoomManager2Room_Init; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public List PlayerIds { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.PlayerIds.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Room2RoomManager_Init)] - [MemoryPackable] - public partial class Room2RoomManager_Init: MessageObject, IActorResponse - { - public static Room2RoomManager_Init Create(bool isFromPool = true) - { - return !isFromPool? new Room2RoomManager_Init() : ObjectPool.Instance.Fetch(typeof(Room2RoomManager_Init)) as Room2RoomManager_Init; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class LockStepInner - { - public const ushort G2Match_Match = 21002; - public const ushort Match2G_Match = 21003; - public const ushort Match2Map_GetRoom = 21004; - public const ushort Map2Match_GetRoom = 21005; - public const ushort G2Room_Reconnect = 21006; - public const ushort Room2G_Reconnect = 21007; - public const ushort RoomManager2Room_Init = 21008; - public const ushort Room2RoomManager_Init = 21009; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepInner_S_21001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepInner_S_21001.cs.meta deleted file mode 100644 index 5e5b6a63..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepInner_S_21001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a6810f88918d4d20ae7b353895f1af1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs deleted file mode 100644 index e2f43d39..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs +++ /dev/null @@ -1,342 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ - [ResponseType(nameof(G2C_Match))] - [Message(LockStepOuter.C2G_Match)] - [MemoryPackable] - public partial class C2G_Match: MessageObject, IRequest - { - public static C2G_Match Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Match() : ObjectPool.Instance.Fetch(typeof(C2G_Match)) as C2G_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.G2C_Match)] - [MemoryPackable] - public partial class G2C_Match: MessageObject, IResponse - { - public static G2C_Match Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Match() : ObjectPool.Instance.Fetch(typeof(G2C_Match)) as G2C_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 匹配成功,通知客户端切换场景 - [Message(LockStepOuter.Match2G_NotifyMatchSuccess)] - [MemoryPackable] - public partial class Match2G_NotifyMatchSuccess: MessageObject, IActorMessage - { - public static Match2G_NotifyMatchSuccess Create(bool isFromPool = true) - { - return !isFromPool? new Match2G_NotifyMatchSuccess() : ObjectPool.Instance.Fetch(typeof(Match2G_NotifyMatchSuccess)) as Match2G_NotifyMatchSuccess; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - -// 房间的ActorId - [MemoryPackOrder(1)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 客户端通知房间切换场景完成 - [Message(LockStepOuter.C2Room_ChangeSceneFinish)] - [MemoryPackable] - public partial class C2Room_ChangeSceneFinish: MessageObject, IActorRoom - { - public static C2Room_ChangeSceneFinish Create(bool isFromPool = true) - { - return !isFromPool? new C2Room_ChangeSceneFinish() : ObjectPool.Instance.Fetch(typeof(C2Room_ChangeSceneFinish)) as C2Room_ChangeSceneFinish; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.LockStepUnitInfo)] - [MemoryPackable] - public partial class LockStepUnitInfo: MessageObject - { - public static LockStepUnitInfo Create(bool isFromPool = true) - { - return !isFromPool? new LockStepUnitInfo() : ObjectPool.Instance.Fetch(typeof(LockStepUnitInfo)) as LockStepUnitInfo; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - [MemoryPackOrder(1)] - public TrueSync.TSVector Position { get; set; } - - [MemoryPackOrder(2)] - public TrueSync.TSQuaternion Rotation { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - this.Position = default; - this.Rotation = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 房间通知客户端进入战斗 - [Message(LockStepOuter.Room2C_Start)] - [MemoryPackable] - public partial class Room2C_Start: MessageObject, IActorMessage - { - public static Room2C_Start Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_Start() : ObjectPool.Instance.Fetch(typeof(Room2C_Start)) as Room2C_Start; - } - - [MemoryPackOrder(0)] - public long StartTime { get; set; } - - [MemoryPackOrder(1)] - public List UnitInfo { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.StartTime = default; - this.UnitInfo.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.FrameMessage)] - [MemoryPackable] - public partial class FrameMessage: MessageObject, IActorMessage - { - public static FrameMessage Create(bool isFromPool = true) - { - return !isFromPool? new FrameMessage() : ObjectPool.Instance.Fetch(typeof(FrameMessage)) as FrameMessage; - } - - [MemoryPackOrder(0)] - public int Frame { get; set; } - - [MemoryPackOrder(1)] - public long PlayerId { get; set; } - - [MemoryPackOrder(2)] - public LSInput Input { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Frame = default; - this.PlayerId = default; - this.Input = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.OneFrameInputs)] - [MemoryPackable] - public partial class OneFrameInputs: MessageObject, IActorMessage - { - public static OneFrameInputs Create(bool isFromPool = true) - { - return !isFromPool? new OneFrameInputs() : ObjectPool.Instance.Fetch(typeof(OneFrameInputs)) as OneFrameInputs; - } - - [MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)] - [MemoryPackOrder(1)] - public Dictionary Inputs { get; set; } = new(); - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Inputs.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.Room2C_AdjustUpdateTime)] - [MemoryPackable] - public partial class Room2C_AdjustUpdateTime: MessageObject, IActorMessage - { - public static Room2C_AdjustUpdateTime Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_AdjustUpdateTime() : ObjectPool.Instance.Fetch(typeof(Room2C_AdjustUpdateTime)) as Room2C_AdjustUpdateTime; - } - - [MemoryPackOrder(0)] - public int DiffTime { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.DiffTime = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.C2Room_CheckHash)] - [MemoryPackable] - public partial class C2Room_CheckHash: MessageObject, IActorRoom - { - public static C2Room_CheckHash Create(bool isFromPool = true) - { - return !isFromPool? new C2Room_CheckHash() : ObjectPool.Instance.Fetch(typeof(C2Room_CheckHash)) as C2Room_CheckHash; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - [MemoryPackOrder(1)] - public int Frame { get; set; } - - [MemoryPackOrder(2)] - public long Hash { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - this.Frame = default; - this.Hash = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.Room2C_CheckHashFail)] - [MemoryPackable] - public partial class Room2C_CheckHashFail: MessageObject, IActorMessage - { - public static Room2C_CheckHashFail Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_CheckHashFail() : ObjectPool.Instance.Fetch(typeof(Room2C_CheckHashFail)) as Room2C_CheckHashFail; - } - - [MemoryPackOrder(0)] - public int Frame { get; set; } - - [MemoryPackOrder(1)] - public byte[] LSWorldBytes { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Frame = default; - this.LSWorldBytes = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.G2C_Reconnect)] - [MemoryPackable] - public partial class G2C_Reconnect: MessageObject, IActorMessage - { - public static G2C_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2C_Reconnect)) as G2C_Reconnect; - } - - [MemoryPackOrder(0)] - public long StartTime { get; set; } - - [MemoryPackOrder(1)] - public List UnitInfos { get; set; } = new(); - - [MemoryPackOrder(2)] - public int Frame { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.StartTime = default; - this.UnitInfos.Clear(); - this.Frame = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class LockStepOuter - { - public const ushort C2G_Match = 11002; - public const ushort G2C_Match = 11003; - public const ushort Match2G_NotifyMatchSuccess = 11004; - public const ushort C2Room_ChangeSceneFinish = 11005; - public const ushort LockStepUnitInfo = 11006; - public const ushort Room2C_Start = 11007; - public const ushort FrameMessage = 11008; - public const ushort OneFrameInputs = 11009; - public const ushort Room2C_AdjustUpdateTime = 11010; - public const ushort C2Room_CheckHash = 11011; - public const ushort Room2C_CheckHashFail = 11012; - public const ushort G2C_Reconnect = 11013; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs.meta deleted file mode 100644 index ac48c819..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/LockStepOuter_C_11001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f493672bf2fa046739a1f8fbf88a28c3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs deleted file mode 100644 index fe702046..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs +++ /dev/null @@ -1,1068 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ - [Message(OuterMessage.HttpGetRouterResponse)] - [MemoryPackable] - public partial class HttpGetRouterResponse: MessageObject - { - public static HttpGetRouterResponse Create(bool isFromPool = true) - { - return !isFromPool? new HttpGetRouterResponse() : ObjectPool.Instance.Fetch(typeof(HttpGetRouterResponse)) as HttpGetRouterResponse; - } - - [MemoryPackOrder(0)] - public List Realms { get; set; } = new(); - - [MemoryPackOrder(1)] - public List Routers { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Realms.Clear(); - this.Routers.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.RouterSync)] - [MemoryPackable] - public partial class RouterSync: MessageObject - { - public static RouterSync Create(bool isFromPool = true) - { - return !isFromPool? new RouterSync() : ObjectPool.Instance.Fetch(typeof(RouterSync)) as RouterSync; - } - - [MemoryPackOrder(0)] - public uint ConnectId { get; set; } - - [MemoryPackOrder(1)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.ConnectId = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TestResponse))] - [Message(OuterMessage.C2M_TestRequest)] - [MemoryPackable] - public partial class C2M_TestRequest: MessageObject, IActorLocationRequest - { - public static C2M_TestRequest Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRequest() : ObjectPool.Instance.Fetch(typeof(C2M_TestRequest)) as C2M_TestRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string request { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.request = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestResponse)] - [MemoryPackable] - public partial class M2C_TestResponse: MessageObject, IActorResponse - { - public static M2C_TestResponse Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestResponse() : ObjectPool.Instance.Fetch(typeof(M2C_TestResponse)) as M2C_TestResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public string response { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.response = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Actor_TransferResponse))] - [Message(OuterMessage.Actor_TransferRequest)] - [MemoryPackable] - public partial class Actor_TransferRequest: MessageObject, IActorLocationRequest - { - public static Actor_TransferRequest Create(bool isFromPool = true) - { - return !isFromPool? new Actor_TransferRequest() : ObjectPool.Instance.Fetch(typeof(Actor_TransferRequest)) as Actor_TransferRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int MapIndex { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.MapIndex = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.Actor_TransferResponse)] - [MemoryPackable] - public partial class Actor_TransferResponse: MessageObject, IActorLocationResponse - { - public static Actor_TransferResponse Create(bool isFromPool = true) - { - return !isFromPool? new Actor_TransferResponse() : ObjectPool.Instance.Fetch(typeof(Actor_TransferResponse)) as Actor_TransferResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_EnterMap))] - [Message(OuterMessage.C2G_EnterMap)] - [MemoryPackable] - public partial class C2G_EnterMap: MessageObject, IRequest - { - public static C2G_EnterMap Create(bool isFromPool = true) - { - return !isFromPool? new C2G_EnterMap() : ObjectPool.Instance.Fetch(typeof(C2G_EnterMap)) as C2G_EnterMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_EnterMap)] - [MemoryPackable] - public partial class G2C_EnterMap: MessageObject, IResponse - { - public static G2C_EnterMap Create(bool isFromPool = true) - { - return !isFromPool? new G2C_EnterMap() : ObjectPool.Instance.Fetch(typeof(G2C_EnterMap)) as G2C_EnterMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - -// 自己unitId - [MemoryPackOrder(3)] - public long MyId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.MyId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.MoveInfo)] - [MemoryPackable] - public partial class MoveInfo: MessageObject - { - public static MoveInfo Create(bool isFromPool = true) - { - return !isFromPool? new MoveInfo() : ObjectPool.Instance.Fetch(typeof(MoveInfo)) as MoveInfo; - } - - [MemoryPackOrder(0)] - public List Points { get; set; } = new(); - - [MemoryPackOrder(1)] - public Unity.Mathematics.quaternion Rotation { get; set; } - - [MemoryPackOrder(2)] - public int TurnSpeed { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Points.Clear(); - this.Rotation = default; - this.TurnSpeed = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.UnitInfo)] - [MemoryPackable] - public partial class UnitInfo: MessageObject - { - public static UnitInfo Create(bool isFromPool = true) - { - return !isFromPool? new UnitInfo() : ObjectPool.Instance.Fetch(typeof(UnitInfo)) as UnitInfo; - } - - [MemoryPackOrder(0)] - public long UnitId { get; set; } - - [MemoryPackOrder(1)] - public int ConfigId { get; set; } - - [MemoryPackOrder(2)] - public int Type { get; set; } - - [MemoryPackOrder(3)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(4)] - public Unity.Mathematics.float3 Forward { get; set; } - - [MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)] - [MemoryPackOrder(5)] - public Dictionary KV { get; set; } = new(); - [MemoryPackOrder(6)] - public MoveInfo MoveInfo { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.UnitId = default; - this.ConfigId = default; - this.Type = default; - this.Position = default; - this.Forward = default; - this.KV.Clear(); - this.MoveInfo = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_CreateUnits)] - [MemoryPackable] - public partial class M2C_CreateUnits: MessageObject, IActorMessage - { - public static M2C_CreateUnits Create(bool isFromPool = true) - { - return !isFromPool? new M2C_CreateUnits() : ObjectPool.Instance.Fetch(typeof(M2C_CreateUnits)) as M2C_CreateUnits; - } - - [MemoryPackOrder(0)] - public List Units { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Units.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_CreateMyUnit)] - [MemoryPackable] - public partial class M2C_CreateMyUnit: MessageObject, IActorMessage - { - public static M2C_CreateMyUnit Create(bool isFromPool = true) - { - return !isFromPool? new M2C_CreateMyUnit() : ObjectPool.Instance.Fetch(typeof(M2C_CreateMyUnit)) as M2C_CreateMyUnit; - } - - [MemoryPackOrder(0)] - public UnitInfo Unit { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Unit = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_StartSceneChange)] - [MemoryPackable] - public partial class M2C_StartSceneChange: MessageObject, IActorMessage - { - public static M2C_StartSceneChange Create(bool isFromPool = true) - { - return !isFromPool? new M2C_StartSceneChange() : ObjectPool.Instance.Fetch(typeof(M2C_StartSceneChange)) as M2C_StartSceneChange; - } - - [MemoryPackOrder(0)] - public long SceneInstanceId { get; set; } - - [MemoryPackOrder(1)] - public string SceneName { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.SceneInstanceId = default; - this.SceneName = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_RemoveUnits)] - [MemoryPackable] - public partial class M2C_RemoveUnits: MessageObject, IActorMessage - { - public static M2C_RemoveUnits Create(bool isFromPool = true) - { - return !isFromPool? new M2C_RemoveUnits() : ObjectPool.Instance.Fetch(typeof(M2C_RemoveUnits)) as M2C_RemoveUnits; - } - - [MemoryPackOrder(0)] - public List Units { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Units.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_PathfindingResult)] - [MemoryPackable] - public partial class C2M_PathfindingResult: MessageObject, IActorLocationMessage - { - public static C2M_PathfindingResult Create(bool isFromPool = true) - { - return !isFromPool? new C2M_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(C2M_PathfindingResult)) as C2M_PathfindingResult; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public Unity.Mathematics.float3 Position { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Position = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_Stop)] - [MemoryPackable] - public partial class C2M_Stop: MessageObject, IActorLocationMessage - { - public static C2M_Stop Create(bool isFromPool = true) - { - return !isFromPool? new C2M_Stop() : ObjectPool.Instance.Fetch(typeof(C2M_Stop)) as C2M_Stop; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_PathfindingResult)] - [MemoryPackable] - public partial class M2C_PathfindingResult: MessageObject, IActorMessage - { - public static M2C_PathfindingResult Create(bool isFromPool = true) - { - return !isFromPool? new M2C_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(M2C_PathfindingResult)) as M2C_PathfindingResult; - } - - [MemoryPackOrder(0)] - public long Id { get; set; } - - [MemoryPackOrder(1)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(2)] - public List Points { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Id = default; - this.Position = default; - this.Points.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_Stop)] - [MemoryPackable] - public partial class M2C_Stop: MessageObject, IActorMessage - { - public static M2C_Stop Create(bool isFromPool = true) - { - return !isFromPool? new M2C_Stop() : ObjectPool.Instance.Fetch(typeof(M2C_Stop)) as M2C_Stop; - } - - [MemoryPackOrder(0)] - public int Error { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(3)] - public Unity.Mathematics.quaternion Rotation { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Error = default; - this.Id = default; - this.Position = default; - this.Rotation = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_Ping))] - [Message(OuterMessage.C2G_Ping)] - [MemoryPackable] - public partial class C2G_Ping: MessageObject, IRequest - { - public static C2G_Ping Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Ping() : ObjectPool.Instance.Fetch(typeof(C2G_Ping)) as C2G_Ping; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Ping)] - [MemoryPackable] - public partial class G2C_Ping: MessageObject, IResponse - { - public static G2C_Ping Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Ping() : ObjectPool.Instance.Fetch(typeof(G2C_Ping)) as G2C_Ping; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long Time { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Time = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Test)] - [MemoryPackable] - public partial class G2C_Test: MessageObject, IMessage - { - public static G2C_Test Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Test() : ObjectPool.Instance.Fetch(typeof(G2C_Test)) as G2C_Test; - } - - public override void Dispose() - { - if (!this.IsFromPool) return; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_Reload))] - [Message(OuterMessage.C2M_Reload)] - [MemoryPackable] - public partial class C2M_Reload: MessageObject, IRequest - { - public static C2M_Reload Create(bool isFromPool = true) - { - return !isFromPool? new C2M_Reload() : ObjectPool.Instance.Fetch(typeof(C2M_Reload)) as C2M_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_Reload)] - [MemoryPackable] - public partial class M2C_Reload: MessageObject, IResponse - { - public static M2C_Reload Create(bool isFromPool = true) - { - return !isFromPool? new M2C_Reload() : ObjectPool.Instance.Fetch(typeof(M2C_Reload)) as M2C_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(R2C_Login))] - [Message(OuterMessage.C2R_Login)] - [MemoryPackable] - public partial class C2R_Login: MessageObject, IRequest - { - public static C2R_Login Create(bool isFromPool = true) - { - return !isFromPool? new C2R_Login() : ObjectPool.Instance.Fetch(typeof(C2R_Login)) as C2R_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.R2C_Login)] - [MemoryPackable] - public partial class R2C_Login: MessageObject, IResponse - { - public static R2C_Login Create(bool isFromPool = true) - { - return !isFromPool? new R2C_Login() : ObjectPool.Instance.Fetch(typeof(R2C_Login)) as R2C_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public string Address { get; set; } - - [MemoryPackOrder(4)] - public long Key { get; set; } - - [MemoryPackOrder(5)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Address = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_LoginGate))] - [Message(OuterMessage.C2G_LoginGate)] - [MemoryPackable] - public partial class C2G_LoginGate: MessageObject, IRequest - { - public static C2G_LoginGate Create(bool isFromPool = true) - { - return !isFromPool? new C2G_LoginGate() : ObjectPool.Instance.Fetch(typeof(C2G_LoginGate)) as C2G_LoginGate; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Key { get; set; } - - [MemoryPackOrder(2)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_LoginGate)] - [MemoryPackable] - public partial class G2C_LoginGate: MessageObject, IResponse - { - public static G2C_LoginGate Create(bool isFromPool = true) - { - return !isFromPool? new G2C_LoginGate() : ObjectPool.Instance.Fetch(typeof(G2C_LoginGate)) as G2C_LoginGate; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_TestHotfixMessage)] - [MemoryPackable] - public partial class G2C_TestHotfixMessage: MessageObject, IMessage - { - public static G2C_TestHotfixMessage Create(bool isFromPool = true) - { - return !isFromPool? new G2C_TestHotfixMessage() : ObjectPool.Instance.Fetch(typeof(G2C_TestHotfixMessage)) as G2C_TestHotfixMessage; - } - - [MemoryPackOrder(0)] - public string Info { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Info = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TestRobotCase))] - [Message(OuterMessage.C2M_TestRobotCase)] - [MemoryPackable] - public partial class C2M_TestRobotCase: MessageObject, IActorLocationRequest - { - public static C2M_TestRobotCase Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase)) as C2M_TestRobotCase; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestRobotCase)] - [MemoryPackable] - public partial class M2C_TestRobotCase: MessageObject, IActorLocationResponse - { - public static M2C_TestRobotCase Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase)) as M2C_TestRobotCase; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_TestRobotCase2)] - [MemoryPackable] - public partial class C2M_TestRobotCase2: MessageObject, IActorLocationMessage - { - public static C2M_TestRobotCase2 Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase2)) as C2M_TestRobotCase2; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestRobotCase2)] - [MemoryPackable] - public partial class M2C_TestRobotCase2: MessageObject, IActorLocationMessage - { - public static M2C_TestRobotCase2 Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase2)) as M2C_TestRobotCase2; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TransferMap))] - [Message(OuterMessage.C2M_TransferMap)] - [MemoryPackable] - public partial class C2M_TransferMap: MessageObject, IActorLocationRequest - { - public static C2M_TransferMap Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TransferMap() : ObjectPool.Instance.Fetch(typeof(C2M_TransferMap)) as C2M_TransferMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TransferMap)] - [MemoryPackable] - public partial class M2C_TransferMap: MessageObject, IActorLocationResponse - { - public static M2C_TransferMap Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TransferMap() : ObjectPool.Instance.Fetch(typeof(M2C_TransferMap)) as M2C_TransferMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_Benchmark))] - [Message(OuterMessage.C2G_Benchmark)] - [MemoryPackable] - public partial class C2G_Benchmark: MessageObject, IRequest - { - public static C2G_Benchmark Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Benchmark() : ObjectPool.Instance.Fetch(typeof(C2G_Benchmark)) as C2G_Benchmark; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Benchmark)] - [MemoryPackable] - public partial class G2C_Benchmark: MessageObject, IResponse - { - public static G2C_Benchmark Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Benchmark() : ObjectPool.Instance.Fetch(typeof(G2C_Benchmark)) as G2C_Benchmark; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class OuterMessage - { - public const ushort HttpGetRouterResponse = 10002; - public const ushort RouterSync = 10003; - public const ushort C2M_TestRequest = 10004; - public const ushort M2C_TestResponse = 10005; - public const ushort Actor_TransferRequest = 10006; - public const ushort Actor_TransferResponse = 10007; - public const ushort C2G_EnterMap = 10008; - public const ushort G2C_EnterMap = 10009; - public const ushort MoveInfo = 10010; - public const ushort UnitInfo = 10011; - public const ushort M2C_CreateUnits = 10012; - public const ushort M2C_CreateMyUnit = 10013; - public const ushort M2C_StartSceneChange = 10014; - public const ushort M2C_RemoveUnits = 10015; - public const ushort C2M_PathfindingResult = 10016; - public const ushort C2M_Stop = 10017; - public const ushort M2C_PathfindingResult = 10018; - public const ushort M2C_Stop = 10019; - public const ushort C2G_Ping = 10020; - public const ushort G2C_Ping = 10021; - public const ushort G2C_Test = 10022; - public const ushort C2M_Reload = 10023; - public const ushort M2C_Reload = 10024; - public const ushort C2R_Login = 10025; - public const ushort R2C_Login = 10026; - public const ushort C2G_LoginGate = 10027; - public const ushort G2C_LoginGate = 10028; - public const ushort G2C_TestHotfixMessage = 10029; - public const ushort C2M_TestRobotCase = 10030; - public const ushort M2C_TestRobotCase = 10031; - public const ushort C2M_TestRobotCase2 = 10032; - public const ushort M2C_TestRobotCase2 = 10033; - public const ushort C2M_TransferMap = 10034; - public const ushort M2C_TransferMap = 10035; - public const ushort C2G_Benchmark = 10036; - public const ushort G2C_Benchmark = 10037; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs.meta deleted file mode 100644 index edfec93e..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/ClientServer/Message/OuterMessage_C_10001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9a420edf6a4a57a4c8d98e5acdffcfe9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server.meta b/Assets/GameScripts/DotNet/Model/Generate/Server.meta deleted file mode 100644 index b1de89c1..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 24ce03f1b7723bc47bca791671a977d2 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config.meta deleted file mode 100644 index 742c5ba0..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c85bf5cb7b62b2f4d83f401d23ab35bb -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/AIConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/AIConfig.cs deleted file mode 100644 index 6623d53d..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/AIConfig.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class AIConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - AIConfigCategory s = o as AIConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public AIConfig Get(int id) - { - this.dict.TryGetValue(id, out AIConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (AIConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public AIConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class AIConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属ai - public int AIConfigId { get; set; } - /// 此ai中的顺序 - public int Order { get; set; } - /// 节点名字 - public string Name { get; set; } - /// 节点参数 - public int[] NodeParams { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/AIConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/AIConfig.cs.meta deleted file mode 100644 index 7139966e..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/AIConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 25f89cbd24b877146a00f0b89443ed02 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartMachineConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartMachineConfig.cs deleted file mode 100644 index 39a082c8..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartMachineConfig.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartMachineConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartMachineConfigCategory s = o as StartMachineConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartMachineConfig Get(int id) - { - this.dict.TryGetValue(id, out StartMachineConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartMachineConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartMachineConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartMachineConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 内网地址 - public string InnerIP { get; set; } - /// 外网地址 - public string OuterIP { get; set; } - /// 守护进程端口 - public string WatcherPort { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartMachineConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartMachineConfig.cs.meta deleted file mode 100644 index 6fed2088..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartMachineConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 563f0756420049a44a3bb5e2a477d595 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartProcessConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartProcessConfig.cs deleted file mode 100644 index c0996410..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartProcessConfig.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartProcessConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartProcessConfigCategory s = o as StartProcessConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartProcessConfig Get(int id) - { - this.dict.TryGetValue(id, out StartProcessConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartProcessConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartProcessConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartProcessConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属机器 - public int MachineId { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartProcessConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartProcessConfig.cs.meta deleted file mode 100644 index b89344aa..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartProcessConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 33af398c5827a1e4e9d75cc717b24f19 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartSceneConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartSceneConfig.cs deleted file mode 100644 index 319f3f36..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartSceneConfig.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartSceneConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartSceneConfigCategory s = o as StartSceneConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartSceneConfig Get(int id) - { - this.dict.TryGetValue(id, out StartSceneConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartSceneConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartSceneConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartSceneConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 所属进程 - public int Process { get; set; } - /// 所属区 - public int Zone { get; set; } - /// 类型 - public string SceneType { get; set; } - /// 名字 - public string Name { get; set; } - /// 外网端口 - public int Port { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartSceneConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartSceneConfig.cs.meta deleted file mode 100644 index 35fcff9c..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartSceneConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 14c0e4b0dd4cc3d4ebdd1d4a47d3a27d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartZoneConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartZoneConfig.cs deleted file mode 100644 index a6b64337..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartZoneConfig.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class StartZoneConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - StartZoneConfigCategory s = o as StartZoneConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public StartZoneConfig Get(int id) - { - this.dict.TryGetValue(id, out StartZoneConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (StartZoneConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public StartZoneConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class StartZoneConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// 数据库地址 - public string DBConnection { get; set; } - /// 数据库名 - public string DBName { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartZoneConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartZoneConfig.cs.meta deleted file mode 100644 index 837b02d9..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/StartZoneConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e1c42eaffb283cc46b9844755f7738d9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/UnitConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/UnitConfig.cs deleted file mode 100644 index e3f513be..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/UnitConfig.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [Config] - public partial class UnitConfigCategory : ConfigSingleton, IMerge - { - [BsonElement] - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - private Dictionary dict = new Dictionary(); - - public void Merge(object o) - { - UnitConfigCategory s = o as UnitConfigCategory; - foreach (var kv in s.dict) - { - this.dict.Add(kv.Key, kv.Value); - } - } - - public UnitConfig Get(int id) - { - this.dict.TryGetValue(id, out UnitConfig item); - - if (item == null) - { - throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)},配置id: {id}"); - } - - return item; - } - - public bool Contain(int id) - { - return this.dict.ContainsKey(id); - } - - public Dictionary GetAll() - { - return this.dict; - } - - public UnitConfig GetOne() - { - if (this.dict == null || this.dict.Count <= 0) - { - return null; - } - return this.dict.Values.GetEnumerator().Current; - } - } - - public partial class UnitConfig: ProtoObject, IConfig - { - /// Id - public int Id { get; set; } - /// Type - public int Type { get; set; } - /// 名字 - public string Name { get; set; } - /// 位置 - public int Position { get; set; } - /// 体重 - public int Weight { get; set; } - - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/UnitConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Config/UnitConfig.cs.meta deleted file mode 100644 index 103d8edd..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Config/UnitConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 947acfb009d18314896dfdc3311921ba -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial.meta deleted file mode 100644 index 44a3e06d..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fea0fd2e70a98ea43b4cadf76f874c28 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartProcessConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartProcessConfig.cs deleted file mode 100644 index 797a9e72..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartProcessConfig.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Net; - -namespace ET -{ - public partial class StartProcessConfig - { - public long SceneId; - - public string InnerIP => this.StartMachineConfig.InnerIP; - - public string OuterIP => this.StartMachineConfig.OuterIP; - - public StartMachineConfig StartMachineConfig => StartMachineConfigCategory.Instance.Get(this.MachineId); - - public override void EndInit() - { - InstanceIdStruct instanceIdStruct = new(0, (uint)this.Id); - this.SceneId = instanceIdStruct.ToLong(); - Log.Info($"StartProcess info: {this.MachineId} {this.Id} {this.SceneId}"); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartProcessConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartProcessConfig.cs.meta deleted file mode 100644 index 6ac659e7..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartProcessConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d21748fcd16e9ba4490731de6fb475b7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs deleted file mode 100644 index 981dc69e..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using System.Net; - -namespace ET -{ - public partial class StartSceneConfigCategory - { - public MultiMap Gates = new(); - - public MultiMap ProcessScenes = new(); - - public Dictionary NetInners = new(); - - public Dictionary> ClientScenesByName = new(); - - public StartSceneConfig LocationConfig; - - public List Realms = new(); - - public List Routers = new(); - - public List Robots = new(); - - public List Maps = new(); - - public StartSceneConfig Match; - - public List GetByProcess(int process) - { - return this.ProcessScenes[process]; - } - - public StartSceneConfig GetBySceneName(int zone, string name) - { - return this.ClientScenesByName[zone][name]; - } - - public override void EndInit() - { - foreach (StartSceneConfig startSceneConfig in this.GetAll().Values) - { - this.ProcessScenes.Add(startSceneConfig.Process, startSceneConfig); - - if (!this.ClientScenesByName.ContainsKey(startSceneConfig.Zone)) - { - this.ClientScenesByName.Add(startSceneConfig.Zone, new Dictionary()); - } - this.ClientScenesByName[startSceneConfig.Zone].Add(startSceneConfig.Name, startSceneConfig); - - switch (startSceneConfig.Type) - { - case SceneType.NetInner: - this.NetInners.Add(startSceneConfig.Process, startSceneConfig); - break; - case SceneType.Realm: - this.Realms.Add(startSceneConfig); - break; - case SceneType.Gate: - this.Gates.Add(startSceneConfig.Zone, startSceneConfig); - break; - case SceneType.Location: - this.LocationConfig = startSceneConfig; - break; - case SceneType.Robot: - this.Robots.Add(startSceneConfig); - break; - case SceneType.Router: - this.Routers.Add(startSceneConfig); - break; - case SceneType.Map: - this.Maps.Add(startSceneConfig); - break; - case SceneType.Match: - this.Match = startSceneConfig; - break; - } - } - } - } - - public partial class StartSceneConfig: ISupportInitialize - { - public ActorId ActorId; - - public SceneType Type; - - public StartProcessConfig StartProcessConfig - { - get - { - return StartProcessConfigCategory.Instance.Get(this.Process); - } - } - - public StartZoneConfig StartZoneConfig - { - get - { - return StartZoneConfigCategory.Instance.Get(this.Zone); - } - } - - // 内网地址外网端口,通过防火墙映射端口过来 - private IPEndPoint innerIPPort; - - public IPEndPoint InnerIPPort - { - get - { - if (this.innerIPPort == null) - { - this.innerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.InnerIP}:{this.Port}"); - } - - return this.innerIPPort; - } - } - - private IPEndPoint outerIPPort; - - // 外网地址外网端口 - public IPEndPoint OuterIPPort - { - get - { - if (this.outerIPPort == null) - { - this.outerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.OuterIP}:{this.Port}"); - } - - return this.outerIPPort; - } - } - - public override void EndInit() - { - this.ActorId = new ActorId(this.Process, this.Id, 1); - this.Type = EnumHelper.FromString(this.SceneType); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs.meta deleted file mode 100644 index cdf6d852..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2328265af4362554bb7e63612eafcc2e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Message.meta deleted file mode 100644 index b2e537a0..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d062d8a8ef84f66479bef1bec4baeb3a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/ClientMessage_C_1000.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/ClientMessage_C_1000.cs deleted file mode 100644 index 413b71b9..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/ClientMessage_C_1000.cs +++ /dev/null @@ -1,77 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// using - [ResponseType(nameof(NetClient2Main_Login))] - [Message(ClientMessage.Main2NetClient_Login)] - [MemoryPackable] - public partial class Main2NetClient_Login: MessageObject, IActorRequest - { - public static Main2NetClient_Login Create(bool isFromPool = true) - { - return !isFromPool? new Main2NetClient_Login() : ObjectPool.Instance.Fetch(typeof(Main2NetClient_Login)) as Main2NetClient_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(ClientMessage.NetClient2Main_Login)] - [MemoryPackable] - public partial class NetClient2Main_Login: MessageObject, IActorResponse - { - public static NetClient2Main_Login Create(bool isFromPool = true) - { - return !isFromPool? new NetClient2Main_Login() : ObjectPool.Instance.Fetch(typeof(NetClient2Main_Login)) as NetClient2Main_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class ClientMessage - { - public const ushort Main2NetClient_Login = 1001; - public const ushort NetClient2Main_Login = 1002; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/ClientMessage_C_1000.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/ClientMessage_C_1000.cs.meta deleted file mode 100644 index cccb38f0..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/ClientMessage_C_1000.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 78bb986771fe05c4dbd537687d809df5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/InnerMessage_S_20001.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/InnerMessage_S_20001.cs deleted file mode 100644 index 44d19c63..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/InnerMessage_S_20001.cs +++ /dev/null @@ -1,758 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// using - [ResponseType(nameof(ObjectQueryResponse))] - [Message(InnerMessage.ObjectQueryRequest)] - [MemoryPackable] - public partial class ObjectQueryRequest: MessageObject, IActorRequest - { - public static ObjectQueryRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectQueryRequest() : ObjectPool.Instance.Fetch(typeof(ObjectQueryRequest)) as ObjectQueryRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Key { get; set; } - - [MemoryPackOrder(2)] - public long InstanceId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Key = default; - this.InstanceId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(A2M_Reload))] - [Message(InnerMessage.M2A_Reload)] - [MemoryPackable] - public partial class M2A_Reload: MessageObject, IActorRequest - { - public static M2A_Reload Create(bool isFromPool = true) - { - return !isFromPool? new M2A_Reload() : ObjectPool.Instance.Fetch(typeof(M2A_Reload)) as M2A_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.A2M_Reload)] - [MemoryPackable] - public partial class A2M_Reload: MessageObject, IActorResponse - { - public static A2M_Reload Create(bool isFromPool = true) - { - return !isFromPool? new A2M_Reload() : ObjectPool.Instance.Fetch(typeof(A2M_Reload)) as A2M_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2G_LockResponse))] - [Message(InnerMessage.G2G_LockRequest)] - [MemoryPackable] - public partial class G2G_LockRequest: MessageObject, IActorRequest - { - public static G2G_LockRequest Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockRequest() : ObjectPool.Instance.Fetch(typeof(G2G_LockRequest)) as G2G_LockRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Id = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2G_LockResponse)] - [MemoryPackable] - public partial class G2G_LockResponse: MessageObject, IActorResponse - { - public static G2G_LockResponse Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockResponse() : ObjectPool.Instance.Fetch(typeof(G2G_LockResponse)) as G2G_LockResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2G_LockReleaseResponse))] - [Message(InnerMessage.G2G_LockReleaseRequest)] - [MemoryPackable] - public partial class G2G_LockReleaseRequest: MessageObject, IActorRequest - { - public static G2G_LockReleaseRequest Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockReleaseRequest() : ObjectPool.Instance.Fetch(typeof(G2G_LockReleaseRequest)) as G2G_LockReleaseRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Id = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2G_LockReleaseResponse)] - [MemoryPackable] - public partial class G2G_LockReleaseResponse: MessageObject, IActorResponse - { - public static G2G_LockReleaseResponse Create(bool isFromPool = true) - { - return !isFromPool? new G2G_LockReleaseResponse() : ObjectPool.Instance.Fetch(typeof(G2G_LockReleaseResponse)) as G2G_LockReleaseResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectAddResponse))] - [Message(InnerMessage.ObjectAddRequest)] - [MemoryPackable] - public partial class ObjectAddRequest: MessageObject, IActorRequest - { - public static ObjectAddRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectAddRequest() : ObjectPool.Instance.Fetch(typeof(ObjectAddRequest)) as ObjectAddRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - [MemoryPackOrder(3)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectAddResponse)] - [MemoryPackable] - public partial class ObjectAddResponse: MessageObject, IActorResponse - { - public static ObjectAddResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectAddResponse() : ObjectPool.Instance.Fetch(typeof(ObjectAddResponse)) as ObjectAddResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectLockResponse))] - [Message(InnerMessage.ObjectLockRequest)] - [MemoryPackable] - public partial class ObjectLockRequest: MessageObject, IActorRequest - { - public static ObjectLockRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectLockRequest() : ObjectPool.Instance.Fetch(typeof(ObjectLockRequest)) as ObjectLockRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - [MemoryPackOrder(3)] - public ActorId ActorId { get; set; } - - [MemoryPackOrder(4)] - public int Time { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - this.ActorId = default; - this.Time = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectLockResponse)] - [MemoryPackable] - public partial class ObjectLockResponse: MessageObject, IActorResponse - { - public static ObjectLockResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectLockResponse() : ObjectPool.Instance.Fetch(typeof(ObjectLockResponse)) as ObjectLockResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectUnLockResponse))] - [Message(InnerMessage.ObjectUnLockRequest)] - [MemoryPackable] - public partial class ObjectUnLockRequest: MessageObject, IActorRequest - { - public static ObjectUnLockRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectUnLockRequest() : ObjectPool.Instance.Fetch(typeof(ObjectUnLockRequest)) as ObjectUnLockRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - [MemoryPackOrder(3)] - public ActorId OldActorId { get; set; } - - [MemoryPackOrder(4)] - public ActorId NewActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - this.OldActorId = default; - this.NewActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectUnLockResponse)] - [MemoryPackable] - public partial class ObjectUnLockResponse: MessageObject, IActorResponse - { - public static ObjectUnLockResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectUnLockResponse() : ObjectPool.Instance.Fetch(typeof(ObjectUnLockResponse)) as ObjectUnLockResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectRemoveResponse))] - [Message(InnerMessage.ObjectRemoveRequest)] - [MemoryPackable] - public partial class ObjectRemoveRequest: MessageObject, IActorRequest - { - public static ObjectRemoveRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectRemoveRequest() : ObjectPool.Instance.Fetch(typeof(ObjectRemoveRequest)) as ObjectRemoveRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectRemoveResponse)] - [MemoryPackable] - public partial class ObjectRemoveResponse: MessageObject, IActorResponse - { - public static ObjectRemoveResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectRemoveResponse() : ObjectPool.Instance.Fetch(typeof(ObjectRemoveResponse)) as ObjectRemoveResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(ObjectGetResponse))] - [Message(InnerMessage.ObjectGetRequest)] - [MemoryPackable] - public partial class ObjectGetRequest: MessageObject, IActorRequest - { - public static ObjectGetRequest Create(bool isFromPool = true) - { - return !isFromPool? new ObjectGetRequest() : ObjectPool.Instance.Fetch(typeof(ObjectGetRequest)) as ObjectGetRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Type { get; set; } - - [MemoryPackOrder(2)] - public long Key { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Type = default; - this.Key = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectGetResponse)] - [MemoryPackable] - public partial class ObjectGetResponse: MessageObject, IActorResponse - { - public static ObjectGetResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectGetResponse() : ObjectPool.Instance.Fetch(typeof(ObjectGetResponse)) as ObjectGetResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public int Type { get; set; } - - [MemoryPackOrder(4)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Type = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2R_GetLoginKey))] - [Message(InnerMessage.R2G_GetLoginKey)] - [MemoryPackable] - public partial class R2G_GetLoginKey: MessageObject, IActorRequest - { - public static R2G_GetLoginKey Create(bool isFromPool = true) - { - return !isFromPool? new R2G_GetLoginKey() : ObjectPool.Instance.Fetch(typeof(R2G_GetLoginKey)) as R2G_GetLoginKey; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2R_GetLoginKey)] - [MemoryPackable] - public partial class G2R_GetLoginKey: MessageObject, IActorResponse - { - public static G2R_GetLoginKey Create(bool isFromPool = true) - { - return !isFromPool? new G2R_GetLoginKey() : ObjectPool.Instance.Fetch(typeof(G2R_GetLoginKey)) as G2R_GetLoginKey; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long Key { get; set; } - - [MemoryPackOrder(4)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.G2M_SessionDisconnect)] - [MemoryPackable] - public partial class G2M_SessionDisconnect: MessageObject, IActorLocationMessage - { - public static G2M_SessionDisconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2M_SessionDisconnect() : ObjectPool.Instance.Fetch(typeof(G2M_SessionDisconnect)) as G2M_SessionDisconnect; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.ObjectQueryResponse)] - [MemoryPackable] - public partial class ObjectQueryResponse: MessageObject, IActorResponse - { - public static ObjectQueryResponse Create(bool isFromPool = true) - { - return !isFromPool? new ObjectQueryResponse() : ObjectPool.Instance.Fetch(typeof(ObjectQueryResponse)) as ObjectQueryResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public byte[] Entity { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Entity = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2M_UnitTransferResponse))] - [Message(InnerMessage.M2M_UnitTransferRequest)] - [MemoryPackable] - public partial class M2M_UnitTransferRequest: MessageObject, IActorRequest - { - public static M2M_UnitTransferRequest Create(bool isFromPool = true) - { - return !isFromPool? new M2M_UnitTransferRequest() : ObjectPool.Instance.Fetch(typeof(M2M_UnitTransferRequest)) as M2M_UnitTransferRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public ActorId OldActorId { get; set; } - - [MemoryPackOrder(2)] - public byte[] Unit { get; set; } - - [MemoryPackOrder(3)] - public List Entitys { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.OldActorId = default; - this.Unit = default; - this.Entitys.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(InnerMessage.M2M_UnitTransferResponse)] - [MemoryPackable] - public partial class M2M_UnitTransferResponse: MessageObject, IActorResponse - { - public static M2M_UnitTransferResponse Create(bool isFromPool = true) - { - return !isFromPool? new M2M_UnitTransferResponse() : ObjectPool.Instance.Fetch(typeof(M2M_UnitTransferResponse)) as M2M_UnitTransferResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class InnerMessage - { - public const ushort ObjectQueryRequest = 20002; - public const ushort M2A_Reload = 20003; - public const ushort A2M_Reload = 20004; - public const ushort G2G_LockRequest = 20005; - public const ushort G2G_LockResponse = 20006; - public const ushort G2G_LockReleaseRequest = 20007; - public const ushort G2G_LockReleaseResponse = 20008; - public const ushort ObjectAddRequest = 20009; - public const ushort ObjectAddResponse = 20010; - public const ushort ObjectLockRequest = 20011; - public const ushort ObjectLockResponse = 20012; - public const ushort ObjectUnLockRequest = 20013; - public const ushort ObjectUnLockResponse = 20014; - public const ushort ObjectRemoveRequest = 20015; - public const ushort ObjectRemoveResponse = 20016; - public const ushort ObjectGetRequest = 20017; - public const ushort ObjectGetResponse = 20018; - public const ushort R2G_GetLoginKey = 20019; - public const ushort G2R_GetLoginKey = 20020; - public const ushort G2M_SessionDisconnect = 20021; - public const ushort ObjectQueryResponse = 20022; - public const ushort M2M_UnitTransferRequest = 20023; - public const ushort M2M_UnitTransferResponse = 20024; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/InnerMessage_S_20001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/InnerMessage_S_20001.cs.meta deleted file mode 100644 index c35b4a17..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/InnerMessage_S_20001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 77ca20f99751331479808fb220803c31 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepInner_S_21001.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepInner_S_21001.cs deleted file mode 100644 index c4b6943c..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepInner_S_21001.cs +++ /dev/null @@ -1,263 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ -// 请求匹配 - [ResponseType(nameof(Match2G_Match))] - [Message(LockStepInner.G2Match_Match)] - [MemoryPackable] - public partial class G2Match_Match: MessageObject, IActorRequest - { - public static G2Match_Match Create(bool isFromPool = true) - { - return !isFromPool? new G2Match_Match() : ObjectPool.Instance.Fetch(typeof(G2Match_Match)) as G2Match_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Id = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Match2G_Match)] - [MemoryPackable] - public partial class Match2G_Match: MessageObject, IActorResponse - { - public static Match2G_Match Create(bool isFromPool = true) - { - return !isFromPool? new Match2G_Match() : ObjectPool.Instance.Fetch(typeof(Match2G_Match)) as Match2G_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Map2Match_GetRoom))] - [Message(LockStepInner.Match2Map_GetRoom)] - [MemoryPackable] - public partial class Match2Map_GetRoom: MessageObject, IActorRequest - { - public static Match2Map_GetRoom Create(bool isFromPool = true) - { - return !isFromPool? new Match2Map_GetRoom() : ObjectPool.Instance.Fetch(typeof(Match2Map_GetRoom)) as Match2Map_GetRoom; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public List PlayerIds { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.PlayerIds.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Map2Match_GetRoom)] - [MemoryPackable] - public partial class Map2Match_GetRoom: MessageObject, IActorResponse - { - public static Map2Match_GetRoom Create(bool isFromPool = true) - { - return !isFromPool? new Map2Match_GetRoom() : ObjectPool.Instance.Fetch(typeof(Map2Match_GetRoom)) as Map2Match_GetRoom; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - -// 房间的ActorId - [MemoryPackOrder(3)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Room2G_Reconnect))] - [Message(LockStepInner.G2Room_Reconnect)] - [MemoryPackable] - public partial class G2Room_Reconnect: MessageObject, IActorRequest - { - public static G2Room_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2Room_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2Room_Reconnect)) as G2Room_Reconnect; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Room2G_Reconnect)] - [MemoryPackable] - public partial class Room2G_Reconnect: MessageObject, IActorResponse - { - public static Room2G_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new Room2G_Reconnect() : ObjectPool.Instance.Fetch(typeof(Room2G_Reconnect)) as Room2G_Reconnect; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long StartTime { get; set; } - - [MemoryPackOrder(4)] - public List UnitInfos { get; set; } = new(); - - [MemoryPackOrder(5)] - public int Frame { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.StartTime = default; - this.UnitInfos.Clear(); - this.Frame = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Room2RoomManager_Init))] - [Message(LockStepInner.RoomManager2Room_Init)] - [MemoryPackable] - public partial class RoomManager2Room_Init: MessageObject, IActorRequest - { - public static RoomManager2Room_Init Create(bool isFromPool = true) - { - return !isFromPool? new RoomManager2Room_Init() : ObjectPool.Instance.Fetch(typeof(RoomManager2Room_Init)) as RoomManager2Room_Init; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public List PlayerIds { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.PlayerIds.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepInner.Room2RoomManager_Init)] - [MemoryPackable] - public partial class Room2RoomManager_Init: MessageObject, IActorResponse - { - public static Room2RoomManager_Init Create(bool isFromPool = true) - { - return !isFromPool? new Room2RoomManager_Init() : ObjectPool.Instance.Fetch(typeof(Room2RoomManager_Init)) as Room2RoomManager_Init; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class LockStepInner - { - public const ushort G2Match_Match = 21002; - public const ushort Match2G_Match = 21003; - public const ushort Match2Map_GetRoom = 21004; - public const ushort Map2Match_GetRoom = 21005; - public const ushort G2Room_Reconnect = 21006; - public const ushort Room2G_Reconnect = 21007; - public const ushort RoomManager2Room_Init = 21008; - public const ushort Room2RoomManager_Init = 21009; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepInner_S_21001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepInner_S_21001.cs.meta deleted file mode 100644 index 0f307b28..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepInner_S_21001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f5da6702a31064c42833a7f9147016ce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepOuter_C_11001.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepOuter_C_11001.cs deleted file mode 100644 index e2f43d39..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepOuter_C_11001.cs +++ /dev/null @@ -1,342 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ - [ResponseType(nameof(G2C_Match))] - [Message(LockStepOuter.C2G_Match)] - [MemoryPackable] - public partial class C2G_Match: MessageObject, IRequest - { - public static C2G_Match Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Match() : ObjectPool.Instance.Fetch(typeof(C2G_Match)) as C2G_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.G2C_Match)] - [MemoryPackable] - public partial class G2C_Match: MessageObject, IResponse - { - public static G2C_Match Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Match() : ObjectPool.Instance.Fetch(typeof(G2C_Match)) as G2C_Match; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 匹配成功,通知客户端切换场景 - [Message(LockStepOuter.Match2G_NotifyMatchSuccess)] - [MemoryPackable] - public partial class Match2G_NotifyMatchSuccess: MessageObject, IActorMessage - { - public static Match2G_NotifyMatchSuccess Create(bool isFromPool = true) - { - return !isFromPool? new Match2G_NotifyMatchSuccess() : ObjectPool.Instance.Fetch(typeof(Match2G_NotifyMatchSuccess)) as Match2G_NotifyMatchSuccess; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - -// 房间的ActorId - [MemoryPackOrder(1)] - public ActorId ActorId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 客户端通知房间切换场景完成 - [Message(LockStepOuter.C2Room_ChangeSceneFinish)] - [MemoryPackable] - public partial class C2Room_ChangeSceneFinish: MessageObject, IActorRoom - { - public static C2Room_ChangeSceneFinish Create(bool isFromPool = true) - { - return !isFromPool? new C2Room_ChangeSceneFinish() : ObjectPool.Instance.Fetch(typeof(C2Room_ChangeSceneFinish)) as C2Room_ChangeSceneFinish; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.LockStepUnitInfo)] - [MemoryPackable] - public partial class LockStepUnitInfo: MessageObject - { - public static LockStepUnitInfo Create(bool isFromPool = true) - { - return !isFromPool? new LockStepUnitInfo() : ObjectPool.Instance.Fetch(typeof(LockStepUnitInfo)) as LockStepUnitInfo; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - [MemoryPackOrder(1)] - public TrueSync.TSVector Position { get; set; } - - [MemoryPackOrder(2)] - public TrueSync.TSQuaternion Rotation { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - this.Position = default; - this.Rotation = default; - - ObjectPool.Instance.Recycle(this); - } - - } - -// 房间通知客户端进入战斗 - [Message(LockStepOuter.Room2C_Start)] - [MemoryPackable] - public partial class Room2C_Start: MessageObject, IActorMessage - { - public static Room2C_Start Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_Start() : ObjectPool.Instance.Fetch(typeof(Room2C_Start)) as Room2C_Start; - } - - [MemoryPackOrder(0)] - public long StartTime { get; set; } - - [MemoryPackOrder(1)] - public List UnitInfo { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.StartTime = default; - this.UnitInfo.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.FrameMessage)] - [MemoryPackable] - public partial class FrameMessage: MessageObject, IActorMessage - { - public static FrameMessage Create(bool isFromPool = true) - { - return !isFromPool? new FrameMessage() : ObjectPool.Instance.Fetch(typeof(FrameMessage)) as FrameMessage; - } - - [MemoryPackOrder(0)] - public int Frame { get; set; } - - [MemoryPackOrder(1)] - public long PlayerId { get; set; } - - [MemoryPackOrder(2)] - public LSInput Input { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Frame = default; - this.PlayerId = default; - this.Input = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.OneFrameInputs)] - [MemoryPackable] - public partial class OneFrameInputs: MessageObject, IActorMessage - { - public static OneFrameInputs Create(bool isFromPool = true) - { - return !isFromPool? new OneFrameInputs() : ObjectPool.Instance.Fetch(typeof(OneFrameInputs)) as OneFrameInputs; - } - - [MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)] - [MemoryPackOrder(1)] - public Dictionary Inputs { get; set; } = new(); - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Inputs.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.Room2C_AdjustUpdateTime)] - [MemoryPackable] - public partial class Room2C_AdjustUpdateTime: MessageObject, IActorMessage - { - public static Room2C_AdjustUpdateTime Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_AdjustUpdateTime() : ObjectPool.Instance.Fetch(typeof(Room2C_AdjustUpdateTime)) as Room2C_AdjustUpdateTime; - } - - [MemoryPackOrder(0)] - public int DiffTime { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.DiffTime = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.C2Room_CheckHash)] - [MemoryPackable] - public partial class C2Room_CheckHash: MessageObject, IActorRoom - { - public static C2Room_CheckHash Create(bool isFromPool = true) - { - return !isFromPool? new C2Room_CheckHash() : ObjectPool.Instance.Fetch(typeof(C2Room_CheckHash)) as C2Room_CheckHash; - } - - [MemoryPackOrder(0)] - public long PlayerId { get; set; } - - [MemoryPackOrder(1)] - public int Frame { get; set; } - - [MemoryPackOrder(2)] - public long Hash { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.PlayerId = default; - this.Frame = default; - this.Hash = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.Room2C_CheckHashFail)] - [MemoryPackable] - public partial class Room2C_CheckHashFail: MessageObject, IActorMessage - { - public static Room2C_CheckHashFail Create(bool isFromPool = true) - { - return !isFromPool? new Room2C_CheckHashFail() : ObjectPool.Instance.Fetch(typeof(Room2C_CheckHashFail)) as Room2C_CheckHashFail; - } - - [MemoryPackOrder(0)] - public int Frame { get; set; } - - [MemoryPackOrder(1)] - public byte[] LSWorldBytes { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Frame = default; - this.LSWorldBytes = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(LockStepOuter.G2C_Reconnect)] - [MemoryPackable] - public partial class G2C_Reconnect: MessageObject, IActorMessage - { - public static G2C_Reconnect Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2C_Reconnect)) as G2C_Reconnect; - } - - [MemoryPackOrder(0)] - public long StartTime { get; set; } - - [MemoryPackOrder(1)] - public List UnitInfos { get; set; } = new(); - - [MemoryPackOrder(2)] - public int Frame { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.StartTime = default; - this.UnitInfos.Clear(); - this.Frame = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class LockStepOuter - { - public const ushort C2G_Match = 11002; - public const ushort G2C_Match = 11003; - public const ushort Match2G_NotifyMatchSuccess = 11004; - public const ushort C2Room_ChangeSceneFinish = 11005; - public const ushort LockStepUnitInfo = 11006; - public const ushort Room2C_Start = 11007; - public const ushort FrameMessage = 11008; - public const ushort OneFrameInputs = 11009; - public const ushort Room2C_AdjustUpdateTime = 11010; - public const ushort C2Room_CheckHash = 11011; - public const ushort Room2C_CheckHashFail = 11012; - public const ushort G2C_Reconnect = 11013; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepOuter_C_11001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepOuter_C_11001.cs.meta deleted file mode 100644 index 1c1ac327..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/LockStepOuter_C_11001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 8fdb6d43fedc543daa3824a136bf364f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/OuterMessage_C_10001.cs b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/OuterMessage_C_10001.cs deleted file mode 100644 index fe702046..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/OuterMessage_C_10001.cs +++ /dev/null @@ -1,1068 +0,0 @@ -using ET; -using MemoryPack; -using System.Collections.Generic; -namespace ET -{ - [Message(OuterMessage.HttpGetRouterResponse)] - [MemoryPackable] - public partial class HttpGetRouterResponse: MessageObject - { - public static HttpGetRouterResponse Create(bool isFromPool = true) - { - return !isFromPool? new HttpGetRouterResponse() : ObjectPool.Instance.Fetch(typeof(HttpGetRouterResponse)) as HttpGetRouterResponse; - } - - [MemoryPackOrder(0)] - public List Realms { get; set; } = new(); - - [MemoryPackOrder(1)] - public List Routers { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Realms.Clear(); - this.Routers.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.RouterSync)] - [MemoryPackable] - public partial class RouterSync: MessageObject - { - public static RouterSync Create(bool isFromPool = true) - { - return !isFromPool? new RouterSync() : ObjectPool.Instance.Fetch(typeof(RouterSync)) as RouterSync; - } - - [MemoryPackOrder(0)] - public uint ConnectId { get; set; } - - [MemoryPackOrder(1)] - public string Address { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.ConnectId = default; - this.Address = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TestResponse))] - [Message(OuterMessage.C2M_TestRequest)] - [MemoryPackable] - public partial class C2M_TestRequest: MessageObject, IActorLocationRequest - { - public static C2M_TestRequest Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRequest() : ObjectPool.Instance.Fetch(typeof(C2M_TestRequest)) as C2M_TestRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string request { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.request = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestResponse)] - [MemoryPackable] - public partial class M2C_TestResponse: MessageObject, IActorResponse - { - public static M2C_TestResponse Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestResponse() : ObjectPool.Instance.Fetch(typeof(M2C_TestResponse)) as M2C_TestResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public string response { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.response = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(Actor_TransferResponse))] - [Message(OuterMessage.Actor_TransferRequest)] - [MemoryPackable] - public partial class Actor_TransferRequest: MessageObject, IActorLocationRequest - { - public static Actor_TransferRequest Create(bool isFromPool = true) - { - return !isFromPool? new Actor_TransferRequest() : ObjectPool.Instance.Fetch(typeof(Actor_TransferRequest)) as Actor_TransferRequest; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int MapIndex { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.MapIndex = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.Actor_TransferResponse)] - [MemoryPackable] - public partial class Actor_TransferResponse: MessageObject, IActorLocationResponse - { - public static Actor_TransferResponse Create(bool isFromPool = true) - { - return !isFromPool? new Actor_TransferResponse() : ObjectPool.Instance.Fetch(typeof(Actor_TransferResponse)) as Actor_TransferResponse; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_EnterMap))] - [Message(OuterMessage.C2G_EnterMap)] - [MemoryPackable] - public partial class C2G_EnterMap: MessageObject, IRequest - { - public static C2G_EnterMap Create(bool isFromPool = true) - { - return !isFromPool? new C2G_EnterMap() : ObjectPool.Instance.Fetch(typeof(C2G_EnterMap)) as C2G_EnterMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_EnterMap)] - [MemoryPackable] - public partial class G2C_EnterMap: MessageObject, IResponse - { - public static G2C_EnterMap Create(bool isFromPool = true) - { - return !isFromPool? new G2C_EnterMap() : ObjectPool.Instance.Fetch(typeof(G2C_EnterMap)) as G2C_EnterMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - -// 自己unitId - [MemoryPackOrder(3)] - public long MyId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.MyId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.MoveInfo)] - [MemoryPackable] - public partial class MoveInfo: MessageObject - { - public static MoveInfo Create(bool isFromPool = true) - { - return !isFromPool? new MoveInfo() : ObjectPool.Instance.Fetch(typeof(MoveInfo)) as MoveInfo; - } - - [MemoryPackOrder(0)] - public List Points { get; set; } = new(); - - [MemoryPackOrder(1)] - public Unity.Mathematics.quaternion Rotation { get; set; } - - [MemoryPackOrder(2)] - public int TurnSpeed { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Points.Clear(); - this.Rotation = default; - this.TurnSpeed = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.UnitInfo)] - [MemoryPackable] - public partial class UnitInfo: MessageObject - { - public static UnitInfo Create(bool isFromPool = true) - { - return !isFromPool? new UnitInfo() : ObjectPool.Instance.Fetch(typeof(UnitInfo)) as UnitInfo; - } - - [MemoryPackOrder(0)] - public long UnitId { get; set; } - - [MemoryPackOrder(1)] - public int ConfigId { get; set; } - - [MemoryPackOrder(2)] - public int Type { get; set; } - - [MemoryPackOrder(3)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(4)] - public Unity.Mathematics.float3 Forward { get; set; } - - [MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)] - [MemoryPackOrder(5)] - public Dictionary KV { get; set; } = new(); - [MemoryPackOrder(6)] - public MoveInfo MoveInfo { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.UnitId = default; - this.ConfigId = default; - this.Type = default; - this.Position = default; - this.Forward = default; - this.KV.Clear(); - this.MoveInfo = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_CreateUnits)] - [MemoryPackable] - public partial class M2C_CreateUnits: MessageObject, IActorMessage - { - public static M2C_CreateUnits Create(bool isFromPool = true) - { - return !isFromPool? new M2C_CreateUnits() : ObjectPool.Instance.Fetch(typeof(M2C_CreateUnits)) as M2C_CreateUnits; - } - - [MemoryPackOrder(0)] - public List Units { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Units.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_CreateMyUnit)] - [MemoryPackable] - public partial class M2C_CreateMyUnit: MessageObject, IActorMessage - { - public static M2C_CreateMyUnit Create(bool isFromPool = true) - { - return !isFromPool? new M2C_CreateMyUnit() : ObjectPool.Instance.Fetch(typeof(M2C_CreateMyUnit)) as M2C_CreateMyUnit; - } - - [MemoryPackOrder(0)] - public UnitInfo Unit { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Unit = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_StartSceneChange)] - [MemoryPackable] - public partial class M2C_StartSceneChange: MessageObject, IActorMessage - { - public static M2C_StartSceneChange Create(bool isFromPool = true) - { - return !isFromPool? new M2C_StartSceneChange() : ObjectPool.Instance.Fetch(typeof(M2C_StartSceneChange)) as M2C_StartSceneChange; - } - - [MemoryPackOrder(0)] - public long SceneInstanceId { get; set; } - - [MemoryPackOrder(1)] - public string SceneName { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.SceneInstanceId = default; - this.SceneName = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_RemoveUnits)] - [MemoryPackable] - public partial class M2C_RemoveUnits: MessageObject, IActorMessage - { - public static M2C_RemoveUnits Create(bool isFromPool = true) - { - return !isFromPool? new M2C_RemoveUnits() : ObjectPool.Instance.Fetch(typeof(M2C_RemoveUnits)) as M2C_RemoveUnits; - } - - [MemoryPackOrder(0)] - public List Units { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Units.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_PathfindingResult)] - [MemoryPackable] - public partial class C2M_PathfindingResult: MessageObject, IActorLocationMessage - { - public static C2M_PathfindingResult Create(bool isFromPool = true) - { - return !isFromPool? new C2M_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(C2M_PathfindingResult)) as C2M_PathfindingResult; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public Unity.Mathematics.float3 Position { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Position = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_Stop)] - [MemoryPackable] - public partial class C2M_Stop: MessageObject, IActorLocationMessage - { - public static C2M_Stop Create(bool isFromPool = true) - { - return !isFromPool? new C2M_Stop() : ObjectPool.Instance.Fetch(typeof(C2M_Stop)) as C2M_Stop; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_PathfindingResult)] - [MemoryPackable] - public partial class M2C_PathfindingResult: MessageObject, IActorMessage - { - public static M2C_PathfindingResult Create(bool isFromPool = true) - { - return !isFromPool? new M2C_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(M2C_PathfindingResult)) as M2C_PathfindingResult; - } - - [MemoryPackOrder(0)] - public long Id { get; set; } - - [MemoryPackOrder(1)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(2)] - public List Points { get; set; } = new(); - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Id = default; - this.Position = default; - this.Points.Clear(); - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_Stop)] - [MemoryPackable] - public partial class M2C_Stop: MessageObject, IActorMessage - { - public static M2C_Stop Create(bool isFromPool = true) - { - return !isFromPool? new M2C_Stop() : ObjectPool.Instance.Fetch(typeof(M2C_Stop)) as M2C_Stop; - } - - [MemoryPackOrder(0)] - public int Error { get; set; } - - [MemoryPackOrder(1)] - public long Id { get; set; } - - [MemoryPackOrder(2)] - public Unity.Mathematics.float3 Position { get; set; } - - [MemoryPackOrder(3)] - public Unity.Mathematics.quaternion Rotation { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Error = default; - this.Id = default; - this.Position = default; - this.Rotation = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_Ping))] - [Message(OuterMessage.C2G_Ping)] - [MemoryPackable] - public partial class C2G_Ping: MessageObject, IRequest - { - public static C2G_Ping Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Ping() : ObjectPool.Instance.Fetch(typeof(C2G_Ping)) as C2G_Ping; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Ping)] - [MemoryPackable] - public partial class G2C_Ping: MessageObject, IResponse - { - public static G2C_Ping Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Ping() : ObjectPool.Instance.Fetch(typeof(G2C_Ping)) as G2C_Ping; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long Time { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Time = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Test)] - [MemoryPackable] - public partial class G2C_Test: MessageObject, IMessage - { - public static G2C_Test Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Test() : ObjectPool.Instance.Fetch(typeof(G2C_Test)) as G2C_Test; - } - - public override void Dispose() - { - if (!this.IsFromPool) return; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_Reload))] - [Message(OuterMessage.C2M_Reload)] - [MemoryPackable] - public partial class C2M_Reload: MessageObject, IRequest - { - public static C2M_Reload Create(bool isFromPool = true) - { - return !isFromPool? new C2M_Reload() : ObjectPool.Instance.Fetch(typeof(C2M_Reload)) as C2M_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_Reload)] - [MemoryPackable] - public partial class M2C_Reload: MessageObject, IResponse - { - public static M2C_Reload Create(bool isFromPool = true) - { - return !isFromPool? new M2C_Reload() : ObjectPool.Instance.Fetch(typeof(M2C_Reload)) as M2C_Reload; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(R2C_Login))] - [Message(OuterMessage.C2R_Login)] - [MemoryPackable] - public partial class C2R_Login: MessageObject, IRequest - { - public static C2R_Login Create(bool isFromPool = true) - { - return !isFromPool? new C2R_Login() : ObjectPool.Instance.Fetch(typeof(C2R_Login)) as C2R_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public string Account { get; set; } - - [MemoryPackOrder(2)] - public string Password { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Account = default; - this.Password = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.R2C_Login)] - [MemoryPackable] - public partial class R2C_Login: MessageObject, IResponse - { - public static R2C_Login Create(bool isFromPool = true) - { - return !isFromPool? new R2C_Login() : ObjectPool.Instance.Fetch(typeof(R2C_Login)) as R2C_Login; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public string Address { get; set; } - - [MemoryPackOrder(4)] - public long Key { get; set; } - - [MemoryPackOrder(5)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.Address = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_LoginGate))] - [Message(OuterMessage.C2G_LoginGate)] - [MemoryPackable] - public partial class C2G_LoginGate: MessageObject, IRequest - { - public static C2G_LoginGate Create(bool isFromPool = true) - { - return !isFromPool? new C2G_LoginGate() : ObjectPool.Instance.Fetch(typeof(C2G_LoginGate)) as C2G_LoginGate; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public long Key { get; set; } - - [MemoryPackOrder(2)] - public long GateId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Key = default; - this.GateId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_LoginGate)] - [MemoryPackable] - public partial class G2C_LoginGate: MessageObject, IResponse - { - public static G2C_LoginGate Create(bool isFromPool = true) - { - return !isFromPool? new G2C_LoginGate() : ObjectPool.Instance.Fetch(typeof(G2C_LoginGate)) as G2C_LoginGate; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public long PlayerId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.PlayerId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_TestHotfixMessage)] - [MemoryPackable] - public partial class G2C_TestHotfixMessage: MessageObject, IMessage - { - public static G2C_TestHotfixMessage Create(bool isFromPool = true) - { - return !isFromPool? new G2C_TestHotfixMessage() : ObjectPool.Instance.Fetch(typeof(G2C_TestHotfixMessage)) as G2C_TestHotfixMessage; - } - - [MemoryPackOrder(0)] - public string Info { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.Info = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TestRobotCase))] - [Message(OuterMessage.C2M_TestRobotCase)] - [MemoryPackable] - public partial class C2M_TestRobotCase: MessageObject, IActorLocationRequest - { - public static C2M_TestRobotCase Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase)) as C2M_TestRobotCase; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestRobotCase)] - [MemoryPackable] - public partial class M2C_TestRobotCase: MessageObject, IActorLocationResponse - { - public static M2C_TestRobotCase Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase)) as M2C_TestRobotCase; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - [MemoryPackOrder(3)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.C2M_TestRobotCase2)] - [MemoryPackable] - public partial class C2M_TestRobotCase2: MessageObject, IActorLocationMessage - { - public static C2M_TestRobotCase2 Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase2)) as C2M_TestRobotCase2; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TestRobotCase2)] - [MemoryPackable] - public partial class M2C_TestRobotCase2: MessageObject, IActorLocationMessage - { - public static M2C_TestRobotCase2 Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase2)) as M2C_TestRobotCase2; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int N { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.N = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(M2C_TransferMap))] - [Message(OuterMessage.C2M_TransferMap)] - [MemoryPackable] - public partial class C2M_TransferMap: MessageObject, IActorLocationRequest - { - public static C2M_TransferMap Create(bool isFromPool = true) - { - return !isFromPool? new C2M_TransferMap() : ObjectPool.Instance.Fetch(typeof(C2M_TransferMap)) as C2M_TransferMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.M2C_TransferMap)] - [MemoryPackable] - public partial class M2C_TransferMap: MessageObject, IActorLocationResponse - { - public static M2C_TransferMap Create(bool isFromPool = true) - { - return !isFromPool? new M2C_TransferMap() : ObjectPool.Instance.Fetch(typeof(M2C_TransferMap)) as M2C_TransferMap; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [ResponseType(nameof(G2C_Benchmark))] - [Message(OuterMessage.C2G_Benchmark)] - [MemoryPackable] - public partial class C2G_Benchmark: MessageObject, IRequest - { - public static C2G_Benchmark Create(bool isFromPool = true) - { - return !isFromPool? new C2G_Benchmark() : ObjectPool.Instance.Fetch(typeof(C2G_Benchmark)) as C2G_Benchmark; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - [Message(OuterMessage.G2C_Benchmark)] - [MemoryPackable] - public partial class G2C_Benchmark: MessageObject, IResponse - { - public static G2C_Benchmark Create(bool isFromPool = true) - { - return !isFromPool? new G2C_Benchmark() : ObjectPool.Instance.Fetch(typeof(G2C_Benchmark)) as G2C_Benchmark; - } - - [MemoryPackOrder(0)] - public int RpcId { get; set; } - - [MemoryPackOrder(1)] - public int Error { get; set; } - - [MemoryPackOrder(2)] - public string Message { get; set; } - - public override void Dispose() - { - if (!this.IsFromPool) return; - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - } - - public static class OuterMessage - { - public const ushort HttpGetRouterResponse = 10002; - public const ushort RouterSync = 10003; - public const ushort C2M_TestRequest = 10004; - public const ushort M2C_TestResponse = 10005; - public const ushort Actor_TransferRequest = 10006; - public const ushort Actor_TransferResponse = 10007; - public const ushort C2G_EnterMap = 10008; - public const ushort G2C_EnterMap = 10009; - public const ushort MoveInfo = 10010; - public const ushort UnitInfo = 10011; - public const ushort M2C_CreateUnits = 10012; - public const ushort M2C_CreateMyUnit = 10013; - public const ushort M2C_StartSceneChange = 10014; - public const ushort M2C_RemoveUnits = 10015; - public const ushort C2M_PathfindingResult = 10016; - public const ushort C2M_Stop = 10017; - public const ushort M2C_PathfindingResult = 10018; - public const ushort M2C_Stop = 10019; - public const ushort C2G_Ping = 10020; - public const ushort G2C_Ping = 10021; - public const ushort G2C_Test = 10022; - public const ushort C2M_Reload = 10023; - public const ushort M2C_Reload = 10024; - public const ushort C2R_Login = 10025; - public const ushort R2C_Login = 10026; - public const ushort C2G_LoginGate = 10027; - public const ushort G2C_LoginGate = 10028; - public const ushort G2C_TestHotfixMessage = 10029; - public const ushort C2M_TestRobotCase = 10030; - public const ushort M2C_TestRobotCase = 10031; - public const ushort C2M_TestRobotCase2 = 10032; - public const ushort M2C_TestRobotCase2 = 10033; - public const ushort C2M_TransferMap = 10034; - public const ushort M2C_TransferMap = 10035; - public const ushort C2G_Benchmark = 10036; - public const ushort G2C_Benchmark = 10037; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/OuterMessage_C_10001.cs.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Message/OuterMessage_C_10001.cs.meta deleted file mode 100644 index 1840eb68..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Message/OuterMessage_C_10001.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c0d2c0be69c996a4488513ae7ade42f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Unity.GenerateServer.asmdef b/Assets/GameScripts/DotNet/Model/Generate/Server/Unity.GenerateServer.asmdef deleted file mode 100644 index bd2e0e56..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Unity.GenerateServer.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Unity.GenerateServer", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [ - "IGNORE" - ], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Generate/Server/Unity.GenerateServer.asmdef.meta b/Assets/GameScripts/DotNet/Model/Generate/Server/Unity.GenerateServer.asmdef.meta deleted file mode 100644 index 2c1953df..00000000 --- a/Assets/GameScripts/DotNet/Model/Generate/Server/Unity.GenerateServer.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 7142a78e1dbb1f341a7d3920552f7699 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server.meta b/Assets/GameScripts/DotNet/Model/Server.meta deleted file mode 100644 index 3f955e1a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 80ca7b39eee27b6469d966bf15636111 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo.meta b/Assets/GameScripts/DotNet/Model/Server/Demo.meta deleted file mode 100644 index 67621cc7..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5ee927a146d81a54bb25900fd6369ae7 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark.meta deleted file mode 100644 index fd96a1d8..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8bb8d5a886dd1414681f7574206daa45 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkClientComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkClientComponent.cs deleted file mode 100644 index 3d9b47fe..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkClientComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class BenchmarkClientComponent: Entity, IAwake - { - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkClientComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkClientComponent.cs.meta deleted file mode 100644 index 82737e32..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkClientComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c68c60b0718e272488136d3e3e0672ec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkServerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkServerComponent.cs deleted file mode 100644 index 9c2c7b91..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkServerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class BenchmarkServerComponent: Entity, IAwake - { - public int Count { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkServerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkServerComponent.cs.meta deleted file mode 100644 index 20a87fec..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Benchmark/BenchmarkServerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: adb7fe671c497d6478e3ed62cbee9fe3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate.meta deleted file mode 100644 index af86dc78..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 06f629321c0b3d44b9e0606d2b5f5303 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateMapComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateMapComponent.cs deleted file mode 100644 index ccb8dd4c..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateMapComponent.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Player))] - public class GateMapComponent: Entity, IAwake - { - private EntityRef scene; - - public Scene Scene - { - get - { - return this.scene; - } - set - { - this.scene = value; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateMapComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateMapComponent.cs.meta deleted file mode 100644 index 63b23786..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateMapComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d6e8828a2661073409b89add293b3508 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateSessionKeyComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateSessionKeyComponent.cs deleted file mode 100644 index eacbd3f4..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateSessionKeyComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class GateSessionKeyComponent : Entity, IAwake - { - public readonly Dictionary sessionKey = new(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateSessionKeyComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateSessionKeyComponent.cs.meta deleted file mode 100644 index 95d74e3b..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/GateSessionKeyComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0c4855591c919784c9e72d7ab5414b21 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/Player.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/Player.cs deleted file mode 100644 index d33cb63d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/Player.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - [ChildOf(typeof(PlayerComponent))] - public sealed class Player : Entity, IAwake - { - public string Account { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/Player.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/Player.cs.meta deleted file mode 100644 index 84ad32ee..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/Player.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 98e58bdf33de9a645ab818ae062dca38 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerComponent.cs deleted file mode 100644 index 779a740a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class PlayerComponent : Entity, IAwake, IDestroy - { - public Dictionary dictionary = new Dictionary(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerComponent.cs.meta deleted file mode 100644 index 3441fd16..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 639fcaa2e756a964a9556cadc1c5cb5f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerSessionComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerSessionComponent.cs deleted file mode 100644 index 375f69ba..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerSessionComponent.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Player))] - public class PlayerSessionComponent : Entity, IAwake - { - private EntityRef session; - - public Session Session - { - get - { - return this.session; - } - set - { - this.session = value; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerSessionComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerSessionComponent.cs.meta deleted file mode 100644 index e9c765fb..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/PlayerSessionComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 237648d5968a24ebb885807879f8382d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/SessionPlayerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/SessionPlayerComponent.cs deleted file mode 100644 index c57f8313..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/SessionPlayerComponent.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Session))] - public class SessionPlayerComponent : Entity, IAwake, IDestroy - { - private EntityRef player; - - public Player Player - { - get - { - return this.player; - } - set - { - this.player = value; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/SessionPlayerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/SessionPlayerComponent.cs.meta deleted file mode 100644 index 67f8d126..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Gate/SessionPlayerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: edd141e260773de498ca22f7b9ff072a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Map.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Map.meta deleted file mode 100644 index 67845436..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Map.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a5a2e1e003bdaf4499b66b5d7466a998 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Map/Recast.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Map/Recast.meta deleted file mode 100644 index 9dcb4a4b..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Map/Recast.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 74ee26df1c91d9d4caac1d4e1c104b90 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot.meta deleted file mode 100644 index 8027fe90..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 82470970474f53a4a909d6229304bf1f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case.meta deleted file mode 100644 index 3c75d499..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e2a25a771a90c4a8680f28e4f53a36a4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case/RobotCase_SecondCase.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case/RobotCase_SecondCase.cs deleted file mode 100644 index d9a1eeef..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case/RobotCase_SecondCase.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ET -{ - public struct RobotCase_SecondCaseWait: IWaitType - { - public int Error { get; set; } - - public M2C_TestRobotCase2 M2CTestRobotCase2; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case/RobotCase_SecondCase.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case/RobotCase_SecondCase.cs.meta deleted file mode 100644 index 1cc2248d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Case/RobotCase_SecondCase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ba892700102f7430f8c84b01c85721fc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console.meta deleted file mode 100644 index 3e37105c..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e455bcec0e656e846a5de3abb1dee497 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console/CreateRobotArgs.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console/CreateRobotArgs.cs deleted file mode 100644 index 36a90cb4..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console/CreateRobotArgs.cs +++ /dev/null @@ -1,10 +0,0 @@ -using CommandLine; - -namespace ET.Server -{ - public class CreateRobotArgs - { - [Option("Num", Required = false, Default = 1)] - public int Num { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console/CreateRobotArgs.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console/CreateRobotArgs.cs.meta deleted file mode 100644 index 10d07e0f..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/Console/CreateRobotArgs.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2065e116928f06445bd193335b2181b5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotCaseType.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotCaseType.cs deleted file mode 100644 index 08d0c208..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotCaseType.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET.Server -{ - [UniqueId(1, 10000)] - public static class RobotCaseType - { - public const int FirstCase = 1; - - public const int SecondCase = 2; - - public const int MaxCaseType = 10000; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotCaseType.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotCaseType.cs.meta deleted file mode 100644 index e8679fc2..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotCaseType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3715612a321cd8b40b5d217d0294528e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotManagerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotManagerComponent.cs deleted file mode 100644 index e5434bca..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotManagerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class RobotManagerComponent: Entity, IAwake - { - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotManagerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotManagerComponent.cs.meta deleted file mode 100644 index 0cfca5e1..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Robot/RobotManagerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c08dcea223e87cf48ae83e40abfffa7b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher.meta deleted file mode 100644 index 7ec23745..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 886c7abbc951ad14197420f7db46033e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher/WatcherComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher/WatcherComponent.cs deleted file mode 100644 index d112469a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher/WatcherComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class WatcherComponent: Entity, IAwake - { - public readonly Dictionary Processes = new Dictionary(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher/WatcherComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher/WatcherComponent.cs.meta deleted file mode 100644 index ab09dc0d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Demo/Watcher/WatcherComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9b13f7d5a781c9743ae1beb843cde393 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep.meta deleted file mode 100644 index fe89a804..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 78a1c559ee23b4ca2878b8d4710adc3f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate.meta deleted file mode 100644 index c612241f..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4c628457f77814ca1a92b6d757ef4063 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate/PlayerRoomComponent.cs b/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate/PlayerRoomComponent.cs deleted file mode 100644 index b8b3ace4..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate/PlayerRoomComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ET.Server -{ - - [ComponentOf(typeof (Player))] - public class PlayerRoomComponent: Entity, IAwake - { - public ActorId RoomActorId { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate/PlayerRoomComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate/PlayerRoomComponent.cs.meta deleted file mode 100644 index ed141560..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Gate/PlayerRoomComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd88fbf5ce4784f16a2907c22636ef3c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map.meta deleted file mode 100644 index 0ae68bec..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d0f1c516742bc43d586c085b7a26e12d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomManagerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomManagerComponent.cs deleted file mode 100644 index d939bb87..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomManagerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class RoomManagerComponent: Entity, IAwake - { - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomManagerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomManagerComponent.cs.meta deleted file mode 100644 index 72f3cfe3..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomManagerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 48baea120fed34a2492026794df7f64b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomPlayer.cs b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomPlayer.cs deleted file mode 100644 index e53a842d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomPlayer.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ET.Server -{ - - [ChildOf(typeof (RoomServerComponent))] - public class RoomPlayer: Entity, IAwake - { - public int Progress { get; set; } - - public bool IsOnline { get; set; } = true; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomPlayer.cs.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomPlayer.cs.meta deleted file mode 100644 index 167b952a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomPlayer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7cb46c73e983f4acb882077e517f6feb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomServerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomServerComponent.cs deleted file mode 100644 index 4fa1bf99..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomServerComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ComponentOf(typeof(Room))] - public class RoomServerComponent: Entity, IAwake> - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomServerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomServerComponent.cs.meta deleted file mode 100644 index fd8a21a6..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Map/RoomServerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1ab5631e2c7734968b6ac758ce81dd13 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Match.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Match.meta deleted file mode 100644 index bdadaa67..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Match.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d3d85a4b2a3594b9fa6887cc3b574056 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Match/MatchComponent.cs b/Assets/GameScripts/DotNet/Model/Server/LockStep/Match/MatchComponent.cs deleted file mode 100644 index 31a60534..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Match/MatchComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class MatchComponent: Entity, IAwake - { - public List waitMatchPlayers = new List(); - } - -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Match/MatchComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Match/MatchComponent.cs.meta deleted file mode 100644 index 0d84496e..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Match/MatchComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 21a0976ebbc13407da27f69d27ed3976 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Room.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Room.meta deleted file mode 100644 index 0fb6425e..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Room.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 78ca54cc32ca42a9861cd379ff3fc3e8 -timeCreated: 1681817948 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Room/LSServerUpdater.cs b/Assets/GameScripts/DotNet/Model/Server/LockStep/Room/LSServerUpdater.cs deleted file mode 100644 index 12a9e72d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Room/LSServerUpdater.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ComponentOf(typeof(Room))] - public class LSServerUpdater: Entity, IAwake, IUpdate - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/LockStep/Room/LSServerUpdater.cs.meta b/Assets/GameScripts/DotNet/Model/Server/LockStep/Room/LSServerUpdater.cs.meta deleted file mode 100644 index 5fdc50cc..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/LockStep/Room/LSServerUpdater.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f48eaf95cced640e8b7c6adc082dbd07 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module.meta b/Assets/GameScripts/DotNet/Model/Server/Module.meta deleted file mode 100644 index 19cfa7be..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 50b89103390beda43874b94fdde62cbf -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI.meta b/Assets/GameScripts/DotNet/Model/Server/Module/AOI.meta deleted file mode 100644 index 9a527cf1..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 92fbb093186ec1742acdcadde9b344b2 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEntity.cs b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEntity.cs deleted file mode 100644 index 17660883..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEntity.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET.Server -{ - [ComponentOf(typeof(Unit))] - public class AOIEntity: Entity, IAwake, IDestroy - { - public Unit Unit => this.GetParent(); - - public int ViewDistance; - - private EntityRef cell; - - public Cell Cell - { - get - { - return this.cell; - } - set - { - this.cell = value; - } - } - - // 观察进入视野的Cell - public HashSet SubEnterCells = new HashSet(); - - // 观察离开视野的Cell - public HashSet SubLeaveCells = new HashSet(); - - // 观察进入视野的Cell - public HashSet enterHashSet = new HashSet(); - - // 观察离开视野的Cell - public HashSet leaveHashSet = new HashSet(); - - // 我看的见的Unit - public Dictionary SeeUnits = new Dictionary(); - - // 看见我的Unit - public Dictionary BeSeeUnits = new Dictionary(); - - // 我看的见的Player - public Dictionary SeePlayers = new Dictionary(); - - // 看见我的Player单独放一个Dict,用于广播 - public Dictionary BeSeePlayers = new Dictionary(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEntity.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEntity.cs.meta deleted file mode 100644 index ecd1e861..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEntity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 82e4e3a5d5dabb049bf406df3ec3dbd3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEventType.cs b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEventType.cs deleted file mode 100644 index c0e040d8..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEventType.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ET.Server -{ - namespace EventType - { - public struct UnitEnterSightRange - { - public AOIEntity A; - public AOIEntity B; - } - - public struct UnitLeaveSightRange - { - public AOIEntity A; - public AOIEntity B; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEventType.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEventType.cs.meta deleted file mode 100644 index 1bfd3e30..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIEventType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2fb3b7c085835bc45b9bf319fb179f8b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIManagerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIManagerComponent.cs deleted file mode 100644 index 76c8b9f1..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIManagerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class AOIManagerComponent: Entity, IAwake - { - public const int CellSize = 10 * 1000; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIManagerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIManagerComponent.cs.meta deleted file mode 100644 index 64447e41..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/AOIManagerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4ac4abb8f844e8543b742c9eb837c9e0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs deleted file mode 100644 index fbebe248..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ChildOf(typeof(AOIManagerComponent))] - public class Cell: Entity, IAwake, IDestroy - { - // 处在这个cell的单位 - public Dictionary AOIUnits = new Dictionary(); - - // 订阅了这个Cell的进入事件 - public Dictionary SubsEnterEntities = new Dictionary(); - - // 订阅了这个Cell的退出事件 - public Dictionary SubsLeaveEntities = new Dictionary(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs.meta deleted file mode 100644 index 5b4d73da..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5a75cc6d8fbc87d4386d2159f6ac48f2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation.meta b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation.meta deleted file mode 100644 index ef46aa7a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9310265e136b6074cac1754f44280871 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSender.cs b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSender.cs deleted file mode 100644 index ec103836..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSender.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.IO; - -namespace ET.Server -{ - // 知道对方的Id,使用这个类发actor消息 - [ChildOf(typeof(ActorLocationSenderOneType))] - public class ActorLocationSender: Entity, IAwake, IDestroy - { - public ActorId ActorId; - - // 最近接收或者发送消息的时间 - public long LastSendOrRecvTime; - - public int Error; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSender.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSender.cs.meta deleted file mode 100644 index c22b4a94..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSender.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f63a22fae23df55448bebaaa447e1bad -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs deleted file mode 100644 index dce87a5a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - - [ChildOf(typeof(ActorLocationSenderComponent))] - public class ActorLocationSenderOneType: Entity, IAwake, IDestroy - { - public const long TIMEOUT_TIME = 60 * 1000; - - public long CheckTimer; - - public int LocationType; - } - - - [ComponentOf(typeof(Scene))] - public class ActorLocationSenderComponent: Entity, IAwake - { - public const long TIMEOUT_TIME = 60 * 1000; - - public long CheckTimer; - - public ActorLocationSenderOneType[] ActorLocationSenderComponents = new ActorLocationSenderOneType[LocationType.Max]; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs.meta deleted file mode 100644 index a24ccca5..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fe4c532cd914d4ad498b494298be81b6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationComponent.cs deleted file mode 100644 index ab00975e..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationComponent.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [UniqueId(0, 100)] - public static class LocationType - { - public const int Unit = 0; - public const int Player = 1; - public const int Friend = 2; - public const int Chat = 3; - public const int GateSession = 4; - public const int Max = 100; - } - - [ChildOf(typeof(LocationOneType))] - public class LockInfo: Entity, IAwake, IDestroy - { - public ActorId LockActorId; - - public CoroutineLock CoroutineLock - { - get; - set; - } - } - - [ChildOf(typeof(LocationManagerComoponent))] - public class LocationOneType: Entity, IAwake - { - public int LocationType; - - public readonly Dictionary locations = new(); - - public readonly Dictionary lockInfos = new(); - } - - [ComponentOf(typeof(Scene))] - public class LocationManagerComoponent: Entity, IAwake - { - public LocationOneType[] LocationOneTypes = new LocationOneType[LocationType.Max]; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationComponent.cs.meta deleted file mode 100644 index e473ec45..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 15d2e4888958d964399187bc1a29f0ec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationProxyComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationProxyComponent.cs deleted file mode 100644 index eb2cee22..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationProxyComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class LocationProxyComponent: Entity, IAwake - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationProxyComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationProxyComponent.cs.meta deleted file mode 100644 index bcbf7ec3..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/ActorLocation/LocationProxyComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 33a386a4a4fc3a1428c59a2e07be246c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB.meta b/Assets/GameScripts/DotNet/Model/Server/Module/DB.meta deleted file mode 100644 index ded93f1c..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ce1b81735cfec4948a4652f0ac14d0ff -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBComponent.cs deleted file mode 100644 index 76877b88..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBComponent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using MongoDB.Driver; - -namespace ET.Server -{ - /// - /// 用来缓存数据 - /// - [ChildOf(typeof(DBManagerComponent))] - public class DBComponent: Entity, IAwake - { - public const int TaskCount = 32; - - public MongoClient mongoClient; - public IMongoDatabase database; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBComponent.cs.meta deleted file mode 100644 index 13ae18d0..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: aedf41755039b6542a26efbcd0b14745 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBManagerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBManagerComponent.cs deleted file mode 100644 index 1c8d7d85..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBManagerComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class DBManagerComponent: Entity, IAwake - { - public DBComponent[] DBComponents = new DBComponent[IdGenerater.MaxZone]; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBManagerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBManagerComponent.cs.meta deleted file mode 100644 index 0d9ce90a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB/DBManagerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9064bf4ba5cdd044a80e66e16b3f07f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB/IDBCollection.cs b/Assets/GameScripts/DotNet/Model/Server/Module/DB/IDBCollection.cs deleted file mode 100644 index 604d3978..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB/IDBCollection.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace ET.Server -{ - public interface IDBCollection - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/DB/IDBCollection.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/DB/IDBCollection.cs.meta deleted file mode 100644 index 2ca53ce0..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/DB/IDBCollection.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 88b90ba479aa3b748b225bddc153ba6d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Http.meta deleted file mode 100644 index 24f5f567..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1be6139db3006b9419935261c3d0414e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpComponent.cs deleted file mode 100644 index d50b3c5d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpComponent.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using System.Net; - -namespace ET.Server -{ - /// - /// http请求分发器 - /// - [ComponentOf(typeof(Scene))] - public class HttpComponent: Entity, IAwake, IDestroy - { - public HttpListener Listener; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpComponent.cs.meta deleted file mode 100644 index 354dbebc..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e0de2584d06993846b20ba44c51b8a0b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpDispatcher.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpDispatcher.cs deleted file mode 100644 index 2a9d691b..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpDispatcher.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - public class HttpDispatcher: SingletonLock, ISingletonAwake - { - private readonly Dictionary> dispatcher = new(); - - public override void Load() - { - World.Instance.AddSingleton(); - } - - public void Awake() - { - HashSet types = EventSystem.Instance.GetTypes(typeof (HttpHandlerAttribute)); - - foreach (Type type in types) - { - object[] attrs = type.GetCustomAttributes(typeof(HttpHandlerAttribute), false); - if (attrs.Length == 0) - { - continue; - } - - HttpHandlerAttribute httpHandlerAttribute = (HttpHandlerAttribute)attrs[0]; - - object obj = Activator.CreateInstance(type); - - IHttpHandler ihttpHandler = obj as IHttpHandler; - if (ihttpHandler == null) - { - throw new Exception($"HttpHandler handler not inherit IHttpHandler class: {obj.GetType().FullName}"); - } - - if (!this.dispatcher.TryGetValue(httpHandlerAttribute.Path, out var dict)) - { - dict = new Dictionary(); - this.dispatcher.Add(httpHandlerAttribute.Path, dict); - } - - dict.Add((int)httpHandlerAttribute.SceneType, ihttpHandler); - } - } - - public IHttpHandler Get(SceneType sceneType, string path) - { - return this.dispatcher[path][(int)sceneType]; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpDispatcher.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpDispatcher.cs.meta deleted file mode 100644 index 1b28eced..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpDispatcher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5f32ee5a97327b54dad8859600342649 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpHandlerAttribute.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpHandlerAttribute.cs deleted file mode 100644 index c88cb360..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpHandlerAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ET.Server -{ - public class HttpHandlerAttribute: BaseAttribute - { - public SceneType SceneType { get; } - - public string Path { get; } - - public HttpHandlerAttribute(SceneType sceneType, string path) - { - this.SceneType = sceneType; - this.Path = path; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpHandlerAttribute.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpHandlerAttribute.cs.meta deleted file mode 100644 index 5cad1caf..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/HttpHandlerAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 536bf765aeb46c44e9d0618fb418c76a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/IHttpHandler.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Http/IHttpHandler.cs deleted file mode 100644 index 5a26ef06..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/IHttpHandler.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - public interface IHttpHandler - { - ETTask Handle(Scene scene, HttpListenerContext context); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Http/IHttpHandler.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Http/IHttpHandler.cs.meta deleted file mode 100644 index 767ab7ff..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Http/IHttpHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 850082c851b74ff419893672cb613cf3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Message.meta deleted file mode 100644 index dc9e907c..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 28793f12e3c15f140bd4d4d713d5782d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorOuterComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorOuterComponent.cs deleted file mode 100644 index 2bc8434f..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorOuterComponent.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using System.Net; - -namespace ET.Server -{ - [ComponentOf(typeof(Scene))] - public class ActorOuterComponent: Entity, IAwake, IUpdate, IDestroy - { - public const long TIMEOUT_TIME = 40 * 1000; - - public int RpcId; - - public readonly Dictionary requestCallback = new(); - - public AService AService; - - public NetworkProtocol InnerProtocol = NetworkProtocol.KCP; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorOuterComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorOuterComponent.cs.meta deleted file mode 100644 index 20e19a37..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorOuterComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 11d2abb5f986c5b44b5b58bfae58908f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorSenderComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorSenderComponent.cs deleted file mode 100644 index a3601eba..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorSenderComponent.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - [ComponentOf(typeof(Scene))] - public class ActorSenderComponent: Entity, IAwake, IDestroy - { - public const long TIMEOUT_TIME = 40 * 1000; - - public int RpcId; - - public readonly Dictionary requestCallback = new(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorSenderComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorSenderComponent.cs.meta deleted file mode 100644 index 0b05e5da..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/ActorSenderComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ecc41a2013820624bbe9d11dc8940dc8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/MessageHandler.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Message/MessageHandler.cs deleted file mode 100644 index 67308d57..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/MessageHandler.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; - -namespace ET.Server -{ - public abstract class MessageHandler: IMHandler where Request : MessageObject, IRequest where Response : MessageObject, IResponse - { - protected abstract ETTask Run(Session session, Request request, Response response); - - public void Handle(Session session, object message) - { - HandleAsync(session, message).Coroutine(); - } - - private async ETTask HandleAsync(Session session, object message) - { - try - { - Request request = message as Request; - if (request == null) - { - throw new Exception($"消息类型转换错误: {message.GetType().FullName} to {typeof (Request).FullName}"); - } - - int rpcId = request.RpcId; - long instanceId = session.InstanceId; - - Response response = ObjectPool.Instance.Fetch(); - - try - { - await this.Run(session, request, response); - } - catch (Exception exception) - { - Log.Error(exception); - response.Error = ErrorCore.ERR_RpcFail; - response.Message = exception.ToString(); - } - - // 等回调回来,session可以已经断开了,所以需要判断session InstanceId是否一样 - if (session.InstanceId != instanceId) - { - return; - } - - response.RpcId = rpcId; // 在这里设置rpcId是为了防止在Run中不小心修改rpcId字段 - session.Send(response); - } - catch (Exception e) - { - throw new Exception($"解释消息失败: {message.GetType().FullName}", e); - } - } - - public Type GetMessageType() - { - return typeof (Request); - } - - public Type GetResponseType() - { - return typeof (Response); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/MessageHandler.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Message/MessageHandler.cs.meta deleted file mode 100644 index fe71e965..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/MessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e3881ad9cfc7dc343a107f25d5659fb1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/NetServerComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Message/NetServerComponent.cs deleted file mode 100644 index b8ff5526..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/NetServerComponent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - public struct NetServerComponentOnRead - { - public Session Session; - public object Message; - } - - [ComponentOf(typeof(Scene))] - public class NetServerComponent: Entity, IAwake, IDestroy, IUpdate - { - public AService AService; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Message/NetServerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Message/NetServerComponent.cs.meta deleted file mode 100644 index 2d2fed43..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Message/NetServerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6d26c818710bffb459fecf60387869b6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/NetInner.meta b/Assets/GameScripts/DotNet/Model/Server/Module/NetInner.meta deleted file mode 100644 index ee721e40..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/NetInner.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 89b0725638d94c1e9c36b262da2e447c -timeCreated: 1688535488 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/NetInner/A2NetInner_Message.cs b/Assets/GameScripts/DotNet/Model/Server/Module/NetInner/A2NetInner_Message.cs deleted file mode 100644 index 135d0d50..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/NetInner/A2NetInner_Message.cs +++ /dev/null @@ -1,75 +0,0 @@ -using MemoryPack; - -namespace ET -{ - [Message(1)] - public class A2NetInner_Message: MessageObject, IActorMessage - { - public static A2NetInner_Message Create() - { - return ObjectPool.Instance.Fetch(typeof(A2NetInner_Message)) as A2NetInner_Message; - } - - public override void Dispose() - { - this.FromAddress = default; - this.ActorId = default; - - ObjectPool.Instance.Recycle(this); - } - - public Address FromAddress; - public ActorId ActorId; - public IActorMessage MessageObject; - } - - [Message(2)] - [ResponseType(nameof(A2NetInner_Response))] - public class A2NetInner_Request: MessageObject, IActorRequest - { - public static A2NetInner_Request Create() - { - return ObjectPool.Instance.Fetch(typeof(A2NetInner_Request)) as A2NetInner_Request; - } - - public override void Dispose() - { - this.RpcId = default; - this.ActorId = default; - this.MessageObject = default; - this.NeedException = default; - - ObjectPool.Instance.Recycle(this); - } - - public int RpcId { get; set; } - public ActorId ActorId; - public bool NeedException; - public IActorRequest MessageObject; - } - - [Message(3)] - public class A2NetInner_Response: MessageObject, IActorResponse - { - public static A2NetInner_Response Create() - { - return ObjectPool.Instance.Fetch(typeof(A2NetInner_Response)) as A2NetInner_Response; - } - - public override void Dispose() - { - this.RpcId = default; - this.Error = default; - this.Message = default; - - ObjectPool.Instance.Recycle(this); - } - - public int Error { get; set; } - public string Message { get; set; } - public int RpcId { get; set; } - - public IActorResponse MessageObject; - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/NetInner/A2NetInner_Message.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/NetInner/A2NetInner_Message.cs.meta deleted file mode 100644 index 3e4fb61a..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/NetInner/A2NetInner_Message.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 49cfb0bef9f14131b988f817eff4313b -timeCreated: 1688535429 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase.meta b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase.meta deleted file mode 100644 index 76e3c942..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 45a2289132188ea4783d8a7858cf50ad -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCase.cs b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCase.cs deleted file mode 100644 index cc9f7eb6..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCase.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Generic; - -namespace ET.Server -{ - [ChildOf(typeof(RobotCaseComponent))] - public class RobotCase: Entity, IAwake, IDestroy - { - public ETCancellationToken CancellationToken; - public string CommandLine; - public HashSet Scenes { get; } = new HashSet(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCase.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCase.cs.meta deleted file mode 100644 index 8b75cfaf..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCase.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e9f8ce7fbba8b27458372ab3ff3c0e7f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCaseComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCaseComponent.cs deleted file mode 100644 index 897daf20..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCaseComponent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET.Server -{ - - [ComponentOf(typeof(Scene))] - public class RobotCaseComponent: Entity, IAwake, IDestroy - { - public Dictionary RobotCases = new Dictionary(); - public int N = 10000; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCaseComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCaseComponent.cs.meta deleted file mode 100644 index bb9fde92..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotCaseComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 75c6bd85c92893d4e82e087a5b65e8d8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotInvokeArgs.cs b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotInvokeArgs.cs deleted file mode 100644 index ecaa53f2..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotInvokeArgs.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET.Server -{ - public struct RobotInvokeArgs - { - public Fiber Fiber { get; set; } - public string Content { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotInvokeArgs.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotInvokeArgs.cs.meta deleted file mode 100644 index e8e8ac43..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotInvokeArgs.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6f570483ab9a6f8458ab9346fa863a63 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotLog.cs b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotLog.cs deleted file mode 100644 index 941ac073..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotLog.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace ET.Server -{ - public static class RobotLog - { -#if DOTNET - public static void Debug(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Debug(message.ToStringAndClear()); - } - - public static void Console(ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler message) - { - Logger.Instance.Console(message.ToStringAndClear()); - } -#endif - - public static void Debug(string msg) - { - Logger.Instance.Debug(msg); - } - - public static void Console(string msg) - { - Logger.Instance.Console(msg); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotLog.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotLog.cs.meta deleted file mode 100644 index 3c338827..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/RobotCase/RobotLog.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0d2320c977663dc45b2fa20ca780ae4d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Router.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Router.meta deleted file mode 100644 index 86707018..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Router.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: bd01ac0fb84bbf64db1fcba8deb29db6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterComponent.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterComponent.cs deleted file mode 100644 index 5cea4b86..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterComponent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; - -namespace ET.Server -{ - - [ComponentOf(typeof(Scene))] - public class RouterComponent: Entity, IAwake, IDestroy, IUpdate - { - public Socket OuterSocket; - public Socket InnerSocket; - public EndPoint IPEndPoint = new IPEndPoint(IPAddress.Any, 0); - - public byte[] Cache = new byte[1500]; - - public Dictionary ConnectIdNodes = new Dictionary(); - - // 已经连接成功的,虽然跟id一样,但是没有经过验证的不会加到这里 - public Dictionary OuterNodes = new Dictionary(); - - public long LastCheckTime = 0; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterComponent.cs.meta deleted file mode 100644 index 6a7976cc..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: aedecff0d33048948a8204f5397a9530 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterNode.cs b/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterNode.cs deleted file mode 100644 index 7c27815d..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterNode.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Net; - -namespace ET.Server -{ - public enum RouterStatus - { - Sync, - Msg, - } - - [ChildOf(typeof(RouterComponent))] - public class RouterNode: Entity, IDestroy, IAwake - { - public uint ConnectId; - public string InnerAddress; - public IPEndPoint InnerIpEndPoint; - public IPEndPoint OuterIpEndPoint; - public IPEndPoint SyncIpEndPoint; - public uint OuterConn; - public uint InnerConn; - public long LastRecvOuterTime; - public long LastRecvInnerTime; - - public int RouterSyncCount; - public int SyncCount; - -#region 限制外网消息数量,一秒最多50个包 - - public long LastCheckTime; - public int LimitCountPerSecond; - -#endregion - - public RouterStatus Status; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterNode.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterNode.cs.meta deleted file mode 100644 index 5648b3ef..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Module/Router/RouterNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e639e9551604860489a87b4cc5642ba4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Plugins.meta b/Assets/GameScripts/DotNet/Model/Server/Plugins.meta deleted file mode 100644 index ea49def2..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e9c8ba382980f3c4b9aaec4e18a10b81 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Plugins/Example.meta b/Assets/GameScripts/DotNet/Model/Server/Plugins/Example.meta deleted file mode 100644 index 01910989..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Plugins/Example.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 047a7bcc80b0c8d4782aee55edab5656 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Server/Plugins/Example/ModelServer.cs b/Assets/GameScripts/DotNet/Model/Server/Plugins/Example/ModelServer.cs deleted file mode 100644 index 8b137891..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Plugins/Example/ModelServer.cs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Assets/GameScripts/DotNet/Model/Server/Plugins/Example/ModelServer.cs.meta b/Assets/GameScripts/DotNet/Model/Server/Plugins/Example/ModelServer.cs.meta deleted file mode 100644 index 9e885bbb..00000000 --- a/Assets/GameScripts/DotNet/Model/Server/Plugins/Example/ModelServer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37193e1ae3001094f8532402e61931d4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share.meta b/Assets/GameScripts/DotNet/Model/Share.meta deleted file mode 100644 index 5cdcb198..00000000 --- a/Assets/GameScripts/DotNet/Model/Share.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4020a5d77b28a594d9482ecf461022ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/ConstFiberId.cs b/Assets/GameScripts/DotNet/Model/Share/ConstFiberId.cs deleted file mode 100644 index dd39a767..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/ConstFiberId.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ET -{ - public static class ConstFiberId - { - public const int Main = -1; - public const int NetClient = -2; - public const int DB = -3; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/ConstFiberId.cs.meta b/Assets/GameScripts/DotNet/Model/Share/ConstFiberId.cs.meta deleted file mode 100644 index cf0aa456..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/ConstFiberId.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a5e2228e988db544687281f0ff80f009 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Demo.meta b/Assets/GameScripts/DotNet/Model/Share/Demo.meta deleted file mode 100644 index 172e3128..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Demo.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cef1faf005614e1498e553b563fae673 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Demo/EventType.cs b/Assets/GameScripts/DotNet/Model/Share/Demo/EventType.cs deleted file mode 100644 index ac5834e6..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Demo/EventType.cs +++ /dev/null @@ -1,38 +0,0 @@ -namespace ET -{ - namespace EventType - { - public struct SceneChangeStart - { - } - - public struct SceneChangeFinish - { - } - - public struct AfterCreateClientScene - { - } - - public struct AfterCreateCurrentScene - { - } - - public struct AppStartInitFinish - { - } - - public struct LoginFinish - { - } - - public struct EnterMapFinish - { - } - - public struct AfterUnitCreate - { - public Unit Unit; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Demo/EventType.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Demo/EventType.cs.meta deleted file mode 100644 index 60b29fbd..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Demo/EventType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3bd7b14de3c7c874d9f2b5411204ddb1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Entry.cs b/Assets/GameScripts/DotNet/Model/Share/Entry.cs deleted file mode 100644 index e6cea506..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Entry.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.IO; -using MemoryPack; - -namespace ET -{ - namespace EventType - { - public struct EntryEvent1 - { - } - - public struct EntryEvent2 - { - } - - public struct EntryEvent3 - { - } - } - - public static class Entry - { - public static void Init() - { - - } - - public static void Start() - { - StartAsync().Coroutine(); - } - - private static async ETTask StartAsync() - { - WinPeriod.Init(); - - MongoHelper.RegisterStruct(); - MongoHelper.Register(); - - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - World.Instance.AddSingleton(); - - World.Instance.AddSingleton(); - - await FiberManager.Instance.Create(SchedulerType.Main, ConstFiberId.Main, 0, SceneType.Main, ""); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Entry.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Entry.cs.meta deleted file mode 100644 index 72d5b0b9..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Entry.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 28ee985a41787a24a8ea3bf87277e7e3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep.meta deleted file mode 100644 index 0e7e9d36..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e8c5c383e6c7b48d9ba137530d2e924b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/FixedTimeCounter.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/FixedTimeCounter.cs deleted file mode 100644 index 7d0dab2f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/FixedTimeCounter.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace ET -{ - public class FixedTimeCounter - { - private long startTime; - private int startFrame; - public int Interval { get; private set; } - - public FixedTimeCounter(long startTime, int startFrame, int interval) - { - this.startTime = startTime; - this.startFrame = startFrame; - this.Interval = interval; - } - - public void ChangeInterval(int interval, int frame) - { - this.startTime += (frame - this.startFrame) * this.Interval; - this.startFrame = frame; - this.Interval = interval; - } - - public long FrameTime(int frame) - { - return this.startTime + (frame - this.startFrame) * this.Interval; - } - - public void Reset(long time, int frame) - { - this.startTime = time; - this.startFrame = frame; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/FixedTimeCounter.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/FixedTimeCounter.cs.meta deleted file mode 100644 index d3654901..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/FixedTimeCounter.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: a78339a190b64d92ba482cd00b239f52 -timeCreated: 1682422635 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/FrameBuffer.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/FrameBuffer.cs deleted file mode 100644 index f82f3c83..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/FrameBuffer.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - public class FrameBuffer - { - public int MaxFrame { get; private set; } - private readonly List frameInputs; - private readonly List snapshots; - private readonly List hashs; - - public FrameBuffer(int frame = 0, int capacity = LSConstValue.FrameCountPerSecond * 60) - { - this.MaxFrame = frame + LSConstValue.FrameCountPerSecond * 30; - this.frameInputs = new List(capacity); - this.snapshots = new List(capacity); - this.hashs = new List(capacity); - - for (int i = 0; i < this.snapshots.Capacity; ++i) - { - this.hashs.Add(0); - this.frameInputs.Add(new OneFrameInputs()); - MemoryBuffer memoryBuffer = new(10240); - memoryBuffer.SetLength(0); - memoryBuffer.Seek(0, SeekOrigin.Begin); - this.snapshots.Add(memoryBuffer); - } - } - - public void SetHash(int frame, long hash) - { - EnsureFrame(frame); - this.hashs[frame % this.frameInputs.Capacity] = hash; - } - - public long GetHash(int frame) - { - EnsureFrame(frame); - return this.hashs[frame % this.frameInputs.Capacity]; - } - - public bool CheckFrame(int frame) - { - if (frame < 0) - { - return false; - } - - if (frame > this.MaxFrame) - { - return false; - } - - return true; - } - - private void EnsureFrame(int frame) - { - if (!CheckFrame(frame)) - { - throw new Exception($"frame out: {frame}, maxframe: {this.MaxFrame}"); - } - } - - public OneFrameInputs FrameInputs(int frame) - { - EnsureFrame(frame); - OneFrameInputs oneFrameInputs = this.frameInputs[frame % this.frameInputs.Capacity]; - return oneFrameInputs; - } - - public void MoveForward(int frame) - { - if (this.MaxFrame - frame > LSConstValue.FrameCountPerSecond) // 至少留出1秒的空间 - { - return; - } - - ++this.MaxFrame; - - OneFrameInputs oneFrameInputs = this.FrameInputs(this.MaxFrame); - oneFrameInputs.Inputs.Clear(); - } - - public MemoryBuffer Snapshot(int frame) - { - EnsureFrame(frame); - MemoryBuffer memoryBuffer = this.snapshots[frame % this.snapshots.Capacity]; - return memoryBuffer; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/FrameBuffer.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/FrameBuffer.cs.meta deleted file mode 100644 index b5a2070d..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/FrameBuffer.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 248572437c2f47728e0191da78943fe5 -timeCreated: 1681719619 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/IActorRoom.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/IActorRoom.cs deleted file mode 100644 index 9f1fb26e..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/IActorRoom.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - public interface IActorRoom: IActorMessage - { - long PlayerId { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/IActorRoom.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/IActorRoom.cs.meta deleted file mode 100644 index 7dadf837..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/IActorRoom.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 88154111be2b445c295e7208376f428b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSRollbackSystem.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSRollbackSystem.cs deleted file mode 100644 index 7bb6fb81..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSRollbackSystem.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public interface ILSRollback - { - } - - public interface ILSRollbackSystem: ISystemType - { - void Run(Entity o); - } - - [LSEntitySystem] - public abstract class LSRollbackSystem : ILSRollbackSystem where T: Entity, ILSRollback - { - void ILSRollbackSystem.Run(Entity o) - { - this.LSRollback((T)o); - } - - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(ILSRollbackSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return InstanceQueueIndex.None; - } - - protected abstract void LSRollback(T self); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSRollbackSystem.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSRollbackSystem.cs.meta deleted file mode 100644 index be037882..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSRollbackSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 27067471cd1c7d045bb855b9f4f4c9b4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSUpdateSystem.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSUpdateSystem.cs deleted file mode 100644 index ff5c3f27..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSUpdateSystem.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace ET -{ - public interface ILSUpdate - { - } - - public interface ILSUpdateSystem: ISystemType - { - void Run(LSEntity o); - } - - [LSEntitySystem] - public abstract class LSUpdateSystem : ILSUpdateSystem where T: LSEntity, ILSUpdate - { - void ILSUpdateSystem.Run(LSEntity o) - { - this.LSUpdate((T)o); - } - - Type ISystemType.Type() - { - return typeof(T); - } - - Type ISystemType.SystemType() - { - return typeof(ILSUpdateSystem); - } - - int ISystemType.GetInstanceQueueIndex() - { - return LSQueneUpdateIndex.LSUpdate; - } - - protected abstract void LSUpdate(T self); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSUpdateSystem.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSUpdateSystem.cs.meta deleted file mode 100644 index 36a3e8c3..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/ILSUpdateSystem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2dc2986d4ec384cad9cf41a6eef3f6eb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSConstValue.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSConstValue.cs deleted file mode 100644 index 85891b2d..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSConstValue.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ET -{ - public static class LSConstValue - { - public const int MatchCount = 1; - public const int UpdateInterval = 50; - public const int FrameCountPerSecond = 1000 / UpdateInterval; - public const int SaveLSWorldFrameCount = 60 * FrameCountPerSecond; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSConstValue.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSConstValue.cs.meta deleted file mode 100644 index 6f9d038a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSConstValue.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f1af7fd8703b4dc3a521ef52d538d168 -timeCreated: 1681819811 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntity.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntity.cs deleted file mode 100644 index 30732a31..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntity.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; - -namespace ET -{ - public interface IRegisterLSEntitySystem - { - void RegisterSystem(LSEntity entity); - } - - [EnableMethod] - public class LSEntity: Entity - { - public new K AddComponent(bool isFromPool = false) where K : LSEntity, IAwake, new() - { - return this.AddComponentWithId(this.GetId(), isFromPool); - } - - public new K AddComponent(P1 p1, bool isFromPool = false) where K : LSEntity, IAwake, new() - { - return this.AddComponentWithId(this.GetId(), p1, isFromPool); - } - - public new K AddComponent(P1 p1, P2 p2, bool isFromPool = false) where K : LSEntity, IAwake, new() - { - return this.AddComponentWithId(this.GetId(), p1, p2, isFromPool); - } - - public new K AddComponent(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : LSEntity, IAwake, new() - { - return this.AddComponentWithId(this.GetId(), p1, p2, p3, isFromPool); - } - - [EnableAccessEntiyChild] - public new T AddChild(bool isFromPool = false) where T : LSEntity, IAwake - { - return this.AddChildWithId(this.GetId(), isFromPool); - } - - [EnableAccessEntiyChild] - public new T AddChild(A a, bool isFromPool = false) where T : LSEntity, IAwake - { - return this.AddChildWithId(this.GetId(), a, isFromPool); - } - - [EnableAccessEntiyChild] - public new T AddChild(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake - { - return this.AddChildWithId(this.GetId(), a, b, isFromPool); - } - - [EnableAccessEntiyChild] - public new T AddChild(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake - { - return this.AddChildWithId(this.GetId(), a, b, c, isFromPool); - } - - protected override void RegisterSystem() - { - IRegisterLSEntitySystem iRegisterLsEntitySystem = (IRegisterLSEntitySystem)this.IScene; - TypeSystems.OneTypeSystems oneTypeSystems = LSEntitySystemSingleton.Instance.GetOneTypeSystems(this.GetType()); - if (oneTypeSystems == null) - { - return; - } - - if (oneTypeSystems.QueueFlag[LSQueneUpdateIndex.LSUpdate]) - { - iRegisterLsEntitySystem.RegisterSystem(this); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntity.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntity.cs.meta deleted file mode 100644 index 89ac7af4..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntity.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3c56b3bb10000446c8e48f82b6969093 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemAttribute.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemAttribute.cs deleted file mode 100644 index fe7d0816..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] - public class LSEntitySystemAttribute: BaseAttribute - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemAttribute.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemAttribute.cs.meta deleted file mode 100644 index 01374594..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 83785c2329d8c4847b6fab0468c7f4d4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemSingleton.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemSingleton.cs deleted file mode 100644 index dfd67bdf..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemSingleton.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - [UniqueId(-1, 1)] - public static class LSQueneUpdateIndex - { - public const int None = -1; - public const int LSUpdate = 0; - public const int Max = 1; - } - - public class LSEntitySystemSingleton: SingletonLock, ISingletonAwake - { - public TypeSystems TypeSystems { get; private set; } - - public void Awake() - { - this.TypeSystems = new(LSQueneUpdateIndex.Max); - foreach (Type type in EventSystem.Instance.GetTypes(typeof (LSEntitySystemAttribute))) - { - object obj = Activator.CreateInstance(type); - - if (obj is not ISystemType iSystemType) - { - continue; - } - - TypeSystems.OneTypeSystems oneTypeSystems = this.TypeSystems.GetOrCreateOneTypeSystems(iSystemType.Type()); - oneTypeSystems.Map.Add(iSystemType.SystemType(), obj); - int index = iSystemType.GetInstanceQueueIndex(); - if (index > LSQueneUpdateIndex.None && index < LSQueneUpdateIndex.Max) - { - oneTypeSystems.QueueFlag[index] = true; - } - } - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - public TypeSystems.OneTypeSystems GetOneTypeSystems(Type type) - { - return this.TypeSystems.GetOneTypeSystems(type); - } - - public void LSRollback(Entity entity) - { - if (entity is not ILSRollback) - { - return; - } - - List iLSRollbackSystems = this.TypeSystems.GetSystems(entity.GetType(), typeof (ILSRollbackSystem)); - if (iLSRollbackSystems == null) - { - return; - } - - foreach (ILSRollbackSystem iLSRollbackSystem in iLSRollbackSystems) - { - if (iLSRollbackSystem == null) - { - continue; - } - - try - { - iLSRollbackSystem.Run(entity); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - - public void LSUpdate(LSEntity entity) - { - if (entity is not ILSUpdate) - { - return; - } - - List iLSUpdateSystems = TypeSystems.GetSystems(entity.GetType(), typeof (ILSUpdateSystem)); - if (iLSUpdateSystems == null) - { - return; - } - - foreach (ILSUpdateSystem iLSUpdateSystem in iLSUpdateSystems) - { - try - { - iLSUpdateSystem.Run(entity); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemSingleton.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemSingleton.cs.meta deleted file mode 100644 index 0aa226ee..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSEntitySystemSingleton.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d43f6155cef5380498803ee6c4e00d63 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInput.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInput.cs deleted file mode 100644 index 302a918a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInput.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using MemoryPack; - -namespace ET -{ - [MemoryPackable] - public partial struct LSInput - { - [MemoryPackOrder(0)] - public TrueSync.TSVector2 V; - - [MemoryPackOrder(1)] - public int Button; - - public bool Equals(LSInput other) - { - return this.V == other.V && this.Button == other.Button; - } - - public override bool Equals(object obj) - { - return obj is LSInput other && Equals(other); - } - - public override int GetHashCode() - { - return HashCode.Combine(this.V, this.Button); - } - - public static bool operator==(LSInput a, LSInput b) - { - if (a.V != b.V) - { - return false; - } - - if (a.Button != b.Button) - { - return false; - } - - return true; - } - - public static bool operator !=(LSInput a, LSInput b) - { - return !(a == b); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInput.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInput.cs.meta deleted file mode 100644 index f09c8e16..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInput.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f2411352b8bd84ed8bf43aa625cf3d44 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInputComponent.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInputComponent.cs deleted file mode 100644 index b97b46f4..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInputComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - [ComponentOf(typeof(LSUnit))] - public class LSInputComponent: LSEntity, ILSUpdate, IAwake, ISerializeToEntity - { - public LSInput LSInput { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInputComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInputComponent.cs.meta deleted file mode 100644 index a0e18de0..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSInputComponent.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: e0df77bdfbbb4a5fa2e9de116dabaaa2 -timeCreated: 1682051388 \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnit.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnit.cs deleted file mode 100644 index 33ff571b..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnit.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using MongoDB.Bson.Serialization.Attributes; -using TrueSync; - -namespace ET -{ - [ChildOf(typeof(LSUnitComponent))] - public class LSUnit: LSEntity, IAwake, ISerializeToEntity - { - public TSVector Position - { - get; - set; - } - - [BsonIgnore] - public TSVector Forward - { - get => this.Rotation * TSVector.forward; - set => this.Rotation = TSQuaternion.LookRotation(value, TSVector.up); - } - - public TSQuaternion Rotation - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnit.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnit.cs.meta deleted file mode 100644 index f4e74e2a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnit.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c62694a15545f4b599f146f8a44e417c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnitComponent.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnitComponent.cs deleted file mode 100644 index 65dfc212..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnitComponent.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - [ComponentOf(typeof(LSWorld))] - public class LSUnitComponent: LSEntity, IAwake, ISerializeToEntity - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnitComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnitComponent.cs.meta deleted file mode 100644 index 7f18d979..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUnitComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a9b77ec7663d54ec88ba2a0297314aef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUpdater.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUpdater.cs deleted file mode 100644 index d8d87479..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUpdater.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class LSUpdater - { - private List updateIds = new(); - private List newUpdateIds = new(); - - private readonly Dictionary> lsEntities = new(); - - public void Update() - { - if (this.newUpdateIds.Count > 0) - { - foreach (long id in this.newUpdateIds) - { - this.updateIds.Add(id); - } - this.updateIds.Sort(); - this.newUpdateIds.Clear(); - } - - foreach (long id in this.updateIds) - { - LSEntity entity = lsEntities[id]; - if (entity == null) - { - this.lsEntities.Remove(id); - continue; - } - this.newUpdateIds.Add(id); - LSEntitySystemSingleton.Instance.LSUpdate(entity); - } - this.updateIds.Clear(); - ObjectHelper.Swap(ref this.updateIds, ref this.newUpdateIds); - } - - public void Add(LSEntity entity) - { - this.newUpdateIds.Add(entity.Id); - this.lsEntities.Add(entity.Id, entity); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUpdater.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUpdater.cs.meta deleted file mode 100644 index 67e2fdfd..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSUpdater.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 654b3240c49c34319877c2dc7da81a5a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSWorld.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSWorld.cs deleted file mode 100644 index 4d916b7f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSWorld.cs +++ /dev/null @@ -1,75 +0,0 @@ -using MongoDB.Bson.Serialization.Attributes; -using System; -using System.Collections.Generic; -using TrueSync; - -namespace ET -{ - public static class LSWorldSystem - { - public static LSWorld LSWorld(this LSEntity entity) - { - return entity.IScene as LSWorld; - } - - public static long GetId(this LSEntity entity) - { - return entity.LSWorld().GetId(); - } - - public static TSRandom GetRandom(this LSEntity entity) - { - return entity.LSWorld().Random; - } - } - - [EnableMethod] - [ChildOf] - [ComponentOf] - public class LSWorld: LSEntity, IAwake, IScene, IRegisterLSEntitySystem - { - public LSWorld() - { - } - - public LSWorld(SceneType sceneType) - { - this.Id = this.GetId(); - - this.SceneType = sceneType; - - Log.Info($"LSScene create: {this.Id} {this.InstanceId}"); - } - - private readonly LSUpdater updater = new(); - - [BsonIgnore] - public Fiber Fiber { get; set; } - - [BsonElement] - private long idGenerator; - - public long GetId() - { - return ++this.idGenerator; - } - - public TSRandom Random { get; set; } - - [BsonIgnore] - public SceneType SceneType { get; set; } - - public int Frame { get; set; } - - public void Update() - { - this.updater.Update(); - ++this.Frame; - } - - public void RegisterSystem(LSEntity entity) - { - this.updater.Add(entity); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSWorld.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/LSWorld.cs.meta deleted file mode 100644 index b2b41981..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/LSWorld.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 55f4993cd749b4da984b60fc8d0720a2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/OneFrameInputs.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/OneFrameInputs.cs deleted file mode 100644 index 167e2af3..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/OneFrameInputs.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public partial class OneFrameInputs - { - protected bool Equals(OneFrameInputs other) - { - return Equals(this.Inputs, other.Inputs); - } - - public void CopyTo(OneFrameInputs to) - { - to.Inputs.Clear(); - foreach (var kv in this.Inputs) - { - to.Inputs.Add(kv.Key, kv.Value); - } - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - if (obj.GetType() != this.GetType()) - { - return false; - } - - return Equals((OneFrameInputs) obj); - } - - public override int GetHashCode() - { - return HashCode.Combine(this.Inputs); - } - - public OneFrameInputs() - { - this.Inputs = new Dictionary(LSConstValue.MatchCount); - } - - public static bool operator==(OneFrameInputs a, OneFrameInputs b) - { - if (a is null || b is null) - { - if (a is null && b is null) - { - return true; - } - return false; - } - - if (a.Inputs.Count != b.Inputs.Count) - { - return false; - } - - foreach (var kv in a.Inputs) - { - if (!b.Inputs.TryGetValue(kv.Key, out LSInput inputInfo)) - { - return false; - } - - if (kv.Value != inputInfo) - { - return false; - } - } - - return true; - } - - public static bool operator !=(OneFrameInputs a, OneFrameInputs b) - { - return !(a == b); - } - } - - public partial class Room2C_Start - { - public Room2C_Start() - { - this.UnitInfo = new List(LSConstValue.MatchCount); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/OneFrameInputs.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/OneFrameInputs.cs.meta deleted file mode 100644 index d3b5a961..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/OneFrameInputs.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: cc7d50658d3c844c8b32167be54851c4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/Replay.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/Replay.cs deleted file mode 100644 index 127304e0..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/Replay.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using MemoryPack; - -namespace ET -{ - [MemoryPackable] - public partial class Replay - { - [MemoryPackOrder(1)] - public List UnitInfos; - - [MemoryPackOrder(2)] - public List FrameInputs = new(); - - [MemoryPackOrder(3)] - public List Snapshots = new(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/Replay.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/Replay.cs.meta deleted file mode 100644 index 10ffecd1..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/Replay.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 83a7335c9271d4f848460aedf23c1b70 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/Room.cs b/Assets/GameScripts/DotNet/Model/Share/LockStep/Room.cs deleted file mode 100644 index fba48320..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/Room.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Collections.Generic; - -namespace ET -{ - [ChildOf] - [ComponentOf] - public class Room: Entity, IScene, IAwake, IUpdate - { - public Fiber Fiber { get; set; } - public SceneType SceneType { get; set; } = SceneType.Room; - public string Name { get; set; } - - public long StartTime { get; set; } - - // 帧缓存 - public FrameBuffer FrameBuffer { get; set; } - - // 计算fixedTime,fixedTime在客户端是动态调整的,会做时间膨胀缩放 - public FixedTimeCounter FixedTimeCounter { get; set; } - - // 玩家id列表 - public List PlayerIds { get; } = new(LSConstValue.MatchCount); - - // 预测帧 - public int PredictionFrame { get; set; } = -1; - - // 权威帧 - public int AuthorityFrame { get; set; } = -1; - - // 存档 - public Replay Replay { get; set; } = new(); - - private EntityRef lsWorld; - - // LSWorld做成child,可以有多个lsWorld,比如守望先锋有两个 - public LSWorld LSWorld - { - get - { - return this.lsWorld; - } - set - { - this.AddChild(value); - this.lsWorld = value; - } - } - - public bool IsReplay { get; set; } - - public int SpeedMultiply { get; set; } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/LockStep/Room.cs.meta b/Assets/GameScripts/DotNet/Model/Share/LockStep/Room.cs.meta deleted file mode 100644 index 3d508734..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/LockStep/Room.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 51fde8d44ce33433b9523076002f8831 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module.meta b/Assets/GameScripts/DotNet/Model/Share/Module.meta deleted file mode 100644 index d5713444..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4ad8d604046d19e40a023fa31ed2265f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI.meta b/Assets/GameScripts/DotNet/Model/Share/Module/AI.meta deleted file mode 100644 index 9ded7544..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 17314ef2e141d8f4e8b75777cec648ce -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AAIHandler.cs b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AAIHandler.cs deleted file mode 100644 index 4cded026..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AAIHandler.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace ET -{ - public class AIHandlerAttribute: BaseAttribute - { - } - - [AIHandler] - public abstract class AAIHandler - { - // 检查是否满足条件 - public abstract int Check(AIComponent aiComponent, AIConfig aiConfig); - - // 协程编写必须可以取消 - public abstract ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AAIHandler.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AAIHandler.cs.meta deleted file mode 100644 index 7b33ff83..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AAIHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3e43892262fb7af4b95b158fa391da91 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIComponent.cs deleted file mode 100644 index 98b3dc97..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIComponent.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ET -{ - // 客户端挂在ClientScene上,服务端挂在Unit上 - [ComponentOf(typeof(Scene))] - public class AIComponent: Entity, IAwake, IDestroy - { - public int AIConfigId; - - public ETCancellationToken CancellationToken; - - public long Timer; - - public int Current; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIComponent.cs.meta deleted file mode 100644 index 9b23035c..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3b13f63f82f588d4382b1e8cb779425e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIConfig.cs b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIConfig.cs deleted file mode 100644 index 260c5368..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIConfig.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using MongoDB.Bson; -using MongoDB.Bson.Serialization.Attributes; - -namespace ET -{ - public partial class AIConfigCategory - { - [BsonIgnore] - public Dictionary> AIConfigs = new Dictionary>(); - - public SortedDictionary GetAI(int aiConfigId) - { - return this.AIConfigs[aiConfigId]; - } - - public override void EndInit() - { - foreach (var kv in this.GetAll()) - { - SortedDictionary aiNodeConfig; - if (!this.AIConfigs.TryGetValue(kv.Value.AIConfigId, out aiNodeConfig)) - { - aiNodeConfig = new SortedDictionary(); - this.AIConfigs.Add(kv.Value.AIConfigId, aiNodeConfig); - } - - aiNodeConfig.Add(kv.Key, kv.Value); - } - } - } -} diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIConfig.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIConfig.cs.meta deleted file mode 100644 index 6c45fe5a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIConfig.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f733a3428ecb9224d8917bd0aed54a0b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIDispatcherComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIDispatcherComponent.cs deleted file mode 100644 index edeaae55..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIDispatcherComponent.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class AIDispatcherComponent: SingletonLock, ISingletonAwake - { - private readonly Dictionary aiHandlers = new(); - - public void Awake() - { - var types = EventSystem.Instance.GetTypes(typeof (AIHandlerAttribute)); - foreach (Type type in types) - { - AAIHandler aaiHandler = Activator.CreateInstance(type) as AAIHandler; - if (aaiHandler == null) - { - Log.Error($"robot ai is not AAIHandler: {type.Name}"); - continue; - } - this.aiHandlers.Add(type.Name, aaiHandler); - } - } - - public AAIHandler Get(string key) - { - this.aiHandlers.TryGetValue(key, out var aaiHandler); - return aaiHandler; - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIDispatcherComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIDispatcherComponent.cs.meta deleted file mode 100644 index 39977ac0..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/AI/AIDispatcherComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 70505ae07c0ed05469c46867370eae98 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Console.meta deleted file mode 100644 index f86f7b73..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: aac5f3c9c8081e643874db9704c945a4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleComponent.cs deleted file mode 100644 index 504a2cf7..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleComponent.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections.Generic; -using System.Threading; - -namespace ET -{ - public static class ConsoleMode - { - public const string ReloadDll = "R"; - public const string ReloadConfig = "C"; - public const string ShowMemory = "M"; - public const string Repl = "Repl"; - public const string Debugger = "Debugger"; - public const string CreateRobot = "CreateRobot"; - public const string Robot = "Robot"; - } - - [ComponentOf(typeof(Scene))] - public class ConsoleComponent: Entity, IAwake - { - public CancellationTokenSource CancellationTokenSource; - - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleComponent.cs.meta deleted file mode 100644 index 9fb1e1e5..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 22534ff56546c094d904521502f2103f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleDispatcher.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleDispatcher.cs deleted file mode 100644 index 1db78080..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleDispatcher.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class ConsoleDispatcher: SingletonLock, ISingletonAwake - { - private readonly Dictionary handlers = new(); - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - public void Awake() - { - HashSet types = EventSystem.Instance.GetTypes(typeof (ConsoleHandlerAttribute)); - - foreach (Type type in types) - { - object[] attrs = type.GetCustomAttributes(typeof(ConsoleHandlerAttribute), false); - if (attrs.Length == 0) - { - continue; - } - - ConsoleHandlerAttribute consoleHandlerAttribute = (ConsoleHandlerAttribute)attrs[0]; - - object obj = Activator.CreateInstance(type); - - IConsoleHandler iConsoleHandler = obj as IConsoleHandler; - if (iConsoleHandler == null) - { - throw new Exception($"ConsoleHandler handler not inherit IConsoleHandler class: {obj.GetType().FullName}"); - } - this.handlers.Add(consoleHandlerAttribute.Mode, iConsoleHandler); - } - } - - public IConsoleHandler Get(string key) - { - return this.handlers[key]; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleDispatcher.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleDispatcher.cs.meta deleted file mode 100644 index e4982209..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleDispatcher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7cf505646a7016d40817dc8783f37ed1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleHandlerAttribute.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleHandlerAttribute.cs deleted file mode 100644 index 2c89403a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleHandlerAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace ET -{ - public class ConsoleHandlerAttribute: BaseAttribute - { - public string Mode { get; } - - public ConsoleHandlerAttribute(string mode) - { - this.Mode = mode; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleHandlerAttribute.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleHandlerAttribute.cs.meta deleted file mode 100644 index b7816f95..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ConsoleHandlerAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 08c605182de1040469a4239c965f2694 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/IConsoleHandler.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Console/IConsoleHandler.cs deleted file mode 100644 index 7ab0c17f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/IConsoleHandler.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - public interface IConsoleHandler - { - ETTask Run(Fiber fiber, ModeContex contex, string content); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/IConsoleHandler.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Console/IConsoleHandler.cs.meta deleted file mode 100644 index 57fbf5f7..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/IConsoleHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0498d217572ef624cb2f066e11f028a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ModeContex.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ModeContex.cs deleted file mode 100644 index 4d0fcef0..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ModeContex.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace ET -{ - [EntitySystemOf(typeof(ModeContex))] - [FriendOf(typeof(ModeContex))] - public static partial class ModeContexSystem - { - [EntitySystem] - private static void Awake(this ModeContex self) - { - self.Mode = ""; - } - - [EntitySystem] - private static void Destroy(this ModeContex self) - { - self.Mode = ""; - } - } - - - - [ComponentOf(typeof(ConsoleComponent))] - public class ModeContex: Entity, IAwake, IDestroy - { - public string Mode = ""; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ModeContex.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Console/ModeContex.cs.meta deleted file mode 100644 index b61b8ca9..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Console/ModeContex.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 519865a57fe078d4b8b5989813e8c4ec -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message.meta deleted file mode 100644 index 3d1cee36..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 08e7592e24d7de848a57c94e2a27a999 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/ErrorCode.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/ErrorCode.cs deleted file mode 100644 index 2ed354de..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/ErrorCode.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ET -{ - public static partial class ErrorCode - { - public const int ERR_Success = 0; - - // 1-11004 是SocketError请看SocketError定义 - //----------------------------------- - // 100000-109999是Core层的错误 - - // 110000以下的错误请看ErrorCore.cs - - // 这里配置逻辑层的错误码 - // 110000 - 200000是抛异常的错误 - // 200001以上不抛异常 - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/ErrorCode.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/ErrorCode.cs.meta deleted file mode 100644 index af4e7a92..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/ErrorCode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c926ebadd533a344d9b622ba3398dd9a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/IMHandler.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/IMHandler.cs deleted file mode 100644 index 88422d1e..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/IMHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace ET -{ - public interface IMHandler - { - void Handle(Session session, object message); - Type GetMessageType(); - - Type GetResponseType(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/IMHandler.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/IMHandler.cs.meta deleted file mode 100644 index 4158bd61..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/IMHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5d9d71d94c994b64daecdede5f1a889c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageDispatcherComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageDispatcherComponent.cs deleted file mode 100644 index 53296361..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageDispatcherComponent.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using System; - -namespace ET -{ - public class MessageDispatcherInfo - { - public SceneType SceneType { get; } - public IMHandler IMHandler { get; } - - public MessageDispatcherInfo(SceneType sceneType, IMHandler imHandler) - { - this.SceneType = sceneType; - this.IMHandler = imHandler; - } - } - - public class MessageDispatcherComponent: SingletonLock, ISingletonAwake - { - private readonly Dictionary> handlers = new(); - - public void Awake() - { - HashSet types = EventSystem.Instance.GetTypes(typeof (MessageHandlerAttribute)); - - foreach (Type type in types) - { - IMHandler iMHandler = Activator.CreateInstance(type) as IMHandler; - if (iMHandler == null) - { - Log.Error($"message handle {type.Name} 需要继承 IMHandler"); - continue; - } - - object[] attrs = type.GetCustomAttributes(typeof(MessageHandlerAttribute), true); - - foreach (object attr in attrs) - { - MessageHandlerAttribute messageHandlerAttribute = attr as MessageHandlerAttribute; - - Type messageType = iMHandler.GetMessageType(); - - ushort opcode = OpcodeType.Instance.GetOpcode(messageType); - if (opcode == 0) - { - Log.Error($"消息opcode为0: {messageType.Name}"); - continue; - } - - MessageDispatcherInfo messageDispatcherInfo = new (messageHandlerAttribute.SceneType, iMHandler); - this.RegisterHandler(opcode, messageDispatcherInfo); - } - } - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - private void RegisterHandler(ushort opcode, MessageDispatcherInfo handler) - { - if (!this.handlers.ContainsKey(opcode)) - { - this.handlers.Add(opcode, new List()); - } - - this.handlers[opcode].Add(handler); - } - - public void Handle(Session session, object message) - { - List actions; - ushort opcode = OpcodeType.Instance.GetOpcode(message.GetType()); - if (!this.handlers.TryGetValue(opcode, out actions)) - { - Log.Error($"消息没有处理: {opcode} {message}"); - return; - } - - SceneType sceneType = session.IScene.SceneType; - foreach (MessageDispatcherInfo ev in actions) - { - if (!ev.SceneType.HasSameFlag(sceneType)) - { - continue; - } - - try - { - ev.IMHandler.Handle(session, message); - } - catch (Exception e) - { - Log.Error(e); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageDispatcherComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageDispatcherComponent.cs.meta deleted file mode 100644 index 726dd089..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageDispatcherComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2ede21855857ffe4aae0f5d80047cc80 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandler.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandler.cs deleted file mode 100644 index 293050f0..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; - -namespace ET -{ - public abstract class MessageHandler: IMHandler where Message : class - { - protected abstract ETTask Run(Session session, Message message); - - public void Handle(Session session, object msg) - { - Message message = msg as Message; - if (message == null) - { - Log.Error($"消息类型转换错误: {msg.GetType().FullName} to {typeof (Message).Name}"); - return; - } - - if (session.IsDisposed) - { - Log.Error($"session disconnect {msg}"); - return; - } - - this.Run(session, message).Coroutine(); - } - - public Type GetMessageType() - { - return typeof (Message); - } - - public Type GetResponseType() - { - return null; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandler.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandler.cs.meta deleted file mode 100644 index 827e245a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c40ee71fc1a2f144bf4d2ff2cf7c65d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandlerAttribute.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandlerAttribute.cs deleted file mode 100644 index 97aa55c9..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandlerAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace ET -{ - public class MessageHandlerAttribute: BaseAttribute - { - public SceneType SceneType { get; } - - public MessageHandlerAttribute(SceneType sceneType) - { - this.SceneType = sceneType; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandlerAttribute.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandlerAttribute.cs.meta deleted file mode 100644 index 8dfd3168..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/MessageHandlerAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 61a55441f76423340b0da6e5c2af7c66 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/Session.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/Session.cs deleted file mode 100644 index 9ace92c4..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/Session.cs +++ /dev/null @@ -1,185 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; - -namespace ET -{ - public readonly struct RpcInfo - { - public readonly IRequest Request; - public readonly ETTask Tcs; - - public RpcInfo(IRequest request) - { - this.Request = request; - this.Tcs = ETTask.Create(true); - } - } - - [EntitySystemOf(typeof(Session))] - [FriendOf(typeof(Session))] - public static partial class SessionSystem - { - [EntitySystem] - private static void Awake(this Session self, AService aService) - { - self.AService = aService; - long timeNow = self.Fiber().TimeInfo.ClientNow(); - self.LastRecvTime = timeNow; - self.LastSendTime = timeNow; - - self.requestCallbacks.Clear(); - - Log.Info($"session create: zone: {self.Zone()} id: {self.Id} {timeNow} "); - } - - [EntitySystem] - private static void Destroy(this Session self) - { - self.AService.Remove(self.Id, self.Error); - - foreach (RpcInfo responseCallback in self.requestCallbacks.Values.ToArray()) - { - responseCallback.Tcs.SetException(new RpcException(self.Error, $"session dispose: {self.Id} {self.RemoteAddress}")); - } - - Log.Info($"session dispose: {self.RemoteAddress} id: {self.Id} ErrorCode: {self.Error}, please see ErrorCode.cs! {self.Fiber().TimeInfo.ClientNow()}"); - - self.requestCallbacks.Clear(); - } - - public static void OnResponse(this Session self, IResponse response) - { - if (!self.requestCallbacks.Remove(response.RpcId, out var action)) - { - return; - } - - if (ErrorCore.IsRpcNeedThrowException(response.Error)) - { - action.Tcs.SetException(new Exception($"Rpc error, request: {action.Request} response: {response}")); - return; - } - action.Tcs.SetResult(response); - } - - public static async ETTask Call(this Session self, IRequest request, ETCancellationToken cancellationToken) - { - int rpcId = ++Session.RpcId; - RpcInfo rpcInfo = new RpcInfo(request); - self.requestCallbacks[rpcId] = rpcInfo; - request.RpcId = rpcId; - - self.Send(request); - - void CancelAction() - { - if (!self.requestCallbacks.TryGetValue(rpcId, out RpcInfo action)) - { - return; - } - - self.requestCallbacks.Remove(rpcId); - Type responseType = OpcodeType.Instance.GetResponseType(action.Request.GetType()); - IResponse response = (IResponse) Activator.CreateInstance(responseType); - response.Error = ErrorCore.ERR_Cancel; - action.Tcs.SetResult(response); - } - - IResponse ret; - try - { - cancellationToken?.Add(CancelAction); - ret = await rpcInfo.Tcs; - } - finally - { - cancellationToken?.Remove(CancelAction); - } - return ret; - } - - public static async ETTask Call(this Session self, IRequest request, int time = 0) - { - int rpcId = ++Session.RpcId; - RpcInfo rpcInfo = new(request); - self.requestCallbacks[rpcId] = rpcInfo; - request.RpcId = rpcId; - self.Send(request); - - if (time > 0) - { - async ETTask Timeout() - { - await self.Fiber().TimerComponent.WaitAsync(time); - if (!self.requestCallbacks.TryGetValue(rpcId, out RpcInfo action)) - { - return; - } - - if (!self.requestCallbacks.Remove(rpcId)) - { - return; - } - - action.Tcs.SetException(new Exception($"session call timeout: {request} {time}")); - } - - Timeout().Coroutine(); - } - - return await rpcInfo.Tcs; - } - - public static void Send(this Session self, IMessage message) - { - self.Send(default, message); - } - - public static void Send(this Session self, ActorId actorId, IMessage message) - { - self.LastSendTime = self.Fiber().TimeInfo.ClientNow(); - Log.Debug(message.ToString()); - self.AService.Send(self.Id, actorId, message as MessageObject); - } - } - - [ChildOf] - public sealed class Session: Entity, IAwake, IDestroy - { - public AService AService { get; set; } - - public static int RpcId - { - get; - set; - } - - public readonly Dictionary requestCallbacks = new(); - - public long LastRecvTime - { - get; - set; - } - - public long LastSendTime - { - get; - set; - } - - public int Error - { - get; - set; - } - - public IPEndPoint RemoteAddress - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/Session.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/Session.cs.meta deleted file mode 100644 index cb924d28..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/Session.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f666df5ed1cec4d40bd2986c28507634 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionAcceptTimeoutComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionAcceptTimeoutComponent.cs deleted file mode 100644 index f0227caa..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionAcceptTimeoutComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ET -{ - // 刚accept的session只持续5秒,必须通过验证,否则断开 - [ComponentOf(typeof(Session))] - public class SessionAcceptTimeoutComponent: Entity, IAwake, IDestroy - { - public long Timer; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionAcceptTimeoutComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionAcceptTimeoutComponent.cs.meta deleted file mode 100644 index 20690c30..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionAcceptTimeoutComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37f2d187ca934374393b7b32d87b91f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionIdleCheckerComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionIdleCheckerComponent.cs deleted file mode 100644 index 674cbc9f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionIdleCheckerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - [ComponentOf(typeof(Session))] - public class SessionIdleCheckerComponent: Entity, IAwake, IDestroy - { - public long RepeatedTimer; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionIdleCheckerComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionIdleCheckerComponent.cs.meta deleted file mode 100644 index d03bb125..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Message/SessionIdleCheckerComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 1d309c1ef46c0eb4bb58c14b6716c032 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Move.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Move.meta deleted file mode 100644 index b6c0697b..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Move.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 26fd94c36353aad4591969119ce93bb4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveComponent.cs deleted file mode 100644 index 1ca7ecf9..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveComponent.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using Unity.Mathematics; - -namespace ET -{ - [ComponentOf(typeof(Unit))] - public class MoveComponent: Entity, IAwake, IDestroy - { - public float3 PreTarget - { - get - { - return this.Targets[this.N - 1]; - } - } - - public float3 NextTarget - { - get - { - return this.Targets[this.N]; - } - } - - // 开启移动协程的时间 - public long BeginTime; - - // 每个点的开始时间 - public long StartTime { get; set; } - - // 开启移动协程的Unit的位置 - public float3 StartPos; - - public float3 RealPos - { - get - { - return this.Targets[0]; - } - } - - private long needTime; - - public long NeedTime - { - get - { - return this.needTime; - } - set - { - this.needTime = value; - } - } - - public long MoveTimer; - - public float Speed; // m/s - - public ETTask tcs; - - public List Targets = new List(); - - public float3 FinalTarget - { - get - { - return this.Targets[this.Targets.Count - 1]; - } - } - - public int N; - - public int TurnTime; - - public bool IsTurnHorizontal; - - public quaternion From; - - public quaternion To; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveComponent.cs.meta deleted file mode 100644 index bbcbc47f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 91e6974c200f3e9468684362d1489433 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveEventType.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveEventType.cs deleted file mode 100644 index 4b4593b2..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveEventType.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ET -{ - namespace EventType - { - public struct MoveStart - { - public Unit Unit; - } - - public struct MoveStop - { - public Unit Unit; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveEventType.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveEventType.cs.meta deleted file mode 100644 index bef62115..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Move/MoveEventType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0abfe3cf9ea0c8d41a0afe2920c080bb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric.meta deleted file mode 100644 index 90281e1f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3d6a99783c189d543ac801a2d36b362b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/INumericWatcher.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/INumericWatcher.cs deleted file mode 100644 index 5e8c595f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/INumericWatcher.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ET -{ - public interface INumericWatcher - { - void Run(Unit unit, EventType.NumbericChange args); - } -} diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/INumericWatcher.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/INumericWatcher.cs.meta deleted file mode 100644 index bb375b22..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/INumericWatcher.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d25ba9800f0a922459d8287d76d224d7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericComponent.cs deleted file mode 100644 index fb07a0fc..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericComponent.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using MongoDB.Bson.Serialization.Options; - -namespace ET -{ - [FriendOf(typeof (NumericComponent))] - public static class NumericComponentSystem - { - public static float GetAsFloat(this NumericComponent self, int numericType) - { - return (float)self.GetByKey(numericType) / 10000; - } - - public static int GetAsInt(this NumericComponent self, int numericType) - { - return (int)self.GetByKey(numericType); - } - - public static long GetAsLong(this NumericComponent self, int numericType) - { - return self.GetByKey(numericType); - } - - public static void Set(this NumericComponent self, int nt, float value) - { - self[nt] = (long)(value * 10000); - } - - public static void Set(this NumericComponent self, int nt, int value) - { - self[nt] = value; - } - - public static void Set(this NumericComponent self, int nt, long value) - { - self[nt] = value; - } - - public static void SetNoEvent(this NumericComponent self, int numericType, long value) - { - self.Insert(numericType, value, false); - } - - public static void Insert(this NumericComponent self, int numericType, long value, bool isPublicEvent = true) - { - long oldValue = self.GetByKey(numericType); - if (oldValue == value) - { - return; - } - - self.NumericDic[numericType] = value; - - if (numericType >= NumericType.Max) - { - self.Update(numericType, isPublicEvent); - return; - } - - if (isPublicEvent) - { - EventSystem.Instance.Publish(self.Scene(), - new EventType.NumbericChange() { Unit = self.GetParent(), New = value, Old = oldValue, NumericType = numericType }); - } - } - - public static long GetByKey(this NumericComponent self, int key) - { - long value = 0; - self.NumericDic.TryGetValue(key, out value); - return value; - } - - public static void Update(this NumericComponent self, int numericType, bool isPublicEvent) - { - int final = (int)numericType / 10; - int bas = final * 10 + 1; - int add = final * 10 + 2; - int pct = final * 10 + 3; - int finalAdd = final * 10 + 4; - int finalPct = final * 10 + 5; - - // 一个数值可能会多种情况影响,比如速度,加个buff可能增加速度绝对值100,也有些buff增加10%速度,所以一个值可以由5个值进行控制其最终结果 - // final = (((base + add) * (100 + pct) / 100) + finalAdd) * (100 + finalPct) / 100; - long result = (long)(((self.GetByKey(bas) + self.GetByKey(add)) * (100 + self.GetAsFloat(pct)) / 100f + self.GetByKey(finalAdd)) * - (100 + self.GetAsFloat(finalPct)) / 100f); - self.Insert(final, result, isPublicEvent); - } - } - - namespace EventType - { - public struct NumbericChange - { - public Unit Unit; - public int NumericType; - public long Old; - public long New; - } - } - - [ComponentOf(typeof (Unit))] - public class NumericComponent: Entity, IAwake, ITransfer - { - [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] - public Dictionary NumericDic = new Dictionary(); - - public long this[int numericType] - { - get - { - return this.GetByKey(numericType); - } - set - { - this.Insert(numericType, value); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericComponent.cs.meta deleted file mode 100644 index d3b3f35e..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 701bdb74115713a4bb6486a4bbc832ce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericType.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericType.cs deleted file mode 100644 index 4cc1333c..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericType.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace ET -{ - // 这个可弄个配置表生成 - public static class NumericType - { - public const int Max = 10000; - - public const int Speed = 1000; - public const int SpeedBase = Speed * 10 + 1; - public const int SpeedAdd = Speed * 10 + 2; - public const int SpeedPct = Speed * 10 + 3; - public const int SpeedFinalAdd = Speed * 10 + 4; - public const int SpeedFinalPct = Speed * 10 + 5; - - public const int Hp = 1001; - public const int HpBase = Hp * 10 + 1; - - public const int MaxHp = 1002; - public const int MaxHpBase = MaxHp * 10 + 1; - public const int MaxHpAdd = MaxHp * 10 + 2; - public const int MaxHpPct = MaxHp * 10 + 3; - public const int MaxHpFinalAdd = MaxHp * 10 + 4; - public const int MaxHpFinalPct = MaxHp * 10 + 5; - - public const int AOI = 1003; - public const int AOIBase = AOI * 10 + 1; - public const int AOIAdd = AOI * 10 + 2; - public const int AOIPct = AOI * 10 + 3; - public const int AOIFinalAdd = AOI * 10 + 4; - public const int AOIFinalPct = AOI * 10 + 5; - } -} diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericType.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericType.cs.meta deleted file mode 100644 index b0da8e30..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e48d074e33972034bad7ee8ba643edf5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherAttribute.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherAttribute.cs deleted file mode 100644 index 2d899728..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace ET -{ - [AttributeUsage(AttributeTargets.Class)] - public class NumericWatcherAttribute : BaseAttribute - { - public SceneType SceneType { get; } - - public int NumericType { get; } - - public NumericWatcherAttribute(SceneType sceneType, int type) - { - this.SceneType = sceneType; - this.NumericType = type; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherAttribute.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherAttribute.cs.meta deleted file mode 100644 index da2fb81f..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherAttribute.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 96e98292e4df6684abad49fc0887b963 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherComponent.cs deleted file mode 100644 index 23467866..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherComponent.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace ET -{ - public class NumericWatcherInfo - { - public SceneType SceneType { get; } - public INumericWatcher INumericWatcher { get; } - - public NumericWatcherInfo(SceneType sceneType, INumericWatcher numericWatcher) - { - this.SceneType = sceneType; - this.INumericWatcher = numericWatcher; - } - } - - /// - /// 监视数值变化组件,分发监听 - /// - public class NumericWatcherComponent : SingletonLock, ISingletonAwake - { - private readonly Dictionary> allWatchers = new(); - - public void Awake() - { - HashSet types = EventSystem.Instance.GetTypes(typeof(NumericWatcherAttribute)); - foreach (Type type in types) - { - object[] attrs = type.GetCustomAttributes(typeof(NumericWatcherAttribute), false); - - foreach (object attr in attrs) - { - NumericWatcherAttribute numericWatcherAttribute = (NumericWatcherAttribute)attr; - INumericWatcher obj = (INumericWatcher)Activator.CreateInstance(type); - NumericWatcherInfo numericWatcherInfo = new(numericWatcherAttribute.SceneType, obj); - if (!this.allWatchers.ContainsKey(numericWatcherAttribute.NumericType)) - { - this.allWatchers.Add(numericWatcherAttribute.NumericType, new List()); - } - this.allWatchers[numericWatcherAttribute.NumericType].Add(numericWatcherInfo); - } - } - } - - public override void Load() - { - World.Instance.AddSingleton(true); - } - - public void Run(Unit unit, EventType.NumbericChange args) - { - List list; - if (!this.allWatchers.TryGetValue(args.NumericType, out list)) - { - return; - } - - SceneType unitDomainSceneType = unit.IScene.SceneType; - foreach (NumericWatcherInfo numericWatcher in list) - { - if (!numericWatcher.SceneType.HasSameFlag(unitDomainSceneType)) - { - continue; - } - numericWatcher.INumericWatcher.Run(unit, args); - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherComponent.cs.meta deleted file mode 100644 index 05d69252..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Numeric/NumericWatcherComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 86c4a86a98102464b8bbe1bd9da800e5 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait.meta b/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait.meta deleted file mode 100644 index 3d67a038..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 972155bb07920b648bbeecab259ed50b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait/ObjectWait.cs b/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait/ObjectWait.cs deleted file mode 100644 index 370ea313..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait/ObjectWait.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace ET -{ - public static class WaitTypeError - { - public const int Success = 0; - public const int Destroy = 1; - public const int Cancel = 2; - public const int Timeout = 3; - } - - public interface IWaitType - { - int Error - { - get; - set; - } - } - - [EntitySystemOf(typeof(ObjectWait))] - [FriendOf(typeof(ObjectWait))] - public static partial class ObjectWaitSystem - { - [EntitySystem] - private static void Awake(this ObjectWait self) - { - self.tcss.Clear(); - } - - [EntitySystem] - private static void Destroy(this ObjectWait self) - { - foreach (object v in self.tcss.Values.ToArray()) - { - ((IDestroyRun) v).SetResult(); - } - } - - private interface IDestroyRun - { - void SetResult(); - } - - private class ResultCallback: IDestroyRun where K : struct, IWaitType - { - private ETTask tcs; - - public ResultCallback() - { - this.tcs = ETTask.Create(true); - } - - public bool IsDisposed - { - get - { - return this.tcs == null; - } - } - - public ETTask Task => this.tcs; - - public void SetResult(K k) - { - var t = tcs; - this.tcs = null; - t.SetResult(k); - } - - public void SetResult() - { - var t = tcs; - this.tcs = null; - t.SetResult(new K() { Error = WaitTypeError.Destroy }); - } - } - - public static async ETTask Wait(this ObjectWait self, ETCancellationToken cancellationToken = null) where T : struct, IWaitType - { - ResultCallback tcs = new ResultCallback(); - Type type = typeof (T); - self.tcss.Add(type, tcs); - - void CancelAction() - { - self.Notify(new T() { Error = WaitTypeError.Cancel }); - } - - T ret; - try - { - cancellationToken?.Add(CancelAction); - ret = await tcs.Task; - } - finally - { - cancellationToken?.Remove(CancelAction); - } - return ret; - } - - public static async ETTask Wait(this ObjectWait self, int timeout, ETCancellationToken cancellationToken = null) where T : struct, IWaitType - { - ResultCallback tcs = new ResultCallback(); - async ETTask WaitTimeout() - { - await self.Fiber().TimerComponent.WaitAsync(timeout, cancellationToken); - if (cancellationToken.IsCancel()) - { - return; - } - if (tcs.IsDisposed) - { - return; - } - self.Notify(new T() { Error = WaitTypeError.Timeout }); - } - - WaitTimeout().Coroutine(); - - self.tcss.Add(typeof (T), tcs); - - void CancelAction() - { - self.Notify(new T() { Error = WaitTypeError.Cancel }); - } - - T ret; - try - { - cancellationToken?.Add(CancelAction); - ret = await tcs.Task; - } - finally - { - cancellationToken?.Remove(CancelAction); - } - return ret; - } - - public static void Notify(this ObjectWait self, T obj) where T : struct, IWaitType - { - Type type = typeof (T); - if (!self.tcss.TryGetValue(type, out object tcs)) - { - return; - } - - self.tcss.Remove(type); - ((ResultCallback) tcs).SetResult(obj); - } - } - - [ComponentOf] - public class ObjectWait: Entity, IAwake, IDestroy - { - public Dictionary tcss = new Dictionary(); - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait/ObjectWait.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait/ObjectWait.cs.meta deleted file mode 100644 index e43fbf24..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/ObjectWait/ObjectWait.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 32a775e5dd87b864c81d6f579572dc9c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Recast.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Recast.meta deleted file mode 100644 index 14f95118..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Recast.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 50e2749056f46c0489ebe1e199d3a108 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Recast/PathfindingComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Recast/PathfindingComponent.cs deleted file mode 100644 index 2c9d9c83..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Recast/PathfindingComponent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace ET -{ - /// - /// 同一块地图可能有多种寻路数据,玩家可以随时切换,怪物也可能跟玩家的寻路不一样,寻路组件应该挂在Unit上 - /// - [ComponentOf(typeof(Unit))] - public class PathfindingComponent: Entity, IAwake, IDestroy - { - public const int FindRandomNavPosMaxRadius = 15000; // 随机找寻路点的最大半径 - - public float[] extents = {15, 10, 15}; - - public string Name; - - public IntPtr navMesh; - - public float[] StartPos = new float[3]; - - public float[] EndPos = new float[3]; - - public float[] Result = new float[Recast.MAX_POLYS * 3]; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Recast/PathfindingComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Recast/PathfindingComponent.cs.meta deleted file mode 100644 index d68af621..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Recast/PathfindingComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0e22ef73640ac8944baf71f1960cc67b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Scene.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Scene.meta deleted file mode 100644 index e00c460c..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Scene.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ed3aaad9f0ba38b4882cf33a7a5cae86 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Scene/CurrentScenesComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Scene/CurrentScenesComponent.cs deleted file mode 100644 index 847f6f94..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Scene/CurrentScenesComponent.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace ET -{ - // 可以用来管理多个客户端场景,比如大世界会加载多块场景 - [ComponentOf(typeof(Scene))] - public class CurrentScenesComponent: Entity, IAwake - { - private EntityRef scene; - - public Scene Scene - { - get - { - return this.scene; - } - set - { - this.scene = value; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Scene/CurrentScenesComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Scene/CurrentScenesComponent.cs.meta deleted file mode 100644 index b3362e41..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Scene/CurrentScenesComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 76092b938d51716479051a770847aa2c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Unit.meta deleted file mode 100644 index 1ce9afcf..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 974f5651ee87bd6429abdd765e594762 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/Unit.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/Unit.cs deleted file mode 100644 index a406bda4..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/Unit.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Diagnostics; -using MongoDB.Bson.Serialization.Attributes; -using Unity.Mathematics; - -namespace ET -{ - [ChildOf(typeof(UnitComponent))] - [DebuggerDisplay("ViewName,nq")] - public class Unit: Entity, IAwake - { - public int ConfigId { get; set; } //配置表id - - [BsonIgnore] - public UnitConfig Config => UnitConfigCategory.Instance.Get(this.ConfigId); - - public UnitType Type => (UnitType)UnitConfigCategory.Instance.Get(this.ConfigId).Type; - - [BsonElement] - private float3 position; //坐标 - - [BsonIgnore] - public float3 Position - { - get => this.position; - set - { - float3 oldPos = this.position; - this.position = value; - EventSystem.Instance.Publish(this.Scene(), new EventType.ChangePosition() { Unit = this, OldPos = oldPos }); - } - } - - [BsonIgnore] - public float3 Forward - { - get => math.mul(this.Rotation, math.forward()); - set => this.Rotation = quaternion.LookRotation(value, math.up()); - } - - [BsonElement] - private quaternion rotation; - - [BsonIgnore] - public quaternion Rotation - { - get => this.rotation; - set - { - this.rotation = value; - EventSystem.Instance.Publish(this.Scene(), new EventType.ChangeRotation() { Unit = this }); - } - } - - protected override string ViewName - { - get - { - return $"{this.GetType().FullName} ({this.Id})"; - } - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/Unit.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/Unit.cs.meta deleted file mode 100644 index 47b74098..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/Unit.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3da3f3ce5b234ff4e9a0ac52abeb8638 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitComponent.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitComponent.cs deleted file mode 100644 index 9eb4df04..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace ET -{ - - [ComponentOf(typeof(Scene))] - public class UnitComponent: Entity, IAwake, IDestroy - { - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitComponent.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitComponent.cs.meta deleted file mode 100644 index 5d80c1e0..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitComponent.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e471c38a87a0d7d47a324bfcdb9fa160 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitEventType.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitEventType.cs deleted file mode 100644 index cacca986..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitEventType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Unity.Mathematics; - -namespace ET -{ - namespace EventType - { - public struct ChangePosition - { - public Unit Unit; - public float3 OldPos; - } - - public struct ChangeRotation - { - public Unit Unit; - } - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitEventType.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitEventType.cs.meta deleted file mode 100644 index 471c203b..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitEventType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 536f5650e527ebc4abd29873e5beaa23 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitType.cs b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitType.cs deleted file mode 100644 index efe1c5ad..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ET -{ - public enum UnitType: byte - { - Player = 1, - Monster = 2, - NPC = 3, - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitType.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitType.cs.meta deleted file mode 100644 index e37f5a42..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Module/Unit/UnitType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 36e597b9a37681d43afd1812cf5008dc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Plugins.meta b/Assets/GameScripts/DotNet/Model/Share/Plugins.meta deleted file mode 100644 index c73de3ec..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 28950c95a2aee3c4782c59819479124a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Plugins/Example.meta b/Assets/GameScripts/DotNet/Model/Share/Plugins/Example.meta deleted file mode 100644 index aebc5b61..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Plugins/Example.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: d17793ff0cb5ec241826760444df27b3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/Plugins/Example/ModelShare.cs b/Assets/GameScripts/DotNet/Model/Share/Plugins/Example/ModelShare.cs deleted file mode 100644 index 8b137891..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Plugins/Example/ModelShare.cs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Assets/GameScripts/DotNet/Model/Share/Plugins/Example/ModelShare.cs.meta b/Assets/GameScripts/DotNet/Model/Share/Plugins/Example/ModelShare.cs.meta deleted file mode 100644 index eeb790e6..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/Plugins/Example/ModelShare.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e8f0c9138d7d86b468a85d9b993dedc6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameScripts/DotNet/Model/Share/TimerInvokeType.cs b/Assets/GameScripts/DotNet/Model/Share/TimerInvokeType.cs deleted file mode 100644 index 1c1bb16a..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/TimerInvokeType.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace ET -{ - [UniqueId(100, 10000)] - public static class TimerInvokeType - { - // 框架层100-200,逻辑层的timer type从200起 - public const int WaitTimer = 100; - public const int SessionIdleChecker = 101; - public const int ActorLocationSenderChecker = 102; - public const int ActorMessageSenderChecker = 103; - - // 框架层100-200,逻辑层的timer type 200-300 - public const int MoveTimer = 201; - public const int AITimer = 202; - public const int SessionAcceptTimeout = 203; - - public const int RoomUpdate = 301; - } -} \ No newline at end of file diff --git a/Assets/GameScripts/DotNet/Model/Share/TimerInvokeType.cs.meta b/Assets/GameScripts/DotNet/Model/Share/TimerInvokeType.cs.meta deleted file mode 100644 index 221587c5..00000000 --- a/Assets/GameScripts/DotNet/Model/Share/TimerInvokeType.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e21dc85ec77863f499b5e84300f8aaa0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Config/Excel/c/AIConfigCategory.bytes b/Config/Excel/c/AIConfigCategory.bytes deleted file mode 100644 index 8c8d5be1..00000000 Binary files a/Config/Excel/c/AIConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/c/UnitConfigCategory.bytes b/Config/Excel/c/UnitConfigCategory.bytes deleted file mode 100644 index b6bab5c7..00000000 Binary files a/Config/Excel/c/UnitConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/AIConfigCategory.bytes b/Config/Excel/cs/AIConfigCategory.bytes deleted file mode 100644 index 8c8d5be1..00000000 Binary files a/Config/Excel/cs/AIConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Benchmark/StartMachineConfigCategory.bytes b/Config/Excel/cs/StartConfig/Benchmark/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/cs/StartConfig/Benchmark/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Benchmark/StartProcessConfigCategory.bytes b/Config/Excel/cs/StartConfig/Benchmark/StartProcessConfigCategory.bytes deleted file mode 100644 index 6b6acf7a..00000000 Binary files a/Config/Excel/cs/StartConfig/Benchmark/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Benchmark/StartSceneConfigCategory.bytes b/Config/Excel/cs/StartConfig/Benchmark/StartSceneConfigCategory.bytes deleted file mode 100644 index 8d208869..00000000 Binary files a/Config/Excel/cs/StartConfig/Benchmark/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Benchmark/StartZoneConfigCategory.bytes b/Config/Excel/cs/StartConfig/Benchmark/StartZoneConfigCategory.bytes deleted file mode 100644 index b8471b2d..00000000 Binary files a/Config/Excel/cs/StartConfig/Benchmark/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Localhost/StartMachineConfigCategory.bytes b/Config/Excel/cs/StartConfig/Localhost/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/cs/StartConfig/Localhost/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Localhost/StartProcessConfigCategory.bytes b/Config/Excel/cs/StartConfig/Localhost/StartProcessConfigCategory.bytes deleted file mode 100644 index 1164f7dd..00000000 Binary files a/Config/Excel/cs/StartConfig/Localhost/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Localhost/StartSceneConfigCategory.bytes b/Config/Excel/cs/StartConfig/Localhost/StartSceneConfigCategory.bytes deleted file mode 100644 index 4c2fdbe3..00000000 Binary files a/Config/Excel/cs/StartConfig/Localhost/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Localhost/StartZoneConfigCategory.bytes b/Config/Excel/cs/StartConfig/Localhost/StartZoneConfigCategory.bytes deleted file mode 100644 index 3fc8a97c..00000000 Binary files a/Config/Excel/cs/StartConfig/Localhost/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Release/StartMachineConfigCategory.bytes b/Config/Excel/cs/StartConfig/Release/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/cs/StartConfig/Release/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Release/StartProcessConfigCategory.bytes b/Config/Excel/cs/StartConfig/Release/StartProcessConfigCategory.bytes deleted file mode 100644 index 6b6acf7a..00000000 Binary files a/Config/Excel/cs/StartConfig/Release/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Release/StartSceneConfigCategory.bytes b/Config/Excel/cs/StartConfig/Release/StartSceneConfigCategory.bytes deleted file mode 100644 index 2aabbfb7..00000000 Binary files a/Config/Excel/cs/StartConfig/Release/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/Release/StartZoneConfigCategory.bytes b/Config/Excel/cs/StartConfig/Release/StartZoneConfigCategory.bytes deleted file mode 100644 index 5b7b502c..00000000 Binary files a/Config/Excel/cs/StartConfig/Release/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/RouterTest/StartMachineConfigCategory.bytes b/Config/Excel/cs/StartConfig/RouterTest/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/cs/StartConfig/RouterTest/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/RouterTest/StartProcessConfigCategory.bytes b/Config/Excel/cs/StartConfig/RouterTest/StartProcessConfigCategory.bytes deleted file mode 100644 index cd8dd984..00000000 Binary files a/Config/Excel/cs/StartConfig/RouterTest/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/RouterTest/StartSceneConfigCategory.bytes b/Config/Excel/cs/StartConfig/RouterTest/StartSceneConfigCategory.bytes deleted file mode 100644 index 8516893e..00000000 Binary files a/Config/Excel/cs/StartConfig/RouterTest/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/StartConfig/RouterTest/StartZoneConfigCategory.bytes b/Config/Excel/cs/StartConfig/RouterTest/StartZoneConfigCategory.bytes deleted file mode 100644 index 3fc8a97c..00000000 Binary files a/Config/Excel/cs/StartConfig/RouterTest/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/cs/UnitConfigCategory.bytes b/Config/Excel/cs/UnitConfigCategory.bytes deleted file mode 100644 index 7f4655df..00000000 Binary files a/Config/Excel/cs/UnitConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/AIConfigCategory.bytes b/Config/Excel/s/AIConfigCategory.bytes deleted file mode 100644 index 8c8d5be1..00000000 Binary files a/Config/Excel/s/AIConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Benchmark/StartMachineConfigCategory.bytes b/Config/Excel/s/StartConfig/Benchmark/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/s/StartConfig/Benchmark/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Benchmark/StartProcessConfigCategory.bytes b/Config/Excel/s/StartConfig/Benchmark/StartProcessConfigCategory.bytes deleted file mode 100644 index 6b6acf7a..00000000 Binary files a/Config/Excel/s/StartConfig/Benchmark/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Benchmark/StartSceneConfigCategory.bytes b/Config/Excel/s/StartConfig/Benchmark/StartSceneConfigCategory.bytes deleted file mode 100644 index 8d208869..00000000 Binary files a/Config/Excel/s/StartConfig/Benchmark/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Benchmark/StartZoneConfigCategory.bytes b/Config/Excel/s/StartConfig/Benchmark/StartZoneConfigCategory.bytes deleted file mode 100644 index b8471b2d..00000000 Binary files a/Config/Excel/s/StartConfig/Benchmark/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Localhost/StartMachineConfigCategory.bytes b/Config/Excel/s/StartConfig/Localhost/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/s/StartConfig/Localhost/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Localhost/StartProcessConfigCategory.bytes b/Config/Excel/s/StartConfig/Localhost/StartProcessConfigCategory.bytes deleted file mode 100644 index 1164f7dd..00000000 Binary files a/Config/Excel/s/StartConfig/Localhost/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Localhost/StartSceneConfigCategory.bytes b/Config/Excel/s/StartConfig/Localhost/StartSceneConfigCategory.bytes deleted file mode 100644 index 4c2fdbe3..00000000 Binary files a/Config/Excel/s/StartConfig/Localhost/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Localhost/StartZoneConfigCategory.bytes b/Config/Excel/s/StartConfig/Localhost/StartZoneConfigCategory.bytes deleted file mode 100644 index 3fc8a97c..00000000 Binary files a/Config/Excel/s/StartConfig/Localhost/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Release/StartMachineConfigCategory.bytes b/Config/Excel/s/StartConfig/Release/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/s/StartConfig/Release/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Release/StartProcessConfigCategory.bytes b/Config/Excel/s/StartConfig/Release/StartProcessConfigCategory.bytes deleted file mode 100644 index 6b6acf7a..00000000 Binary files a/Config/Excel/s/StartConfig/Release/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Release/StartSceneConfigCategory.bytes b/Config/Excel/s/StartConfig/Release/StartSceneConfigCategory.bytes deleted file mode 100644 index 2aabbfb7..00000000 Binary files a/Config/Excel/s/StartConfig/Release/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/Release/StartZoneConfigCategory.bytes b/Config/Excel/s/StartConfig/Release/StartZoneConfigCategory.bytes deleted file mode 100644 index 5b7b502c..00000000 Binary files a/Config/Excel/s/StartConfig/Release/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/RouterTest/StartMachineConfigCategory.bytes b/Config/Excel/s/StartConfig/RouterTest/StartMachineConfigCategory.bytes deleted file mode 100644 index 19aa7970..00000000 Binary files a/Config/Excel/s/StartConfig/RouterTest/StartMachineConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/RouterTest/StartProcessConfigCategory.bytes b/Config/Excel/s/StartConfig/RouterTest/StartProcessConfigCategory.bytes deleted file mode 100644 index cd8dd984..00000000 Binary files a/Config/Excel/s/StartConfig/RouterTest/StartProcessConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/RouterTest/StartSceneConfigCategory.bytes b/Config/Excel/s/StartConfig/RouterTest/StartSceneConfigCategory.bytes deleted file mode 100644 index 8516893e..00000000 Binary files a/Config/Excel/s/StartConfig/RouterTest/StartSceneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/StartConfig/RouterTest/StartZoneConfigCategory.bytes b/Config/Excel/s/StartConfig/RouterTest/StartZoneConfigCategory.bytes deleted file mode 100644 index 3fc8a97c..00000000 Binary files a/Config/Excel/s/StartConfig/RouterTest/StartZoneConfigCategory.bytes and /dev/null differ diff --git a/Config/Excel/s/UnitConfigCategory.bytes b/Config/Excel/s/UnitConfigCategory.bytes deleted file mode 100644 index 095cc7e0..00000000 Binary files a/Config/Excel/s/UnitConfigCategory.bytes and /dev/null differ diff --git a/Config/Json/c/AIConfig.txt b/Config/Json/c/AIConfig.txt deleted file mode 100644 index 149f3a31..00000000 --- a/Config/Json/c/AIConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[101, {"_t":"AIConfig","_id":101,"AIConfigId":1,"Order":1,"Name":"AI_Attack","NodeParams":[]}], -[102, {"_t":"AIConfig","_id":102,"AIConfigId":1,"Order":2,"Name":"AI_XunLuo","NodeParams":[]}], -[201, {"_t":"AIConfig","_id":201,"AIConfigId":2,"Order":1,"Name":"AI_XunLuo","NodeParams":[]}], -]} diff --git a/Config/Json/c/UnitConfig.txt b/Config/Json/c/UnitConfig.txt deleted file mode 100644 index 1e9f92a4..00000000 --- a/Config/Json/c/UnitConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1001, {"_t":"UnitConfig","_id":1001,"Type":1,"Name":"米克尔","Position":1,"Height":178}], -[1002, {"_t":"UnitConfig","_id":1002,"Type":1,"Name":"米克尔2","Position":2,"Height":278}], -[1004, {"_t":"UnitConfig","_id":1004,"Type":1,"Name":"米克尔4","Position":2,"Height":278}], -]} diff --git a/Config/Json/cs/AIConfig.txt b/Config/Json/cs/AIConfig.txt deleted file mode 100644 index 149f3a31..00000000 --- a/Config/Json/cs/AIConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[101, {"_t":"AIConfig","_id":101,"AIConfigId":1,"Order":1,"Name":"AI_Attack","NodeParams":[]}], -[102, {"_t":"AIConfig","_id":102,"AIConfigId":1,"Order":2,"Name":"AI_XunLuo","NodeParams":[]}], -[201, {"_t":"AIConfig","_id":201,"AIConfigId":2,"Order":1,"Name":"AI_XunLuo","NodeParams":[]}], -]} diff --git a/Config/Json/cs/StartConfig/Benchmark/StartMachineConfig.txt b/Config/Json/cs/StartConfig/Benchmark/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/cs/StartConfig/Benchmark/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/cs/StartConfig/Benchmark/StartProcessConfig.txt b/Config/Json/cs/StartConfig/Benchmark/StartProcessConfig.txt deleted file mode 100644 index 29edb2b8..00000000 --- a/Config/Json/cs/StartConfig/Benchmark/StartProcessConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -[2, {"_t":"StartProcessConfig","_id":2,"MachineId":1}], -[3, {"_t":"StartProcessConfig","_id":3,"MachineId":1}], -]} diff --git a/Config/Json/cs/StartConfig/Benchmark/StartSceneConfig.txt b/Config/Json/cs/StartConfig/Benchmark/StartSceneConfig.txt deleted file mode 100644 index a99af9b0..00000000 --- a/Config/Json/cs/StartConfig/Benchmark/StartSceneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"BenchmarkServer","Name":"BenchmarkServer","Port":30001}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":2,"Zone":1,"SceneType":"BenchmarkClient","Name":"BenchmarkClient1","Port":30002}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":3,"Zone":1,"SceneType":"BenchmarkClient","Name":"BenchmarkClient2","Port":30003}], -]} diff --git a/Config/Json/cs/StartConfig/Benchmark/StartZoneConfig.txt b/Config/Json/cs/StartConfig/Benchmark/StartZoneConfig.txt deleted file mode 100644 index 3dfc64dd..00000000 --- a/Config/Json/cs/StartConfig/Benchmark/StartZoneConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -]} diff --git a/Config/Json/cs/StartConfig/Demo/StartMachineConfig.txt b/Config/Json/cs/StartConfig/Demo/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/cs/StartConfig/Demo/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/cs/StartConfig/Demo/StartProcessConfig.txt b/Config/Json/cs/StartConfig/Demo/StartProcessConfig.txt deleted file mode 100644 index 17c80583..00000000 --- a/Config/Json/cs/StartConfig/Demo/StartProcessConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1,"InnerPort":20101}], -]} diff --git a/Config/Json/cs/StartConfig/Demo/StartSceneConfig.txt b/Config/Json/cs/StartConfig/Demo/StartSceneConfig.txt deleted file mode 100644 index f18d632f..00000000 --- a/Config/Json/cs/StartConfig/Demo/StartSceneConfig.txt +++ /dev/null @@ -1,14 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","OuterPort":30002}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","OuterPort":30003}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","OuterPort":30004}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","OuterPort":0}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","OuterPort":0}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","OuterPort":0}], -[200, {"_t":"StartSceneConfig","_id":200,"Process":1,"Zone":2,"SceneType":"Robot","Name":"Robot01","OuterPort":0}], -[300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","OuterPort":30300}], -[301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","OuterPort":30301}], -[302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","OuterPort":30302}], -[303, {"_t":"StartSceneConfig","_id":303,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router03","OuterPort":30303}], -[304, {"_t":"StartSceneConfig","_id":304,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router04","OuterPort":30304}], -]} diff --git a/Config/Json/cs/StartConfig/Demo/StartZoneConfig.txt b/Config/Json/cs/StartConfig/Demo/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/cs/StartConfig/Demo/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/cs/StartConfig/Localhost/StartMachineConfig.txt b/Config/Json/cs/StartConfig/Localhost/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/cs/StartConfig/Localhost/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/cs/StartConfig/Localhost/StartProcessConfig.txt b/Config/Json/cs/StartConfig/Localhost/StartProcessConfig.txt deleted file mode 100644 index f3191f44..00000000 --- a/Config/Json/cs/StartConfig/Localhost/StartProcessConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -]} diff --git a/Config/Json/cs/StartConfig/Localhost/StartSceneConfig.txt b/Config/Json/cs/StartConfig/Localhost/StartSceneConfig.txt deleted file mode 100644 index ec4f34d6..00000000 --- a/Config/Json/cs/StartConfig/Localhost/StartSceneConfig.txt +++ /dev/null @@ -1,15 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"NetInner","Name":"NetInner","Port":30001}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","Port":30002}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","Port":30003}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","Port":30004}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","Port":0}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Match","Name":"Match","Port":0}], -[7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","Port":0}], -[8, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","Port":0}], -[300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","Port":30300}], -[301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","Port":30301}], -[302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","Port":30302}], -[303, {"_t":"StartSceneConfig","_id":303,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router03","Port":30303}], -[304, {"_t":"StartSceneConfig","_id":304,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router04","Port":30304}], -]} diff --git a/Config/Json/cs/StartConfig/Localhost/StartZoneConfig.txt b/Config/Json/cs/StartConfig/Localhost/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/cs/StartConfig/Localhost/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/cs/StartConfig/LockStep/StartMachineConfig.txt b/Config/Json/cs/StartConfig/LockStep/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/cs/StartConfig/LockStep/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/cs/StartConfig/LockStep/StartProcessConfig.txt b/Config/Json/cs/StartConfig/LockStep/StartProcessConfig.txt deleted file mode 100644 index 17c80583..00000000 --- a/Config/Json/cs/StartConfig/LockStep/StartProcessConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1,"InnerPort":20101}], -]} diff --git a/Config/Json/cs/StartConfig/LockStep/StartSceneConfig.txt b/Config/Json/cs/StartConfig/LockStep/StartSceneConfig.txt deleted file mode 100644 index 4dd9b627..00000000 --- a/Config/Json/cs/StartConfig/LockStep/StartSceneConfig.txt +++ /dev/null @@ -1,17 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","OuterPort":30002}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","OuterPort":30003}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","OuterPort":30004}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","OuterPort":0}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Match","Name":"Match","OuterPort":0}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","OuterPort":0}], -[7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","OuterPort":0}], -[8, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map3","OuterPort":0}], -[9, {"_t":"StartSceneConfig","_id":9,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map4","OuterPort":0}], -[200, {"_t":"StartSceneConfig","_id":200,"Process":1,"Zone":2,"SceneType":"Robot","Name":"Robot01","OuterPort":0}], -[300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","OuterPort":30300}], -[301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","OuterPort":30301}], -[302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","OuterPort":30302}], -[303, {"_t":"StartSceneConfig","_id":303,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router03","OuterPort":30303}], -[304, {"_t":"StartSceneConfig","_id":304,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router04","OuterPort":30304}], -]} diff --git a/Config/Json/cs/StartConfig/LockStep/StartZoneConfig.txt b/Config/Json/cs/StartConfig/LockStep/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/cs/StartConfig/LockStep/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/cs/StartConfig/Release/StartMachineConfig.txt b/Config/Json/cs/StartConfig/Release/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/cs/StartConfig/Release/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/cs/StartConfig/Release/StartProcessConfig.txt b/Config/Json/cs/StartConfig/Release/StartProcessConfig.txt deleted file mode 100644 index 29edb2b8..00000000 --- a/Config/Json/cs/StartConfig/Release/StartProcessConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -[2, {"_t":"StartProcessConfig","_id":2,"MachineId":1}], -[3, {"_t":"StartProcessConfig","_id":3,"MachineId":1}], -]} diff --git a/Config/Json/cs/StartConfig/Release/StartSceneConfig.txt b/Config/Json/cs/StartConfig/Release/StartSceneConfig.txt deleted file mode 100644 index ea7cbaf8..00000000 --- a/Config/Json/cs/StartConfig/Release/StartSceneConfig.txt +++ /dev/null @@ -1,15 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"NetInner","Name":"NetInner","Port":30001}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","Port":30002}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","Port":30003}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","Port":30004}], -[11, {"_t":"StartSceneConfig","_id":11,"Process":2,"Zone":1,"SceneType":"NetInner","Name":"NetInner2","Port":30011}], -[12, {"_t":"StartSceneConfig","_id":12,"Process":2,"Zone":1,"SceneType":"Location","Name":"Location","Port":0}], -[13, {"_t":"StartSceneConfig","_id":13,"Process":2,"Zone":1,"SceneType":"Map","Name":"Map1","Port":0}], -[14, {"_t":"StartSceneConfig","_id":14,"Process":2,"Zone":1,"SceneType":"Map","Name":"Map2","Port":0}], -[30, {"_t":"StartSceneConfig","_id":30,"Process":3,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","Port":30300}], -[31, {"_t":"StartSceneConfig","_id":31,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router01","Port":30301}], -[32, {"_t":"StartSceneConfig","_id":32,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router02","Port":30302}], -[33, {"_t":"StartSceneConfig","_id":33,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router03","Port":30303}], -[34, {"_t":"StartSceneConfig","_id":34,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router04","Port":30304}], -]} diff --git a/Config/Json/cs/StartConfig/Release/StartZoneConfig.txt b/Config/Json/cs/StartConfig/Release/StartZoneConfig.txt deleted file mode 100644 index c5f951b3..00000000 --- a/Config/Json/cs/StartConfig/Release/StartZoneConfig.txt +++ /dev/null @@ -1,4 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"mongodb://127.0.0.1","DBName":"ET2"}], -]} diff --git a/Config/Json/cs/StartConfig/RouterTest/StartMachineConfig.txt b/Config/Json/cs/StartConfig/RouterTest/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/cs/StartConfig/RouterTest/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/cs/StartConfig/RouterTest/StartProcessConfig.txt b/Config/Json/cs/StartConfig/RouterTest/StartProcessConfig.txt deleted file mode 100644 index 1b8c8a32..00000000 --- a/Config/Json/cs/StartConfig/RouterTest/StartProcessConfig.txt +++ /dev/null @@ -1,9 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -[2, {"_t":"StartProcessConfig","_id":2,"MachineId":1}], -[3, {"_t":"StartProcessConfig","_id":3,"MachineId":1}], -[4, {"_t":"StartProcessConfig","_id":4,"MachineId":1}], -[5, {"_t":"StartProcessConfig","_id":5,"MachineId":1}], -[6, {"_t":"StartProcessConfig","_id":6,"MachineId":1}], -[7, {"_t":"StartProcessConfig","_id":7,"MachineId":1}], -]} diff --git a/Config/Json/cs/StartConfig/RouterTest/StartSceneConfig.txt b/Config/Json/cs/StartConfig/RouterTest/StartSceneConfig.txt deleted file mode 100644 index 7da79356..00000000 --- a/Config/Json/cs/StartConfig/RouterTest/StartSceneConfig.txt +++ /dev/null @@ -1,15 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"NetInner","Name":"NetInner","Port":30001}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","Port":30002}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","Port":30003}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","Port":30004}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","Port":0}], -[7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","Port":0}], -[8, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","Port":0}], -[200, {"_t":"StartSceneConfig","_id":200,"Process":2,"Zone":2,"SceneType":"Robot","Name":"Robot01","Port":0}], -[400, {"_t":"StartSceneConfig","_id":400,"Process":3,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","Port":30300}], -[401, {"_t":"StartSceneConfig","_id":401,"Process":4,"Zone":3,"SceneType":"Router","Name":"Router01","Port":30301}], -[402, {"_t":"StartSceneConfig","_id":402,"Process":5,"Zone":3,"SceneType":"Router","Name":"Router02","Port":30302}], -[403, {"_t":"StartSceneConfig","_id":403,"Process":6,"Zone":3,"SceneType":"Router","Name":"Router03","Port":30303}], -[404, {"_t":"StartSceneConfig","_id":404,"Process":7,"Zone":3,"SceneType":"Router","Name":"Router04","Port":30304}], -]} diff --git a/Config/Json/cs/StartConfig/RouterTest/StartZoneConfig.txt b/Config/Json/cs/StartConfig/RouterTest/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/cs/StartConfig/RouterTest/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/cs/UnitConfig.txt b/Config/Json/cs/UnitConfig.txt deleted file mode 100644 index c2ce7e58..00000000 --- a/Config/Json/cs/UnitConfig.txt +++ /dev/null @@ -1,6 +0,0 @@ -{"dict": [ -[1001, {"_t":"UnitConfig","_id":1001,"Type":1,"Name":"米克尔","Position":1,"Height":178,"Weight":68}], -[1002, {"_t":"UnitConfig","_id":1002,"Type":1,"Name":"米克尔2","Position":2,"Height":278,"Weight":78}], -[1003, {"_t":"UnitConfig","_id":1003,"Type":1,"Name":"米克尔3","Position":1,"Height":178,"Weight":68}], -[1004, {"_t":"UnitConfig","_id":1004,"Type":1,"Name":"米克尔4","Position":2,"Height":278,"Weight":78}], -]} diff --git a/Config/Json/s/AIConfig.txt b/Config/Json/s/AIConfig.txt deleted file mode 100644 index 149f3a31..00000000 --- a/Config/Json/s/AIConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[101, {"_t":"AIConfig","_id":101,"AIConfigId":1,"Order":1,"Name":"AI_Attack","NodeParams":[]}], -[102, {"_t":"AIConfig","_id":102,"AIConfigId":1,"Order":2,"Name":"AI_XunLuo","NodeParams":[]}], -[201, {"_t":"AIConfig","_id":201,"AIConfigId":2,"Order":1,"Name":"AI_XunLuo","NodeParams":[]}], -]} diff --git a/Config/Json/s/StartConfig/Benchmark/StartMachineConfig.txt b/Config/Json/s/StartConfig/Benchmark/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/s/StartConfig/Benchmark/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/s/StartConfig/Benchmark/StartProcessConfig.txt b/Config/Json/s/StartConfig/Benchmark/StartProcessConfig.txt deleted file mode 100644 index 29edb2b8..00000000 --- a/Config/Json/s/StartConfig/Benchmark/StartProcessConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -[2, {"_t":"StartProcessConfig","_id":2,"MachineId":1}], -[3, {"_t":"StartProcessConfig","_id":3,"MachineId":1}], -]} diff --git a/Config/Json/s/StartConfig/Benchmark/StartSceneConfig.txt b/Config/Json/s/StartConfig/Benchmark/StartSceneConfig.txt deleted file mode 100644 index a99af9b0..00000000 --- a/Config/Json/s/StartConfig/Benchmark/StartSceneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"BenchmarkServer","Name":"BenchmarkServer","Port":30001}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":2,"Zone":1,"SceneType":"BenchmarkClient","Name":"BenchmarkClient1","Port":30002}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":3,"Zone":1,"SceneType":"BenchmarkClient","Name":"BenchmarkClient2","Port":30003}], -]} diff --git a/Config/Json/s/StartConfig/Benchmark/StartZoneConfig.txt b/Config/Json/s/StartConfig/Benchmark/StartZoneConfig.txt deleted file mode 100644 index 3dfc64dd..00000000 --- a/Config/Json/s/StartConfig/Benchmark/StartZoneConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -]} diff --git a/Config/Json/s/StartConfig/Demo/StartMachineConfig.txt b/Config/Json/s/StartConfig/Demo/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/s/StartConfig/Demo/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/s/StartConfig/Demo/StartProcessConfig.txt b/Config/Json/s/StartConfig/Demo/StartProcessConfig.txt deleted file mode 100644 index 17c80583..00000000 --- a/Config/Json/s/StartConfig/Demo/StartProcessConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1,"InnerPort":20101}], -]} diff --git a/Config/Json/s/StartConfig/Demo/StartSceneConfig.txt b/Config/Json/s/StartConfig/Demo/StartSceneConfig.txt deleted file mode 100644 index f18d632f..00000000 --- a/Config/Json/s/StartConfig/Demo/StartSceneConfig.txt +++ /dev/null @@ -1,14 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","OuterPort":30002}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","OuterPort":30003}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","OuterPort":30004}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","OuterPort":0}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","OuterPort":0}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","OuterPort":0}], -[200, {"_t":"StartSceneConfig","_id":200,"Process":1,"Zone":2,"SceneType":"Robot","Name":"Robot01","OuterPort":0}], -[300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","OuterPort":30300}], -[301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","OuterPort":30301}], -[302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","OuterPort":30302}], -[303, {"_t":"StartSceneConfig","_id":303,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router03","OuterPort":30303}], -[304, {"_t":"StartSceneConfig","_id":304,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router04","OuterPort":30304}], -]} diff --git a/Config/Json/s/StartConfig/Demo/StartZoneConfig.txt b/Config/Json/s/StartConfig/Demo/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/s/StartConfig/Demo/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/s/StartConfig/Localhost/StartMachineConfig.txt b/Config/Json/s/StartConfig/Localhost/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/s/StartConfig/Localhost/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/s/StartConfig/Localhost/StartProcessConfig.txt b/Config/Json/s/StartConfig/Localhost/StartProcessConfig.txt deleted file mode 100644 index f3191f44..00000000 --- a/Config/Json/s/StartConfig/Localhost/StartProcessConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -]} diff --git a/Config/Json/s/StartConfig/Localhost/StartSceneConfig.txt b/Config/Json/s/StartConfig/Localhost/StartSceneConfig.txt deleted file mode 100644 index ec4f34d6..00000000 --- a/Config/Json/s/StartConfig/Localhost/StartSceneConfig.txt +++ /dev/null @@ -1,15 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"NetInner","Name":"NetInner","Port":30001}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","Port":30002}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","Port":30003}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","Port":30004}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","Port":0}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Match","Name":"Match","Port":0}], -[7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","Port":0}], -[8, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","Port":0}], -[300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","Port":30300}], -[301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","Port":30301}], -[302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","Port":30302}], -[303, {"_t":"StartSceneConfig","_id":303,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router03","Port":30303}], -[304, {"_t":"StartSceneConfig","_id":304,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router04","Port":30304}], -]} diff --git a/Config/Json/s/StartConfig/Localhost/StartZoneConfig.txt b/Config/Json/s/StartConfig/Localhost/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/s/StartConfig/Localhost/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/s/StartConfig/LockStep/StartMachineConfig.txt b/Config/Json/s/StartConfig/LockStep/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/s/StartConfig/LockStep/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/s/StartConfig/LockStep/StartProcessConfig.txt b/Config/Json/s/StartConfig/LockStep/StartProcessConfig.txt deleted file mode 100644 index 17c80583..00000000 --- a/Config/Json/s/StartConfig/LockStep/StartProcessConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1,"InnerPort":20101}], -]} diff --git a/Config/Json/s/StartConfig/LockStep/StartSceneConfig.txt b/Config/Json/s/StartConfig/LockStep/StartSceneConfig.txt deleted file mode 100644 index 4dd9b627..00000000 --- a/Config/Json/s/StartConfig/LockStep/StartSceneConfig.txt +++ /dev/null @@ -1,17 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","OuterPort":30002}], -[2, {"_t":"StartSceneConfig","_id":2,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","OuterPort":30003}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","OuterPort":30004}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","OuterPort":0}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Match","Name":"Match","OuterPort":0}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","OuterPort":0}], -[7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","OuterPort":0}], -[8, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map3","OuterPort":0}], -[9, {"_t":"StartSceneConfig","_id":9,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map4","OuterPort":0}], -[200, {"_t":"StartSceneConfig","_id":200,"Process":1,"Zone":2,"SceneType":"Robot","Name":"Robot01","OuterPort":0}], -[300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","OuterPort":30300}], -[301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","OuterPort":30301}], -[302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","OuterPort":30302}], -[303, {"_t":"StartSceneConfig","_id":303,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router03","OuterPort":30303}], -[304, {"_t":"StartSceneConfig","_id":304,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router04","OuterPort":30304}], -]} diff --git a/Config/Json/s/StartConfig/LockStep/StartZoneConfig.txt b/Config/Json/s/StartConfig/LockStep/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/s/StartConfig/LockStep/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/s/StartConfig/Release/StartMachineConfig.txt b/Config/Json/s/StartConfig/Release/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/s/StartConfig/Release/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/s/StartConfig/Release/StartProcessConfig.txt b/Config/Json/s/StartConfig/Release/StartProcessConfig.txt deleted file mode 100644 index 29edb2b8..00000000 --- a/Config/Json/s/StartConfig/Release/StartProcessConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -[2, {"_t":"StartProcessConfig","_id":2,"MachineId":1}], -[3, {"_t":"StartProcessConfig","_id":3,"MachineId":1}], -]} diff --git a/Config/Json/s/StartConfig/Release/StartSceneConfig.txt b/Config/Json/s/StartConfig/Release/StartSceneConfig.txt deleted file mode 100644 index ea7cbaf8..00000000 --- a/Config/Json/s/StartConfig/Release/StartSceneConfig.txt +++ /dev/null @@ -1,15 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"NetInner","Name":"NetInner","Port":30001}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","Port":30002}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","Port":30003}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","Port":30004}], -[11, {"_t":"StartSceneConfig","_id":11,"Process":2,"Zone":1,"SceneType":"NetInner","Name":"NetInner2","Port":30011}], -[12, {"_t":"StartSceneConfig","_id":12,"Process":2,"Zone":1,"SceneType":"Location","Name":"Location","Port":0}], -[13, {"_t":"StartSceneConfig","_id":13,"Process":2,"Zone":1,"SceneType":"Map","Name":"Map1","Port":0}], -[14, {"_t":"StartSceneConfig","_id":14,"Process":2,"Zone":1,"SceneType":"Map","Name":"Map2","Port":0}], -[30, {"_t":"StartSceneConfig","_id":30,"Process":3,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","Port":30300}], -[31, {"_t":"StartSceneConfig","_id":31,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router01","Port":30301}], -[32, {"_t":"StartSceneConfig","_id":32,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router02","Port":30302}], -[33, {"_t":"StartSceneConfig","_id":33,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router03","Port":30303}], -[34, {"_t":"StartSceneConfig","_id":34,"Process":3,"Zone":3,"SceneType":"Router","Name":"Router04","Port":30304}], -]} diff --git a/Config/Json/s/StartConfig/Release/StartZoneConfig.txt b/Config/Json/s/StartConfig/Release/StartZoneConfig.txt deleted file mode 100644 index c5f951b3..00000000 --- a/Config/Json/s/StartConfig/Release/StartZoneConfig.txt +++ /dev/null @@ -1,4 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"mongodb://127.0.0.1","DBName":"ET2"}], -]} diff --git a/Config/Json/s/StartConfig/RouterTest/StartMachineConfig.txt b/Config/Json/s/StartConfig/RouterTest/StartMachineConfig.txt deleted file mode 100644 index 788928e2..00000000 --- a/Config/Json/s/StartConfig/RouterTest/StartMachineConfig.txt +++ /dev/null @@ -1,3 +0,0 @@ -{"dict": [ -[1, {"_t":"StartMachineConfig","_id":1,"InnerIP":"127.0.0.1","OuterIP":"127.0.0.1","WatcherPort":"10000"}], -]} diff --git a/Config/Json/s/StartConfig/RouterTest/StartProcessConfig.txt b/Config/Json/s/StartConfig/RouterTest/StartProcessConfig.txt deleted file mode 100644 index 1b8c8a32..00000000 --- a/Config/Json/s/StartConfig/RouterTest/StartProcessConfig.txt +++ /dev/null @@ -1,9 +0,0 @@ -{"dict": [ -[1, {"_t":"StartProcessConfig","_id":1,"MachineId":1}], -[2, {"_t":"StartProcessConfig","_id":2,"MachineId":1}], -[3, {"_t":"StartProcessConfig","_id":3,"MachineId":1}], -[4, {"_t":"StartProcessConfig","_id":4,"MachineId":1}], -[5, {"_t":"StartProcessConfig","_id":5,"MachineId":1}], -[6, {"_t":"StartProcessConfig","_id":6,"MachineId":1}], -[7, {"_t":"StartProcessConfig","_id":7,"MachineId":1}], -]} diff --git a/Config/Json/s/StartConfig/RouterTest/StartSceneConfig.txt b/Config/Json/s/StartConfig/RouterTest/StartSceneConfig.txt deleted file mode 100644 index 7da79356..00000000 --- a/Config/Json/s/StartConfig/RouterTest/StartSceneConfig.txt +++ /dev/null @@ -1,15 +0,0 @@ -{"dict": [ -[1, {"_t":"StartSceneConfig","_id":1,"Process":1,"Zone":1,"SceneType":"NetInner","Name":"NetInner","Port":30001}], -[3, {"_t":"StartSceneConfig","_id":3,"Process":1,"Zone":1,"SceneType":"Realm","Name":"Realm","Port":30002}], -[4, {"_t":"StartSceneConfig","_id":4,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate1","Port":30003}], -[5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Gate","Name":"Gate2","Port":30004}], -[6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Location","Name":"Location","Port":0}], -[7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","Port":0}], -[8, {"_t":"StartSceneConfig","_id":8,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","Port":0}], -[200, {"_t":"StartSceneConfig","_id":200,"Process":2,"Zone":2,"SceneType":"Robot","Name":"Robot01","Port":0}], -[400, {"_t":"StartSceneConfig","_id":400,"Process":3,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","Port":30300}], -[401, {"_t":"StartSceneConfig","_id":401,"Process":4,"Zone":3,"SceneType":"Router","Name":"Router01","Port":30301}], -[402, {"_t":"StartSceneConfig","_id":402,"Process":5,"Zone":3,"SceneType":"Router","Name":"Router02","Port":30302}], -[403, {"_t":"StartSceneConfig","_id":403,"Process":6,"Zone":3,"SceneType":"Router","Name":"Router03","Port":30303}], -[404, {"_t":"StartSceneConfig","_id":404,"Process":7,"Zone":3,"SceneType":"Router","Name":"Router04","Port":30304}], -]} diff --git a/Config/Json/s/StartConfig/RouterTest/StartZoneConfig.txt b/Config/Json/s/StartConfig/RouterTest/StartZoneConfig.txt deleted file mode 100644 index 541aaf32..00000000 --- a/Config/Json/s/StartConfig/RouterTest/StartZoneConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1, {"_t":"StartZoneConfig","_id":1,"DBConnection":"mongodb://127.0.0.1","DBName":"ET1"}], -[2, {"_t":"StartZoneConfig","_id":2,"DBConnection":"","DBName":""}], -[3, {"_t":"StartZoneConfig","_id":3,"DBConnection":"","DBName":""}], -]} diff --git a/Config/Json/s/UnitConfig.txt b/Config/Json/s/UnitConfig.txt deleted file mode 100644 index 32108e0a..00000000 --- a/Config/Json/s/UnitConfig.txt +++ /dev/null @@ -1,5 +0,0 @@ -{"dict": [ -[1001, {"_t":"UnitConfig","_id":1001,"Type":1,"Name":"米克尔","Position":1,"Weight":68}], -[1002, {"_t":"UnitConfig","_id":1002,"Type":1,"Name":"米克尔2","Position":2,"Weight":78}], -[1003, {"_t":"UnitConfig","_id":1003,"Type":1,"Name":"米克尔3","Position":1,"Weight":68}], -]} diff --git a/Config/NLog/NLog.config b/Config/NLog/NLog.config deleted file mode 100644 index bf5638e9..00000000 --- a/Config/NLog/NLog.config +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Config/NLog/NLog.xsd b/Config/NLog/NLog.xsd deleted file mode 100644 index 03e19d65..00000000 --- a/Config/NLog/NLog.xsd +++ /dev/null @@ -1,4054 +0,0 @@ - - - - - - - - - - - - - - - Watch config file for changes and reload automatically. - - - - - Print internal NLog messages to the console. Default value is: false - - - - - - Print internal NLog messages to the console error output. Default value is: false - - - - - - Write internal NLog messages to the specified file. - - - - - Log level threshold for internal log messages. Default value is: Info. - - - - - - Global log level threshold for application log messages. Messages below this level - won't be logged. - - - - - - Throw an exception when there is an internal error. Default value is: false. Not - recommend to set to true in production! - - - - - - Throw an exception when there is a configuration error. If not set, determined by - throwExceptions. - - - - - - Gets or sets a value indicating whether Variables should be kept on configuration - reload. Default value is: false. - - - - - - Write internal NLog messages to the System.Diagnostics.Trace. Default value is: - false. - - - - - - Write timestamps for internal NLog messages. Default value is: true. - - - - - - Use InvariantCulture as default culture instead of CurrentCulture. Default value is: - false. - - - - - - Perform message template parsing and formatting of LogEvent messages (true = Always, - false = Never, empty = Auto Detect). Default value is: empty. - - - - - - - - - - - - - - - Make all targets within this section asynchronous (creates additional threads but the - calling thread isn't blocked by any target writes). - - - - - - - - - - - - - - - - - - Prefix for targets/layout renderers/filters/conditions loaded from this assembly. - - - - - - Load NLog extensions from the specified file (*.dll) - - - - - Load NLog extensions from the specified assembly. Assembly name should be fully - qualified. - - - - - - - - - - - Filter on the name of the logger. May include wildcard characters ('*' or '?'). - - - - - - Comma separated list of levels that this rule matches. - - - - - Minimum level that this rule matches. - - - - - Maximum level that this rule matches. - - - - - Level that this rule matches. - - - - - Comma separated list of target names. - - - - - Ignore further rules if this one matches. - - - - - Enable this rule. Note: disabled rules aren't available from the API. - - - - - - Rule identifier to allow rule lookup with Configuration.FindRuleByName and - Configuration.RemoveRuleByName. - - - - - - - - - - - - - - - - Default action if none of the filters match. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the file to be included. You could use * wildcard. The name is relative to the - name of the current config file. - - - - - - Ignore any errors in the include file. - - - - - - - - Variable value. Note, the 'value' attribute has precedence over this one. - - - - - - - Variable name. - - - - - Variable value. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Number of log events that should be processed in a batch by the lazy writer - thread. - - - - - - Whether to use the locking queue, instead of a lock-free concurrent queue The - locking queue is less concurrent when many logger threads, but reduces memory allocation - - - - - - Limit of full s to write before yielding into Performance is better when - writing many small batches, than writing a single large batch - - - - - - Action to be taken when the lazy writer thread request queue count exceeds the - set limit. - - - - - - Limit on the number of requests in the lazy writer thread request queue. - - - - - - Time in milliseconds to sleep between batches. (1 or less means trigger on new - activity) - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - Delay the flush until the LogEvent has been confirmed as written - - - - - - Condition expression. Log events who meet this condition will cause a flush on - the wrapped target. - - - - - - Only flush when LogEvent matches condition. Ignore explicit-flush, - config-reload-flush and shutdown-flush - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Number of log events to be buffered. - - - - - Timeout (in milliseconds) after which the contents of buffer will be flushed - if there's no write in the specified period of time. Use -1 to disable timed flushes. - - - - - - Action to take if the buffer overflows. - - - - - Indicates whether to use sliding timeout. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Encoding to be used. - - - - - Instance of that is used to format log messages. - - - - - End of line value if a newline is appended at the end of log message . - - - - - - Maximum message size in bytes. - - - - - Indicates whether to append newline at the end of log message. - - - - - - Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only - implemented for TCP. - - - - - - Network address. - - - - - Size of the connection cache (number of connections which are kept alive). - - - - - - The number of seconds a connection will remain idle before the first - keep-alive probe is sent - - - - - - Maximum queue size. - - - - - Maximum current connections. 0 = no maximum. - - - - - Action that should be taken if the will be more connections than . - - - - - - Action that should be taken if the message is larger than maxMessageSize. - - - - - - Indicates whether to keep connection open whenever possible. - - - - - - NDLC item separator. - - - - - Indicates whether to include source info (file name and line number) in the - information sent over the network. - - - - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - - - - - Indicates whether to include NLog-specific extensions to log4j schema. - - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include stack contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include call site (class and method name) in the - information sent over the network. - - - - - - Option to include all properties from the log events - - - - - AppInfo field. By default it's the friendly name of the current AppDomain. - - - - - - NDC item separator. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Layout that should be use to calculate the value for the parameter. - - - - - Viewer parameter name. - - - - - Whether an attribute with empty value should be included in the output - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Indicates whether to auto-check if the console is available. - Disables - console writing if Environment.UserInteractive = False (Windows Service) - Disables console - writing if Console Standard Input is not available (Non-Console-App) - - - - - - Enables output using ANSI Color Codes - - - - - The encoding for writing messages to the . - - - - - Indicates whether the error stream (stderr) should be used instead of the - output stream (stdout). - - - - - - Indicates whether to auto-flush after - - - - - Indicates whether to auto-check if the console has been redirected to file - - Disables coloring logic when System.Console.IsOutputRedirected = true - - - - - - Indicates whether to use default row highlighting rules. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Condition that must be met in order to set the specified foreground and background - color. - - - - - - Background color. - - - - - Foreground color. - - - - - - - - - - - - - - - - - Compile the ? This can improve the performance, but at the costs of more memory usage. - If false, the Regex Cache is used. - - - - - - Condition that must be met before scanning the row for highlight of words - - - - - - Indicates whether to ignore case when comparing texts. - - - - - Regular expression to be matched. You must specify either text or regex. - - - - - - Text to be matched. You must specify either text or regex. - - - - - Indicates whether to match whole words only. - - - - - Background color. - - - - - Foreground color. - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Indicates whether to auto-flush after - - - - - Indicates whether to auto-check if the console is available - Disables console - writing if Environment.UserInteractive = False (Windows Service) - Disables console writing - if Console Standard Input is not available (Non-Console-App) - - - - - - The encoding for writing messages to the . - - - - - Indicates whether to send the log messages to the standard error instead of - the standard output. - - - - - - Whether to enable batch writing using char[]-buffers, instead of using - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Obsolete - value will be ignored! The logging code always runs outside of - transaction. Gets or sets a value indicating whether to use database transactions. Some data - providers require this. - - - - - - Indicates whether to keep the database connection open between the log - events. - - - - - - Name of the database provider. - - - - - Database password. If the ConnectionString is not provided this value will be - used to construct the "Password=" part of the connection string. - - - - - - Database host name. If the ConnectionString is not provided this value will be - used to construct the "Server=" part of the connection string. - - - - - - Database user name. If the ConnectionString is not provided this value will be - used to construct the "User ID=" part of the connection string. - - - - - - Name of the connection string (as specified in <connectionStrings> - configuration section. - - - - - - Connection string. When provided, it overrides the values specified in DBHost, - DBUserName, DBPassword, DBDatabase. - - - - - - Database name. If the ConnectionString is not provided this value will be used - to construct the "Database=" part of the connection string. - - - - - - Connection string using for installation and uninstallation. If not provided, - regular ConnectionString is being used. - - - - - - Configures isolated transaction batch writing. If supported by the database, - then it will improve insert performance. - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - Text of the SQL command to be run on each log level. - - - - - Type of the SQL command to be run on each log level. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Convert format of the property value - - - - - Culture used for parsing property string-value for type-conversion - - - - - Value to assign on the object-property - - - - - Name for the object-property - - - - - Type of the object-property - - - - - - - - - - - - - - Type of the command. - - - - - Connection string to run the command against. If not provided, connection string from - the target is used. - - - - - - Indicates whether to ignore failures. - - - - - Command text. - - - - - - - - - - - - - - - - - - - Database parameter name. - - - - - Layout that should be use to calculate the value for the parameter. - - - - - Database parameter DbType. - - - - - Database parameter size. - - - - - Database parameter precision. - - - - - Database parameter scale. - - - - - Type of the parameter. - - - - - Whether empty value should translate into DbNull. Requires database column to allow - NULL values. - - - - - - Convert format of the database parameter value. - - - - - Culture used for parsing parameter string-value for type-conversion - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Layout that renders event Category. - - - - - Optional entry type. When not set, or when not convertible to then determined - by - - - - - - Layout that renders event ID. - - - - - Name of the Event Log to write to. This can be System, Application or any - user-defined name. - - - - - - Name of the machine on which Event Log service is running. - - - - - Maximum Event log size in kilobytes. - - - - - Message length limit to write to the Event Log. - - - - - Value to be used as the event Source. - - - - - Action to take if the message is larger than the option. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Indicates whether to return to the first target after any successful write. - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - File encoding. - - - - - Line ending mode. - - - - - Maximum days of archive files that should be kept. - - - - - Indicates whether to compress archive files into the zip archive format. - - - - - - Way file archives are numbered. - - - - - Name of the file to be used for an archive. - - - - - Is the an absolute or relative path? - - - - - Indicates whether to automatically archive log files every time the specified - time passes. - - - - - - Size in bytes above which log files will be automatically archived. Warning: - combining this with isn't supported. We cannot create multiple archive files, if they should - have the same name. Choose: - - - - - - Maximum number of archive files that should be kept. - - - - - Indicates whether the footer should be written only when the file is - archived. - - - - - - Maximum number of log file names that should be stored as existing. - - - - - - Indicates whether to delete old log file on startup. - - - - - File attributes (Windows only). - - - - - Indicates whether to create directories if they do not exist. - - - - - - Cleanup invalid values in a filename, e.g. slashes in a filename. If set to - true, this can impact the performance of massive writes. If set to false, nothing gets - written when the filename is wrong. - - - - - - Value of the file size threshold to archive old log file on startup. - - - - - - Indicates whether to archive old log file on startup. - - - - - Value specifying the date format to use when archiving files. - - - - - - Indicates whether to enable log file(s) to be deleted. - - - - - Indicates whether to write BOM (byte order mark) in created files - - - - - - Indicates whether to replace file contents on each write instead of appending - log message at the end. - - - - - - Indicates whether file creation calls should be synchronized by a system - global mutex. - - - - - - Gets or set a value indicating whether a managed file stream is forced, - instead of using the native implementation. - - - - - - Is the an absolute or relative path? - - - - - Name of the file to write to. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - Indicates whether concurrent writes to the log file by multiple processes on - different network hosts. - - - - - - Maximum number of seconds that files are kept open. If this number is negative - the files are not automatically closed after a period of inactivity. - - - - - - Number of files to be kept open. Setting this to a higher value may improve - performance in a situation where a single File target is writing to many files (such as - splitting by level or by logger). - - - - - - Indicates whether to keep log file open instead of opening and closing it on - each logging event. - - - - - - Whether or not this target should just discard all data that its asked to - write. Mostly used for when testing NLog Stack except final write - - - - - - Indicates whether concurrent writes to the log file by multiple processes on - the same host. - - - - - - Number of times the write is appended on the file before NLog discards the log - message. - - - - - - Delay in milliseconds to wait before attempting to write to the file again. - - - - - - Log file buffer size in bytes. - - - - - Maximum number of seconds before open files are flushed. If this number is - negative or zero the files are not flushed by timer. - - - - - - Indicates whether to automatically flush the file buffers after each log - message. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Condition expression. Log events who meet this condition will be forwarded to - the wrapped target. - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Windows domain name to change context to. - - - - - Required impersonation level. - - - - - Type of the logon provider. - - - - - Logon Type. - - - - - User account password. - - - - - Indicates whether to revert to the credentials of the process instead of - impersonating another user. - - - - - - Username to change context to. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Interval in which messages will be written up to the number of messages. - - - - - - Maximum allowed number of messages written per . - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Endpoint address. - - - - - Name of the endpoint configuration in WCF configuration file. - - - - - - Indicates whether to use a WCF service contract that is one way (fire and - forget) or two way (request-reply) - - - - - - Client ID. - - - - - Indicates whether to include per-event properties in the payload sent to the - server. - - - - - - Indicates whether to use binary message encoding. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - Layout that should be use to calculate the value for the parameter. - - - - - Name of the parameter. - - - - - Type of the parameter. - - - - - Type of the parameter. Obsolete alias for - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Text to be rendered. - - - - - Header. - - - - - Footer. - - - - - Indicates whether NewLine characters in the body should be replaced with - tags. - - - - - - Priority used for sending mails. - - - - - Encoding to be used for sending e-mail. - - - - - BCC email addresses separated by semicolons (e.g. - john@domain.com;jane@domain.com). - - - - - - CC email addresses separated by semicolons (e.g. - john@domain.com;jane@domain.com). - - - - - - Indicates whether to add new lines between log entries. - - - - - Indicates whether to send message as HTML instead of plain text. - - - - - - Sender's email address (e.g. joe@domain.com). - - - - - Mail message body (repeated for each log message send in one mail). - - - - - - Mail subject. - - - - - Recipients' email addresses separated by semicolons (e.g. - john@domain.com;jane@domain.com). - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - Indicates the SMTP client timeout. - - - - - SMTP Server to be used for sending. - - - - - SMTP Authentication mode. - - - - - Username used to connect to SMTP server (used when SmtpAuthentication is set - to "basic"). - - - - - - Password used to authenticate against SMTP server (used when - SmtpAuthentication is set to "basic"). - - - - - - Indicates whether SSL (secure sockets layer) should be used when communicating - with SMTP server. - - - - - - Port number that SMTP Server is listening on. - - - - - Indicates whether the default Settings from System.Net.MailSettings should be - used. - - - - - - Folder where applications save mail messages to be processed by the local SMTP - server. - - - - - - Specifies how outgoing email messages will be handled. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Max number of items to have in memory - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Class name. - - - - - Method name. The method must be public and static. Use the - AssemblyQualifiedName , - https://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname(v=vs.110).aspx - e.g. - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Encoding to be used. - - - - - End of line value if a newline is appended at the end of log message . - - - - - - Maximum message size in bytes. - - - - - Indicates whether to append newline at the end of log message. - - - - - - Network address. - - - - - Size of the connection cache (number of connections which are kept alive). - - - - - - The number of seconds a connection will remain idle before the first - keep-alive probe is sent - - - - - - Indicates whether to keep connection open whenever possible. - - - - - - Maximum current connections. 0 = no maximum. - - - - - Maximum queue size. - - - - - Action that should be taken if the will be more connections than . - - - - - - Action that should be taken if the message is larger than maxMessageSize. - - - - - - Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only - implemented for TCP. - - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Encoding to be used. - - - - - Instance of that is used to format log messages. - - - - - End of line value if a newline is appended at the end of log message . - - - - - - Maximum message size in bytes. - - - - - Indicates whether to append newline at the end of log message. - - - - - - Get or set the SSL/TLS protocols. Default no SSL/TLS is used. Currently only - implemented for TCP. - - - - - - Network address. - - - - - Size of the connection cache (number of connections which are kept alive). - - - - - - The number of seconds a connection will remain idle before the first - keep-alive probe is sent - - - - - - Maximum queue size. - - - - - Maximum current connections. 0 = no maximum. - - - - - Action that should be taken if the will be more connections than . - - - - - - Action that should be taken if the message is larger than maxMessageSize. - - - - - - Indicates whether to keep connection open whenever possible. - - - - - - NDLC item separator. - - - - - Indicates whether to include source info (file name and line number) in the - information sent over the network. - - - - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - - - - - Indicates whether to include NLog-specific extensions to log4j schema. - - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include stack contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include dictionary contents. - - - - - Indicates whether to include call site (class and method name) in the - information sent over the network. - - - - - - Option to include all properties from the log events - - - - - AppInfo field. By default it's the friendly name of the current AppDomain. - - - - - - NDC item separator. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Indicates whether to perform layout calculation. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Indicates whether performance counter should be automatically created. - - - - - - Name of the performance counter category. - - - - - Counter help text. - - - - - Name of the performance counter. - - - - - Performance counter type. - - - - - The value by which to increment the counter. - - - - - Performance counter instance name. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Default filter to be applied when no specific rule matches. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - Condition to be tested. - - - - - Resulting filter to be applied when the condition matches. - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - Number of times to repeat each log message. - - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - Number of retries that should be attempted on the wrapped target in case of a - failure. - - - - - - Time to wait between retries in milliseconds. - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Layout used to format log messages. - - - - - Forward to (Instead of ) - - - - - Always use independent of - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name of the target. - - - - - Target supports reuse of internal buffers, and doesn't have to constantly - allocate new buffers Required for legacy NLog-targets, that expects buffers to remain stable - after Write-method exit - - - - - - Should we include the BOM (Byte-order-mark) for UTF? Influences the property. - This will only work for UTF-8. - - - - - - Web service method name. Only used with Soap. - - - - - Web service namespace. Only used with Soap. - - - - - Protocol to be used when calling web service. - - - - - Custom proxy address, include port separated by a colon - - - - - Encoding. - - - - - Web service URL. - - - - - Value whether escaping be done according to the old NLog style (Very - non-standard) - - - - - - Value whether escaping be done according to Rfc3986 (Supports - Internationalized Resource Identifiers - IRIs) - - - - - - Indicates whether to pre-authenticate the HttpWebRequest (Requires - 'Authorization' in parameters) - - - - - - Name of the root XML element, if POST of XML document chosen. If so, this - property must not be null. (see and ). - - - - - - (optional) root namespace of the XML document, if POST of XML document chosen. - (see and ). - - - - - - Proxy configuration when calling web service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Footer layout. - - - - - Header layout. - - - - - Body layout (can be repeated multiple times). - - - - - Custom column delimiter value (valid when ColumnDelimiter is set to - 'Custom'). - - - - - - Column delimiter. - - - - - Quote Character. - - - - - Quoting mode. - - - - - Indicates whether CVS should include header. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Layout of the column. - - - - - Name of the column. - - - - - Override of Quoting mode - - - - - - - - - - - - - - - - - - - - - - Should forward slashes be escaped? If true, / will be converted to \/ - - - - - - Option to render the empty object value {} - - - - - Option to suppress the extra spaces in the output json - - - - - Option to exclude null/empty properties from the log event (as JSON) - - - - - - List of property names to exclude when is true - - - - - Option to include all properties from the log event (as JSON) - - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - How far should the JSON serializer follow object references before backing - off - - - - - - - - - - - - - - - - - - Layout that will be rendered as the attribute's value. - - - - - Name of the attribute. - - - - - Determines whether or not this attribute will be Json encoded. - - - - - Should forward slashes be escaped? If true, / will be converted to \/ - - - - - - Indicates whether to escape non-ascii characters - - - - - Whether an attribute with empty value should be included in the output - - - - - - - - - - - - - - - Footer layout. - - - - - Header layout. - - - - - Body layout (can be repeated multiple times). - - - - - - - - - - - - - - - - - - - - - Option to include all properties from the log events - - - - - Indicates whether to include call site (class and method name) in the - information sent over the network. - - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include contents of the stack. - - - - - Indicates whether to include source info (file name and line number) in the - information sent over the network. - - - - - - - - - - - - - - - Layout text. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - List of property names to exclude when is true - - - - - Option to include all properties from the log event (as XML) - - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - How far should the XML serializer follow object references before backing - off - - - - - - XML element name to use for rendering IList-collections items - - - - - - XML attribute name to use when rendering property-key When null (or empty) - then key-attribute is not included - - - - - - XML element name to use when rendering properties - - - - - XML attribute name to use when rendering property-value When null (or empty) - then value-attribute is not included and value is formatted as XML-element-value - - - - - - Name of the root XML element - - - - - Value inside the root XML element - - - - - Whether a ElementValue with empty value should be included in the output - - - - - - Auto indent and create new lines - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - - - - - - - - - - - - Layout that will be rendered as the attribute's value. - - - - - Name of the attribute. - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - Whether an attribute with empty value should be included in the output - - - - - - - - - - - - - - - - - - - - - - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - Name of the element - - - - - Value inside the element - - - - - Whether a ElementValue with empty value should be included in the output - - - - - - Auto indent and create new lines - - - - - List of property names to exclude when is true - - - - - Option to include all properties from the log event (as XML) - - - - - Indicates whether to include contents of the dictionary. - - - - - Indicates whether to include contents of the dictionary. - - - - - How far should the XML serializer follow object references before backing off - - - - - - XML element name to use for rendering IList-collections items - - - - - XML attribute name to use when rendering property-key When null (or empty) then - key-attribute is not included - - - - - - XML element name to use when rendering properties - - - - - XML attribute name to use when rendering property-value When null (or empty) then - value-attribute is not included and value is formatted as XML-element-value - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Condition expression. - - - - - - - - - - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - Substring to be matched. - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - String to compare the layout to. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - Substring to be matched. - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - String to compare the layout to. - - - - - Indicates whether to ignore case when comparing strings. - - - - - Layout to be used to filter log messages. - - - - - - - - - - - - - - - - - - - - - - - - Action to be taken when filter matches. - - - - - Default number of unique filter values to expect, will automatically increase - if needed - - - - - - Applies the configured action to the initial logevent that starts the timeout - period. Used to configure that it should ignore all events until timeout. - - - - - - Layout to be used to filter log messages. - - - - - Max number of unique filter values to expect simultaneously - - - - - Max length of filter values, will truncate if above limit - - - - - How long before a filter expires, and logging is accepted again - - - - - - Default buffer size for the internal buffers - - - - - Reuse internal buffers, and doesn't have to constantly allocate new buffers - - - - - - Append FilterCount to the when an event is no longer filtered - - - - - - Insert FilterCount value into when an event is no longer filtered - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Config/Recast/Map1 b/Config/Recast/Map1 deleted file mode 100644 index 02b5c8cb..00000000 Binary files a/Config/Recast/Map1 and /dev/null differ diff --git a/Config/Recast/Map2 b/Config/Recast/Map2 deleted file mode 100644 index 02b5c8cb..00000000 Binary files a/Config/Recast/Map2 and /dev/null differ diff --git a/DotNet/App/DotNet.App.csproj b/DotNet/App/DotNet.App.csproj deleted file mode 100644 index 3f613b38..00000000 --- a/DotNet/App/DotNet.App.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - Exe - net7.0 - ET - 11 - App - - - - false - en - - - - DOTNET - ..\..\Bin\ - true - true - - - - DOTNET - ..\..\Bin\ - true - true - - - - - - - diff --git a/DotNet/App/Program.cs b/DotNet/App/Program.cs deleted file mode 100644 index fbde2546..00000000 --- a/DotNet/App/Program.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Threading; - -namespace ET -{ - public static class Program - { - public static void Main() - { - Entry.Init(); - Init init = new(); - init.Start(); - while (true) - { - Thread.Sleep(1); - try - { - init.Update(); - init.LateUpdate(); - } - catch (Exception e) - { - Log.Error(e); - } - } - // ReSharper disable once FunctionNeverReturns - } - } -} \ No newline at end of file diff --git a/DotNet/Core/DotNet.Core.csproj b/DotNet/Core/DotNet.Core.csproj deleted file mode 100644 index 19fc1a56..00000000 --- a/DotNet/Core/DotNet.Core.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - net7.0 - enable - disable - Core - ET - - - - false - en - - - - true - DOTNET - ..\..\Bin\ - true - false - - - - true - DOTNET - ..\..\Bin\ - true - - - - - Core\%(RecursiveDir)%(FileName)%(Extension) - - - - - - - - - - - - Core\Fiber\Module\Console - - - Core\World\Module\Console - - - - diff --git a/DotNet/Hotfix/DotNet.Hotfix.csproj b/DotNet/Hotfix/DotNet.Hotfix.csproj deleted file mode 100644 index 30725389..00000000 --- a/DotNet/Hotfix/DotNet.Hotfix.csproj +++ /dev/null @@ -1,48 +0,0 @@ - - - net7.0 - ET - 11 - Hotfix - - - false - en - - - DOTNET - ..\..\Bin\ - true - - - DOTNET - ..\..\Bin\ - true - false - true - - - - - Client\%(RecursiveDir)%(FileName)%(Extension) - - - - Server\%(RecursiveDir)%(FileName)%(Extension) - - - - Share\%(RecursiveDir)%(FileName)%(Extension) - - - - - - - - - - - - - \ No newline at end of file diff --git a/DotNet/Loader/CodeLoader.cs b/DotNet/Loader/CodeLoader.cs deleted file mode 100644 index ca3b707c..00000000 --- a/DotNet/Loader/CodeLoader.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Runtime.Loader; - -namespace ET -{ - - public class CodeLoader: Singleton, ISingletonAwake - { - private AssemblyLoadContext assemblyLoadContext; - - private Assembly model; - - public void Awake() - { - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - foreach (Assembly assembly in assemblies) - { - if (assembly.GetName().Name == "Model") - { - this.model = assembly; - break; - } - } - this.LoadHotfix(); - - IStaticMethod start = new StaticMethod(this.model, "ET.Entry", "Start"); - start.Run(); - } - - public void LoadHotfix() - { - assemblyLoadContext?.Unload(); - GC.Collect(); - assemblyLoadContext = new AssemblyLoadContext("Hotfix", true); - byte[] dllBytes = File.ReadAllBytes("./Hotfix.dll"); - byte[] pdbBytes = File.ReadAllBytes("./Hotfix.pdb"); - Assembly hotfixAssembly = assemblyLoadContext.LoadFromStream(new MemoryStream(dllBytes), new MemoryStream(pdbBytes)); - - Dictionary types = AssemblyHelper.GetAssemblyTypes(Assembly.GetEntryAssembly(), typeof(Init).Assembly, typeof (Fiber).Assembly, this.model, hotfixAssembly); - - World.Instance.AddSingleton>(types); - - World.Instance.Load(); - } - } -} \ No newline at end of file diff --git a/DotNet/Loader/ConfigLoader.cs b/DotNet/Loader/ConfigLoader.cs deleted file mode 100644 index da35ac6c..00000000 --- a/DotNet/Loader/ConfigLoader.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace ET -{ - [Invoke] - public class GetAllConfigBytes: AInvokeHandler> - { - public override Dictionary Handle(ConfigComponent.GetAllConfigBytes args) - { - Dictionary output = new Dictionary(); - List startConfigs = new List() - { - "StartMachineConfigCategory", - "StartProcessConfigCategory", - "StartSceneConfigCategory", - "StartZoneConfigCategory", - }; - HashSet configTypes = EventSystem.Instance.GetTypes(typeof (ConfigAttribute)); - foreach (Type configType in configTypes) - { - string configFilePath; - if (startConfigs.Contains(configType.Name)) - { - configFilePath = $"../Config/Excel/s/{Options.Instance.StartConfig}/{configType.Name}.bytes"; - } - else - { - configFilePath = $"../Config/Excel/s/{configType.Name}.bytes"; - } - output[configType] = File.ReadAllBytes(configFilePath); - } - - return output; - } - } - - [Invoke] - public class GetOneConfigBytes: AInvokeHandler - { - public override byte[] Handle(ConfigComponent.GetOneConfigBytes args) - { - byte[] configBytes = File.ReadAllBytes($"../Config/Excel/s/{args.ConfigName}.bytes"); - return configBytes; - } - } -} \ No newline at end of file diff --git a/DotNet/Loader/DotNet.Loader.csproj b/DotNet/Loader/DotNet.Loader.csproj deleted file mode 100644 index ec9de1ad..00000000 --- a/DotNet/Loader/DotNet.Loader.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - net7.0 - ET - 11 - Loader - - - false - en - - - DOTNET - ..\..\Bin\ - true - true - false - - - DOTNET - ..\..\Bin\ - true - true - true - - - - - - - - - - - \ No newline at end of file diff --git a/DotNet/Loader/Init.cs b/DotNet/Loader/Init.cs deleted file mode 100644 index 054563cd..00000000 --- a/DotNet/Loader/Init.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Threading; -using CommandLine; - -namespace ET -{ - public class Init - { - public void Start() - { - try - { - AppDomain.CurrentDomain.UnhandledException += (sender, e) => - { - Log.Error(e.ExceptionObject.ToString()); - }; - - // 命令行参数 - Parser.Default.ParseArguments(System.Environment.GetCommandLineArgs()) - .WithNotParsed(error => throw new Exception($"命令行格式错误! {error}")) - .WithParsed((o)=>World.Instance.AddSingleton(o)); - World.Instance.AddSingleton().ILog = new NLogger(Options.Instance.AppType.ToString(), Options.Instance.Process, "../Config/NLog/NLog.config"); - ETTask.ExceptionHandler += Log.Error; - World.Instance.AddSingleton(); - } - catch (Exception e) - { - Log.Error(e); - } - } - - public void Update() - { - FiberManager.Instance.Update(); - } - - public void LateUpdate() - { - FiberManager.Instance.LateUpdate(); - } - } -} diff --git a/DotNet/Loader/RecastFileReader.cs b/DotNet/Loader/RecastFileReader.cs deleted file mode 100644 index 0fb0415f..00000000 --- a/DotNet/Loader/RecastFileReader.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.IO; - -namespace ET -{ - [Invoke] - public class RecastFileReader: AInvokeHandler - { - public override byte[] Handle(NavmeshComponent.RecastFileLoader args) - { - return File.ReadAllBytes(Path.Combine("../Config/Recast", args.Name)); - } - } -} \ No newline at end of file diff --git a/DotNet/Model/DotNet.Model.csproj b/DotNet/Model/DotNet.Model.csproj deleted file mode 100644 index 20a8e8ec..00000000 --- a/DotNet/Model/DotNet.Model.csproj +++ /dev/null @@ -1,54 +0,0 @@ - - - net7.0 - ET - 11 - Model - - - false - en - - - DOTNET - ..\..\Bin\ - true - true - false - - - DOTNET - ..\..\Bin\ - true - true - true - - - - - Server\%(RecursiveDir)%(FileName)%(Extension) - - - - Client\%(RecursiveDir)%(FileName)%(Extension) - - - - Share\%(RecursiveDir)%(FileName)%(Extension) - - - - Generate\%(RecursiveDir)%(FileName)%(Extension) - - - - - - - - - - - - - \ No newline at end of file