From 3e31ecc943e09766b18211861c7a9a2c06398dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Gasc=C3=B3n?= <52170489+GerardGascon@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:42:32 +0200 Subject: [PATCH] feat: accent obert A --- Assets/Scripts/Domain/CustomInput.cs | 1 + Assets/Scripts/Domain/Input/AObertaReader.cs | 8 ++++++++ Assets/Scripts/Domain/Input/AObertaReader.cs.meta | 3 +++ Assets/Scripts/Domain/KeyHistory.cs | 6 +++--- Assets/Scripts/View/UI/ExpressionInput.cs | 2 ++ 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 Assets/Scripts/Domain/Input/AObertaReader.cs create mode 100644 Assets/Scripts/Domain/Input/AObertaReader.cs.meta diff --git a/Assets/Scripts/Domain/CustomInput.cs b/Assets/Scripts/Domain/CustomInput.cs index 73a25f3..dc9f2ac 100644 --- a/Assets/Scripts/Domain/CustomInput.cs +++ b/Assets/Scripts/Domain/CustomInput.cs @@ -19,6 +19,7 @@ namespace Domain { _readers.Add(typeof(TjReader), new TjReader(_history)); _readers.Add(typeof(LlReader), new LlReader(_history)); _readers.Add(typeof(SsReader), new SsReader(_history)); + _readers.Add(typeof(AObertaReader), new AObertaReader(_history)); } public void UpdateInput() { diff --git a/Assets/Scripts/Domain/Input/AObertaReader.cs b/Assets/Scripts/Domain/Input/AObertaReader.cs new file mode 100644 index 0000000..7fbd8a1 --- /dev/null +++ b/Assets/Scripts/Domain/Input/AObertaReader.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Domain.Input { + public class AObertaReader : SequentialInputReader { + public AObertaReader(KeyHistory history) : base(history, new List{ 0xBA, 0x41 }) { } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Domain/Input/AObertaReader.cs.meta b/Assets/Scripts/Domain/Input/AObertaReader.cs.meta new file mode 100644 index 0000000..5527dd5 --- /dev/null +++ b/Assets/Scripts/Domain/Input/AObertaReader.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d9af0ad3cdac447e803e2d16325ec74f +timeCreated: 1713278245 \ No newline at end of file diff --git a/Assets/Scripts/Domain/KeyHistory.cs b/Assets/Scripts/Domain/KeyHistory.cs index 5e4704a..9269aeb 100644 --- a/Assets/Scripts/Domain/KeyHistory.cs +++ b/Assets/Scripts/Domain/KeyHistory.cs @@ -5,9 +5,9 @@ namespace Domain { public class KeyHistory { private readonly LimitedSizeList _lastPresses = new(10); - private readonly int[] _customKeys = { 191, 51, 222, 186 }; - private readonly bool[] _isPressed = new bool[26 + 5]; - private readonly bool[] _wasPressed = new bool[26 + 5]; + private readonly int[] _customKeys = { 191, 51, 222, 186, 0xBA }; + private readonly bool[] _isPressed = new bool[26 + 6]; + private readonly bool[] _wasPressed = new bool[26 + 6]; public void KeyPressed(int key) => _lastPresses.Add(key); diff --git a/Assets/Scripts/View/UI/ExpressionInput.cs b/Assets/Scripts/View/UI/ExpressionInput.cs index 6956507..17466c9 100644 --- a/Assets/Scripts/View/UI/ExpressionInput.cs +++ b/Assets/Scripts/View/UI/ExpressionInput.cs @@ -47,6 +47,8 @@ namespace View.UI { _click.Execute(); if (_customInput.KeyDown(typeof(TxReader))) _click.Execute(); + if(_customInput.KeyDown(typeof(AObertaReader))) + _click.Execute(); } public void UpdateView(int score) {