2018-10-30 20:05:06 +01:00
|
|
|
using UnityEditor;
|
|
|
|
|
2019-09-27 17:48:18 +02:00
|
|
|
namespace UnityAtoms.Editor
|
2018-10-30 20:05:06 +01:00
|
|
|
{
|
2019-10-15 19:19:44 +02:00
|
|
|
/// <summary>
|
2020-03-09 00:16:40 +01:00
|
|
|
/// A custom property drawer for References. Makes it possible to choose between a Value, Variable, Constant or a Variable Instancer.
|
2019-10-15 19:19:44 +02:00
|
|
|
/// </summary>
|
2019-04-17 13:05:23 +02:00
|
|
|
|
2020-03-09 00:16:40 +01:00
|
|
|
[CustomPropertyDrawer(typeof(AtomBaseReference), true)]
|
|
|
|
public class AtomReferenceDrawer : AtomBaseReferenceDrawer
|
2018-10-30 20:05:06 +01:00
|
|
|
{
|
2020-03-09 00:16:40 +01:00
|
|
|
protected class UsageValue : UsageData
|
2019-11-12 00:03:12 +01:00
|
|
|
{
|
2020-03-09 00:16:40 +01:00
|
|
|
public override int Value { get => AtomReferenceUsage.VALUE; }
|
|
|
|
public override string PropertyName { get => "_value"; }
|
|
|
|
public override string DisplayName { get => "Use Value"; }
|
2019-11-12 00:03:12 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 00:16:40 +01:00
|
|
|
protected class UsageConstant : UsageData
|
2018-10-30 20:05:06 +01:00
|
|
|
{
|
2020-03-09 00:16:40 +01:00
|
|
|
public override int Value { get => AtomReferenceUsage.CONSTANT; }
|
|
|
|
public override string PropertyName { get => "_constant"; }
|
|
|
|
public override string DisplayName { get => "Use Constant"; }
|
|
|
|
}
|
2018-10-30 20:05:06 +01:00
|
|
|
|
2020-03-09 00:16:40 +01:00
|
|
|
protected class UsageVariable : UsageData
|
|
|
|
{
|
|
|
|
public override int Value { get => AtomReferenceUsage.VARIABLE; }
|
|
|
|
public override string PropertyName { get => "_variable"; }
|
|
|
|
public override string DisplayName { get => "Use Variable"; }
|
2018-10-30 20:05:06 +01:00
|
|
|
}
|
|
|
|
|
2020-03-09 00:16:40 +01:00
|
|
|
protected class UsageVariableInstancer : UsageData
|
Added Variable Instancer, Event Reference, Atom Collection and Atom List (old Atom List renamed to Atom Value List) (#110)
AtomVariableInstancer
- Added AtomVariableInstancer as an option to AtomReference.
- Added AtomVariableInstancer to generator.
- Added editor icon for AtomVariableInstancer.
AtomEventReference
- Added an AtomEventReference class (and AtomEventX2Reference). It’s similar to an AtomReference, but for Events. Let’s you pick between an Event, Variable (will select the Changed event) and a VariableInstancer (see above).
- Added AtomEventReference and AtomEventX2Reference to generator.
- Added a drawer for AtomEventReference.
- Listeners are now using AtomEventReference instead of AtomEvent.
- Refactoring of VoidHooks since Listeners are now using AtomEventReference.
AtomCollection
- Created an AtomCollection - a collection of Atoms associated with key strings (AtomReferences).
- Added new editor icon for collections.
- Created a SerializableDictionary class, which AtomCollection is using.
- Custom property drawer for SerializableDictionary.
- SerializableDictionary supports nested structures meaning that a AtomCollection can have a KVP that is pointing to another AtomCollection.
- AtomCollections have 3 events: Added, Removed, Cleared.
- Added an option to sync an InstanceVariable to collection - adding it to the collection when created (using gameObject’s instance id as key) and removing it from the collection when destroyed.
AtomList
- Renamed old AtomList to AtomValueList
- Added AtomList, like Collection, but a list
- Added new icon for AtomList
- Created a AtomBaseVariableList class, which AtomList is using.
- Custom property drawer for AtomBaseVariableList.
- AtomLists have 3 events: Added, Removed, Cleared.
- Added an option to sync an InstanceVariable to list - adding it to the list when created and removing it from the list when destroyed.
2020-02-23 02:39:43 +01:00
|
|
|
{
|
2020-03-09 00:16:40 +01:00
|
|
|
public override int Value { get => AtomReferenceUsage.VARIABLE_INSTANCER; }
|
|
|
|
public override string PropertyName { get => "_variableInstancer"; }
|
|
|
|
public override string DisplayName { get => "Use Variable Instancer"; }
|
Added Variable Instancer, Event Reference, Atom Collection and Atom List (old Atom List renamed to Atom Value List) (#110)
AtomVariableInstancer
- Added AtomVariableInstancer as an option to AtomReference.
- Added AtomVariableInstancer to generator.
- Added editor icon for AtomVariableInstancer.
AtomEventReference
- Added an AtomEventReference class (and AtomEventX2Reference). It’s similar to an AtomReference, but for Events. Let’s you pick between an Event, Variable (will select the Changed event) and a VariableInstancer (see above).
- Added AtomEventReference and AtomEventX2Reference to generator.
- Added a drawer for AtomEventReference.
- Listeners are now using AtomEventReference instead of AtomEvent.
- Refactoring of VoidHooks since Listeners are now using AtomEventReference.
AtomCollection
- Created an AtomCollection - a collection of Atoms associated with key strings (AtomReferences).
- Added new editor icon for collections.
- Created a SerializableDictionary class, which AtomCollection is using.
- Custom property drawer for SerializableDictionary.
- SerializableDictionary supports nested structures meaning that a AtomCollection can have a KVP that is pointing to another AtomCollection.
- AtomCollections have 3 events: Added, Removed, Cleared.
- Added an option to sync an InstanceVariable to collection - adding it to the collection when created (using gameObject’s instance id as key) and removing it from the collection when destroyed.
AtomList
- Renamed old AtomList to AtomValueList
- Added AtomList, like Collection, but a list
- Added new icon for AtomList
- Created a AtomBaseVariableList class, which AtomList is using.
- Custom property drawer for AtomBaseVariableList.
- AtomLists have 3 events: Added, Removed, Cleared.
- Added an option to sync an InstanceVariable to list - adding it to the list when created and removing it from the list when destroyed.
2020-02-23 02:39:43 +01:00
|
|
|
}
|
2019-03-17 23:43:20 +01:00
|
|
|
|
2020-03-09 00:16:40 +01:00
|
|
|
private readonly UsageData[] _usages = new UsageData[4] { new UsageValue(), new UsageConstant(), new UsageVariable(), new UsageVariableInstancer() };
|
2018-10-30 20:05:06 +01:00
|
|
|
|
2020-03-09 00:16:40 +01:00
|
|
|
protected override UsageData[] GetUsages(SerializedProperty prop = null) => _usages;
|
2018-10-30 20:05:06 +01:00
|
|
|
}
|
2019-04-07 11:10:09 +02:00
|
|
|
}
|