From e3285591909435993a3e63d3ed9caa6764811486 Mon Sep 17 00:00:00 2001 From: Vladimir Popov Date: Wed, 15 Jul 2020 10:20:04 +0300 Subject: [PATCH] Simple Blackboard --- CHANGELOG.md | 21 + CHANGELOG.md.meta | 7 + Editor.meta | 8 + Editor/AddPopups.meta | 8 + Editor/AddPopups/AddPopup.cs | 76 ++ Editor/AddPopups/AddPopup.cs.meta | 11 + Editor/AddPopups/AddPopupValue.cs | 42 + Editor/AddPopups/AddPopupValue.cs.meta | 11 + Editor/AddPopups/IAddPopupValue.cs | 31 + Editor/AddPopups/IAddPopupValue.cs.meta | 11 + Editor/CustomEditors.meta | 8 + ...lackboardContainerComponentCustomEditor.cs | 34 + ...oardContainerComponentCustomEditor.cs.meta | 11 + .../BlackboardPropertyReferenceEditor.cs | 147 ++ .../BlackboardPropertyReferenceEditor.cs.meta | 3 + .../GeneratingValueSerializedTableEditor.cs | 114 ++ ...neratingValueSerializedTableEditor.cs.meta | 11 + .../SerializedTablesContainerEditor.cs | 122 ++ .../SerializedTablesContainerEditor.cs.meta | 11 + .../SerializedValueSerializedTableEditor.cs | 134 ++ ...rializedValueSerializedTableEditor.cs.meta | 11 + Editor/EditorTools.meta | 8 + Editor/EditorTools/BlackboardEditor.cs | 139 ++ Editor/EditorTools/BlackboardEditor.cs.meta | 11 + .../BlackboardEditorToolsCollection.cs | 106 ++ .../BlackboardEditorToolsCollection.cs.meta | 11 + Editor/EditorTools/BlackboardTableEditor.cs | 100 ++ .../EditorTools/BlackboardTableEditor.cs.meta | 11 + .../EditorTools/BlackboardTableEditor_Base.cs | 31 + .../BlackboardTableEditor_Base.cs.meta | 11 + .../EditorTools/ClassBlackboardTableEditor.cs | 29 + .../ClassBlackboardTableEditor.cs.meta | 11 + .../SerializedTableTypesCollection.cs | 89 ++ .../SerializedTableTypesCollection.cs.meta | 11 + .../StructBlackboardTableEditor.cs | 29 + .../StructBlackboardTableEditor.cs.meta | 11 + Editor/Helpers.meta | 8 + Editor/Helpers/SerializedPropertyHelper.cs | 28 + .../Helpers/SerializedPropertyHelper.cs.meta | 11 + Editor/ValueViews.meta | 8 + Editor/ValueViews/BlackboardValueView.cs | 30 + Editor/ValueViews/BlackboardValueView.cs.meta | 11 + Editor/ValueViews/IBlackboardValueView.cs | 19 + .../ValueViews/IBlackboardValueView.cs.meta | 11 + Editor/ValueViews/Implementations.meta | 8 + .../AnimationCurveBlackboardValueView.cs | 22 + .../AnimationCurveBlackboardValueView.cs.meta | 11 + .../BoolBlackboardValueView.cs | 16 + .../BoolBlackboardValueView.cs.meta | 11 + .../BoundsBlackboardValueView.cs | 17 + .../BoundsBlackboardValueView.cs.meta | 11 + .../BoundsIntBlackboardValueView.cs | 17 + .../BoundsIntBlackboardValueView.cs.meta | 11 + .../ByteBlackboardValueView.cs | 17 + .../ByteBlackboardValueView.cs.meta | 11 + .../CharBlackboardValueView.cs | 17 + .../CharBlackboardValueView.cs.meta | 11 + .../ColorBlackboardValueView.cs | 17 + .../ColorBlackboardValueView.cs.meta | 11 + .../ComponentBlackboardValueView.cs | 12 + .../ComponentBlackboardValueView.cs.meta | 11 + .../DoubleBlackboardValueView.cs | 16 + .../DoubleBlackboardValueView.cs.meta | 11 + .../FloatBlackboardValueView.cs | 16 + .../FloatBlackboardValueView.cs.meta | 11 + .../GameObjectBlackboardValueView.cs | 12 + .../GameObjectBlackboardValueView.cs.meta | 11 + .../GradientBlackboardValueView.cs | 17 + .../GradientBlackboardValueView.cs.meta | 11 + .../Implementations/IntBlackboardValueView.cs | 16 + .../IntBlackboardValueView.cs.meta | 11 + .../LayerMaskBlackboardValueView.cs | 18 + .../LayerMaskBlackboardValueView.cs.meta | 11 + .../LongBlackboardValueView.cs | 16 + .../LongBlackboardValueView.cs.meta | 11 + .../MaterialBlackboardValueView.cs | 12 + .../MaterialBlackboardValueView.cs.meta | 11 + .../Matrix4x4BlackboardValueView.cs | 43 + .../Matrix4x4BlackboardValueView.cs.meta | 11 + .../ObjectBlackboardValueView.cs | 12 + .../ObjectBlackboardValueView.cs.meta | 11 + .../PropertyNameBlackboardValueView.cs | 20 + .../PropertyNameBlackboardValueView.cs.meta | 11 + .../QuaternionBlackboardValueView.cs | 20 + .../QuaternionBlackboardValueView.cs.meta | 11 + .../RectBlackboardValueView.cs | 17 + .../RectBlackboardValueView.cs.meta | 11 + .../RectIntBlackboardValueView.cs | 17 + .../RectIntBlackboardValueView.cs.meta | 11 + .../SbyteBlackboardValueView.cs | 17 + .../SbyteBlackboardValueView.cs.meta | 11 + .../ShortBlackboardValueView.cs | 17 + .../ShortBlackboardValueView.cs.meta | 11 + .../SpriteBlackboardValueView.cs | 12 + .../SpriteBlackboardValueView.cs.meta | 11 + .../StringBlackboardValueView.cs | 16 + .../StringBlackboardValueView.cs.meta | 11 + .../TextureBlackboardValueView.cs | 12 + .../TextureBlackboardValueView.cs.meta | 11 + .../TransformBlackboardValueView.cs | 12 + .../TransformBlackboardValueView.cs.meta | 11 + .../UintBlackboardValueView.cs | 17 + .../UintBlackboardValueView.cs.meta | 11 + .../UlongBlackboardValueView.cs | 23 + .../UlongBlackboardValueView.cs.meta | 11 + .../UnityObjectBlackboardValueView.cs | 19 + .../UnityObjectBlackboardValueView.cs.meta | 11 + .../UshortBlackboardValueView.cs | 27 + .../UshortBlackboardValueView.cs.meta | 11 + .../Vector2BlackboardValueView.cs | 17 + .../Vector2BlackboardValueView.cs.meta | 11 + .../Vector2IntBlackboardValueView.cs | 17 + .../Vector2IntBlackboardValueView.cs.meta | 11 + .../Vector3BlackboardValueView.cs | 17 + .../Vector3BlackboardValueView.cs.meta | 11 + .../Vector3IntBlackboardValueView.cs | 17 + .../Vector3IntBlackboardValueView.cs.meta | 11 + .../Vector4BlackboardValueView.cs | 17 + .../Vector4BlackboardValueView.cs.meta | 11 + Editor/Zor.SimpleBlackboard.Editor.asmdef | 16 + .../Zor.SimpleBlackboard.Editor.asmdef.meta | 7 + LICENSE => LICENSE.md | 2 +- LICENSE.md.meta | 7 + README.md | 118 ++ README.md.meta | 7 + Runtime.meta | 8 + Runtime/AssemblyInfo.cs | 4 + Runtime/AssemblyInfo.cs.meta | 3 + Runtime/Components.meta | 8 + Runtime/Components/AccessorFlushers.meta | 3 + .../AccessorFlushers/AccessorFlusher.cs | 31 + .../AccessorFlushers/AccessorFlusher.cs.meta | 3 + .../CoroutineAccessorFlusher.cs | 51 + .../CoroutineAccessorFlusher.cs.meta | 3 + .../FixedUpdateAccessorFlusher.cs | 19 + .../FixedUpdateAccessorFlusher.cs.meta | 3 + .../LateUpdateAccessorFlusher.cs | 19 + .../LateUpdateAccessorFlusher.cs.meta | 3 + .../AccessorFlushers/UpdateAccessorFlusher.cs | 19 + .../UpdateAccessorFlusher.cs.meta | 3 + .../WaitForFixedUpdateAccessorFlusher.cs | 16 + .../WaitForFixedUpdateAccessorFlusher.cs.meta | 3 + .../WaitForNullAccessorFlusher.cs | 16 + .../WaitForNullAccessorFlusher.cs.meta | 3 + .../WaitForSecondsAccessorFlusher.cs | 20 + .../WaitForSecondsAccessorFlusher.cs.meta | 3 + Runtime/Components/Accessors.meta | 3 + Runtime/Components/Accessors/Accessor.cs | 33 + Runtime/Components/Accessors/Accessor.cs.meta | 3 + Runtime/Components/Accessors/Accessor_Base.cs | 40 + .../Accessors/Accessor_Base.cs.meta | 3 + .../Accessors/AnimationCurveAccessor.cs | 18 + .../Accessors/AnimationCurveAccessor.cs.meta | 3 + Runtime/Components/Accessors/BoolAccessor.cs | 17 + .../Components/Accessors/BoolAccessor.cs.meta | 3 + .../Components/Accessors/BoundsAccessor.cs | 17 + .../Accessors/BoundsAccessor.cs.meta | 3 + .../Components/Accessors/BoundsIntAccessor.cs | 17 + .../Accessors/BoundsIntAccessor.cs.meta | 3 + Runtime/Components/Accessors/ByteAccessor.cs | 17 + .../Components/Accessors/ByteAccessor.cs.meta | 3 + Runtime/Components/Accessors/CharAccessor.cs | 17 + .../Components/Accessors/CharAccessor.cs.meta | 3 + Runtime/Components/Accessors/ClassAccessor.cs | 22 + .../Accessors/ClassAccessor.cs.meta | 3 + Runtime/Components/Accessors/ColorAccessor.cs | 17 + .../Accessors/ColorAccessor.cs.meta | 3 + .../Components/Accessors/ComponentAccessor.cs | 17 + .../Accessors/ComponentAccessor.cs.meta | 3 + .../Components/Accessors/DoubleAccessor.cs | 17 + .../Accessors/DoubleAccessor.cs.meta | 3 + Runtime/Components/Accessors/FloatAccessor.cs | 17 + .../Accessors/FloatAccessor.cs.meta | 3 + .../Accessors/GameObjectAccessor.cs | 17 + .../Accessors/GameObjectAccessor.cs.meta | 3 + .../Components/Accessors/GradientAccessor.cs | 17 + .../Accessors/GradientAccessor.cs.meta | 3 + Runtime/Components/Accessors/IntAccessor.cs | 17 + .../Components/Accessors/IntAccessor.cs.meta | 3 + .../Components/Accessors/LayerMaskAccessor.cs | 17 + .../Accessors/LayerMaskAccessor.cs.meta | 3 + Runtime/Components/Accessors/LongAccessor.cs | 17 + .../Components/Accessors/LongAccessor.cs.meta | 3 + .../Components/Accessors/MaterialAccessor.cs | 17 + .../Accessors/MaterialAccessor.cs.meta | 3 + .../Components/Accessors/Matrix4x4Accessor.cs | 17 + .../Accessors/Matrix4x4Accessor.cs.meta | 3 + .../Components/Accessors/ObjectAccessor.cs | 18 + .../Accessors/ObjectAccessor.cs.meta | 3 + .../Accessors/PropertyNameAccessor.cs | 17 + .../Accessors/PropertyNameAccessor.cs.meta | 3 + .../Accessors/QuaternionAccessor.cs | 17 + .../Accessors/QuaternionAccessor.cs.meta | 3 + Runtime/Components/Accessors/RectAccessor.cs | 17 + .../Components/Accessors/RectAccessor.cs.meta | 3 + .../Components/Accessors/RectIntAccessor.cs | 17 + .../Accessors/RectIntAccessor.cs.meta | 3 + Runtime/Components/Accessors/SbyteAccessor.cs | 17 + .../Accessors/SbyteAccessor.cs.meta | 3 + Runtime/Components/Accessors/ShortAccessor.cs | 17 + .../Accessors/ShortAccessor.cs.meta | 3 + .../Components/Accessors/SpriteAccessor.cs | 17 + .../Accessors/SpriteAccessor.cs.meta | 3 + .../Components/Accessors/StringAccessor.cs | 17 + .../Accessors/StringAccessor.cs.meta | 3 + .../Components/Accessors/StructAccessor.cs | 22 + .../Accessors/StructAccessor.cs.meta | 3 + .../Components/Accessors/TextureAccessor.cs | 17 + .../Accessors/TextureAccessor.cs.meta | 3 + .../Components/Accessors/TransformAccessor.cs | 17 + .../Accessors/TransformAccessor.cs.meta | 3 + Runtime/Components/Accessors/UintAccessor.cs | 17 + .../Components/Accessors/UintAccessor.cs.meta | 3 + Runtime/Components/Accessors/UlongAccessor.cs | 17 + .../Accessors/UlongAccessor.cs.meta | 3 + .../Components/Accessors/UshortAccessor.cs | 17 + .../Accessors/UshortAccessor.cs.meta | 3 + .../Components/Accessors/Vector2Accessor.cs | 17 + .../Accessors/Vector2Accessor.cs.meta | 3 + .../Accessors/Vector2IntAccessor.cs | 17 + .../Accessors/Vector2IntAccessor.cs.meta | 3 + .../Components/Accessors/Vector3Accessor.cs | 17 + .../Accessors/Vector3Accessor.cs.meta | 3 + .../Accessors/Vector3IntAccessor.cs | 17 + .../Accessors/Vector3IntAccessor.cs.meta | 3 + .../Components/Accessors/Vector4Accessor.cs | 17 + .../Accessors/Vector4Accessor.cs.meta | 3 + Runtime/Components/AddComponentConstants.cs | 11 + .../Components/AddComponentConstants.cs.meta | 3 + Runtime/Components/BlackboardContainer.cs | 50 + .../Components/BlackboardContainer.cs.meta | 11 + .../Components/BlackboardPropertyReference.cs | 22 + .../BlackboardPropertyReference.cs.meta | 3 + Runtime/Core.meta | 8 + Runtime/Core/Blackboard.cs | 1005 ++++++++++++++ Runtime/Core/Blackboard.cs.meta | 11 + Runtime/Core/BlackboardPropertyName.cs | 101 ++ Runtime/Core/BlackboardPropertyName.cs.meta | 11 + Runtime/Core/BlackboardTable.cs | 132 ++ Runtime/Core/BlackboardTable.cs.meta | 3 + Runtime/Core/IBlackboardTable.cs | 63 + Runtime/Core/IBlackboardTable.cs.meta | 3 + Runtime/Debug.meta | 3 + Runtime/Debug/BlackboardDebug.cs | 54 + Runtime/Debug/BlackboardDebug.cs.meta | 3 + Runtime/Helpers.meta | 8 + Runtime/Helpers/ListHelper.cs | 36 + Runtime/Helpers/ListHelper.cs.meta | 11 + Runtime/Serialization.meta | 8 + Runtime/Serialization/SerializedContainer.cs | 31 + .../Serialization/SerializedContainer.cs.meta | 11 + Runtime/Serialization/SerializedTables.meta | 8 + .../ClassGeneratedValueSerializedTable.cs | 52 + ...ClassGeneratedValueSerializedTable.cs.meta | 3 + .../ClassSerializedValueSerializedTable.cs | 47 + ...lassSerializedValueSerializedTable.cs.meta | 3 + .../GeneratedValueSerializedTable_Base.cs | 13 + ...GeneratedValueSerializedTable_Base.cs.meta | 11 + .../SerializedTables/Implementations.meta | 8 + .../AnimationCurveSerializedTable.cs | 10 + .../AnimationCurveSerializedTable.cs.meta | 11 + .../Implementations/BoolSerializedTable.cs | 8 + .../BoolSerializedTable.cs.meta | 11 + .../BoundsIntSerializedTable.cs | 10 + .../BoundsIntSerializedTable.cs.meta | 11 + .../Implementations/BoundsSerializedTable.cs | 10 + .../BoundsSerializedTable.cs.meta | 11 + .../Implementations/ByteSerializedTable.cs | 8 + .../ByteSerializedTable.cs.meta | 11 + .../Implementations/CharSerializedTable.cs | 8 + .../CharSerializedTable.cs.meta | 11 + .../Implementations/ColorSerializedTable.cs | 10 + .../ColorSerializedTable.cs.meta | 11 + .../ComponentSerializedTable.cs | 10 + .../ComponentSerializedTable.cs.meta | 11 + .../Implementations/DoubleSerializedTable.cs | 8 + .../DoubleSerializedTable.cs.meta | 11 + .../Implementations/FloatSerializedTable.cs | 8 + .../FloatSerializedTable.cs.meta | 11 + .../GameObjectSerializedTable.cs | 10 + .../GameObjectSerializedTable.cs.meta | 11 + .../GradientSerializedTable.cs | 10 + .../GradientSerializedTable.cs.meta | 11 + .../Implementations/IntSerializedTable.cs | 8 + .../IntSerializedTable.cs.meta | 11 + .../LayerMaskSerializedTable.cs | 10 + .../LayerMaskSerializedTable.cs.meta | 11 + .../Implementations/LongSerializedTable.cs | 8 + .../LongSerializedTable.cs.meta | 11 + .../MaterialSerializedTable.cs | 10 + .../MaterialSerializedTable.cs.meta | 11 + .../Matrix4x4SerializedTable.cs | 10 + .../Matrix4x4SerializedTable.cs.meta | 11 + .../Implementations/ObjectSerializedTable.cs | 10 + .../ObjectSerializedTable.cs.meta | 11 + .../PropertyNameSerializedTable.cs | 10 + .../PropertyNameSerializedTable.cs.meta | 11 + .../QuaternionSerializedTable.cs | 10 + .../QuaternionSerializedTable.cs.meta | 11 + .../Implementations/RectIntSerializedTable.cs | 10 + .../RectIntSerializedTable.cs.meta | 11 + .../Implementations/RectSerializedTable.cs | 10 + .../RectSerializedTable.cs.meta | 11 + .../Implementations/SbyteSerializedTable.cs | 8 + .../SbyteSerializedTable.cs.meta | 11 + .../Implementations/ShortSerializedTable.cs | 8 + .../ShortSerializedTable.cs.meta | 11 + .../Implementations/SpriteSerializedTable.cs | 10 + .../SpriteSerializedTable.cs.meta | 11 + .../Implementations/StringSerializedTable.cs | 8 + .../StringSerializedTable.cs.meta | 11 + .../Implementations/TextureSerializedTable.cs | 10 + .../TextureSerializedTable.cs.meta | 11 + .../TransformSerializedTable.cs | 10 + .../TransformSerializedTable.cs.meta | 11 + .../Implementations/UintSerializedTable.cs | 8 + .../UintSerializedTable.cs.meta | 11 + .../Implementations/UlongSerializedTable.cs | 8 + .../UlongSerializedTable.cs.meta | 11 + .../Implementations/UshortSerializedTable.cs | 8 + .../UshortSerializedTable.cs.meta | 11 + .../Vector2IntSerializedTable.cs | 10 + .../Vector2IntSerializedTable.cs.meta | 11 + .../Implementations/Vector2SerializedTable.cs | 10 + .../Vector2SerializedTable.cs.meta | 11 + .../Vector3IntSerializedTable.cs | 10 + .../Vector3IntSerializedTable.cs.meta | 11 + .../Implementations/Vector3SerializedTable.cs | 10 + .../Vector3SerializedTable.cs.meta | 11 + .../Implementations/Vector4SerializedTable.cs | 10 + .../Vector4SerializedTable.cs.meta | 11 + .../SerializedTables/SerializedTable_Base.cs | 36 + .../SerializedTable_Base.cs.meta | 11 + .../SerializedValueSerializedTable_Base.cs | 13 + ...erializedValueSerializedTable_Base.cs.meta | 11 + .../StructGeneratedValueSerializedTable.cs | 52 + ...tructGeneratedValueSerializedTable.cs.meta | 3 + .../StructSerializedValueSerializedTable.cs | 47 + ...ructSerializedValueSerializedTable.cs.meta | 3 + .../SerializedTablesContainer.cs | 52 + .../SerializedTablesContainer.cs.meta | 11 + Runtime/Zor.SimpleBlackboard.asmdef | 3 + Runtime/Zor.SimpleBlackboard.asmdef.meta | 7 + Tests.meta | 8 + Tests/Runtime.meta | 8 + Tests/Runtime/BlackboardProfiling.cs | 100 ++ Tests/Runtime/BlackboardProfiling.cs.meta | 3 + Tests/Runtime/BlackboardTests.cs | 1201 +++++++++++++++++ Tests/Runtime/BlackboardTests.cs.meta | 11 + .../Runtime/Zor.SimpleBlackboard.Tests.asmdef | 16 + .../Zor.SimpleBlackboard.Tests.asmdef.meta | 7 + package.json | 18 + package.json.meta | 7 + 353 files changed, 7981 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md create mode 100644 CHANGELOG.md.meta create mode 100644 Editor.meta create mode 100644 Editor/AddPopups.meta create mode 100644 Editor/AddPopups/AddPopup.cs create mode 100644 Editor/AddPopups/AddPopup.cs.meta create mode 100644 Editor/AddPopups/AddPopupValue.cs create mode 100644 Editor/AddPopups/AddPopupValue.cs.meta create mode 100644 Editor/AddPopups/IAddPopupValue.cs create mode 100644 Editor/AddPopups/IAddPopupValue.cs.meta create mode 100644 Editor/CustomEditors.meta create mode 100644 Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs create mode 100644 Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs.meta create mode 100644 Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs create mode 100644 Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs.meta create mode 100644 Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs create mode 100644 Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs.meta create mode 100644 Editor/CustomEditors/SerializedTablesContainerEditor.cs create mode 100644 Editor/CustomEditors/SerializedTablesContainerEditor.cs.meta create mode 100644 Editor/CustomEditors/SerializedValueSerializedTableEditor.cs create mode 100644 Editor/CustomEditors/SerializedValueSerializedTableEditor.cs.meta create mode 100644 Editor/EditorTools.meta create mode 100644 Editor/EditorTools/BlackboardEditor.cs create mode 100644 Editor/EditorTools/BlackboardEditor.cs.meta create mode 100644 Editor/EditorTools/BlackboardEditorToolsCollection.cs create mode 100644 Editor/EditorTools/BlackboardEditorToolsCollection.cs.meta create mode 100644 Editor/EditorTools/BlackboardTableEditor.cs create mode 100644 Editor/EditorTools/BlackboardTableEditor.cs.meta create mode 100644 Editor/EditorTools/BlackboardTableEditor_Base.cs create mode 100644 Editor/EditorTools/BlackboardTableEditor_Base.cs.meta create mode 100644 Editor/EditorTools/ClassBlackboardTableEditor.cs create mode 100644 Editor/EditorTools/ClassBlackboardTableEditor.cs.meta create mode 100644 Editor/EditorTools/SerializedTableTypesCollection.cs create mode 100644 Editor/EditorTools/SerializedTableTypesCollection.cs.meta create mode 100644 Editor/EditorTools/StructBlackboardTableEditor.cs create mode 100644 Editor/EditorTools/StructBlackboardTableEditor.cs.meta create mode 100644 Editor/Helpers.meta create mode 100644 Editor/Helpers/SerializedPropertyHelper.cs create mode 100644 Editor/Helpers/SerializedPropertyHelper.cs.meta create mode 100644 Editor/ValueViews.meta create mode 100644 Editor/ValueViews/BlackboardValueView.cs create mode 100644 Editor/ValueViews/BlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/IBlackboardValueView.cs create mode 100644 Editor/ValueViews/IBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations.meta create mode 100644 Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/BoolBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/BoolBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/ByteBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/ByteBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/CharBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/CharBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/ColorBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/ColorBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/FloatBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/FloatBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/GradientBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/GradientBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/IntBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/IntBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/LongBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/LongBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/RectBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/RectBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/ShortBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/ShortBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/StringBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/StringBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/TextureBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/TextureBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/TransformBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/TransformBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/UintBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/UintBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/UlongBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/UlongBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/UshortBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/UshortBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs.meta create mode 100644 Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs create mode 100644 Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs.meta create mode 100644 Editor/Zor.SimpleBlackboard.Editor.asmdef create mode 100644 Editor/Zor.SimpleBlackboard.Editor.asmdef.meta rename LICENSE => LICENSE.md (91%) create mode 100644 LICENSE.md.meta create mode 100644 README.md create mode 100644 README.md.meta create mode 100644 Runtime.meta create mode 100644 Runtime/AssemblyInfo.cs create mode 100644 Runtime/AssemblyInfo.cs.meta create mode 100644 Runtime/Components.meta create mode 100644 Runtime/Components/AccessorFlushers.meta create mode 100644 Runtime/Components/AccessorFlushers/AccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/AccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs.meta create mode 100644 Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs create mode 100644 Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs.meta create mode 100644 Runtime/Components/Accessors.meta create mode 100644 Runtime/Components/Accessors/Accessor.cs create mode 100644 Runtime/Components/Accessors/Accessor.cs.meta create mode 100644 Runtime/Components/Accessors/Accessor_Base.cs create mode 100644 Runtime/Components/Accessors/Accessor_Base.cs.meta create mode 100644 Runtime/Components/Accessors/AnimationCurveAccessor.cs create mode 100644 Runtime/Components/Accessors/AnimationCurveAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/BoolAccessor.cs create mode 100644 Runtime/Components/Accessors/BoolAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/BoundsAccessor.cs create mode 100644 Runtime/Components/Accessors/BoundsAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/BoundsIntAccessor.cs create mode 100644 Runtime/Components/Accessors/BoundsIntAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/ByteAccessor.cs create mode 100644 Runtime/Components/Accessors/ByteAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/CharAccessor.cs create mode 100644 Runtime/Components/Accessors/CharAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/ClassAccessor.cs create mode 100644 Runtime/Components/Accessors/ClassAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/ColorAccessor.cs create mode 100644 Runtime/Components/Accessors/ColorAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/ComponentAccessor.cs create mode 100644 Runtime/Components/Accessors/ComponentAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/DoubleAccessor.cs create mode 100644 Runtime/Components/Accessors/DoubleAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/FloatAccessor.cs create mode 100644 Runtime/Components/Accessors/FloatAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/GameObjectAccessor.cs create mode 100644 Runtime/Components/Accessors/GameObjectAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/GradientAccessor.cs create mode 100644 Runtime/Components/Accessors/GradientAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/IntAccessor.cs create mode 100644 Runtime/Components/Accessors/IntAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/LayerMaskAccessor.cs create mode 100644 Runtime/Components/Accessors/LayerMaskAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/LongAccessor.cs create mode 100644 Runtime/Components/Accessors/LongAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/MaterialAccessor.cs create mode 100644 Runtime/Components/Accessors/MaterialAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/Matrix4x4Accessor.cs create mode 100644 Runtime/Components/Accessors/Matrix4x4Accessor.cs.meta create mode 100644 Runtime/Components/Accessors/ObjectAccessor.cs create mode 100644 Runtime/Components/Accessors/ObjectAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/PropertyNameAccessor.cs create mode 100644 Runtime/Components/Accessors/PropertyNameAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/QuaternionAccessor.cs create mode 100644 Runtime/Components/Accessors/QuaternionAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/RectAccessor.cs create mode 100644 Runtime/Components/Accessors/RectAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/RectIntAccessor.cs create mode 100644 Runtime/Components/Accessors/RectIntAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/SbyteAccessor.cs create mode 100644 Runtime/Components/Accessors/SbyteAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/ShortAccessor.cs create mode 100644 Runtime/Components/Accessors/ShortAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/SpriteAccessor.cs create mode 100644 Runtime/Components/Accessors/SpriteAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/StringAccessor.cs create mode 100644 Runtime/Components/Accessors/StringAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/StructAccessor.cs create mode 100644 Runtime/Components/Accessors/StructAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/TextureAccessor.cs create mode 100644 Runtime/Components/Accessors/TextureAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/TransformAccessor.cs create mode 100644 Runtime/Components/Accessors/TransformAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/UintAccessor.cs create mode 100644 Runtime/Components/Accessors/UintAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/UlongAccessor.cs create mode 100644 Runtime/Components/Accessors/UlongAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/UshortAccessor.cs create mode 100644 Runtime/Components/Accessors/UshortAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/Vector2Accessor.cs create mode 100644 Runtime/Components/Accessors/Vector2Accessor.cs.meta create mode 100644 Runtime/Components/Accessors/Vector2IntAccessor.cs create mode 100644 Runtime/Components/Accessors/Vector2IntAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/Vector3Accessor.cs create mode 100644 Runtime/Components/Accessors/Vector3Accessor.cs.meta create mode 100644 Runtime/Components/Accessors/Vector3IntAccessor.cs create mode 100644 Runtime/Components/Accessors/Vector3IntAccessor.cs.meta create mode 100644 Runtime/Components/Accessors/Vector4Accessor.cs create mode 100644 Runtime/Components/Accessors/Vector4Accessor.cs.meta create mode 100644 Runtime/Components/AddComponentConstants.cs create mode 100644 Runtime/Components/AddComponentConstants.cs.meta create mode 100644 Runtime/Components/BlackboardContainer.cs create mode 100644 Runtime/Components/BlackboardContainer.cs.meta create mode 100644 Runtime/Components/BlackboardPropertyReference.cs create mode 100644 Runtime/Components/BlackboardPropertyReference.cs.meta create mode 100644 Runtime/Core.meta create mode 100644 Runtime/Core/Blackboard.cs create mode 100644 Runtime/Core/Blackboard.cs.meta create mode 100644 Runtime/Core/BlackboardPropertyName.cs create mode 100644 Runtime/Core/BlackboardPropertyName.cs.meta create mode 100644 Runtime/Core/BlackboardTable.cs create mode 100644 Runtime/Core/BlackboardTable.cs.meta create mode 100644 Runtime/Core/IBlackboardTable.cs create mode 100644 Runtime/Core/IBlackboardTable.cs.meta create mode 100644 Runtime/Debug.meta create mode 100644 Runtime/Debug/BlackboardDebug.cs create mode 100644 Runtime/Debug/BlackboardDebug.cs.meta create mode 100644 Runtime/Helpers.meta create mode 100644 Runtime/Helpers/ListHelper.cs create mode 100644 Runtime/Helpers/ListHelper.cs.meta create mode 100644 Runtime/Serialization.meta create mode 100644 Runtime/Serialization/SerializedContainer.cs create mode 100644 Runtime/Serialization/SerializedContainer.cs.meta create mode 100644 Runtime/Serialization/SerializedTables.meta create mode 100644 Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs create mode 100644 Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/SerializedTable_Base.cs create mode 100644 Runtime/Serialization/SerializedTables/SerializedTable_Base.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs create mode 100644 Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs create mode 100644 Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs.meta create mode 100644 Runtime/Serialization/SerializedTablesContainer.cs create mode 100644 Runtime/Serialization/SerializedTablesContainer.cs.meta create mode 100644 Runtime/Zor.SimpleBlackboard.asmdef create mode 100644 Runtime/Zor.SimpleBlackboard.asmdef.meta create mode 100644 Tests.meta create mode 100644 Tests/Runtime.meta create mode 100644 Tests/Runtime/BlackboardProfiling.cs create mode 100644 Tests/Runtime/BlackboardProfiling.cs.meta create mode 100644 Tests/Runtime/BlackboardTests.cs create mode 100644 Tests/Runtime/BlackboardTests.cs.meta create mode 100644 Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef create mode 100644 Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef.meta create mode 100644 package.json create mode 100644 package.json.meta diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1751681 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +All notable changes to this package will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0] - 2020-07-15 + +### Added + +- Blackboard and other core functionality. +- Blackboard serialization. +- Unity components support. +- Unity editor support. +- Tests. + +[unreleased]: https://github.com/ZorPastaman/Simple-Blackboard/compare/v1.0.0...HEAD +[1.0.0]: https://github.com/ZorPastaman/Simple-Blackboard/releases/tag/v1.0.0 diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 0000000..4b50549 --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 18c5568f872809246a8b3b4b4b0dba17 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor.meta b/Editor.meta new file mode 100644 index 0000000..ca91afe --- /dev/null +++ b/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7118688bb48e744a93987fe1692851d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/AddPopups.meta b/Editor/AddPopups.meta new file mode 100644 index 0000000..bb9af28 --- /dev/null +++ b/Editor/AddPopups.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d9a9c856b4a13b34ca820c2e86e1230e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/AddPopups/AddPopup.cs b/Editor/AddPopups/AddPopup.cs new file mode 100644 index 0000000..a61eb1e --- /dev/null +++ b/Editor/AddPopups/AddPopup.cs @@ -0,0 +1,76 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.BlackboardTableEditors +{ + /// + /// Popup used for adding new properties to in the editor. + /// + internal sealed class AddPopup : EditorWindow + { + private GUIContent m_closeButtonIcon; + private GUILayoutOption[] m_closeButtonOptions; + + private Blackboard m_blackboard; + private string m_key; + private IAddPopupValue m_addPopupValue; + + private Vector2 m_scrollPos; + + /// + /// Sets necessary parameters to . Call this before first . + /// + /// New property is added to this. + /// Initial key. It can be changed in . + /// Value wrapper. + /// Position of the popup in the editor space. + public void Setup(Blackboard blackboard, string key, IAddPopupValue addPopupValue, Vector2 popupPosition) + { + m_blackboard = blackboard; + m_key = key; + m_addPopupValue = addPopupValue; + var size = new Vector2(450f, EditorGUIUtility.singleLineHeight * 8f + + EditorGUIUtility.standardVerticalSpacing * 6f); + + ShowAsDropDown(new Rect(popupPosition, size), size); + } + + private void OnEnable() + { + m_closeButtonIcon = EditorGUIUtility.IconContent("LookDevClose"); + m_closeButtonOptions = new[] { GUILayout.Width(32f) }; + } + + private void OnGUI() + { + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.LabelField(m_addPopupValue.valueType.Name, EditorStyles.toolbarButton); + + if (GUILayout.Button(m_closeButtonIcon, EditorStyles.toolbarButton, m_closeButtonOptions)) + { + Close(); + return; + } + + EditorGUILayout.EndHorizontal(); + + m_key = EditorGUILayout.TextField("Key", m_key); + + m_scrollPos = EditorGUILayout.BeginScrollView(m_scrollPos); + + m_addPopupValue.DrawValue("Value"); + + EditorGUILayout.EndScrollView(); + + if (GUILayout.Button("OK")) + { + m_addPopupValue.Set(m_key, m_blackboard); + Close(); + } + } + } +} diff --git a/Editor/AddPopups/AddPopup.cs.meta b/Editor/AddPopups/AddPopup.cs.meta new file mode 100644 index 0000000..a5b3436 --- /dev/null +++ b/Editor/AddPopups/AddPopup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5389a4a3485cf35459bf7efcee410ce9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/AddPopups/AddPopupValue.cs b/Editor/AddPopups/AddPopupValue.cs new file mode 100644 index 0000000..b4367a0 --- /dev/null +++ b/Editor/AddPopups/AddPopupValue.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using Zor.SimpleBlackboard.BlackboardValueViews; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.BlackboardTableEditors +{ + /// + /// Value wrapper used in . + /// + /// Value type. + internal sealed class AddPopupValue : IAddPopupValue + { + private readonly BlackboardValueView m_valueView; + private T m_value; + + /// + /// Creates a wrapper over . + /// + /// Value view of used in this wrapper. + public AddPopupValue(BlackboardValueView valueView) + { + m_valueView = valueView; + } + + /// + public Type valueType => typeof(T); + + /// + public void DrawValue(string label) + { + m_value = m_valueView.DrawValue(label, m_value); + } + + /// + public void Set(string key, Blackboard blackboard) + { + blackboard.SetObjectValue(typeof(T), new BlackboardPropertyName(key), m_value); + } + } +} diff --git a/Editor/AddPopups/AddPopupValue.cs.meta b/Editor/AddPopups/AddPopupValue.cs.meta new file mode 100644 index 0000000..b42f669 --- /dev/null +++ b/Editor/AddPopups/AddPopupValue.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1454c656d6e67ac4db0b903e3ec8fbaa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/AddPopups/IAddPopupValue.cs b/Editor/AddPopups/IAddPopupValue.cs new file mode 100644 index 0000000..40a6663 --- /dev/null +++ b/Editor/AddPopups/IAddPopupValue.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.BlackboardTableEditors +{ + /// + /// Interface for a value wrapper used in . + /// + internal interface IAddPopupValue + { + /// + /// Type of the value. + /// + Type valueType { get; } + + /// + /// Draws an editor for the value. + /// + /// Property label. + void DrawValue(string label); + + /// + /// Sets the current value into using as a property name. + /// + /// Property name. + /// Sets current value into this. + void Set(string key, Blackboard blackboard); + } +} diff --git a/Editor/AddPopups/IAddPopupValue.cs.meta b/Editor/AddPopups/IAddPopupValue.cs.meta new file mode 100644 index 0000000..de77a92 --- /dev/null +++ b/Editor/AddPopups/IAddPopupValue.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: daedc2dcbe7296f4691f2286c5bd1b9c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CustomEditors.meta b/Editor/CustomEditors.meta new file mode 100644 index 0000000..ee24b02 --- /dev/null +++ b/Editor/CustomEditors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dfcf19b34948e3b40beb41d1d3a8ea81 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs b/Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs new file mode 100644 index 0000000..0bcd465 --- /dev/null +++ b/Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEditor; +using Zor.SimpleBlackboard.EditorTools; + +namespace Zor.SimpleBlackboard.Components +{ + [CustomEditor(typeof(BlackboardContainer))] + public sealed class BlackboardContainerComponentCustomEditor : Editor + { + private bool m_constantRepaint; + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + if (!EditorApplication.isPlaying) + { + return; + } + + EditorGUILayout.Separator(); + m_constantRepaint = EditorGUILayout.Toggle("Require Constant Repaint", m_constantRepaint); + + var blackboardContainer = (BlackboardContainer)target; + BlackboardEditor.DrawBlackboard(blackboardContainer.blackboard); + } + + public override bool RequiresConstantRepaint() + { + return m_constantRepaint; + } + } +} diff --git a/Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs.meta b/Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs.meta new file mode 100644 index 0000000..bcea19f --- /dev/null +++ b/Editor/CustomEditors/BlackboardContainerComponentCustomEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aaeb70078cf571f4ab0892029cb1c263 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs b/Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs new file mode 100644 index 0000000..4d54ef1 --- /dev/null +++ b/Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs @@ -0,0 +1,147 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.Serialization; +using Object = UnityEngine.Object; + +namespace Zor.SimpleBlackboard.Components +{ + [CustomPropertyDrawer(typeof(BlackboardPropertyReference))] + public sealed class BlackboardPropertyReferenceEditor : PropertyDrawer + { +private const string BlackboardContainerPropertyName = "blackboardContainer"; + private const string PropertyNamePropertyName = "propertyName"; + + private const string SerializedContainersPropertyName = "m_SerializedContainers"; + + private static readonly GenericMenu.MenuFunction2 s_onMenuItem = OnMenuItem; + + private static readonly List<(string, Type)> s_propertyKeysCache = new List<(string, Type)>(); + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + float height = EditorGUI.GetPropertyHeight(property, false); + + if (property.isExpanded) + { + SerializedProperty blackboardContainerProperty = + property.FindPropertyRelative(BlackboardContainerPropertyName); + SerializedProperty propertyNameProperty = property.FindPropertyRelative(PropertyNamePropertyName); + + height += EditorGUI.GetPropertyHeight(blackboardContainerProperty) + + EditorGUI.GetPropertyHeight(propertyNameProperty) + 2f * EditorGUIUtility.standardVerticalSpacing; + } + + return height; + } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + position.height = EditorGUI.GetPropertyHeight(property, false); + EditorGUI.PropertyField(position, property, false); + + if (!property.isExpanded) + { + return; + } + + ++EditorGUI.indentLevel; + + SerializedProperty blackboardContainerProperty = + property.FindPropertyRelative(BlackboardContainerPropertyName); + SerializedProperty propertyNameProperty = property.FindPropertyRelative(PropertyNamePropertyName); + Object blackboardContainer = blackboardContainerProperty.objectReferenceValue; + SerializedProperty serializedContainersProperty = blackboardContainer == null + ? null + : new SerializedObject(blackboardContainer).FindProperty(SerializedContainersPropertyName); + + position.y += position.height + EditorGUIUtility.standardVerticalSpacing; + position.height = EditorGUI.GetPropertyHeight(blackboardContainerProperty); + EditorGUI.PropertyField(position, blackboardContainerProperty, true); + + position.y += position.height + EditorGUIUtility.standardVerticalSpacing; + position.height = EditorGUI.GetPropertyHeight(propertyNameProperty); + position.width -= position.height; + EditorGUI.PropertyField(position, propertyNameProperty, true); + + position.x += position.width; + position.width = position.height; + + bool wasEnabled = GUI.enabled; + GUI.enabled = blackboardContainerProperty.objectReferenceValue != null; + if (EditorGUI.DropdownButton(position, GUIContent.none, FocusType.Keyboard)) + { + try + { + FillPropertyNamesCache(serializedContainersProperty); + CreateGenericMenu(propertyNameProperty); + } + finally + { + s_propertyKeysCache.Clear(); + } + } + GUI.enabled = wasEnabled; + + --EditorGUI.indentLevel; + } + + private static void FillPropertyNamesCache(SerializedProperty serializedContainersProperty) + { + if (serializedContainersProperty == null) + { + return; + } + + for (int i = 0, count = serializedContainersProperty.arraySize; i < count; ++i) + { + SerializedProperty serializedContainerProperty = serializedContainersProperty.GetArrayElementAtIndex(i); + var serializedContainer = serializedContainerProperty.objectReferenceValue as SerializedContainer; + + if (serializedContainer == null) + { + continue; + } + + serializedContainer.GetKeys(s_propertyKeysCache); + } + } + + private static void CreateGenericMenu(SerializedProperty propertyNameProperty) + { + var menu = new GenericMenu(); + + for (int i = 0, count = s_propertyKeysCache.Count; i < count; ++i) + { + (string propertyKey, Type type) = s_propertyKeysCache[i]; + var menuItem = new MenuItem(propertyNameProperty, propertyKey); + menu.AddItem(new GUIContent($"{propertyKey} : {type.Name}"), + false, s_onMenuItem, menuItem); + } + + menu.ShowAsContext(); + } + + private static void OnMenuItem(object menuItemObject) + { + var menuItem = (MenuItem)menuItemObject; + menuItem.propertyNameProperty.stringValue = menuItem.propertyKeyValue; + menuItem.propertyNameProperty.serializedObject.ApplyModifiedProperties(); + } + + private readonly struct MenuItem + { + public readonly SerializedProperty propertyNameProperty; + public readonly string propertyKeyValue; + + public MenuItem(SerializedProperty propertyNameProperty, string propertyKeyValue) + { + this.propertyNameProperty = propertyNameProperty; + this.propertyKeyValue = propertyKeyValue; + } + } + } +} diff --git a/Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs.meta b/Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs.meta new file mode 100644 index 0000000..d6b0d2e --- /dev/null +++ b/Editor/CustomEditors/BlackboardPropertyReferenceEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b0011a483a3a42cfb4335ea4ce134073 +timeCreated: 1592154610 \ No newline at end of file diff --git a/Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs b/Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs new file mode 100644 index 0000000..06fef30 --- /dev/null +++ b/Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs @@ -0,0 +1,114 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; +using Zor.SimpleBlackboard.Debugging; + +namespace Zor.SimpleBlackboard.Serialization +{ + [CustomEditor(typeof(GeneratedValueSerializedTable_Base), true)] + public sealed class GeneratingValueSerializedTableEditor : Editor + { + private const string KeysPropertyName = "m_Keys"; + + private SerializedProperty m_keysProperty; + private ReorderableList m_list; + + private bool m_correctType; + + public override void OnInspectorGUI() + { + if (!m_correctType) + { + base.OnInspectorGUI(); + return; + } + + m_list.DoLayoutList(); + } + + private void OnEnable() + { + Type targetType = target.GetType(); + + if (!IsSubclassOfRightClass(targetType)) + { + BlackboardDebug.LogError($"{targetType.FullName} is derived from {typeof(GeneratedValueSerializedTable_Base).FullName}. Instead it should be derived from {typeof(StructGeneratedValueSerializedTable<>).FullName} or {typeof(ClassGeneratedValueSerializedTable<>).FullName}"); + return; + } + + m_correctType = true; + + m_keysProperty = serializedObject.FindProperty(KeysPropertyName); + + m_list = new ReorderableList(serializedObject, m_keysProperty, false, true, true, true) + { + drawHeaderCallback = OnDrawHeader, + elementHeightCallback = OnElementHeight, + drawElementCallback = OnDrawElement, + onAddCallback = OnAdd, + onRemoveCallback = OnRemove + }; + } + + private void OnDrawHeader(Rect rect) + { + EditorGUI.LabelField(rect, $"{((SerializedTable_Base)target).valueType.Name} ({m_keysProperty.arraySize})"); + } + + private float OnElementHeight(int index) + { + SerializedProperty key = m_keysProperty.GetArrayElementAtIndex(index); + + return EditorGUI.GetPropertyHeight(key, new GUIContent("Key"), true) + + EditorGUIUtility.standardVerticalSpacing * 2f; + } + + private void OnDrawElement(Rect rect, int index, bool isActive, bool isFocused) + { + SerializedProperty key = m_keysProperty.GetArrayElementAtIndex(index); + + rect.x += 10f; + rect.width -= 10f; + rect.height = EditorGUI.GetPropertyHeight(key, new GUIContent("Key"),true); + EditorGUI.PropertyField(rect, key, new GUIContent("Key"),true); + + serializedObject.ApplyModifiedProperties(); + } + + private void OnAdd(ReorderableList list) + { + m_keysProperty.arraySize++; + + serializedObject.ApplyModifiedProperties(); + } + + private void OnRemove(ReorderableList list) + { + int index = list.index; + SerializedPropertyHelper.CompletelyRemove(m_keysProperty, index); + + serializedObject.ApplyModifiedProperties(); + } + + private static bool IsSubclassOfRightClass(Type toCheck) + { + while (toCheck != null && toCheck != typeof(object)) + { + Type type = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck; + + if (typeof(StructGeneratedValueSerializedTable<>) == type || + typeof(ClassGeneratedValueSerializedTable<>) == type) + { + return true; + } + + toCheck = toCheck.BaseType; + } + + return false; + } + } +} diff --git a/Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs.meta b/Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs.meta new file mode 100644 index 0000000..758c891 --- /dev/null +++ b/Editor/CustomEditors/GeneratingValueSerializedTableEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0c584e32ab22c841b5740460bacb793 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CustomEditors/SerializedTablesContainerEditor.cs b/Editor/CustomEditors/SerializedTablesContainerEditor.cs new file mode 100644 index 0000000..110cca6 --- /dev/null +++ b/Editor/CustomEditors/SerializedTablesContainerEditor.cs @@ -0,0 +1,122 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.EditorTools; +using Object = UnityEngine.Object; + +namespace Zor.SimpleBlackboard.Serialization +{ + [CustomEditor(typeof(SerializedTablesContainer))] + public sealed class SerializedTablesContainerEditor : Editor + { + private const string SerializedTablesPropertyName = "m_SerializedTables"; + + private readonly Dictionary m_editors = new Dictionary(); + private readonly List m_tableTypes = new List(); + private readonly List m_valueTypes = new List(); + + private GenericMenu.MenuFunction2 m_addTable; + + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + SerializedProperty serializedTables = serializedObject.FindProperty(SerializedTablesPropertyName); + + for (int i = 0, count = serializedTables.arraySize; i < count; ++i) + { + SerializedProperty serializedTable = serializedTables.GetArrayElementAtIndex(i); + Object objectValue = serializedTable.objectReferenceValue; + + if (objectValue == null) + { + continue; + } + + if (!m_editors.TryGetValue(objectValue, out Editor editor)) + { + editor = CreateEditorWithContext(new[] {objectValue}, target); + m_editors.Add(objectValue, editor); + } + + EditorGUILayout.BeginVertical(GUI.skin.box); + + editor.OnInspectorGUI(); + + if (GUILayout.Button("Remove")) + { + DestroyImmediate(objectValue, true); + SerializedPropertyHelper.CompletelyRemove(serializedTables, i); + + i--; + count = serializedTables.arraySize; + + serializedObject.ApplyModifiedProperties(); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + + EditorGUILayout.EndVertical(); + } + + EditorGUILayout.Separator(); + + if (GUILayout.Button("Add")) + { + MakeAddTableDropdown(serializedTables); + } + } + + private void Awake() + { + m_addTable = AddTable; + } + + private void OnDestroy() + { + Dictionary.ValueCollection.Enumerator enumerator = m_editors.Values.GetEnumerator(); + + while (enumerator.MoveNext()) + { + DestroyImmediate(enumerator.Current); + } + + enumerator.Dispose(); + } + + private void MakeAddTableDropdown(SerializedProperty serializedTables) + { + m_tableTypes.Clear(); + m_valueTypes.Clear(); + SerializedTableTypesCollection.GetSerializedTableTypes(m_tableTypes, m_valueTypes, serializedTables); + + var menu = new GenericMenu(); + for (int i = 0, count = m_tableTypes.Count; i < count; ++i) + { + Type tableType = m_tableTypes[i]; + Type valueType = m_valueTypes[i]; + menu.AddItem(new GUIContent(valueType.Name), false, m_addTable, tableType); + } + menu.ShowAsContext(); + } + + private void AddTable(object obj) + { + var type = (Type)obj; + ScriptableObject instance = CreateInstance(type); + instance.name = type.Name; + + AssetDatabase.AddObjectToAsset(instance, target); + + SerializedProperty serializedTables = serializedObject.FindProperty(SerializedTablesPropertyName); + int index = serializedTables.arraySize++; + serializedTables.GetArrayElementAtIndex(index).objectReferenceValue = instance; + + serializedObject.ApplyModifiedProperties(); + AssetDatabase.SaveAssets(); + } + } +} diff --git a/Editor/CustomEditors/SerializedTablesContainerEditor.cs.meta b/Editor/CustomEditors/SerializedTablesContainerEditor.cs.meta new file mode 100644 index 0000000..4fe0941 --- /dev/null +++ b/Editor/CustomEditors/SerializedTablesContainerEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b376edb39d86abc4a8c18df4f0f37a58 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/CustomEditors/SerializedValueSerializedTableEditor.cs b/Editor/CustomEditors/SerializedValueSerializedTableEditor.cs new file mode 100644 index 0000000..92b09a4 --- /dev/null +++ b/Editor/CustomEditors/SerializedValueSerializedTableEditor.cs @@ -0,0 +1,134 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; +using Zor.SimpleBlackboard.Debugging; + +namespace Zor.SimpleBlackboard.Serialization +{ + [CustomEditor(typeof(SerializedValueSerializedTable_Base), true)] + public sealed class SerializedValueSerializedTableEditor : Editor + { + private const string KeysPropertyName = "m_Keys"; + private const string ValuesPropertyName = "m_Values"; + + private SerializedProperty m_keysProperty; + private SerializedProperty m_valuesProperty; + private ReorderableList m_list; + + private bool m_correctType; + + public override void OnInspectorGUI() + { + if (!m_correctType) + { + base.OnInspectorGUI(); + return; + } + + m_list.DoLayoutList(); + } + + private void OnEnable() + { + Type targetType = target.GetType(); + + if (!IsSubclassOfRightClass(targetType)) + { + BlackboardDebug.LogError($"{targetType.FullName} is derived from {typeof(SerializedValueSerializedTable_Base).FullName}. Instead it should be derived from {typeof(StructSerializedValueSerializedTable<>).FullName} or {typeof(ClassSerializedValueSerializedTable<>).FullName}"); + return; + } + + m_correctType = true; + + m_keysProperty = serializedObject.FindProperty(KeysPropertyName); + m_valuesProperty = serializedObject.FindProperty(ValuesPropertyName); + EnsureCapacity(); + + m_list = new ReorderableList(serializedObject, m_keysProperty, false, true, true, true) + { + drawHeaderCallback = OnDrawHeader, + elementHeightCallback = OnElementHeight, + drawElementCallback = OnDrawElement, + onAddCallback = OnAdd, + onRemoveCallback = OnRemove + }; + } + + private void OnDrawHeader(Rect rect) + { + EditorGUI.LabelField(rect, $"{((SerializedTable_Base)target).valueType.Name} ({m_keysProperty.arraySize})"); + } + + private float OnElementHeight(int index) + { + SerializedProperty key = m_keysProperty.GetArrayElementAtIndex(index); + SerializedProperty value = m_valuesProperty.GetArrayElementAtIndex(index); + + return EditorGUI.GetPropertyHeight(key, new GUIContent("Key"), true) + + EditorGUI.GetPropertyHeight(value, new GUIContent("Value"), true) + + EditorGUIUtility.standardVerticalSpacing * 2f; + } + + private void OnDrawElement(Rect rect, int index, bool isActive, bool isFocused) + { + SerializedProperty key = m_keysProperty.GetArrayElementAtIndex(index); + SerializedProperty value = m_valuesProperty.GetArrayElementAtIndex(index); + + rect.x += 10f; + rect.width -= 10f; + rect.height = EditorGUI.GetPropertyHeight(key, new GUIContent("Key"),true); + EditorGUI.PropertyField(rect, key, new GUIContent("Key"),true); + + rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing; + rect.height = EditorGUI.GetPropertyHeight(value, new GUIContent("Value"),true); + EditorGUI.PropertyField(rect, value, new GUIContent("Value"),true); + + serializedObject.ApplyModifiedProperties(); + } + + private void OnAdd(ReorderableList list) + { + m_keysProperty.arraySize++; + m_valuesProperty.arraySize++; + + serializedObject.ApplyModifiedProperties(); + } + + private void OnRemove(ReorderableList list) + { + int index = list.index; + SerializedPropertyHelper.CompletelyRemove(m_keysProperty, index); + SerializedPropertyHelper.CompletelyRemove(m_valuesProperty, index); + + serializedObject.ApplyModifiedProperties(); + } + + private void EnsureCapacity() + { + int capacity = Mathf.Min(m_keysProperty.arraySize, m_valuesProperty.arraySize); + m_keysProperty.arraySize = capacity; + m_valuesProperty.arraySize = capacity; + } + + private static bool IsSubclassOfRightClass(Type toCheck) + { + while (toCheck != null && toCheck != typeof(object)) + { + Type type = toCheck.IsGenericType ? toCheck.GetGenericTypeDefinition() : toCheck; + + if (typeof(StructSerializedValueSerializedTable<>) == type || + typeof(ClassSerializedValueSerializedTable<>) == type) + { + return true; + } + + toCheck = toCheck.BaseType; + } + + return false; + } + } +} diff --git a/Editor/CustomEditors/SerializedValueSerializedTableEditor.cs.meta b/Editor/CustomEditors/SerializedValueSerializedTableEditor.cs.meta new file mode 100644 index 0000000..7245ba4 --- /dev/null +++ b/Editor/CustomEditors/SerializedValueSerializedTableEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ff173ce07a99cf45845fbfb4c57d4a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools.meta b/Editor/EditorTools.meta new file mode 100644 index 0000000..2832124 --- /dev/null +++ b/Editor/EditorTools.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ea87578c17af73438029c225bac3bbd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/BlackboardEditor.cs b/Editor/EditorTools/BlackboardEditor.cs new file mode 100644 index 0000000..033c71d --- /dev/null +++ b/Editor/EditorTools/BlackboardEditor.cs @@ -0,0 +1,139 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + /// Static helper for drawing a in the editor. + /// + public static class BlackboardEditor + { + private static readonly List s_tableTypes = new List(); + private static readonly List s_noEditorTables = new List(); + + private static readonly GenericMenu.MenuFunction2 s_onCreatePopup = OnCreatePopup; + + /// + /// Draws an editor for . + /// + /// An editor is drawn for this. + public static void DrawBlackboard(Blackboard blackboard) + { + if (blackboard == null) + { + return; + } + + try + { + blackboard.GetValueTypes(s_tableTypes); + s_tableTypes.Sort((left, right) => string.CompareOrdinal(left.Name, right.Name)); + DrawTables(blackboard); + s_tableTypes.Clear(); + DrawNoEditor(); + DrawAdd(blackboard); + } + finally + { + s_tableTypes.Clear(); + s_noEditorTables.Clear(); + } + } + + private static void DrawTables(Blackboard blackboard) + { + EditorGUI.BeginChangeCheck(); + + for (int i = 0, count = s_tableTypes.Count; i < count; ++i) + { + Type type = s_tableTypes[i]; + + if (!BlackboardEditorToolsCollection.TryGetTableEditor(type, out BlackboardTableEditor_Base editor)) + { + s_noEditorTables.Add(type); + continue; + } + + EditorGUILayout.BeginVertical(GUI.skin.box); + editor.Draw(blackboard); + EditorGUILayout.EndVertical(); + } + } + + private static void DrawNoEditor() + { + int noEditorCount = s_noEditorTables.Count; + + if (noEditorCount == 0) + { + return; + } + + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.PrefixLabel("Other Types"); + + EditorGUILayout.BeginVertical(); + + for (int i = 0; i < noEditorCount; ++i) + { + EditorGUILayout.LabelField(s_noEditorTables[i].Name); + } + + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndHorizontal(); + } + + private static void DrawAdd(Blackboard blackboard) + { + EditorGUILayout.Separator(); + + if (GUILayout.Button("Add")) + { + var menu = new GenericMenu(); + + Vector2 position = Event.current.mousePosition; + Vector2 screenPoint = GUIUtility.GUIToScreenPoint(new Vector2(position.x, position.y)); + + BlackboardEditorToolsCollection.GetValueViewTypes(s_tableTypes); + + for (int i = 0, count = s_tableTypes.Count; i < count; ++i) + { + Type type = s_tableTypes[i]; + + var popupInfo = new PopupInfo + { + type = type, + blackboard = blackboard, + screenPoint = screenPoint, + }; + + menu.AddItem(new GUIContent(type.Name), false, s_onCreatePopup, popupInfo); + } + + menu.ShowAsContext(); + } + } + + private static void OnCreatePopup(object popupInfoObject) + { + var popupInfo = (PopupInfo)popupInfoObject; + + BlackboardEditorToolsCollection.CreateAddPopup(popupInfo.type, popupInfo.blackboard, popupInfo.type.Name, + popupInfo.screenPoint); + } + + private class PopupInfo + { + public Type type; + public Blackboard blackboard; + public Vector2 screenPoint; + } + } +} diff --git a/Editor/EditorTools/BlackboardEditor.cs.meta b/Editor/EditorTools/BlackboardEditor.cs.meta new file mode 100644 index 0000000..9273e87 --- /dev/null +++ b/Editor/EditorTools/BlackboardEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d12b762ea0a2ec947899c06a02fb0997 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/BlackboardEditorToolsCollection.cs b/Editor/EditorTools/BlackboardEditorToolsCollection.cs new file mode 100644 index 0000000..b82d281 --- /dev/null +++ b/Editor/EditorTools/BlackboardEditorToolsCollection.cs @@ -0,0 +1,106 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using System.Linq; +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.BlackboardTableEditors; +using Zor.SimpleBlackboard.BlackboardValueViews; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + /// Static collection of blackboard editor tools. + /// + [InitializeOnLoad] + internal static class BlackboardEditorToolsCollection + { + private static readonly Dictionary s_valueViews; + private static readonly Dictionary s_tableEditors; + + static BlackboardEditorToolsCollection() + { + Type[] types = (from domainAssembly in AppDomain.CurrentDomain.GetAssemblies() + where !domainAssembly.IsDynamic + from assemblyType in domainAssembly.GetExportedTypes() + where !assemblyType.IsAbstract && !assemblyType.IsGenericType + && typeof(IBlackboardValueView).IsAssignableFrom(assemblyType) + select assemblyType) + .ToArray(); + + int count = types.Length; + + s_valueViews = new Dictionary(count); + s_tableEditors = new Dictionary(count); + + for (int i = 0; i < count; ++i) + { + Type type = types[i]; + + var valueView = (IBlackboardValueView)Activator.CreateInstance(type); + Type valueViewType = valueView.valueType; + s_valueViews[valueViewType] = valueView; + + Type tableEditorType = valueViewType.IsValueType + ? typeof(StructBlackboardTableEditor<>) + : typeof(ClassBlackboardTableEditor<>); + Type editorViewType = tableEditorType.MakeGenericType(valueViewType); + var editorView = (BlackboardTableEditor_Base)Activator.CreateInstance(editorViewType, valueView); + s_tableEditors[editorView.valueType] = editorView; + } + } + + /// + /// Tries to get an editor for . + /// + /// Value type for which an editor is needed. + /// Found table editor or default if it's not found. + /// True if the editor is found; false otherwise. + public static bool TryGetTableEditor([NotNull] Type valueType, out BlackboardTableEditor_Base blackboardTableEditor) + { + return s_tableEditors.TryGetValue(valueType, out blackboardTableEditor); + } + + /// + /// Adds all value types of existing s to . + /// + /// Value types of existing s are added + /// to this. + public static void GetValueViewTypes([NotNull] List valueViewTypes) + { + valueViewTypes.AddRange(s_valueViews.Keys); + } + + /// + /// Creates for and . + /// + /// Value type of a property to add to . + /// A new property is added to this. + /// Initial key of the property. + /// Position of the popup. + /// Created . + public static AddPopup CreateAddPopup([NotNull] Type valueType, Blackboard blackboard, string key, + Vector2 position) + { + if (!s_valueViews.TryGetValue(valueType, out IBlackboardValueView valueView)) + { + return null; + } + + Type addPopupValueType = typeof(AddPopupValue<>).MakeGenericType(valueType); + var addPopupValue = (IAddPopupValue)Activator.CreateInstance(addPopupValueType, valueView); + AddPopup[] addPopups = Resources.FindObjectsOfTypeAll(); + for (int i = 0, count = addPopups.Length; i < count; ++i) + { + addPopups[i].Close(); + } + var addPopup = ScriptableObject.CreateInstance(); + addPopup.Setup(blackboard, key, addPopupValue, position); + + return addPopup; + } + } +} diff --git a/Editor/EditorTools/BlackboardEditorToolsCollection.cs.meta b/Editor/EditorTools/BlackboardEditorToolsCollection.cs.meta new file mode 100644 index 0000000..08de5a5 --- /dev/null +++ b/Editor/EditorTools/BlackboardEditorToolsCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b48ce6d0922961848b7535e8c31fadab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/BlackboardTableEditor.cs b/Editor/EditorTools/BlackboardTableEditor.cs new file mode 100644 index 0000000..c885196 --- /dev/null +++ b/Editor/EditorTools/BlackboardTableEditor.cs @@ -0,0 +1,100 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.BlackboardValueViews; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + /// Draws an editor for . + /// + /// Value type. + internal abstract class BlackboardTableEditor : BlackboardTableEditor_Base + { + private static readonly List> s_properties = + new List>(); + + private readonly BlackboardValueView m_blackboardValueView; + + /// + /// Creates a using for drawing. + /// + /// + /// This is used for drawing a property in + /// + protected BlackboardTableEditor(BlackboardValueView blackboardValueView) + { + m_blackboardValueView = blackboardValueView; + } + + /// + public override Type valueType => typeof(T); + + /// + public override void Draw(Blackboard blackboard) + { + try + { + EditorGUILayout.LabelField(valueType.Name, EditorStyles.boldLabel); + + GetProperties(blackboard, s_properties); + s_properties.Sort((left, right) + => string.CompareOrdinal(left.Key.name, right.Key.name)); + + for (int i = 0, count = s_properties.Count; i < count; ++i) + { + KeyValuePair property = s_properties[i]; + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.BeginVertical(); + + EditorGUI.BeginChangeCheck(); + + BlackboardPropertyName key = property.Key; + T newValue = m_blackboardValueView.DrawValue(key.name, property.Value); + + if (EditorGUI.EndChangeCheck()) + { + SetValue(blackboard, key, newValue); + } + + EditorGUILayout.EndVertical(); + + if (GUILayout.Button(s_RemoveButtonIcon, s_RemoveButtonOptions)) + { + blackboard.RemoveObject(key); + } + + EditorGUILayout.EndHorizontal(); + } + } + finally + { + s_properties.Clear(); + } + } + + /// + /// Gets properties of the type from . + /// + /// Blackboard source. + /// Properties output. + protected abstract void GetProperties([NotNull] Blackboard blackboard, + [NotNull] List> properties); + + /// + /// Sets into + /// with property name . + /// + /// Property is set into this. + /// Property name. + /// Property value. + protected abstract void SetValue([NotNull] Blackboard blackboard, + BlackboardPropertyName key, T value); + } +} diff --git a/Editor/EditorTools/BlackboardTableEditor.cs.meta b/Editor/EditorTools/BlackboardTableEditor.cs.meta new file mode 100644 index 0000000..0107fa5 --- /dev/null +++ b/Editor/EditorTools/BlackboardTableEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0979b7c047303d041a9daeb1a9e54181 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/BlackboardTableEditor_Base.cs b/Editor/EditorTools/BlackboardTableEditor_Base.cs new file mode 100644 index 0000000..72594ed --- /dev/null +++ b/Editor/EditorTools/BlackboardTableEditor_Base.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + /// Base class for . + /// + internal abstract class BlackboardTableEditor_Base + { + protected static readonly GUIContent s_RemoveButtonIcon = EditorGUIUtility.IconContent("TreeEditor.Trash"); + protected static readonly GUILayoutOption[] s_RemoveButtonOptions = { GUILayout.Width(32f) }; + + /// + /// Value type of the drawn property. + /// + [NotNull] + public abstract Type valueType { get; } + + /// + /// Draws an editor for in . + /// + /// For its the editor is drawn. + public abstract void Draw(Blackboard blackboard); + } +} diff --git a/Editor/EditorTools/BlackboardTableEditor_Base.cs.meta b/Editor/EditorTools/BlackboardTableEditor_Base.cs.meta new file mode 100644 index 0000000..0c11aae --- /dev/null +++ b/Editor/EditorTools/BlackboardTableEditor_Base.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 32f3b1eee0e1f6249b658fa3318ab9aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/ClassBlackboardTableEditor.cs b/Editor/EditorTools/ClassBlackboardTableEditor.cs new file mode 100644 index 0000000..25c9e3c --- /dev/null +++ b/Editor/EditorTools/ClassBlackboardTableEditor.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System.Collections.Generic; +using Zor.SimpleBlackboard.BlackboardValueViews; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + internal sealed class ClassBlackboardTableEditor : BlackboardTableEditor where T : class + { + public ClassBlackboardTableEditor(BlackboardValueView blackboardValueView) : base(blackboardValueView) + { + } + + /// + protected override void GetProperties(Blackboard blackboard, + List> properties) + { + blackboard.GetClassProperties(properties); + } + + /// + protected override void SetValue(Blackboard blackboard, BlackboardPropertyName key, T value) + { + blackboard.SetClassValue(key, value); + } + } +} diff --git a/Editor/EditorTools/ClassBlackboardTableEditor.cs.meta b/Editor/EditorTools/ClassBlackboardTableEditor.cs.meta new file mode 100644 index 0000000..1b029dc --- /dev/null +++ b/Editor/EditorTools/ClassBlackboardTableEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f24f97ba9a409d419588859dfb2de7b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/SerializedTableTypesCollection.cs b/Editor/EditorTools/SerializedTableTypesCollection.cs new file mode 100644 index 0000000..82e4f91 --- /dev/null +++ b/Editor/EditorTools/SerializedTableTypesCollection.cs @@ -0,0 +1,89 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using System.Linq; +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; +using Zor.SimpleBlackboard.Serialization; +using Object = UnityEngine.Object; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + /// Static collection of serialized table types. + /// + [InitializeOnLoad] + internal static class SerializedTableTypesCollection + { + private static readonly Type[] s_serializedTableTypes; + private static readonly Type[] s_valueTypes; + + static SerializedTableTypesCollection() + { + s_serializedTableTypes = (from domainAssembly in AppDomain.CurrentDomain.GetAssemblies() + where !domainAssembly.IsDynamic + from assemblyType in domainAssembly.GetExportedTypes() + where !assemblyType.IsAbstract && !assemblyType.IsGenericType + && assemblyType.IsSubclassOf(typeof(SerializedTable_Base)) + select assemblyType) + .ToArray(); + + int count = s_serializedTableTypes.Length; + s_valueTypes = new Type[count]; + + for (int i = 0; i < count; ++i) + { + var tempSerializedTable = + (SerializedTable_Base)ScriptableObject.CreateInstance(s_serializedTableTypes[i]); + s_valueTypes[i] = tempSerializedTable.valueType; + Object.DestroyImmediate(tempSerializedTable); + } + } + + /// + /// Get all serialized table and value types. + /// + /// Table types are added to this. + /// Value types are added to this. + /// + /// If this exists, it's used to filter the result - value types that exist in + /// are not added. + /// This has to be an array of . + /// + /// + /// and are synchronized by index. + /// + public static void GetSerializedTableTypes([NotNull] List tableTypes, [NotNull] List valueTypes, + [CanBeNull] SerializedProperty existingTables) + { + for (int i = 0, count = s_serializedTableTypes.Length; i < count; ++i) + { + Type valueType = s_valueTypes[i]; + + if (existingTables == null || !Contains(existingTables, valueType)) + { + tableTypes.Add(s_serializedTableTypes[i]); + valueTypes.Add(valueType); + } + } + } + + private static bool Contains(SerializedProperty tables, Type type) + { + for (int i = 0, count = tables.arraySize; i < count; ++i) + { + Type valueType = ((SerializedTable_Base)tables.GetArrayElementAtIndex(i) + .objectReferenceValue).valueType; + + if (valueType == type) + { + return true; + } + } + + return false; + } + } +} diff --git a/Editor/EditorTools/SerializedTableTypesCollection.cs.meta b/Editor/EditorTools/SerializedTableTypesCollection.cs.meta new file mode 100644 index 0000000..2e97c9f --- /dev/null +++ b/Editor/EditorTools/SerializedTableTypesCollection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 46a58cfa56ab9b546bcc484375b8cdee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/EditorTools/StructBlackboardTableEditor.cs b/Editor/EditorTools/StructBlackboardTableEditor.cs new file mode 100644 index 0000000..b385350 --- /dev/null +++ b/Editor/EditorTools/StructBlackboardTableEditor.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System.Collections.Generic; +using Zor.SimpleBlackboard.BlackboardValueViews; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.EditorTools +{ + /// + internal sealed class StructBlackboardTableEditor : BlackboardTableEditor where T : struct + { + public StructBlackboardTableEditor(BlackboardValueView blackboardValueView) : base(blackboardValueView) + { + } + + /// + protected override void GetProperties(Blackboard blackboard, + List> properties) + { + blackboard.GetStructProperties(properties); + } + + /// + protected override void SetValue(Blackboard blackboard, BlackboardPropertyName key, T value) + { + blackboard.SetStructValue(key, value); + } + } +} diff --git a/Editor/EditorTools/StructBlackboardTableEditor.cs.meta b/Editor/EditorTools/StructBlackboardTableEditor.cs.meta new file mode 100644 index 0000000..f657211 --- /dev/null +++ b/Editor/EditorTools/StructBlackboardTableEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b5bf26105ec1eb4e9d3b62de0460fa0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Helpers.meta b/Editor/Helpers.meta new file mode 100644 index 0000000..9794595 --- /dev/null +++ b/Editor/Helpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2755c7d497bbfcd459094259c25e1b57 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Helpers/SerializedPropertyHelper.cs b/Editor/Helpers/SerializedPropertyHelper.cs new file mode 100644 index 0000000..f811558 --- /dev/null +++ b/Editor/Helpers/SerializedPropertyHelper.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard +{ + internal static class SerializedPropertyHelper + { + /// + /// A little hack to remove a serialized property from a serialized array. The hack is needed because it's + /// impossible to know how many times it's needed to call + /// to completely remove a property from the array. + /// + /// Array property what the property is deleted from. + /// At this index the deletion is processed. + public static void CompletelyRemove([NotNull] SerializedProperty serializedProperty, int index) + { + int size = serializedProperty.arraySize; + + do + { + serializedProperty.DeleteArrayElementAtIndex(index); + } while (serializedProperty.arraySize == size); + } + } +} + diff --git a/Editor/Helpers/SerializedPropertyHelper.cs.meta b/Editor/Helpers/SerializedPropertyHelper.cs.meta new file mode 100644 index 0000000..f684523 --- /dev/null +++ b/Editor/Helpers/SerializedPropertyHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d9143a010f737bd4388591b109d13726 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews.meta b/Editor/ValueViews.meta new file mode 100644 index 0000000..a85d99d --- /dev/null +++ b/Editor/ValueViews.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0254969bc5936ad42ab314112eeb92a8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/BlackboardValueView.cs b/Editor/ValueViews/BlackboardValueView.cs new file mode 100644 index 0000000..1716a07 --- /dev/null +++ b/Editor/ValueViews/BlackboardValueView.cs @@ -0,0 +1,30 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + /// + /// View for a blackboard value. + /// Inherit this to make a drawer for a value of + /// . + /// + /// Value type. + /// + /// Blackboard values are drawn by this class because Unity draws properties by itself only if the property is + /// serialized by Unity which is not true for the Blackboard system. + /// + public abstract class BlackboardValueView : IBlackboardValueView + { + /// + public Type valueType => typeof(T); + + /// + /// Draws in the editor and returns new value. + /// + /// Label which is used in the editor. + /// Current value. + /// New value. + public abstract T DrawValue(string label, T value); + } +} diff --git a/Editor/ValueViews/BlackboardValueView.cs.meta b/Editor/ValueViews/BlackboardValueView.cs.meta new file mode 100644 index 0000000..00fb814 --- /dev/null +++ b/Editor/ValueViews/BlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f95f1c79126e6c49ae74a8277f5487e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/IBlackboardValueView.cs b/Editor/ValueViews/IBlackboardValueView.cs new file mode 100644 index 0000000..d1f0299 --- /dev/null +++ b/Editor/ValueViews/IBlackboardValueView.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using JetBrains.Annotations; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + /// + /// Interface for . + /// + internal interface IBlackboardValueView + { + /// + /// Value type of the drawn property. + /// + [NotNull] + Type valueType { get; } + } +} diff --git a/Editor/ValueViews/IBlackboardValueView.cs.meta b/Editor/ValueViews/IBlackboardValueView.cs.meta new file mode 100644 index 0000000..50ec4b1 --- /dev/null +++ b/Editor/ValueViews/IBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2b40b3b3aa4cc249938a78cf005f219 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations.meta b/Editor/ValueViews/Implementations.meta new file mode 100644 index 0000000..cbeb87f --- /dev/null +++ b/Editor/ValueViews/Implementations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: faffc4722d201aa498f928b0cb5a3404 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs b/Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs new file mode 100644 index 0000000..33b27a7 --- /dev/null +++ b/Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class AnimationCurveBlackboardValueView : BlackboardValueView + { + public override AnimationCurve DrawValue(string label, AnimationCurve value) + { + if (value == null) + { + value = new AnimationCurve(); + } + + return EditorGUILayout.CurveField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs.meta new file mode 100644 index 0000000..0ab82bc --- /dev/null +++ b/Editor/ValueViews/Implementations/AnimationCurveBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aaedda95be617f14b90ab622c1acfe65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/BoolBlackboardValueView.cs b/Editor/ValueViews/Implementations/BoolBlackboardValueView.cs new file mode 100644 index 0000000..acc2f01 --- /dev/null +++ b/Editor/ValueViews/Implementations/BoolBlackboardValueView.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class BoolBlackboardValueView : BlackboardValueView + { + public override bool DrawValue(string label, bool value) + { + return EditorGUILayout.Toggle(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/BoolBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/BoolBlackboardValueView.cs.meta new file mode 100644 index 0000000..4a77e13 --- /dev/null +++ b/Editor/ValueViews/Implementations/BoolBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2482a23aaede6e346a60c4428e89f41e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs b/Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs new file mode 100644 index 0000000..f366553 --- /dev/null +++ b/Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class BoundsBlackboardValueView : BlackboardValueView + { + public override Bounds DrawValue(string label, Bounds value) + { + return EditorGUILayout.BoundsField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs.meta new file mode 100644 index 0000000..7823ec5 --- /dev/null +++ b/Editor/ValueViews/Implementations/BoundsBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0079be1d1ff35dc4790221210f4955f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs b/Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs new file mode 100644 index 0000000..df7ec4b --- /dev/null +++ b/Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class BoundsIntBlackboardValueView : BlackboardValueView + { + public override BoundsInt DrawValue(string label, BoundsInt value) + { + return EditorGUILayout.BoundsIntField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs.meta new file mode 100644 index 0000000..bd56fe8 --- /dev/null +++ b/Editor/ValueViews/Implementations/BoundsIntBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a18f827ce4015d4d8eb35990c63ab33 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/ByteBlackboardValueView.cs b/Editor/ValueViews/Implementations/ByteBlackboardValueView.cs new file mode 100644 index 0000000..f0ad2ce --- /dev/null +++ b/Editor/ValueViews/Implementations/ByteBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class ByteBlackboardValueView : BlackboardValueView + { + public override byte DrawValue(string label, byte value) + { + return (byte)Mathf.Clamp(EditorGUILayout.IntField(label, value), byte.MinValue, byte.MaxValue); + } + } +} diff --git a/Editor/ValueViews/Implementations/ByteBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/ByteBlackboardValueView.cs.meta new file mode 100644 index 0000000..a82bc84 --- /dev/null +++ b/Editor/ValueViews/Implementations/ByteBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6fa33a2ea3ab67246a8b89297ffecd47 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/CharBlackboardValueView.cs b/Editor/ValueViews/Implementations/CharBlackboardValueView.cs new file mode 100644 index 0000000..e7f34f4 --- /dev/null +++ b/Editor/ValueViews/Implementations/CharBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class CharBlackboardValueView : BlackboardValueView + { + public override char DrawValue(string label, char value) + { + string result = EditorGUILayout.TextField(label, value.ToString()); + return !string.IsNullOrEmpty(result) ? result[0] : default; + } + } +} diff --git a/Editor/ValueViews/Implementations/CharBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/CharBlackboardValueView.cs.meta new file mode 100644 index 0000000..259af2e --- /dev/null +++ b/Editor/ValueViews/Implementations/CharBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd1930f721b6b9e41a36ad2a59ceca3b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/ColorBlackboardValueView.cs b/Editor/ValueViews/Implementations/ColorBlackboardValueView.cs new file mode 100644 index 0000000..17ac7e4 --- /dev/null +++ b/Editor/ValueViews/Implementations/ColorBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class ColorBlackboardValueView : BlackboardValueView + { + public override Color DrawValue(string label, Color value) + { + return EditorGUILayout.ColorField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/ColorBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/ColorBlackboardValueView.cs.meta new file mode 100644 index 0000000..7288001 --- /dev/null +++ b/Editor/ValueViews/Implementations/ColorBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5a0584e44f4ce484180df9db32886c31 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs b/Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs new file mode 100644 index 0000000..f7ec69e --- /dev/null +++ b/Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class ComponentBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs.meta new file mode 100644 index 0000000..b3ce621 --- /dev/null +++ b/Editor/ValueViews/Implementations/ComponentBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 73e1c3ec917de1d42b2c1fef67e582fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs b/Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs new file mode 100644 index 0000000..74a8baf --- /dev/null +++ b/Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class DoubleBlackboardValueView : BlackboardValueView + { + public override double DrawValue(string label, double value) + { + return EditorGUILayout.DoubleField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs.meta new file mode 100644 index 0000000..256050d --- /dev/null +++ b/Editor/ValueViews/Implementations/DoubleBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe5dfe188efc5c640a85b08fac6e130c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/FloatBlackboardValueView.cs b/Editor/ValueViews/Implementations/FloatBlackboardValueView.cs new file mode 100644 index 0000000..a1376c3 --- /dev/null +++ b/Editor/ValueViews/Implementations/FloatBlackboardValueView.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class FloatBlackboardValueView : BlackboardValueView + { + public override float DrawValue(string label, float value) + { + return EditorGUILayout.FloatField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/FloatBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/FloatBlackboardValueView.cs.meta new file mode 100644 index 0000000..23a7ad5 --- /dev/null +++ b/Editor/ValueViews/Implementations/FloatBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf11ddb5e1233ac4e9921bee3699c65f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs b/Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs new file mode 100644 index 0000000..b6917fa --- /dev/null +++ b/Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class GameObjectBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs.meta new file mode 100644 index 0000000..9a79a19 --- /dev/null +++ b/Editor/ValueViews/Implementations/GameObjectBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b4e1893cd05e1e479c33468a7592c54 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/GradientBlackboardValueView.cs b/Editor/ValueViews/Implementations/GradientBlackboardValueView.cs new file mode 100644 index 0000000..233604e --- /dev/null +++ b/Editor/ValueViews/Implementations/GradientBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class GradientBlackboardValueView : BlackboardValueView + { + public override Gradient DrawValue(string label, Gradient value) + { + return EditorGUILayout.GradientField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/GradientBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/GradientBlackboardValueView.cs.meta new file mode 100644 index 0000000..dd32844 --- /dev/null +++ b/Editor/ValueViews/Implementations/GradientBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cd80d67fb46b8fd4f82356fe519ee7e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/IntBlackboardValueView.cs b/Editor/ValueViews/Implementations/IntBlackboardValueView.cs new file mode 100644 index 0000000..a98ecfd --- /dev/null +++ b/Editor/ValueViews/Implementations/IntBlackboardValueView.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class IntBlackboardValueView : BlackboardValueView + { + public override int DrawValue(string label, int value) + { + return EditorGUILayout.IntField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/IntBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/IntBlackboardValueView.cs.meta new file mode 100644 index 0000000..7572ae6 --- /dev/null +++ b/Editor/ValueViews/Implementations/IntBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85e3b94fdc51d514f9576a35ce0504ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs b/Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs new file mode 100644 index 0000000..007707b --- /dev/null +++ b/Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class LayerMaskBlackboardValueView : BlackboardValueView + { + public override LayerMask DrawValue(string label, LayerMask value) + { + return EditorGUILayout.MaskField(label, value, InternalEditorUtility.layers); + } + } +} diff --git a/Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs.meta new file mode 100644 index 0000000..8adde9a --- /dev/null +++ b/Editor/ValueViews/Implementations/LayerMaskBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c6cfb728498f2c4cad3ca2304c49351 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/LongBlackboardValueView.cs b/Editor/ValueViews/Implementations/LongBlackboardValueView.cs new file mode 100644 index 0000000..de9210b --- /dev/null +++ b/Editor/ValueViews/Implementations/LongBlackboardValueView.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class LongBlackboardValueView : BlackboardValueView + { + public override long DrawValue(string label, long value) + { + return EditorGUILayout.LongField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/LongBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/LongBlackboardValueView.cs.meta new file mode 100644 index 0000000..cc680f8 --- /dev/null +++ b/Editor/ValueViews/Implementations/LongBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76c0f4564c6be8c4094a6713ca0f2b46 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs b/Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs new file mode 100644 index 0000000..dd6d229 --- /dev/null +++ b/Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class MaterialBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs.meta new file mode 100644 index 0000000..643b33f --- /dev/null +++ b/Editor/ValueViews/Implementations/MaterialBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e939aa65e31ac04cb21342d35daf3a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs b/Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs new file mode 100644 index 0000000..ff9ac9b --- /dev/null +++ b/Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class Matrix4x4BlackboardValueView : BlackboardValueView + { + public override Matrix4x4 DrawValue(string label, Matrix4x4 value) + { + EditorGUILayout.BeginHorizontal(); + + EditorGUILayout.PrefixLabel(label); + + EditorGUILayout.BeginVertical(); + + for (int i = 0; i < 4; ++i) + { + EditorGUILayout.BeginHorizontal(); + + Vector4 row = value.GetRow(i); + + for (int j = 0; j < 4; j++) + { + row[j] = EditorGUILayout.FloatField(row[j]); + } + + value.SetRow(i, row); + + EditorGUILayout.EndHorizontal(); + } + + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndHorizontal(); + + return value; + } + } +} diff --git a/Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs.meta new file mode 100644 index 0000000..5b804eb --- /dev/null +++ b/Editor/ValueViews/Implementations/Matrix4x4BlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f87ba601273817b4587a61a7f3bb4529 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs b/Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs new file mode 100644 index 0000000..7334d57 --- /dev/null +++ b/Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class ObjectBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs.meta new file mode 100644 index 0000000..fa8dc4d --- /dev/null +++ b/Editor/ValueViews/Implementations/ObjectBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb0c0c7d110151b4c806c16c30af8f74 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs b/Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs new file mode 100644 index 0000000..90cd969 --- /dev/null +++ b/Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class PropertyNameBlackboardValueView : BlackboardValueView + { + public override PropertyName DrawValue(string label, PropertyName value) + { + string stringValue = value.ToString(); + stringValue = stringValue.Substring(0, stringValue.IndexOf(':')); + stringValue = EditorGUILayout.TextField(label, stringValue); + return new PropertyName(stringValue); + } + } +} diff --git a/Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs.meta new file mode 100644 index 0000000..2dd0e0f --- /dev/null +++ b/Editor/ValueViews/Implementations/PropertyNameBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90c755db4600ebe4d8b3344aaedd3f29 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs b/Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs new file mode 100644 index 0000000..5044477 --- /dev/null +++ b/Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class QuaternionBlackboardValueView : BlackboardValueView + { + public override Quaternion DrawValue(string label, Quaternion value) + { + Vector4 vector = + EditorGUILayout.Vector4Field(label, new Vector4(value.x, value.y, value.z, value.w)); + + return new Quaternion(vector.x, vector.y, vector.z, vector.w); + } + } +} diff --git a/Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs.meta new file mode 100644 index 0000000..fd94682 --- /dev/null +++ b/Editor/ValueViews/Implementations/QuaternionBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b99933a078923514f91f69d9d50a7d7b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/RectBlackboardValueView.cs b/Editor/ValueViews/Implementations/RectBlackboardValueView.cs new file mode 100644 index 0000000..7f02d41 --- /dev/null +++ b/Editor/ValueViews/Implementations/RectBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class RectBlackboardValueView : BlackboardValueView + { + public override Rect DrawValue(string label, Rect value) + { + return EditorGUILayout.RectField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/RectBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/RectBlackboardValueView.cs.meta new file mode 100644 index 0000000..da3d7d2 --- /dev/null +++ b/Editor/ValueViews/Implementations/RectBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08a6d3d122204d741ad9001bcbda46d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs b/Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs new file mode 100644 index 0000000..13b661d --- /dev/null +++ b/Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class RectIntBlackboardValueView : BlackboardValueView + { + public override RectInt DrawValue(string label, RectInt value) + { + return EditorGUILayout.RectIntField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs.meta new file mode 100644 index 0000000..298ebcf --- /dev/null +++ b/Editor/ValueViews/Implementations/RectIntBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 569caaa68c541e740a9af308d9a37aee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs b/Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs new file mode 100644 index 0000000..121e867 --- /dev/null +++ b/Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class SbyteBlackboardValueView : BlackboardValueView + { + public override sbyte DrawValue(string label, sbyte value) + { + return (sbyte)Mathf.Clamp(EditorGUILayout.IntField(label, value), sbyte.MinValue, sbyte.MaxValue); + } + } +} diff --git a/Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs.meta new file mode 100644 index 0000000..264b36d --- /dev/null +++ b/Editor/ValueViews/Implementations/SbyteBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 903f13e00a87087499a842c0b1b00f65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/ShortBlackboardValueView.cs b/Editor/ValueViews/Implementations/ShortBlackboardValueView.cs new file mode 100644 index 0000000..b152693 --- /dev/null +++ b/Editor/ValueViews/Implementations/ShortBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class ShortBlackboardValueView : BlackboardValueView + { + public override short DrawValue(string label, short value) + { + return (short)Mathf.Clamp(EditorGUILayout.IntField(label, value), short.MinValue, short.MaxValue); + } + } +} diff --git a/Editor/ValueViews/Implementations/ShortBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/ShortBlackboardValueView.cs.meta new file mode 100644 index 0000000..794e127 --- /dev/null +++ b/Editor/ValueViews/Implementations/ShortBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 379d1c29fda62b74d934ded6f3f21ed1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs b/Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs new file mode 100644 index 0000000..f9c0842 --- /dev/null +++ b/Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class SpriteBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs.meta new file mode 100644 index 0000000..0519fe8 --- /dev/null +++ b/Editor/ValueViews/Implementations/SpriteBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98af221ea774eab47b2bfd36638a8b29 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/StringBlackboardValueView.cs b/Editor/ValueViews/Implementations/StringBlackboardValueView.cs new file mode 100644 index 0000000..7e00abc --- /dev/null +++ b/Editor/ValueViews/Implementations/StringBlackboardValueView.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class StringBlackboardValueView : BlackboardValueView + { + public override string DrawValue(string label, string value) + { + return EditorGUILayout.TextField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/StringBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/StringBlackboardValueView.cs.meta new file mode 100644 index 0000000..f2bf630 --- /dev/null +++ b/Editor/ValueViews/Implementations/StringBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5df21b01763cd5f40906f7b6e9dc639d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/TextureBlackboardValueView.cs b/Editor/ValueViews/Implementations/TextureBlackboardValueView.cs new file mode 100644 index 0000000..ba0262e --- /dev/null +++ b/Editor/ValueViews/Implementations/TextureBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class TextureBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/TextureBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/TextureBlackboardValueView.cs.meta new file mode 100644 index 0000000..8c47ebf --- /dev/null +++ b/Editor/ValueViews/Implementations/TextureBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3197491b0a20b74585159ce9b1660f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/TransformBlackboardValueView.cs b/Editor/ValueViews/Implementations/TransformBlackboardValueView.cs new file mode 100644 index 0000000..5fd6179 --- /dev/null +++ b/Editor/ValueViews/Implementations/TransformBlackboardValueView.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class TransformBlackboardValueView : UnityObjectBlackboardValueView + { + } +} diff --git a/Editor/ValueViews/Implementations/TransformBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/TransformBlackboardValueView.cs.meta new file mode 100644 index 0000000..2dd2b3a --- /dev/null +++ b/Editor/ValueViews/Implementations/TransformBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f0f6e186cc146241aa57da704988787 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/UintBlackboardValueView.cs b/Editor/ValueViews/Implementations/UintBlackboardValueView.cs new file mode 100644 index 0000000..c818352 --- /dev/null +++ b/Editor/ValueViews/Implementations/UintBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class UintBlackboardValueView : BlackboardValueView + { + public override uint DrawValue(string label, uint value) + { + return (uint)Mathf.Clamp(EditorGUILayout.IntField(label, (int)value), uint.MinValue, uint.MaxValue); + } + } +} diff --git a/Editor/ValueViews/Implementations/UintBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/UintBlackboardValueView.cs.meta new file mode 100644 index 0000000..251ab01 --- /dev/null +++ b/Editor/ValueViews/Implementations/UintBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07cfa5d252991544f8ca8890cb33ab2e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/UlongBlackboardValueView.cs b/Editor/ValueViews/Implementations/UlongBlackboardValueView.cs new file mode 100644 index 0000000..05d52b9 --- /dev/null +++ b/Editor/ValueViews/Implementations/UlongBlackboardValueView.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class UlongBlackboardValueView : BlackboardValueView + { + public override ulong DrawValue(string label, ulong value) + { + long result = EditorGUILayout.LongField(label, (long)value); + + if (result < (long)ulong.MinValue) + { + result = (long)ulong.MinValue; + } + + return (ulong)result; + } + } +} diff --git a/Editor/ValueViews/Implementations/UlongBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/UlongBlackboardValueView.cs.meta new file mode 100644 index 0000000..1dc5f7a --- /dev/null +++ b/Editor/ValueViews/Implementations/UlongBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8b825ff237466e4fb34aa04636c0e5a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs b/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs new file mode 100644 index 0000000..e5bdf5e --- /dev/null +++ b/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + /// + /// Inherit this if you need to draw with EditorGUILayout.ObjectField. + /// + /// Value type. + public abstract class UnityObjectBlackboardValueView : BlackboardValueView where T : Object + { + public sealed override T DrawValue(string label, T value) + { + return EditorGUILayout.ObjectField(label, value, typeof(T), true) as T; + } + } +} diff --git a/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs.meta new file mode 100644 index 0000000..f33cef0 --- /dev/null +++ b/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 82fc3b1f3fb16b24ea6a398bb42ee7ae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/UshortBlackboardValueView.cs b/Editor/ValueViews/Implementations/UshortBlackboardValueView.cs new file mode 100644 index 0000000..2ca8ddc --- /dev/null +++ b/Editor/ValueViews/Implementations/UshortBlackboardValueView.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class UshortBlackboardValueView : BlackboardValueView + { + public override ushort DrawValue(string label, ushort value) + { + long result = EditorGUILayout.LongField(label, value); + + if (result < ushort.MinValue) + { + result = ushort.MinValue; + } + else if (result > ushort.MaxValue) + { + result = ushort.MaxValue; + } + + return (ushort)result; + } + } +} diff --git a/Editor/ValueViews/Implementations/UshortBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/UshortBlackboardValueView.cs.meta new file mode 100644 index 0000000..5477477 --- /dev/null +++ b/Editor/ValueViews/Implementations/UshortBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8fb3cda80cde86e4c998dc7e6fc556a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs b/Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs new file mode 100644 index 0000000..e397288 --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class Vector2BlackboardValueView : BlackboardValueView + { + public override Vector2 DrawValue(string label, Vector2 value) + { + return EditorGUILayout.Vector2Field(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs.meta new file mode 100644 index 0000000..a3b41d9 --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector2BlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95263614a4c412741865032413efcd03 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs b/Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs new file mode 100644 index 0000000..59ed288 --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class Vector2IntBlackboardValueView : BlackboardValueView + { + public override Vector2Int DrawValue(string label, Vector2Int value) + { + return EditorGUILayout.Vector2IntField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs.meta new file mode 100644 index 0000000..687dd8e --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector2IntBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24a9f7844edfdec41a04beb30d5e36f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs b/Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs new file mode 100644 index 0000000..2c8b56d --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class Vector3BlackboardValueView : BlackboardValueView + { + public override Vector3 DrawValue(string label, Vector3 value) + { + return EditorGUILayout.Vector3Field(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs.meta new file mode 100644 index 0000000..0f9918e --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector3BlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ec884b29e642bb2409e13fd13dbb3517 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs b/Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs new file mode 100644 index 0000000..71bcb37 --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class Vector3IntBlackboardValueView : BlackboardValueView + { + public override Vector3Int DrawValue(string label, Vector3Int value) + { + return EditorGUILayout.Vector3IntField(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs.meta new file mode 100644 index 0000000..62a7387 --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector3IntBlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: baff4101911ac274cbb3dddae610fc18 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs b/Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs new file mode 100644 index 0000000..3fcc17e --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using JetBrains.Annotations; +using UnityEditor; +using UnityEngine; + +namespace Zor.SimpleBlackboard.BlackboardValueViews +{ + [UsedImplicitly] + public sealed class Vector4BlackboardValueView : BlackboardValueView + { + public override Vector4 DrawValue(string label, Vector4 value) + { + return EditorGUILayout.Vector4Field(label, value); + } + } +} diff --git a/Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs.meta b/Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs.meta new file mode 100644 index 0000000..f84e517 --- /dev/null +++ b/Editor/ValueViews/Implementations/Vector4BlackboardValueView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebefba65c2e9fa2448cb0c5383d45f77 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Zor.SimpleBlackboard.Editor.asmdef b/Editor/Zor.SimpleBlackboard.Editor.asmdef new file mode 100644 index 0000000..b21cac6 --- /dev/null +++ b/Editor/Zor.SimpleBlackboard.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Zor.SimpleBlackboard.Editor", + "references": [ + "Zor.SimpleBlackboard" + ], + "optionalUnityReferences": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Editor/Zor.SimpleBlackboard.Editor.asmdef.meta b/Editor/Zor.SimpleBlackboard.Editor.asmdef.meta new file mode 100644 index 0000000..06f3ec3 --- /dev/null +++ b/Editor/Zor.SimpleBlackboard.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5c75358c424f1a64d96dfa28cf09911f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LICENSE b/LICENSE.md similarity index 91% rename from LICENSE rename to LICENSE.md index e462ab2..a176672 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Vladimir Popov +Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/LICENSE.md.meta b/LICENSE.md.meta new file mode 100644 index 0000000..e6e9973 --- /dev/null +++ b/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 19c21f08d4ca251498ecb519d27f050f +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6c64a6 --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +# Simple Blackboard +Simple Blackboard for Unity is a flexible data storage that can contain any count of properties of any type. +The properties can be accessed with property names. + +The main advantage of Simple Blackboard is that it allocates as little as possible. +Also it has good enough performance and supports derivation. + +## Installation + +This repo is a regular Unity package. You can install it as your project dependency. +More here: https://docs.unity3d.com/Manual/upm-dependencies.html. + +## Usage + +### Setup + +#### As a Unity component + +Add a [BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs) +to a GameObject in your scene. +You can find it in **Add Component/Simple Blackboard/Blackboard Container**. +That component automatically creates a [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) inside. +You can access it via `BlackboardContainer.blackboard` property. + +#### As a regular c# class + +Simply create a [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) with its default constructor: `new Blackboard()`. +You may get all the features of the Simple Blackboard this way too. + + +### [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) API + +- `TryGetStructValue()` tries to get and return a value of a specified struct type and property name. +- `TryGetClassValue()` tries to get and return a value of a specified class type and property name. +- `SetStructValue()` sets a value of a specified struct type and property name. +- `SetClassValue()` sets a value of a specified class type and property name. + +Those are main methods of [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs), +you can find more in its source code. + +All the methods of [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) +use [BlackboardPropertyName](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/BlackboardPropertyName.cs) +as a property name, not string. You can create that struct with one of its constructors. It transforms strings into unique integer ids. That makes work of +[Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) faster. But it's not recommended to create a new +[BlackboardPropertyName](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/BlackboardPropertyName.cs) every time, cache it. + +## Serialization + +If you use a [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) as a regular c# class, +you have to support serialization yourself. + +If you use a [BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs), +you can create a [SerializedTablesContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTablesContainer.cs) +in **Assets/Create/Simple Blackboard/Serialized Tables Container** and link it in your +[BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs). +It will automatically apply all properties of a +[Serialized Tables Container](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTablesContainer.cs) on Awake(). + +### How to customize serialization + +Although there are many types supported by Simple Blackboard out of the box, you may need to serialize more types or your own types. +In that case, you need to inherit +[ClassGeneratedValueSerializedTable](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs), +[ClassSerializedValueSerializedTable](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs), +[StructGeneratedValueSerializedTable](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs), +or [StructSerializedValueSerializedTable](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs). + +If you need a full customizable serialized table, you can inherit +[SerializedTable_Base](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs). + +If you need a full customizable serialized container, you can inherit +[SerializedContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Serialization/SerializedContainer.cs). + +## Blackboard editor support + +Because Unity draws only serialized by itself properties, properties of a [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) +aren't drawn by Unity. But [BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs) +has a custom editor to show and make editable all of its [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) properties. +Although there are many types that are drawn out of the box, you may need to draw more types in Unity editor. You can achieve it by inheriting +[BlackboardValueView](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Editor/ValueViews/BlackboardValueView.cs) or +[UnityObjectBlackboardValueView](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Editor/ValueViews/Implementations/UnityObjectBlackboardValueView.cs). + +## Logs +There is a special class for logging the whole Blackboard system: +[BlackboardDebug](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Debug/BlackboardDebug.cs). +It contains conditional methods for logging. You can control a compilation of those methods with define symbols: +- SIMPLE_BLACKBOARD_LOG_DETAILS - log every change of the Blackboard system. +- SIMPLE_BLACKBOARD_LOG +- SIMPLE_BLACKBOARD_LOG_WARNING +- SIMPLE_BLACKBOARD_LOG_ERROR + +[BlackboardDebug](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Debug/BlackboardDebug.cs) +has all of them as public const strings. + +## Little features + +### [BlackboardPropertyReference](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardPropertyReference.cs) + +It's a simple serializable struct with two fields: reference to +[BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs) +and property name of string type. It has a custom editor that makes a selector for the property name field. The selector is filled with property names of +all serialized properties of the referenced +[BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs). +It's recommended to use it for custom components where you need to reference a specific property in a +[Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) +of a [BlackboardContainer](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Components/BlackboardContainer.cs). + +### Accessors + +These are special components that allow to easily get or set a value in a [Blackboard](https://github.com/ZorPastaman/Simple-Blackboard/blob/develop/Runtime/Core/Blackboard.cs) in Unity component system. +You can find them in **Add Component/Simple Blackboard/Accessors/** or in the [folder](https://github.com/ZorPastaman/Simple-Blackboard/tree/develop/Runtime/Components/Accessors). +You can get/set a blackboard property via the property `Accessor.value`. + +Accessors also have Unity Event that is invoked with a current value in a blackboard. To flush such an event, you need to call the method `Accessor_Base.Flush()` or just use one of Accessor flushers that do that automatically. +You can find them in **Add Component/Simple Blackboard/Accessor Flushers/** or in the [folder](https://github.com/ZorPastaman/Simple-Blackboard/tree/develop/Runtime/Components/AccessorFlushers). + +## See also +- [Event Based Blackboard](https://github.com/ZorPastaman/Event-Based-Blackboard) - another version of a blackboard system which flush events when its properties are changed but doesn't support derivation. diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..c17f668 --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6f514c688cdebc6459bc58945ff87b74 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime.meta b/Runtime.meta new file mode 100644 index 0000000..77df6d2 --- /dev/null +++ b/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 743aba493e24f3b45bd4b69250aae4b8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/AssemblyInfo.cs b/Runtime/AssemblyInfo.cs new file mode 100644 index 0000000..52d658c --- /dev/null +++ b/Runtime/AssemblyInfo.cs @@ -0,0 +1,4 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Zor.SimpleBlackboard.Editor")] diff --git a/Runtime/AssemblyInfo.cs.meta b/Runtime/AssemblyInfo.cs.meta new file mode 100644 index 0000000..7b8a06e --- /dev/null +++ b/Runtime/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 00d0e70d8eac47cd824450afa29eb470 +timeCreated: 1591526062 \ No newline at end of file diff --git a/Runtime/Components.meta b/Runtime/Components.meta new file mode 100644 index 0000000..89f7cfe --- /dev/null +++ b/Runtime/Components.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 64dc9f9a5fb45a944a7837fdaa8e434f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Components/AccessorFlushers.meta b/Runtime/Components/AccessorFlushers.meta new file mode 100644 index 0000000..5b60e46 --- /dev/null +++ b/Runtime/Components/AccessorFlushers.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 02821c368cbc4fb5a0ae23fbbe2c1988 +timeCreated: 1590939620 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/AccessorFlusher.cs b/Runtime/Components/AccessorFlushers/AccessorFlusher.cs new file mode 100644 index 0000000..6e33eac --- /dev/null +++ b/Runtime/Components/AccessorFlushers/AccessorFlusher.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; +using Zor.SimpleBlackboard.Components.Accessors; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// Inherit this component to implement your Flusher for . + /// + /// + /// You need to call for flushing. + /// + public abstract class AccessorFlusher : MonoBehaviour + { +#pragma warning disable CS0649 + [SerializeField] private Accessor_Base[] m_Accessors; +#pragma warning restore CS0649 + + /// + /// Call this method for flushing. + /// + protected void FlushAccessors() + { + for (int i = 0, count = m_Accessors.Length; i < count; ++i) + { + m_Accessors[i].Flush(); + } + } + } +} diff --git a/Runtime/Components/AccessorFlushers/AccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/AccessorFlusher.cs.meta new file mode 100644 index 0000000..8bb58f8 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/AccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 745bbc2ddac64259bc5c50a710b86937 +timeCreated: 1590939654 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs new file mode 100644 index 0000000..4e08995 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System.Collections; +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// Inherit this component to implement your Flusher for + /// based on . + /// + public abstract class CoroutineAccessorFlusher : AccessorFlusher + { + private YieldInstruction m_instruction; + private Coroutine m_coroutine; + + /// + /// which is processed before calling + /// . + /// + protected abstract YieldInstruction instruction { get; } + + private void Awake() + { + m_instruction = instruction; + } + + private void OnEnable() + { + m_coroutine = StartCoroutine(Process()); + } + + private void OnDisable() + { + if (m_coroutine != null) + { + StopCoroutine(m_coroutine); + m_coroutine = null; + } + } + + private IEnumerator Process() + { + while (true) + { + yield return m_instruction; + FlushAccessors(); + } + } + } +} diff --git a/Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs.meta new file mode 100644 index 0000000..df0b868 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/CoroutineAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ffd733aed60c46f4bf0479bfb91135d7 +timeCreated: 1591517768 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs new file mode 100644 index 0000000..fa4cf6a --- /dev/null +++ b/Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// This flusher calls + /// every . + /// + [AddComponentMenu(AddComponentConstants.AccessorFlushersFolder + "Fixed Update Accessor Flusher")] + public sealed class FixedUpdateAccessorFlusher : AccessorFlusher + { + private void FixedUpdate() + { + FlushAccessors(); + } + } +} diff --git a/Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs.meta new file mode 100644 index 0000000..ef79e6b --- /dev/null +++ b/Runtime/Components/AccessorFlushers/FixedUpdateAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 222352e960e04c8f85316f2606426114 +timeCreated: 1591517662 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs new file mode 100644 index 0000000..a1b5ced --- /dev/null +++ b/Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// This flusher calls + /// every . + /// + [AddComponentMenu(AddComponentConstants.AccessorFlushersFolder + "Late Update Accessor Flusher")] + public sealed class LateUpdateAccessorFlusher : AccessorFlusher + { + private void LateUpdate() + { + FlushAccessors(); + } + } +} diff --git a/Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs.meta new file mode 100644 index 0000000..c3977de --- /dev/null +++ b/Runtime/Components/AccessorFlushers/LateUpdateAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 65b062665b774feebcb33f2d04a0cc5f +timeCreated: 1591517712 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs new file mode 100644 index 0000000..fd0c857 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// This flusher calls + /// every . + /// + [AddComponentMenu(AddComponentConstants.AccessorFlushersFolder + "Update Accessor Flusher")] + public sealed class UpdateAccessorFlusher : AccessorFlusher + { + private void Update() + { + FlushAccessors(); + } + } +} diff --git a/Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs.meta new file mode 100644 index 0000000..9d00927 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/UpdateAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bb25dba712d5405888a3d8c48d443a43 +timeCreated: 1590939904 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs new file mode 100644 index 0000000..2a7d1ec --- /dev/null +++ b/Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// This flusher calls + /// every time in after . + /// + [AddComponentMenu(AddComponentConstants.AccessorFlushersFolder + "Wait For Fixed Update Accessor Flusher")] + public sealed class WaitForFixedUpdateAccessorFlusher : CoroutineAccessorFlusher + { + protected override YieldInstruction instruction => new WaitForFixedUpdate(); + } +} diff --git a/Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs.meta new file mode 100644 index 0000000..d74feab --- /dev/null +++ b/Runtime/Components/AccessorFlushers/WaitForFixedUpdateAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 18f48f2b33b349fba6becdefff3e38bd +timeCreated: 1591520715 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs new file mode 100644 index 0000000..b7ba52f --- /dev/null +++ b/Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// This flusher calls + /// every time in after null. + /// + [AddComponentMenu(AddComponentConstants.AccessorFlushersFolder + "Wait For Null Accessor Flusher")] + public sealed class WaitForNullAccessorFlusher : CoroutineAccessorFlusher + { + protected override YieldInstruction instruction => null; + } +} diff --git a/Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs.meta new file mode 100644 index 0000000..7e1d46e --- /dev/null +++ b/Runtime/Components/AccessorFlushers/WaitForNullAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a433d95d26c5417684161fc334183f4f +timeCreated: 1591520853 \ No newline at end of file diff --git a/Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs b/Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs new file mode 100644 index 0000000..1a39712 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Components.AccessorFlushers +{ + /// + /// This flusher calls + /// every time in after . + /// + [AddComponentMenu(AddComponentConstants.AccessorFlushersFolder + "Wait For Seconds Accessor Flusher")] + public sealed class WaitForSecondsAccessorFlusher : CoroutineAccessorFlusher + { +#pragma warning disable CS0649 + [SerializeField] private float m_Seconds; +#pragma warning restore CS0649 + + protected override YieldInstruction instruction => new WaitForSeconds(m_Seconds); + } +} diff --git a/Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs.meta b/Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs.meta new file mode 100644 index 0000000..3d4ad41 --- /dev/null +++ b/Runtime/Components/AccessorFlushers/WaitForSecondsAccessorFlusher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bc89787fe5364420a6317c53a9320704 +timeCreated: 1591520935 \ No newline at end of file diff --git a/Runtime/Components/Accessors.meta b/Runtime/Components/Accessors.meta new file mode 100644 index 0000000..ab66238 --- /dev/null +++ b/Runtime/Components/Accessors.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e55573626a87450f9768f6892524d018 +timeCreated: 1590313385 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Accessor.cs b/Runtime/Components/Accessors/Accessor.cs new file mode 100644 index 0000000..ede46c7 --- /dev/null +++ b/Runtime/Components/Accessors/Accessor.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.Scripting; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + /// + /// Accessor for a property of type in a blackboard. + /// Inherit this to implement a new type support. + /// + /// Value type. + /// Unity event which is invoked on . + public abstract class Accessor : Accessor_Base where TEvent : UnityEvent + { +#pragma warning disable CS0649 + [SerializeField] private TEvent m_OnFlushed; +#pragma warning restore CS0649 + + [Preserve] + public abstract T value { get; set; } + + /// + /// Invokes a Unity Event with a current value. + /// + [Preserve] + public override void Flush() + { + m_OnFlushed.Invoke(value); + } + } +} diff --git a/Runtime/Components/Accessors/Accessor.cs.meta b/Runtime/Components/Accessors/Accessor.cs.meta new file mode 100644 index 0000000..06e844a --- /dev/null +++ b/Runtime/Components/Accessors/Accessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b3968a73ce394f659973b7246f2b0733 +timeCreated: 1590562639 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Accessor_Base.cs b/Runtime/Components/Accessors/Accessor_Base.cs new file mode 100644 index 0000000..a69945b --- /dev/null +++ b/Runtime/Components/Accessors/Accessor_Base.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; +using UnityEngine.Scripting; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + /// + /// Base class for accessors. + /// It's recommended to inherit . + /// + public abstract class Accessor_Base : MonoBehaviour + { +#pragma warning disable CS0649 + [SerializeField] protected BlackboardPropertyReference m_BlackboardPropertyReference; +#pragma warning restore CS0649 + + private BlackboardPropertyName m_blackboardPropertyName; + private bool m_initialized; + + protected BlackboardPropertyName propertyName + { + get + { + if (!m_initialized) + { + m_blackboardPropertyName = + new BlackboardPropertyName(m_BlackboardPropertyReference.propertyName); + m_initialized = true; + } + + return m_blackboardPropertyName; + } + } + + [Preserve] + public abstract void Flush(); + } +} diff --git a/Runtime/Components/Accessors/Accessor_Base.cs.meta b/Runtime/Components/Accessors/Accessor_Base.cs.meta new file mode 100644 index 0000000..5bce9e2 --- /dev/null +++ b/Runtime/Components/Accessors/Accessor_Base.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cbe338b603444e019b726f727bc9ab8d +timeCreated: 1590936013 \ No newline at end of file diff --git a/Runtime/Components/Accessors/AnimationCurveAccessor.cs b/Runtime/Components/Accessors/AnimationCurveAccessor.cs new file mode 100644 index 0000000..536078d --- /dev/null +++ b/Runtime/Components/Accessors/AnimationCurveAccessor.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Animation Curve Accessor")] + public abstract class AnimationCurveAccessor : + ClassAccessor + { + [Serializable] + public sealed class AnimationCurveEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/AnimationCurveAccessor.cs.meta b/Runtime/Components/Accessors/AnimationCurveAccessor.cs.meta new file mode 100644 index 0000000..89a1d72 --- /dev/null +++ b/Runtime/Components/Accessors/AnimationCurveAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e54dc4868cdc4be69566e7d4c707a1df +timeCreated: 1590314285 \ No newline at end of file diff --git a/Runtime/Components/Accessors/BoolAccessor.cs b/Runtime/Components/Accessors/BoolAccessor.cs new file mode 100644 index 0000000..6146281 --- /dev/null +++ b/Runtime/Components/Accessors/BoolAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Bool Accessor")] + public sealed class BoolAccessor : StructAccessor + { + [Serializable] + public sealed class BoolEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/BoolAccessor.cs.meta b/Runtime/Components/Accessors/BoolAccessor.cs.meta new file mode 100644 index 0000000..42031e4 --- /dev/null +++ b/Runtime/Components/Accessors/BoolAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 37016ceba7f8421dad3fd786e3dfed93 +timeCreated: 1590314330 \ No newline at end of file diff --git a/Runtime/Components/Accessors/BoundsAccessor.cs b/Runtime/Components/Accessors/BoundsAccessor.cs new file mode 100644 index 0000000..541d3a1 --- /dev/null +++ b/Runtime/Components/Accessors/BoundsAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Bounds Accessor")] + public sealed class BoundsAccessor : StructAccessor + { + [Serializable] + public sealed class BoundsEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/BoundsAccessor.cs.meta b/Runtime/Components/Accessors/BoundsAccessor.cs.meta new file mode 100644 index 0000000..fd13233 --- /dev/null +++ b/Runtime/Components/Accessors/BoundsAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6ad61067b13f4f4c9a15a1577bd09c9e +timeCreated: 1590314379 \ No newline at end of file diff --git a/Runtime/Components/Accessors/BoundsIntAccessor.cs b/Runtime/Components/Accessors/BoundsIntAccessor.cs new file mode 100644 index 0000000..997369e --- /dev/null +++ b/Runtime/Components/Accessors/BoundsIntAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Bounds Int Accessor")] + public sealed class BoundsIntAccessor : StructAccessor + { + [Serializable] + public sealed class BoundsIntEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/BoundsIntAccessor.cs.meta b/Runtime/Components/Accessors/BoundsIntAccessor.cs.meta new file mode 100644 index 0000000..67cfd1d --- /dev/null +++ b/Runtime/Components/Accessors/BoundsIntAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a7d3ad6df64c41fdaf82bb310e2ad7ea +timeCreated: 1590314434 \ No newline at end of file diff --git a/Runtime/Components/Accessors/ByteAccessor.cs b/Runtime/Components/Accessors/ByteAccessor.cs new file mode 100644 index 0000000..fae2039 --- /dev/null +++ b/Runtime/Components/Accessors/ByteAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Byte Accessor")] + public sealed class ByteAccessor : StructAccessor + { + [Serializable] + public sealed class ByteEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/ByteAccessor.cs.meta b/Runtime/Components/Accessors/ByteAccessor.cs.meta new file mode 100644 index 0000000..23d00bb --- /dev/null +++ b/Runtime/Components/Accessors/ByteAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9b610381cbfd40f1b7903efe17ee10ae +timeCreated: 1590314483 \ No newline at end of file diff --git a/Runtime/Components/Accessors/CharAccessor.cs b/Runtime/Components/Accessors/CharAccessor.cs new file mode 100644 index 0000000..b2326cd --- /dev/null +++ b/Runtime/Components/Accessors/CharAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Char Accessor")] + public sealed class CharAccessor : StructAccessor + { + [Serializable] + public sealed class CharEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/CharAccessor.cs.meta b/Runtime/Components/Accessors/CharAccessor.cs.meta new file mode 100644 index 0000000..f096283 --- /dev/null +++ b/Runtime/Components/Accessors/CharAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ba477d0952f3467a9277a9dc9c024a46 +timeCreated: 1590317384 \ No newline at end of file diff --git a/Runtime/Components/Accessors/ClassAccessor.cs b/Runtime/Components/Accessors/ClassAccessor.cs new file mode 100644 index 0000000..9b3b308 --- /dev/null +++ b/Runtime/Components/Accessors/ClassAccessor.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine.Events; +using UnityEngine.Scripting; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + public abstract class ClassAccessor : Accessor where T : class where TEvent : UnityEvent + { + [Preserve] + public override T value + { + get + { + m_BlackboardPropertyReference.blackboardContainer.blackboard.TryGetClassValue(propertyName, + out T answer); + return answer; + } + set => m_BlackboardPropertyReference.blackboardContainer.blackboard.SetClassValue(propertyName, value); + } + } +} diff --git a/Runtime/Components/Accessors/ClassAccessor.cs.meta b/Runtime/Components/Accessors/ClassAccessor.cs.meta new file mode 100644 index 0000000..900653e --- /dev/null +++ b/Runtime/Components/Accessors/ClassAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 090c7dde5939435eae482b4a82730028 +timeCreated: 1590314072 \ No newline at end of file diff --git a/Runtime/Components/Accessors/ColorAccessor.cs b/Runtime/Components/Accessors/ColorAccessor.cs new file mode 100644 index 0000000..b43a21c --- /dev/null +++ b/Runtime/Components/Accessors/ColorAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Color Accessor")] + public sealed class ColorAccessor : StructAccessor + { + [Serializable] + public sealed class ColorEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/ColorAccessor.cs.meta b/Runtime/Components/Accessors/ColorAccessor.cs.meta new file mode 100644 index 0000000..350e8be --- /dev/null +++ b/Runtime/Components/Accessors/ColorAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b7447e32107347a58f56161152c288f0 +timeCreated: 1590317503 \ No newline at end of file diff --git a/Runtime/Components/Accessors/ComponentAccessor.cs b/Runtime/Components/Accessors/ComponentAccessor.cs new file mode 100644 index 0000000..e9696f9 --- /dev/null +++ b/Runtime/Components/Accessors/ComponentAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Component Accessor")] + public sealed class ComponentAccessor : ClassAccessor + { + [Serializable] + public sealed class ComponentEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/ComponentAccessor.cs.meta b/Runtime/Components/Accessors/ComponentAccessor.cs.meta new file mode 100644 index 0000000..4d7fff9 --- /dev/null +++ b/Runtime/Components/Accessors/ComponentAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0be344b9f3f542ae966f589f8badd9c5 +timeCreated: 1590317573 \ No newline at end of file diff --git a/Runtime/Components/Accessors/DoubleAccessor.cs b/Runtime/Components/Accessors/DoubleAccessor.cs new file mode 100644 index 0000000..dbe2b16 --- /dev/null +++ b/Runtime/Components/Accessors/DoubleAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Double Accessor")] + public sealed class DoubleAccessor : StructAccessor + { + [Serializable] + public sealed class DoubleEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/DoubleAccessor.cs.meta b/Runtime/Components/Accessors/DoubleAccessor.cs.meta new file mode 100644 index 0000000..73d9639 --- /dev/null +++ b/Runtime/Components/Accessors/DoubleAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ffa69f998c8742b4973843d1ddcc5136 +timeCreated: 1590317688 \ No newline at end of file diff --git a/Runtime/Components/Accessors/FloatAccessor.cs b/Runtime/Components/Accessors/FloatAccessor.cs new file mode 100644 index 0000000..5dd3dcd --- /dev/null +++ b/Runtime/Components/Accessors/FloatAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Float Accessor")] + public sealed class FloatAccessor : StructAccessor + { + [Serializable] + public sealed class FloatEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/FloatAccessor.cs.meta b/Runtime/Components/Accessors/FloatAccessor.cs.meta new file mode 100644 index 0000000..23c974f --- /dev/null +++ b/Runtime/Components/Accessors/FloatAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 03bde06ee1c743f9bb49e2a42548368b +timeCreated: 1590317791 \ No newline at end of file diff --git a/Runtime/Components/Accessors/GameObjectAccessor.cs b/Runtime/Components/Accessors/GameObjectAccessor.cs new file mode 100644 index 0000000..68a6d23 --- /dev/null +++ b/Runtime/Components/Accessors/GameObjectAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "GameObject Accessor")] + public sealed class GameObjectAccessor : ClassAccessor + { + [Serializable] + public sealed class GameObjectEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/GameObjectAccessor.cs.meta b/Runtime/Components/Accessors/GameObjectAccessor.cs.meta new file mode 100644 index 0000000..64d7c0b --- /dev/null +++ b/Runtime/Components/Accessors/GameObjectAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e1e9d43e2b534ca3a1f4533dfa385f74 +timeCreated: 1590317843 \ No newline at end of file diff --git a/Runtime/Components/Accessors/GradientAccessor.cs b/Runtime/Components/Accessors/GradientAccessor.cs new file mode 100644 index 0000000..865b5aa --- /dev/null +++ b/Runtime/Components/Accessors/GradientAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Gradient Accessor")] + public sealed class GradientAccessor : ClassAccessor + { + [Serializable] + public sealed class GradientEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/GradientAccessor.cs.meta b/Runtime/Components/Accessors/GradientAccessor.cs.meta new file mode 100644 index 0000000..9d5ce38 --- /dev/null +++ b/Runtime/Components/Accessors/GradientAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0de9cb28644b42c790b67afc9e29a8b2 +timeCreated: 1590317911 \ No newline at end of file diff --git a/Runtime/Components/Accessors/IntAccessor.cs b/Runtime/Components/Accessors/IntAccessor.cs new file mode 100644 index 0000000..d2b5d81 --- /dev/null +++ b/Runtime/Components/Accessors/IntAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Int Accessor")] + public sealed class IntAccessor : StructAccessor + { + [Serializable] + public sealed class IntEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/IntAccessor.cs.meta b/Runtime/Components/Accessors/IntAccessor.cs.meta new file mode 100644 index 0000000..51abc33 --- /dev/null +++ b/Runtime/Components/Accessors/IntAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0029caa853294744b460acfb3f59e4a9 +timeCreated: 1590318131 \ No newline at end of file diff --git a/Runtime/Components/Accessors/LayerMaskAccessor.cs b/Runtime/Components/Accessors/LayerMaskAccessor.cs new file mode 100644 index 0000000..a5da81b --- /dev/null +++ b/Runtime/Components/Accessors/LayerMaskAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Layer Mask Accessor")] + public sealed class LayerMaskAccessor : StructAccessor + { + [Serializable] + public sealed class LayerMaskEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/LayerMaskAccessor.cs.meta b/Runtime/Components/Accessors/LayerMaskAccessor.cs.meta new file mode 100644 index 0000000..d51013e --- /dev/null +++ b/Runtime/Components/Accessors/LayerMaskAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 10f476f8a45543c2a68727ec1244d498 +timeCreated: 1590562435 \ No newline at end of file diff --git a/Runtime/Components/Accessors/LongAccessor.cs b/Runtime/Components/Accessors/LongAccessor.cs new file mode 100644 index 0000000..d27ecfe --- /dev/null +++ b/Runtime/Components/Accessors/LongAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Long Accessor")] + public sealed class LongAccessor : StructAccessor + { + [Serializable] + public sealed class LongEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/LongAccessor.cs.meta b/Runtime/Components/Accessors/LongAccessor.cs.meta new file mode 100644 index 0000000..895f117 --- /dev/null +++ b/Runtime/Components/Accessors/LongAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c574ab480dc244a0897ec46fa009344b +timeCreated: 1590562842 \ No newline at end of file diff --git a/Runtime/Components/Accessors/MaterialAccessor.cs b/Runtime/Components/Accessors/MaterialAccessor.cs new file mode 100644 index 0000000..1687ec8 --- /dev/null +++ b/Runtime/Components/Accessors/MaterialAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Material Accessor")] + public sealed class MaterialAccessor : ClassAccessor + { + [Serializable] + public sealed class MaterialEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/MaterialAccessor.cs.meta b/Runtime/Components/Accessors/MaterialAccessor.cs.meta new file mode 100644 index 0000000..32697f5 --- /dev/null +++ b/Runtime/Components/Accessors/MaterialAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 19f000886cbe48a78a5390027c6d48d6 +timeCreated: 1590562938 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Matrix4x4Accessor.cs b/Runtime/Components/Accessors/Matrix4x4Accessor.cs new file mode 100644 index 0000000..504629f --- /dev/null +++ b/Runtime/Components/Accessors/Matrix4x4Accessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Matrix4x4 Accessor")] + public sealed class Matrix4x4Accessor : StructAccessor + { + [Serializable] + public sealed class Matrix4x4Event : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/Matrix4x4Accessor.cs.meta b/Runtime/Components/Accessors/Matrix4x4Accessor.cs.meta new file mode 100644 index 0000000..8cee924 --- /dev/null +++ b/Runtime/Components/Accessors/Matrix4x4Accessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6f0c86eed53c4b398aba563b4cc72231 +timeCreated: 1590562990 \ No newline at end of file diff --git a/Runtime/Components/Accessors/ObjectAccessor.cs b/Runtime/Components/Accessors/ObjectAccessor.cs new file mode 100644 index 0000000..04f25fa --- /dev/null +++ b/Runtime/Components/Accessors/ObjectAccessor.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; +using Object = UnityEngine.Object; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Object Accessor")] + public sealed class ObjectAccessor : ClassAccessor + { + [Serializable] + public sealed class ObjectEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/ObjectAccessor.cs.meta b/Runtime/Components/Accessors/ObjectAccessor.cs.meta new file mode 100644 index 0000000..512b6cc --- /dev/null +++ b/Runtime/Components/Accessors/ObjectAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3b247db667e94b498acd687b3cc13f00 +timeCreated: 1590563050 \ No newline at end of file diff --git a/Runtime/Components/Accessors/PropertyNameAccessor.cs b/Runtime/Components/Accessors/PropertyNameAccessor.cs new file mode 100644 index 0000000..3096719 --- /dev/null +++ b/Runtime/Components/Accessors/PropertyNameAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Property Name Accessor")] + public sealed class PropertyNameAccessor : StructAccessor + { + [Serializable] + public sealed class PropertyNameEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/PropertyNameAccessor.cs.meta b/Runtime/Components/Accessors/PropertyNameAccessor.cs.meta new file mode 100644 index 0000000..78a920f --- /dev/null +++ b/Runtime/Components/Accessors/PropertyNameAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d4d876e2288b4dbf8f9b732f84164315 +timeCreated: 1590563113 \ No newline at end of file diff --git a/Runtime/Components/Accessors/QuaternionAccessor.cs b/Runtime/Components/Accessors/QuaternionAccessor.cs new file mode 100644 index 0000000..31e1b8c --- /dev/null +++ b/Runtime/Components/Accessors/QuaternionAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Quaternion Accessor")] + public sealed class QuaternionAccessor : StructAccessor + { + [Serializable] + public sealed class QuaternionEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/QuaternionAccessor.cs.meta b/Runtime/Components/Accessors/QuaternionAccessor.cs.meta new file mode 100644 index 0000000..544bab7 --- /dev/null +++ b/Runtime/Components/Accessors/QuaternionAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 076d02d41a424b51882f6f90bee6f9bb +timeCreated: 1590563153 \ No newline at end of file diff --git a/Runtime/Components/Accessors/RectAccessor.cs b/Runtime/Components/Accessors/RectAccessor.cs new file mode 100644 index 0000000..cba3e3f --- /dev/null +++ b/Runtime/Components/Accessors/RectAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Rect Accessor")] + public sealed class RectAccessor : StructAccessor + { + [Serializable] + public sealed class RectEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/RectAccessor.cs.meta b/Runtime/Components/Accessors/RectAccessor.cs.meta new file mode 100644 index 0000000..8d54012 --- /dev/null +++ b/Runtime/Components/Accessors/RectAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eecefe1565de4757b3dd1ff96d8a04a6 +timeCreated: 1590563201 \ No newline at end of file diff --git a/Runtime/Components/Accessors/RectIntAccessor.cs b/Runtime/Components/Accessors/RectIntAccessor.cs new file mode 100644 index 0000000..7aa20f6 --- /dev/null +++ b/Runtime/Components/Accessors/RectIntAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Rect Int Accessor")] + public sealed class RectIntAccessor : StructAccessor + { + [Serializable] + public sealed class RectIntEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/RectIntAccessor.cs.meta b/Runtime/Components/Accessors/RectIntAccessor.cs.meta new file mode 100644 index 0000000..075db38 --- /dev/null +++ b/Runtime/Components/Accessors/RectIntAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bd77d50af30e48f7be0a4ce4ee3a6484 +timeCreated: 1590563250 \ No newline at end of file diff --git a/Runtime/Components/Accessors/SbyteAccessor.cs b/Runtime/Components/Accessors/SbyteAccessor.cs new file mode 100644 index 0000000..1edac3e --- /dev/null +++ b/Runtime/Components/Accessors/SbyteAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Sbyte Accessor")] + public sealed class SbyteAccessor : StructAccessor + { + [Serializable] + public sealed class SbyteEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/SbyteAccessor.cs.meta b/Runtime/Components/Accessors/SbyteAccessor.cs.meta new file mode 100644 index 0000000..4c33cef --- /dev/null +++ b/Runtime/Components/Accessors/SbyteAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 12383a695069462692aee07f701ac154 +timeCreated: 1590563292 \ No newline at end of file diff --git a/Runtime/Components/Accessors/ShortAccessor.cs b/Runtime/Components/Accessors/ShortAccessor.cs new file mode 100644 index 0000000..e01ac14 --- /dev/null +++ b/Runtime/Components/Accessors/ShortAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Short Accessor")] + public sealed class ShortAccessor : StructAccessor + { + [Serializable] + public sealed class ShortEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/ShortAccessor.cs.meta b/Runtime/Components/Accessors/ShortAccessor.cs.meta new file mode 100644 index 0000000..08b9f54 --- /dev/null +++ b/Runtime/Components/Accessors/ShortAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5fef768a812c404bbe0946847ec21869 +timeCreated: 1590563350 \ No newline at end of file diff --git a/Runtime/Components/Accessors/SpriteAccessor.cs b/Runtime/Components/Accessors/SpriteAccessor.cs new file mode 100644 index 0000000..e8b6657 --- /dev/null +++ b/Runtime/Components/Accessors/SpriteAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Sprite Accessor")] + public sealed class SpriteAccessor : ClassAccessor + { + [Serializable] + public sealed class SpriteEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/SpriteAccessor.cs.meta b/Runtime/Components/Accessors/SpriteAccessor.cs.meta new file mode 100644 index 0000000..b9e1b85 --- /dev/null +++ b/Runtime/Components/Accessors/SpriteAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 68983118ab944ca98602411f57c4450c +timeCreated: 1590563413 \ No newline at end of file diff --git a/Runtime/Components/Accessors/StringAccessor.cs b/Runtime/Components/Accessors/StringAccessor.cs new file mode 100644 index 0000000..b66eacd --- /dev/null +++ b/Runtime/Components/Accessors/StringAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "String Accessor")] + public sealed class StringAccessor : ClassAccessor + { + [Serializable] + public sealed class StringEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/StringAccessor.cs.meta b/Runtime/Components/Accessors/StringAccessor.cs.meta new file mode 100644 index 0000000..bed0f42 --- /dev/null +++ b/Runtime/Components/Accessors/StringAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 35f60e30ce7340ad8ee29d5304d618f8 +timeCreated: 1590563468 \ No newline at end of file diff --git a/Runtime/Components/Accessors/StructAccessor.cs b/Runtime/Components/Accessors/StructAccessor.cs new file mode 100644 index 0000000..6b19862 --- /dev/null +++ b/Runtime/Components/Accessors/StructAccessor.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine.Events; +using UnityEngine.Scripting; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + public abstract class StructAccessor : Accessor where T : struct where TEvent : UnityEvent + { + [Preserve] + public override T value + { + get + { + m_BlackboardPropertyReference.blackboardContainer.blackboard.TryGetStructValue(propertyName, + out T answer); + return answer; + } + set => m_BlackboardPropertyReference.blackboardContainer.blackboard.SetStructValue(propertyName, value); + } + } +} diff --git a/Runtime/Components/Accessors/StructAccessor.cs.meta b/Runtime/Components/Accessors/StructAccessor.cs.meta new file mode 100644 index 0000000..b0cb9df --- /dev/null +++ b/Runtime/Components/Accessors/StructAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 82a69758dc59429388569b8511b5012f +timeCreated: 1590313681 \ No newline at end of file diff --git a/Runtime/Components/Accessors/TextureAccessor.cs b/Runtime/Components/Accessors/TextureAccessor.cs new file mode 100644 index 0000000..c953fc9 --- /dev/null +++ b/Runtime/Components/Accessors/TextureAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Texture Accessor")] + public sealed class TextureAccessor : ClassAccessor + { + [Serializable] + public sealed class TextureEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/TextureAccessor.cs.meta b/Runtime/Components/Accessors/TextureAccessor.cs.meta new file mode 100644 index 0000000..bbd6a6c --- /dev/null +++ b/Runtime/Components/Accessors/TextureAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f23a0e2c42724413bcdf81fe96bae3fe +timeCreated: 1590563528 \ No newline at end of file diff --git a/Runtime/Components/Accessors/TransformAccessor.cs b/Runtime/Components/Accessors/TransformAccessor.cs new file mode 100644 index 0000000..b20956d --- /dev/null +++ b/Runtime/Components/Accessors/TransformAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Transform Accessor")] + public sealed class TransformAccessor : ClassAccessor + { + [Serializable] + public sealed class TransformEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/TransformAccessor.cs.meta b/Runtime/Components/Accessors/TransformAccessor.cs.meta new file mode 100644 index 0000000..44ebded --- /dev/null +++ b/Runtime/Components/Accessors/TransformAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8ee31253c1c7417193a3f8c86a7db5dc +timeCreated: 1590563574 \ No newline at end of file diff --git a/Runtime/Components/Accessors/UintAccessor.cs b/Runtime/Components/Accessors/UintAccessor.cs new file mode 100644 index 0000000..6b93cb6 --- /dev/null +++ b/Runtime/Components/Accessors/UintAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Uint Accessor")] + public sealed class UintAccessor : StructAccessor + { + [Serializable] + public sealed class UintEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/UintAccessor.cs.meta b/Runtime/Components/Accessors/UintAccessor.cs.meta new file mode 100644 index 0000000..afa5304 --- /dev/null +++ b/Runtime/Components/Accessors/UintAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c441500e751842299f6922eaef44fbe7 +timeCreated: 1590563645 \ No newline at end of file diff --git a/Runtime/Components/Accessors/UlongAccessor.cs b/Runtime/Components/Accessors/UlongAccessor.cs new file mode 100644 index 0000000..c077b7d --- /dev/null +++ b/Runtime/Components/Accessors/UlongAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Ulong Accessor")] + public sealed class UlongAccessor : StructAccessor + { + [Serializable] + public sealed class UlongEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/UlongAccessor.cs.meta b/Runtime/Components/Accessors/UlongAccessor.cs.meta new file mode 100644 index 0000000..8d2bf6c --- /dev/null +++ b/Runtime/Components/Accessors/UlongAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a4f9af6a3fda40c699be00aa116563ca +timeCreated: 1590563683 \ No newline at end of file diff --git a/Runtime/Components/Accessors/UshortAccessor.cs b/Runtime/Components/Accessors/UshortAccessor.cs new file mode 100644 index 0000000..fc7b023 --- /dev/null +++ b/Runtime/Components/Accessors/UshortAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Ushort Accessor")] + public sealed class UshortAccessor : StructAccessor + { + [Serializable] + public sealed class UshortEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/UshortAccessor.cs.meta b/Runtime/Components/Accessors/UshortAccessor.cs.meta new file mode 100644 index 0000000..a08062a --- /dev/null +++ b/Runtime/Components/Accessors/UshortAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 99f1515b5da44e4490cb87b9076c8643 +timeCreated: 1590563731 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Vector2Accessor.cs b/Runtime/Components/Accessors/Vector2Accessor.cs new file mode 100644 index 0000000..8089a5e --- /dev/null +++ b/Runtime/Components/Accessors/Vector2Accessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Vector2 Accessor")] + public sealed class Vector2Accessor : StructAccessor + { + [Serializable] + public sealed class Vector2Event : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/Vector2Accessor.cs.meta b/Runtime/Components/Accessors/Vector2Accessor.cs.meta new file mode 100644 index 0000000..1aa8902 --- /dev/null +++ b/Runtime/Components/Accessors/Vector2Accessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: adee0c6941f7496c822943b8fa073298 +timeCreated: 1590563768 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Vector2IntAccessor.cs b/Runtime/Components/Accessors/Vector2IntAccessor.cs new file mode 100644 index 0000000..c01f362 --- /dev/null +++ b/Runtime/Components/Accessors/Vector2IntAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Vector2 Int Accessor")] + public sealed class Vector2IntAccessor : StructAccessor + { + [Serializable] + public sealed class Vector2IntEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/Vector2IntAccessor.cs.meta b/Runtime/Components/Accessors/Vector2IntAccessor.cs.meta new file mode 100644 index 0000000..34ae1c9 --- /dev/null +++ b/Runtime/Components/Accessors/Vector2IntAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 73877eb6d2274348bb96248f2247f6b6 +timeCreated: 1590563800 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Vector3Accessor.cs b/Runtime/Components/Accessors/Vector3Accessor.cs new file mode 100644 index 0000000..31caf5e --- /dev/null +++ b/Runtime/Components/Accessors/Vector3Accessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Vector3 Accessor")] + public sealed class Vector3Accessor : StructAccessor + { + [Serializable] + public sealed class Vector3Event : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/Vector3Accessor.cs.meta b/Runtime/Components/Accessors/Vector3Accessor.cs.meta new file mode 100644 index 0000000..b0b7095 --- /dev/null +++ b/Runtime/Components/Accessors/Vector3Accessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f770347900f048f2a97d47c55e8732af +timeCreated: 1590563834 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Vector3IntAccessor.cs b/Runtime/Components/Accessors/Vector3IntAccessor.cs new file mode 100644 index 0000000..2464fbe --- /dev/null +++ b/Runtime/Components/Accessors/Vector3IntAccessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Vector3 Int Accessor")] + public sealed class Vector3IntAccessor : StructAccessor + { + [Serializable] + public sealed class Vector3IntEvent : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/Vector3IntAccessor.cs.meta b/Runtime/Components/Accessors/Vector3IntAccessor.cs.meta new file mode 100644 index 0000000..05d1ffc --- /dev/null +++ b/Runtime/Components/Accessors/Vector3IntAccessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c0598706e42c4e78bf4b69060b9f386b +timeCreated: 1590563866 \ No newline at end of file diff --git a/Runtime/Components/Accessors/Vector4Accessor.cs b/Runtime/Components/Accessors/Vector4Accessor.cs new file mode 100644 index 0000000..67649a2 --- /dev/null +++ b/Runtime/Components/Accessors/Vector4Accessor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using UnityEngine.Events; + +namespace Zor.SimpleBlackboard.Components.Accessors +{ + [AddComponentMenu(AddComponentConstants.AccessorsFolder + "Vector4 Accessor")] + public sealed class Vector4Accessor : StructAccessor + { + [Serializable] + public sealed class Vector4Event : UnityEvent + { + } + } +} diff --git a/Runtime/Components/Accessors/Vector4Accessor.cs.meta b/Runtime/Components/Accessors/Vector4Accessor.cs.meta new file mode 100644 index 0000000..12a2241 --- /dev/null +++ b/Runtime/Components/Accessors/Vector4Accessor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3b93c7a9645d4c4c88395228aec99253 +timeCreated: 1590563927 \ No newline at end of file diff --git a/Runtime/Components/AddComponentConstants.cs b/Runtime/Components/AddComponentConstants.cs new file mode 100644 index 0000000..c4b17c6 --- /dev/null +++ b/Runtime/Components/AddComponentConstants.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Components +{ + public static class AddComponentConstants + { + public const string SimpleBlackboardFolder = "Simple Blackboard/"; + public const string AccessorsFolder = SimpleBlackboardFolder + "Accessors/"; + public const string AccessorFlushersFolder = SimpleBlackboardFolder + "Accessor Flushers/"; + } +} diff --git a/Runtime/Components/AddComponentConstants.cs.meta b/Runtime/Components/AddComponentConstants.cs.meta new file mode 100644 index 0000000..9168fe0 --- /dev/null +++ b/Runtime/Components/AddComponentConstants.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b599885cbb0240e6bbe4c58466103897 +timeCreated: 1590316784 \ No newline at end of file diff --git a/Runtime/Components/BlackboardContainer.cs b/Runtime/Components/BlackboardContainer.cs new file mode 100644 index 0000000..58c95f7 --- /dev/null +++ b/Runtime/Components/BlackboardContainer.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Zor.SimpleBlackboard.Debugging; +using Zor.SimpleBlackboard.Serialization; + +namespace Zor.SimpleBlackboard.Components +{ + /// + /// Container of for using that as + /// . + /// + [AddComponentMenu(AddComponentConstants.SimpleBlackboardFolder + "Blackboard Container")] + public sealed class BlackboardContainer : MonoBehaviour + { +#pragma warning disable CS0649 + [SerializeField, Tooltip("Array of serialized properties for Blackboard.\nIt is applied to Blackboard only on Awake.")] + private SerializedContainer[] m_SerializedContainers; +#pragma warning restore CS0649 + + private Blackboard m_blackboard; + + public Blackboard blackboard => m_blackboard; + + private void Awake() + { + m_blackboard = new Blackboard(); + + for (int i = 0, count = m_SerializedContainers.Length; i < count; ++i) + { + SerializedContainer container = m_SerializedContainers[i]; + + if (container == null) + { + BlackboardDebug.LogWarning($"[BlackboardContainer] SerializedContainer at index '{i}' is null", this); + continue; + } + + container.Apply(blackboard); + } + } + + [ContextMenu("Log")] + private void Log() + { + UnityEngine.Debug.Log(m_blackboard.ToString(), this); + } + } +} diff --git a/Runtime/Components/BlackboardContainer.cs.meta b/Runtime/Components/BlackboardContainer.cs.meta new file mode 100644 index 0000000..a1d1266 --- /dev/null +++ b/Runtime/Components/BlackboardContainer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27052f068f6efaa4b9da00b91fa69be0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: -10000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Components/BlackboardPropertyReference.cs b/Runtime/Components/BlackboardPropertyReference.cs new file mode 100644 index 0000000..7006c96 --- /dev/null +++ b/Runtime/Components/BlackboardPropertyReference.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; + +namespace Zor.SimpleBlackboard.Components +{ + /// + /// Useful serializable struct for referencing a property in + /// in . + /// + /// + /// Usually it's used in . + /// + [Serializable] + public struct BlackboardPropertyReference + { +#pragma warning disable CS0649 + public BlackboardContainer blackboardContainer; + public string propertyName; +#pragma warning restore CS0649 + } +} diff --git a/Runtime/Components/BlackboardPropertyReference.cs.meta b/Runtime/Components/BlackboardPropertyReference.cs.meta new file mode 100644 index 0000000..9b4e096 --- /dev/null +++ b/Runtime/Components/BlackboardPropertyReference.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e5a083fda10c46f0b0a36b3340dc4965 +timeCreated: 1590313171 \ No newline at end of file diff --git a/Runtime/Core.meta b/Runtime/Core.meta new file mode 100644 index 0000000..4c53ce6 --- /dev/null +++ b/Runtime/Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e7938a0aef25ad41b3c7d91c0dfa4b4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Core/Blackboard.cs b/Runtime/Core/Blackboard.cs new file mode 100644 index 0000000..1837ff8 --- /dev/null +++ b/Runtime/Core/Blackboard.cs @@ -0,0 +1,1005 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using System.Text; +using JetBrains.Annotations; +using UnityEngine.Profiling; +using Zor.SimpleBlackboard.Debugging; + +namespace Zor.SimpleBlackboard.Core +{ + /// + /// The main class of the Blackboard system. + /// + public sealed class Blackboard + { + /// + /// Value type to table of that type dictionary. + /// + private readonly Dictionary m_tables = new Dictionary(); + /// + /// Property name to value type of that property dictionary. + /// + private readonly Dictionary m_propertyTypes = + new Dictionary(); + + /// + /// How many value types are contained in the . + /// + public int valueTypesCount => m_tables.Count; + + /// + /// How many properties are contained in the . + /// + public int propertiesCount => m_propertyTypes.Count; + + /// + /// Tries to get and return a value of the struct type + /// and the property name . + /// + /// Name of the value property to get. + /// If the property is found, this contains its value; otherwise + /// this contains default value. + /// Struct type of the value to get. + /// True if the property is found; false otherwise. + /// + /// + /// + public bool TryGetStructValue(BlackboardPropertyName propertyName, out T value) where T : struct + { + Profiler.BeginSample("Blackboard.TryGetStructValue"); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType) + || currentType != typeof(T)) + { + value = default; + + Profiler.EndSample(); + + return false; + } + + var table = (BlackboardTable)m_tables[currentType]; + value = table.GetValue(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Tries to get and return a value of the class type + /// and the property name . + /// + /// Name of the value property to get. + /// If the property is found, this contains its value; otherwise + /// this contains default value. + /// Class type of the value to get. + /// True if the property is found; false otherwise. + /// This method supports derivation. + /// + /// + /// + public bool TryGetClassValue(BlackboardPropertyName propertyName, out T value) where T : class + { + Profiler.BeginSample("Blackboard.TryGetClassValue"); + + bool answer = TryGetObjectValue(typeof(T), propertyName, out object objectValue); + value = objectValue as T; + + Profiler.EndSample(); + + return answer; + } + + /// + /// Tries to get and return a value of the type + /// and the property name . + /// + /// Type of the value to get. + /// Name of the value property to get. + /// If the property is found, this contains its value; otherwise + /// this contains default value. + /// True if the property is found; false otherwise. + /// This method supports derivation. + /// + /// + /// + public bool TryGetObjectValue([NotNull] Type valueType, BlackboardPropertyName propertyName, out object value) + { + Profiler.BeginSample("Blackboard.TryGetObjectValue typed"); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType) + || !valueType.IsAssignableFrom(currentType)) + { + value = default; + + Profiler.EndSample(); + + return false; + } + + IBlackboardTable table = m_tables[currentType]; + value = table.GetObjectValue(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Tries to get and return a value of the property name . + /// + /// Name of the value property to get. + /// If the property is found, this contains its value; otherwise + /// this contains default value. + /// True if the property is found; false otherwise. + /// + /// + /// + public bool TryGetObjectValue(BlackboardPropertyName propertyName, out object value) + { + Profiler.BeginSample("Blackboard.TryGetObjectValue"); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType)) + { + value = default; + + Profiler.EndSample(); + + return false; + } + + IBlackboardTable table = m_tables[currentType]; + value = table.GetObjectValue(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Sets the value of the struct type + /// and the property name . + /// + /// Name of the value property to set. + /// Value to set. + /// Struct value type to set. + /// This method allocates if a property of the type is set first + /// or when the internal table resizes. + /// + /// + public void SetStructValue(BlackboardPropertyName propertyName, T value) where T : struct + { + Profiler.BeginSample("Blackboard.SetStructValue"); + + Type newType = typeof(T); + BlackboardTable table; + + BlackboardDebug.LogDetails($"[Blackboard] Set struct value '{value}' of type '{newType.FullName}' into property '{propertyName}'"); + + if (m_propertyTypes.TryGetValue(propertyName, out Type currentType)) + { + if (currentType == newType) + { + table = (BlackboardTable)m_tables[newType]; + } + else + { + m_tables[currentType].Remove(propertyName); + m_propertyTypes[propertyName] = newType; + table = GetOrCreateTable(); + } + } + else + { + m_propertyTypes[propertyName] = newType; + table = GetOrCreateTable(); + } + + table.SetValue(propertyName, value); + + Profiler.EndSample(); + } + + /// + /// Sets the value of the class type + /// and the property name . + /// + /// Name of the value property to set. + /// Value to set. + /// Class value type to set. + /// This method allocates if a property of the type is set first + /// or when the internal table resizes. + /// + /// If the contains a property of the property name , + /// it replaces that property with the new one. + /// + /// + /// + public void SetClassValue(BlackboardPropertyName propertyName, [CanBeNull] T value) where T : class + { + Profiler.BeginSample("Blackboard.SetClassValue"); + + Type valueType = value == null ? typeof(T) : value.GetType(); + IBlackboardTable table; + + BlackboardDebug.LogDetails($"[Blackboard] Set class value '{value}' of type '{valueType.FullName}' into property '{propertyName}'"); + + if (m_propertyTypes.TryGetValue(propertyName, out Type currentType)) + { + if (currentType == valueType) + { + table = m_tables[valueType]; + } + else + { + m_tables[currentType].Remove(propertyName); + m_propertyTypes[propertyName] = valueType; + table = GetOrCreateTable(valueType); + } + } + else + { + m_propertyTypes[propertyName] = valueType; + table = GetOrCreateTable(valueType); + } + + table.SetObjectValue(propertyName, value); + + Profiler.EndSample(); + } + + /// + /// Sets the value of the type + /// and the property name . + /// + /// Value type to set. + /// Name of the value property to set. + /// Value to set. + /// + /// This method allocates if a property of the type is set first + /// or when the internal table resizes. + /// If the contains a property of the property name , + /// it replaces that property with the new one. + /// + /// + /// + public void SetObjectValue([NotNull] Type valueType, BlackboardPropertyName propertyName, + [CanBeNull] object value) + { + Profiler.BeginSample("Blackboard.SetObjectValue"); + + if (value != null) + { + valueType = value.GetType(); + } + + IBlackboardTable table; + + BlackboardDebug.LogDetails($"[Blackboard] Set object value '{value}' of type '{valueType.FullName}' into property '{propertyName}'"); + + if (m_propertyTypes.TryGetValue(propertyName, out Type currentType)) + { + if (currentType == valueType) + { + table = m_tables[valueType]; + } + else + { + m_tables[currentType].Remove(propertyName); + m_propertyTypes[propertyName] = valueType; + table = GetOrCreateTable(valueType); + } + } + else + { + m_propertyTypes[propertyName] = valueType; + table = GetOrCreateTable(valueType); + } + + table.SetObjectValue(propertyName, value); + + Profiler.EndSample(); + } + + /// + /// Gets all properties of the struct type + /// and adds them to . + /// + /// Found properties are added to this. + /// Struct value type of the properties to add. + /// + /// + /// + public void GetStructProperties([NotNull] List> properties) + where T : struct + { + Profiler.BeginSample("Blackboard.GetStructProperties"); + + if (m_tables.TryGetValue(typeof(T), out IBlackboardTable table)) + { + var typedTable = (BlackboardTable)table; + typedTable.GetProperties(properties); + } + + Profiler.EndSample(); + } + + /// + /// Gets all properties of the class type + /// and adds them to . + /// + /// Found properties are added to this. + /// Class value type of the properties to add. + /// + /// + /// + public void GetClassProperties([NotNull] List> properties) + where T : class + { + Profiler.BeginSample("Blackboard.GetClassProperties"); + + Type valueType = typeof(T); + + Dictionary.Enumerator enumerator = m_tables.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + + if (valueType.IsAssignableFrom(current.Key)) + { + current.Value.GetPropertiesAs(properties); + } + } + enumerator.Dispose(); + + Profiler.EndSample(); + } + + /// + /// Gets all properties of the type + /// and adds them to . + /// + /// Value type of the properties to add. + /// Found properties are added to this. + /// + /// + /// + public void GetObjectProperties([NotNull] Type valueType, + [NotNull] List> properties) + { + Profiler.BeginSample("Blackboard.GetObjectProperties typed"); + + Dictionary.Enumerator enumerator = m_tables.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + + if (valueType.IsAssignableFrom(current.Key)) + { + current.Value.GetProperties(properties); + } + } + enumerator.Dispose(); + + Profiler.EndSample(); + } + + /// + /// Gets all properties and adds them to . + /// + /// Properties are added to this. + /// + /// + /// + public void GetObjectProperties([NotNull] List> properties) + { + Profiler.BeginSample("Blackboard.GetObjectProperties"); + + Dictionary.ValueCollection.Enumerator enumerator = m_tables.Values.GetEnumerator(); + while (enumerator.MoveNext()) + { + enumerator.Current.GetProperties(properties); + } + enumerator.Dispose(); + + Profiler.EndSample(); + } + + /// + /// Gets all value types contained in the + /// and adds them to . + /// + /// Found value types are added to this. + public void GetValueTypes([NotNull] List valueTypes) + { + Profiler.BeginSample("Blackboard.GetValueTypes"); + + valueTypes.AddRange(m_tables.Keys); + + Profiler.EndSample(); + } + + /// + /// Checks if the contains a property of + /// the property name and the struct type . + /// + /// Name of the value property to find. + /// Struct value type. + /// + /// True if the property is contained in the ; false otherwise. + /// + /// + /// + /// + public bool ContainsStructValue(BlackboardPropertyName propertyName) where T : struct + { + Profiler.BeginSample("Blackboard.ContainsStructValue"); + + bool answer = m_propertyTypes.TryGetValue(propertyName, out Type currentType) && currentType == typeof(T); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains a property of + /// the property name and the type . + /// + /// Name of the value property to find. + /// Value type. + /// + /// True if the property is contained in the ; false otherwise. + /// + /// + /// + /// + public bool ContainsObjectValue(BlackboardPropertyName propertyName) + { + Profiler.BeginSample("Blackboard.ContainsObjectValue"); + + bool answer = m_propertyTypes.TryGetValue(propertyName, out Type currentType) + && typeof(T).IsAssignableFrom(currentType); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains a property of + /// the property name and the type . + /// + /// Value type. + /// Name of the value property to find. + /// + /// True if the property is contained in the ; false otherwise. + /// + /// + /// + /// + public bool ContainsObjectValue([NotNull] Type valueType, BlackboardPropertyName propertyName) + { + Profiler.BeginSample("Blackboard.ContainsObjectValue typed"); + + bool answer = m_propertyTypes.TryGetValue(propertyName, out Type currentType) + && valueType.IsAssignableFrom(currentType); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains a property of + /// the property name . + /// + /// Name of the value property to find. + /// + /// True if the property is contained in the ; false otherwise. + /// + /// + /// + /// + public bool ContainsObjectValue(BlackboardPropertyName propertyName) + { + Profiler.BeginSample("Blackboard.ConstainsObjectValue"); + + bool answer = m_propertyTypes.ContainsKey(propertyName); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains or contained + /// a property of the type . + /// + /// Value type. + /// + /// True if the property is or was contained in the ; false otherwise. + /// + /// + /// This method doesn't support derivation. + /// + /// + /// + /// + public bool ContainsType() + { + Profiler.BeginSample("Blackboard.ContainsType"); + + bool answer = m_tables.ContainsKey(typeof(T)); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains or contained + /// a property of the type . + /// + /// Value type. + /// + /// True if the property is or was contained in the ; false otherwise. + /// + /// + /// This method doesn't support derivation. + /// + /// + /// + /// + public bool ContainsType([NotNull] Type valueType) + { + Profiler.BeginSample("Blackboard.ContainsType"); + + bool answer = m_tables.ContainsKey(valueType); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains or contained + /// a property of the type . + /// + /// Value type. + /// + /// True if the property is or was contained in the ; false otherwise. + /// + /// + /// + /// + public bool ContainsInheritingType() + { + Profiler.BeginSample("Blackboard.ContainsInheritingType"); + + bool answer = ContainsInheritingType(typeof(T)); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Checks if the contains or contained + /// a property of the type . + /// + /// Value type. + /// + /// True if the property is or was contained in the ; false otherwise. + /// + /// + /// + /// + public bool ContainsInheritingType([NotNull] Type valueType) + { + Profiler.BeginSample("Blackboard.ContainsInheritingType"); + + bool answer = false; + + Dictionary.KeyCollection.Enumerator enumerator = m_tables.Keys.GetEnumerator(); + while (enumerator.MoveNext() && !answer) + { + answer = valueType.IsAssignableFrom(enumerator.Current); + } + enumerator.Dispose(); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Gets how many properties of the type are contained in the . + /// + /// Value type. + /// + /// How many values of the type + /// are contained in the . + /// -1 if the doesn't contain a value + /// of the type . + /// + /// + /// This method doesn't support derivation. + /// + /// + /// + /// + public int GetCount() + { + Profiler.BeginSample("Blackboard.GetCount"); + + int answer = m_tables.TryGetValue(typeof(T), out IBlackboardTable table) + ? ((BlackboardTable)table).count + : -1; + + Profiler.EndSample(); + + return answer; + } + + /// + /// Gets how many properties of the type + /// are contained in the . + /// + /// Value type. + /// + /// How many values of the type + /// are contained in the . + /// -1 if the doesn't contain a value + /// of the type . + /// + /// + /// This method doesn't support derivation. + /// + /// + /// + /// + public int GetCount([NotNull] Type valueType) + { + Profiler.BeginSample("Blackboard.GetCount"); + + int answer = m_tables.TryGetValue(valueType, out IBlackboardTable table) + ? table.count + : -1; + + Profiler.EndSample(); + + return answer; + } + + /// + /// Gets how many properties of the type are contained in the . + /// + /// Value type. + /// + /// How many values of the type + /// are contained in the . + /// -1 if the doesn't contain a value + /// of the type . + /// + /// + /// + /// + public int GetCountWithInheritors() + { + Profiler.BeginSample("Blackboard.GetCountWithInheritors"); + + int answer = GetCountWithInheritors(typeof(T)); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Gets how many properties of the type + /// are contained in the . + /// + /// Value type. + /// + /// How many values of the type + /// are contained in the . + /// -1 if the doesn't contain a value + /// of the type . + /// + /// + /// + /// + public int GetCountWithInheritors([NotNull] Type valueType) + { + Profiler.BeginSample("Blackboard.GetCountWithInheritors"); + + bool found = false; + int count = 0; + + Dictionary.Enumerator enumerator = m_tables.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + + if (valueType.IsAssignableFrom(current.Key)) + { + found = true; + count += current.Value.count; + } + } + enumerator.Dispose(); + + int answer = found ? count : -1; + + Profiler.EndSample(); + + return answer; + } + + /// + /// Removes a property of the property name + /// and the struct type . + /// + /// Name of the property to remove. + /// Struct value type. + /// True if the property is removed; false if it doesn't exist. + /// + /// + /// + public bool RemoveStruct(BlackboardPropertyName propertyName) where T : struct + { + Profiler.BeginSample("Blackboard.RemoveStruct"); + + Type valueType = typeof(T); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType) + || currentType != valueType) + { + Profiler.EndSample(); + + return false; + } + + BlackboardDebug.LogDetails($"[Blackboard] Remove struct of type '{valueType.FullName}' from property '{propertyName}'"); + + m_propertyTypes.Remove(propertyName); + var typedTable = (BlackboardTable)m_tables[currentType]; + typedTable.Remove(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Removes a property of the property name and + /// the type . + /// + /// Name of the property to remove. + /// Value type. + /// True if the property is removed; false if it doesn't exist. + /// + /// + /// + public bool RemoveObject(BlackboardPropertyName propertyName) + { + Profiler.BeginSample("Blackboard.RemoveObject"); + + Type valueType = typeof(T); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType) + || !valueType.IsAssignableFrom(currentType)) + { + Profiler.EndSample(); + + return false; + } + + BlackboardDebug.LogDetails($"[Blackboard] Remove object of type '{valueType.FullName}' from property '{propertyName}'"); + + m_propertyTypes.Remove(propertyName); + m_tables[currentType].Remove(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Removes a property of the property name + /// and the type . + /// + /// Value type. + /// Name of the property to remove. + /// True if the property is removed; false if it doesn't exist. + /// + /// + /// + public bool RemoveObject([NotNull] Type valueType, BlackboardPropertyName propertyName) + { + Profiler.BeginSample("Blackboard.RemoveObject typed"); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType) + || !valueType.IsAssignableFrom(currentType)) + { + Profiler.EndSample(); + + return false; + } + + BlackboardDebug.LogDetails($"[Blackboard] Remove object of type '{valueType.FullName}' from property '{propertyName}'"); + + m_propertyTypes.Remove(propertyName); + m_tables[currentType].Remove(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Removes a property of the property name . + /// + /// Name of the property to remove. + /// True if the property is removed; false if it doesn't exist. + /// + /// + /// + public bool RemoveObject(BlackboardPropertyName propertyName) + { + Profiler.BeginSample("Blackboard.RemoveObject"); + + if (!m_propertyTypes.TryGetValue(propertyName, out Type currentType)) + { + Profiler.EndSample(); + + return false; + } + + BlackboardDebug.LogDetails($"[Blackboard] Remove object from property {propertyName}"); + + m_propertyTypes.Remove(propertyName); + m_tables[currentType].Remove(propertyName); + + Profiler.EndSample(); + + return true; + } + + /// + /// Clears of all properties. + /// + public void Clear() + { + Profiler.BeginSample("Blackboard.Clear"); + + BlackboardDebug.LogDetails("[Blackboard] Clear"); + + m_propertyTypes.Clear(); + + Dictionary.ValueCollection.Enumerator enumerator = m_tables.Values.GetEnumerator(); + while (enumerator.MoveNext()) + { + enumerator.Current.Clear(); + } + enumerator.Dispose(); + + Profiler.EndSample(); + } + + public override string ToString() + { + var builder = new StringBuilder(); + + Dictionary.Enumerator enumerator = m_tables.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + builder.Append($"{{{current.Key.FullName}, {current.Value}}},\n"); + } + enumerator.Dispose(); + + int builderLength = builder.Length; + int length = builderLength >= 2 ? builderLength - 2 : 0; + + return builder.ToString(0, length); + } + + /// + /// Creates a new table of the type and adds it to . + /// + /// Value type. + /// Created table. + /// + [NotNull] + private BlackboardTable CreateTable() + { + Profiler.BeginSample("Blackboard.CreateTable"); + + Type valueType = typeof(T); + + BlackboardDebug.Log($"[Blackboard] Create blackboard table of type '{valueType.FullName}'"); + + var table = new BlackboardTable(); + m_tables.Add(valueType, table); + + Profiler.EndSample(); + + return table; + } + + /// + /// Creates a new table of the type and adds it to . + /// + /// Value type. + /// Created table. + /// If it's possible, use because this method is more expensive. + /// + [NotNull] + private IBlackboardTable CreateTable([NotNull] Type valueType) + { + Profiler.BeginSample("Blackboard.CreateTable"); + + Type tableType = typeof(BlackboardTable<>).MakeGenericType(valueType); + + BlackboardDebug.Log($"[Blackboard] Create blackboard table of type '{valueType.FullName}'"); + + var table = (IBlackboardTable)Activator.CreateInstance(tableType); + m_tables.Add(valueType, table); + + Profiler.EndSample(); + + return table; + } + + /// + /// Creates a new table of the type and adds it to + /// or returns a current table if it exists. + /// + /// Value type. + /// Created or existing table. + /// + [NotNull] + private BlackboardTable GetOrCreateTable() + { + Profiler.BeginSample("Blackboard.GetOrCreateTable"); + + BlackboardTable answer = m_tables.TryGetValue(typeof(T), out IBlackboardTable table) + ? (BlackboardTable)table + : CreateTable(); + + Profiler.EndSample(); + + return answer; + } + + /// + /// Creates a new table of the type and adds it to + /// or returns a current table if it exists. + /// + /// Value type. + /// Created or existing table. + /// + /// If it's possible, use because this method is more expensive. + /// + /// + [NotNull] + private IBlackboardTable GetOrCreateTable([NotNull] Type valueType) + { + Profiler.BeginSample("Blackboard.GetOrCreateTable"); + + if (!m_tables.TryGetValue(valueType, out IBlackboardTable table)) + { + table = CreateTable(valueType); + } + + Profiler.EndSample(); + + return table; + } + } +} diff --git a/Runtime/Core/Blackboard.cs.meta b/Runtime/Core/Blackboard.cs.meta new file mode 100644 index 0000000..1e2dc74 --- /dev/null +++ b/Runtime/Core/Blackboard.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0688861a08349f241b7fc1d5e58fa92a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Core/BlackboardPropertyName.cs b/Runtime/Core/BlackboardPropertyName.cs new file mode 100644 index 0000000..8584dfc --- /dev/null +++ b/Runtime/Core/BlackboardPropertyName.cs @@ -0,0 +1,101 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using JetBrains.Annotations; + +namespace Zor.SimpleBlackboard.Core +{ + /// + /// Wrapper over transforming it into for faster comparisons. + /// + /// + /// It's used in . + /// + public readonly struct BlackboardPropertyName : IEquatable + { + /// + /// Dictionary of all unique strings that were used in + /// to their ids. + /// + private static readonly Dictionary s_nameIds = new Dictionary(100); + /// + /// List of all unique strings that were used in . + /// + private static readonly List s_names = new List(100); + + /// + /// Unique per string id. + /// + public readonly int id; + + /// + /// Creates a with unique per . + /// + /// For this, unique is set. + public BlackboardPropertyName([NotNull] string name) + { + if (!s_nameIds.TryGetValue(name, out id)) + { + id = s_names.Count; + s_nameIds.Add(name, id); + s_names.Add(name); + } + } + + /// + /// Creates a with the specified . + /// + /// Id to set. + public BlackboardPropertyName(int id) + { + this.id = id; + } + + /// + /// Name of the property. + /// + /// + /// + /// Original string name of the property if the was created + /// with . + /// + /// + /// If the was created with , + /// this may return or a name if another + /// was created with and got the same . + /// + /// + public string name => id >= 0 && id < s_names.Count ? s_names[id] : string.Empty; + + public override bool Equals(object obj) + { + return obj is BlackboardPropertyName other && other.id == id; + } + + public bool Equals(BlackboardPropertyName other) + { + return other.id == id; + } + + public override int GetHashCode() + { + return id; + } + + public override string ToString() + { + return $"{id.ToString()}({name})"; + } + + public static bool operator ==(BlackboardPropertyName lhs, BlackboardPropertyName rhs) + { + return lhs.id == rhs.id; + } + + public static bool operator !=(BlackboardPropertyName lhs, BlackboardPropertyName rhs) + { + return lhs.id != rhs.id; + } + } +} diff --git a/Runtime/Core/BlackboardPropertyName.cs.meta b/Runtime/Core/BlackboardPropertyName.cs.meta new file mode 100644 index 0000000..b5c3904 --- /dev/null +++ b/Runtime/Core/BlackboardPropertyName.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f450b363abdd634da96eeb05bdf2de0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Core/BlackboardTable.cs b/Runtime/Core/BlackboardTable.cs new file mode 100644 index 0000000..b2e3082 --- /dev/null +++ b/Runtime/Core/BlackboardTable.cs @@ -0,0 +1,132 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using System.Text; +using JetBrains.Annotations; + +namespace Zor.SimpleBlackboard.Core +{ + /// + /// Entry of . A + /// contains values of the type . + /// + /// Value type. + internal sealed class BlackboardTable : IBlackboardTable + { + /// + /// Property names to values dictionary. + /// + private readonly Dictionary m_table = new Dictionary(); + + /// + /// Type of values that are contained in the . + /// + public Type valueType => typeof(T); + + /// + /// How many values are contained in the . + /// + public int count => m_table.Count; + + /// + /// Gets a value of the property name . + /// + /// Name of the property to get. + /// Gotten value. + public T GetValue(BlackboardPropertyName propertyName) + { + return m_table[propertyName]; + } + + /// + public object GetObjectValue(BlackboardPropertyName propertyName) + { + return m_table[propertyName]; + } + + /// + /// Sets the value of the property name + /// + /// Name of the property to set. + /// Set value. + public void SetValue(BlackboardPropertyName propertyName, T value) + { + m_table[propertyName] = value; + } + + /// + public void SetObjectValue(BlackboardPropertyName propertyName, object value) + { + m_table[propertyName] = value is T typedValue + ? typedValue + : default; + } + + /// + /// Gets all properties and adds them to . + /// + /// Properties are added to this. + /// + public void GetProperties([NotNull] List> properties) + { + properties.AddRange(m_table); + } + + /// + /// + public void GetProperties(List> properties) + { + Dictionary.Enumerator enumerator = m_table.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + properties.Add(new KeyValuePair(current.Key, current.Value)); + } + enumerator.Dispose(); + } + + /// + public void GetPropertiesAs(List> properties) + where TAs : class + { + Dictionary.Enumerator enumerator = m_table.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + properties.Add(new KeyValuePair(current.Key, current.Value as TAs)); + } + enumerator.Dispose(); + } + + /// + public bool Remove(BlackboardPropertyName propertyName) + { + return m_table.Remove(propertyName); + } + + /// + public void Clear() + { + m_table.Clear(); + } + + public override string ToString() + { + var builder = new StringBuilder(); + + Dictionary.Enumerator enumerator = m_table.GetEnumerator(); + while (enumerator.MoveNext()) + { + KeyValuePair current = enumerator.Current; + builder.Append($"[{current.Key.ToString()}, {current.Value.ToString()}], "); + } + enumerator.Dispose(); + + int builderLength = builder.Length; + int length = builderLength >= 2 ? builderLength - 2 : 0; + + return builder.ToString(0, length); + } + } +} diff --git a/Runtime/Core/BlackboardTable.cs.meta b/Runtime/Core/BlackboardTable.cs.meta new file mode 100644 index 0000000..60c7408 --- /dev/null +++ b/Runtime/Core/BlackboardTable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 34fd9f2a42614884adb5bb8e9560c7aa +timeCreated: 1587973190 \ No newline at end of file diff --git a/Runtime/Core/IBlackboardTable.cs b/Runtime/Core/IBlackboardTable.cs new file mode 100644 index 0000000..4c3bfbb --- /dev/null +++ b/Runtime/Core/IBlackboardTable.cs @@ -0,0 +1,63 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using JetBrains.Annotations; + +namespace Zor.SimpleBlackboard.Core +{ + internal interface IBlackboardTable + { + /// + /// Type of values that are contained in the . + /// + [NotNull] + Type valueType { get; } + + /// + /// How many values are contained in the . + /// + int count { get; } + + /// + /// Gets a value of the property name + /// + /// Name of the property to get. + /// Gotten value. + object GetObjectValue(BlackboardPropertyName propertyName); + + /// + /// Sets the value of the property name . + /// + /// Name of the property to set. + /// Value to set. + void SetObjectValue(BlackboardPropertyName propertyName, object value); + + /// + /// Gets all properties and adds them to . + /// + /// Properties are added to this. + void GetProperties([NotNull] List> properties); + + /// + /// Gets all properties, casts their values to and + /// adds them to . + /// + /// Properties are added to this. + /// Cast value type. + void GetPropertiesAs([NotNull] List> properties) + where TAs : class; + + /// + /// Removes a property of the . + /// + /// Name of the property to remove. + /// True if the property is removed; false if it doesn't exist. + bool Remove(BlackboardPropertyName propertyName); + + /// + /// Clears of all properties. + /// + void Clear(); + } +} diff --git a/Runtime/Core/IBlackboardTable.cs.meta b/Runtime/Core/IBlackboardTable.cs.meta new file mode 100644 index 0000000..951a02f --- /dev/null +++ b/Runtime/Core/IBlackboardTable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 980fda878b104356941bd687c070cae4 +timeCreated: 1587973177 \ No newline at end of file diff --git a/Runtime/Debug.meta b/Runtime/Debug.meta new file mode 100644 index 0000000..a16e47c --- /dev/null +++ b/Runtime/Debug.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f85fd2c8013f4fbf8cb00540dff3fe98 +timeCreated: 1591521784 \ No newline at end of file diff --git a/Runtime/Debug/BlackboardDebug.cs b/Runtime/Debug/BlackboardDebug.cs new file mode 100644 index 0000000..29096f2 --- /dev/null +++ b/Runtime/Debug/BlackboardDebug.cs @@ -0,0 +1,54 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System.Diagnostics; +using UnityEngine; + +namespace Zor.SimpleBlackboard.Debugging +{ + /// + /// Class for logging the blackboard system. + /// + public static class BlackboardDebug + { + /// + /// This define allows to log every change of the blackboard system. It can be too extensive. Use it only if + /// you have problems in the blackboard system and don't understand an origin of them at all. + /// + public const string LogDetailsDefine = "SIMPLE_BLACKBOARD_LOG_DETAILS"; + public const string LogDefine = "SIMPLE_BLACKBOARD_LOG"; + public const string WarningDefine = "SIMPLE_BLACKBOARD_LOG_WARNING"; + public const string ErrorDefine = "SIMPLE_BLACKBOARD_LOG_ERROR"; + + private const string Format = "[SimpleBlackboard] {0}."; + + [Conditional(LogDetailsDefine)] + internal static void LogDetails(string message) + { + UnityEngine.Debug.LogFormat(Format, message); + } + + [Conditional(LogDefine)] + internal static void Log(string message) + { + UnityEngine.Debug.LogFormat(Format, message); + } + + [Conditional(WarningDefine)] + internal static void LogWarning(string message) + { + UnityEngine.Debug.LogWarningFormat(Format, message); + } + + [Conditional(WarningDefine)] + internal static void LogWarning(string message, Object context) + { + UnityEngine.Debug.LogWarningFormat(context, Format, message); + } + + [Conditional(ErrorDefine)] + internal static void LogError(string message) + { + UnityEngine.Debug.LogErrorFormat(Format, message); + } + } +} diff --git a/Runtime/Debug/BlackboardDebug.cs.meta b/Runtime/Debug/BlackboardDebug.cs.meta new file mode 100644 index 0000000..97a51d6 --- /dev/null +++ b/Runtime/Debug/BlackboardDebug.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8daa2ce85f3c4d4783098f1a427e2323 +timeCreated: 1591521849 \ No newline at end of file diff --git a/Runtime/Helpers.meta b/Runtime/Helpers.meta new file mode 100644 index 0000000..d06ec49 --- /dev/null +++ b/Runtime/Helpers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cdeb5205b198b1e48b5413e756c94f43 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Helpers/ListHelper.cs b/Runtime/Helpers/ListHelper.cs new file mode 100644 index 0000000..8cb986b --- /dev/null +++ b/Runtime/Helpers/ListHelper.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System.Collections.Generic; +using JetBrains.Annotations; +using UnityEngine; + +namespace Zor.SimpleBlackboard.Helpers +{ + internal static class ListHelper + { + public static void EnsureCapacity([NotNull] List list, int additionalCount) + { + int requiredCapacity = list.Count + additionalCount; + int currentCapacity = list.Capacity; + + if (currentCapacity >= requiredCapacity) + { + return; + } + + int num = currentCapacity == 0 ? 4 : currentCapacity * 2; + + if ((uint)num > 2146435071U) + { + num = 2146435071; + } + + if (num < requiredCapacity) + { + num = requiredCapacity; + } + + list.Capacity = num; + } + } +} diff --git a/Runtime/Helpers/ListHelper.cs.meta b/Runtime/Helpers/ListHelper.cs.meta new file mode 100644 index 0000000..d7bdd1e --- /dev/null +++ b/Runtime/Helpers/ListHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e5802f77603e6541b6445e2e154ffed +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization.meta b/Runtime/Serialization.meta new file mode 100644 index 0000000..b8b7456 --- /dev/null +++ b/Runtime/Serialization.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41413467e0fbc884197c6a2700b9edec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedContainer.cs b/Runtime/Serialization/SerializedContainer.cs new file mode 100644 index 0000000..aecfeb0 --- /dev/null +++ b/Runtime/Serialization/SerializedContainer.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Serialized container of properties for . + /// Inherit this if you want to get a custom functionality. + /// If you need a common functionality, inherit , + /// , + /// or . + /// + public abstract class SerializedContainer : ScriptableObject + { + /// + /// Applies its properties to . + /// + /// Applies its properties to this. + public abstract void Apply(Blackboard blackboard); + + /// + /// Gets keys and their types and adds them to . + /// + /// Keys are added to this. + public abstract void GetKeys(List<(string, Type)> keys); + } +} diff --git a/Runtime/Serialization/SerializedContainer.cs.meta b/Runtime/Serialization/SerializedContainer.cs.meta new file mode 100644 index 0000000..f5c1332 --- /dev/null +++ b/Runtime/Serialization/SerializedContainer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e00ac50788144d49bb7e73f7be9ea31 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables.meta b/Runtime/Serialization/SerializedTables.meta new file mode 100644 index 0000000..c7f13f2 --- /dev/null +++ b/Runtime/Serialization/SerializedTables.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee8ca610433d6a5499bf73c326c8e17f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs b/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs new file mode 100644 index 0000000..396db74 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Zor.SimpleBlackboard.Helpers; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Serialized table that has set keys and generates class values at runtime. + /// Inherit this class and override to get this functionality. + /// + /// Class type of the generated value. + public abstract class ClassGeneratedValueSerializedTable : GeneratedValueSerializedTable_Base where T : class + { +#pragma warning disable CS0649 + [SerializeField] private string[] m_Keys; +#pragma warning restore CS0649 + + /// + public sealed override Type valueType => typeof(T); + + /// + public sealed override void Apply(Blackboard blackboard) + { + for (int i = 0, count = m_Keys.Length; i < count; ++i) + { + blackboard.SetClassValue(new BlackboardPropertyName(m_Keys[i]), GetValue()); + } + } + + /// + public sealed override void GetKeys(List<(string, Type)> keys) + { + int count = m_Keys.Length; + ListHelper.EnsureCapacity(keys, count); + + for (int i = 0; i < count; ++i) + { + keys.Add((m_Keys[i], valueType)); + } + } + + /// + /// Gets a generated value. + /// + /// Generated value. + protected abstract T GetValue(); + } +} diff --git a/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs.meta new file mode 100644 index 0000000..ebec866 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/ClassGeneratedValueSerializedTable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 63fe2acb248f435caafe3f29c06947fa +timeCreated: 1590311046 \ No newline at end of file diff --git a/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs b/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs new file mode 100644 index 0000000..13ea4d0 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Zor.SimpleBlackboard.Helpers; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Serialized table that has set keys and class values. + /// Inherit this class to get this functionality. + /// + /// Class type of the value. + public abstract class ClassSerializedValueSerializedTable : SerializedValueSerializedTable_Base where T : class + { +#pragma warning disable CS0649 + [SerializeField] private string[] m_Keys; + [SerializeField] private T[] m_Values; +#pragma warning restore CS0649 + + /// + public sealed override Type valueType => typeof(T); + + /// + public sealed override void Apply(Blackboard blackboard) + { + for (int i = 0, count = Mathf.Min(m_Keys.Length, m_Values.Length); i < count; ++i) + { + blackboard.SetClassValue(new BlackboardPropertyName(m_Keys[i]), m_Values[i]); + } + } + + /// + public sealed override void GetKeys(List<(string, Type)> keys) + { + int count = m_Keys.Length; + ListHelper.EnsureCapacity(keys, count); + + for (int i = 0; i < count; ++i) + { + keys.Add((m_Keys[i], valueType)); + } + } + } +} diff --git a/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs.meta new file mode 100644 index 0000000..6099f7c --- /dev/null +++ b/Runtime/Serialization/SerializedTables/ClassSerializedValueSerializedTable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c603bc8d4511474d9dad640c8396d23b +timeCreated: 1590311394 \ No newline at end of file diff --git a/Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs b/Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs new file mode 100644 index 0000000..99ed5d6 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// This class is used for the custom editor. + /// Don't inherit this. Inherit + /// or . + /// + public abstract class GeneratedValueSerializedTable_Base : SerializedTable_Base + { + } +} diff --git a/Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs.meta b/Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs.meta new file mode 100644 index 0000000..17c0085 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/GeneratedValueSerializedTable_Base.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1e92b7e430c1dfb449d3decf8b05c7a9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations.meta b/Runtime/Serialization/SerializedTables/Implementations.meta new file mode 100644 index 0000000..dd87fb8 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5054760b89e0fcf44b72c32d278796a7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs new file mode 100644 index 0000000..11fb122 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class AnimationCurveSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs.meta new file mode 100644 index 0000000..44b7794 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/AnimationCurveSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b8309208c508d1c4193a7fba3acc5202 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs new file mode 100644 index 0000000..b99d3c6 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class BoolSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs.meta new file mode 100644 index 0000000..f609d30 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/BoolSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f9ba635bc0d4d7a4daf720cffdcb41f6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs new file mode 100644 index 0000000..116b8b2 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class BoundsIntSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs.meta new file mode 100644 index 0000000..e54ee02 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/BoundsIntSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71b4fbc526a729a49aefbaaa5b96ea82 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs new file mode 100644 index 0000000..5f8dc4d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class BoundsSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs.meta new file mode 100644 index 0000000..0f12445 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/BoundsSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3330872622514464290289fed66f4d65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs new file mode 100644 index 0000000..c81ff04 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class ByteSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs.meta new file mode 100644 index 0000000..131fa9d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ByteSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9a5eb32754d31394e9588a85f4cec5d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs new file mode 100644 index 0000000..2a2df6d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class CharSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs.meta new file mode 100644 index 0000000..6ac5a1b --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/CharSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c32aefa3fbc691140805bd01ff1dd893 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs new file mode 100644 index 0000000..7628064 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class ColorSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs.meta new file mode 100644 index 0000000..52bb75d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ColorSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 813670c25def2e242a0a1f401a8007b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs new file mode 100644 index 0000000..14e243c --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class ComponentSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs.meta new file mode 100644 index 0000000..cf35cac --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ComponentSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b83aa9c6756355841837eb0e4f69d754 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs new file mode 100644 index 0000000..0be838a --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class DoubleSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs.meta new file mode 100644 index 0000000..6669692 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/DoubleSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7981812236c3a274a9392e75431f23e6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs new file mode 100644 index 0000000..286d85c --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class FloatSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs.meta new file mode 100644 index 0000000..4a0744c --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/FloatSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb1feb2eef28f32479172afb82acf086 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs new file mode 100644 index 0000000..7a04f37 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class GameObjectSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs.meta new file mode 100644 index 0000000..08b167e --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/GameObjectSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9963b0b7a5adaf44697558023341e703 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs new file mode 100644 index 0000000..a10743d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class GradientSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs.meta new file mode 100644 index 0000000..ac39ca2 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/GradientSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8098488e1f047894d955b17620cb2e09 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs new file mode 100644 index 0000000..efa3521 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class IntSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs.meta new file mode 100644 index 0000000..5400ab3 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/IntSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83f28316c765f774487376fa5d128d66 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs new file mode 100644 index 0000000..3102c5f --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class LayerMaskSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs.meta new file mode 100644 index 0000000..ca558be --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/LayerMaskSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: feefe6f24278b2d46a80532663a2bd1e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs new file mode 100644 index 0000000..cf1a820 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class LongSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs.meta new file mode 100644 index 0000000..8429745 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/LongSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 36a05bb9878c6fe4ea707909f57c0dd6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs new file mode 100644 index 0000000..7032355 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class MaterialSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs.meta new file mode 100644 index 0000000..dc3ceaf --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/MaterialSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e86ed5a3f205bdb48b6ff0e93d4334a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs new file mode 100644 index 0000000..f1310a9 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class Matrix4x4SerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs.meta new file mode 100644 index 0000000..38f4977 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Matrix4x4SerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08e347a3097376640bb9ea9a9a4f3963 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs new file mode 100644 index 0000000..13a01bf --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class ObjectSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs.meta new file mode 100644 index 0000000..2aad26c --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ObjectSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4e9363dfb19195e458873500d697a8bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs new file mode 100644 index 0000000..0fba176 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class PropertyNameSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs.meta new file mode 100644 index 0000000..5b0d777 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/PropertyNameSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b1d86a0f87742c43bf2138ace96a614 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs new file mode 100644 index 0000000..2a2c510 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class QuaternionSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs.meta new file mode 100644 index 0000000..726fad5 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/QuaternionSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 62865d44d58f2cd4b8d0d48e9e5ea65a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs new file mode 100644 index 0000000..d29571d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class RectIntSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs.meta new file mode 100644 index 0000000..222178f --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/RectIntSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c482cd0e313d5664f8bbb57c379fb02e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs new file mode 100644 index 0000000..4a6dbe5 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class RectSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs.meta new file mode 100644 index 0000000..7bfbc7d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/RectSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c9b9b4982948484182cd56109e7833a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs new file mode 100644 index 0000000..5aa81fb --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class SbyteSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs.meta new file mode 100644 index 0000000..39ece0b --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/SbyteSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 561b8ca713b517b49a9d9b1b545b7c0d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs new file mode 100644 index 0000000..a734496 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class ShortSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs.meta new file mode 100644 index 0000000..a2421d9 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/ShortSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8df382e803a94724b8651acf15ab34b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs new file mode 100644 index 0000000..9cf6a59 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class SpriteSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs.meta new file mode 100644 index 0000000..c106597 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/SpriteSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5925a829d3f42f84a8c8f07fff012269 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs new file mode 100644 index 0000000..c91130d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class StringSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs.meta new file mode 100644 index 0000000..da511b7 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/StringSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ce5062cfbcdc3e34e847e6b8243bf25d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs new file mode 100644 index 0000000..59dcdb9 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class TextureSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs.meta new file mode 100644 index 0000000..aea51d7 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/TextureSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83cb5b23be463884b807d4655b8c572a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs new file mode 100644 index 0000000..84328d3 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class TransformSerializedTable : ClassSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs.meta new file mode 100644 index 0000000..daa92f9 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/TransformSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3592f4b9f3043c340857aa688e5cfccb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs new file mode 100644 index 0000000..ac3164d --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class UintSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs.meta new file mode 100644 index 0000000..a38e3fb --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/UintSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ab1c456553d51e04fa253022f40bb15f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs new file mode 100644 index 0000000..c4c42ab --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class UlongSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs.meta new file mode 100644 index 0000000..3ba17f0 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/UlongSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b369c71faa599f4eb4f82dd3113d77d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs new file mode 100644 index 0000000..1634d18 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs @@ -0,0 +1,8 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class UshortSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs.meta new file mode 100644 index 0000000..d32b6a5 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/UshortSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a78d27906c3c04043add3ddd8f489d80 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs new file mode 100644 index 0000000..e3a5822 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class Vector2IntSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs.meta new file mode 100644 index 0000000..f2e3134 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector2IntSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 90bc169059005464187e9f78d5b9d2c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs new file mode 100644 index 0000000..071e03e --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class Vector2SerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs.meta new file mode 100644 index 0000000..e713f65 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector2SerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0eaf9a794145a044995b97be7f88345f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs new file mode 100644 index 0000000..dc13861 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class Vector3IntSerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs.meta new file mode 100644 index 0000000..c9639a7 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector3IntSerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4846ff26f40a17849a715b713b051ec5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs new file mode 100644 index 0000000..7e567e6 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class Vector3SerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs.meta new file mode 100644 index 0000000..be4bd88 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector3SerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 124f2b121523b364d95c7e14f87dfa99 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs b/Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs new file mode 100644 index 0000000..3529934 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using UnityEngine; + +namespace Zor.SimpleBlackboard.Serialization +{ + public sealed class Vector4SerializedTable : StructSerializedValueSerializedTable + { + } +} diff --git a/Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs.meta new file mode 100644 index 0000000..e4ffb47 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/Implementations/Vector4SerializedTable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2cb33829d56d94449855cbc03e0e6a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs b/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs new file mode 100644 index 0000000..95822f3 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Base class for a serialized table. + /// Inherit this for a special functionality. + /// If you need a common functionality, inherit , + /// , + /// or . + /// + public abstract class SerializedTable_Base : ScriptableObject + { + /// + /// Type of serialized value in this table. + /// + public abstract Type valueType { get; } + + /// + /// Applies its properties to . + /// + /// Applies its properties to this. + public abstract void Apply(Blackboard blackboard); + + /// + /// Gets keys and their types and adds them to . + /// + /// Keys are added to this. + public abstract void GetKeys(List<(string, Type)> keys); + } +} diff --git a/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs.meta b/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs.meta new file mode 100644 index 0000000..c0d46f8 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/SerializedTable_Base.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 334b8e46f4135b647915530e83f2d758 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs b/Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs new file mode 100644 index 0000000..81e132f --- /dev/null +++ b/Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// This class is used for the custom editor. + /// Don't inherit this. Inherit + /// or . + /// + public abstract class SerializedValueSerializedTable_Base : SerializedTable_Base + { + } +} diff --git a/Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs.meta b/Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs.meta new file mode 100644 index 0000000..edcd802 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/SerializedValueSerializedTable_Base.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e5a57cdb56c5c742a035181f73e252b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs b/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs new file mode 100644 index 0000000..4d5bc9c --- /dev/null +++ b/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Zor.SimpleBlackboard.Helpers; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Serialized table that has set keys and generates struct values at runtime. + /// Inherit this class and override to get this functionality. + /// + /// Struct type of the generated value. + public abstract class StructGeneratedValueSerializedTable : GeneratedValueSerializedTable_Base where T : struct + { +#pragma warning disable CS0649 + [SerializeField] private string[] m_Keys; +#pragma warning restore CS0649 + + /// + public sealed override Type valueType => typeof(T); + + /// + public sealed override void Apply(Blackboard blackboard) + { + for (int i = 0, count = m_Keys.Length; i < count; ++i) + { + blackboard.SetStructValue(new BlackboardPropertyName(m_Keys[i]), GetValue()); + } + } + + /// + public sealed override void GetKeys(List<(string, Type)> keys) + { + int count = m_Keys.Length; + ListHelper.EnsureCapacity(keys, count); + + for (int i = 0; i < count; ++i) + { + keys.Add((m_Keys[i], valueType)); + } + } + + /// + /// Gets a generated value. + /// + /// Generated value. + protected abstract T GetValue(); + } +} diff --git a/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs.meta new file mode 100644 index 0000000..3f5f93a --- /dev/null +++ b/Runtime/Serialization/SerializedTables/StructGeneratedValueSerializedTable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9c6e458edd394be1beb45f9b2149077e +timeCreated: 1590310810 \ No newline at end of file diff --git a/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs b/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs new file mode 100644 index 0000000..2bd1ebe --- /dev/null +++ b/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Zor.SimpleBlackboard.Helpers; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Serialized table that has set keys and struct values. + /// Inherit this class to get this functionality. + /// + /// Struct type of the value. + public abstract class StructSerializedValueSerializedTable : SerializedValueSerializedTable_Base where T : struct + { +#pragma warning disable CS0649 + [SerializeField] private string[] m_Keys; + [SerializeField] private T[] m_Values; +#pragma warning restore CS0649 + + /// + public sealed override Type valueType => typeof(T); + + /// + public sealed override void Apply(Blackboard blackboard) + { + for (int i = 0, count = Mathf.Min(m_Keys.Length, m_Values.Length); i < count; ++i) + { + blackboard.SetStructValue(new BlackboardPropertyName(m_Keys[i]), m_Values[i]); + } + } + + /// + public sealed override void GetKeys(List<(string, Type)> keys) + { + int count = m_Keys.Length; + ListHelper.EnsureCapacity(keys, count); + + for (int i = 0; i < count; ++i) + { + keys.Add((m_Keys[i], valueType)); + } + } + } +} diff --git a/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs.meta b/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs.meta new file mode 100644 index 0000000..3668573 --- /dev/null +++ b/Runtime/Serialization/SerializedTables/StructSerializedValueSerializedTable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 72f22e104ce04df5b69e51f0fe6ae947 +timeCreated: 1590311149 \ No newline at end of file diff --git a/Runtime/Serialization/SerializedTablesContainer.cs b/Runtime/Serialization/SerializedTablesContainer.cs new file mode 100644 index 0000000..0b5bf30 --- /dev/null +++ b/Runtime/Serialization/SerializedTablesContainer.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections.Generic; +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Zor.SimpleBlackboard.Debugging; + +namespace Zor.SimpleBlackboard.Serialization +{ + /// + /// Container of serialized properties for a . + /// + [CreateAssetMenu(menuName = "Simple Blackboard/Serialized Tables Container", fileName = "SerializedTablesContainer", order = 445)] + public sealed class SerializedTablesContainer : SerializedContainer + { +#pragma warning disable CS0649 + [SerializeField, HideInInspector] private SerializedTable_Base[] m_SerializedTables; +#pragma warning restore CS0649 + + /// + public override void Apply(Blackboard blackboard) + { + for (int i = 0, count = m_SerializedTables.Length; i < count; ++i) + { + SerializedTable_Base table = m_SerializedTables[i]; + + if (table == null) + { + BlackboardDebug.LogWarning($"[SerializedTablesContainer] Serialized table at index '{i}' is null"); + continue; + } + + table.Apply(blackboard); + } + } + + /// + public override void GetKeys(List<(string, Type)> keys) + { + for (int i = 0, count = m_SerializedTables.Length; i < count; ++i) + { + SerializedTable_Base table = m_SerializedTables[i]; + + if (table != null) + { + table.GetKeys(keys); + } + } + } + } +} diff --git a/Runtime/Serialization/SerializedTablesContainer.cs.meta b/Runtime/Serialization/SerializedTablesContainer.cs.meta new file mode 100644 index 0000000..10d6246 --- /dev/null +++ b/Runtime/Serialization/SerializedTablesContainer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96f5b35aa54b0ac47a90bb041963c7c3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Zor.SimpleBlackboard.asmdef b/Runtime/Zor.SimpleBlackboard.asmdef new file mode 100644 index 0000000..573a1a5 --- /dev/null +++ b/Runtime/Zor.SimpleBlackboard.asmdef @@ -0,0 +1,3 @@ +{ + "name": "Zor.SimpleBlackboard" +} diff --git a/Runtime/Zor.SimpleBlackboard.asmdef.meta b/Runtime/Zor.SimpleBlackboard.asmdef.meta new file mode 100644 index 0000000..10c68cc --- /dev/null +++ b/Runtime/Zor.SimpleBlackboard.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e1703ee141f53e64180a32309e02ea34 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests.meta b/Tests.meta new file mode 100644 index 0000000..6dc27ab --- /dev/null +++ b/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e84ffe7b3e3256a4e800fb5484f405b1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime.meta b/Tests/Runtime.meta new file mode 100644 index 0000000..451fd48 --- /dev/null +++ b/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ecefe283cac1d9a438ab1b3078e34b3f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/BlackboardProfiling.cs b/Tests/Runtime/BlackboardProfiling.cs new file mode 100644 index 0000000..93e19aa --- /dev/null +++ b/Tests/Runtime/BlackboardProfiling.cs @@ -0,0 +1,100 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using UnityEngine; +using Zor.SimpleBlackboard.Core; + +namespace Zor.SimpleBlackboard.Tests +{ + public sealed class BlackboardProfiling : MonoBehaviour + { + private const int ArrayLength = 100; + +#pragma warning disable CS0649 + [SerializeField] private bool m_NewPropertyNamePerValue; +#pragma warning restore CS0649 + + private Blackboard m_blackboard = new Blackboard(); + + private BlackboardPropertyName[] m_propertyNames; + + private int[] m_ints; + private double[] m_doubles; + private float[] m_floats; + private short[] m_shorts; + + private Mesh[] m_meshes; + + private int m_step; + + private void Start() + { + m_propertyNames = CreateArray(new BlackboardPropertyName("0"), + (value, index) => new BlackboardPropertyName(index.ToString())); + + m_ints = CreateArray(-ArrayLength / 2, (value, index) => value + 1); + m_doubles = CreateArray(-(double)ArrayLength / 2, (value, index) => value + 1.0); + m_floats = CreateArray(-(float)ArrayLength / 2, (value, index) => value + 1f); + m_shorts = CreateArray((short)(-ArrayLength / 2), (value, index) => (short)(value + 1)); + + m_meshes = CreateArray(new Mesh(), (value, index) => new Mesh()); + } + + private void Update() + { + SetStructValues(m_ints); + SetStructValues(m_doubles); + SetStructValues(m_floats); + SetStructValues(m_shorts); + SetClassValues(m_meshes); + + m_step++; + } + + private void SetStructValues(T[] array) where T : struct + { + for (int i = 0; i < ArrayLength; ++i) + { + int index = m_NewPropertyNamePerValue ? m_step + i : m_step; + BlackboardPropertyName propertyName = m_propertyNames[index % ArrayLength]; + + m_blackboard.SetStructValue(propertyName, array[i]); + } + } + + private void SetClassValues(T[] array) where T : class + { + for (int i = 0; i < ArrayLength; ++i) + { + int index = m_NewPropertyNamePerValue ? m_step + i : m_step; + BlackboardPropertyName propertyName = m_propertyNames[index % ArrayLength]; + + m_blackboard.SetClassValue(propertyName, array[i]); + } + } + + private static T[] CreateArray(T initialValue, Func getNext) + { + var array = new T[ArrayLength]; + array[0] = initialValue; + + for (int i = 1; i < ArrayLength; ++i) + { + array[i] = getNext(array[i - 1], i); + } + + return array; + } + + private void Reset() + { + m_blackboard = new Blackboard(); + } + + [ContextMenu("Log")] + private void Log() + { + UnityEngine.Debug.Log(m_blackboard.ToString()); + } + } +} diff --git a/Tests/Runtime/BlackboardProfiling.cs.meta b/Tests/Runtime/BlackboardProfiling.cs.meta new file mode 100644 index 0000000..270042a --- /dev/null +++ b/Tests/Runtime/BlackboardProfiling.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4439c84ce0664a2a9b6891422cee5999 +timeCreated: 1592201931 \ No newline at end of file diff --git a/Tests/Runtime/BlackboardTests.cs b/Tests/Runtime/BlackboardTests.cs new file mode 100644 index 0000000..bd8bb9e --- /dev/null +++ b/Tests/Runtime/BlackboardTests.cs @@ -0,0 +1,1201 @@ +// Copyright (c) 2020 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Simple-Blackboard + +using System; +using System.Collections; +using System.Collections.Generic; +using JetBrains.Annotations; +using NUnit.Framework; +using UnityEngine; +using Zor.SimpleBlackboard.Core; +using Object = UnityEngine.Object; + +namespace Zor.SimpleBlackboard.Tests +{ + public static class BlackboardTests + { + [Test] + public static void SetObjectTryGetObjectTests() + { + var blackboard = new Blackboard(); + + SetObjectTryGetObjectTest(blackboard, + new[] + { + new Mesh(), new Mesh(), + (object)6, 8, + new GameObject(), new GameObject(), + new List(), new List() + }); + } + + [Test] + public static void SetStructTryGetStructTests() + { + var blackboard = new Blackboard(); + + SetStructTryGetStructTest(blackboard, + new[] { 5, 10, -56, 10000, 0, -15000 }); + SetStructTryGetStructTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void SetObjectTryGetClassTests() + { + var blackboard = new Blackboard(); + + SetObjectTryGetClassTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + SetObjectTryGetClassTest(blackboard, + new object[] + { + new List(), new List(), + new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + SetObjectTryGetClassTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + } + + [Test] + public static void SetObjectTryGetObjectWithTypeTests() + { + var blackboard = new Blackboard(); + + SetObjectTryGetObjectTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + SetObjectTryGetObjectTest(blackboard, + new object[] + { + new List(), new List(), + new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + SetObjectTryGetObjectTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + SetObjectTryGetObjectTest(blackboard, new object[] { 5, -100, 300, 0 }); + SetObjectTryGetObjectTest(blackboard, + new object[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void GetStructPropertiesTests() + { + var blackboard = new Blackboard(); + + GetStructPropertiesTest(blackboard, + new[] { 5, 10, -56, 10000, 0, -15000 }); + GetStructPropertiesTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void GetClassPropertiesTests() + { + var blackboard = new Blackboard(); + + GetClassPropertiesTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + GetClassPropertiesTest(blackboard, + new ICollection[] + { + new List(), new List(), new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + blackboard.Clear(); + GetClassPropertiesTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + } + + [Test] + public static void GetObjectPropertiesWithTypeTests() + { + var blackboard = new Blackboard(); + + GetObjectPropertiesWithTypeTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + GetObjectPropertiesWithTypeTest(blackboard, + new ICollection[] + { + new List(), new List(), new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + blackboard.Clear(); + GetObjectPropertiesWithTypeTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + GetObjectPropertiesWithTypeTest(blackboard, + new[] {5, 10, -56, 10000, 0, -15000}); + GetObjectPropertiesWithTypeTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void GetObjectPropertiesTests() + { + var blackboard = new Blackboard(); + + GetObjectPropertiesTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + blackboard.Clear(); + GetObjectPropertiesTest(blackboard, + new ICollection[] + { + new List(), new List(), new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + blackboard.Clear(); + GetObjectPropertiesTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + blackboard.Clear(); + GetObjectPropertiesTest(blackboard, + new[] {5, 10, -56, 10000, 0, -15000}); + blackboard.Clear(); + GetObjectPropertiesTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void GetTypesTests() + { + var blackboard = new Blackboard(); + + GetTypesTest(blackboard, new[] + { + new GameObject(), new Mesh(), new GameObject().AddComponent(), + new Dictionary(), new List(), + new GameObject(), new Mesh(), new GameObject().AddComponent(), + new Dictionary(), new List(), + (object)56, 134, 56.67, -300.56, 100f, -80f + }); + } + + [Test] + public static void ContainsStructValueTests() + { + var blackboard = new Blackboard(); + + ContainsStructValueTest(blackboard, + new[] { 5, 10, -56, 10000, 0, -15000 }); + ContainsStructValueTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ContainsObjectValueTests() + { + var blackboard = new Blackboard(); + + ContainsObjectValueTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + ContainsObjectValueTest(blackboard, + new ICollection[] + { + new List(), new List(), + new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + ContainsObjectValueTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + ContainsObjectValueTest(blackboard, new[] { 5, -100, 300, 0 }); + ContainsObjectValueTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ContainsObjectValueWithTypeTests() + { + var blackboard = new Blackboard(); + + ContainsObjectValueWithTypeTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + ContainsObjectValueWithTypeTest(blackboard, + new object[] + { + new List(), new List(), + new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + ContainsObjectValueWithTypeTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + ContainsObjectValueWithTypeTest(blackboard, new object[] { 5, -100, 300, 0 }); + ContainsObjectValueWithTypeTest(blackboard, + new object[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ContainsObjectValueWithoutTypeTests() + { + var blackboard = new Blackboard(); + + ContainsObjectValueWithoutTypeTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new GameObject().AddComponent(), new GameObject().AddComponent() + }); + ContainsObjectValueWithoutTypeTest(blackboard, + new object[] + { + new List(), new List(), + new object[5], new object[5], + new Dictionary(), new Dictionary() + }); + ContainsObjectValueWithoutTypeTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh(), + new Dictionary(), new Dictionary() + }); + ContainsObjectValueWithoutTypeTest(blackboard, new object[] { 5, -100, 300, 0 }); + ContainsObjectValueWithoutTypeTest(blackboard, + new object[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ContainsTypeTests() + { + var blackboard = new Blackboard(); + + ContainsTypeTest(blackboard, + new[] + { + new GameObject(), new GameObject() + }); + ContainsTypeTest(blackboard, + new[] + { + new List(), new List() + }); + ContainsTypeTest(blackboard, + new[] + { + new Mesh(), new Mesh() + }); + ContainsTypeTest(blackboard, new[] { 5, -100, 300, 0 }); + ContainsTypeTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ContainsInheritorTypeTests() + { + var blackboard = new Blackboard(); + + ContainsInheritorTypeTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh() + }); + ContainsInheritorTypeTest(blackboard, + new IList[] + { + new List(), new List(), + new object[1], new object[1] + }); + ContainsInheritorTypeTest(blackboard, + new Component[] + { + new GameObject().AddComponent(), new GameObject().transform + }); + ContainsInheritorTypeTest(blackboard, new[] { 5, -100, 300, 0 }); + ContainsInheritorTypeTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void GetCountTests() + { + var blackboard = new Blackboard(); + + GetCountTest(blackboard, + new[] + { + new GameObject(), new GameObject() + }); + GetCountTest(blackboard, + new[] + { + new List(), new List() + }); + GetCountTest(blackboard, + new[] + { + new Mesh(), new Mesh() + }); + GetCountTest(blackboard, new[] { 5, -100, 300, 0 }); + GetCountTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void GetCountWithInheritorsTests() + { + var blackboard = new Blackboard(); + + GetCountWithInheritorsTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh() + }); + GetCountWithInheritorsTest(blackboard, + new IList[] + { + new List(), new List(), + new object[1], new object[1] + }); + GetCountWithInheritorsTest(blackboard, + new Component[] + { + new GameObject().AddComponent(), new GameObject().transform + }); + GetCountWithInheritorsTest(blackboard, new[] { 5, -100, 300, 0 }); + GetCountWithInheritorsTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void RemoveStructTests() + { + var blackboard = new Blackboard(); + + RemoveStructTest(blackboard, new[] { 5, -100, 300, 0 }); + RemoveStructTest(blackboard, new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void RemoveObjectTests() + { + var blackboard = new Blackboard(); + + RemoveObjectTest(blackboard, + new Object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh() + }); + RemoveObjectTest(blackboard, + new IList[] + { + new List(), new List(), + new object[1], new object[1] + }); + RemoveObjectTest(blackboard, + new Component[] + { + new GameObject().AddComponent(), new GameObject().transform + }); + RemoveObjectTest(blackboard, new[] { 5, -100, 300, 0 }); + RemoveObjectTest(blackboard, + new[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void RemoveObjectWithTypeTests() + { + var blackboard = new Blackboard(); + + RemoveObjectWithTypeTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh() + }); + RemoveObjectWithTypeTest(blackboard, + new object[] + { + new List(), new List(), + new object[1], new object[1] + }); + RemoveObjectWithTypeTest(blackboard, + new object[] + { + new GameObject().AddComponent(), new GameObject().transform + }); + RemoveObjectWithTypeTest(blackboard, new object[] { 5, -100, 300, 0 }); + RemoveObjectWithTypeTest(blackboard, + new object[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void RemoveObjectWithoutType() + { + var blackboard = new Blackboard(); + + RemoveObjectTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh() + }); + blackboard.Clear(); + RemoveObjectTest(blackboard, + new object[] + { + new List(), new List(), + new object[1], new object[1] + }); + blackboard.Clear(); + RemoveObjectTest(blackboard, + new object[] + { + new GameObject().AddComponent(), new GameObject().transform + }); + blackboard.Clear(); + RemoveObjectTest(blackboard, new object[] { 5, -100, 300, 0 }); + blackboard.Clear(); + RemoveObjectTest(blackboard, + new object[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ClearTests() + { + var blackboard = new Blackboard(); + + ClearTest(blackboard, + new object[] + { + new GameObject(), new GameObject(), + new Mesh(), new Mesh() + }); + ClearTest(blackboard, + new object[] + { + new List(), new List(), + new object[1], new object[1] + }); + ClearTest(blackboard, + new object[] + { + new GameObject().AddComponent(), new GameObject().transform + }); + ClearTest(blackboard, new object[] { 5, -100, 300, 0 }); + ClearTest(blackboard, + new object[] { 5f, 10.76f, -56.55501f, 10000.8f, 0.5f, -15000.43f }); + } + + [Test] + public static void ValueTypesCountTests() + { + var blackboard = new Blackboard(); + + ValueTypesCountTest(blackboard, new object[] + { + new GameObject(), new GameObject(), + new List(), new List(), + new GameObject().AddComponent(), new GameObject().transform, + }); + + blackboard = new Blackboard(); + ValueTypesCountTest(blackboard, new object[] + { + new int[1], new float[1], + new Dictionary(), new List() + }); + } + + [Test] + public static void PropertiesCountTests() + { + var blackboard = new Blackboard(); + + PropertiesCountTest(blackboard, new object[] + { + new GameObject(), new GameObject(), + new List(), new List(), + new GameObject().AddComponent(), new GameObject().transform, + }); + blackboard.Clear(); + PropertiesCountTest(blackboard, new object[] + { + new int[1], new float[1], + new Dictionary(), new List() + }); + } + + private static void SetObjectTryGetObjectTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetClassValue(propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.TryGetObjectValue(propertyNames[i], out object containedValue), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}'"); + Assert.AreEqual(values[i], containedValue, + $"Value of '{propertyNames[i].ToString()}' in blackboard is not equal"); + } + } + + private static void SetStructTryGetStructTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + where T : struct + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetStructValue(propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.TryGetStructValue(propertyNames[i], out T containedValue), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}'"); + Assert.AreEqual(values[i], containedValue, + $"Value of '{propertyNames[i].ToString()}' in blackboard is not equal"); + } + } + + private static void SetObjectTryGetClassTest([NotNull] Blackboard blackboard, + [NotNull] object[] values) where TTryGet : class + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetClassValue(propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.TryGetClassValue(propertyNames[i], out TTryGet containedValue), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}' and '{typeof(TTryGet).FullName}'"); + Assert.AreEqual(values[i], containedValue, + $"Value of '{propertyNames[i].ToString()}' in blackboard is not equal and '{typeof(TTryGet).FullName}'"); + } + } + + private static void SetObjectTryGetObjectTest([NotNull] Blackboard blackboard, + [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetClassValue(propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.TryGetObjectValue(typeof(TTryGet), propertyNames[i], out object containedValue), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}' and '{typeof(TTryGet).FullName}'"); + Assert.AreEqual(values[i], containedValue, + $"Value of '{propertyNames[i].ToString()}' in blackboard is not equal and '{typeof(TTryGet).FullName}'"); + } + } + + private static void GetStructPropertiesTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + where T : struct + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetStructValue(propertyNames[i], values[i]); + } + + var properties = new List>(); + blackboard.GetStructProperties(properties); + + for (int i = 0; i < count; ++i) + { + var property = new KeyValuePair(propertyNames[i], values[i]); + Assert.IsTrue(properties.Contains(property), + $"Blackboard doesn't contain value '{property.Value}' of name '{property.Key.ToString()}'"); + } + } + + private static void GetClassPropertiesTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + where T : class + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetClassValue(propertyNames[i], values[i]); + } + + var properties = new List>(); + blackboard.GetClassProperties(properties); + + for (int i = 0; i < count; ++i) + { + var property = new KeyValuePair(propertyNames[i], values[i]); + Assert.IsTrue(properties.Contains(property), + $"Blackboard doesn't contain value '{property.Value}' of name '{property.Key.ToString()}'"); + } + } + + private static void GetObjectPropertiesWithTypeTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + var properties = new List>(); + blackboard.GetObjectProperties(typeof(T), properties); + + for (int i = 0; i < count; ++i) + { + var property = new KeyValuePair(propertyNames[i], values[i]); + Assert.IsTrue(properties.Contains(property), + $"Blackboard doesn't contain value '{property.Value}' of name '{property.Key.ToString()}'"); + } + } + + private static void GetObjectPropertiesTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + var properties = new List>(); + blackboard.GetObjectProperties(properties); + + for (int i = 0; i < count; ++i) + { + var property = new KeyValuePair(propertyNames[i], values[i]); + Assert.IsTrue(properties.Contains(property), + $"Blackboard doesn't contain value '{property.Value}' of name '{property.Key.ToString()}'"); + } + } + + private static void GetTypesTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetClassValue(propertyNames[i], values[i]); + } + + var types = new List(); + blackboard.GetValueTypes(types); + + for (int i = 0; i < count; ++i) + { + Type type = values[i].GetType(); + Assert.IsTrue(types.Contains(type), + $"Blackboard doesn't contain type '{type.FullName}'"); + } + } + + private static void ContainsStructValueTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + where T : struct + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetStructValue(propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.ContainsStructValue(propertyNames[i]), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}'"); + } + } + + private static void ContainsObjectValueTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.ContainsObjectValue(propertyNames[i]), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}'"); + } + } + + private static void ContainsObjectValueWithTypeTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.ContainsObjectValue(values[i].GetType(), propertyNames[i]), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}'"); + } + } + + private static void ContainsObjectValueWithoutTypeTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Assert.IsTrue(blackboard.ContainsObjectValue(propertyNames[i]), + $"Blackboard doesn't contain value of '{propertyNames[i].ToString()}'"); + } + } + + private static void ContainsTypeTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + Assert.IsTrue(blackboard.ContainsType(), + $"Blackboard doesn't contain type '{typeof(T).FullName}'. Generic"); + Assert.IsTrue(blackboard.ContainsType(typeof(T)), + $"Blackboard doesn't contain type '{typeof(T).FullName}'. Non-Generic"); + } + + private static void ContainsInheritorTypeTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + Assert.IsTrue(blackboard.ContainsInheritingType(), + $"Blackboard doesn't contain inheritor type '{typeof(T).FullName}'. Generic"); + Assert.IsTrue(blackboard.ContainsInheritingType(typeof(T)), + $"Blackboard doesn't contain inheritor type '{typeof(T).FullName}'. Non-Generic"); + } + + private static void GetCountTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + Assert.AreEqual(values.Length, blackboard.GetCount(), + $"Blackboard doesn't contain expected count of '{typeof(T).FullName}'. Generic"); + Assert.AreEqual(values.Length, blackboard.GetCount(typeof(T)), + $"Blackboard doesn't contain expected count of '{typeof(T).FullName}'. Non-Generic"); + } + + private static void GetCountWithInheritorsTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + Assert.AreEqual(values.Length, blackboard.GetCountWithInheritors(), + $"Blackboard doesn't contain expected count of '{typeof(T).FullName}'. Generic"); + Assert.AreEqual(values.Length, blackboard.GetCountWithInheritors(typeof(T)), + $"Blackboard doesn't contain expected count of '{typeof(T).FullName}'. Non-Generic"); + } + + private static void RemoveStructTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + where T : struct + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetStructValue(propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsTrue(blackboard.RemoveStruct(propertyName), + $"Blackboard returned false on remove of '{propertyName}' of type '{typeof(T).FullName}'"); + } + + for (int i = 0; i < count; ++i) + { + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsFalse(blackboard.RemoveStruct(propertyName), + $"Blackboard returned true on impossible remove of '{propertyName}' of type '{typeof(T).FullName}'"); + } + + Assert.AreEqual(0, blackboard.GetCount(), + $"Blackboard contains removed values of type '{typeof(T).FullName}'"); + } + + private static void RemoveObjectTest([NotNull] Blackboard blackboard, [NotNull] T[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(typeof(T), propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsTrue(blackboard.RemoveObject(propertyName), + $"Blackboard returned false on remove of '{propertyName}' of type '{typeof(T).FullName}'"); + } + + for (int i = 0; i < count; ++i) + { + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsFalse(blackboard.RemoveObject(propertyName), + $"Blackboard returned true on impossible remove of '{propertyName}' of type '{typeof(T).FullName}'"); + } + + Assert.AreEqual(0, blackboard.GetCountWithInheritors(), + $"Blackboard contains removed values of type '{typeof(T).FullName}'"); + } + + private static void RemoveObjectWithTypeTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + Type type = values[i].GetType(); + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsTrue(blackboard.RemoveObject(type, propertyName), + $"Blackboard returned false on remove of '{propertyName}' of type '{type.FullName}'"); + } + + for (int i = 0; i < count; ++i) + { + Type type = values[i].GetType(); + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsFalse(blackboard.RemoveObject(type, propertyName), + $"Blackboard returned true on impossible remove of '{propertyName}' of type '{type.FullName}'"); + } + + Assert.AreEqual(0, blackboard.GetCountWithInheritors(typeof(object)), + $"Blackboard contains removed values"); + } + + private static void RemoveObjectTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + for (int i = 0; i < count; ++i) + { + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsTrue(blackboard.RemoveObject(propertyName), + $"Blackboard returned false on remove of '{propertyName}'"); + } + + for (int i = 0; i < count; ++i) + { + BlackboardPropertyName propertyName = propertyNames[i]; + Assert.IsFalse(blackboard.RemoveObject(propertyName), + $"Blackboard returned true on impossible remove of '{propertyName}'"); + } + + Assert.AreEqual(0, blackboard.GetCountWithInheritors(typeof(object)), + $"Blackboard contains removed values"); + } + + private static void ClearTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + blackboard.Clear(); + + Assert.AreEqual(0, blackboard.propertiesCount, + "Blackboard has something after clear"); + } + + private static void ValueTypesCountTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + var types = new List(); + + for (int i = 0; i < count; ++i) + { + Type type = values[i].GetType(); + + if (!types.Contains(type)) + { + types.Add(type); + } + } + + Assert.AreEqual(types.Count, blackboard.valueTypesCount, + "Blackboard has wrong number of value types"); + } + + private static void PropertiesCountTest([NotNull] Blackboard blackboard, [NotNull] object[] values) + { + int count = values.Length; + var propertyNames = new BlackboardPropertyName[count]; + + for (int i = 0; i < count; ++i) + { + propertyNames[i] = new BlackboardPropertyName(values[i].GetType().FullName + " " + i.ToString()); + } + + for (int i = 0; i < count; ++i) + { + blackboard.SetObjectValue(values[i].GetType(), propertyNames[i], values[i]); + } + + Assert.AreEqual(propertyNames.Length, blackboard.propertiesCount, + "Blackboard has wrong number of properties"); + } + } +} + diff --git a/Tests/Runtime/BlackboardTests.cs.meta b/Tests/Runtime/BlackboardTests.cs.meta new file mode 100644 index 0000000..32596da --- /dev/null +++ b/Tests/Runtime/BlackboardTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c243d55ea0fa13448cb8df0561b3afd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef b/Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef new file mode 100644 index 0000000..2252706 --- /dev/null +++ b/Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Zor.SimpleBlackboard.Tests", + "references": [ + "Zor.SimpleBlackboard" + ], + "optionalUnityReferences": [ + "TestAssemblies" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef.meta b/Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef.meta new file mode 100644 index 0000000..e1a3303 --- /dev/null +++ b/Tests/Runtime/Zor.SimpleBlackboard.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 63c2dc282a53f7e4d934afa648563f87 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..c80c86b --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "com.zor.simple-blackboard", + "version": "1.0.0", + "displayName": "Simple Blackboard", + "description": "Simple Blackboard for Unity is a flexible data storage that can contain any count of properties of any type. The properties can be accessed with property names.", + "unity": "2018.4", + "keywords": [ + "data", + "blackboard", + "flexible", + "storage" + ], + "author": { + "name": "Vladimir Popov", + "email": "zor1994@gmail.com", + "url": "https://github.com/ZorPastaman" + } +} diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..23a4492 --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9e4eb2cbd68cd1e4c9d02f18fd8c282d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: