Skip to content

Commit

Permalink
Merge pull request #39 from eviltwo/0.7.5-dev
Browse files Browse the repository at this point in the history
0.7.5
  • Loading branch information
eviltwo committed Jul 9, 2024
2 parents 28cec6e + 255a200 commit ac22a5f
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 13 deletions.
6 changes: 3 additions & 3 deletions InputGlyphs/Assets/InputGlyphs/Samples/DuoPlayerSample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_ReferenceResolution: {x: 800, y: 450}
m_ScreenMatchMode: 2
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
Expand Down
6 changes: 3 additions & 3 deletions InputGlyphs/Assets/InputGlyphs/Samples/SoloPlayerSample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_ReferenceResolution: {x: 800, y: 450}
m_ScreenMatchMode: 2
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
Expand Down
6 changes: 3 additions & 3 deletions InputGlyphs/Assets/InputGlyphs/Samples/SteamworksSample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_ReferenceResolution: {x: 800, y: 450}
m_ScreenMatchMode: 2
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#if INPUT_SYSTEM && ENABLE_INPUT_SYSTEM
using UnityEditor;

namespace InputGlyphs.Display.Editor
{
[CustomEditor(typeof(InputGlyphImage))]
public class InputGlyphImageEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();

var glyphImage = (InputGlyphImage)target;

if (glyphImage.PlayerInput != null
&& glyphImage.PlayerInput.notificationBehavior != UnityEngine.InputSystem.PlayerNotifications.InvokeUnityEvents
&& glyphImage.PlayerInput.notificationBehavior != UnityEngine.InputSystem.PlayerNotifications.InvokeCSharpEvents)
{
EditorGUILayout.HelpBox("PlayerInput.notificationBehavior must be set to InvokeUnityEvents or InvokeCSharpEvents.", MessageType.Error);
}
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#if INPUT_SYSTEM && ENABLE_INPUT_SYSTEM
using UnityEditor;

namespace InputGlyphs.Display.Editor
{
[CustomEditor(typeof(InputGlyphSprite))]
public class InputGlyphSpriteEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();

var glyphSprite = (InputGlyphSprite)target;

if (glyphSprite.PlayerInput != null
&& glyphSprite.PlayerInput.notificationBehavior != UnityEngine.InputSystem.PlayerNotifications.InvokeUnityEvents
&& glyphSprite.PlayerInput.notificationBehavior != UnityEngine.InputSystem.PlayerNotifications.InvokeCSharpEvents)
{
EditorGUILayout.HelpBox("PlayerInput.notificationBehavior must be set to InvokeUnityEvents or InvokeCSharpEvents.", MessageType.Error);
}
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public override void OnInspectorGUI()
}
}
}

if (glyphText.PlayerInput != null
&& glyphText.PlayerInput.notificationBehavior != UnityEngine.InputSystem.PlayerNotifications.InvokeUnityEvents
&& glyphText.PlayerInput.notificationBehavior != UnityEngine.InputSystem.PlayerNotifications.InvokeCSharpEvents)
{
EditorGUILayout.HelpBox("PlayerInput.notificationBehavior must be set to InvokeUnityEvents or InvokeCSharpEvents.", MessageType.Error);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ private void Awake()
{
SpriteRenderer = GetComponent<SpriteRenderer>();
}
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
_texture = new Texture2D(2, 2);
}

Expand Down Expand Up @@ -108,7 +112,10 @@ private void UnregisterPlayerInputEvents(PlayerInput playerInput)

private void OnControlsChanged(PlayerInput playerInput)
{
UpdateGlyphs(playerInput);
if (playerInput == PlayerInput)
{
UpdateGlyphs(playerInput);
}
}

private void UpdateGlyphs(PlayerInput playerInput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ private void Awake()
{
Text = GetComponent<TMP_Text>();
}
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
_packedTexture = new Texture2D(2, 2);
_sharedMaterial = new Material(Material);
_sharedMaterial.SetTexture("_MainTex", _packedTexture);
Expand Down Expand Up @@ -132,7 +136,10 @@ private void UnregisterPlayerInputEvents(PlayerInput playerInput)

private void OnControlsChanged(PlayerInput playerInput)
{
UpdateGlyphs(playerInput);
if (playerInput == PlayerInput)
{
UpdateGlyphs(playerInput);
}
}

private void UpdateGlyphs(PlayerInput playerInput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ private void Awake()
{
Image = GetComponent<Image>();
}
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
_defaultSizeDelta = Image.rectTransform.sizeDelta;
_texture = new Texture2D(2, 2);
}
Expand Down Expand Up @@ -111,7 +115,10 @@ private void UnregisterPlayerInputEvents(PlayerInput playerInput)

private void OnControlsChanged(PlayerInput playerInput)
{
UpdateGlyphs(playerInput);
if (playerInput == PlayerInput)
{
UpdateGlyphs(playerInput);
}
}

private void UpdateGlyphs(PlayerInput playerInput)
Expand Down
2 changes: 1 addition & 1 deletion InputGlyphs/Assets/InputGlyphs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.eviltwo.input-glyphs",
"displayName": "Input Glyphs",
"version": "0.7.4",
"version": "0.7.5",
"unity": "2022.3",
"description": "Displays glyphs (icons) of keyboard & mouse or controller buttons recognized by Unity's InputSystem.",
"author": {
Expand Down

0 comments on commit ac22a5f

Please sign in to comment.