From 30b147abb1879c6cbdd4b7ba1e6476a4db1a53b7 Mon Sep 17 00:00:00 2001 From: tanghai Date: Tue, 13 Apr 2021 23:02:24 +0800 Subject: [PATCH] =?UTF-8?q?ai=E6=A1=86=E6=9E=B6=E6=8F=90=E4=BA=A4=EF=BC=8C?= =?UTF-8?q?=E9=99=84=E5=B8=A6=E4=B8=80=E4=B8=AA=E5=B0=8F=E4=BE=8B=E5=AD=90?= =?UTF-8?q?=EF=BC=8C=E7=99=BB=E5=BD=95=E8=BF=9B=E6=B8=B8=E6=88=8F=EF=BC=8C?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=B7=A1=E9=80=BB?= =?UTF-8?q?10=E7=A7=92=EF=BC=8C=E5=81=9C=E4=B8=8B=E6=9D=A5=E6=94=BB?= =?UTF-8?q?=E5=87=BB5=E7=A7=92=EF=BC=8C=E7=84=B6=E5=90=8E=E5=86=8D?= =?UTF-8?q?=E5=B7=A1=E9=80=BB10=E7=A7=92=EF=BC=8C=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E4=B8=8B=E5=8E=BB=20=E6=B3=A8=E6=84=8FAIConf?= =?UTF-8?q?ig=E8=A1=A8=E4=B8=AD=EF=BC=8C=E6=AF=8F=E4=B8=AAai=E6=98=AF?= =?UTF-8?q?=E4=B8=80=E4=B8=AAsheet=EF=BC=8C=E8=A1=A8=E4=B8=AD=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E9=85=8D=E7=BD=AE=E5=A4=9A=E4=B8=AAai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Client-Server.sln.DotSettings | 1 + Config/AIConfigCategory.bytes | 4 + Excel/AIConfig.xlsx | Bin 0 -> 10331 bytes Excel/StartSceneConfig.xlsx | Bin 9424 -> 9406 bytes Proto/OuterMessage.proto | 11 ++- .../Demo/C2M_PathfindingResultHandler.cs | 2 +- Server/Hotfix/Demo/C2M_StopHandler.cs | 15 +++ Server/Hotfix/Demo/Move/MoveHelper.cs | 57 ++++++----- Server/Hotfix/Server.Hotfix.csproj | 6 +- Server/Model/Generate/Config/AIConfig.cs | 91 ++++++++++++++++++ Server/Model/Generate/Message/OuterMessage.cs | 17 +++- Server/Model/Generate/Message/OuterOpcode.cs | 35 +++---- Server/Model/Server.Model.csproj | 4 + Tools/ExcelExporter/ProtoObject.cs | 6 -- .../Bundles/Config/AIConfigCategory.bytes | 4 + .../Config/AIConfigCategory.bytes.meta | 7 ++ Unity/Assets/Hotfix/Demo/AI.meta | 8 ++ Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs | 45 +++++++++ Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs.meta | 11 +++ Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs | 42 ++++++++ Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs.meta | 11 +++ .../Demo/AI/XunLuoPathComponentSystem.cs | 17 ++++ .../Demo/AI/XunLuoPathComponentSystem.cs.meta | 11 +++ Unity/Assets/Hotfix/Demo/MapHelper.cs | 4 + Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs | 4 +- Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs | 4 + Unity/Assets/Hotfix/Module/AI.meta | 8 ++ .../Hotfix/Module/AI/AIComponentSystem.cs | 80 +++++++++++++++ .../Module/AI/AIComponentSystem.cs.meta | 11 +++ .../Module/AI/AIDispatcherComponentSystem.cs | 55 +++++++++++ .../AI/AIDispatcherComponentSystem.cs.meta | 11 +++ Unity/Assets/HotfixView/AppStart_Init.cs | 2 + .../HotfixView/Opera/OperaComponentSystem.cs | 17 ---- Unity/Assets/HotfixView/Scene/SceneFactory.cs | 1 + Unity/Assets/Model/Core/Object/Object.cs | 2 +- Unity/Assets/Model/Demo/AI.meta | 8 ++ .../Model/Demo/AI/XunLuoPathComponent.cs | 11 +++ .../Model/Demo/AI/XunLuoPathComponent.cs.meta | 11 +++ .../Assets/Model/Generate/Config/AIConfig.cs | 91 ++++++++++++++++++ .../Model/Generate/Config/AIConfig.cs.meta | 11 +++ .../Model/Generate/Message/OuterMessage.cs | 17 +++- .../Model/Generate/Message/OuterOpcode.cs | 35 +++---- Unity/Assets/Model/Module/AI.meta | 8 ++ Unity/Assets/Model/Module/AI/AAIHandler.cs | 18 ++++ .../Assets/Model/Module/AI/AAIHandler.cs.meta | 11 +++ Unity/Assets/Model/Module/AI/AIComponent.cs | 14 +++ .../Model/Module/AI/AIComponent.cs.meta | 11 +++ Unity/Assets/Model/Module/AI/AIConfig.cs | 35 +++++++ Unity/Assets/Model/Module/AI/AIConfig.cs.meta | 11 +++ .../Model/Module/AI/AIDispatcherComponent.cs | 11 +++ .../Module/AI/AIDispatcherComponent.cs.meta | 11 +++ .../Model/Module/Message/OpcodeHelper.cs | 3 +- Unity/Packages/packages-lock.json | 2 +- Unity/ProjectSettings/ProjectVersion.txt | 4 +- 54 files changed, 823 insertions(+), 104 deletions(-) create mode 100644 Config/AIConfigCategory.bytes create mode 100644 Excel/AIConfig.xlsx create mode 100644 Server/Hotfix/Demo/C2M_StopHandler.cs create mode 100644 Server/Model/Generate/Config/AIConfig.cs create mode 100644 Unity/Assets/Bundles/Config/AIConfigCategory.bytes create mode 100644 Unity/Assets/Bundles/Config/AIConfigCategory.bytes.meta create mode 100644 Unity/Assets/Hotfix/Demo/AI.meta create mode 100644 Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs create mode 100644 Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs.meta create mode 100644 Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs create mode 100644 Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs.meta create mode 100644 Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs create mode 100644 Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs.meta create mode 100644 Unity/Assets/Hotfix/Module/AI.meta create mode 100644 Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs create mode 100644 Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs.meta create mode 100644 Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs create mode 100644 Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs.meta create mode 100644 Unity/Assets/Model/Demo/AI.meta create mode 100644 Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs create mode 100644 Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs.meta create mode 100644 Unity/Assets/Model/Generate/Config/AIConfig.cs create mode 100644 Unity/Assets/Model/Generate/Config/AIConfig.cs.meta create mode 100644 Unity/Assets/Model/Module/AI.meta create mode 100644 Unity/Assets/Model/Module/AI/AAIHandler.cs create mode 100644 Unity/Assets/Model/Module/AI/AAIHandler.cs.meta create mode 100644 Unity/Assets/Model/Module/AI/AIComponent.cs create mode 100644 Unity/Assets/Model/Module/AI/AIComponent.cs.meta create mode 100644 Unity/Assets/Model/Module/AI/AIConfig.cs create mode 100644 Unity/Assets/Model/Module/AI/AIConfig.cs.meta create mode 100644 Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs create mode 100644 Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs.meta diff --git a/Client-Server.sln.DotSettings b/Client-Server.sln.DotSettings index 4ab0dc67..02f4a9b2 100644 --- a/Client-Server.sln.DotSettings +++ b/Client-Server.sln.DotSettings @@ -404,6 +404,7 @@ II.2.12 <HandlesEvent /> True True True + True True True True diff --git a/Config/AIConfigCategory.bytes b/Config/AIConfigCategory.bytes new file mode 100644 index 00000000..79b9eb47 --- /dev/null +++ b/Config/AIConfigCategory.bytes @@ -0,0 +1,4 @@ + +e" AI_Attack +f" AI_XunLuo +" AI_XunLuo \ No newline at end of file diff --git a/Excel/AIConfig.xlsx b/Excel/AIConfig.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..26315397a01b839847f215128a6e1f96063dbbf9 GIT binary patch literal 10331 zcma)iWmsIxvNrAn_u%dt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z|GGG$XA|v03fgR!3ORK9)-JdADwA+dYRi7)<6CX>@J>v2{|n=qXvmkvp)HNkvhB?+ zxw03|p9zvEKe)cC$ugOaU9HUOlnq7V(f;*^FdCb0k zGp1FipMF~EYu=yZua?7`tYY1tZonns*I8B2O=l|qm$>JU=6MW&1X|~GCL|C5p!{`~ zzpVbL8^+h;k?R8w4_EY4cehylz{5^S)^{fBDyC#EROp=$t%PHv<~v$-Ggbja(<8xY znZ4~+#@Bn36#oOM8>D-cw>5|u2E2mBXkZea=C1r3H;d8u!?acfK`Ae><|kJ~k1r-x zZA@nwZ+9+Gnn45{4Mc3Jh?*9oJ{r2L|XZ4fu4qKR$amalBl^c`_Huwsi)%UV2g}GOASU_=deV%7Cqf zuPQPr$#aiIv#7Qu-GSDAzq-#IE7>$F_I*iK1v@4tW~Kgzsq6=PPL1Ut$tLw|4W_>| z!yO6b{K3xRjOyqtAjP`u40SonH7RRK=!VDFB>wL85n#29cIQ{+hB%Vm3iref5I(Dr zym-yQKnQV=9}9d&yeM!DSVF`J5dT{eeicxJ{40~r|H2#m7v{@<^S=fJ@c)f-L^K== zyh!wbO9F?9d2l(J185Q-FL4hp3S1(>5Gct1hzUag;Nri7f9=0!>4`Q7MW8V86+#Yp kn@B+jLH_?b|F>6~$bnP>qKSCq4WKzO7AZzY;{Uh$ANO(c!T + { + protected override async ETTask Run(Unit unit, C2M_Stop message) + { + unit.Stop(0); + await ETTask.CompletedTask; + } + } +} \ No newline at end of file diff --git a/Server/Hotfix/Demo/Move/MoveHelper.cs b/Server/Hotfix/Demo/Move/MoveHelper.cs index 6efa9327..908e9fb3 100644 --- a/Server/Hotfix/Demo/Move/MoveHelper.cs +++ b/Server/Hotfix/Demo/Move/MoveHelper.cs @@ -9,43 +9,48 @@ namespace ET public static async ETTask FindPathMoveToAsync(this Unit unit, Vector3 target, ETCancellationToken cancellationToken = null) { float speed = unit.GetComponent().GetAsFloat(NumericType.Speed); - if (speed < 0.001) + if (speed < 0.01) { unit.SendStop(-1); return; } + + using var list = ListComponent.Create(); - using (var list = ListComponent.Create()) - { - unit.Domain.GetComponent().SearchPath(10001, unit.Position, target, list.List); + unit.Domain.GetComponent().SearchPath(10001, unit.Position, target, list.List); - List path = list.List; - if (path.Count < 2) - { - unit.SendStop(-2); - return; - } + List path = list.List; + if (path.Count < 2) + { + unit.SendStop(0); + return; + } - // 广播寻路路径 - M2C_PathfindingResult m2CPathfindingResult = new M2C_PathfindingResult(); - m2CPathfindingResult.Id = unit.Id; - for (int i = 0; i < list.List.Count; ++i) - { - Vector3 vector3 = list.List[i]; - m2CPathfindingResult.Xs.Add(vector3.x); - m2CPathfindingResult.Ys.Add(vector3.y); - m2CPathfindingResult.Zs.Add(vector3.z); - } - MessageHelper.Broadcast(unit, m2CPathfindingResult); + // 广播寻路路径 + M2C_PathfindingResult m2CPathfindingResult = new M2C_PathfindingResult(); + m2CPathfindingResult.Id = unit.Id; + for (int i = 0; i < list.List.Count; ++i) + { + Vector3 vector3 = list.List[i]; + m2CPathfindingResult.Xs.Add(vector3.x); + m2CPathfindingResult.Ys.Add(vector3.y); + m2CPathfindingResult.Zs.Add(vector3.z); + } + MessageHelper.Broadcast(unit, m2CPathfindingResult); - bool ret = await unit.GetComponent().MoveToAsync(path, speed); - if (ret) // 如果返回false,说明被其它移动取消了,这时候不需要通知客户端stop - { - unit.SendStop(0); - } + bool ret = await unit.GetComponent().MoveToAsync(path, speed); + if (ret) // 如果返回false,说明被其它移动取消了,这时候不需要通知客户端stop + { + unit.SendStop(0); } } + public static void Stop(this Unit unit, int error) + { + unit.GetComponent().Stop(); + unit.SendStop(error); + } + public static void SendStop(this Unit unit, int error) { MessageHelper.Broadcast(unit, new M2C_Stop() diff --git a/Server/Hotfix/Server.Hotfix.csproj b/Server/Hotfix/Server.Hotfix.csproj index 859ce6b8..eccacdd8 100644 --- a/Server/Hotfix/Server.Hotfix.csproj +++ b/Server/Hotfix/Server.Hotfix.csproj @@ -47,8 +47,10 @@ Module\Numeric\NumericWatcher_Hp_ShowUI.cs - - + + + Module\AI\%(RecursiveDir)%(FileName)%(Extension) + diff --git a/Server/Model/Generate/Config/AIConfig.cs b/Server/Model/Generate/Config/AIConfig.cs new file mode 100644 index 00000000..32582834 --- /dev/null +++ b/Server/Model/Generate/Config/AIConfig.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using MongoDB.Bson.Serialization.Attributes; +using ProtoBuf; + +namespace ET +{ + [ProtoContract] + [Config] + public partial class AIConfigCategory : ProtoObject + { + public static AIConfigCategory Instance; + + [ProtoIgnore] + [BsonIgnore] + private Dictionary dict = new Dictionary(); + + [BsonElement] + [ProtoMember(1)] + private List list = new List(); + + public AIConfigCategory() + { + Instance = this; + } + + [ProtoAfterDeserialization] + public void AfterDeserialization() + { + foreach (AIConfig config in list) + { + this.dict.Add(config.Id, config); + } + list.Clear(); + this.EndInit(); + } + + 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; + } + } + + [ProtoContract] + public partial class AIConfig: ProtoObject, IConfig + { + [ProtoMember(1, IsRequired = true)] + public int Id { get; set; } + [ProtoMember(2, IsRequired = true)] + public int AIConfigId { get; set; } + [ProtoMember(3, IsRequired = true)] + public int Order { get; set; } + [ProtoMember(4, IsRequired = true)] + public string Name { get; set; } + [ProtoMember(5, IsRequired = true)] + public int[] NodeParams { get; set; } + + + [ProtoAfterDeserialization] + public void AfterDeserialization() + { + this.EndInit(); + } + } +} diff --git a/Server/Model/Generate/Message/OuterMessage.cs b/Server/Model/Generate/Message/OuterMessage.cs index 60737c7d..5fd73193 100644 --- a/Server/Model/Generate/Message/OuterMessage.cs +++ b/Server/Model/Generate/Message/OuterMessage.cs @@ -140,7 +140,7 @@ namespace ET [ProtoMember(93)] public long ActorId { get; set; } - [ProtoMember(1)] + [ProtoMember(2)] public List Units = new List(); } @@ -155,9 +155,6 @@ namespace ET [ProtoMember(93)] public long ActorId { get; set; } - [ProtoMember(94)] - public long Id { get; set; } - [ProtoMember(1)] public float X { get; set; } @@ -169,6 +166,18 @@ namespace ET } + [Message(OuterOpcode.C2M_Stop)] + [ProtoContract] + public partial class C2M_Stop: Object, IActorLocationMessage + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(93)] + public long ActorId { get; set; } + + } + [Message(OuterOpcode.M2C_PathfindingResult)] [ProtoContract] public partial class M2C_PathfindingResult: Object, IActorMessage diff --git a/Server/Model/Generate/Message/OuterOpcode.cs b/Server/Model/Generate/Message/OuterOpcode.cs index ce5c1f5c..3ae840a2 100644 --- a/Server/Model/Generate/Message/OuterOpcode.cs +++ b/Server/Model/Generate/Message/OuterOpcode.cs @@ -11,22 +11,23 @@ namespace ET public const ushort UnitInfo = 20007; public const ushort M2C_CreateUnits = 20008; public const ushort C2M_PathfindingResult = 20009; - public const ushort M2C_PathfindingResult = 20010; - public const ushort M2C_Stop = 20011; - public const ushort C2G_Ping = 20012; - public const ushort G2C_Ping = 20013; - public const ushort G2C_Test = 20014; - public const ushort C2M_Reload = 20015; - public const ushort M2C_Reload = 20016; - public const ushort C2R_Login = 20017; - public const ushort R2C_Login = 20018; - public const ushort C2G_LoginGate = 20019; - public const ushort G2C_LoginGate = 20020; - public const ushort G2C_TestHotfixMessage = 20021; - public const ushort C2M_TestActorRequest = 20022; - public const ushort M2C_TestActorResponse = 20023; - public const ushort PlayerInfo = 20024; - public const ushort C2G_PlayerInfo = 20025; - public const ushort G2C_PlayerInfo = 20026; + public const ushort C2M_Stop = 20010; + public const ushort M2C_PathfindingResult = 20011; + public const ushort M2C_Stop = 20012; + public const ushort C2G_Ping = 20013; + public const ushort G2C_Ping = 20014; + public const ushort G2C_Test = 20015; + public const ushort C2M_Reload = 20016; + public const ushort M2C_Reload = 20017; + public const ushort C2R_Login = 20018; + public const ushort R2C_Login = 20019; + public const ushort C2G_LoginGate = 20020; + public const ushort G2C_LoginGate = 20021; + public const ushort G2C_TestHotfixMessage = 20022; + public const ushort C2M_TestActorRequest = 20023; + public const ushort M2C_TestActorResponse = 20024; + public const ushort PlayerInfo = 20025; + public const ushort C2G_PlayerInfo = 20026; + public const ushort G2C_PlayerInfo = 20027; } } diff --git a/Server/Model/Server.Model.csproj b/Server/Model/Server.Model.csproj index db2cea5b..a31bf03d 100644 --- a/Server/Model/Server.Model.csproj +++ b/Server/Model/Server.Model.csproj @@ -37,6 +37,10 @@ Module\Config\%(RecursiveDir)%(FileName)%(Extension) + + + Module\AI\%(RecursiveDir)%(FileName)%(Extension) + diff --git a/Tools/ExcelExporter/ProtoObject.cs b/Tools/ExcelExporter/ProtoObject.cs index 1e2c0fef..104830d0 100644 --- a/Tools/ExcelExporter/ProtoObject.cs +++ b/Tools/ExcelExporter/ProtoObject.cs @@ -14,12 +14,6 @@ namespace ET { } - [ProtoAfterDeserialization] - public virtual void AfterDeserialization() - { - this.EndInit(); - } - public virtual void EndInit() { } diff --git a/Unity/Assets/Bundles/Config/AIConfigCategory.bytes b/Unity/Assets/Bundles/Config/AIConfigCategory.bytes new file mode 100644 index 00000000..79b9eb47 --- /dev/null +++ b/Unity/Assets/Bundles/Config/AIConfigCategory.bytes @@ -0,0 +1,4 @@ + +e" AI_Attack +f" AI_XunLuo +" AI_XunLuo \ No newline at end of file diff --git a/Unity/Assets/Bundles/Config/AIConfigCategory.bytes.meta b/Unity/Assets/Bundles/Config/AIConfigCategory.bytes.meta new file mode 100644 index 00000000..67bc4026 --- /dev/null +++ b/Unity/Assets/Bundles/Config/AIConfigCategory.bytes.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 277d58db3067742a7b32f9994984b3bc +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Demo/AI.meta b/Unity/Assets/Hotfix/Demo/AI.meta new file mode 100644 index 00000000..449f5e36 --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0c430df865ee84f2f9348d817d6596a9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs b/Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs new file mode 100644 index 00000000..c8030911 --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace ET +{ + public class AI_Attack: AAIHandler + { + public override int Check(AIComponent aiComponent, AIConfig aiConfig) + { + long sec = TimeHelper.ClientNow() / 1000 % 15; + if (sec >= 10) + { + return 0; + } + return 1; + } + + public override async ETVoid Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken) + { + Scene zoneScene = aiComponent.DomainScene(); + + Unit myUnit = zoneScene.GetComponent().MyUnit; + if (myUnit == null) + { + return; + } + + // 停在当前位置 + zoneScene.GetComponent().Session.Send(new C2M_Stop()); + + Log.Debug("开始攻击"); + + for (int i = 0; i < 100000; ++i) + { + Log.Debug($"攻击: {i}次"); + + // 因为协程可能被中断,任何协程都要传入cancellationToken,判断如果是中断则要返回 + bool timeRet = await TimerComponent.Instance.WaitAsync(1000, cancellationToken); + if (!timeRet) + { + return; + } + } + } + } +} \ No newline at end of file diff --git a/Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs.meta b/Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs.meta new file mode 100644 index 00000000..0cdfa382 --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI/AI_Attack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b11fc1dea7c44643a27b53e790e9a1c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs b/Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs new file mode 100644 index 00000000..948e2f0c --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace ET +{ + public class AI_XunLuo: AAIHandler + { + public override int Check(AIComponent aiComponent, AIConfig aiConfig) + { + long sec = TimeHelper.ClientNow() / 1000 % 15; + if (sec < 10) + { + return 0; + } + return 1; + } + + public override async ETVoid Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken) + { + Scene zoneScene = aiComponent.DomainScene(); + + Unit myUnit = zoneScene.GetComponent().MyUnit; + if (myUnit == null) + { + return; + } + + Log.Debug("开始巡逻"); + + while (true) + { + XunLuoPathComponent xunLuoPathComponent = myUnit.GetComponent(); + Vector3 nextTarget = xunLuoPathComponent.GetCurrent(); + int ret = await myUnit.MoveToAsync(nextTarget, cancellationToken); + if (ret != 0) + { + return; + } + xunLuoPathComponent.MoveNext(); + } + } + } +} \ No newline at end of file diff --git a/Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs.meta b/Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs.meta new file mode 100644 index 00000000..98aa96f5 --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI/AI_XunLuo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd174eb9071c649bfba0b572fa58f130 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs b/Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs new file mode 100644 index 00000000..49d443ea --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs @@ -0,0 +1,17 @@ +using UnityEngine; + +namespace ET +{ + public static class XunLuoPathComponentSystem + { + public static Vector3 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/Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs.meta b/Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs.meta new file mode 100644 index 00000000..a86b9c8a --- /dev/null +++ b/Unity/Assets/Hotfix/Demo/AI/XunLuoPathComponentSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cbebec6c70d61475b889cc1a0fe80d6e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Demo/MapHelper.cs b/Unity/Assets/Hotfix/Demo/MapHelper.cs index 8cc9db65..c1904c7c 100644 --- a/Unity/Assets/Hotfix/Demo/MapHelper.cs +++ b/Unity/Assets/Hotfix/Demo/MapHelper.cs @@ -10,6 +10,10 @@ namespace ET try { G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent().Session.Call(new C2G_EnterMap()) as G2C_EnterMap; + + UnitComponent unitComponent = zoneScene.GetComponent(); + unitComponent.MyUnit = unitComponent.Get(g2CEnterMap.UnitId); + Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene}).Coroutine(); } catch (Exception e) diff --git a/Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs b/Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs index ac6d8ed7..57d7c9b6 100644 --- a/Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs +++ b/Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs @@ -8,7 +8,7 @@ namespace ET // 可以多次调用,多次调用的话会取消上一次的协程 public static async ETTask MoveToAsync(this Unit unit, Vector3 targetPos, ETCancellationToken cancellationToken = null) { - C2M_PathfindingResult msg = new C2M_PathfindingResult(); + C2M_PathfindingResult msg = new C2M_PathfindingResult() {X = targetPos.x, Y = targetPos.y, Z = targetPos.z}; unit.Domain.GetComponent().Session.Send(msg); ObjectWait objectWait = unit.GetComponent(); @@ -17,7 +17,7 @@ namespace ET objectWait.Notify(new WaitType.Wait_UnitStop() { Error = WaitTypeError.Cancel }); // 一直等到unit发送stop - WaitType.Wait_UnitStop waitUnitStop = await objectWait.Wait(); + WaitType.Wait_UnitStop waitUnitStop = await objectWait.Wait(cancellationToken); return waitUnitStop.Error; } } diff --git a/Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs b/Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs index ffbc16b4..2b966cd3 100644 --- a/Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs +++ b/Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs @@ -16,6 +16,10 @@ namespace ET numericComponent.Set((NumericType)unitInfo.Ks[i], unitInfo.Vs[i]); } + unit.AddComponent(); + + unit.AddComponent(); + UnitComponent unitComponent = domain.GetComponent(); unitComponent.Add(unit); diff --git a/Unity/Assets/Hotfix/Module/AI.meta b/Unity/Assets/Hotfix/Module/AI.meta new file mode 100644 index 00000000..b90d29c7 --- /dev/null +++ b/Unity/Assets/Hotfix/Module/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 490f7b30b1f804e9882ec3deb25b6013 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs b/Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs new file mode 100644 index 00000000..e7201efb --- /dev/null +++ b/Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs @@ -0,0 +1,80 @@ +using System; +using UnityEngine; + +namespace ET +{ + [ObjectSystem] + public class AIComponentAwakeSystem: AwakeSystem + { + public override void Awake(AIComponent self, int aiConfigId) + { + self.AIConfigId = aiConfigId; + self.Timer = TimerComponent.Instance.NewRepeatedTimer(1000, self.Check); + } + } + + [ObjectSystem] + public class AIComponentDestroySystem: DestroySystem + { + public override void Destroy(AIComponent self) + { + TimerComponent.Instance.Remove(ref self.Timer); + self.CancellationToken?.Cancel(); + self.CancellationToken = null; + self.Current = 0; + } + } + + public static class AIComponentSystem + { + public static void Check(this AIComponent self) + { + if (self.Parent == null) + { + TimerComponent.Instance.Remove(ref self.Timer); + return; + } + + var oneAI = AIConfigCategory.Instance.AIConfigs[self.AIConfigId]; + + foreach (AIConfig aiConfig in oneAI.Values) + { + + AIDispatcherComponent.Instance.AIHandlers.TryGetValue(aiConfig.Name, out AAIHandler aaiHandler); + + 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/Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs.meta b/Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs.meta new file mode 100644 index 00000000..54a53b3f --- /dev/null +++ b/Unity/Assets/Hotfix/Module/AI/AIComponentSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e782e22b472a243e99f82c93f1b191da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs b/Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs new file mode 100644 index 00000000..89b13b6f --- /dev/null +++ b/Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ET +{ + [ObjectSystem] + public class AIDispatcherComponentAwakeSystem: AwakeSystem + { + public override void Awake(AIDispatcherComponent self) + { + AIDispatcherComponent.Instance = self; + self.Load(); + } + } + + [ObjectSystem] + public class AIDispatcherComponentLoadSystem: LoadSystem + { + public override void Load(AIDispatcherComponent self) + { + self.Load(); + } + } + + [ObjectSystem] + public class AIDispatcherComponentDestroySystem: DestroySystem + { + public override void Destroy(AIDispatcherComponent self) + { + self.AIHandlers.Clear(); + AIDispatcherComponent.Instance = null; + } + } + + public static class AIDispatcherComponentSystem + { + public static void Load(this AIDispatcherComponent self) + { + self.AIHandlers.Clear(); + + var types = Game.EventSystem.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; + } + self.AIHandlers.Add(type.Name, aaiHandler); + } + } + } +} \ No newline at end of file diff --git a/Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs.meta b/Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs.meta new file mode 100644 index 00000000..7d6a02e3 --- /dev/null +++ b/Unity/Assets/Hotfix/Module/AI/AIDispatcherComponentSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e4f1a7d7c4df49d88b56711a37c25d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/HotfixView/AppStart_Init.cs b/Unity/Assets/HotfixView/AppStart_Init.cs index 10f94e50..9f38ca9e 100644 --- a/Unity/Assets/HotfixView/AppStart_Init.cs +++ b/Unity/Assets/HotfixView/AppStart_Init.cs @@ -24,6 +24,8 @@ namespace ET Game.Scene.AddComponent(); + Game.Scene.AddComponent(); + ResourcesComponent.Instance.LoadBundle("unit.unity3d"); Scene zoneScene = await SceneFactory.CreateZoneScene(1, "Process"); diff --git a/Unity/Assets/HotfixView/Opera/OperaComponentSystem.cs b/Unity/Assets/HotfixView/Opera/OperaComponentSystem.cs index b58392d3..d9b8770d 100644 --- a/Unity/Assets/HotfixView/Opera/OperaComponentSystem.cs +++ b/Unity/Assets/HotfixView/Opera/OperaComponentSystem.cs @@ -34,25 +34,8 @@ namespace ET self.frameClickMap.Y = self.ClickPoint.y; self.frameClickMap.Z = self.ClickPoint.z; self.DomainScene().GetComponent().Session.Send(self.frameClickMap); - - // 测试actor rpc消息 - self.TestActor().Coroutine(); } } } - - public static async ETVoid TestActor(this OperaComponent self) - { - try - { - M2C_TestActorResponse response = (M2C_TestActorResponse)await self.Domain.GetComponent().Session.Call( - new C2M_TestActorRequest() { Info = "actor rpc request" }); - Log.Info(response.Info); - } - catch (Exception e) - { - Log.Error(e); - } - } } } \ No newline at end of file diff --git a/Unity/Assets/HotfixView/Scene/SceneFactory.cs b/Unity/Assets/HotfixView/Scene/SceneFactory.cs index 6181abed..d65143e2 100644 --- a/Unity/Assets/HotfixView/Scene/SceneFactory.cs +++ b/Unity/Assets/HotfixView/Scene/SceneFactory.cs @@ -8,6 +8,7 @@ namespace ET zoneScene.AddComponent(); zoneScene.AddComponent(); zoneScene.AddComponent(); + zoneScene.AddComponent(1); // UI层的初始化 await Game.EventSystem.Publish(new EventType.AfterCreateZoneScene() {ZoneScene = zoneScene}); diff --git a/Unity/Assets/Model/Core/Object/Object.cs b/Unity/Assets/Model/Core/Object/Object.cs index cc3ee7be..2c273ca7 100644 --- a/Unity/Assets/Model/Core/Object/Object.cs +++ b/Unity/Assets/Model/Core/Object/Object.cs @@ -53,7 +53,7 @@ namespace ET } #endif } - + public override string ToString() { return JsonHelper.ToJson(this); diff --git a/Unity/Assets/Model/Demo/AI.meta b/Unity/Assets/Model/Demo/AI.meta new file mode 100644 index 00000000..73689820 --- /dev/null +++ b/Unity/Assets/Model/Demo/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc7b2c776a049435694c2242436e6183 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs b/Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs new file mode 100644 index 00000000..afddbbb6 --- /dev/null +++ b/Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace ET +{ + public class XunLuoPathComponent: Entity + { + public Vector3[] path = new Vector3[] { new Vector3(0, 0, 0), new Vector3(20, 0, 0), new Vector3(20, 0, 20), new Vector3(0, 0, 20), }; + + public int Index; + } +} \ No newline at end of file diff --git a/Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs.meta b/Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs.meta new file mode 100644 index 00000000..5a5b7123 --- /dev/null +++ b/Unity/Assets/Model/Demo/AI/XunLuoPathComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bde98272f7b14c46bfc11f5072d4e9a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Generate/Config/AIConfig.cs b/Unity/Assets/Model/Generate/Config/AIConfig.cs new file mode 100644 index 00000000..32582834 --- /dev/null +++ b/Unity/Assets/Model/Generate/Config/AIConfig.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using MongoDB.Bson.Serialization.Attributes; +using ProtoBuf; + +namespace ET +{ + [ProtoContract] + [Config] + public partial class AIConfigCategory : ProtoObject + { + public static AIConfigCategory Instance; + + [ProtoIgnore] + [BsonIgnore] + private Dictionary dict = new Dictionary(); + + [BsonElement] + [ProtoMember(1)] + private List list = new List(); + + public AIConfigCategory() + { + Instance = this; + } + + [ProtoAfterDeserialization] + public void AfterDeserialization() + { + foreach (AIConfig config in list) + { + this.dict.Add(config.Id, config); + } + list.Clear(); + this.EndInit(); + } + + 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; + } + } + + [ProtoContract] + public partial class AIConfig: ProtoObject, IConfig + { + [ProtoMember(1, IsRequired = true)] + public int Id { get; set; } + [ProtoMember(2, IsRequired = true)] + public int AIConfigId { get; set; } + [ProtoMember(3, IsRequired = true)] + public int Order { get; set; } + [ProtoMember(4, IsRequired = true)] + public string Name { get; set; } + [ProtoMember(5, IsRequired = true)] + public int[] NodeParams { get; set; } + + + [ProtoAfterDeserialization] + public void AfterDeserialization() + { + this.EndInit(); + } + } +} diff --git a/Unity/Assets/Model/Generate/Config/AIConfig.cs.meta b/Unity/Assets/Model/Generate/Config/AIConfig.cs.meta new file mode 100644 index 00000000..727498e1 --- /dev/null +++ b/Unity/Assets/Model/Generate/Config/AIConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 43cfda55a06294993bc33c15d1062d6f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Generate/Message/OuterMessage.cs b/Unity/Assets/Model/Generate/Message/OuterMessage.cs index 60737c7d..5fd73193 100644 --- a/Unity/Assets/Model/Generate/Message/OuterMessage.cs +++ b/Unity/Assets/Model/Generate/Message/OuterMessage.cs @@ -140,7 +140,7 @@ namespace ET [ProtoMember(93)] public long ActorId { get; set; } - [ProtoMember(1)] + [ProtoMember(2)] public List Units = new List(); } @@ -155,9 +155,6 @@ namespace ET [ProtoMember(93)] public long ActorId { get; set; } - [ProtoMember(94)] - public long Id { get; set; } - [ProtoMember(1)] public float X { get; set; } @@ -169,6 +166,18 @@ namespace ET } + [Message(OuterOpcode.C2M_Stop)] + [ProtoContract] + public partial class C2M_Stop: Object, IActorLocationMessage + { + [ProtoMember(90)] + public int RpcId { get; set; } + + [ProtoMember(93)] + public long ActorId { get; set; } + + } + [Message(OuterOpcode.M2C_PathfindingResult)] [ProtoContract] public partial class M2C_PathfindingResult: Object, IActorMessage diff --git a/Unity/Assets/Model/Generate/Message/OuterOpcode.cs b/Unity/Assets/Model/Generate/Message/OuterOpcode.cs index ce5c1f5c..3ae840a2 100644 --- a/Unity/Assets/Model/Generate/Message/OuterOpcode.cs +++ b/Unity/Assets/Model/Generate/Message/OuterOpcode.cs @@ -11,22 +11,23 @@ namespace ET public const ushort UnitInfo = 20007; public const ushort M2C_CreateUnits = 20008; public const ushort C2M_PathfindingResult = 20009; - public const ushort M2C_PathfindingResult = 20010; - public const ushort M2C_Stop = 20011; - public const ushort C2G_Ping = 20012; - public const ushort G2C_Ping = 20013; - public const ushort G2C_Test = 20014; - public const ushort C2M_Reload = 20015; - public const ushort M2C_Reload = 20016; - public const ushort C2R_Login = 20017; - public const ushort R2C_Login = 20018; - public const ushort C2G_LoginGate = 20019; - public const ushort G2C_LoginGate = 20020; - public const ushort G2C_TestHotfixMessage = 20021; - public const ushort C2M_TestActorRequest = 20022; - public const ushort M2C_TestActorResponse = 20023; - public const ushort PlayerInfo = 20024; - public const ushort C2G_PlayerInfo = 20025; - public const ushort G2C_PlayerInfo = 20026; + public const ushort C2M_Stop = 20010; + public const ushort M2C_PathfindingResult = 20011; + public const ushort M2C_Stop = 20012; + public const ushort C2G_Ping = 20013; + public const ushort G2C_Ping = 20014; + public const ushort G2C_Test = 20015; + public const ushort C2M_Reload = 20016; + public const ushort M2C_Reload = 20017; + public const ushort C2R_Login = 20018; + public const ushort R2C_Login = 20019; + public const ushort C2G_LoginGate = 20020; + public const ushort G2C_LoginGate = 20021; + public const ushort G2C_TestHotfixMessage = 20022; + public const ushort C2M_TestActorRequest = 20023; + public const ushort M2C_TestActorResponse = 20024; + public const ushort PlayerInfo = 20025; + public const ushort C2G_PlayerInfo = 20026; + public const ushort G2C_PlayerInfo = 20027; } } diff --git a/Unity/Assets/Model/Module/AI.meta b/Unity/Assets/Model/Module/AI.meta new file mode 100644 index 00000000..15d2dc7f --- /dev/null +++ b/Unity/Assets/Model/Module/AI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 167c92d772b01476c983b16abfa46562 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Module/AI/AAIHandler.cs b/Unity/Assets/Model/Module/AI/AAIHandler.cs new file mode 100644 index 00000000..add1d5fa --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AAIHandler.cs @@ -0,0 +1,18 @@ +using System; + +namespace ET +{ + public class AIHandlerAttribute: BaseAttribute + { + } + + [AIHandler] + public abstract class AAIHandler + { + // 检查是否满足条件 + public abstract int Check(AIComponent aiComponent, AIConfig aiConfig); + + // 协程编写必须可以取消 + public abstract ETVoid Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/Unity/Assets/Model/Module/AI/AAIHandler.cs.meta b/Unity/Assets/Model/Module/AI/AAIHandler.cs.meta new file mode 100644 index 00000000..ae1779b0 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AAIHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4fe4e242d994c449483c3160866a57d7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Module/AI/AIComponent.cs b/Unity/Assets/Model/Module/AI/AIComponent.cs new file mode 100644 index 00000000..043479e8 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AIComponent.cs @@ -0,0 +1,14 @@ +namespace ET +{ + // 客户端挂在ZoneScene上,服务端挂在Unit上 + public class AIComponent: Entity + { + public int AIConfigId; + + public ETCancellationToken CancellationToken; + + public long Timer; + + public int Current; + } +} \ No newline at end of file diff --git a/Unity/Assets/Model/Module/AI/AIComponent.cs.meta b/Unity/Assets/Model/Module/AI/AIComponent.cs.meta new file mode 100644 index 00000000..f2cdb066 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AIComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c754f37c484d34e4fa0a9160de407f8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Module/AI/AIConfig.cs b/Unity/Assets/Model/Module/AI/AIConfig.cs new file mode 100644 index 00000000..ee75fde3 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AIConfig.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.ComponentModel; +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; +using ProtoBuf; + +namespace ET +{ + public partial class AIConfigCategory + { + public Dictionary> AIConfigs = new Dictionary>(); + + public SortedDictionary GetAI(int aiConfigId) + { + return this.AIConfigs[aiConfigId]; + } + + public override void EndInit() + { + base.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/Unity/Assets/Model/Module/AI/AIConfig.cs.meta b/Unity/Assets/Model/Module/AI/AIConfig.cs.meta new file mode 100644 index 00000000..456fcc26 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AIConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9093f3843f3ee4466a5fc71c53a394b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs b/Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs new file mode 100644 index 00000000..53d8d9e4 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace ET +{ + public class AIDispatcherComponent: Entity + { + public static AIDispatcherComponent Instance; + + public Dictionary AIHandlers = new Dictionary(); + } +} \ No newline at end of file diff --git a/Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs.meta b/Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs.meta new file mode 100644 index 00000000..c8343181 --- /dev/null +++ b/Unity/Assets/Model/Module/AI/AIDispatcherComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b3ad59713447042a18ef6ff24c957d02 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Model/Module/Message/OpcodeHelper.cs b/Unity/Assets/Model/Module/Message/OpcodeHelper.cs index 0320eb69..d4f6a3ec 100644 --- a/Unity/Assets/Model/Module/Message/OpcodeHelper.cs +++ b/Unity/Assets/Model/Module/Message/OpcodeHelper.cs @@ -6,7 +6,8 @@ namespace ET { private static readonly HashSet ignoreDebugLogMessageSet = new HashSet { - + OuterOpcode.C2G_Ping, + OuterOpcode.G2C_Ping, }; private static bool IsNeedLogMessage(ushort opcode) diff --git a/Unity/Packages/packages-lock.json b/Unity/Packages/packages-lock.json index ba047a29..ada12001 100644 --- a/Unity/Packages/packages-lock.json +++ b/Unity/Packages/packages-lock.json @@ -52,7 +52,7 @@ "url": "https://packages.unity.cn" }, "com.unity.test-framework": { - "version": "1.1.22", + "version": "1.1.24", "depth": 1, "source": "registry", "dependencies": { diff --git a/Unity/ProjectSettings/ProjectVersion.txt b/Unity/ProjectSettings/ProjectVersion.txt index e33fd4ac..ab9a1efa 100644 --- a/Unity/ProjectSettings/ProjectVersion.txt +++ b/Unity/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.0f1c1 -m_EditorVersionWithRevision: 2020.3.0f1c1 (1e553bf703d9) +m_EditorVersion: 2020.3.3f1c1 +m_EditorVersionWithRevision: 2020.3.3f1c1 (a34b99c2c582) -- GitLab