fix(game): 清理 SettingsSystem 与 ScopedStorage 的 MA0004

- 修复 SettingsSystem 中不依赖上下文的 await,补充 ConfigureAwait(false)
- 修复 ScopedStorage.DeleteAsync 的 await,保持作用域前缀语义不变
This commit is contained in:
gewuyou 2026-04-25 09:29:01 +08:00
parent 425c22d98f
commit 64c8589489
2 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ public class SettingsSystem : AbstractSystem, ISettingsSystem
public async Task ApplyAll()
{
// 遍历所有设置应用器并尝试应用
foreach (var applicator in _model.AllApplicators()) await TryApplyAsync(applicator);
foreach (var applicator in _model.AllApplicators()) await TryApplyAsync(applicator).ConfigureAwait(false);
}
/// <summary>
@ -41,7 +41,7 @@ public class SettingsSystem : AbstractSystem, ISettingsSystem
/// <returns>完成的任务</returns>
public async Task SaveAll()
{
await _model.SaveAllAsync();
await _model.SaveAllAsync().ConfigureAwait(false);
}
/// <summary>
@ -51,7 +51,7 @@ public class SettingsSystem : AbstractSystem, ISettingsSystem
public async Task ResetAll()
{
_model.ResetAll();
await ApplyAll();
await ApplyAll().ConfigureAwait(false);
}
/// <summary>
@ -62,7 +62,7 @@ public class SettingsSystem : AbstractSystem, ISettingsSystem
public async Task Reset<T>() where T : class, ISettingsData, IResetApplyAbleSettings, new()
{
_model.Reset<T>();
await Apply<T>();
await Apply<T>().ConfigureAwait(false);
}
@ -87,7 +87,7 @@ public class SettingsSystem : AbstractSystem, ISettingsSystem
try
{
await applyAbleSettings.ApplyAsync();
await applyAbleSettings.ApplyAsync().ConfigureAwait(false);
// 发送设置应用成功事件
this.SendEvent(new SettingsAppliedEvent<ISettingsSection>(section, true));
}

View File

@ -102,7 +102,7 @@ public sealed class ScopedStorage(IStorage inner, string prefix) : IScopedStorag
/// <returns>异步操作任务</returns>
public async Task DeleteAsync(string key)
{
await inner.DeleteAsync(Key(key));
await inner.DeleteAsync(Key(key)).ConfigureAwait(false);
}
/// <summary>
@ -166,4 +166,4 @@ public sealed class ScopedStorage(IStorage inner, string prefix) : IScopedStorag
{
return new ScopedStorage(inner, Key(scope));
}
}
}