Browse Source

fix: 🐛 lock the fixSpeed and orgCD

tags/v0.1.0
shangfengh 2 years ago
parent
commit
8163db4f40
4 changed files with 21 additions and 9 deletions
  1. +1
    -1
      logic/GameClass/GameObj/Character/Character.Skill.cs
  2. +9
    -4
      logic/GameClass/GameObj/Character/Character.Student.cs
  3. +10
    -2
      logic/GameClass/GameObj/Character/Character.cs
  4. +1
    -2
      logic/cmd/spectatorForLadder.cmd

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

@@ -11,7 +11,7 @@ namespace GameClass.GameObj
private readonly IOccupation occupation; private readonly IOccupation occupation;
public IOccupation Occupation => occupation; public IOccupation Occupation => occupation;


private Dictionary<ActiveSkillType, ActiveSkill> activeSkillDictionary = new();
private readonly Dictionary<ActiveSkillType, ActiveSkill> activeSkillDictionary = new();
public Dictionary<ActiveSkillType, ActiveSkill> ActiveSkillDictionary => activeSkillDictionary; public Dictionary<ActiveSkillType, ActiveSkill> ActiveSkillDictionary => activeSkillDictionary;


public ActiveSkill FindActiveSkill(ActiveSkillType activeSkillType) public ActiveSkill FindActiveSkill(ActiveSkillType activeSkillType)


+ 9
- 4
logic/GameClass/GameObj/Character/Character.Student.cs View File

@@ -7,16 +7,21 @@ namespace GameClass.GameObj
{ {
public class Student : Character public class Student : Character
{ {
private readonly object fixLock = new();
protected int fixSpeed; protected int fixSpeed;
/// <summary> /// <summary>
/// 修理电机速度 /// 修理电机速度
/// </summary> /// </summary>
public int FixSpeed public int FixSpeed
{ {
get => fixSpeed;
get
{
lock (fixLock)
return fixSpeed;
}
set set
{ {
lock (gameObjLock)
lock (fixLock)
{ {
fixSpeed = value; fixSpeed = value;
} }
@@ -25,7 +30,7 @@ namespace GameClass.GameObj
/// <summary> /// <summary>
/// 原初修理电机速度 /// 原初修理电机速度
/// </summary> /// </summary>
public int OrgFixSpeed { get; protected set; }
protected readonly int orgFixSpeed;


protected int treatSpeed = GameData.basicTreatSpeed; protected int treatSpeed = GameData.basicTreatSpeed;
public int TreatSpeed public int TreatSpeed
@@ -122,7 +127,7 @@ namespace GameClass.GameObj


public Student(XY initPos, int initRadius, CharacterType characterType) : base(initPos, initRadius, characterType) public Student(XY initPos, int initRadius, CharacterType characterType) : base(initPos, initRadius, characterType)
{ {
this.OrgFixSpeed = this.fixSpeed = ((IStudentType)Occupation).FixSpeed;
this.orgFixSpeed = this.fixSpeed = ((IStudentType)Occupation).FixSpeed;
this.TreatSpeed = this.OrgTreatSpeed = ((IStudentType)Occupation).TreatSpeed; this.TreatSpeed = this.OrgTreatSpeed = ((IStudentType)Occupation).TreatSpeed;
this.MaxGamingAddiction = ((IStudentType)Occupation).MaxGamingAddiction; this.MaxGamingAddiction = ((IStudentType)Occupation).MaxGamingAddiction;
} }


+ 10
- 2
logic/GameClass/GameObj/Character/Character.cs View File

@@ -31,7 +31,15 @@ namespace GameClass.GameObj
} }
} }
} }
public int OrgCD { get; protected set; }
private int orgCD;
public int OrgCD
{
get
{
lock (actionLock)
return orgCD;
}
}


public readonly BulletType OriBulletOfPlayer; public readonly BulletType OriBulletOfPlayer;
private BulletType bulletOfPlayer; private BulletType bulletOfPlayer;
@@ -49,7 +57,7 @@ namespace GameClass.GameObj
lock (actionLock) lock (actionLock)
{ {
bulletOfPlayer = value; bulletOfPlayer = value;
cd = OrgCD = (BulletFactory.BulletCD(value));
cd = orgCD = (BulletFactory.BulletCD(value));
Debugger.Output(this, string.Format("'s CD has been set to: {0}.", cd)); Debugger.Output(this, string.Format("'s CD has been set to: {0}.", cd));
maxBulletNum = bulletNum = (BulletFactory.BulletNum(value)); maxBulletNum = bulletNum = (BulletFactory.BulletNum(value));
} }


+ 1
- 2
logic/cmd/spectatorForLadder.cmd View File

@@ -1,3 +1,2 @@
@echo off @echo off

start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --port 8891 --characterId 2087 --ip thuai6.eesast.com
start cmd /k ..\Client\bin\Debug\net6.0-windows\Client.exe --port 8894 --characterID 123321123 --type 1 --occupation 1 --ip thuai6.eesast.com --cl

Loading…
Cancel
Save