Browse Source

fix: 🐛 fix the update of bgm'

tags/0.1.0
shangfengh 2 years ago
parent
commit
2fdf444836
5 changed files with 21 additions and 9 deletions
  1. +7
    -1
      logic/GameClass/GameObj/Character/Character.cs
  2. +3
    -3
      logic/Gaming/Game.cs
  3. +2
    -2
      logic/Preparation/Utility/EnumType.cs
  4. +5
    -1
      logic/Server/CopyInfo.cs
  5. +4
    -2
      logic/Server/GameServer.cs

+ 7
- 1
logic/GameClass/GameObj/Character/Character.cs View File

@@ -175,7 +175,7 @@ namespace GameClass.GameObj
public Dictionary<BgmType, double> BgmDictionary public Dictionary<BgmType, double> BgmDictionary
{ {
get => bgmDictionary; get => bgmDictionary;
set
private set
{ {
lock (gameObjLock) lock (gameObjLock)
{ {
@@ -183,6 +183,12 @@ namespace GameClass.GameObj
} }
} }
} }
public void AddBgm(BgmType bgm, double value)
{
if (BgmDictionary.ContainsKey(bgm))
BgmDictionary[bgm] = value;
else BgmDictionary.Add(bgm, value);
}


private int alertnessRadius; private int alertnessRadius;
public int AlertnessRadius public int AlertnessRadius


+ 3
- 3
logic/Gaming/Game.cs View File

@@ -111,7 +111,7 @@ namespace Gaming
} }
} }
if (bgmVolume > 0) if (bgmVolume > 0)
newPlayer.BgmDictionary.Add(BgmType.StudentIsApproaching, bgmVolume);
newPlayer.AddBgm(BgmType.StudentIsApproaching, bgmVolume);
} }
else else
{ {
@@ -120,7 +120,7 @@ namespace Gaming
if (person.IsGhost()) if (person.IsGhost())
{ {
if (XY.Distance(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment)) if (XY.Distance(newPlayer.Position, person.Position) <= (newPlayer.AlertnessRadius / person.Concealment))
newPlayer.BgmDictionary.Add(BgmType.GhostIsComing, (double)newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position));
newPlayer.AddBgm(BgmType.GhostIsComing, (double)newPlayer.AlertnessRadius / XY.Distance(newPlayer.Position, person.Position));
break; break;
} }
} }
@@ -144,7 +144,7 @@ namespace Gaming
} }
} }
if (bgmVolume > 0) if (bgmVolume > 0)
newPlayer.BgmDictionary.Add(BgmType.StudentIsApproaching, bgmVolume);
newPlayer.AddBgm(BgmType.StudentIsApproaching, bgmVolume);
} }






+ 2
- 2
logic/Preparation/Utility/EnumType.cs View File

@@ -126,8 +126,8 @@ namespace Preparation.Utility
EmergencyExit = 10, EmergencyExit = 10,
Window = 11, Window = 11,
Door3 = 12, Door3 = 12,
Door4 =13,
Door5 = 14,
Door5 = 13,
Door6 = 14,
Chest = 15, Chest = 15,
} }
public enum BgmType public enum BgmType


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

@@ -22,7 +22,11 @@ namespace Server
case Preparation.Utility.PlaceType.Chest: case Preparation.Utility.PlaceType.Chest:
return Protobuf.PlaceType.Chest; return Protobuf.PlaceType.Chest;
case Preparation.Utility.PlaceType.Door3: case Preparation.Utility.PlaceType.Door3:
return Protobuf.PlaceType.Door;
return Protobuf.PlaceType.Door3;
case Preparation.Utility.PlaceType.Door5:
return Protobuf.PlaceType.Door5;
case Preparation.Utility.PlaceType.Door6:
return Protobuf.PlaceType.Door6;
case Preparation.Utility.PlaceType.Generator: case Preparation.Utility.PlaceType.Generator:
return Protobuf.PlaceType.Classroom; return Protobuf.PlaceType.Classroom;
case Preparation.Utility.PlaceType.Grass: case Preparation.Utility.PlaceType.Grass:


+ 4
- 2
logic/Server/GameServer.cs View File

@@ -211,8 +211,10 @@ namespace Server
case 9: return Protobuf.PlaceType.Gate; case 9: return Protobuf.PlaceType.Gate;
case 10: return Protobuf.PlaceType.HiddenGate; case 10: return Protobuf.PlaceType.HiddenGate;
case 11: return Protobuf.PlaceType.Window; case 11: return Protobuf.PlaceType.Window;
case 12: return Protobuf.PlaceType.Door;
case 13: return Protobuf.PlaceType.Chest;
case 12: return Protobuf.PlaceType.Door3;
case 13: return Protobuf.PlaceType.Door5;
case 14: return Protobuf.PlaceType.Door6;
case 15: return Protobuf.PlaceType.Chest;
default: return Protobuf.PlaceType.NullPlaceType; default: return Protobuf.PlaceType.NullPlaceType;
} }
} }


Loading…
Cancel
Save