Skip to content

Commit a9bd58a

Browse files
committed
[修改]1. 修改全局参数的IsDebug 变动适配
1 parent ede6b15 commit a9bd58a

4 files changed

Lines changed: 11 additions & 15 deletions

File tree

GameFrameX.Core/Actors/Impl/WorkActor.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public static long NextChainId()
109109
}
110110

111111
#region 勿调用(仅供代码生成器调用)
112+
112113
/// <summary>
113114
/// 将一个同步Action任务压入Actor的任务队列中执行
114115
/// </summary>
@@ -120,7 +121,7 @@ public static long NextChainId()
120121
/// <returns>返回一个Task对象,表示异步操作的完成状态</returns>
121122
public Task Enqueue(Action work, long callChainId, bool discard = false, int timeOut = TimeOut, CancellationToken cancellationToken = default)
122123
{
123-
if (!discard && GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
124+
if (!discard && GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
124125
{
125126
return default;
126127
}
@@ -147,7 +148,7 @@ public Task Enqueue(Action work, long callChainId, bool discard = false, int tim
147148
/// <returns>返回一个Task<T/>对象,表示异步操作的完成状态和结果</returns>
148149
public Task<T> Enqueue<T>(Func<T> work, long callChainId, bool discard = false, int timeOut = TimeOut, CancellationToken cancellationToken = default)
149150
{
150-
if (!discard && GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
151+
if (!discard && GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
151152
{
152153
return default;
153154
}
@@ -173,7 +174,7 @@ public Task<T> Enqueue<T>(Func<T> work, long callChainId, bool discard = false,
173174
/// <returns>返回一个Task对象,表示异步操作的完成状态</returns>
174175
public Task Enqueue(Func<Task> work, long callChainId, bool discard = false, int timeOut = TimeOut, CancellationToken cancellationToken = default)
175176
{
176-
if (!discard && GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
177+
if (!discard && GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
177178
{
178179
return default;
179180
}
@@ -200,7 +201,7 @@ public Task Enqueue(Func<Task> work, long callChainId, bool discard = false, int
200201
/// <returns>返回一个Task<T/>对象,表示异步操作的完成状态和结果</returns>
201202
public Task<T> Enqueue<T>(Func<Task<T>> work, long callChainId, bool discard = false, int timeOut = TimeOut, CancellationToken cancellationToken = default)
202203
{
203-
if (!discard && GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
204+
if (!discard && GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
204205
{
205206
return default;
206207
}
@@ -218,6 +219,7 @@ public Task<T> Enqueue<T>(Func<Task<T>> work, long callChainId, bool discard = f
218219
#endregion
219220

220221
#region 供框架底层调用(逻辑开发人员应尽量避免调用)
222+
221223
/// <summary>
222224
/// 发送无返回值的工作指令到Actor的任务队列中
223225
/// </summary>
@@ -265,7 +267,7 @@ public Task SendAsync(Action work, int timeOut = Actor.TimeOut, CancellationToke
265267
var (needEnqueue, chainId) = IsNeedEnqueue();
266268
if (needEnqueue)
267269
{
268-
if (GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
270+
if (GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
269271
{
270272
return default;
271273
}
@@ -297,7 +299,7 @@ public Task<T> SendAsync<T>(Func<T> work, int timeOut = Actor.TimeOut, Cancellat
297299
var (needEnqueue, chainId) = IsNeedEnqueue();
298300
if (needEnqueue)
299301
{
300-
if (GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
302+
if (GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
301303
{
302304
return default;
303305
}
@@ -340,7 +342,7 @@ public Task SendAsync(Func<Task> work, int timeOut = int.MaxValue, bool checkLoc
340342
var (needEnqueue, chainId) = IsNeedEnqueue();
341343
if (needEnqueue)
342344
{
343-
if (checkLock && GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
345+
if (checkLock && GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
344346
{
345347
return default;
346348
}
@@ -371,7 +373,7 @@ public Task<T> SendAsync<T>(Func<Task<T>> work, int timeOut = int.MaxValue, Canc
371373
var (needEnqueue, chainId) = IsNeedEnqueue();
372374
if (needEnqueue)
373375
{
374-
if (GlobalSettings.IsDebug && !ActorLimit.AllowCall(Id))
376+
if (GlobalSettings.CurrentSetting.IsDebug && !ActorLimit.AllowCall(Id))
375377
{
376378
return default;
377379
}

GameFrameX.Core/Hotfix/HotfixModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void Unload()
148148
if (_dllLoader != null)
149149
{
150150
var weak = _dllLoader.Unload();
151-
if (GlobalSettings.IsDebug)
151+
if (GlobalSettings.CurrentSetting.IsDebug)
152152
{
153153
// 检查热更DLL是否已经释放
154154
Task.Run(async () =>

GameFrameX.StartUp/AppStartUpBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public bool Init(ServerType serverType, AppSetting setting, string[] args = null
5151
Setting.CheckNotNull(nameof(Setting));
5252
GlobalSettings.SetCurrentSetting(setting);
5353
GlobalSettings.SaveIntervalInMilliSeconds = Setting.SaveDataInterval;
54-
GlobalSettings.IsDebug = Setting.IsDebug;
5554
return true;
5655
}
5756

GameFrameX.Utility/Setting/GlobalSettings.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ public static class GlobalSettings
3333
/// </summary>
3434
public static DateTime LaunchTime { get; set; }
3535

36-
/// <summary>
37-
/// 是否是调试模式
38-
/// </summary>
39-
public static bool IsDebug { get; set; }
40-
4136
/// <summary>
4237
/// 数据存储间隔 单位 毫秒,默认5分钟,最小1秒
4338
/// </summary>

0 commit comments

Comments
 (0)