Browse Source

Merge pull request #267 from Shawqeem/dev

refactor: 🎨 change the color of bombed bullets and improve the fu…
tags/0.1.0
shangfengh GitHub 2 years ago
parent
commit
c1a0159ebe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 73 deletions
  1. +87
    -71
      logic/Client/MainWindow.xaml.cs
  2. +1
    -1
      logic/Gaming/AttackManager.cs
  3. +1
    -1
      logic/cmd/gameServer.cmd

+ 87
- 71
logic/Client/MainWindow.xaml.cs View File

@@ -564,23 +564,16 @@ namespace Client
return true;
if (humanOrButcher && human != null)
{
if (human.Guid == msg.Guid) // 自己能看见自己
if (msg.Place == human.Place)
return true;
}
if (msg.Place == Protobuf.PlaceType.Grass || msg.Place == Protobuf.PlaceType.Gate || msg.Place == Protobuf.PlaceType.HiddenGate)
return false;
if (msg.Place == Protobuf.PlaceType.Land || msg.Place == Protobuf.PlaceType.Classroom)
return true;
if (humanOrButcher && human != null)
{
if (msg.Place != human.Place)
return false;
}
else if (!humanOrButcher && butcher != null)
{
if (msg.Place != butcher.Place)
return false;
if (msg.Place == butcher.Place)
return true;
}
if (msg.Place == Protobuf.PlaceType.Grass)
return false;
return true;
}

@@ -593,20 +586,21 @@ namespace Client
if (butcher.Guid == msg.Guid) // 自己能看见自己
return true;
}
if (msg.Place == Protobuf.PlaceType.Grass || msg.Place == Protobuf.PlaceType.Gate || msg.Place == Protobuf.PlaceType.HiddenGate)
return false;
if (msg.Place == Protobuf.PlaceType.Land || msg.Place == Protobuf.PlaceType.Classroom)
return true;
if (humanOrButcher && human != null)
{
if (msg.Place != human.Place)
return false;
}
else if (!humanOrButcher && butcher != null)
{
if (msg.Place != butcher.Place)
return false;
if (msg.TrickerType == Protobuf.TrickerType.Assassin)
{
foreach (var buff in msg.Buff)
{
if (buff == Protobuf.TrickerBuffType.TrickerInvisible)
return false;
}
}
if (msg.Place == human.Place)
return true;
}
if (msg.Place == Protobuf.PlaceType.Grass)
return false;
return true;
}

@@ -614,18 +608,18 @@ namespace Client
{
if (isSpectatorMode)
return true;
if (msg.Place == Protobuf.PlaceType.Land)
return true;
if (humanOrButcher && human != null)
{
if (msg.Place != human.Place)
return false;
if (msg.Place == human.Place)
return true;
}
else if (!humanOrButcher && butcher != null)
{
if (msg.Place != butcher.Place)
return false;
if (msg.Place == butcher.Place)
return true;
}
if (msg.Place == Protobuf.PlaceType.Grass)
return false;
return true;
}

@@ -633,18 +627,37 @@ namespace Client
{
if (isSpectatorMode)
return true;
if (msg.Place == Protobuf.PlaceType.Land)
return true;
if (humanOrButcher && human != null)
{
if (msg.Place != human.Place)
return false;
if (msg.Place == human.Place)
return true;
}
else if (!humanOrButcher && butcher != null)
{
if (msg.Place != butcher.Place)
return false;
if (msg.Place == butcher.Place)
return true;
}
if (msg.Place == Protobuf.PlaceType.Grass)
return false;
return true;
}

private bool CanSee(MessageOfBombedBullet msg)
{
if (isSpectatorMode)
return true;
//if (humanOrButcher && human != null)
//{
// if (msg.Place == human.Place)
// return true;
//}
//else if (!humanOrButcher && butcher != null)
//{
// if (msg.Place == butcher.Place)
// return true;
//}
//if (msg.Place == Protobuf.PlaceType.Grass)
// return false;
return true;
}

@@ -847,46 +860,49 @@ namespace Client
}
foreach (var data in listOfBombedBullet)
{
switch (data.Type)
if (CanSee(data))
{
case Protobuf.BulletType.BombBomb:
{
double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
Ellipse icon = new()
switch (data.Type)
{
case Protobuf.BulletType.BombBomb:
{
Width = 2 * bombRange * unitWidth,
Height = 2 * bombRange * unitHeight,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
Fill = Brushes.DarkRed,
};
UpperLayerOfMap.Children.Add(icon);
break;
}
case Protobuf.BulletType.JumpyDumpty:
{
double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
Ellipse icon = new()
double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
Ellipse icon = new()
{
Width = 2 * bombRange * unitWidth,
Height = 2 * bombRange * unitHeight,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
Fill = Brushes.DarkRed,
};
UpperLayerOfMap.Children.Add(icon);
break;
}
case Protobuf.BulletType.JumpyDumpty:
{
Width = 2 * bombRange * unitWidth,
Height = 2 * bombRange * unitHeight,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
Fill = Brushes.DarkViolet,
};
UpperLayerOfMap.Children.Add(icon);
double bombRange = 1.0 * data.BombRange / Preparation.Utility.GameData.numOfPosGridPerCell;
Ellipse icon = new()
{
Width = 2 * bombRange * unitWidth,
Height = 2 * bombRange * unitHeight,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(data.Y * unitWidth / 1000.0 - unitWidth * bombRange, data.X * unitHeight / 1000.0 - unitHeight * bombRange, 0, 0),
Fill = Brushes.DarkRed,
};
UpperLayerOfMap.Children.Add(icon);
break;
}
//case Protobuf.BulletType.LineBullet:
// {
// double bombRange = data.BombRange / 1000;
// DrawLaser(new Point(data.Y * unitWidth / 1000.0, data.X * unitHeight / 1000.0), -data.FacingDirection + Math.PI / 2, bombRange * unitHeight, 0.5 * unitWidth);
// break;
// }
default:
break;
}
//case Protobuf.BulletType.LineBullet:
// {
// double bombRange = data.BombRange / 1000;
// DrawLaser(new Point(data.Y * unitWidth / 1000.0, data.X * unitHeight / 1000.0), -data.FacingDirection + Math.PI / 2, bombRange * unitHeight, 0.5 * unitWidth);
// break;
// }
default:
break;
}
}
}
foreach (var data in listOfClassroom)


+ 1
- 1
logic/Gaming/AttackManager.cs View File

@@ -95,7 +95,7 @@ namespace Gaming
new Thread
(() =>
{
Thread.Sleep(GameData.frameDuration);
Thread.Sleep(GameData.frameDuration * 5);
gameMap.RemoveJustFromMap(bombedBullet);
}
)


+ 1
- 1
logic/cmd/gameServer.cmd View File

@@ -4,7 +4,7 @@ start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --

ping -n 2 127.0.0.1 > NUL

start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 4 --type 2 --occupation 2
start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 4 --type 2 --occupation 1

start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --cl --port 8888 --characterID 0 --type 1 --occupation 1



Loading…
Cancel
Save