Browse Source

feat: add the SafeValue StartTime

dev
shangfengh 2 years ago
parent
commit
42afd92370
3 changed files with 505 additions and 115 deletions
  1. +2
    -2
      logic/GameClass/GameObj/Map/Chest.cs
  2. +131
    -105
      logic/Preparation/Utility/SafeValue/InTheRange.cs
  3. +372
    -8
      logic/Preparation/Utility/SafeValue/TimeBased.cs

+ 2
- 2
logic/GameClass/GameObj/Map/Chest.cs View File

@@ -18,7 +18,7 @@ namespace GameClass.GameObj
private readonly Gadget[] propInChest = new Gadget[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() };
public Gadget[] PropInChest => propInChest;

private TimeBasedProgressForInterrupting openProgress = new TimeBasedProgressForInterrupting();
public TimeBasedProgressForInterrupting OpenProgress { get => openProgress; }
private TimeBasedProgressOptimizedForInterrupting openProgress = new TimeBasedProgressOptimizedForInterrupting();
public TimeBasedProgressOptimizedForInterrupting OpenProgress { get => openProgress; }
}
}

+ 131
- 105
logic/Preparation/Utility/SafeValue/InTheRange.cs View File

@@ -13,6 +13,7 @@ namespace Preparation.Utility
private int v;
private int maxV;
private readonly object vLock = new();
#region 构造与读取
public IntInTheVariableRange(int value, int maxValue)
{
if (maxValue < 0)
@@ -50,7 +51,10 @@ namespace Preparation.Utility
public int GetValue() { lock (vLock) return v; }
public static implicit operator int(IntInTheVariableRange aint) => aint.GetValue();
public int GetMaxV() { lock (vLock) return maxV; }
public bool IsMaxV() { lock (vLock) return v == maxV; }
#endregion

#region 普通设置MaxV与Value的值的方法
/// <summary>
/// 若maxValue<=0则maxValue设为0并返回False
/// </summary>
@@ -82,29 +86,7 @@ namespace Preparation.Utility
if (v > maxValue) v = maxValue;
}
}
/// <summary>
/// 如果当前值大于maxValue,则更新maxValue失败
/// </summary>
public bool TrySetMaxV(int maxValue)
{
lock (vLock)
{
if (v > maxValue) return false;
maxV = maxValue;
return true;
}
}

/// <summary>
/// 应当保证该value>=0
/// </summary>
public int SetPositiveV(int value)
{
lock (vLock)
{
return v = (value > maxV) ? maxV : value;
}
}
public int SetV(int value)
{
if (value <= 0)
@@ -119,6 +101,19 @@ namespace Preparation.Utility
return v = (value > maxV) ? maxV : value;
}
}
/// <summary>
/// 应当保证该value>=0
/// </summary>
public int SetPositiveV(int value)
{
lock (vLock)
{
return v = (value > maxV) ? maxV : value;
}
}
#endregion

#region 普通运算
/// <returns>返回实际改变量</returns>
public int AddV(int addV)
{
@@ -193,30 +188,26 @@ namespace Preparation.Utility
}
return subPositiveV;
}
#endregion

#region 特殊条件的设置MaxV与Value的值的方法
/// <summary>
/// 试图加到满,如果无法加到maxValue则不加并返回-1
/// 如果当前值大于maxValue,则更新maxValue失败
/// </summary>
/// <returns>返回实际改变量</returns>
public int TryAddToMaxV(int addV)
public bool TrySetMaxV(int maxValue)
{
lock (vLock)
{
if (maxV - v <= addV)
{
addV = maxV - v;
v = maxV;
return addV;
}
return -1;
if (v > maxValue) return false;
maxV = maxValue;
return true;
}
}

public bool Set0IfNotMax()
public bool Set0IfNotMaxor0()
{
lock (vLock)
{
if (v < maxV)
if (v < maxV && v > 0)
{
v = 0;
return true;
@@ -236,14 +227,27 @@ namespace Preparation.Utility
}
return false;
}
#endregion

public bool IsMaxV()
#region 特殊条件的运算
/// <summary>
/// 试图加到满,如果无法加到maxValue则不加并返回-1
/// </summary>
/// <returns>返回实际改变量</returns>
public int TryAddToMaxV(int addV)
{
lock (vLock)
{
return v == maxV;
if (maxV - v <= addV)
{
addV = maxV - v;
v = maxV;
return addV;
}
return -1;
}
}
#endregion
}

/// <summary>
@@ -254,6 +258,7 @@ namespace Preparation.Utility
private long v;
private long maxV;
private readonly object vLock = new();
#region 构造与读取
public LongInTheVariableRange(long value, long maxValue)
{
if (maxValue < 0)
@@ -291,7 +296,16 @@ namespace Preparation.Utility
public long GetValue() { lock (vLock) return v; }
public static implicit operator long(LongInTheVariableRange aint) => aint.GetValue();
public long GetMaxV() { lock (vLock) return maxV; }
public bool IsMaxV()
{
lock (vLock)
{
return v == maxV;
}
}
#endregion

#region 普通设置MaxV与Value的值的方法
/// <summary>
/// 若maxValue<=0则maxValue设为0并返回False
/// </summary>
@@ -323,29 +337,7 @@ namespace Preparation.Utility
if (v > maxValue) v = maxValue;
}
}
/// <summary>
/// 如果当前值大于maxValue,则更新maxValue失败
/// </summary>
public bool TrySetMaxV(long maxValue)
{
lock (vLock)
{
if (v > maxValue) return false;
maxV = maxValue;
return true;
}
}

/// <summary>
/// 应当保证该value>=0
/// </summary>
public long SetPositiveV(long value)
{
lock (vLock)
{
return v = (value > maxV) ? maxV : value;
}
}
public long SetV(long value)
{
if (value <= 0)
@@ -360,6 +352,19 @@ namespace Preparation.Utility
return v = (value > maxV) ? maxV : value;
}
}
/// <summary>
/// 应当保证该value>=0
/// </summary>
public long SetPositiveV(long value)
{
lock (vLock)
{
return v = (value > maxV) ? maxV : value;
}
}
#endregion

#region 普通运算
/// <returns>返回实际改变量</returns>
public long AddV(long addV)
{
@@ -434,22 +439,19 @@ namespace Preparation.Utility
}
return subPositiveV;
}
#endregion

#region 特殊条件的设置MaxV与Value的值的方法
/// <summary>
/// 试图加到满,如果无法加到maxValue则不加并返回-1
/// 如果当前值大于maxValue,则更新maxValue失败
/// </summary>
/// <returns>返回实际改变量</returns>
public long TryAddToMaxV(long addV)
public bool TrySetMaxV(long maxValue)
{
lock (vLock)
{
if (maxV - v <= addV)
{
addV = maxV - v;
v = maxV;
return addV;
}
return -1;
if (v > maxValue) return false;
maxV = maxValue;
return true;
}
}

@@ -477,14 +479,27 @@ namespace Preparation.Utility
}
return false;
}
#endregion

public bool IsMaxV()
#region 特殊条件的运算
/// <summary>
/// 试图加到满,如果无法加到maxValue则不加并返回-1
/// </summary>
/// <returns>返回实际改变量</returns>
public long TryAddToMaxV(long addV)
{
lock (vLock)
{
return v == maxV;
if (maxV - v <= addV)
{
addV = maxV - v;
v = maxV;
return addV;
}
return -1;
}
}
#endregion
}

/// <summary>
@@ -495,6 +510,7 @@ namespace Preparation.Utility
private double v;
private double maxV;
private readonly object vLock = new();
#region 构造与读取
public DoubleInTheVariableRange(double value, double maxValue)
{
if (maxValue < 0)
@@ -532,7 +548,16 @@ namespace Preparation.Utility
public double GetValue() { lock (vLock) return v; }
public static implicit operator double(DoubleInTheVariableRange adouble) => adouble.GetValue();
public double GetMaxV() { lock (vLock) return maxV; }
public bool IsMaxV()
{
lock (vLock)
{
return v == maxV;
}
}
#endregion

#region 普通设置MaxV与Value的值的方法
/// <summary>
/// 若maxValue<=0则maxValue设为0并返回False
/// </summary>
@@ -564,29 +589,7 @@ namespace Preparation.Utility
if (v > maxValue) v = maxValue;
}
}
/// <summary>
/// 如果当前值大于maxValue,则更新maxValue失败
/// </summary>
public bool TrySetMaxV(double maxValue)
{
lock (vLock)
{
if (v > maxValue) return false;
maxV = maxValue;
return true;
}
}

/// <summary>
/// 应当保证该value>=0
/// </summary>
public double SetPositiveV(double value)
{
lock (vLock)
{
return v = (value > maxV) ? maxV : value;
}
}
public double SetV(double value)
{
if (value <= 0)
@@ -601,6 +604,19 @@ namespace Preparation.Utility
return v = (value > maxV) ? maxV : value;
}
}
/// <summary>
/// 应当保证该value>=0
/// </summary>
public double SetPositiveV(double value)
{
lock (vLock)
{
return v = (value > maxV) ? maxV : value;
}
}
#endregion

#region 普通运算
/// <returns>返回实际改变量</returns>
public double AddV(double addV)
{
@@ -675,22 +691,19 @@ namespace Preparation.Utility
}
return subPositiveV;
}
#endregion

#region 特殊条件的设置MaxV与Value的值的方法
/// <summary>
/// 试图加到满,如果无法加到maxValue则不加并返回-1
/// 如果当前值大于maxValue,则更新maxValue失败
/// </summary>
/// <returns>返回实际改变量</returns>
public double TryAddToMaxV(double addV)
public bool TrySetMaxV(double maxValue)
{
lock (vLock)
{
if (maxV - v <= addV)
{
addV = maxV - v;
v = maxV;
return addV;
}
return -1;
if (v > maxValue) return false;
maxV = maxValue;
return true;
}
}

@@ -718,13 +731,26 @@ namespace Preparation.Utility
}
return false;
}
#endregion

public bool IsMaxV()
#region 特殊条件的运算
/// <summary>
/// 试图加到满,如果无法加到maxValue则不加并返回-1
/// </summary>
/// <returns>返回实际改变量</returns>
public double TryAddToMaxV(double addV)
{
lock (vLock)
{
return v == maxV;
if (maxV - v <= addV)
{
addV = maxV - v;
v = maxV;
return addV;
}
return -1;
}
}
#endregion
}
}

+ 372
- 8
logic/Preparation/Utility/SafeValue/TimeBased.cs View File

@@ -5,23 +5,47 @@ namespace Preparation.Utility
{
//其对应属性不应当有set访问器,避免不安全的=赋值

/// <summary>
/// 记录上次Start的时间,尚未Start则为long.MaxValue
/// 当前不为long.MaxValue则不能Start
/// </summary>
public class StartTime
{
private long _time;
public StartTime(long time)
{
_time = time;
}
public StartTime() { _time = long.MaxValue; }
public long Get() => Interlocked.CompareExchange(ref _time, -2, -2);
/// <returns>返回操作前的值</returns>
public long Start() => Interlocked.CompareExchange(ref _time, Environment.TickCount64, long.MaxValue);
/// <returns>返回操作前的值</returns>
public long Stop() => Interlocked.Exchange(ref _time, long.MaxValue);
public void StopIfPassing(long passedTime)
{
if (Environment.TickCount64 - Interlocked.CompareExchange(ref _time, -2, -2) > passedTime)
Interlocked.Exchange(ref _time, long.MaxValue);
}
}

/// <summary>
/// 根据时间推算Start后完成多少进度的进度条(long)。
/// 只允许Start(清零状态的进度条才可以Start)时修改needTime(请确保大于0);
/// 支持InterruptToSet0使未完成的进度条终止清零;支持Set0使进度条强制终止清零;
/// 通过原子操作实现。
/// </summary>
public class TimeBasedProgressForInterrupting
public class TimeBasedProgressOptimizedForInterrupting
{
private long endT = long.MaxValue;
private long needT;

public TimeBasedProgressForInterrupting(long needTime)
public TimeBasedProgressOptimizedForInterrupting(long needTime)
{
if (needTime <= 0) Debugger.Output("Bug:TimeBasedProgressForInterrupting.needTime (" + needTime.ToString() + ") is less than 0.");
if (needTime <= 0) Debugger.Output("Bug:TimeBasedProgressOptimizedForInterrupting.needProgress (" + needTime.ToString() + ") is less than 0.");
this.needT = needTime;
}
public TimeBasedProgressForInterrupting()
public TimeBasedProgressOptimizedForInterrupting()
{
this.needT = 0;
}
@@ -32,7 +56,7 @@ namespace Preparation.Utility
{
return Interlocked.CompareExchange(ref endT, -2, -2) <= Environment.TickCount64;
}
public bool IsOpened() => Interlocked.Read(ref endT) != long.MaxValue;
public bool IsStarted() => Interlocked.Read(ref endT) != long.MaxValue;
/// <summary>
/// GetProgress<0则表明未开始
/// </summary>
@@ -68,7 +92,7 @@ namespace Preparation.Utility
/// <summary>
/// <0则表明未开始
/// </summary>
public static implicit operator long(TimeBasedProgressForInterrupting pLong) => pLong.GetProgress();
public static implicit operator long(TimeBasedProgressOptimizedForInterrupting pLong) => pLong.GetProgress();

/// <summary>
/// GetProgressDouble<0则表明未开始
@@ -94,12 +118,12 @@ namespace Preparation.Utility
{
if (needTime <= 0)
{
Debugger.Output("Warning:Start TimeBasedProgressForInterrupting with the needTime (" + needTime.ToString() + ") which is less than 0.");
Debugger.Output("Warning:Start TimeBasedProgressOptimizedForInterrupting with the needProgress (" + needTime.ToString() + ") which is less than 0.");
return false;
}
//规定只有Start可以修改needT,且需要先访问endTime,从而避免锁(某种程度上endTime可以认为是needTime的锁)
if (Interlocked.CompareExchange(ref endT, Environment.TickCount64 + needTime, long.MaxValue) != long.MaxValue) return false;
if (needTime <= 2) Debugger.Output("Warning:the field of TimeBasedProgressForInterrupting is " + needTime.ToString() + ",which is too small.");
if (needTime <= 2) Debugger.Output("Warning:the field of TimeBasedProgressOptimizedForInterrupting is " + needTime.ToString() + ",which is too small.");
Interlocked.Exchange(ref needT, needTime);
return true;
}
@@ -127,6 +151,346 @@ namespace Preparation.Utility
}
//增加其他新的写操作可能导致不安全
}
/*
public class TimeBasedProgressAtVariableSpeed
{
private long progress = 0;
private long lastStartT = long.MaxValue;
private readonly object progressLock = new();
private long needProgress;

public TimeBasedProgressAtVariableSpeed(long needProgress)
{
if (needProgress <= 0) Debugger.Output("Bug:TimeBasedProgressAtVariableSpeed.needProgress (" + needProgress.ToString() + ") is less than 0.");
this.needProgress = needProgress;
}
public TimeBasedProgressAtVariableSpeed()
{
this.needProgress = 0;
}
public long GetNeedProgress()
{
lock (progressLock) return needProgress;
}
public override string ToString()
{
lock (progressLock)
{
return "NeedProgress:" + Interlocked.CompareExchange(ref needProgress, -2, -2).ToString() + " ms, "
+ "FinishedProgress:" + progress.ToString() +"ms, "
+ "lastStartTime:" +lastStartT.ToString() +"ms";
}
}
public long GetProgressNow()
{
lock (progressLock)
{
if (lastStartT==long.MaxValue) return progress;
long progressNow = progress + Environment.TickCount64 - lastStartT;
if (progressNow>= needProgress)
{
lastStartT = long.MaxValue;
return progress = needProgress;
}
return progressNow;
}
}

public bool IsFinished()
{
lock (progressLock)
{
if (progress >= needProgress) return true;
if (progress + Environment.TickCount64 - lastStartT >= needProgress)
{
lastStartT = long.MaxValue;
progress = needProgress;
return true;
}
return false;
}
}
public bool IsProgressing()
{
lock (progressLock)
{
if (lastStartT==long.MaxValue) return false;
if (progress + Environment.TickCount64 - lastStartT >= needProgress)
{
lastStartT = long.MaxValue;
progress = needProgress;
return false;
}
return true;
}
}

/// <summary>
/// GetProgress<0则表明未开始
/// </summary>
public long GetProgress()
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
return Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
}
public long GetNonNegativeProgress()
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
long progress = Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
return progress < 0 ? 0 : progress;
}
/// <summary>
/// GetProgress<0则表明未开始
/// </summary>
public long GetProgress(long time)
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - time;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
return Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
}
public long GetNonNegativeProgress(long time)
{
long cutime = Interlocked.Read(ref endT) - time;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
long progress = Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
return progress < 0 ? 0 : progress;
}
/// <summary>
/// <0则表明未开始
/// </summary>
public static implicit operator long(TimeBasedProgressAtVariableSpeed pLong) => pLong.GetProgress();

/// <summary>
/// GetProgressDouble<0则表明未开始
/// </summary>
public double GetProgressDouble()
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
if (cutime <= 0) return 1;
long needTime = Interlocked.CompareExchange(ref needProgress, -2, -2);
if (needTime == 0) return 0;
return 1.0 - ((double)cutime / needTime);
}
public double GetNonNegativeProgressDouble(long time)
{
long cutime = Interlocked.Read(ref endT) - time;
if (cutime <= 0) return 1;
long needTime = Interlocked.CompareExchange(ref needProgress, -2, -2);
if (needTime <= cutime) return 0;
return 1.0 - ((double)cutime / needTime);
}

public bool Start(long needTime)
{
if (needTime <= 2)
{
Debugger.Output("Warning:Start TimeBasedProgressAtVariableSpeed with the needProgress (" + needTime.ToString() + ") which is less than 0.");
return false;
}
//规定只有Start可以修改needT,且需要先访问startTime,从而避免锁(某种程度上endTime可以认为是needTime的锁)
if (Interlocked.CompareExchange(ref lastStartT, Environment.TickCount64, long.MaxValue) != long.MaxValue) return false;
Interlocked.Exchange(ref needProgress, needTime);
return true;
}
public bool Start()
{
return Interlocked.CompareExchange(ref lastStartT, Environment.TickCount64, long.MaxValue) == long.MaxValue;
}
/// <summary>
/// 使进度条强制终止清零
/// </summary>
public void Set0()
{
Interlocked.Exchange(ref lastStartT, long.MaxValue);
Interlocked.Exchange(ref progress, 0);
}
/// <summary>
/// 使进度条暂停
/// </summary>
public bool Pause()
{
Interlocked.CompareExchange(ref lastStartT, -2, -2)
if (Environment.TickCount64 < )
{
Interlocked.Exchange(ref endT, long.MaxValue);
return true;
}
return false;
}
}*/

public class TimeBasedProgressAtVariableSpeed
{
private long progress = 0;
private long lastStartT = long.MaxValue;
private readonly object progressLock = new();
private long needProgress;
private double speed;

public TimeBasedProgressAtVariableSpeed(long needProgress, double speed)
{
if (needProgress <= 0) Debugger.Output("Bug:TimeBasedProgressAtVariableSpeed.needProgress (" + needProgress.ToString() + ") is less than 0.");
this.needProgress = needProgress;
this.speed = speed;
}
public TimeBasedProgressAtVariableSpeed()
{
this.needProgress = 0;
}
public long GetNeedProgress()
{
lock (progressLock) return needProgress;
}
public override string ToString()
{
lock (progressLock)
{
return "NeedProgress:" + Interlocked.CompareExchange(ref needProgress, -2, -2).ToString() + " ms, "
+ "FinishedProgress:" + progress.ToString() + "ms, "
+ "lastStartTime:" + lastStartT.ToString() + "ms";
}
}
public long GetProgressNow()
{
lock (progressLock)
{
if (lastStartT == long.MaxValue) return progress;
long progressNow = progress + Environment.TickCount64 - lastStartT;
if (progressNow >= needProgress)
{
lastStartT = long.MaxValue;
return progress = needProgress;
}
return progressNow;
}
}

public bool IsFinished()
{
lock (progressLock)
{
if (progress >= needProgress) return true;
if (progress + Environment.TickCount64 - lastStartT >= needProgress)
{
lastStartT = long.MaxValue;
progress = needProgress;
return true;
}
return false;
}
}
public bool IsProgressing()
{
lock (progressLock)
{
if (lastStartT == long.MaxValue) return false;
if (progress + Environment.TickCount64 - lastStartT >= needProgress)
{
lastStartT = long.MaxValue;
progress = needProgress;
return false;
}
return true;
}
}

/// <summary>
/// GetProgress<0则表明未开始
/// </summary>
public long GetProgress()
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
return Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
}
public long GetNonNegativeProgress()
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
long progress = Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
return progress < 0 ? 0 : progress;
}
/// <summary>
/// GetProgress<0则表明未开始
/// </summary>
public long GetProgress(long time)
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - time;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
return Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
}
public long GetNonNegativeProgress(long time)
{
long cutime = Interlocked.Read(ref endT) - time;
if (cutime <= 0) return Interlocked.CompareExchange(ref needProgress, -2, -2);
long progress = Interlocked.CompareExchange(ref needProgress, -2, -2) - cutime;
return progress < 0 ? 0 : progress;
}
/// <summary>
/// <0则表明未开始
/// </summary>
public static implicit operator long(TimeBasedProgressAtVariableSpeed pLong) => pLong.GetProgress();

/// <summary>
/// GetProgressDouble<0则表明未开始
/// </summary>
public double GetProgressDouble()
{
long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
if (cutime <= 0) return 1;
long needTime = Interlocked.CompareExchange(ref needProgress, -2, -2);
if (needTime == 0) return 0;
return 1.0 - ((double)cutime / needTime);
}
public double GetNonNegativeProgressDouble(long time)
{
long cutime = Interlocked.Read(ref endT) - time;
if (cutime <= 0) return 1;
long needTime = Interlocked.CompareExchange(ref needProgress, -2, -2);
if (needTime <= cutime) return 0;
return 1.0 - ((double)cutime / needTime);
}

public bool Start(long needTime)
{
if (needTime <= 2)
{
Debugger.Output("Warning:Start TimeBasedProgressAtVariableSpeed with the needProgress (" + needTime.ToString() + ") which is less than 0.");
return false;
}
//规定只有Start可以修改needT,且需要先访问startTime,从而避免锁(某种程度上endTime可以认为是needTime的锁)
if (Interlocked.CompareExchange(ref lastStartT, Environment.TickCount64, long.MaxValue) != long.MaxValue) return false;
Interlocked.Exchange(ref needProgress, needTime);
return true;
}
public bool Start()
{
return Interlocked.CompareExchange(ref lastStartT, Environment.TickCount64, long.MaxValue) == long.MaxValue;
}
/// <summary>
/// 使进度条强制终止清零
/// </summary>
public void Set0()
{
Interlocked.Exchange(ref lastStartT, long.MaxValue);
Interlocked.Exchange(ref progress, 0);
}
/// <summary>
/// 使进度条暂停
/// </summary>
public bool Pause()
{
Interlocked.CompareExchange(ref lastStartT, -2, -2)
if (Environment.TickCount64 < )
{
Interlocked.Exchange(ref endT, long.MaxValue);
return true;
}
return false;
}
}

/// <summary>
/// 冷却时间为可变的CDms的bool,不支持查看当前进度,初始为True


Loading…
Cancel
Save