|
4 | 4 | namespace MajdataPlay.Platform.iOS; |
5 | 5 | public static class NativeKeyboard |
6 | 6 | { |
7 | | - const string IOSLibraryName = "__Internal"; |
8 | 7 | #if UNITY_EDITOR_OSX |
9 | | - const string MacEditorLibraryName = "NativeKeyboard"; |
| 8 | + const string LibraryName = "NativeKeyboard"; |
| 9 | +#else |
| 10 | + const string LibraryName = "__Internal"; |
10 | 11 | #endif |
11 | 12 |
|
12 | | -#if UNITY_IOS && !UNITY_EDITOR |
13 | | - [DllImport(IOSLibraryName, EntryPoint = "Init")] |
| 13 | + [DllImport(LibraryName, EntryPoint = "Init")] |
14 | 14 | static extern ErrorCode InitInternal(); |
15 | 15 |
|
16 | | - [DllImport(IOSLibraryName, EntryPoint = "GetKeyboardHandle")] |
| 16 | + [DllImport(LibraryName, EntryPoint = "GetKeyboardHandle")] |
17 | 17 | static extern nint GetKeyboardHandleInternal(); |
18 | 18 |
|
19 | | - [DllImport(IOSLibraryName, EntryPoint = "IsPressed")] |
| 19 | + [DllImport(LibraryName, EntryPoint = "IsPressed")] |
20 | 20 | static extern ErrorCode IsPressedInternal(uint keyCode, out byte isPressedOut); |
21 | 21 |
|
22 | | - [DllImport(IOSLibraryName, EntryPoint = "IsPressedWithHandle")] |
| 22 | + [DllImport(LibraryName, EntryPoint = "IsPressedWithHandle")] |
23 | 23 | static extern ErrorCode IsPressedWithHandleInternal(nint keyboardHandle, uint keyCode, out byte isPressedOut); |
24 | 24 |
|
25 | | - [DllImport(IOSLibraryName, EntryPoint = "Free")] |
| 25 | + [DllImport(LibraryName, EntryPoint = "Free")] |
26 | 26 | static extern ErrorCode FreeInternal(); |
27 | | -#elif UNITY_EDITOR_OSX |
28 | | - [DllImport(MacEditorLibraryName, EntryPoint = "Init")] |
29 | | - static extern ErrorCode InitInternal(); |
30 | | - |
31 | | - [DllImport(MacEditorLibraryName, EntryPoint = "GetKeyboardHandle")] |
32 | | - static extern nint GetKeyboardHandleInternal(); |
33 | | - |
34 | | - [DllImport(MacEditorLibraryName, EntryPoint = "IsPressed")] |
35 | | - static extern ErrorCode IsPressedInternal(uint keyCode, out byte isPressedOut); |
36 | | - |
37 | | - [DllImport(MacEditorLibraryName, EntryPoint = "IsPressedWithHandle")] |
38 | | - static extern ErrorCode IsPressedWithHandleInternal(nint keyboardHandle, uint keyCode, out byte isPressedOut); |
39 | | - |
40 | | - [DllImport(MacEditorLibraryName, EntryPoint = "Free")] |
41 | | - static extern ErrorCode FreeInternal(); |
42 | | -#endif |
43 | 27 |
|
44 | 28 | public static ErrorCode Init() |
45 | 29 | { |
|
0 commit comments