mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 09:28:07 +08:00
- Fixed a bug caused by inconsistent state check between managed and native object. - Bump Unity version. - Update copyright text
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
// ---------------------------------------------------------------------------------------------
|
|
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ---------------------------------------------------------------------------------------------
|
|
|
|
namespace Pal3.Game.Script.Waiter
|
|
{
|
|
using Command;
|
|
using Command.Extensions;
|
|
using Core.Command;
|
|
using UnityEngine;
|
|
|
|
public sealed class WaitUntilScriptFinished : CustomYieldInstruction,
|
|
ICommandExecutor<ScriptFinishedRunningNotification>
|
|
{
|
|
public override bool keepWaiting => !_isFinished;
|
|
|
|
private readonly PalScriptType _scriptType;
|
|
private readonly uint _scriptId;
|
|
private bool _isFinished;
|
|
|
|
public WaitUntilScriptFinished(PalScriptType scriptType, uint scriptId)
|
|
{
|
|
_scriptType = scriptType;
|
|
_scriptId = scriptId;
|
|
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
|
}
|
|
|
|
public void Execute(ScriptFinishedRunningNotification command)
|
|
{
|
|
if (_scriptType == command.ScriptType && _scriptId == command.ScriptId)
|
|
{
|
|
_isFinished = true;
|
|
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
|
}
|
|
}
|
|
}
|
|
} |