Skip to content

Commit

Permalink
Merge branch 'update-2-0-0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jozzzzep committed Dec 28, 2022
2 parents d64f5ec + 0458039 commit 8fdfa61
Show file tree
Hide file tree
Showing 73 changed files with 8,411 additions and 916 deletions.
563 changes: 356 additions & 207 deletions README.md

Large diffs are not rendered by default.

Binary file modified packages/KeyBinder.unitypackage
Binary file not shown.
Binary file removed packages/keybinder-scripts.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 3979250487278012142}
- component: {fileID: 3979250487278012141}
m_Layer: 5
m_Name: Canvas
m_Name: CanvasMiddleText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -29,6 +29,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3979250487461342932}
m_Father: {fileID: 0}
Expand Down Expand Up @@ -72,7 +73,7 @@ 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}
Expand Down Expand Up @@ -128,6 +129,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3979250487278012144}
m_RootOrder: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using KeyBinder;
Expand All @@ -8,16 +6,14 @@ public class ExampleScript01 : MonoBehaviour
{
[SerializeField] TextMeshProUGUI textComp;

// Start is called before the first frame update
void Start()
{
textComp.text = "Press a key";
KeyDetector.InputCheckSetActive(true);
KeyDetector.KeyReceived += KeyBinderKeyReceived;
}

private void KeyBinderKeyReceived(KeyCode obj)
private void Update()
{
textComp.text = $"Key pressed: {obj}";
textComp.text = $"Key pressed: {KeyDetector.LatestKey}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
Expand Down Expand Up @@ -242,6 +243,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
Expand Down Expand Up @@ -394,6 +396,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using KeyBinder;
Expand All @@ -8,15 +6,15 @@ public class ExampleScript02 : MonoBehaviour
{
[SerializeField] TextMeshProUGUI textComp;

// Start is called before the first frame update
void Start()
{
textComp.text = "Press a key";
KeyDetector.InputCheckSetActive(true);
KeyDetector.KeyReceived += KeyBinderKeyReceived;
}

private void Update()
private void KeyBinderKeyReceived(KeyCode obj)
{
textComp.text = $"Key pressed: {KeyDetector.LatestKey}";
textComp.text = $"Key pressed: {obj}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1253847176}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -126.71, y: 243.5}
m_SizeDelta: {x: 602.57, y: 38.254}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 335, y: -38}
m_SizeDelta: {x: 602.57007, y: 38.25403}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &121495112
MonoBehaviour:
Expand Down Expand Up @@ -284,6 +285,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
Expand Down Expand Up @@ -352,10 +354,10 @@ 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_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
Expand Down Expand Up @@ -394,6 +396,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 121495111}
- {fileID: 2137231986}
Expand Down Expand Up @@ -435,6 +438,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
Expand Down Expand Up @@ -467,6 +471,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
Expand Down Expand Up @@ -499,6 +504,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2137231986}
m_RootOrder: 0
Expand Down Expand Up @@ -634,15 +640,16 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1925297929}
m_Father: {fileID: 1253847176}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 301.65057, y: 243.5}
m_SizeDelta: {x: 254.1611, y: 38.2528}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -151, y: -38}
m_SizeDelta: {x: 254.16113, y: 38.252808}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2137231987
MonoBehaviour:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using KeyBinder;

public class ExampleScript03 : MonoBehaviour
{
/// a better solution is in example 4

[SerializeField] TextMeshProUGUI textComp;
[SerializeField] GameObject bulletPrefab;
[SerializeField] Transform firePoint;
Expand Down Expand Up @@ -52,7 +52,7 @@ public void BindNewKey()
void DetectedNewKey(KeyCode key)
{
UpdateKeyBind(key);
KeyDetector.KeyReceived -= UpdateKeyBind;
KeyDetector.KeyReceived -= DetectedNewKey;
KeyDetector.InputCheckSetActive(false);
binding = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1253847176}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -126.71, y: 243.5}
m_SizeDelta: {x: 602.57, y: 38.254}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 327, y: -38}
m_SizeDelta: {x: 602.57, y: 38.253998}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &121495112
MonoBehaviour:
Expand Down Expand Up @@ -284,6 +285,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
Expand Down Expand Up @@ -352,7 +354,7 @@ 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}
Expand Down Expand Up @@ -394,6 +396,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 121495111}
- {fileID: 2137231986}
Expand Down Expand Up @@ -435,6 +438,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
Expand Down Expand Up @@ -467,6 +471,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
Expand Down Expand Up @@ -499,6 +504,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2137231986}
m_RootOrder: 0
Expand Down Expand Up @@ -634,15 +640,16 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1925297929}
m_Father: {fileID: 1253847176}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 301.65057, y: 243.5}
m_SizeDelta: {x: 254.1611, y: 38.2528}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -146, y: -38}
m_SizeDelta: {x: 254.16113, y: 38.252808}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2137231987
MonoBehaviour:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class ExampleScript04 : MonoBehaviour
[SerializeField] float shootingForce;

KeyCode currentBind;
bool binding;

void Start()
{
Expand All @@ -19,7 +18,7 @@ void Start()

void Update()
{
if (binding) return;
if (KeyDetector.InputCheckIsActive) return;

if (Input.GetKeyDown(currentBind))
Shoot();
Expand All @@ -43,12 +42,10 @@ public void BindNewKey()
{
textComp.text = $"Press a key to bind it";
KeyDetector.InputCheckOnce(DetectedNewKey);
binding = true;
}

void DetectedNewKey(KeyCode key)
{
UpdateKeyBind(key);
binding = false;
}
}

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

Loading

0 comments on commit 8fdfa61

Please sign in to comment.