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


C# GenericMenu.AddSeparator方法代码示例

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


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

示例1: ClearConnectionMenu

    public void ClearConnectionMenu()
    {
        GenericMenu menu = new GenericMenu ();

        menu.AddSeparator ("ARE YOU SURE YOU WANT TO CLEAR?");
        menu.AddSeparator ("");
        menu.AddItem(new GUIContent ("Clear"), false, ClearConnections, "");
        menu.AddItem(new GUIContent ("Don't Clear"), false, DontClearConnections, "");

        menu.ShowAsContext ();
    }
开发者ID:ekhudson,项目名称:Train2013,代码行数:11,代码来源:ConnectionRegistryEditor.cs

示例2: showContextMenu

    protected override void showContextMenu(Behaviour behaviour)
    {
        CinemaActorClipCurve clipCurve = behaviour as CinemaActorClipCurve;
        if (clipCurve == null) return;

        List<KeyValuePair<string, string>> currentCurves = new List<KeyValuePair<string, string>>();
        foreach (MemberClipCurveData data in clipCurve.CurveData)
        {
            KeyValuePair<string, string> curveStrings = new KeyValuePair<string, string>(data.Type, data.PropertyName);
            currentCurves.Add(curveStrings);
        }

        GenericMenu createMenu = new GenericMenu();

        if (clipCurve.Actor != null)
        {
            Component[] components = DirectorHelper.getValidComponents(clipCurve.Actor.gameObject);

            for (int i = 0; i < components.Length; i++)
            {
                Component component = components[i];
                MemberInfo[] members = DirectorHelper.getValidMembers(component);
                for (int j = 0; j < members.Length; j++)
                {
                    AddCurveContext context = new AddCurveContext();
                    context.clipCurve = clipCurve;
                    context.component = component;
                    context.memberInfo = members[j];
                    if (!currentCurves.Contains(new KeyValuePair<string, string>(component.GetType().Name, members[j].Name)))
                    {
                        createMenu.AddItem(new GUIContent(string.Format("Add Curve/{0}/{1}", component.GetType().Name, DirectorHelper.GetUserFriendlyName(component, members[j]))), false, addCurve, context);
                    }
                }
            }
            createMenu.AddSeparator(string.Empty);
        }
        createMenu.AddItem(new GUIContent("Copy"), false, copyItem, behaviour);
        createMenu.AddSeparator(string.Empty);
        createMenu.AddItem(new GUIContent("Clear"), false, deleteItem, clipCurve);
        createMenu.ShowAsContext();
    }
开发者ID:ArthurRasmusson,项目名称:UofTHacks2016,代码行数:41,代码来源:CinemaActorCurveControl.cs

示例3: showContextMenu

    protected override void showContextMenu(Behaviour behaviour)
    {
        CinemaShot shot = behaviour as CinemaShot;
        if (shot == null) return;

        Camera[] cameras = GameObject.FindObjectsOfType<Camera>();
        
        GenericMenu createMenu = new GenericMenu();
        createMenu.AddItem(new GUIContent("Focus"), false, focusShot, shot);
        foreach (Camera c in cameras)
        {
            
            ContextSetCamera arg = new ContextSetCamera();
            arg.shot = shot;
            arg.camera = c;
            createMenu.AddItem(new GUIContent(string.Format(MODIFY_CAMERA, c.gameObject.name)), false, setCamera, arg);
        }
        createMenu.AddSeparator(string.Empty);
        createMenu.AddItem(new GUIContent("Copy"), false, copyItem, behaviour);
        createMenu.AddSeparator(string.Empty);
        createMenu.AddItem(new GUIContent("Clear"), false, deleteItem, shot);
        createMenu.ShowAsContext();
    }
开发者ID:ArthurRasmusson,项目名称:UofTHacks2016,代码行数:23,代码来源:CinemaShotControl.cs

示例4: 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

示例5: displayContextMenu

    private void displayContextMenu()
    {
        var menu = new GenericMenu();

        var items = new List<ContextMenuItem>();
        FillContextMenu( items );

        var actionFunc = new System.Action<int>( ( command ) =>
        {
            var handler = items[ command ].Handler;
            handler();
        } );

        menu.AddDisabledItem( new GUIContent( string.Format( "{0} (GUI Manager)", target.name ) ) );
        menu.AddSeparator( "" );

        var options = items.Select( i => i.MenuText ).ToList();
        for( int i = 0; i < options.Count; i++ )
        {
            var index = i;
            if( options[ i ] == "-" )
                menu.AddSeparator( "" );
            else
                menu.AddItem( new GUIContent( options[ i ] ), false, () => { actionFunc( index ); } );
        }

        menu.ShowAsContext();
    }
开发者ID:zc1415926,项目名称:Unity-SelectCharacter-Scene,代码行数:28,代码来源:dfGUIManagerInspector.cs

示例6: OnGUIToolbar

    private void OnGUIToolbar()
    {
        GUILayout.BeginHorizontal(EditorStyles.toolbar);

        GUILayout.Label("");

        if (GUILayout.Button("Help", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
        {
            GenericMenu menu = new GenericMenu();
            menu.AddItem(new GUIContent("View Online Documentation"), false, OnViewDocs);
            menu.AddItem(new GUIContent("View API Reference"), false, OnViewAPI);
            menu.AddSeparator("");
            menu.AddItem(new GUIContent("Open Product Page"), false, OnProductPage);
            menu.AddItem(new GUIContent("Check Updates"), false, OnCheckUpdates);
            menu.AddItem(new GUIContent("Mail to Support"), false, OnSendMail);
            menu.ShowAsContext();
        }


        GUILayout.EndHorizontal();
    }
开发者ID:juliancruz87,项目名称:transpp,代码行数:21,代码来源:OnlineMapsEditor.cs

示例7: OnContextMenu

    void OnContextMenu()
    {
        Event evt = Event.current;
        if(evt.type == EventType.ContextClick){
            GenericMenu menu = new GenericMenu();
            if(!HasFSM()){
              	menu.AddItem (new GUIContent ("AttachFSM"), false, AttachFSM, evt.mousePosition);
            } else {
                menu.AddItem (new GUIContent ("Add/NewState/ChangeColor"), false, AddState,evt.mousePosition);
           	}
            menu.AddSeparator("");
            menu.AddItem (new GUIContent ("Purge"), false, Purge, evt.mousePosition);
            menu.ShowAsContext ();
            evt.Use();
            Debug.Log("OnContextMenu::ContextClick");
        }

        //menu.AddItem (new GUIContent ("Add/NewTransition/Timer"), false, AddTransition, evt.mousePosition);
    }
开发者ID:mmvlad,项目名称:FiniteStateMachine,代码行数:19,代码来源:ScriptEditor_FSM.cs

示例8: RenderLayerMenu

	private void RenderLayerMenu(Event curEvent)
	{
		GenericMenu menu = new GenericMenu();
		string[] layerArray = GetLayerList();
		
		menu.AddItem(new GUIContent("Nothing"),false,LayerMenuItemCallback,-2);
		
		menu.AddItem(new GUIContent("Everything"),false,LayerMenuItemCallback,-1);
		
		menu.AddSeparator(string.Empty);
		
		bool selected = false;
		for(int i = 0; i < 32; i++)
		{
			if(layerArray[i] != string.Empty)
			{
				selected = false;
				
				if( ((1 << i) & window.liveTemplate.layerIndex) == (1 << i) )
					selected = true;

				menu.AddItem(new GUIContent( layerArray[i] ) ,selected,LayerMenuItemCallback, (1 << i));
			}
		}
		
		menu.ShowAsContext();
		
		curEvent.Use();
	}
开发者ID:davia966,项目名称:Just-a-Student,代码行数:29,代码来源:qb_Painter.cs

示例9: OnFlowCreateMenuGUI

		public override void OnFlowCreateMenuGUI(string prefix, GenericMenu menu) {

			if (this.InstallationNeeded() == false) {

				menu.AddSeparator(prefix);

				menu.AddItem(new GUIContent(prefix + "Functions/Definition"), on: false, func: () => {
					
					this.flowEditor.CreateNewItem(() => {
						
						var window = FlowSystem.CreateWindow(flags: FlowWindow.Flags.IsContainer | FlowWindow.Flags.IsFunction);
						window.title = "Function Definition";

						return window;
						
					});

				});

				menu.AddItem(new GUIContent(prefix + "Functions/Call"), on: false, func: () => {
					
					this.flowEditor.CreateNewItem(() => {
						
						var window = FlowSystem.CreateWindow(flags: FlowWindow.Flags.IsFunction | FlowWindow.Flags.IsSmall | FlowWindow.Flags.CantCompiled);
						window.smallStyleDefault = "flow node 3";
						window.smallStyleSelected = "flow node 3 on";
						window.title = "Function Call";

						window.rect.width = 150f;
						window.rect.height = 100f;

						return window;
						
					});

				});

			}

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

示例10: OnGUI

    void OnGUI()
    {
        GUIStyle boldNumberFieldStyle = new GUIStyle(EditorStyles.numberField);
        boldNumberFieldStyle.font = EditorStyles.boldFont;

        GUIStyle boldToggleStyle = new GUIStyle(EditorStyles.toggle);
        boldToggleStyle.font = EditorStyles.boldFont;

        GUI.enabled = !waitTillPlistHasBeenWritten;

        //Toolbar
        EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
        {
            Rect optionsRect = GUILayoutUtility.GetRect(0, 20, GUILayout.ExpandWidth(false));

            if (GUILayout.Button(new GUIContent("Sort   " + (sortAscending ? "▼" : "▲"), "Change sorting to " + (sortAscending ? "descending" : "ascending")), EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
            {
                OnChangeSortModeClicked();
            }

            if (GUILayout.Button(new GUIContent("Options", "Contains additional functionality like \"Add new entry\" and \"Delete all entries\" "), EditorStyles.toolbarDropDown, GUILayout.ExpandWidth(false)))
            {
                GenericMenu options = new GenericMenu();
                options.AddItem(new GUIContent("New Entry..."), false, OnNewEntryClicked);
                options.AddSeparator("");
                options.AddItem(new GUIContent("Import..."), false, OnImport);
                options.AddItem(new GUIContent("Export Selected..."), false, OnExportSelected);
                options.AddItem(new GUIContent("Export All Entries"), false, OnExportAllClicked);
                options.AddSeparator("");
                options.AddItem(new GUIContent("Delete Selected Entries"), false, OnDeleteSelectedClicked);
                options.AddItem(new GUIContent("Delete All Entries"), false, OnDeleteAllClicked);
                options.DropDown(optionsRect);
            }

            GUILayout.Space(5);

            //Searchfield
            Rect position = GUILayoutUtility.GetRect(50, 250, 10, 50,EditorStyles.toolbarTextField);
            position.width -= 16;
            position.x += 16;
            SearchString = GUI.TextField(position, SearchString, EditorStyles.toolbarTextField);

            position.x = position.x - 18;
            position.width = 20;
            if (GUI.Button(position, "", ToolbarSeachTextFieldPopup))
            {
                GenericMenu options = new GenericMenu();
                options.AddItem(new GUIContent("All"), SearchFilter == SearchFilterType.All, OnSearchAllClicked);
                options.AddItem(new GUIContent("Key"), SearchFilter == SearchFilterType.Key, OnSearchKeyClicked);
                options.AddItem(new GUIContent("Value (Strings only)"), SearchFilter == SearchFilterType.Value , OnSearchValueClicked);
                options.DropDown(position);
            }

            position = GUILayoutUtility.GetRect(10, 10, ToolbarSeachCancelButton);
            position.x -= 5;
            if (GUI.Button(position, "", ToolbarSeachCancelButton))
            {
                SearchString = string.Empty;
            }

            GUILayout.FlexibleSpace();

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                string refreshTooltip = "Should all entries be automaticly refreshed every " + UpdateIntervalInSeconds + " seconds?";
                autoRefresh = GUILayout.Toggle(autoRefresh, new GUIContent("Auto Refresh ", refreshTooltip), EditorStyles.toolbarButton, GUILayout.ExpandWidth(false), GUILayout.MinWidth(75));
            }

            if (GUILayout.Button(new GUIContent(RefreshIcon, "Force a refresh, could take a few seconds."), EditorStyles.toolbarButton, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false)))
            {
                RefreshKeys();
            }

            Rect r;
            if (Application.platform == RuntimePlatform.OSXEditor)
                r = GUILayoutUtility.GetRect(16, 16);
            else
                r = GUILayoutUtility.GetRect(9, 16);

            if (waitTillPlistHasBeenWritten)
            {
                Texture2D t = AssetDatabase.LoadAssetAtPath(IconsPath + "loader/" + (Mathf.FloorToInt(rotation % 12) + 1) + ".png", typeof(Texture2D)) as Texture2D;

                GUI.DrawTexture(new Rect(r.x + 3, r.y, 16, 16), t);
            }
        }
        EditorGUILayout.EndHorizontal();

        GUI.enabled = !waitTillPlistHasBeenWritten;

        if (showNewEntryBox)
        {
            GUILayout.BeginHorizontal(GUI.skin.box);
            {
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                {
                    newKey = EditorGUILayout.TextField("Key", newKey);

                    switch (selectedType)
                    {
//.........这里部分代码省略.........
开发者ID:kinifi,项目名称:LE_IM,代码行数:101,代码来源:APPWindow.cs

示例11: BuildFileMenu

    void BuildFileMenu()
    {
        _fileMenu = new GenericMenu();
        _fileMenu.AddItem(new GUIContent("New psai Soundtrack"), false, FileMenuCallback, "new");
        _fileMenu.AddItem(new GUIContent("Open psai Soundtrack"), false, FileMenuCallback, "open");
        if (EditorModel.Instance.ProjectDataChangedSinceLastSave)
        {
            _fileMenu.AddItem(new GUIContent("Save"), false, FileMenuCallback, "save");
        }
        else
        {
            _fileMenu.AddDisabledItem(new GUIContent("Save"));
        }

        if (EditorModel.Instance.Project != null)
        {
            _fileMenu.AddItem(new GUIContent("Save As"), false, FileMenuCallback, "saveas");
        }
        else
        {
            _fileMenu.AddDisabledItem(new GUIContent("Save As"));
        }

        _fileMenu.AddSeparator("");

        if (EditorModel.Instance.Project != null)
        {
            _fileMenu.AddItem(new GUIContent("Import Theme(s) from other psai Soundtrack"), false, FileMenuCallback, "import");
        }
        else
        {
            _fileMenu.AddDisabledItem(new GUIContent("Import Theme(s) from other psai Soundtrack"));
        }

        /*
        _fileMenu.AddSeparator("");
        if (EditorModel.Instance.Project != null && EditorModel.Instance.Project.Themes.Count > 0)
        {
            _fileMenu.AddItem(new GUIContent("Build Soundtrack"), false, FileMenuCallback, "export");
        }
        else
        {
            _fileMenu.AddDisabledItem(new GUIContent("Build Soundtrack"));
        }
         */
    }
开发者ID:si3792,项目名称:StudentsVsZombies,代码行数:46,代码来源:PsaiEditorWindow.cs

示例12: ShowNodeCreationMenu

    public void ShowNodeCreationMenu()
    {
        if (NodifyEditorUtilities.currentSelectedGroup == null) { return; }

        GenericMenu menu = new GenericMenu();

        InitializeCreateNodeMenu();
        foreach(CreateMenu menuItem in createNodeMenuItems)
        {
            object[] argArray = new object[] { menuItem.type, menuItem.name, Event.current.mousePosition - NodifyEditorUtilities.currentSelectedGroup.editorWindowOffset, menuItem.iconResourcePath };

            menu.AddItem(new GUIContent(menuItem.path), false, delegate(object args)
            {
                object[] argToArray = (object[])args;

                System.Type type = (System.Type)argToArray[0];
                GameObject nodeObj = new GameObject((string)argToArray[1]);

                #if UNITY_5
                    Node nodeClass = (Node)nodeObj.AddComponent(type);
                #else
                    Node nodeClass = (Node)nodeObj.AddComponent(type.Name);
                #endif
                nodeClass.editorPosition = (Vector2)argToArray[2];
                nodeClass.editorResourceIcon = (string)argToArray[3];
                nodeClass.OnEditorNodeCreated();
                nodeObj.transform.parent = NodifyEditorUtilities.currentSelectedGroup.transform;

            }, argArray);
        }

        menu.AddSeparator("");

        menu.AddItem(new GUIContent("New Group"), false, delegate(object args)
        {
            GameObject nGroup = new GameObject("NewGroup");
            NodeGroup nGroupClass = nGroup.AddComponent<NodeGroup>();
            nGroupClass.transform.parent = NodifyEditorUtilities.currentSelectedGroup.transform;
            nGroupClass.editorPosition = (Vector2)args;
            nGroupClass.OnEditorNodeCreated();
        }, Event.current.mousePosition - NodifyEditorUtilities.currentSelectedGroup.editorWindowOffset);

        if(Selection.objects.Length > 0)
        {
            if(Selection.objects.Length > 1 || (Selection.objects.Length == 1 && !Selection.Contains(NodifyEditorUtilities.currentSelectedGroup.gameObject)))
            {
                menu.AddItem(new GUIContent("New Group [with selected]"), false, delegate(object args)
                {
                    GameObject nGroup = new GameObject("NewGroup");
                    NodeGroup nGroupClass = nGroup.AddComponent<NodeGroup>();
                    nGroupClass.transform.parent = NodifyEditorUtilities.currentSelectedGroup.transform;
                    nGroupClass.editorPosition = (Vector2)args;
                    nGroupClass.OnEditorNodeCreated();

                    foreach(GameObject obj in Selection.gameObjects)
                    {
                        if(obj != NodifyEditorUtilities.currentSelectedGroup.gameObject && obj.GetComponent<Node>())
                        {
                            obj.transform.parent = nGroupClass.transform;
                        }
                    }

                }, Event.current.mousePosition - NodifyEditorUtilities.currentSelectedGroup.editorWindowOffset);
            }
        }

        menu.ShowAsContext();
    }
开发者ID:anneomcl,项目名称:LetsMake,代码行数:68,代码来源:NodifyEditorWindow.cs

示例13: buildContextMenu

 void buildContextMenu(int frame)
 {
     contextMenuFrame = frame;
     contextMenu = new GenericMenu();
     bool selectionHasKeys = aData.getCurrentTake().contextSelectionTracks.Count > 1 || aData.getCurrentTake().contextSelectionHasKeys();
     bool copyBufferNotEmpty = (contextSelectionKeysBuffer.Count > 0);
     bool canPaste = false;
     bool singleTrack = contextSelectionKeysBuffer.Count == 1;
     AMTrack selectedTrack = aData.getCurrentTake().getSelectedTrack();
     if(copyBufferNotEmpty) {
         if(singleTrack) {
             // if origin is property track
             if(selectedTrack is AMPropertyTrack) {
                 // if pasting into property track
                 if(contextSelectionTracksBuffer[0] is AMPropertyTrack) {
                     // if property tracks have the same property
                     if((selectedTrack as AMPropertyTrack).hasSamePropertyAs((contextSelectionTracksBuffer[0] as AMPropertyTrack))) {
                         canPaste = true;
                     }
                 }
                 // if origin is event track
             }
             else if(selectedTrack is AMEventTrack) {
                 // if pasting into event track
                 if(contextSelectionTracksBuffer[0] is AMEventTrack) {
                     // if event tracks are compaitable
                     if((selectedTrack as AMEventTrack).hasSameEventsAs((contextSelectionTracksBuffer[0] as AMEventTrack))) {
                         canPaste = true;
                     }
                 }
             }
             else {
                 if(selectedTrack.getTrackType() == contextSelectionTracksBuffer[0].getTrackType()) {
                     canPaste = true;
                 }
             }
         }
         else {
             // to do
             if(contextSelectionTracksBuffer.Contains(selectedTrack)) canPaste = true;
         }
     }
     contextMenu.AddItem(new GUIContent("Insert Keyframe"), false, invokeContextMenuItem, 0);
     contextMenu.AddSeparator("");
     if(selectionHasKeys) {
         contextMenu.AddItem(new GUIContent("Cut Frames"), false, invokeContextMenuItem, 1);
         contextMenu.AddItem(new GUIContent("Copy Frames"), false, invokeContextMenuItem, 2);
         if(canPaste) contextMenu.AddItem(new GUIContent("Paste Frames"), false, invokeContextMenuItem, 3);
         else contextMenu.AddDisabledItem(new GUIContent("Paste Frames"));
         contextMenu.AddItem(new GUIContent("Clear Frames"), false, invokeContextMenuItem, 4);
     }
     else {
         contextMenu.AddDisabledItem(new GUIContent("Cut Frames"));
         contextMenu.AddDisabledItem(new GUIContent("Copy Frames"));
         if(canPaste) contextMenu.AddItem(new GUIContent("Paste Frames"), false, invokeContextMenuItem, 3);
         else contextMenu.AddDisabledItem(new GUIContent("Paste Frames"));
         contextMenu.AddDisabledItem(new GUIContent("Clear Frames"));
     }
     contextMenu.AddItem(new GUIContent("Select All Frames"), false, invokeContextMenuItem, 5);
 }
开发者ID:nathanfunk,项目名称:MateAnimator,代码行数:60,代码来源:AMTimeline.cs

示例14: OnRightMouseClick

    public void OnRightMouseClick(Vector2 mousePos)
    {
        string image = GetClickedImageName (mousePos);
        if(!image.Equals(string.Empty)) {

            selection.Clear();
            selection.Add(image);
            editor.Repaint ();

            GenericMenu menu = new GenericMenu ();
            menu.AddItem (new GUIContent ("Copy Name"), false, SubMenuCallBack,     TexturePackerMenuItem.COPY_TO_CLIPBOARD);
            menu.AddSeparator ("");
            menu.AddItem (new GUIContent ("Documentation"), false, SubMenuCallBack, TexturePackerMenuItem.DOCUMENTATION);
            menu.ShowAsContext ();
        } else {
            selection.Clear();
        }

        editor.Repaint ();
    }
开发者ID:eaheckert,项目名称:Asteroid,代码行数:20,代码来源:TexturePackerAtlasEditor.cs

示例15: buildAddTrackMenu_Drag

    void buildAddTrackMenu_Drag()
    {
        bool hasTransform = true;
        bool hasAnimation = true;
        bool hasAudioSource = true;
        bool hasCamera = true;

        foreach(GameObject g in objects_window) {
            // break loop when all variables are false
            if(!hasTransform && !hasAnimation && !hasAudioSource && !hasCamera) break;

            if(hasTransform && !g.GetComponent(typeof(Transform))) {
                hasTransform = false;
            }
            if(hasAnimation && !g.GetComponent(typeof(Animation))) {
                hasAnimation = false;
            }
            if(hasAudioSource && !g.GetComponent(typeof(AudioSource))) {
                hasAudioSource = false;
            }
            if(hasCamera && !g.GetComponent(typeof(Camera))) {
                hasCamera = false;
            }
        }
        // add track menu
        menu_drag = new GenericMenu();

        // Translation
        if(hasTransform) { menu_drag.AddItem(new GUIContent("Translation"), false, addTrackFromMenu, (int)Track.Translation); }
        else { menu_drag.AddDisabledItem(new GUIContent("Translation")); }
        // Rotation
        if(hasTransform) { menu_drag.AddItem(new GUIContent("Rotation"), false, addTrackFromMenu, (int)Track.Rotation); }
        else { menu_drag.AddDisabledItem(new GUIContent("Rotation")); }
        // Orientation
        if(hasTransform) menu_drag.AddItem(new GUIContent("Orientation"), false, addTrackFromMenu, (int)Track.Orientation);
        else menu_drag.AddDisabledItem(new GUIContent("Orientation"));
        // Animation
        if(hasAnimation) menu_drag.AddItem(new GUIContent("Animation"), false, addTrackFromMenu, (int)Track.Animation);
        else menu_drag.AddDisabledItem(new GUIContent("Animation"));
        // Audio
        if(hasAudioSource) menu_drag.AddItem(new GUIContent("Audio"), false, addTrackFromMenu, (int)Track.Audio);
        else menu_drag.AddDisabledItem(new GUIContent("Audio"));
        // Property
        menu_drag.AddItem(new GUIContent("Property"), false, addTrackFromMenu, (int)Track.Property);
        // Event
        menu_drag.AddItem(new GUIContent("Event"), false, addTrackFromMenu, (int)Track.Event);
        // GO Active
        menu_drag.AddItem(new GUIContent("GO Active"), false, addTrackFromMenu, (int)Track.GOSetActive);

        if(oData.quickAdd_Combos.Count > 0) {
            // multiple tracks
            menu_drag.AddSeparator("");
            foreach(List<int> combo in oData.quickAdd_Combos) {
                string combo_name = "";
                for(int i = 0; i < combo.Count; i++) {
                    //combo_name += Enum.GetName(typeof(Track),combo[i])+" ";
                    combo_name += TrackNames[combo[i]] + " ";
                    if(i < combo.Count - 1) combo_name += "+ ";
                }
                if(canQuickAddCombo(combo, hasTransform, hasAnimation, hasAudioSource, hasCamera)) menu_drag.AddItem(new GUIContent(combo_name), false, addTrackFromMenu, 100 + oData.quickAdd_Combos.IndexOf(combo));
                else menu_drag.AddDisabledItem(new GUIContent(combo_name));
            }
        }
    }
开发者ID:nathanfunk,项目名称:MateAnimator,代码行数:64,代码来源:AMTimeline.cs


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