diff --git a/Client.cs b/Client.cs index c1cc6b5..55e6df9 100644 --- a/Client.cs +++ b/Client.cs @@ -34,15 +34,23 @@ namespace BattleServer /// private void handle(BattleRpcMessage msg) { - Console.WriteLine("收到战斗消息:{0}", msg.ToString()); - int end = battle.Manager.CheckBattle((int)msg.rid); - Console.WriteLine("CheckBattle:{0}", end); - switch(msg.method){ - case "Check": - BattleReport report = ProtoDeSerialize(msg.Data.value); - HotUpdateScripts.FightRunnerMgr.Instance.StartOnceFight(report); - socket.Send(ProtoSerialize(msg)); - break; + try{ + Console.WriteLine("收到战斗消息:{0}", msg.method); + switch(msg.method){ + case "Check": + BattleReport report = ProtoDeSerialize(msg.data.value); + bool ischeck = HotUpdateScripts.FightRunnerMgr.Instance.VerifyOnceFight(report); + Console.WriteLine("战斗校验结果:{0}", ischeck); + msg.data = new Google.Protobuf.WellKnownTypes.Any { + type_url = "type.googleapis.com/BattleCheckResults", + value = ProtoSerialize(new BattleCheckResults{ischeck=ischeck}), + }; + socket.Send(ProtoSerialize(msg)); + break; + } + } catch (IOException ex){ + Console.WriteLine("战斗异常 {0}",ex.Message); + socket.Close(); } } @@ -70,6 +78,7 @@ namespace BattleServer /// public static T ProtoDeSerialize(byte[] msg) where T : class { + msg = msg == null ? new byte[]{} : msg; using (var ms = new MemoryStream(msg)) { var data = ProtoBuf.Serializer.Deserialize(ms); diff --git a/Program.cs b/Program.cs index 5723578..d1e5cb1 100644 --- a/Program.cs +++ b/Program.cs @@ -10,7 +10,7 @@ namespace BattleServer { HotUpdateScripts.FightRunnerMgr.Instance.Init("./GameConfig/"); cfg.Game.HeroData data = HotUpdateScripts.FightBase.GC.Hero.Get("25001"); - HotUpdateScripts.FightDebug.Log("name:"+data.Name); + HotUpdateScripts.FightDebug.Log("测试读取配置 name:"+data.Name); Console.WriteLine("BattleServer Start!"); Service service = new Service(); Console.ReadKey(); diff --git a/Service.cs b/Service.cs index 2e9279e..733e7d9 100644 --- a/Service.cs +++ b/Service.cs @@ -15,7 +15,7 @@ namespace BattleServer public Service() { - var server = new WebSocketServer("ws://127.0.0.1:9898"); //创建webscoket服务端实例 + var server = new WebSocketServer("ws://127.0.0.1:9897"); //创建webscoket服务端实例 server.Start(onAccept); clients = new List(); } diff --git a/bin/Debug/net6.0/FightRunner.dll b/bin/Debug/net6.0/FightRunner.dll index d11d74a..c24270b 100644 Binary files a/bin/Debug/net6.0/FightRunner.dll and b/bin/Debug/net6.0/FightRunner.dll differ diff --git a/bin/Debug/net6.0/GameFight.dll b/bin/Debug/net6.0/GameFight.dll index bf8c986..febae82 100644 Binary files a/bin/Debug/net6.0/GameFight.dll and b/bin/Debug/net6.0/GameFight.dll differ diff --git a/bin/Debug/net6.0/GameProto.dll b/bin/Debug/net6.0/GameProto.dll index 0444c62..1de9c27 100644 Binary files a/bin/Debug/net6.0/GameProto.dll and b/bin/Debug/net6.0/GameProto.dll differ diff --git a/bin/Debug/net6.0/dfbattle.dll b/bin/Debug/net6.0/dfbattle.dll index 55070c9..a4594b6 100644 Binary files a/bin/Debug/net6.0/dfbattle.dll and b/bin/Debug/net6.0/dfbattle.dll differ diff --git a/bin/Debug/net6.0/dfbattle.pdb b/bin/Debug/net6.0/dfbattle.pdb index 910881d..f37a692 100644 Binary files a/bin/Debug/net6.0/dfbattle.pdb and b/bin/Debug/net6.0/dfbattle.pdb differ diff --git a/lib/FightRunner.dll b/lib/FightRunner.dll index d11d74a..c24270b 100644 Binary files a/lib/FightRunner.dll and b/lib/FightRunner.dll differ diff --git a/lib/GameFight.dll b/lib/GameFight.dll index bf8c986..febae82 100644 Binary files a/lib/GameFight.dll and b/lib/GameFight.dll differ diff --git a/lib/GameProto.dll b/lib/GameProto.dll index 0444c62..1de9c27 100644 Binary files a/lib/GameProto.dll and b/lib/GameProto.dll differ diff --git a/obj/Debug/net6.0/dfbattle.csproj.AssemblyReference.cache b/obj/Debug/net6.0/dfbattle.csproj.AssemblyReference.cache index 6942242..f923ebd 100644 Binary files a/obj/Debug/net6.0/dfbattle.csproj.AssemblyReference.cache and b/obj/Debug/net6.0/dfbattle.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/net6.0/dfbattle.dll b/obj/Debug/net6.0/dfbattle.dll index 55070c9..a4594b6 100644 Binary files a/obj/Debug/net6.0/dfbattle.dll and b/obj/Debug/net6.0/dfbattle.dll differ diff --git a/obj/Debug/net6.0/dfbattle.pdb b/obj/Debug/net6.0/dfbattle.pdb index 910881d..f37a692 100644 Binary files a/obj/Debug/net6.0/dfbattle.pdb and b/obj/Debug/net6.0/dfbattle.pdb differ