/// <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); } }
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)); }
/// <summary> /// Visits the attributable. /// </summary> /// <param name="attributable">The attributable.</param> private void VisitAttributable(IAttributable attributable) { if (attributable == null) { return; } VisitAttributeList(attributable.Attributes); }
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)); }
/// <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(); }
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); }
public AttributeValueFile(IAttributable parent, string name, bool mustExist) : base(parent, name) { MustExist = mustExist; }
protected AttributeValueRange(IAttributable parent, string name) : base(parent, name) { }
public AttributeValueInt(IAttributable parent, string name) : base(parent, name) { }
public AttributeValueInt(IAttributable parent, string name, string unit, int val) : base(parent, name, unit) { Set(val); }
public AttributeValueInt(IAttributable parent, string name, string unit) : base(parent, name, unit) { }
protected NodeAttribute(IAttributable parent, string name, string unit) : this(parent, name) { Unit = unit; }
/// <summary> /// Instantiate an Attribution /// </summary> /// <param name="value">The attributable data</param> public Attribution(IAttributable value) { this.value = value; }
/// <summary> /// Instantiate an Attribution /// </summary> /// <param name="value">The attributable data</param> public Attribution(IAttributable value) { this.value = value; }
public AttributeValueTime(IAttributable parent, string name, Func <bool> running) : base(parent, name) { }
public AttributeValueTime(IAttributable parent, string name, Func <TimeSpan, TimeSpan> transformer, TimeSpan val) : base(parent, name) { Transformer = transformer; Set(val); }
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); }
public AttributeValueInt(IAttributable parent, string name, Func <int, int> transformer) : base(parent, name) { Transformer = transformer; }
protected TypedNodeAttribute(IAttributable parent, string name, string unit) : base(parent, name, unit) { }
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); }