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


C# GenericMenu.AddDisabledItem方法代码示例

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


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

示例1: Selector

	void Selector(SerializedProperty property) {
		SpineSlot attrib = (SpineSlot)attribute;
		SkeletonData data = skeletonDataAsset.GetSkeletonData(true);
		if (data == null)
			return;

		GenericMenu menu = new GenericMenu();

		menu.AddDisabledItem(new GUIContent(skeletonDataAsset.name));
		menu.AddSeparator("");

		for (int i = 0; i < data.Slots.Count; i++) {
			string name = data.Slots.Items[i].Name;
			if (name.StartsWith(attrib.startsWith)) {
				if (attrib.containsBoundingBoxes) {

					int slotIndex = i;

					List<Attachment> attachments = new List<Attachment>();
					foreach (var skin in data.Skins) {
						skin.FindAttachmentsForSlot(slotIndex, attachments);
					}

					bool hasBoundingBox = false;
					foreach (var attachment in attachments) {
						if (attachment is BoundingBoxAttachment) {
							menu.AddItem(new GUIContent(name), name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
							hasBoundingBox = true;
							break;
						}
					}

					if (!hasBoundingBox)
						menu.AddDisabledItem(new GUIContent(name));
					

				} else {
					menu.AddItem(new GUIContent(name), name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
				}
				
			}
				
		}

		menu.ShowAsContext();
	}
开发者ID:nolimet,项目名称:Liaka,代码行数:46,代码来源:SpineAttributeDrawers.cs

示例2: showBodyContextMenu

    protected override void showBodyContextMenu(Event evt)
    {
        MultiCurveTrack itemTrack = TargetTrack.Behaviour as MultiCurveTrack;
        if (itemTrack == null) return;

        Behaviour b = DirectorCopyPaste.Peek();

        PasteContext pasteContext = new PasteContext(evt.mousePosition, itemTrack);
        GenericMenu createMenu = new GenericMenu();
        if (b != null && DirectorHelper.IsTrackItemValidForTrack(b, itemTrack))
        {
            createMenu.AddItem(new GUIContent("Paste"), false, pasteItem, pasteContext);
        }
        else
        {
            createMenu.AddDisabledItem(new GUIContent("Paste"));
        }
        createMenu.ShowAsContext();
    }
开发者ID:ArthurRasmusson,项目名称:UofTHacks2016,代码行数:19,代码来源:MultiActorCurveTrackControl.cs

示例3: OnFlowWindowGUI


//.........这里部分代码省略.........
						
						if (attachWindow.IsFunction() == true) {
							
							alreadyConnectedFunctionIds.Add(attachWindow.GetFunctionId());
							
						}
						
					}
					
				}
				
				foreach (var win in data.windows) {
					
					if (win.IsFunction() == true &&
					    win.IsContainer() == true) {
						
						var count = alreadyConnectedFunctionIds.Count((e) => e == win.id);
						if ((window.GetFunctionId() == win.id && count == 1) || count == 0) {
							
						} else {
							
							if (win.id == window.functionId) window.functionId = 0;
							alreadyConnectedFunctionIds.Remove(win.id);
							
						}
						
					}
					
				}

				var functionId = window.GetFunctionId();
				var functionContainer = functionId == 0 ? null : data.GetWindow(functionId);
				var isActiveSelected = true;

				var oldColor = GUI.color;
				GUI.color = isActiveSelected ? Color.white : Color.grey;
				var result = GUILayoutExt.LargeButton(functionContainer != null ? functionContainer.title : "None", GUILayout.MaxHeight(60f), GUILayout.MaxWidth(150f));
				GUI.color = oldColor;
				var rect = GUILayoutUtility.GetLastRect();
				rect.y += rect.height;

				if (result == true) {

					var menu = new GenericMenu();
					menu.AddItem(new GUIContent("None"), window.functionId == 0, () => {

						window.functionId = 0;

					});

					if (windowFrom != null) {

						alreadyConnectedFunctionIds.Clear();
						var attaches = windowFrom.GetAttachedWindows();
						foreach (var attachWindow in attaches) {
							
							if (attachWindow.IsFunction() == true) {
								
								alreadyConnectedFunctionIds.Add(attachWindow.GetFunctionId());
								
							}
							
						}
						
					}
					foreach (var win in data.windows) {
						
						if (win.IsFunction() == true &&
						    win.IsContainer() == true) {

							var count = alreadyConnectedFunctionIds.Count((e) => e == win.id);
							if ((window.GetFunctionId() == win.id && count == 1) || count == 0) {

								var id = win.id;
								menu.AddItem(new GUIContent(win.title), win.id == window.functionId, () => {

									window.functionId = id;

								});

							} else {

								if (win.id == window.functionId) window.functionId = 0;

								alreadyConnectedFunctionIds.Remove(win.id);
								menu.AddDisabledItem(new GUIContent(win.title));

							}

						}
						
					}

					menu.DropDown(rect);

				}

			}

		}
开发者ID:zhaoluxyz,项目名称:Unity3d.UI.Windows,代码行数:101,代码来源:FunctionsAddon.cs

示例4: OnConditionHeaderClick

 private void OnConditionHeaderClick()
 {
     GenericMenu genericMenu = new GenericMenu ();
     if(state.transitions[transitionIndex].conditions.Count == 0){
         genericMenu.AddDisabledItem (new GUIContent ("Copy"));
     }else{
         genericMenu.AddItem (new GUIContent ("Copy"), false, new GenericMenu.MenuFunction (this.CopyConditions));
     }
     if(copiedConditions != null && copiedConditions.Count>0 && conditionCopiedState != null && conditionCopiedState.id != state.id){
         genericMenu.AddItem (new GUIContent ("Paste"), false, new GenericMenu.MenuFunction (this.PasteConditions));
     }else{
         genericMenu.AddDisabledItem (new GUIContent ("Paste"));
     }
     genericMenu.ShowAsContext ();
     Event.current.Use ();
 }
开发者ID:JustSmallTestDemo1202,项目名称:testProject,代码行数:16,代码来源:StateInspector.cs

示例5: HandleAnchorContext

    private void HandleAnchorContext(int controlID, JointHelpers.AnchorBias bias, AnchoredJoint2D joint,
        Joint2DSettingsBase joint2DSettings, Vector2 anchorPosition,
        Rigidbody2D connectedBody)
    {
        EditorHelpers.ContextClick(controlID, () => {
            var menu = new GenericMenu();
            menu.AddDisabledItem(new GUIContent(joint.GetType()
                                                     .Name));
            menu.AddSeparator("");
            if (WantsLocking()) {
                menu.AddItem(new GUIContent("Lock Anchors", GetAnchorLockTooltip()),
                    joint2DSettings.lockAnchors, () => {
                        EditorHelpers.RecordUndo(
                            joint2DSettings.lockAnchors ? "Unlock Anchors" : "Lock Anchors", joint2DSettings,
                            joint);
                        if (!joint2DSettings.lockAnchors) {
                            ReAlignAnchors(joint, bias);
                        }
                        joint2DSettings.lockAnchors = !joint2DSettings.lockAnchors;
                        EditorUtility.SetDirty(joint2DSettings);
                        EditorUtility.SetDirty(joint);
                    });
            }
            {
                var otherBias = JointHelpers.GetOppositeBias(bias);
                var otherPosition = JointHelpers.GetAnchorPosition(joint, otherBias);
                if (Vector2.Distance(otherPosition, anchorPosition) <= AnchorEpsilon) {
                    menu.AddDisabledItem(new GUIContent("Bring other anchor here"));
                } else {
                    menu.AddItem(new GUIContent("Bring other anchor here"), false, () => {
                        EditorHelpers.RecordUndo("Move Joint Anchor", joint);
                        JointHelpers.SetWorldAnchorPosition(joint, anchorPosition, otherBias);
                        EditorUtility.SetDirty(joint);
                    });
                }
            }

            menu.AddItem(new GUIContent("Enable Collision",
                "Should rigid bodies connected with this joint collide?"), joint.enableCollision,
                () => {
                    EditorHelpers.RecordUndo("Move Joint Anchor", joint);
                    joint.enableCollision = !joint.enableCollision;
                    EditorUtility.SetDirty(joint);
                });

            menu.AddSeparator("");

            var itemCount = menu.GetItemCount();

            ExtraMenuItems(menu, joint);

            if (itemCount != menu.GetItemCount()) {
                menu.AddSeparator("");
            }

            if (connectedBody) {
                var connectedBodyName = connectedBody.name;
                var selectConnectedBodyContent = new GUIContent(string.Format("Select '{0}'", connectedBodyName));
                if (isCreatedByTarget) {
                    menu.AddDisabledItem(selectConnectedBodyContent);
                } else {
                    menu.AddItem(selectConnectedBodyContent, false,
                        () => { Selection.activeGameObject = connectedBody.gameObject; });
                }
                menu.AddItem(new GUIContent(string.Format("Move ownership to '{0}'", connectedBodyName)), false, () => {
                    var connectedObject = connectedBody.gameObject;

                    var cloneJoint =
                        Undo.AddComponent(connectedObject, joint.GetType()) as AnchoredJoint2D;
                    if (!cloneJoint) {
                        return;
                    }
                    EditorUtility.CopySerialized(joint, cloneJoint);
                    cloneJoint.connectedBody = joint.GetComponent<Rigidbody2D>();

                    JointHelpers.SetWorldAnchorPosition(cloneJoint,
                        JointHelpers.GetAnchorPosition(joint, JointHelpers.AnchorBias.Main),
                        JointHelpers.AnchorBias.Connected);
                    JointHelpers.SetWorldAnchorPosition(cloneJoint,
                        JointHelpers.GetAnchorPosition(joint, JointHelpers.AnchorBias.Connected),
                        JointHelpers.AnchorBias.Main);

                    var jointSettings = SettingsHelper.GetOrCreate(joint);
                    var cloneSettings =
                        Undo.AddComponent(connectedObject, jointSettings.GetType()) as Joint2DSettingsBase;

                    if (cloneSettings == null) {
                        return;
                    }
                    cloneSettings.hideFlags = HideFlags.HideInInspector;

                    EditorUtility.CopySerialized(jointSettings, cloneSettings);
                    cloneSettings.Setup(cloneJoint);

                    cloneSettings.SetOffset(JointHelpers.AnchorBias.Main,
                        jointSettings.GetOffset(JointHelpers.AnchorBias.Connected));
                    cloneSettings.SetOffset(JointHelpers.AnchorBias.Connected,
                        jointSettings.GetOffset(JointHelpers.AnchorBias.Main));

                    if (!Selection.Contains(connectedObject)) {
//.........这里部分代码省略.........
开发者ID:Cyberbanan,项目名称:Unity-2D-Joint-Editors,代码行数:101,代码来源:Joint2DEditorBase.cs

示例6: ShowAddTriggermenu

    void ShowAddTriggermenu()
    {
        // Now create the menu, add items and show it
        GenericMenu menu = new GenericMenu();
        for (int i = 0; i < m_EventTypes.Length; ++i){
            bool active = true;

            // Check if we already have a Entry for the current eventType, if so, disable it
            for (int p = 0; p < m_DelegatesProperty.arraySize; ++p){
                SerializedProperty delegateEntry = m_DelegatesProperty.GetArrayElementAtIndex(p);
                SerializedProperty eventProperty = delegateEntry.FindPropertyRelative("eventID");
                if (eventProperty.enumValueIndex == i){
                    active = false;
                }
            }

            if (active)
                menu.AddItem(m_EventTypes[i], false, OnAddNewSelected, i);
            else
                menu.AddDisabledItem(m_EventTypes[i]);
        }
        menu.ShowAsContext();
        Event.current.Use();
    }
开发者ID:francasense,项目名称:okmijnuhv,代码行数:24,代码来源:GenericTriggerEditor.cs

示例7: Show

 internal static void Show(string folder, string currentSubFolder, Rect activatorRect, ProjectBrowser caller)
 {
     m_Caller = caller;
     string[] subFolders = AssetDatabase.GetSubFolders(folder);
     GenericMenu menu = new GenericMenu();
     if (subFolders.Length >= 0)
     {
         currentSubFolder = Path.GetFileName(currentSubFolder);
         foreach (string str in subFolders)
         {
             string fileName = Path.GetFileName(str);
             menu.AddItem(new GUIContent(fileName), fileName == currentSubFolder, new GenericMenu.MenuFunction(new ProjectBrowser.BreadCrumbListMenu(str).SelectSubFolder));
             menu.ShowAsContext();
         }
     }
     else
     {
         menu.AddDisabledItem(new GUIContent("No sub folders..."));
     }
     menu.DropDown(activatorRect);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:21,代码来源:ProjectBrowser.cs

示例8: TagsMaskField

	public static void TagsMaskField (GUIContent changeLabel, GUIContent setLabel,ref Pathfinding.TagMask value) {
		
		GUILayout.BeginHorizontal ();
		
		//Debug.Log (value.ToString ());
		EditorGUIUtility.LookLikeControls();
		EditorGUILayout.PrefixLabel (changeLabel,EditorStyles.layerMaskField);
		//GUILayout.FlexibleSpace ();
		//Rect r = GUILayoutUtility.GetLastRect ();
		
		string text = "";
		if (value.tagsChange == 0) text = "Nothing";
		else if (value.tagsChange == ~0) text = "Everything";
		else {
			text = System.Convert.ToString (value.tagsChange,2);
		}
		
		if (GUILayout.Button (text,EditorStyles.layerMaskField,GUILayout.ExpandWidth (true))) {
			
			
			//Debug.Log ("pre");
			GenericMenu menu = new GenericMenu ();
			
			menu.AddItem (new GUIContent ("Everything"),value.tagsChange == ~0, value.SetValues, new Pathfinding.TagMask (~0,value.tagsSet));
			menu.AddItem (new GUIContent ("Nothing"),value.tagsChange == 0, value.SetValues, new Pathfinding.TagMask (0,value.tagsSet));
			
			for (int i=0;i<32;i++) {
				bool on = (value.tagsChange >> i & 0x1) != 0;
				Pathfinding.TagMask result = new Pathfinding.TagMask (on ? value.tagsChange & ~(1 << i) : value.tagsChange | 1<<i,value.tagsSet);
				menu.AddItem (new GUIContent (""+i),on,value.SetValues, result);
				//value.SetValues (result);
			}
			
			menu.ShowAsContext ();
			
			Event.current.Use ();
			//Debug.Log ("Post");
		}
		
		EditorGUIUtility.LookLikeInspector();
		GUILayout.EndHorizontal ();
		
		
		
		GUILayout.BeginHorizontal ();
		
		//Debug.Log (value.ToString ());
		EditorGUIUtility.LookLikeControls();
		EditorGUILayout.PrefixLabel (setLabel,EditorStyles.layerMaskField);
		//GUILayout.FlexibleSpace ();
		//r = GUILayoutUtility.GetLastRect ();
		
		text = "";
		if (value.tagsSet == 0) text = "Nothing";
		else if (value.tagsSet == ~0) text = "Everything";
		else {
			text = System.Convert.ToString (value.tagsSet,2);
		}
		
		if (GUILayout.Button (text,EditorStyles.layerMaskField,GUILayout.ExpandWidth (true))) {
			
			
			//Debug.Log ("pre");
			GenericMenu menu = new GenericMenu ();
			
			if (value.tagsChange != 0)	menu.AddItem (new GUIContent ("Everything"),value.tagsSet == ~0, value.SetValues, new Pathfinding.TagMask (value.tagsChange,~0));
			else				menu.AddDisabledItem (new GUIContent ("Everything"));
			
			menu.AddItem (new GUIContent ("Nothing"),value.tagsSet == 0, value.SetValues, new Pathfinding.TagMask (value.tagsChange,0));
			
			for (int i=0;i<32;i++) {
				bool enabled = (value.tagsChange >> i & 0x1) != 0;
				bool on = (value.tagsSet >> i & 0x1) != 0;
				
				Pathfinding.TagMask result = new Pathfinding.TagMask (value.tagsChange, on ? value.tagsSet & ~(1 << i) : value.tagsSet | 1<<i);
				
				if (enabled)	menu.AddItem (new GUIContent (""+i),on,value.SetValues, result);
				else	menu.AddDisabledItem (new GUIContent (""+i));
				
				//value.SetValues (result);
			}
			
			menu.ShowAsContext ();
			
			Event.current.Use ();
			//Debug.Log ("Post");
		}
		
		EditorGUIUtility.LookLikeInspector();
		GUILayout.EndHorizontal ();
		
		
		//return value;
	}
开发者ID:shreshtabm,项目名称:Fight-for-Zion-Mobile-Game,代码行数:94,代码来源:EditorGUIx.cs

示例9: OnGUIHasBeenDrawn

    void OnGUIHasBeenDrawn()
    {
        if (BaseNode.hotNode == null)
            return;
        if (BaseNode.hotNode.activateContext) {
            // Now create the menu, add items and show it
            var menu = new GenericMenu ();
            var isParent = BaseNode.hotNode.IsParent ();
            var sequenceTypes = (from i in nodeTypes orderby i.Name where i.BaseType == typeof(React.BranchNode) select i).ToArray ();
            foreach (var t in sequenceTypes) {
                if (isParent)
                    menu.AddItem (new GUIContent ("Add/Branch/" + t.Name), false, AddToHotNode, t);
                menu.AddItem (new GUIContent ("Convert/Branch/" + t.Name), false, ConvertHotNode, t);
            }

            var leafTypes = (from i in nodeTypes orderby i.Name where i.BaseType == typeof(React.LeafNode) select i).ToArray ();
            foreach (var t in leafTypes) {
                if (isParent)
                    menu.AddItem (new GUIContent ("Add/Leaf/" + t.Name), false, AddToHotNode, t);
                menu.AddItem (new GUIContent ("Convert/Leaf/" + t.Name), false, ConvertHotNode, t);
            }

            var decoratorTypes = (from i in nodeTypes orderby i.Name where i.BaseType == typeof(React.DecoratorNode) select i).ToArray ();
            foreach (var t in decoratorTypes) {
                if (isParent)
                    menu.AddItem (new GUIContent ("Add/Decorator/" + t.Name), false, AddToHotNode, t);
                menu.AddItem (new GUIContent ("Convert/Decorator/" + t.Name), false, ConvertHotNode, t);
                menu.AddItem (new GUIContent ("Decorate/" + t.Name), false, DecorateHotNode, t);
            }

            menu.AddSeparator ("");
            Action hotNodeAction = BaseNode.hotNode as Action;
            if (hotNodeAction != null)
            {
                Dictionary< string, List< string > > actionsMap = BaseNode.editorReactable.CollectActionsMap();

                foreach (KeyValuePair<string, List<string> > kvp in actionsMap)
                {
                    foreach (string method in kvp.Value )
                    {
                        menu.AddItem(new GUIContent("Set Action/" + kvp.Key + "/" + method), false, SetActionMethod, new KeyValuePair<string, string>( kvp.Key, method ) );
                    }
                }
            }

            Condition hotNodeCondition = BaseNode.hotNode as Condition;
            If hotNodeIf = BaseNode.hotNode as If;
            if (hotNodeCondition != null || hotNodeIf != null )
            {
                Dictionary< string, List< string > > actionsMap = BaseNode.editorReactable.CollectConditionsMap();

                foreach (KeyValuePair<string, List<string> > kvp in actionsMap)
                {
                    foreach (string method in kvp.Value )
                    {
                        menu.AddItem(new GUIContent("Set Condition/" + kvp.Key + "/" + method), false, SetConditionMethod, new KeyValuePair<string, string>(kvp.Key, method));
                    }
                }
            }

            menu.AddSeparator("");

            menu.AddItem (new GUIContent ("Cut"), false, OnCut);
            menu.AddItem (new GUIContent ("Copy"), false, OnCopy);
            if (isParent)
                menu.AddItem (new GUIContent ("Paste"), false, OnPaste);
            else
                menu.AddDisabledItem (new GUIContent ("Paste"));
            menu.AddItem (new GUIContent ("Duplicate"), false, OnDuplicate);
            menu.AddItem (new GUIContent ("Delete"), false, OnDelete);

            if (BaseNode.hotNode.HasAnyChildren())
            {
                if (BaseNode.hotNode.hideChildren)
                {
                    menu.AddItem(new GUIContent("Show"), false, OnShowChildren );
                }
                else
                {
                    menu.AddItem(new GUIContent("Hide"), false, OnHideChildren );
                }
            }

            menu.ShowAsContext ();
        }
    }
开发者ID:s76,项目名称:testAI,代码行数:86,代码来源:ReactEditor.cs

示例10: OnCompilerTransitionAttachedGeneration


//.........这里部分代码省略.........
				var rect = GUILayoutUtility.GetLastRect();
				rect.y += rect.height;

				if (result == true) {

					System.Action<int> onApply = (int id) => {

						var linkerSources = new List<FD.FlowWindow>();
						foreach (var w in data.windowAssets) {

							if (w.AlreadyAttached(window.id) == true) {

								linkerSources.Add(w);

							}

						}

						if (window.linkerId != 0) {

							foreach (var w in linkerSources) {

								data.Detach(w.id, window.linkerId, oneWay: true);

							}

						}

						window.linkerId = id;

						if (window.linkerId != 0) {

							foreach (var w in linkerSources) {

								data.Attach(w.id, window.linkerId, oneWay: true);

							}

						}

					};

					var menu = new GenericMenu();
					menu.AddItem(new GUIContent("None"), window.linkerId == 0, () => {

						onApply(0);

					});

					if (windowFrom != null) {

						alreadyConnectedFunctionIds.Clear();
						var attaches = windowFrom.GetAttachedWindows();
						foreach (var attachWindow in attaches) {
							
							if (attachWindow.IsLinker() == true) {
								
								alreadyConnectedFunctionIds.Add(attachWindow.GetLinkerId());
								
							}
							
						}
						
					}
					foreach (var win in data.windowAssets) {
						
						if (win.CanDirectCall() == true) {

							var caption = new GUIContent(string.Format("{0} ({1})", win.title, win.directory));

							var count = alreadyConnectedFunctionIds.Count((e) => e == win.id);
							if ((window.GetLinkerId() == win.id && count == 1) || count == 0) {

								var id = win.id;
								menu.AddItem(caption, win.id == window.GetLinkerId(), () => {

									onApply(id);

								});

							} else {

								if (win.id == window.GetLinkerId()) window.linkerId = 0;

								alreadyConnectedFunctionIds.Remove(win.id);
								menu.AddDisabledItem(caption);

							}

						}
						
					}

					menu.DropDown(rect);

				}

			}

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

示例11: DrawTimelinePanel

	void DrawTimelinePanel() {
		
		if (!enableTempPreview)
			playbackTime = eventInspector.GetPlaybackTime();
		
		
		GUILayout.BeginVertical(); {
			
			GUILayout.Space(10);
		
			GUILayout.BeginHorizontal(); {
				
				GUILayout.Space(20);
				
				playbackTime = Timeline(playbackTime);
				
				GUILayout.Space(10);
				
			}
			GUILayout.EndHorizontal();
			
			GUILayout.FlexibleSpace();
			
			GUILayout.BeginHorizontal(); {
				
                if (GUILayout.Button("Tools")) {
					GenericMenu menu = new GenericMenu();
					
					GenericMenu.MenuFunction2 callback = delegate(object obj) {
						int id = (int)obj;
						
						switch(id)
						{
							case 1:
							{
								stateClipboard = eventInspector.GetEvents(targetController, selectedLayer, targetState.GetFullPathHash(targetStateMachine));
								break;
							}
								
							case 2:
							{
								eventInspector.InsertEventsCopy(targetController, selectedLayer, targetState.GetFullPathHash(targetStateMachine), stateClipboard);
								break;
							}
								
							case 3:
							{
								controllerClipboard = eventInspector.GetEvents(targetController);
								break;
							}
							
							case 4:
							{
								eventInspector.InsertControllerEventsCopy(targetController, controllerClipboard);
								break;
							}
						}
					};
					
					if (targetState == null)
						menu.AddDisabledItem(new GUIContent("Copy All Events From Selected State"));
					else
						menu.AddItem(new GUIContent("Copy All Events From Selected State"), false, callback, 1);
					
					if (targetState == null || stateClipboard == null || stateClipboard.Length == 0)
						menu.AddDisabledItem(new GUIContent("Paste All Events To Selected State"));
					else
						menu.AddItem(new GUIContent("Paste All Events To Selected State"), false, callback, 2);
					
					if (targetController == null)
						menu.AddDisabledItem(new GUIContent("Copy All Events From Selected Controller"));
					else
						menu.AddItem(new GUIContent("Copy All Events From Selected Controller"), false, callback, 3);
					
					if (targetController == null || controllerClipboard == null || controllerClipboard.Count == 0)
						menu.AddDisabledItem(new GUIContent("Paste All Events To Selected Controller"));
					else
						menu.AddItem(new GUIContent("Paste All Events To Selected Controller"), false, callback, 4);
					
					
					
					menu.ShowAsContext();
				}
				
				GUILayout.FlexibleSpace();
				
				if (GUILayout.Button("Add", GUILayout.Width(80))) {
					MecanimEvent newEvent = new MecanimEvent();
					newEvent.normalizedTime = playbackTime;
					newEvent.functionName = "MessageName";
					newEvent.paramType = MecanimEventParamTypes.None;
					
					displayEvents.Add(newEvent);
					SortEvents();
					
					SetActiveEvent(newEvent);
					
					MecanimEventEditorPopup.Show(this, newEvent, GetConditionParameters());
				}
				
//.........这里部分代码省略.........
开发者ID:fakestuff,项目名称:MecanimEventSystem,代码行数:101,代码来源:MecanimEventEditor.cs

示例12: DrawMenu

	void DrawMenu() {
		//if (GUILayout.Button("Create...", EditorStyles.toolbarButton))
		Color OldColor = GUI.backgroundColor;
		GUI.backgroundColor = new Color(1,1,1,1);
		GUILayout.BeginHorizontal(GUI.skin.GetStyle("Toolbar"));
		if (GUILayout.Button("File", GUI.skin.GetStyle("ToolbarDropDown")))
		{
			GenericMenu toolsMenu = new GenericMenu();

			//if (Selection.activeGameObject != null)
			//toolsMenu.AddItem(new GUIContent("New/Simple"), false, NewSimple);
			toolsMenu.AddItem(new GUIContent("New"), false, NewAdvanced);
			toolsMenu.AddItem(new GUIContent("Open"), false, Load);
			toolsMenu.AddSeparator("");
			if (CurrentFilePath!="")
			toolsMenu.AddItem(new GUIContent("Save"), false, Save);
			else
			toolsMenu.AddDisabledItem(new GUIContent("Save"));
			toolsMenu.AddItem(new GUIContent("Save as..."), false, SaveAs);

			toolsMenu.AddSeparator("");
			toolsMenu.AddItem(new GUIContent("Help"), false, OpenHelp);
			toolsMenu.AddSeparator("");
			//List<string> lst = new List<string>();
			/*lst.AddRange(GlobalSettings.RecentFiles);
			string[] lstArray = lst.Distinct().ToArray();
			for(int i=0;i<(lstArray.Length);i+=1)
			{
				toolsMenu.AddItem(new GUIContent("Open Recent/"+Path.GetFileName(lstArray[i])), false, Nothing,i);
			}*/
			//else
			//toolsMenu.AddDisabledItem(new GUIContent("Optimize Selected"));

			//toolsMenu.AddSeparator("");

			//toolsMenu.AddItem(new GUIContent("Help..."), false, Nothing);

			// Offset menu from right of editor window
			toolsMenu.DropDown(new Rect(5, 0, 0, 16));
			EditorGUIUtility.ExitGUI();
		}
		if (GUILayout.Button("View", GUI.skin.GetStyle("ToolbarDropDown")))
		{
			GenericMenu toolsMenu = new GenericMenu();

			//if (Selection.activeGameObject != null)
			//toolsMenu.AddItem(new GUIContent("New/Simple"), false, NewSimple);
			toolsMenu.AddItem(new GUIContent("Layer Names"), ViewLayerNames, SetViewLayerNames);
			toolsMenu.AddItem(new GUIContent("Flat Look"), Flatter, SetFlatter);
			toolsMenu.AddItem(new GUIContent("Blend Layer Icons"), BlendLayers, SetBlendLayers);
			toolsMenu.DropDown(new Rect(41, 0, 0, 16));
			EditorGUIUtility.ExitGUI();
		}
		if (GUILayout.Button("Previews",GUI.skin.GetStyle("ToolbarDropDown")))
		{
			GenericMenu toolsMenu = new GenericMenu();

			//if (Selection.activeGameObject != null)
			toolsMenu.AddItem(new GUIContent("Open Preview Window"), false, OpenPreview);
			toolsMenu.AddItem(new GUIContent("Realtime Preview Updates"), RealtimePreviewUpdates, SetRealtimePreviewUpdates);
			toolsMenu.AddItem(new GUIContent("Animate Layer Previews"), AnimateInputs, SetAnimateInputs);

			toolsMenu.DropDown(new Rect(83, 0, 0, 16));
			EditorGUIUtility.ExitGUI();
		}
		if (GUILayout.Button("Help",GUI.skin.GetStyle("ToolbarDropDown")))
		{
			GenericMenu toolsMenu = new GenericMenu();
			toolsMenu.AddItem(new GUIContent("Open Online Documentation"), false, OpenHelp);
			toolsMenu.AddItem(new GUIContent("Report Bug or Suggest Feature!"), false, SendFeedback);
			toolsMenu.AddItem(new GUIContent("See Bug and Feature Reports"), false, OpenFeedback);

			toolsMenu.DropDown(new Rect(146, 0, 0, 17));
			EditorGUIUtility.ExitGUI();
		}
//		Debug.Log("DrawMenu:"+Status);
		GUILayout.Button("Status: "+Status,GUI.skin.GetStyle("ToolbarButton"));
		//GUILayout.Label(Path.GetFileName(AssetDatabase.GetAssetPath(OpenShader)));
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();
		GUI.backgroundColor = OldColor;
	}	
开发者ID:Thaon,项目名称:IRNBRU,代码行数:82,代码来源:ShaderSandwich.cs

示例13: OnGUI_LinesTab


//.........这里部分代码省略.........
                else
                {
                    GUILayout.BeginArea(spacingInfo.GetLineRect(currentLineY), "", OurStyles.Line);
                }
                //GUILayout.BeginHorizontal(GUI.skin.box);

                // == DRAG == //

                Rect dragControlRect = spacingInfo.GetDragControlRect();
                GUI.Label(dragControlRect, SafeTextureContent(dragLineTextureDark, dragLineTextureLight, "=", LineDragInfo.dragging ? null : "Drag to re-order line"));

                if (currentEventType == EventType.MouseDown)
                {
                    if (!LineDragInfo.dragging)
                    {
                        if (dragControlRect.Contains(currentEvent.mousePosition))
                        {
                            deleteConfirmActive = false; // Make sure delete confirm is disabled (no focus trigger here otherwise)
                            if (currentEvent.button == 0) // left
                            {
                                LineDragInfo.draggedLineIndex = lineIndex;
                                LineDragInfo.dragging = true;
                                LineDragInfo.lastTrueMousePosition = new Vector2(currentEvent.mousePosition.x, currentEvent.mousePosition.y + currentLineY);
                                LineDragInfo.dragStartMousePositionY = LineDragInfo.lastTrueMousePosition.y;
                                LineDragInfo.lastLineY = -100001;
                                //Debug.Log("Starting to drag line #" + LineDragInfo.draggedLineIndex + " at mouse " + LineDragInfo.dragStartMousePositionY);
                                GUI.FocusControl("LinesToggle"); // cancel any non-drag control focus
                                currentEvent.Use();
                            }
                            else
                            {
                                GenericMenu outputMenu = new GenericMenu();
                                if (lineIndex == 0)
                                    outputMenu.AddDisabledItem(new GUIContent("Move up"));
                                else
                                    outputMenu.AddItem(new GUIContent("Move up"), false, DragHandleContextMoveUp, lineIndex);
                                if (lineIndex == settings.data.LineCount() - 1)
                                    outputMenu.AddDisabledItem(new GUIContent("Move down"));
                                else
                                    outputMenu.AddItem(new GUIContent("Move down"), false, DragHandleContextMoveDown, lineIndex);
                                outputMenu.AddSeparator("");
                                if (lineIndex == 0)
                                    outputMenu.AddDisabledItem(new GUIContent("Move to top"));
                                else
                                    outputMenu.AddItem(new GUIContent("Move to top"), false, DragHandleContextMoveTop, lineIndex);
                                if (lineIndex == settings.data.LineCount() - 1)
                                    outputMenu.AddDisabledItem(new GUIContent("Move to bottom"));
                                else
                                    outputMenu.AddItem(new GUIContent("Move to bottom"), false, DragHandleContextMoveBottom, lineIndex);
                                outputMenu.AddSeparator("");
                                outputMenu.AddItem(new GUIContent("Duplicate line"), false, DragHandleContextDuplicate, lineIndex);
                                outputMenu.ShowAsContext();
                            }
                        }
                    }
                }

                // == FLAG == //

                bool currentOutputStatus = settings.data.GetOutputStatus(lineIndex);

                Rect outputFlagRect = spacingInfo.GetFlagControlRect();
                if (currentOutputStatus)
                {
                    LineIssue issues = settings.data.GetIssues(lineIndex);
                    if (EasyVoiceClipCreator.IssuePreventsFileMaking(issues))
开发者ID:Stumpstump,项目名称:RoverGame,代码行数:67,代码来源:EasyVoiceEditorWindow.cs

示例14: HandleNodeEvents

	private void HandleNodeEvents (State node)
	{
		Event ev = Event.current;
		switch (ev.type) {
		case EventType.mouseDown:
			if (node.position.Contains (ev.mousePosition) && Event.current.button == 0) {
				isDraggingState = true;
			}

			if (node.position.Contains (ev.mousePosition) && Event.current.button == 1) {
				GenericMenu genericMenu = new GenericMenu ();
				genericMenu.AddItem (new GUIContent ("Make Transition"), false, new GenericMenu.MenuFunction2 (this.MakeTransitionCallback), node);
				if (!((State)node).isDefaultState && node.GetType() != typeof(AnyState) && !(node is BaseTrigger)) {
					genericMenu.AddItem (new GUIContent ("Set As Default"), false, new GenericMenu.MenuFunction2 (this.SetDefaultCallback), node);
				} else {
					genericMenu.AddDisabledItem (new GUIContent ("Set As Default"));
				}
				
				if(node.GetType() == typeof(AnyState)){
					genericMenu.AddDisabledItem (new GUIContent ("Delete"));
				}else{
					genericMenu.AddItem (new GUIContent ("Delete"), false, new GenericMenu.MenuFunction2 (this.DeleteStateCallback), node);
				}

				if(node.GetType() == typeof(AnyState)){
					genericMenu.AddDisabledItem (new GUIContent ("Copy"));
				}else{
					genericMenu.AddItem (new GUIContent ("Copy"), false, new GenericMenu.MenuFunction2 (this.CopyState), node);
				}
				if(copyOfState!= null && node.GetType() != typeof(AnyState) && copyOfState.id != node.id){
					genericMenu.AddItem (new GUIContent ("Paste"), false, new GenericMenu.MenuFunction2 (this.PasteState), node);
				}else{
					genericMenu.AddDisabledItem (new GUIContent ("Paste"));
				}
				genericMenu.ShowAsContext ();
				ev.Use ();
			}
			break;
		case EventType.mouseUp:
			isDraggingState = false;
			Selection.activeObject=node;
			break;
		case EventType.mouseDrag:
			if (isDraggingState) {
				selectedState.position.x += Event.current.delta.x;
				selectedState.position.y += Event.current.delta.y;
				
				if (selectedState.position.y < 10) {
					selectedState.position.y = 10;
				}
				if (selectedState.position.x <  10) {
					selectedState.position.x = 10;
				}
				ev.Use ();
			}
			break;
		}
		
		if (node.position.Contains (ev.mousePosition) && (ev.type != EventType.MouseDown || ev.button != 0 ? false : ev.clickCount == 1)) {
			if (selectedState != node) {
				OnStateSelectionChanged (node);
			}
		}
	}
开发者ID:NusantaraBeta,项目名称:BrawlerRumble,代码行数:64,代码来源:AIEditorWindow.cs

示例15: ShowContextMenu

 private void ShowContextMenu(ANode node)
 {
     if (_tree == null || !_tree.Nodes.Contains(node)) {
         return;
     }
     GenericMenu menu = new GenericMenu();
     if(node is AFlowNode) {
         if(node != _tree.Root) {
             menu.AddItem(new GUIContent("Make Root"), false, RootCallback, node);
         } else {
             menu.AddDisabledItem(new GUIContent("Make Root"));
         }
         menu.AddItem(new GUIContent("Connect"), false, ConnectCallback, node);
     } else {
         menu.AddDisabledItem(new GUIContent("Make Root"));
         menu.AddDisabledItem(new GUIContent("Connect"));
     }
     menu.AddSeparator("");
     menu.AddItem(new GUIContent("Delete"), false, DeleteCallback, node);
     menu.ShowAsContext();
 }
开发者ID:marekdaniluk,项目名称:lab,代码行数:21,代码来源:TreeDrawer.cs


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