Browse Source

fix: 🐛 fix some bugs

tags/0.1.0
gsy1519 2 years ago
parent
commit
074b45fe12
7 changed files with 261 additions and 92 deletions
  1. +1
    -1
      logic/Client/CommandLineArgs.cs
  2. +131
    -50
      logic/Client/MainWindow.xaml.cs
  3. +8
    -0
      logic/Client/Properties/launchSettings.json
  4. +56
    -20
      logic/Client/StatusBarOfHunter.xaml.cs
  5. +56
    -20
      logic/Client/StatusBarOfSurvivor.xaml.cs
  6. +1
    -1
      logic/Server/CopyInfo.cs
  7. +8
    -0
      logic/cmd/gameServer.cmd

+ 1
- 1
logic/Client/CommandLineArgs.cs View File

@@ -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";


+ 131
- 50
logic/Client/MainWindow.xaml.cs View File

@@ -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,
};


+ 8
- 0
logic/Client/Properties/launchSettings.json View File

@@ -0,0 +1,8 @@
{
"profiles": {
"Client": {
"commandName": "Project",
"commandLineArgs": "--cl --playbackFile=D:\\2_autumn\\thuai6\\playback.thuaipb --characterID=4 --type=2 --occupation=1"
}
}
}

+ 56
- 20
logic/Client/StatusBarOfHunter.xaml.cs View File

@@ -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++;


+ 56
- 20
logic/Client/StatusBarOfSurvivor.xaml.cs View File

@@ -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++;


+ 1
- 1
logic/Server/CopyInfo.cs View File

@@ -432,4 +432,4 @@ namespace Server
return msg;
}
}
}
}

+ 8
- 0
logic/cmd/gameServer.cmd View File

@@ -0,0 +1,8 @@
@echo off

start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --port 8888 --teamCount 2 --playerCount 2 --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=4 --type=2 --occupation=1


Loading…
Cancel
Save