Compare commits
5 Commits
8d3287c36c
...
a22bd2ba7e
Author | SHA1 | Date |
---|---|---|
paring | a22bd2ba7e | |
paring | 8fd4c05a2f | |
paring | 56672b497f | |
paring | b91d8cc4f4 | |
paring | 09e6a18b6f |
|
@ -1,13 +1,24 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SkyHook
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public struct SkyHookEvent
|
||||
{
|
||||
public ulong Time;
|
||||
public short Type;
|
||||
public uint Key;
|
||||
/// <summary>
|
||||
/// When the key was pressed
|
||||
/// </summary>
|
||||
public readonly ulong Time;
|
||||
/// <summary>
|
||||
/// The key is pressed or released
|
||||
/// </summary>
|
||||
public readonly EventType Type;
|
||||
/// <summary>
|
||||
/// The key number that was pressed or released
|
||||
/// </summary>
|
||||
public readonly uint Key;
|
||||
}
|
||||
|
||||
public enum EventType
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "SkyHook.Unity",
|
||||
"rootNamespace": "",
|
||||
"rootNamespace": "SkyHook",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor",
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace SkyHook
|
|||
{
|
||||
private static SkyHookManager _instance;
|
||||
|
||||
private static bool IsFocused;
|
||||
private static bool _isFocused;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the event will be received only if the game window is focused.
|
||||
|
@ -46,7 +46,7 @@ namespace SkyHook
|
|||
|
||||
private void HookCallback(SkyHookEvent ev)
|
||||
{
|
||||
if (RequireFocus && !IsFocused)
|
||||
if (RequireFocus && !_isFocused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -96,11 +96,11 @@ namespace SkyHook
|
|||
StopHook();
|
||||
}
|
||||
|
||||
private void Run()
|
||||
private void Update()
|
||||
{
|
||||
if (requireFocus)
|
||||
if (RequireFocus)
|
||||
{
|
||||
IsFocused = Application.isFocused;
|
||||
_isFocused = Application.isFocused;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Reference in New Issue