mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 17:38:10 +08:00
Correct PAL3A parameter signatures and add handlers for fortune selection, skybox sequences, actor facing and attacks, team and progression state, camera constraints, and battle preparation flags. Give script instances separate locals, advance grouped waits concurrently, and pause PAL3A parents only for their directly decoded child calls. Cancel stale interactions and save replay on reset, preserve finite action semantics, and restore camera orientation after releasing horizontal constraints. Persist supported state in v2 saves and add protocol, runtime, and progression regressions. Full combat gameplay remains outside this change. Validation: PAL3 274/274 and PAL3A 291/291 EditMode tests; 18 PAL3 and 22 PAL3A runtime checks. All 77,889 PAL3A instruction boundaries match EXE signatures.
57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
// ------------------------------------------------------------------------
|
|
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ------------------------------------------------------------------------
|
|
|
|
namespace Pal3.Game.Script.Waiter
|
|
{
|
|
using System;
|
|
using Command;
|
|
using Command.Extensions;
|
|
using Core.Command;
|
|
using UnityEngine;
|
|
|
|
public sealed class WaitUntilScriptFinished : CustomYieldInstruction, IDisposable,
|
|
ICommandExecutor<ScriptFinishedRunningNotification>,
|
|
ICommandExecutor<ResetGameStateCommand>
|
|
{
|
|
public override bool keepWaiting => !_isFinished;
|
|
public bool IsCanceled { get; private set; }
|
|
|
|
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<ScriptFinishedRunningNotification>(this);
|
|
}
|
|
}
|
|
|
|
public void Execute(ResetGameStateCommand command)
|
|
{
|
|
IsCanceled = true;
|
|
Dispose();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (!_isFinished)
|
|
{
|
|
IsCanceled = true;
|
|
_isFinished = true;
|
|
}
|
|
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
|
}
|
|
}
|
|
} |