init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RPGCoreCommon.DynamicValues
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method)]
|
||||
public class DynamicValueProviderAttribute : PropertyAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// <b>[Fields/Property]</b><br/>
|
||||
/// Marks non-public field or property to provide value for <see cref="DynamicValue"/>'s formula.
|
||||
/// Public fields and properties are always used as value providers.
|
||||
/// Collections are ALWAYS ignored - if you want to get values from collection try to use custom method. More info below.
|
||||
/// <br/><br/>
|
||||
/// <b>[Method]</b><br/>
|
||||
/// Method can be marked as custom value provider.
|
||||
/// Those methods can have any name, but require specific return value and one parameter.
|
||||
/// Only two definitions of methods are valid, ex.:
|
||||
/// <ul>
|
||||
/// <li><b>T CustomProviderMethod(Type)</b> - this usage supports polymorphism,
|
||||
/// type in parameter will be supplied with type of any class that implements <T>.
|
||||
/// Thanks to this type of value we want can be specified in marker.</li>
|
||||
/// <li><b>T CustomProviderMethod(string)</b> - this usage DOESN'T support polymorphism,
|
||||
/// string in parameter is exactly value specified in marker.</li>
|
||||
/// </ul>
|
||||
/// </summary>
|
||||
public DynamicValueProviderAttribute()
|
||||
{
|
||||
// TODO: tutaj jeszcze jako argument trzeba przekazać nazwę drugiej metody, która ma listę możliwych stringów w przypadku użycia na CustomProviderMethod(string), wtedy będzie można to fajnie walidować już na poziomie tego narzędzia
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user