mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 17:38:10 +08:00
* Implement more PAL3A specific commands. * Fix data structure issues with PAL3A ScnObjectInfo. * And more fixes/tweaks for supporting PAL3A game play.
81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
// ---------------------------------------------------------------------------------------------
|
|
// Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved.
|
|
// See LICENSE file in the project root for license information.
|
|
// ---------------------------------------------------------------------------------------------
|
|
|
|
namespace Pal3.Feature
|
|
{
|
|
using System;
|
|
using Command;
|
|
using Command.InternalCommands;
|
|
using Command.SceCommands;
|
|
using MetaData;
|
|
using Scene;
|
|
using Script;
|
|
using UnityEngine;
|
|
|
|
public class HotelManager : MonoBehaviour,
|
|
ICommandExecutor<UIShowHotelMenuCommand>
|
|
{
|
|
private ScriptManager _scriptManager;
|
|
private SceneManager _sceneManager;
|
|
|
|
public void Init(ScriptManager scriptManager, SceneManager sceneManager)
|
|
{
|
|
_scriptManager = scriptManager;
|
|
_sceneManager = sceneManager;
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
|
}
|
|
|
|
public void Rest(string sceneFileName, string sceneName, uint afterRestTalkScript)
|
|
{
|
|
_sceneManager.LoadScene(sceneFileName, sceneName);
|
|
CommandDispatcher<ICommand>.Instance.Dispatch(
|
|
new PlayerInteractionTriggeredNotification());
|
|
_scriptManager.AddScript(afterRestTalkScript);
|
|
}
|
|
|
|
public void Execute(UIShowHotelMenuCommand command)
|
|
{
|
|
var vars = _scriptManager.GetGlobalVariables();
|
|
|
|
#if PAL3
|
|
if (command.HotelScriptName.Equals("DealScript\\rest\\q01rest.txt",
|
|
StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
if (vars[ScriptConstants.MainStoryVariableName] == 11101)
|
|
{
|
|
vars[ScriptConstants.MainStoryVariableName] = 11200;
|
|
Rest("Q01", "xn01", (uint)command.AfterRestScriptId);
|
|
}
|
|
}
|
|
|
|
if (command.HotelScriptName.Equals("DealScript\\rest\\q13rest.txt"))
|
|
{
|
|
if (vars[ScriptConstants.MainStoryVariableName] == 120301)
|
|
{
|
|
vars[ScriptConstants.MainStoryVariableName] = 120302;
|
|
_scriptManager.AddScript((uint)command.AfterRestScriptId);
|
|
}
|
|
}
|
|
#elif PAL3A
|
|
if (command.HotelScriptName.Equals("DealScript\\rest\\q10rest.txt"))
|
|
{
|
|
if (vars[ScriptConstants.MainStoryVariableName] == 140300)
|
|
{
|
|
Rest("q10", "n02y", 2007);
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
} |