1
1
using UnityEditor ;
2
+ #if UNITY_2019_1_OR_NEWER
3
+ using UnityEditor . ShortcutManagement ;
4
+ using UnityEngine ;
5
+ #endif
2
6
3
7
namespace litefeel . AlignTools
4
8
{
5
9
public static class AlignToolsMenu
6
10
{
7
- private const string KeyboardMenuPath = "Window/Align Tools/Adjust Position By Keyboard %#K" ;
8
-
11
+ #if UNITY_2019_1_OR_NEWER
12
+ private const string KeyboardMenuPath = "Align Tools/Adjust Position By Keyboard" ;
13
+ private const string WindowMenuPath = "Window/LiteFeel/Align Tools" ;
14
+ #else
15
+ private const string KeyboardMenuPath = "Window/LiteFeel/Align Tools/Adjust Position By Keyboard %#K" ;
16
+ private const string WindowMenuPath = "Window/LiteFeel/Align Tools/Align Tools" ;
17
+ #endif
9
18
// Creation of window
10
- [ MenuItem ( "Window/Align Tools/Align Tools" ) ]
19
+ [ MenuItem ( WindowMenuPath ) ]
11
20
private static void AlignToolsWindows ( )
12
21
{
13
22
AlignToolsWindow window = EditorWindow . GetWindow < AlignToolsWindow > ( false , "Align Tools" , true ) ;
14
23
window . Show ( ) ;
15
24
window . autoRepaintOnSceneChange = true ;
16
25
}
17
26
27
+ #if UNITY_2019_1_OR_NEWER
28
+ [ ClutchShortcut ( KeyboardMenuPath , KeyCode . K , ShortcutModifiers . Action | ShortcutModifiers . Shift ) ]
29
+ private static void ToggleKeyboard ( ShortcutArguments arg )
30
+ {
31
+ if ( arg . stage == ShortcutStage . Begin )
32
+ Settings . AdjustPositionByKeyboard = ! Settings . AdjustPositionByKeyboard ;
33
+ }
34
+ #else
18
35
[ MenuItem ( KeyboardMenuPath , true ) ]
19
36
private static bool VaildToggleKeyboard ( )
20
37
{
@@ -26,6 +43,7 @@ private static void ToggleKeyboard()
26
43
{
27
44
Settings . AdjustPositionByKeyboard = ! Menu . GetChecked ( KeyboardMenuPath ) ;
28
45
}
46
+ #endif
29
47
}
30
48
}
31
49
0 commit comments