本文整理汇总了C#中UnityEditor.GenericMenu.ShowAsContext方法的典型用法代码示例。如果您正苦于以下问题:C# GenericMenu.ShowAsContext方法的具体用法?C# GenericMenu.ShowAsContext怎么用?C# GenericMenu.ShowAsContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.GenericMenu
的用法示例。
在下文中一共展示了GenericMenu.ShowAsContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
internal static void Show(int savedFilterInstanceID)
{
GUIContent content = new GUIContent("Delete");
GenericMenu genericMenu = new GenericMenu();
genericMenu.AddItem(content, false, new GenericMenu.MenuFunction(new ProjectBrowser.SavedFiltersContextMenu(savedFilterInstanceID).Delete));
genericMenu.ShowAsContext();
}
示例2: OnContextClick
public void OnContextClick(int itemIndex)
{
GenericMenu genericMenu = new GenericMenu();
genericMenu.AddItem(new GUIContent("Unexpose"), false, (GenericMenu.MenuFunction2) (data => this.Delete((int) data)), (object) itemIndex);
genericMenu.AddItem(new GUIContent("Rename"), false, (GenericMenu.MenuFunction2) (data => this.m_ReorderableListWithRenameAndScrollView.BeginRename((int) data, 0.0f)), (object) itemIndex);
genericMenu.ShowAsContext();
}
示例3: SelectBehaviorBrain
private void SelectBehaviorBrain()
{
GUIContent content = new GUIContent(BehaviorTreeEditor.active != null ? BehaviorTreeEditor.active.name : "[None Selected]");
float width = EditorStyles.toolbarDropDown.CalcSize(content).x;
width = Mathf.Clamp(width, 100f, width);
if (GUILayout.Button(content, EditorStyles.toolbarDropDown, GUILayout.Width(width)))
{
GenericMenu menu = new GenericMenu();
if (BehaviorTreeEditor.active != null)
SelectBehaviorBrainMenu(BehaviorTreeEditor.active, ref menu);
menu.AddItem(new GUIContent("[Craete New]"), false, delegate ()
{
BehaviorTree bt = AssetCreator.CreateAsset<BehaviorTree>(true);
if (bt != null)
{
bt.Name = bt.name;
Root root = BehaviorTreeEditorUtility.AddNode<Root>(BehaviorTreeEditor.center, bt);
bt.rootNode = root;
root.Name = "Root";
AssetDatabase.SaveAssets();
BehaviorTreeEditor.SelectBehaviorTrees(bt);
}
});
menu.ShowAsContext();
}
}
示例4: OnRightClick
protected override void OnRightClick(Vector2 mousePosition)
{
base.OnRightClick(mousePosition);
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Delete State Transition"), false, Delete);
menu.ShowAsContext();
}
示例5: OnRightClick
protected override void OnRightClick(Vector2 mousePosition)
{
base.OnRightClick(mousePosition);
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Add Sequence Action"), false, OnAddNode, mousePosition);
menu.ShowAsContext();
}
示例6: OnTransitionContextClick
private void OnTransitionContextClick(int index){
GenericMenu menu = new GenericMenu ();
menu.AddItem (new GUIContent("Remove"),false,delegate() {
FsmEditorUtility.DestroyImmediate(node.Transitions[index]);
node.Transitions = ArrayUtility.Remove (node.Transitions, transitions [index]);
this.ResetTransitionList();
});
menu.ShowAsContext ();
}
示例7: Show
public static void Show(int itemIndex, FlexibleMenu caller)
{
FlexibleMenu.ItemContextMenu.s_Caller = caller;
GenericMenu genericMenu = new GenericMenu();
genericMenu.AddItem(new GUIContent("Edit..."), false, new GenericMenu.MenuFunction2(FlexibleMenu.ItemContextMenu.Edit), itemIndex);
genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction2(FlexibleMenu.ItemContextMenu.Delete), itemIndex);
genericMenu.ShowAsContext();
GUIUtility.ExitGUI();
}
示例8: OnTreeViewContextClick
public void OnTreeViewContextClick(int index)
{
AudioMixerItem node = (AudioMixerItem) this.m_TreeView.FindNode(index);
if (node == null)
return;
GenericMenu genericMenu = new GenericMenu();
genericMenu.AddItem(new GUIContent("Delete AudioMixer"), false, new GenericMenu.MenuFunction2(this.DeleteAudioMixerCallback), (object) node.mixer);
genericMenu.ShowAsContext();
}
示例9: OnTreeViewContextClick
public void OnTreeViewContextClick(int index)
{
AudioMixerItem audioMixerItem = (AudioMixerItem)this.m_TreeView.FindNode(index);
if (audioMixerItem != null)
{
GenericMenu genericMenu = new GenericMenu();
genericMenu.AddItem(new GUIContent("Delete AudioMixer"), false, new GenericMenu.MenuFunction2(this.DeleteAudioMixerCallback), audioMixerItem.mixer);
genericMenu.ShowAsContext();
}
}
示例10: OnGUI
/// <summary>
/// Draws the gui control.
/// <param name="position">Rectangle on the screen to use for the property GUI.</param>
/// <param name="property">The SerializedProperty to make the custom GUI for.</param>
/// <param name="label">The label of this property.</param>
/// </summary>
public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {
// Get state
var targetState = property.serializedObject.targetObject as InternalStateBehaviour;
// It's a valid state?
if (targetState != null) {
// Draw prefix label
#if UNITY_4_0_0 || UNITY_4_1 || UNITY_4_2
Rect controlPosition = EditorGUI.PrefixLabel(position, EditorGUIUtility.GetControlID(FocusType.Passive, position), label);
#else
Rect controlPosition = EditorGUI.PrefixLabel(position, label);
#endif
// Get the parent
ParentBehaviour parent = targetState.parent;
// Draw button as popup
if (GUI.Button(controlPosition, parent != null ? parent.stateName : "Null", EditorStyles.popup)) {
// Get valid parents for the state
List<ParentBehaviour> validParents = new List<ParentBehaviour>();
var targetParent = targetState as ParentBehaviour;
validParents.AddRange(targetState.GetComponents<ParentBehaviour>());
// The target state is a parent behaviour?
if (targetParent != null) {
for (int i = validParents.Count - 1; i >= 0; i--) {
// it's the targetParent?
if (validParents[i] == targetParent)
validParents.RemoveAt(i);
// The parent is a child of the target parent?
else if (validParents[i].IsAncestor(targetParent))
validParents.RemoveAt(i);
}
}
// Create menu
var menu = new GenericMenu();
// Add null item
menu.AddItem(new GUIContent("Null"), parent == null, this.OnSetNewParent, new SetParent(targetState, null));
// Add menu items
var parentNames = new List<string>();
for (int i = 0; i < validParents.Count; i++) {
string parentName = StringHelper.GetUniqueNameInList(parentNames, validParents[i].fullStateName);
parentNames.Add(parentName);
menu.AddItem(new GUIContent(parentName), parent == validParents[i], this.OnSetNewParent, new SetParent(targetState, validParents[i]));
}
// Show context menu
menu.ShowAsContext();
}
}
}
示例11: DrawLocationMenu
private void DrawLocationMenu()
{
if (GUILayout.Button("Menu", "MiniPullDown", GUILayout.Width(56))) {
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("New Location"), false, AddNewLocation);
menu.AddItem(new GUIContent("Sort/By Name"), false, SortLocationsByName);
menu.AddItem(new GUIContent("Sort/By ID"), false, SortLocationsByID);
menu.AddItem(new GUIContent("Sync From DB"), database.syncInfo.syncLocations, ToggleSyncLocationsFromDB);
menu.ShowAsContext();
}
}
示例12: DrawTemplateMenu
private void DrawTemplateMenu()
{
if (GUILayout.Button("Menu", "MiniPullDown", GUILayout.Width(56))) {
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Export XML..."), false, ExportTemplate);
menu.AddItem(new GUIContent("Import XML..."), false, ImportTemplate);
menu.AddItem(new GUIContent("Update From Assets"), false, ConfirmUpdateFromAssets);
menu.AddItem(new GUIContent("Reset"), false, ResetTemplate);
menu.ShowAsContext();
}
}
示例13: ShowAddTrackGroupContextMenu
/// <summary>
/// Show the "Add Track Group" context menu.
/// </summary>
/// <param name="cutscene">The current Cutscene that the track group will be added to.</param>
public static void ShowAddTrackGroupContextMenu(Cutscene cutscene)
{
GenericMenu createMenu = new GenericMenu();
foreach (Type type in DirectorHelper.GetAllSubTypes(typeof(TrackGroup)))
{
TrackGroupContextData userData = getContextDataFromType(cutscene, type);
string text = string.Format(userData.Label);
createMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(AddTrackGroup), userData);
}
createMenu.ShowAsContext();
}
示例14: Show
internal static void Show(SerializedProperty prop)
{
GUIContent content1 = new GUIContent("Copy");
GUIContent content2 = new GUIContent("Paste");
GenericMenu genericMenu = new GenericMenu();
genericMenu.AddItem(content1, false, new GenericMenu.MenuFunction(new GradientContextMenu(prop).Copy));
if (ParticleSystemClipboard.HasSingleGradient())
genericMenu.AddItem(content2, false, new GenericMenu.MenuFunction(new GradientContextMenu(prop).Paste));
else
genericMenu.AddDisabledItem(content2);
genericMenu.ShowAsContext();
}
示例15: DrawNodeEditorMenu
private void DrawNodeEditorMenu()
{
if (GUILayout.Button("Menu", "MiniPullDown", GUILayout.Width(56))) {
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("New Conversation"), false, AddNewConversationToNodeEditor);
menu.AddItem(new GUIContent("Sort/By Title"), false, SortConversationsByTitle);
menu.AddItem(new GUIContent("Sort/By ID"), false, SortConversationsByID);
menu.AddItem(new GUIContent("Actor Names"), showActorNames, ToggleShowActorNames);
menu.AddItem(new GUIContent("Outline Mode"), false, ActivateOutlineMode);
menu.ShowAsContext();
}
}
开发者ID:farreltr,项目名称:OneLastSunset,代码行数:12,代码来源:DialogueEditorWindowConversationNodeEditorTopControls.cs