11using System ;
22using System . Collections . Concurrent ;
33using System . Collections . Generic ;
4- using Lunar . Interfaces ;
4+ using Lunar . Core . Base . Interfaces ;
55using UnityEngine ;
66using System . Linq ;
7+ using Lunar . Core . Base ;
78
89namespace Lunar . Adapters . Unity
910{
1011 public class InputAdapter : IInput
1112 {
12- public bool GetKeyDown ( KeyCode keycode )
13+ public bool GetKeyDown ( KeyCodeBase keycode )
1314 {
1415 return Input . GetKeyDown ( keycode . ToUnity ( ) ) ;
1516 }
1617
17- public bool GetKey ( KeyCode keycode )
18+ public bool GetKey ( KeyCodeBase keycode )
1819 {
1920 return Input . GetKey ( keycode . ToUnity ( ) ) ;
2021 }
2122
22- public bool GetKeyUp ( KeyCode keycode )
23+ public bool GetKeyUp ( KeyCodeBase keycode )
2324 {
2425 return Input . GetKeyUp ( keycode . ToUnity ( ) ) ;
2526 }
2627 }
2728
2829 public static class KeyCodeConverter
2930 {
30- private static readonly ConcurrentDictionary < KeyCode , UnityEngine . KeyCode > Cache = new ( ) ;
31+ private static readonly ConcurrentDictionary < KeyCodeBase , UnityEngine . KeyCode > Cache = new ( ) ;
3132
3233 // If some key names are inconsistent on both sides, they can be overwritten here uniformly
33- private static readonly Dictionary < KeyCode , UnityEngine . KeyCode > Overrides
34+ private static readonly Dictionary < KeyCodeBase , UnityEngine . KeyCode > Overrides
3435 = new ( )
3536 {
3637 // [KeyCode.SomeLunarName] = UnityEngine.KeyCode.SomeDifferentUnityName,
3738 } ;
3839
39- public static UnityEngine . KeyCode ToUnity ( this KeyCode key )
40+ public static UnityEngine . KeyCode ToUnity ( this KeyCodeBase key )
4041 {
4142 if ( Overrides . TryGetValue ( key , out var overridden ) )
4243 {
@@ -60,16 +61,16 @@ public static UnityEngine.KeyCode ToUnity(this KeyCode key)
6061 }
6162 public class InputActionsAdapter : IInputActions
6263 {
63- public Dictionary < string , KeyCode [ ] > Bindings { get ; }
64+ public Dictionary < string , KeyCodeBase [ ] > Bindings { get ; }
6465 public IInput Input { get ; }
6566
66- public InputActionsAdapter ( IInput input , Dictionary < string , KeyCode [ ] > bindings )
67+ public InputActionsAdapter ( IInput input , Dictionary < string , KeyCodeBase [ ] > bindings )
6768 {
6869 Input = input ;
6970 Bindings = bindings ;
7071 }
7172
72- public bool SetBinding ( string action , params KeyCode [ ] keys )
73+ public bool SetBinding ( string action , params KeyCodeBase [ ] keys )
7374 {
7475 if ( string . IsNullOrWhiteSpace ( action ) )
7576 {
@@ -81,7 +82,7 @@ public bool SetBinding(string action, params KeyCode[] keys)
8182 return false ;
8283 }
8384
84- if ( keys . Any ( key => ! Enum . IsDefined ( typeof ( KeyCode ) , key ) ) )
85+ if ( keys . Any ( key => ! Enum . IsDefined ( typeof ( KeyCodeBase ) , key ) ) )
8586 {
8687 return false ;
8788 }
0 commit comments