本文整理汇总了C#中UnityEditor.GenericMenu.AddSeparator方法的典型用法代码示例。如果您正苦于以下问题:C# GenericMenu.AddSeparator方法的具体用法?C# GenericMenu.AddSeparator怎么用?C# GenericMenu.AddSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.GenericMenu
的用法示例。
在下文中一共展示了GenericMenu.AddSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: AddItemsToMenu
public virtual void AddItemsToMenu(GenericMenu menu)
{
menu.AddItem(new GUIContent("Sort groups alphabetically"), this.m_SortGroupsAlphabetically, () => this.m_SortGroupsAlphabetically = !this.m_SortGroupsAlphabetically);
menu.AddItem(new GUIContent("Show referenced groups"), this.m_ShowReferencedBuses, () => this.m_ShowReferencedBuses = !this.m_ShowReferencedBuses);
menu.AddItem(new GUIContent("Show group connections"), this.m_ShowBusConnections, () => this.m_ShowBusConnections = !this.m_ShowBusConnections);
if (this.m_ShowBusConnections)
{
menu.AddItem(new GUIContent("Only highlight selected group connections"), this.m_ShowBusConnectionsOfSelection, () => this.m_ShowBusConnectionsOfSelection = !this.m_ShowBusConnectionsOfSelection);
}
menu.AddSeparator("");
menu.AddItem(new GUIContent("Vertical layout"), this.layoutMode == LayoutMode.Vertical, () => this.layoutMode = LayoutMode.Vertical);
menu.AddItem(new GUIContent("Horizontal layout"), this.layoutMode == LayoutMode.Horizontal, () => this.layoutMode = LayoutMode.Horizontal);
menu.AddSeparator("");
if (<>f__am$cache0 == null)
{
示例3: 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();
}
示例4: 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);
}
}
}
示例5: Slider
public static bool Slider(GUIContent label, ref float value, float displayScale, float displayExponent, string unit, float leftValue, float rightValue, AudioMixerController controller, AudioParameterPath path, params GUILayoutOption[] options)
{
EditorGUI.BeginChangeCheck();
float fieldWidth = EditorGUIUtility.fieldWidth;
string fieldFormatString = EditorGUI.kFloatFieldFormatString;
bool flag = controller.ContainsExposedParameter(path.parameter);
EditorGUIUtility.fieldWidth = 70f;
EditorGUI.kFloatFieldFormatString = "F2";
EditorGUI.s_UnitString = unit;
GUIContent label1 = label;
if (flag)
label1 = GUIContent.Temp(label.text + " ➔", label.tooltip);
float num1 = value * displayScale;
float num2 = EditorGUILayout.PowerSlider(label1, num1, leftValue * displayScale, rightValue * displayScale, displayExponent, options);
EditorGUI.s_UnitString = (string) null;
EditorGUI.kFloatFieldFormatString = fieldFormatString;
EditorGUIUtility.fieldWidth = fieldWidth;
if (Event.current.type == EventType.ContextClick && GUILayoutUtility.topLevel.GetLast().Contains(Event.current.mousePosition))
{
Event.current.Use();
GenericMenu genericMenu = new GenericMenu();
if (!flag)
genericMenu.AddItem(new GUIContent("Expose '" + path.ResolveStringPath(false) + "' to script"), false, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ExposePopupCallback), (object) new AudioMixerEffectGUI.ExposedParamContext(controller, path));
else
genericMenu.AddItem(new GUIContent("Unexpose"), false, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.UnexposePopupCallback), (object) new AudioMixerEffectGUI.ExposedParamContext(controller, path));
ParameterTransitionType type;
controller.TargetSnapshot.GetTransitionTypeOverride(path.parameter, out type);
genericMenu.AddSeparator(string.Empty);
genericMenu.AddItem(new GUIContent("Linear Snapshot Transition"), type == ParameterTransitionType.Lerp, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ParameterTransitionOverrideCallback), (object) new AudioMixerEffectGUI.ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Lerp));
genericMenu.AddItem(new GUIContent("Smoothstep Snapshot Transition"), type == ParameterTransitionType.Smoothstep, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ParameterTransitionOverrideCallback), (object) new AudioMixerEffectGUI.ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Smoothstep));
genericMenu.AddItem(new GUIContent("Squared Snapshot Transition"), type == ParameterTransitionType.Squared, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ParameterTransitionOverrideCallback), (object) new AudioMixerEffectGUI.ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.Squared));
genericMenu.AddItem(new GUIContent("SquareRoot Snapshot Transition"), type == ParameterTransitionType.SquareRoot, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ParameterTransitionOverrideCallback), (object) new AudioMixerEffectGUI.ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.SquareRoot));
genericMenu.AddItem(new GUIContent("BrickwallStart Snapshot Transition"), type == ParameterTransitionType.BrickwallStart, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ParameterTransitionOverrideCallback), (object) new AudioMixerEffectGUI.ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.BrickwallStart));
genericMenu.AddItem(new GUIContent("BrickwallEnd Snapshot Transition"), type == ParameterTransitionType.BrickwallEnd, new GenericMenu.MenuFunction2(AudioMixerEffectGUI.ParameterTransitionOverrideCallback), (object) new AudioMixerEffectGUI.ParameterTransitionOverrideContext(controller, path.parameter, ParameterTransitionType.BrickwallEnd));
genericMenu.AddSeparator(string.Empty);
genericMenu.ShowAsContext();
}
if (!EditorGUI.EndChangeCheck())
return false;
value = num2 / displayScale;
return true;
}
示例6: OnFlowToolsMenuGUI
public override void OnFlowToolsMenuGUI(string prefix, GenericMenu menu) {
menu.AddSeparator(string.Empty);
menu.AddItem(new GUIContent(prefix + "Open Device Preview"), on: false, func: () => {
DevicePreview.ShowEditor();
});
}
示例7: 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);
}
}
}
示例8: 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();
}
示例9: 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);
}
}
}
示例10: OpenGroupContextMenu
private void OpenGroupContextMenu(AudioMixerTreeViewNode audioNode, bool visible)
{
GenericMenu genericMenu = new GenericMenu();
if (this.NodeWasToggled != null)
{
genericMenu.AddItem(new GUIContent((!visible) ? "Show Group" : "Hide group"), false, delegate
{
this.NodeWasToggled(audioNode, !visible);
});
}
genericMenu.AddSeparator(string.Empty);
AudioMixerColorCodes.AddColorItemsToGenericMenu(genericMenu, audioNode.group);
genericMenu.ShowAsContext();
}
示例11: Show
public static void Show(Rect buttonRect, AudioMixerSnapshotController snapshot, AudioMixerSnapshotListView list)
{
GenericMenu genericMenu = new GenericMenu();
AudioMixerSnapshotListView.SnapshotMenu.data userData = new AudioMixerSnapshotListView.SnapshotMenu.data
{
snapshot = snapshot,
list = list
};
genericMenu.AddItem(new GUIContent("Set as start Snapshot"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.SetAsStartupSnapshot), userData);
genericMenu.AddSeparator(string.Empty);
genericMenu.AddItem(new GUIContent("Rename"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.Rename), userData);
genericMenu.AddItem(new GUIContent("Duplicate"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.Duplicate), userData);
genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.Delete), userData);
genericMenu.DropDown(buttonRect);
}
示例12: 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
}
示例13: CreateMenuItems
public void CreateMenuItems(GenericMenu genericMenu)
{
var groups = Commands.GroupBy(p => p==null? "" : p.Group).OrderBy(p => p.Key).ToArray();
foreach (var group in groups)
{
//genericMenu.AddDisabledItem(new GUIContent(group.Key));
var groupCount = 0;
foreach (var editorCommand in group.OrderBy(p => p.Order))
{
ICommand command = editorCommand.Command;
genericMenu.AddItem(new GUIContent(editorCommand.Title),editorCommand.Checked, () =>
{
InvertApplication.Execute(command);
} );
groupCount ++;
}
if (group != groups.Last() && groupCount > 0)
genericMenu.AddSeparator(null);
}
}
示例14: OpenGroupContextMenu
private void OpenGroupContextMenu(AudioMixerTreeViewNode audioNode, bool visible)
{
// ISSUE: object of a compiler-generated type is created
// ISSUE: variable of a compiler-generated type
AudioGroupTreeViewGUI.\u003COpenGroupContextMenu\u003Ec__AnonStorey64 menuCAnonStorey64 = new AudioGroupTreeViewGUI.\u003COpenGroupContextMenu\u003Ec__AnonStorey64();
// ISSUE: reference to a compiler-generated field
menuCAnonStorey64.audioNode = audioNode;
// ISSUE: reference to a compiler-generated field
menuCAnonStorey64.visible = visible;
// ISSUE: reference to a compiler-generated field
menuCAnonStorey64.\u003C\u003Ef__this = this;
GenericMenu menu = new GenericMenu();
if (this.NodeWasToggled != null)
{
// ISSUE: reference to a compiler-generated field
// ISSUE: reference to a compiler-generated method
menu.AddItem(new GUIContent(!menuCAnonStorey64.visible ? "Show Group" : "Hide group"), false, new GenericMenu.MenuFunction(menuCAnonStorey64.\u003C\u003Em__B2));
}
menu.AddSeparator(string.Empty);
AudioMixerGroupController[] groups;
// ISSUE: reference to a compiler-generated field
if (this.m_Controller.CachedSelection.Contains(menuCAnonStorey64.audioNode.group))
{
groups = this.m_Controller.CachedSelection.ToArray();
}
else
{
// ISSUE: reference to a compiler-generated field
groups = new AudioMixerGroupController[1]
{
menuCAnonStorey64.audioNode.group
};
}
AudioMixerColorCodes.AddColorItemsToGenericMenu(menu, groups);
menu.ShowAsContext();
}
示例15: OnTreeViewContextClick
public void OnTreeViewContextClick(int index)
{
TreeViewItem treeViewItem = this.m_AudioGroupTree.FindNode(index);
if (treeViewItem != null)
{
AudioMixerTreeViewNode audioMixerTreeViewNode = treeViewItem as AudioMixerTreeViewNode;
if (audioMixerTreeViewNode != null && audioMixerTreeViewNode.group != null)
{
GenericMenu genericMenu = new GenericMenu();
if (!EditorApplication.isPlaying)
{
genericMenu.AddItem(new GUIContent("Add child group"), false, new GenericMenu.MenuFunction2(this.AddChildGroupPopupCallback), new AudioMixerGroupPopupContext(this.m_Controller, audioMixerTreeViewNode.group));
if (audioMixerTreeViewNode.group != this.m_Controller.masterGroup)
{
genericMenu.AddItem(new GUIContent("Add sibling group"), false, new GenericMenu.MenuFunction2(this.AddSiblingGroupPopupCallback), new AudioMixerGroupPopupContext(this.m_Controller, audioMixerTreeViewNode.group));
genericMenu.AddSeparator(string.Empty);
genericMenu.AddItem(new GUIContent("Rename"), false, new GenericMenu.MenuFunction2(this.RenameGroupCallback), treeViewItem);
AudioMixerGroupController[] array = this.GetGroupSelectionWithoutMasterGroup().ToArray();
genericMenu.AddItem(new GUIContent((array.Length <= 1) ? "Duplicate group (and children)" : "Duplicate groups (and children)"), false, new GenericMenu.MenuFunction2(this.DuplicateGroupPopupCallback), this);
genericMenu.AddItem(new GUIContent((array.Length <= 1) ? "Remove group (and children)" : "Remove groups (and children)"), false, new GenericMenu.MenuFunction2(this.DeleteGroupsPopupCallback), this);
}
}
else
{
genericMenu.AddDisabledItem(new GUIContent("Modifying group topology in play mode is not allowed"));
}
genericMenu.ShowAsContext();
}
}
}