docs.unity3d.com
    目次を表示する/隠す

    Class ElementAdderMenuCommandAttribute

    Annotate IElementAdderMenuCommand<TContext> implementations with a ElementAdderMenuCommandAttribute to associate it with the contract type of addable elements.

    Inheritance
    Object
    Attribute
    ElementAdderMenuCommandAttribute
    Namespace: Unity.VisualScripting.ReorderableList.Element_Adder_Menu
    Syntax
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
    public sealed class ElementAdderMenuCommandAttribute : Attribute, _Attribute
    Examples

    The following source code demonstrates how to add a helper menu command to the add element menu of a shopping list:

    [ElementAdderMenuCommand(typeof(ShoppingItem))]
    public class AddFavoriteShoppingItemsCommand : IElementAdderMenuCommand<ShoppingList> {
     public AddFavoriteShoppingItemsCommand() {
         Content = new GUIContent("Add Favorite Items");
     }
    
     public GUIContent Content { get; private set; }
    
     public bool CanExecute(IElementAdder<ShoppingList> elementAdder) {
         return true;
     }
     public void Execute(IElementAdder<ShoppingList> elementAdder) {
         // xTODO: Add favorite items to the shopping list!
     }
    }
    @ElementAdderMenuCommand(ShoppingItem)
    class AddFavoriteShoppingItemsCommand extends IElementAdderMenuCommand.<ShoppingList> {
     var _content:GUIContent = new GUIContent('Add Favorite Items');
    
     function get Content():GUIContent { return _content; }
    
     function CanExecute(elementAdder:IElementAdder.<ShoppingList>):boolean {
         return true;
     }
     function Execute(elementAdder:IElementAdder.<ShoppingList>) {
         // xTODO: Add favorite items to the shopping list!
     }
    }

    Constructors

    ElementAdderMenuCommandAttribute(Type)

    Initializes a new instance of the ElementAdderMenuCommandAttribute class.

    Declaration
    public ElementAdderMenuCommandAttribute(Type contractType)
    Parameters
    Type Name Description
    Type contractType

    Contract type of addable elements.

    Properties

    ContractType

    Gets the contract type of addable elements.

    Declaration
    public Type ContractType { get; }
    Property Value
    Type Description
    Type

    Extension Methods

    XAnalyserProvider.Analyser(Object, IGraphContext)
    XAnalyserProvider.Analyser<TAnalyser>(Object, IGraphContext)
    XAnalyserProvider.Analysis(Object, IGraphContext)
    XAnalyserProvider.Analysis<TAnalysis>(Object, IGraphContext)
    XAnalyserProvider.Analyser(Object, GraphReference)
    XAnalyserProvider.Analyser<TAnalyser>(Object, GraphReference)
    XAnalyserProvider.Analysis(Object, GraphReference)
    XAnalyserProvider.Analysis<TAnalysis>(Object, GraphReference)
    XDescriptorProvider.Describe(Object)
    XDescriptorProvider.HasDescriptor(Object)
    XDescriptorProvider.Descriptor(Object)
    XDescriptorProvider.Descriptor<TDescriptor>(Object)
    XDescriptorProvider.Description(Object)
    XDescriptorProvider.Description<TDescription>(Object)
    Cloning.Clone(Object, ICloner, Boolean)
    Cloning.Clone<T>(T, ICloner, Boolean)
    Cloning.CloneViaFakeSerialization(Object)
    Cloning.CloneViaFakeSerialization<T>(T)
    ConversionUtility.IsConvertibleTo(Object, Type, Boolean)
    ConversionUtility.IsConvertibleTo<T>(Object, Boolean)
    ConversionUtility.ConvertTo(Object, Type)
    ConversionUtility.ConvertTo<T>(Object)
    TypeUtility.ToShortString(Object, Int32)
    Serialization.CloneViaSerialization<T>(T, Boolean)
    Serialization.CloneViaSerializationInto<TSource, TDestination>(TSource, ref TDestination, Boolean)
    Serialization.Serialize(Object, Boolean)
    LinqUtility.Yield<T>(T)
    UnityObjectUtility.IsUnityNull(Object)
    UnityObjectUtility.ToSafeString(Object)
    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)