mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-26 17:38:10 +08:00
Cover SCE command contracts, binary readers, resource layouts and full local CPK decompression for PAL3 and PAL3A. Fix CVD time rebasing, binary read bounds and short reads, and CPK/NAV validation. Standardize first-party copyright headers, preserve correct creation years, and update console source generation. Validate both variants in Unity and verify all live CPK entries.
56 lines
2.0 KiB
C#
56 lines
2.0 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.UI
|
|
{
|
|
using System;
|
|
using Command;
|
|
using Command.Extensions;
|
|
using Core.Command;
|
|
using Core.Utilities;
|
|
using Data;
|
|
using Engine.Core.Abstraction;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using UnityEngine.InputSystem.DualShock;
|
|
|
|
public sealed class CursorManager : IDisposable,
|
|
ICommandExecutor<ActiveInputDeviceChangedNotification>
|
|
{
|
|
private readonly ITexture2D _cursorTextureNormal;
|
|
|
|
public CursorManager(GameResourceProvider gameResourceProvider)
|
|
{
|
|
Requires.IsNotNull(gameResourceProvider, nameof(gameResourceProvider));
|
|
_cursorTextureNormal = gameResourceProvider.GetCursorTexture();
|
|
Cursor.SetCursor(_cursorTextureNormal.NativeObject as Texture2D, Vector2.zero, CursorMode.Auto);
|
|
|
|
CommandExecutorRegistry<ICommand>.Instance.Register(this);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
|
|
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
|
Cursor.visible = true;
|
|
}
|
|
|
|
public void Execute(ActiveInputDeviceChangedNotification command)
|
|
{
|
|
if (command.Device == Gamepad.current ||
|
|
command.Device == Joystick.current ||
|
|
command.Device == Touchscreen.current ||
|
|
command.Device == DualShockGamepad.current)
|
|
{
|
|
Cursor.visible = false;
|
|
}
|
|
else if (command.Device == Mouse.current ||
|
|
command.Device == Pointer.current)
|
|
{
|
|
Cursor.visible = true;
|
|
}
|
|
}
|
|
}
|
|
} |