Example #1
0
 public static void ExtractMenuItemWithPath(string menuString, GenericMenu menu, string replacementMenuString, UnityEngine.Object[] temporaryContext)
 {
     MenuUtils.MenuCallbackObject menuCallbackObject = new MenuUtils.MenuCallbackObject();
     menuCallbackObject.menuItemPath     = menuString;
     menuCallbackObject.temporaryContext = temporaryContext;
     menu.AddItem(new GUIContent(replacementMenuString), false, new GenericMenu.MenuFunction2(MenuUtils.MenuCallback), menuCallbackObject);
 }
Example #2
0
		public static void ExtractMenuItemWithPath(string menuString, GenericMenu menu, string replacementMenuString, UnityEngine.Object[] temporaryContext)
		{
			MenuUtils.MenuCallbackObject menuCallbackObject = new MenuUtils.MenuCallbackObject();
			menuCallbackObject.menuItemPath = menuString;
			menuCallbackObject.temporaryContext = temporaryContext;
			menu.AddItem(new GUIContent(replacementMenuString), false, new GenericMenu.MenuFunction2(MenuUtils.MenuCallback), menuCallbackObject);
		}
Example #3
0
 public static void ExtractMenuItemWithPath(string menuString, GenericMenu menu, string replacementMenuString, UnityEngine.Object[] temporaryContext, int userData, Action <string, UnityEngine.Object[], int> onBeforeExecuteCallback, Action <string, UnityEngine.Object[], int> onAfterExecuteCallback)
 {
     MenuUtils.MenuCallbackObject menuCallbackObject = new MenuUtils.MenuCallbackObject();
     menuCallbackObject.menuItemPath            = menuString;
     menuCallbackObject.temporaryContext        = temporaryContext;
     menuCallbackObject.onBeforeExecuteCallback = onBeforeExecuteCallback;
     menuCallbackObject.onAfterExecuteCallback  = onAfterExecuteCallback;
     menuCallbackObject.userData = userData;
     menu.AddItem(new GUIContent(replacementMenuString), false, new GenericMenu.MenuFunction2(MenuUtils.MenuCallback), menuCallbackObject);
 }
Example #4
0
 public static void MenuCallback(object callbackObject)
 {
     MenuUtils.MenuCallbackObject menuCallbackObject = callbackObject as MenuUtils.MenuCallbackObject;
     if (menuCallbackObject.temporaryContext != null)
     {
         EditorApplication.ExecuteMenuItemWithTemporaryContext(menuCallbackObject.menuItemPath, menuCallbackObject.temporaryContext);
     }
     else
     {
         EditorApplication.ExecuteMenuItem(menuCallbackObject.menuItemPath);
     }
 }
Example #5
0
        public static void ExtractMenuItemWithPath(string menuString, GenericMenu menu, string replacementMenuString, UnityEngine.Object[] temporaryContext, int userData, Action <string, UnityEngine.Object[], int> onBeforeExecuteCallback, Action <string, UnityEngine.Object[], int> onAfterExecuteCallback)
        {
            MenuUtils.MenuCallbackObject menuCallbackObject = new MenuUtils.MenuCallbackObject();
            menuCallbackObject.menuItemPath            = menuString;
            menuCallbackObject.temporaryContext        = temporaryContext;
            menuCallbackObject.onBeforeExecuteCallback = onBeforeExecuteCallback;
            menuCallbackObject.onAfterExecuteCallback  = onAfterExecuteCallback;
            menuCallbackObject.userData = userData;
            GUIContent arg_58_1 = new GUIContent(L10n.TrPath(replacementMenuString));
            bool       arg_58_2 = false;

            if (MenuUtils.< > f__mg$cache0 == null)
            {
                MenuUtils.< > f__mg$cache0 = new GenericMenu.MenuFunction2(MenuUtils.MenuCallback);
            }
            menu.AddItem(arg_58_1, arg_58_2, MenuUtils.< > f__mg$cache0, menuCallbackObject);
        }
Example #6
0
 public static void MenuCallback(object callbackObject)
 {
     MenuUtils.MenuCallbackObject menuCallbackObject = callbackObject as MenuUtils.MenuCallbackObject;
     if (menuCallbackObject.onBeforeExecuteCallback != null)
     {
         menuCallbackObject.onBeforeExecuteCallback(menuCallbackObject.menuItemPath, menuCallbackObject.temporaryContext, menuCallbackObject.userData);
     }
     if (menuCallbackObject.temporaryContext != null)
     {
         EditorApplication.ExecuteMenuItemWithTemporaryContext(menuCallbackObject.menuItemPath, menuCallbackObject.temporaryContext);
     }
     else
     {
         EditorApplication.ExecuteMenuItem(menuCallbackObject.menuItemPath);
     }
     if (menuCallbackObject.onAfterExecuteCallback == null)
     {
         return;
     }
     menuCallbackObject.onAfterExecuteCallback(menuCallbackObject.menuItemPath, menuCallbackObject.temporaryContext, menuCallbackObject.userData);
 }