示例#1
0
 /// <summary>
 /// Visits all attributes of the given <see cref="IAttributable"/>.
 /// </summary>
 /// <param name="attributable">The attributes of this <see cref="IAttributable"/>
 /// gets visited.</param>
 private void VisitAttributes(IAttributable attributable)
 {
     foreach (NRAttribute nrAttribute in attributable.Attributes)
     {
         nrAttribute.Accept(this);
     }
 }
示例#2
0
 public AttributeValueEnum(IAttributable parent, string name) : base(parent, name)
 {
     if (!typeof(TEnum).IsEnum)
     {
         throw new ArgumentException("TEnum must be an enum.");
     }
 }
 public static bool HasAttribute <TAttribute>(this IAttributable attributable) where TAttribute : class, IPropertyAttribute
 {
     if (null == attributable)
     {
         return(false);
     }
     return(UTinyPropertyMetaData <IAttributable> .HasAttribute <TAttribute>(attributable));
 }
 public static void RemoveAttribute <TAttribute>(this IAttributable attributable, TAttribute attribute) where TAttribute : class, IPropertyAttribute
 {
     if (null == attributable)
     {
         return;
     }
     UTinyPropertyMetaData <IAttributable> .UnregisterAttribute(attributable, attribute);
 }
 public static TAttribute GetAttribute <TAttribute>(this IAttributable attributable) where TAttribute : class, IPropertyAttribute
 {
     if (null == attributable)
     {
         return(null);
     }
     return(UTinyPropertyMetaData <IAttributable> .GetAttribute <TAttribute>(attributable));
 }
示例#6
0
 /// <summary>
 /// Visits the attributable.
 /// </summary>
 /// <param name="attributable">The attributable.</param>
 private void VisitAttributable(IAttributable attributable)
 {
     if (attributable == null)
     {
         return;
     }
     VisitAttributeList(attributable.Attributes);
 }
示例#7
0
 protected NodeAttribute(IAttributable parent, string name)
 {
     RuntimeSettable = true;
     Enabled         = true;
     Visible         = true;
     Parent          = parent;
     Name            = name;
     parent.AddAttribute(this);
 }
        /// <summary>
        /// Reads the contributor for the specified <see cref="IAttributable"/>.
        /// </summary>
        /// <param name="attributable">The attributable.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>An <see cref="AgentState"/> instance containing the REST API response.</returns>
        public AgentState ReadContributor(IAttributable attributable, params IStateTransitionOption[] options)
        {
            Attribution attribution = attributable.Attribution;

            if (attribution == null)
            {
                return(null);
            }

            return(ReadContributor(attribution.Contributor, options));
        }
示例#9
0
    /// <summary>
    /// Display information of an IAttributable object
    /// </summary>
    /// <param name="obj">the object to describe</param>
    public void DisplayInfo(IAttributable obj)
    {
        //display base object information
        DisplayInfo((ILevelableObject)obj);

        //redisplay the attributes panel
        attrPanel.SetActive(true);

        str.text   = obj.Strength.ToString();
        agi.text   = obj.Agility.ToString();
        intel.text = obj.Intelligence.ToString();
    }
示例#10
0
        public static void AddRelatedUnitSourceAttribute(this IAttributable attributable, ITypeNameResolver resolver,
                                                         RelatedUnitSourceUsage flag, int sortOrder)
        {
            var argument    = resolver.GetEnumValueCode(flag);
            var csAttribute = new CsAttribute(nameof(RelatedUnitSourceAttribute))
                              .WithArgumentCode(argument);

            if (flag != RelatedUnitSourceUsage.DoNotUse)
            {
                csAttribute.WithArgument(sortOrder);
            }
            attributable.WithAttribute(csAttribute);
        }
 public AttributeValueDouble(IAttributable parent, string name, string unit, double val) : base(parent, name, unit)
 {
     Set(val);
 }
示例#12
0
 public AttributeValueFile(IAttributable parent, string name, bool mustExist) : base(parent, name)
 {
     MustExist = mustExist;
 }
示例#13
0
 protected AttributeValueRange(IAttributable parent, string name) : base(parent, name)
 {
 }
示例#14
0
 public AttributeValueInt(IAttributable parent, string name) : base(parent, name)
 {
 }
示例#15
0
 public AttributeValueInt(IAttributable parent, string name, string unit, int val) : base(parent, name, unit)
 {
     Set(val);
 }
示例#16
0
 public AttributeValueInt(IAttributable parent, string name, string unit) : base(parent, name, unit)
 {
 }
示例#17
0
 protected NodeAttribute(IAttributable parent, string name, string unit) : this(parent, name)
 {
     Unit = unit;
 }
示例#18
0
 /// <summary>
 /// Instantiate an Attribution
 /// </summary>
 /// <param name="value">The attributable data</param>
 public Attribution(IAttributable value)
 {
     this.value = value;
 }
示例#19
0
		/// <summary>
		/// Instantiate an Attribution
		/// </summary>
		/// <param name="value">The attributable data</param>
		public Attribution(IAttributable value)
		{
			this.value = value;
		}
示例#20
0
 public AttributeValueTime(IAttributable parent, string name, Func <bool> running) : base(parent, name)
 {
 }
示例#21
0
 public AttributeValueTime(IAttributable parent, string name, Func <TimeSpan, TimeSpan> transformer, TimeSpan val) : base(parent, name)
 {
     Transformer = transformer;
     Set(val);
 }
示例#22
0
 public AttributeValueTime(IAttributable parent, string name, TimeSpan val) : base(parent, name)
 {
     Set(val);
 }
 public AttributeValueString(IAttributable parent, string name, string val) : base(parent, name)
 {
     Set(val);
 }
 public AttributeValueRangeInt(IAttributable parent, string name, int val) : base(parent, name)
 {
     Set(val);
 }
示例#25
0
 public AttributeValueInt(IAttributable parent, string name, Func <int, int> transformer) : base(parent, name)
 {
     Transformer = transformer;
 }
示例#26
0
 protected TypedNodeAttribute(IAttributable parent, string name, string unit) : base(parent, name, unit)
 {
 }
示例#27
0
 public AttributeValueInt(IAttributable parent, string name, string unit, Func <int, int> transformer, int val) : base(parent, name, unit)
 {
     Transformer = transformer;
     Set(val);
 }
 public AttributeValueRangeDouble(IAttributable parent, string name, double val) : base(parent, name)
 {
     Set(val);
 }
 public AttributeValueRangeDouble(IAttributable parent, string name) : base(parent, name)
 {
 }
 public static IAttributable WithAttribute <TAttribute>(this IAttributable attributable, TAttribute attribute)
     where TAttribute : class, IPropertyAttribute
 {
     attributable.AddAttribute(attribute);
     return(attributable);
 }