From 21ba17a5b985b8abbb7d019990e555ca2eba3c53 Mon Sep 17 00:00:00 2001 From: Shawqeem <1004837646@qq.com> Date: Sat, 25 Mar 2023 23:44:44 +0800 Subject: [PATCH] fix: :bug: fix some bugs due to the copy errors fix some bugs due to copy error --- logic/Client/CommandLineArgs.cs | 2 +- logic/Client/MainWindow.xaml.cs | 181 ++++++++++++++------ logic/Client/Properties/launchSettings.json | 8 + logic/Client/StatusBarOfHunter.xaml.cs | 76 +++++--- logic/Client/StatusBarOfSurvivor.xaml.cs | 76 +++++--- logic/Server/CopyInfo.cs | 8 - logic/Server/Properties/launchSettings.json | 2 +- logic/cmd/gameServer.cmd | 8 + 8 files changed, 261 insertions(+), 100 deletions(-) create mode 100644 logic/Client/Properties/launchSettings.json create mode 100644 logic/cmd/gameServer.cmd diff --git a/logic/Client/CommandLineArgs.cs b/logic/Client/CommandLineArgs.cs index 77b3f1f..fe08801 100644 --- a/logic/Client/CommandLineArgs.cs +++ b/logic/Client/CommandLineArgs.cs @@ -18,7 +18,7 @@ namespace Client public string Ip { get; set; } = "127.0.0.1"; [Option('p', "port", Required = false, HelpText = "Client listening port")] - public string Port { get; set; } = "7777"; + public string Port { get; set; } = "8888"; [Option('t', "teamID", Required = false, HelpText = "Client teamID")] public string TeamID { get; set; } = "0"; diff --git a/logic/Client/MainWindow.xaml.cs b/logic/Client/MainWindow.xaml.cs index 13506af..ea22f74 100644 --- a/logic/Client/MainWindow.xaml.cs +++ b/logic/Client/MainWindow.xaml.cs @@ -119,11 +119,10 @@ namespace Client } else { - if (options.PlaybackFile == DefaultArgumentOptions.FileName) - { + //if (options.PlaybackFile == DefaultArgumentOptions.FileName) + //{ try { - OnReceive(); string[] comInfo = new string[5]; comInfo[0] = options.Ip; comInfo[1] = options.Port; @@ -131,16 +130,17 @@ namespace Client comInfo[3] = options.PlayerType; comInfo[4] = options.Occupation; ConnectToServer(comInfo); + OnReceive(); } catch { OnReceive(); } - } - else - { - Playback(options.PlaybackFile, options.PlaybackSpeed); - } + //} + //else + //{ + // Playback(options.PlaybackFile, options.PlaybackSpeed); + //} } } private void Playback(string fileName, double pbSpeed = 2.0) @@ -317,7 +317,7 @@ namespace Client case 9: mapPatches[i, j].Fill = Brushes.LightSkyBlue; mapPatches[i, j].Stroke = Brushes.LightSkyBlue; - break;//door + break;//gate case 10: foreach (var obj in listOfAll) { @@ -733,17 +733,26 @@ namespace Client switch (data.Type) { case PropType.Key3: - DrawProp(data, "🔧"); + DrawProp(data, "🔑"); break; case PropType.Key5: - DrawProp(data, "🛡"); + DrawProp(data, "🔑"); break; case PropType.Key6: - DrawProp(data, "♥"); + DrawProp(data, "🔑"); break; - case PropType.Ptype4: + case PropType.AddSpeed: DrawProp(data, "⛸"); break; + case PropType.AddHpOrAp: + DrawProp(data, "♥"); + break; + case PropType.AddLifeOrAp: + DrawProp(data, "🏅"); + break; + case PropType.ShieldOrSpear: + DrawProp(data, "🛡"); + break; default: DrawProp(data, ""); break; @@ -922,19 +931,11 @@ namespace Client { switch (e.Key) { - case Key.D0: - PropMsg msgP0 = new() - { - PlayerId = playerID, - PropType = PropType.Key3, - }; - client.PickProp(msgP0); - break; case Key.D1: PropMsg msgP1 = new() { PlayerId = playerID, - PropType = PropType.Key5, + PropType = PropType.AddSpeed, }; client.PickProp(msgP1); break; @@ -942,7 +943,7 @@ namespace Client PropMsg msgP2 = new() { PlayerId = playerID, - PropType = PropType.Key6, + PropType = PropType.AddLifeOrAp, }; client.PickProp(msgP2); break; @@ -950,10 +951,42 @@ namespace Client PropMsg msgP3 = new() { PlayerId = playerID, - PropType = PropType.Ptype4, + PropType = PropType.AddHpOrAp, }; client.PickProp(msgP3); break; + case Key.D4: + PropMsg msgP4 = new() + { + PlayerId = playerID, + PropType = PropType.ShieldOrSpear, + }; + client.PickProp(msgP4); + break; + case Key.D5: + PropMsg msgP5 = new() + { + PlayerId = playerID, + PropType = PropType.Key3, + }; + client.PickProp(msgP5); + break; + case Key.D6: + PropMsg msgP6 = new() + { + PlayerId = playerID, + PropType = PropType.Key5, + }; + client.PickProp(msgP6); + break; + case Key.D7: + PropMsg msgP7 = new() + { + PlayerId = playerID, + PropType = PropType.Key6, + }; + client.PickProp(msgP7); + break; default: break; } @@ -962,19 +995,11 @@ namespace Client { switch (e.Key) { - case Key.D0: - PropMsg msgP0 = new() - { - PlayerId = playerID, - PropType = PropType.Key3, - }; - client.UseProp(msgP0); - break; case Key.D1: PropMsg msgP1 = new() { PlayerId = playerID, - PropType = PropType.Key5, + PropType = PropType.AddSpeed, }; client.UseProp(msgP1); break; @@ -982,7 +1007,7 @@ namespace Client PropMsg msgP2 = new() { PlayerId = playerID, - PropType = PropType.Key6, + PropType = PropType.AddLifeOrAp, }; client.UseProp(msgP2); break; @@ -990,10 +1015,42 @@ namespace Client PropMsg msgP3 = new() { PlayerId = playerID, - PropType = PropType.Ptype4, + PropType = PropType.AddHpOrAp, }; client.UseProp(msgP3); break; + case Key.D4: + PropMsg msgP4 = new() + { + PlayerId = playerID, + PropType = PropType.ShieldOrSpear, + }; + client.UseProp(msgP4); + break; + case Key.D5: + PropMsg msgP5 = new() + { + PlayerId = playerID, + PropType = PropType.Key3, + }; + client.UseProp(msgP5); + break; + case Key.D6: + PropMsg msgP6 = new() + { + PlayerId = playerID, + PropType = PropType.Key5, + }; + client.UseProp(msgP6); + break; + case Key.D7: + PropMsg msgP7 = new() + { + PlayerId = playerID, + PropType = PropType.Key6, + }; + client.UseProp(msgP7); + break; default: break; } @@ -1002,19 +1059,11 @@ namespace Client { switch (e.Key) { - case Key.D0: - PropMsg msgP0 = new() - { - PlayerId = playerID, - PropType = PropType.Key3, - }; - client.ThrowProp(msgP0); - break; case Key.D1: PropMsg msgP1 = new() { PlayerId = playerID, - PropType = PropType.Key5, + PropType = PropType.AddSpeed, }; client.ThrowProp(msgP1); break; @@ -1022,7 +1071,7 @@ namespace Client PropMsg msgP2 = new() { PlayerId = playerID, - PropType = PropType.Key6, + PropType = PropType.AddLifeOrAp, }; client.ThrowProp(msgP2); break; @@ -1030,10 +1079,42 @@ namespace Client PropMsg msgP3 = new() { PlayerId = playerID, - PropType = PropType.Ptype4, + PropType = PropType.AddHpOrAp, }; client.ThrowProp(msgP3); break; + case Key.D4: + PropMsg msgP4 = new() + { + PlayerId = playerID, + PropType = PropType.ShieldOrSpear, + }; + client.ThrowProp(msgP4); + break; + case Key.D5: + PropMsg msgP5 = new() + { + PlayerId = playerID, + PropType = PropType.Key3, + }; + client.ThrowProp(msgP5); + break; + case Key.D6: + PropMsg msgP6 = new() + { + PlayerId = playerID, + PropType = PropType.Key5, + }; + client.ThrowProp(msgP6); + break; + case Key.D7: + PropMsg msgP7 = new() + { + PlayerId = playerID, + PropType = PropType.Key6, + }; + client.ThrowProp(msgP7); + break; default: break; } @@ -1130,14 +1211,14 @@ namespace Client client.StartLearning(msgK); break; case Key.R: - IDMsg msgR = new() - { + TreatAndRescueMsg msgR = new() + { PlayerId = playerID, - }; + }; client.StartRescueMate(msgR); break; case Key.T: - IDMsg msgT = new() + TreatAndRescueMsg msgT = new() { PlayerId = playerID, }; diff --git a/logic/Client/Properties/launchSettings.json b/logic/Client/Properties/launchSettings.json new file mode 100644 index 0000000..b6b9a43 --- /dev/null +++ b/logic/Client/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Client": { + "commandName": "Project", + "commandLineArgs": "--cl --playbackFile=D:\\2_autumn\\thuai6\\playback.thuaipb --characterID=4 --type=2 --occupation=1" + } + } +} \ No newline at end of file diff --git a/logic/Client/StatusBarOfHunter.xaml.cs b/logic/Client/StatusBarOfHunter.xaml.cs index 23c0f93..0ce2946 100644 --- a/logic/Client/StatusBarOfHunter.xaml.cs +++ b/logic/Client/StatusBarOfHunter.xaml.cs @@ -154,19 +154,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop0.Text = "🔧"; + prop0.Text = "🔑"; break; case PropType.Key5: - prop0.Text = "🛡"; + prop0.Text = "🔑"; break; case PropType.Key6: - prop0.Text = "♥"; + prop0.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop0.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop0.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop0.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop0.Text = "🛡"; + break; default: - prop0.Text = " "; + prop0.Text = ""; break; } cnt++; @@ -175,19 +184,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop1.Text = "🔧"; + prop1.Text = "🔑"; break; case PropType.Key5: - prop1.Text = "🛡"; + prop1.Text = "🔑"; break; case PropType.Key6: - prop1.Text = "♥"; + prop1.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop1.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop1.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop1.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop1.Text = "🛡"; + break; default: - prop1.Text = " "; + prop1.Text = ""; break; } cnt++; @@ -196,19 +214,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop2.Text = "🔧"; + prop2.Text = "🔑"; break; case PropType.Key5: - prop2.Text = "🛡"; + prop2.Text = "🔑"; break; case PropType.Key6: - prop2.Text = "♥"; + prop2.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop2.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop2.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop2.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop2.Text = "🛡"; + break; default: - prop2.Text = " "; + prop2.Text = ""; break; } cnt++; @@ -217,19 +244,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop3.Text = "🔧"; + prop3.Text = "🔑"; break; case PropType.Key5: - prop3.Text = "🛡"; + prop3.Text = "🔑"; break; case PropType.Key6: - prop3.Text = "♥"; + prop3.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop3.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop3.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop3.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop3.Text = "🛡"; + break; default: - prop3.Text = " "; + prop3.Text = ""; break; } cnt++; diff --git a/logic/Client/StatusBarOfSurvivor.xaml.cs b/logic/Client/StatusBarOfSurvivor.xaml.cs index d2bd725..5950c16 100644 --- a/logic/Client/StatusBarOfSurvivor.xaml.cs +++ b/logic/Client/StatusBarOfSurvivor.xaml.cs @@ -148,19 +148,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop0.Text = "🔧"; + prop0.Text = "🔑"; break; case PropType.Key5: - prop0.Text = "🛡"; + prop0.Text = "🔑"; break; case PropType.Key6: - prop0.Text = "♥"; + prop0.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop0.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop0.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop0.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop0.Text = "🛡"; + break; default: - prop0.Text = " "; + prop0.Text = ""; break; } cnt++; @@ -169,19 +178,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop1.Text = "🔧"; + prop1.Text = "🔑"; break; case PropType.Key5: - prop1.Text = "🛡"; + prop1.Text = "🔑"; break; case PropType.Key6: - prop1.Text = "♥"; + prop1.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop1.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop1.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop1.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop1.Text = "🛡"; + break; default: - prop1.Text = " "; + prop1.Text = ""; break; } cnt++; @@ -190,19 +208,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop2.Text = "🔧"; + prop2.Text = "🔑"; break; case PropType.Key5: - prop2.Text = "🛡"; + prop2.Text = "🔑"; break; case PropType.Key6: - prop2.Text = "♥"; + prop2.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop2.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop2.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop2.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop2.Text = "🛡"; + break; default: - prop2.Text = " "; + prop2.Text = ""; break; } cnt++; @@ -211,19 +238,28 @@ namespace Client switch (icon) { case PropType.Key3: - prop3.Text = "🔧"; + prop3.Text = "🔑"; break; case PropType.Key5: - prop3.Text = "🛡"; + prop3.Text = "🔑"; break; case PropType.Key6: - prop3.Text = "♥"; + prop3.Text = "🔑"; break; - case PropType.Ptype4: + case PropType.AddSpeed: prop3.Text = "⛸"; break; + case PropType.AddLifeOrAp: + prop3.Text = "🏅"; + break; + case PropType.AddHpOrAp: + prop3.Text = "♥"; + break; + case PropType.ShieldOrSpear: + prop3.Text = "🛡"; + break; default: - prop3.Text = " "; + prop3.Text = ""; break; } cnt++; diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index 5337692..8a82e6b 100644 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -48,14 +48,6 @@ namespace Server { switch (prop) { - case Preparation.Utility.PropType.AddSpeed: - return Protobuf.PropType.AddSpeed; - case Preparation.Utility.PropType.AddLifeOrAp: - return Protobuf.PropType.AddLifeOrAp; - case Preparation.Utility.PropType.AddHpOrAp: - return Protobuf.PropType.AddHpOrAp; - case Preparation.Utility.PropType.ShieldOrSpear: - return Protobuf.PropType.ShieldOrSpear; case Preparation.Utility.PropType.Key3: return Protobuf.PropType.Key3; case Preparation.Utility.PropType.Key5: diff --git a/logic/Server/Properties/launchSettings.json b/logic/Server/Properties/launchSettings.json index e92f6c7..bc93c16 100644 --- a/logic/Server/Properties/launchSettings.json +++ b/logic/Server/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Server": { "commandName": "Project", - "commandLineArgs": "-p 8888\r\n-f playback\r\n-g 600\r\n-b true\r\n-c 4\r\n-t 2" + "commandLineArgs": "-p 8888 -t 2 -c 4" } } } \ No newline at end of file diff --git a/logic/cmd/gameServer.cmd b/logic/cmd/gameServer.cmd new file mode 100644 index 0000000..10f250d --- /dev/null +++ b/logic/cmd/gameServer.cmd @@ -0,0 +1,8 @@ +@echo off + +start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --port 8888 --teamCount 1 --playerCount 1 --gameTimeInSecond 600 --fileName test + +ping -n 4 127.0.0.1 > NUL + +::start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port=8888 --characterID=0 --type=1 --occupation=1 +