| @@ -141,7 +141,7 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| public override void AddScore(int add) | |||||
| public override void AddScore(long add) | |||||
| { | { | ||||
| if (parent == null) | if (parent == null) | ||||
| base.AddScore(add); | base.AddScore(add); | ||||
| @@ -535,23 +535,20 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| #endregion | #endregion | ||||
| private int score = 0; | |||||
| public int Score | |||||
| private long score = 0; | |||||
| public long Score | |||||
| { | { | ||||
| get => score; | |||||
| get => Interlocked.Read(ref score); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| /// 加分 | /// 加分 | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="add">增加量</param> | /// <param name="add">增加量</param> | ||||
| public virtual void AddScore(int add) | |||||
| public virtual void AddScore(long add) | |||||
| { | { | ||||
| lock (gameObjLock) | |||||
| { | |||||
| score += add; | |||||
| //Debugger.Output(this, " 's score has been added to: " + score.ToString()); | |||||
| } | |||||
| Interlocked.Add(ref score, add); | |||||
| //Debugger.Output(this, " 's score has been added to: " + score.ToString()); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -17,7 +17,7 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| int score = 0; | int score = 0; | ||||
| foreach (var player in playerList) | foreach (var player in playerList) | ||||
| score += player.Score; | |||||
| score += (int)player.Score; | |||||
| return score; | return score; | ||||
| } | } | ||||
| } | } | ||||
| @@ -7,8 +7,8 @@ namespace Preparation.Interface | |||||
| { | { | ||||
| public long TeamID { get; } | public long TeamID { get; } | ||||
| public int HP { get; set; } | public int HP { get; set; } | ||||
| public int Score { get; } | |||||
| public void AddScore(int add); | |||||
| public long Score { get; } | |||||
| public void AddScore(long add); | |||||
| public double Vampire { get; } | public double Vampire { get; } | ||||
| public PlayerStateType PlayerState { get; } | public PlayerStateType PlayerState { get; } | ||||
| public BulletType BulletOfPlayer { get; set; } | public BulletType BulletOfPlayer { get; set; } | ||||
| @@ -68,7 +68,7 @@ namespace Server | |||||
| ViewRange = player.ViewRange, | ViewRange = player.ViewRange, | ||||
| Radius = player.Radius, | Radius = player.Radius, | ||||
| DangerAlert = (player.BgmDictionary.ContainsKey(BgmType.GhostIsComing)) ? player.BgmDictionary[BgmType.GhostIsComing] : 0, | DangerAlert = (player.BgmDictionary.ContainsKey(BgmType.GhostIsComing)) ? player.BgmDictionary[BgmType.GhostIsComing] : 0, | ||||
| Score = player.Score, | |||||
| Score = (int)player.Score, | |||||
| TreatProgress = player.DegreeOfTreatment, | TreatProgress = player.DegreeOfTreatment, | ||||
| RescueProgress = player.TimeOfRescue, | RescueProgress = player.TimeOfRescue, | ||||
| @@ -110,7 +110,7 @@ namespace Server | |||||
| TrickerType = Transformation.ToTrickerType(player.CharacterType), | TrickerType = Transformation.ToTrickerType(player.CharacterType), | ||||
| Guid = player.ID, | Guid = player.ID, | ||||
| Score = player.Score, | |||||
| Score = (int)player.Score, | |||||
| PlayerId = player.PlayerID, | PlayerId = player.PlayerID, | ||||
| ViewRange = player.ViewRange, | ViewRange = player.ViewRange, | ||||
| Radius = player.Radius, | Radius = player.Radius, | ||||
| @@ -196,8 +196,8 @@ namespace Server | |||||
| { | { | ||||
| foreach (Character character in game.GameMap.GameObjDict[GameObjType.Character]) | foreach (Character character in game.GameMap.GameObjDict[GameObjType.Character]) | ||||
| { | { | ||||
| if (!character.IsGhost()) score[0] += character.Score; | |||||
| else score[1] += character.Score; | |||||
| if (!character.IsGhost()) score[0] += (int)character.Score; | |||||
| else score[1] += (int)character.Score; | |||||
| } | } | ||||
| } | } | ||||