BS 0.2.0 Visual
This commit is contained in:
29
Convention/[Visual]/UIComponent/KeyboardStatsBar.cs
Normal file
29
Convention/[Visual]/UIComponent/KeyboardStatsBar.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Convention.WindowsUI
|
||||
{
|
||||
public class KeyboardStatsBar : WindowUIModule
|
||||
{
|
||||
[Serializable]
|
||||
public class KeyboardStatsData
|
||||
{
|
||||
public Key key;
|
||||
public CanvasGroup iconCanvasGroup;
|
||||
public float notPress = 0.3f;
|
||||
public float press = 1f;
|
||||
}
|
||||
|
||||
[Setting] public List<KeyboardStatsData> bindings = new();
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach (var bind in bindings)
|
||||
{
|
||||
bind.iconCanvasGroup.alpha = Keyboard.current[bind.key].isPressed ? bind.press : bind.notPress;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user