예제 #1
0
        private static string GetMenuItemScript(string label, string methodName, EditorFullscreenSettings.FullscreenOption fullscreenOptions)
        {
            string hotkeyString = EditorInput.GetKeyMenuItemString(fullscreenOptions.hotkey, fullscreenOptions.modifiers);
            string script       = "        [MenuItem(" + typeof(EditorFullscreenSettings).Name + ".MENU_ITEM_PATH + \"" + label + " " + hotkeyString + "\")]\r\n"
                                  + "        public static void " + methodName + "() {EditorFullscreenController." + methodName + "();}\r\n";

            return(script);
        }
        private static string GetMenuItemScript(string label, string methodName, EditorFullscreenSettings.FullscreenOption fullscreenOptions, string fullscreenHotkey)
        {
            string hotkeyString = " _" + EditorInput.GetKeyMenuItemString(fullscreenOptions.hotkey, fullscreenOptions.modifiers);

#if UNITY_STANDALONE_WIN && (UNITY_5_0 || UNITY_5_1)
            //Disable menu-item hotkeys for Unity pre-5.4 because of strange bugs which occur when they have no modifier. Instead the hotkeys are handled through EditorInput.
            hotkeyString = "";
            label       += char.ConvertFromUtf32(9) + EditorInput.GetKeysDownString(fullscreenOptions.hotkey, fullscreenOptions.modifiers);
#endif

            string fullscreenOpsString = "EditorFullscreenSettings.settings." + fullscreenHotkey;
            string methodCall          = "EditorFullscreenController.TriggerFullscreenHotkey(" + fullscreenOpsString + ");";

            string script = "        [MenuItem(" + typeof(EditorFullscreenSettings).Name + ".MENU_ITEM_PATH + \"" + label + hotkeyString + "\")]\r\n"
                            + "        public static void " + methodName + "() {" + methodCall + "}\r\n";
            return(script);
        }
예제 #3
0
        private static string GetMenuItemScript(string label, int tabsInLabel, string methodName, EditorFullscreenSettings.FullscreenOption fullscreenOptions, string fullscreenHotkey, int menuPriority)
        {
            if (fullscreenOptions.hotkey == KeyCode.None)
            {
                return("");                                          //Blank hotkey, so no script required.
            }
            string hotkeyString = " " + EditorInput.GetKeyMenuItemString(fullscreenOptions.hotkey, fullscreenOptions.modifiers);

#if UNITY_EDITOR_OSX
            //Add extra label on macOS for F hotkeys (F hotkeys are labeled incorrectly with modifiers, and some other hotkeys show no label)
            for (int i = 0; i < tabsInLabel; i++)
            {
                label += char.ConvertFromUtf32(9);
            }
            label += EditorInput.GetKeysDownString(fullscreenOptions.hotkey, fullscreenOptions.modifiers);
#endif

            string fullscreenOpsString = "EditorFullscreenSettings.settings." + fullscreenHotkey;
            string methodCall          = "EditorFullscreenController.TriggerFullscreenHotkey(" + fullscreenOpsString + ");";

            string script = "        [MenuItem(" + typeof(EditorFullscreenSettings).Name + ".MENU_ITEM_PATH + \"" + label + hotkeyString + "\", false, " + menuPriority + ")]\r\n"
                            + "        public static void " + methodName + "() {" + methodCall + "}\r\n";
            return(script);
        }