本文整理匯總了C#中UnityEditor.GenericMenu.DropDown方法的典型用法代碼示例。如果您正苦於以下問題:C# GenericMenu.DropDown方法的具體用法?C# GenericMenu.DropDown怎麽用?C# GenericMenu.DropDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEditor.GenericMenu
的用法示例。
在下文中一共展示了GenericMenu.DropDown方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnGUI
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var left = position; left.xMax -= 40;
var right = position; right.xMin = left.xMax + 2;
EditorGUI.PropertyField(left, property);
if (GUI.Button(right, "List") == true)
{
var menu = new GenericMenu();
if (LeanLocalization.Instance != null)
{
for (var j = 0; j < LeanLocalization.Instance.Languages.Count; j++)
{
var language = LeanLocalization.Instance.Languages[j];
menu.AddItem(new GUIContent(language), property.stringValue == language, () => { property.stringValue = language; property.serializedObject.ApplyModifiedProperties(); });
}
}
if (menu.GetItemCount() > 0)
{
menu.DropDown(right);
}
else
{
Debug.LogWarning("Your scene doesn't contain any languages, so the language name list couldn't be created.");
}
}
}
示例2: OnGUI
void OnGUI()
{
Rect curWindowRect = EditorGUILayout.BeginVertical();
{
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
{
// Create drop down
Rect createBtnRect = GUILayoutUtility.GetRect(new GUIContent("Create"), EditorStyles.toolbarDropDown, GUILayout.ExpandWidth(false));
if (GUI.Button(createBtnRect, "Create", EditorStyles.toolbarDropDown))
{
GenericMenu menu = new GenericMenu();
menu.DropDown(createBtnRect);
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Settings", EditorStyles.toolbarButton))
BuildSettingEditor.Show();
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
}
示例3: 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();
}
示例4: Show
public static void Show(Rect buttonRect, int viewIndex, AudioMixerGroupViewList list)
{
GenericMenu genericMenu = new GenericMenu();
AudioMixerGroupViewList.ViewsContexttMenu.data userData = new AudioMixerGroupViewList.ViewsContexttMenu.data
{
viewIndex = viewIndex,
list = list
};
genericMenu.AddItem(new GUIContent("Rename"), false, new GenericMenu.MenuFunction2(AudioMixerGroupViewList.ViewsContexttMenu.Rename), userData);
genericMenu.AddItem(new GUIContent("Duplicate"), false, new GenericMenu.MenuFunction2(AudioMixerGroupViewList.ViewsContexttMenu.Duplicate), userData);
genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction2(AudioMixerGroupViewList.ViewsContexttMenu.Delete), userData);
genericMenu.DropDown(buttonRect);
}
示例5: OpenContextMenu
public static void OpenContextMenu(Vector2 startPos, IEnumerable<ContextMenuItem> items)
{
GenericMenu contextMenu = new GenericMenu();
foreach (var item in items)
{
var handler = item.Handler;
contextMenu.AddOptionalItem(
item.IsEnabled, new GUIContent(item.Caption), item.IsChecked, () => handler());
}
contextMenu.DropDown(new Rect(startPos.x, startPos.y, 0, 0));
}
示例6: 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);
}
示例7: 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);
}
示例8: CreateNodeMenuGUI
// Create and open the "Create New Node" dropdown menu.
public void CreateNodeMenuGUI(Patch patch)
{
if (GUILayout.Button(_buttonText, EditorStyles.toolbarDropDown))
{
var menu = new GenericMenu();
foreach (var nodeType in _nodeTypes)
menu.AddItem(
new GUIContent(nodeType.label), false,
OnMenuItem, new MenuItemData(patch, nodeType.type)
);
var oy = EditorStyles.toolbar.fixedHeight - 2;
menu.DropDown(new Rect(1, oy, 1, 1));
}
}
示例9: 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);
}
示例10: Show
internal static void Show(Rect position, SerializedProperty property, SerializedProperty property2, SerializedProperty scalar, Rect curveRanges, ParticleSystemCurveEditor curveEditor)
{
GUIContent content = new GUIContent("Copy");
GUIContent content2 = new GUIContent("Paste");
GenericMenu menu = new GenericMenu();
bool flag = (property != null) && (property2 != null);
bool flag2 = (flag && ParticleSystemClipboard.HasDoubleAnimationCurve()) || (!flag && ParticleSystemClipboard.HasSingleAnimationCurve());
AnimationCurveContextMenu menu2 = new AnimationCurveContextMenu(property, property2, scalar, curveRanges, curveEditor);
menu.AddItem(content, false, new GenericMenu.MenuFunction(menu2.Copy));
if (flag2)
{
menu.AddItem(content2, false, new GenericMenu.MenuFunction(menu2.Paste));
}
else
{
menu.AddDisabledItem(content2);
}
menu.DropDown(position);
}
示例11: Show
public static void Show(Rect buttonRect, string[] classNames, int initialSelectedInstanceID)
{
GenericMenu genericMenu = new GenericMenu();
List<UnityEngine.Object> list = AssetSelectionPopupMenu.FindAssetsOfType(classNames);
if (list.Any<UnityEngine.Object>())
{
list.Sort((UnityEngine.Object result1, UnityEngine.Object result2) => EditorUtility.NaturalCompare(result1.name, result2.name));
foreach (UnityEngine.Object current in list)
{
GUIContent content = new GUIContent(current.name);
bool on = current.GetInstanceID() == initialSelectedInstanceID;
genericMenu.AddItem(content, on, new GenericMenu.MenuFunction2(AssetSelectionPopupMenu.SelectCallback), current);
}
}
else
{
genericMenu.AddDisabledItem(new GUIContent("No Audio Mixers found in this project"));
}
genericMenu.DropDown(buttonRect);
}
示例12: Show
public static void Show(Rect buttonRect, string[] classNames, int initialSelectedInstanceID)
{
GenericMenu genericMenu = new GenericMenu();
List<UnityEngine.Object> assetsOfType = AssetSelectionPopupMenu.FindAssetsOfType(classNames);
if (assetsOfType.Any<UnityEngine.Object>())
{
assetsOfType.Sort((Comparison<UnityEngine.Object>) ((result1, result2) => EditorUtility.NaturalCompare(result1.name, result2.name)));
using (List<UnityEngine.Object>.Enumerator enumerator = assetsOfType.GetEnumerator())
{
while (enumerator.MoveNext())
{
UnityEngine.Object current = enumerator.Current;
GUIContent content = new GUIContent(current.name);
bool on = current.GetInstanceID() == initialSelectedInstanceID;
genericMenu.AddItem(content, on, new GenericMenu.MenuFunction2(AssetSelectionPopupMenu.SelectCallback), (object) current);
}
}
}
else
genericMenu.AddDisabledItem(new GUIContent("No Audio Mixers found in this project"));
genericMenu.DropDown(buttonRect);
}
示例13: CreateFileMenu
private void CreateFileMenu(Rect position)
{
GenericMenu fileMenu = new GenericMenu();
fileMenu.AddItem(new GUIContent("Overwrite Input Settings"), false, HandleFileMenuOption, FileMenuOptions.OverriteInputSettings);
if(EditorToolbox.HasInputAdapterAddon())
fileMenu.AddItem(new GUIContent("Configure For Input Adapter"), false, HandleFileMenuOption, FileMenuOptions.ConfigureForInputAdapter);
fileMenu.AddSeparator("");
if(_inputManager.inputConfigurations.Count > 0)
fileMenu.AddItem(new GUIContent("Create Snapshot"), false, HandleFileMenuOption, FileMenuOptions.CreateSnapshot);
else
fileMenu.AddDisabledItem(new GUIContent("Create Snapshot"));
if(EditorToolbox.CanLoadSnapshot())
fileMenu.AddItem(new GUIContent("Load Snapshot"), false, HandleFileMenuOption, FileMenuOptions.LoadSnapshot);
else
fileMenu.AddDisabledItem(new GUIContent("Load Snapshot"));
fileMenu.AddSeparator("");
if(_inputManager.inputConfigurations.Count > 0)
fileMenu.AddItem(new GUIContent("Export"), false, HandleFileMenuOption, FileMenuOptions.Export);
else
fileMenu.AddDisabledItem(new GUIContent("Export"));
fileMenu.AddItem(new GUIContent("Import"), false, HandleFileMenuOption, FileMenuOptions.Import);
if(EditorToolbox.HasJoystickMappingAddon())
fileMenu.AddItem(new GUIContent("Import Joystick Mapping"), false, HandleFileMenuOption, FileMenuOptions.ImportJoystickMapping);
fileMenu.DropDown(position);
}
示例14: DrawToolbar
private void DrawToolbar(GUIStyle buttonStyle) {
var result = GUILayout.Button("Create", buttonStyle);
var rect = GUILayoutUtility.GetLastRect();
if (result == true) {
var menu = new GenericMenu();
this.SetupCreateMenu(string.Empty, menu);
menu.DropDown(new Rect(rect.x, rect.y + TOOLBAR_HEIGHT, rect.width, rect.height));
}
result = GUILayout.Button("Tools", buttonStyle);
rect = GUILayoutUtility.GetLastRect();
if (result == true) {
var menu = new GenericMenu();
this.SetupToolsMenu(string.Empty, menu);
menu.DropDown(new Rect(rect.x, rect.y + TOOLBAR_HEIGHT, rect.width, rect.height));
}
Flow.OnDrawToolbarGUI(this, buttonStyle);
GUILayout.FlexibleSpace();
var oldColor = GUI.color;
GUI.color = Color.gray;
GUILayout.Label(string.Format("Current Data: {0}", AssetDatabase.GetAssetPath(this.guiSplash.cachedData)), buttonStyle);
GUI.color = oldColor;
if (GUILayout.Button("Change", buttonStyle) == true) {
this.ChangeFlowData();
}
}
示例15: CreateEditMenu
private void CreateEditMenu(Rect position)
{
GenericMenu editMenu = new GenericMenu();
editMenu.AddItem(new GUIContent("New Configuration"), false, HandleEditMenuOption, EditMenuOptions.NewInputConfiguration);
if(_selectionPath.Count >= 1)
editMenu.AddItem(new GUIContent("New Axis"), false, HandleEditMenuOption, EditMenuOptions.NewAxisConfiguration);
else
editMenu.AddDisabledItem(new GUIContent("New Axis"));
editMenu.AddSeparator("");
if(_selectionPath.Count > 0)
editMenu.AddItem(new GUIContent("Duplicate Shift+D"), false, HandleEditMenuOption, EditMenuOptions.Duplicate);
else
editMenu.AddDisabledItem(new GUIContent("Duplicate Shift+D"));
if(_selectionPath.Count > 0)
editMenu.AddItem(new GUIContent("Delete Del"), false, HandleEditMenuOption, EditMenuOptions.Delete);
else
editMenu.AddDisabledItem(new GUIContent("Delete Del"));
if(_inputManager.inputConfigurations.Count > 0)
editMenu.AddItem(new GUIContent("Delete All"), false, HandleEditMenuOption, EditMenuOptions.DeleteAll);
else
editMenu.AddDisabledItem(new GUIContent("Delete All"));
if(_selectionPath.Count >= 2)
editMenu.AddItem(new GUIContent("Copy"), false, HandleEditMenuOption, EditMenuOptions.Copy);
else
editMenu.AddDisabledItem(new GUIContent("Copy"));
if(_copySource != null && _selectionPath.Count >= 2)
editMenu.AddItem(new GUIContent("Paste"), false, HandleEditMenuOption, EditMenuOptions.Paste);
else
editMenu.AddDisabledItem(new GUIContent("Paste"));
editMenu.AddSeparator("");
editMenu.AddItem(new GUIContent("Select Target"), false, HandleEditMenuOption, EditMenuOptions.SelectTarget);
editMenu.AddItem(new GUIContent("Ignore Timescale"), _inputManager.ignoreTimescale, HandleEditMenuOption, EditMenuOptions.IgnoreTimescale);
editMenu.AddItem(new GUIContent("Dont Destroy On Load"), _inputManager.dontDestroyOnLoad, HandleEditMenuOption, EditMenuOptions.DontDestroyOnLoad);
editMenu.DropDown(position);
}