Files
Pal3.Unity/Assets/Scripts/Pal3.Game/Script/PalScriptCommandPreprocessor.cs
T
2023-10-04 17:45:26 -07:00

40 lines
1.2 KiB
C#

// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Pal3.Game.Script
{
using Core.Command;
using Core.Utilities;
using Patcher;
public sealed class PalScriptCommandPreprocessor
{
private readonly IPalScriptPatcher _patcher;
public PalScriptCommandPreprocessor(IPalScriptPatcher patcher)
{
_patcher = Requires.IsNotNull(patcher, nameof(patcher));
}
public void Process(ref ICommand command,
PalScriptType scriptType,
uint scriptId,
string scriptDescription,
long positionInScript,
int codepage)
{
if (_patcher.TryPatchCommandInScript(scriptType,
scriptId,
scriptDescription,
positionInScript,
codepage,
command,
out ICommand fixedCommand))
{
command = fixedCommand;
}
}
}
}