当前位置: 首页>>代码示例>>C#>>正文


C# GenericMenu.AddDisabledItem方法代码示例

本文整理汇总了C#中UnityEditor.GenericMenu.AddDisabledItem方法的典型用法代码示例。如果您正苦于以下问题:C# GenericMenu.AddDisabledItem方法的具体用法?C# GenericMenu.AddDisabledItem怎么用?C# GenericMenu.AddDisabledItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEditor.GenericMenu的用法示例。


在下文中一共展示了GenericMenu.AddDisabledItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ContextMenu

 private void ContextMenu(Model instance)
 {
     var menu = new GenericMenu();
     menu.AddItem(new GUIContent("New"), false, New);
     if (instance != null) {
         menu.AddItem(new GUIContent("Edit"), false, ShowEditWindow, instance);
     } else {
         menu.AddDisabledItem(new GUIContent("Edit"));
     }
     menu.AddSeparator("");
     if (instance != null) {
         menu.AddItem(new GUIContent("Copy"), false, Copy, instance);
     } else {
         menu.AddDisabledItem(new GUIContent("Copy"));
     }
     if (CanPaste()) {
         menu.AddItem(new GUIContent("Paste"), false, Paste);
     } else {
         menu.AddDisabledItem(new GUIContent("Paste"));
     }
     if (instance != null) {
         menu.AddItem(new GUIContent("Delete"), false, Delete, instance);
     } else {
         menu.AddDisabledItem(new GUIContent("Delete"));
     }
     menu.ShowAsContext();
 }
开发者ID:alasdairhurst,项目名称:ELB,代码行数:27,代码来源:ModelList.cs

示例2: CreateVCContextMenu

        public static void CreateVCContextMenu(ref GenericMenu menu, string assetPath, Object instance = null)
        {
            if (VCUtility.ValidAssetPath(assetPath))
            {
                bool ready = VCCommands.Instance.Ready;
                if (ready)
                {
                    var assetStatus = VCCommands.Instance.GetAssetStatus(assetPath);
                    if (instance && ObjectUtilities.ChangesStoredInScene(instance)) assetPath = SceneManagerUtilities.GetCurrentScenePath();
                    var validActions = GetValidActions(assetPath, instance);

                    if (validActions.showDiff)      menu.AddItem(new GUIContent(Terminology.diff),              false, () => VCUtility.DiffWithBase(assetPath));
                    if (validActions.showAdd)       menu.AddItem(new GUIContent(Terminology.add),               false, () => VCCommands.Instance.Add(new[] { assetPath }));
                    if (validActions.showOpen)      menu.AddItem(new GUIContent(Terminology.getlock),           false, () => GetLock(assetPath, instance));
                    if (validActions.showOpenLocal) menu.AddItem(new GUIContent(Terminology.allowLocalEdit),    false, () => AllowLocalEdit(assetPath, instance));
                    if (validActions.showForceOpen) menu.AddItem(new GUIContent("Force " + Terminology.getlock),false, () => GetLock(assetPath, instance, OperationMode.Force));
                    if (validActions.showCommit)    menu.AddItem(new GUIContent(Terminology.commit),            false, () => Commit(assetPath, instance));
                    if (validActions.showUnlock)    menu.AddItem(new GUIContent(Terminology.unlock),            false, () => VCCommands.Instance.ReleaseLock(new[] { assetPath }));
                    if (validActions.showDisconnect)menu.AddItem(new GUIContent("Disconnect"),                  false, () => PrefabHelper.DisconnectPrefab(instance as GameObject));
                    if (validActions.showDelete)    menu.AddItem(new GUIContent(Terminology.delete),            false, () => VCCommands.Instance.Delete(new[] { assetPath }));
                    if (validActions.showRevert)    menu.AddItem(new GUIContent(Terminology.revert),            false, () => Revert(assetPath, instance));
                }
                else
                {
                    menu.AddDisabledItem(new GUIContent("..Busy.."));
                }
            }
        }
开发者ID:kjems,项目名称:uversioncontrol,代码行数:28,代码来源:VCGUIControls.cs

示例3: AddDefaultItemsToMenu

 protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow view)
 {
     if (menu.GetItemCount() != 0)
     {
         menu.AddSeparator(string.Empty);
     }
     if (base.parent.window.showMode == ShowMode.MainWindow)
     {
         menu.AddItem(EditorGUIUtility.TextContent("Maximize"), !(base.parent is SplitView), new GenericMenu.MenuFunction2(this.Maximize), view);
     }
     else
     {
         menu.AddDisabledItem(EditorGUIUtility.TextContent("Maximize"));
     }
     menu.AddItem(EditorGUIUtility.TextContent("Close Tab"), false, new GenericMenu.MenuFunction2(this.Close), view);
     menu.AddSeparator(string.Empty);
     System.Type[] paneTypes = base.GetPaneTypes();
     GUIContent content = EditorGUIUtility.TextContent("Add Tab");
     foreach (System.Type type in paneTypes)
     {
         if (type != null)
         {
             GUIContent content2;
             content2 = new GUIContent(EditorWindow.GetLocalizedTitleContentFromType(type)) {
                 text = content.text + "/" + content2.text
             };
             menu.AddItem(content2, false, new GenericMenu.MenuFunction2(this.AddTabToHere), type);
         }
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:30,代码来源:DockArea.cs

示例4: AddMenuItem

 void AddMenuItem(GenericMenu mnu, string item, GenericMenu.MenuFunction func, bool enabled=true)
 {
     if (enabled)
         mnu.AddItem(new GUIContent(item), false, func);
     else
         mnu.AddDisabledItem(new GUIContent(item));
 }
开发者ID:scumbly,项目名称:Organ-Grinder,代码行数:7,代码来源:CanvasUI.cs

示例5: AddItemsToMenu

 public void AddItemsToMenu(GenericMenu menu)
 {
     menu.AddItem(m_GUIRunOnRecompile, m_Settings.runOnRecompilation, ToggleRunOnRecompilation);
     menu.AddItem(m_GUIRunTestsOnNewScene, m_Settings.runTestOnANewScene, m_Settings.ToggleRunTestOnANewScene);
     if(!m_Settings.runTestOnANewScene)
         menu.AddDisabledItem(m_GUIAutoSaveSceneBeforeRun);
     else
         menu.AddItem(m_GUIAutoSaveSceneBeforeRun, m_Settings.autoSaveSceneBeforeRun, m_Settings.ToggleAutoSaveSceneBeforeRun);
     menu.AddItem(m_GUIShowDetailsBelowTests, m_Settings.horizontalSplit, m_Settings.ToggleHorizontalSplit);
 }
开发者ID:claytantor,项目名称:shadow-haven-unity,代码行数:10,代码来源:UnitTestView.cs

示例6: AddDefaultItemsToMenu

 protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow view)
 {
   if (menu.GetItemCount() != 0)
     menu.AddSeparator(string.Empty);
   menu.AddItem(EditorGUIUtility.TextContent("Maximize"), !(this.parent is SplitView), new GenericMenu.MenuFunction2(this.Unmaximize), (object) view);
   menu.AddDisabledItem(EditorGUIUtility.TextContent("Close Tab"));
   menu.AddSeparator(string.Empty);
   System.Type[] paneTypes = this.GetPaneTypes();
   GUIContent guiContent = EditorGUIUtility.TextContent("Add Tab");
   foreach (System.Type t in paneTypes)
   {
     if (t != null)
     {
       GUIContent content = new GUIContent(EditorWindow.GetLocalizedTitleContentFromType(t));
       content.text = guiContent.text + "/" + content.text;
       menu.AddDisabledItem(content);
     }
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:19,代码来源:MaximizedHostView.cs

示例7: DiaplayVCContextMenu

 public static void DiaplayVCContextMenu(string assetPath, Object instance = null, float xoffset = 0.0f, float yoffset = 0.0f, bool showAssetName = false)
 {
     var menu = new GenericMenu();
     if (showAssetName)
     {
         menu.AddDisabledItem(new GUIContent(Path.GetFileName(assetPath)));
         menu.AddSeparator("");
     }
     CreateVCContextMenu(ref menu, assetPath, instance);
     menu.DropDown(new Rect(Event.current.mousePosition.x + xoffset, Event.current.mousePosition.y + yoffset, 0.0f, 0.0f));
     Event.current.Use();
 }
开发者ID:kjems,项目名称:uversioncontrol,代码行数:12,代码来源:VCGUIControls.cs

示例8: Show

 internal static void Show(SerializedProperty prop)
 {
   GUIContent content1 = new GUIContent("Copy");
   GUIContent content2 = new GUIContent("Paste");
   GenericMenu genericMenu = new GenericMenu();
   genericMenu.AddItem(content1, false, new GenericMenu.MenuFunction(new GradientContextMenu(prop).Copy));
   if (ParticleSystemClipboard.HasSingleGradient())
     genericMenu.AddItem(content2, false, new GenericMenu.MenuFunction(new GradientContextMenu(prop).Paste));
   else
     genericMenu.AddDisabledItem(content2);
   genericMenu.ShowAsContext();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:12,代码来源:GradientContextMenu.cs

示例9: AddDefaultItemsToMenu

 protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow view)
 {
     if (menu.GetItemCount() != 0)
     {
         menu.AddSeparator("");
     }
     menu.AddItem(EditorGUIUtility.TextContent("Maximize"), !(base.parent is SplitView), new GenericMenu.MenuFunction2(this.Unmaximize), view);
     menu.AddDisabledItem(EditorGUIUtility.TextContent("Close Tab"));
     menu.AddSeparator("");
     Type[] paneTypes = base.GetPaneTypes();
     GUIContent content = EditorGUIUtility.TextContent("Add Tab");
     foreach (Type type in paneTypes)
     {
         if (type != null)
         {
             GUIContent content2 = new GUIContent(EditorWindow.GetLocalizedTitleContentFromType(type));
             content2.text = content.text + "/" + content2.text;
             menu.AddDisabledItem(content2);
         }
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:21,代码来源:MaximizedHostView.cs

示例10: AddDefaultItemsToMenu

		protected override void AddDefaultItemsToMenu(GenericMenu menu, EditorWindow view)
		{
			if (menu.GetItemCount() != 0)
			{
				menu.AddSeparator(string.Empty);
			}
			menu.AddItem(EditorGUIUtility.TextContent("DockAreaMaximize"), !(base.parent is SplitView), new GenericMenu.MenuFunction2(this.Unmaximize), view);
			menu.AddDisabledItem(EditorGUIUtility.TextContent("DockAreaCloseTab"));
			menu.AddSeparator(string.Empty);
			Type[] paneTypes = base.GetPaneTypes();
			GUIContent gUIContent = EditorGUIUtility.TextContent("DockAreaAddTab");
			Type[] array = paneTypes;
			for (int i = 0; i < array.Length; i++)
			{
				Type type = array[i];
				if (type != null)
				{
					GUIContent gUIContent2 = new GUIContent(EditorGUIUtility.TextContent(type.ToString()));
					gUIContent2.text = gUIContent.text + "/" + gUIContent2.text;
					menu.AddDisabledItem(gUIContent2);
				}
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:23,代码来源:MaximizedHostView.cs

示例11: OnFlowToolsMenuGUI

		public override void OnFlowToolsMenuGUI(string prefix, GenericMenu menu) {
			
			menu.AddSeparator(prefix);
			
			#if WEBPLAYER
			menu.AddDisabledItem(new GUIContent("Compile UI..."));
			#else
			menu.AddItem(new GUIContent(prefix + "Compile UI..."), on: false, func: () => {
				
				Compiler.ShowEditor(null, null);
				
			});
			#endif

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:15,代码来源:CompilerAddon.cs

示例12: AddColumnVisibilityItems

 protected virtual void AddColumnVisibilityItems(GenericMenu menu)
 {
     for (int i = 0; i < this.state.columns.Length; i++)
     {
         MultiColumnHeaderState.Column column = this.state.columns[i];
         if (column.allowToggleVisibility)
         {
             menu.AddItem(new GUIContent(column.headerText), Enumerable.Contains<int>(this.state.visibleColumns, i), new GenericMenu.MenuFunction2(this.ToggleVisibility), i);
         }
         else
         {
             menu.AddDisabledItem(new GUIContent(column.headerText));
         }
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:15,代码来源:MultiColumnHeader.cs

示例13: Show

 internal static void Show(Rect position, SerializedProperty property, SerializedProperty property2, SerializedProperty scalar, Rect curveRanges, ParticleSystemCurveEditor curveEditor)
 {
   GUIContent content1 = new GUIContent("Copy");
   GUIContent content2 = new GUIContent("Paste");
   GenericMenu genericMenu = new GenericMenu();
   bool flag1 = property != null && property2 != null;
   bool flag2 = flag1 && ParticleSystemClipboard.HasDoubleAnimationCurve() || !flag1 && ParticleSystemClipboard.HasSingleAnimationCurve();
   AnimationCurveContextMenu curveContextMenu = new AnimationCurveContextMenu(property, property2, scalar, curveRanges, curveEditor);
   genericMenu.AddItem(content1, false, new GenericMenu.MenuFunction(curveContextMenu.Copy));
   if (flag2)
     genericMenu.AddItem(content2, false, new GenericMenu.MenuFunction(curveContextMenu.Paste));
   else
     genericMenu.AddDisabledItem(content2);
   genericMenu.DropDown(position);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:15,代码来源:AnimationCurveContextMenu.cs

示例14: DrawItemMenu

 private void DrawItemMenu()
 {
     if (GUILayout.Button("Menu", "MiniPullDown", GUILayout.Width(56))) {
         GenericMenu menu = new GenericMenu();
         menu.AddItem(new GUIContent("New Item"), false, AddNewItem);
         if (template.treatItemsAsQuests) {
             menu.AddItem(new GUIContent("New Quest"), false, AddNewQuest);
         } else {
             menu.AddDisabledItem(new GUIContent("New Quest"));
         }
         menu.AddItem(new GUIContent("Use Quest System"), template.treatItemsAsQuests, ToggleUseQuestSystem);
         menu.AddItem(new GUIContent("Sort/By Name"), false, SortItemsByName);
         menu.AddItem(new GUIContent("Sort/By ID"), false, SortItemsByID);
         menu.AddItem(new GUIContent("Sync From DB"), database.syncInfo.syncItems, ToggleSyncItemsFromDB);
         menu.ShowAsContext();
     }
 }
开发者ID:farreltr,项目名称:OneLastSunset,代码行数:17,代码来源:DialogueEditorWindowItemSection.cs

示例15: Show

			internal static void Show(Rect activatorRect, List<ExposablePopupMenu.ItemData> buttonData, ExposablePopupMenu caller)
			{
				ExposablePopupMenu.PopUpMenu.m_Data = buttonData;
				ExposablePopupMenu.PopUpMenu.m_Caller = caller;
				GenericMenu genericMenu = new GenericMenu();
				foreach (ExposablePopupMenu.ItemData current in ExposablePopupMenu.PopUpMenu.m_Data)
				{
					if (current.m_Enabled)
					{
						genericMenu.AddItem(current.m_GUIContent, current.m_On, new GenericMenu.MenuFunction2(ExposablePopupMenu.PopUpMenu.SelectionCallback), current);
					}
					else
					{
						genericMenu.AddDisabledItem(current.m_GUIContent);
					}
				}
				genericMenu.DropDown(activatorRect);
			}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:18,代码来源:ExposablePopupMenu.cs


注:本文中的UnityEditor.GenericMenu.AddDisabledItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。