This commit is contained in:
2025-05-11 00:46:26 +08:00
parent 366f9e95ec
commit 618f75f911
2404 changed files with 154475 additions and 924730 deletions

View File

@@ -0,0 +1,129 @@
using System.Runtime.InteropServices;
// using Rewired;
using UnityEngine;
public class InputManager : MonoBehaviour
{
public struct POINT
{
public int X;
public int Y;
}
// [Tooltip("Rewired Input Manager's player used for handling player's input")]
// private Player player;
public bool IgnoreAllInput = false;
public static bool IsMouseLeft;
public static bool IsMouseRight;
public static bool isShowSlot0;
public static bool isShowSlot1;
public static bool isShowSlot2;
public static bool isShowSlot3;
public static bool isShowSlot4;
[DllImport("user32.dll")]
private static extern bool SetCursorPos(int X, int Y);
[DllImport("user32.dll")]
private static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
[DllImport("user32.dll")]
public static extern bool GetCursorPos(out POINT lpPoint);
private PlayerInputControl _playerInputControl;
private void Start()
{
_playerInputControl = new PlayerInputControl();
}
private void Update()
{
if (IgnoreAllInput)
{
return;
}
if (Input.GetMouseButtonDown(0))
{
IsMouseLeft = true;
}
if (Input.GetMouseButtonUp(0))
{
IsMouseLeft = false;
}
if (Input.GetMouseButtonDown(1))
{
IsMouseRight = true;
}
if (Input.GetMouseButtonUp(1))
{
IsMouseRight = false;
}
if (Input.GetKeyDown(KeyCode.Alpha0))
{
isShowSlot0 = true;
Debug.LogError("showSlot0======");
}
else
{
isShowSlot0 = false;
}
if (Input.GetKeyDown(KeyCode.Alpha1))
{
isShowSlot1 = true;
Debug.LogError("showSlot1======");
}
else
{
isShowSlot1 = false;
}
if (Input.GetKeyDown(KeyCode.Alpha2))
{
isShowSlot2 = true;
Debug.LogError("showSlot2======");
}
else
{
isShowSlot2 = false;
}
if (Input.GetKeyDown(KeyCode.Alpha3))
{
isShowSlot3 = true;
}
else
{
isShowSlot3 = false;
}
if (Input.GetKeyDown(KeyCode.Alpha4))
{
isShowSlot4 = true;
}
else
{
isShowSlot4 = false;
}
}
}