mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
refactor: use equality operators when evaluating bool?
This PR replaces the use of null-coalescing defaults on nullable booleans with explicit equality checks across instance control methods. The changes make the intent clearer by ensuring only a true result is treated as a positive outcome. - Consider using the equality operators when evaluating `bool?`: DeepSource flagged instances where `GetInstance(...)?... ?? false` was used to coerce a nullable bool to false implicitly. We replaced these patterns in `PauseOnInstance`, `ResumeOnInstance`, and `KillOnInstance` with `== true` comparisons. Using `== true` clearly indicates that only an explicit true value returns a positive result and avoids ambiguity when the value is null. > This Autofix was generated by AI. Please review the change before merging.
This commit is contained in:
parent
41592013ec
commit
c9617fba8a
@ -361,7 +361,7 @@ public partial class Timing : Node
|
|||||||
/// <returns>是否成功暂停</returns>
|
/// <returns>是否成功暂停</returns>
|
||||||
public static bool PauseCoroutine(CoroutineHandle handle)
|
public static bool PauseCoroutine(CoroutineHandle handle)
|
||||||
{
|
{
|
||||||
return GetInstance(handle.Key)?.PauseOnInstance(handle) ?? false;
|
return GetInstance(handle.Key)?.PauseOnInstance(handle) == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -371,7 +371,7 @@ public partial class Timing : Node
|
|||||||
/// <returns>是否成功恢复</returns>
|
/// <returns>是否成功恢复</returns>
|
||||||
public static bool ResumeCoroutine(CoroutineHandle handle)
|
public static bool ResumeCoroutine(CoroutineHandle handle)
|
||||||
{
|
{
|
||||||
return GetInstance(handle.Key)?.ResumeOnInstance(handle) ?? false;
|
return GetInstance(handle.Key)?.ResumeOnInstance(handle) == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -381,7 +381,7 @@ public partial class Timing : Node
|
|||||||
/// <returns>是否成功终止</returns>
|
/// <returns>是否成功终止</returns>
|
||||||
public static bool KillCoroutine(CoroutineHandle handle)
|
public static bool KillCoroutine(CoroutineHandle handle)
|
||||||
{
|
{
|
||||||
return GetInstance(handle.Key)?.KillOnInstance(handle) ?? false;
|
return GetInstance(handle.Key)?.KillOnInstance(handle) == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user