diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100755 index 0000000..7a84ea5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +Replaced when project is built from commit logs via Semantic Release. diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 0000000..bbdfb4e --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 738a34c22e4054e0a9c06d5e9919a4cc +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Documentation~/com.fluid.elastic-inventory.md b/Documentation~/com.fluid.elastic-inventory.md new file mode 100755 index 0000000..f37d25d --- /dev/null +++ b/Documentation~/com.fluid.elastic-inventory.md @@ -0,0 +1 @@ +Documentation beyond README.md goes here. diff --git a/Editor.meta b/Editor.meta new file mode 100644 index 0000000..aabfaf7 --- /dev/null +++ b/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b86cd99dfac11486f829781bc5f81db9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Components.meta b/Editor/Components.meta new file mode 100644 index 0000000..0c13621 --- /dev/null +++ b/Editor/Components.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 699c1cdf6b6745028d78c7cf7c6b35d2 +timeCreated: 1684875207 \ No newline at end of file diff --git a/Editor/Components/Atoms.meta b/Editor/Components/Atoms.meta new file mode 100644 index 0000000..946cc9a --- /dev/null +++ b/Editor/Components/Atoms.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a105d96d3ce44d899180fd2fdd6f9a38 +timeCreated: 1685131372 \ No newline at end of file diff --git a/Editor/Components/Atoms/DropdownAdd.cs b/Editor/Components/Atoms/DropdownAdd.cs new file mode 100644 index 0000000..6a6a4b5 --- /dev/null +++ b/Editor/Components/Atoms/DropdownAdd.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using UnityEngine.UIElements; + +namespace CleverCrow.Fluid.ElasticInventory.Editors { + public class DropdownAdd : ComponentBase { + readonly DropdownField _dropdown; + readonly List> _choices; + readonly string _addText; + readonly VisualElement _containerParent; + readonly bool _resetOnInteract; + + // @TODO Make addText optional so the categories will update on click + public DropdownAdd ( + VisualElement containerParent, + string addText, + List> choices, + bool resetOnInteract = true + ) : base(containerParent) { + _containerParent = containerParent; + _choices = choices; + _addText = addText; + _resetOnInteract = resetOnInteract; + + var keys = choices.ConvertAll(choice => choice.Key); + keys.Insert(0, addText); + + _dropdown = CreateDropdownField(keys); + } + + public void BindClick (System.Action callback) { + _dropdown.RegisterCallback>(e => { + if (_resetOnInteract) _dropdown.value = _addText; + if (e.newValue == _addText) { + callback(default); + return; + } + + var choice = _choices.Find(c => c.Key == e.newValue); + callback(choice.Value); + }); + } + + private DropdownField CreateDropdownField (List keys) { + var dropdown = new DropdownField() { + choices = keys, + value = _addText + }; + + _containerParent.Add(dropdown); + + return dropdown; + } + + public void SetValue (int indexOf) { + if (indexOf < 0 || indexOf >= _choices.Count) return; + _dropdown.value = _choices[indexOf].Key; + } + } +} diff --git a/Editor/Components/Atoms/DropdownAdd.cs.meta b/Editor/Components/Atoms/DropdownAdd.cs.meta new file mode 100644 index 0000000..b51cc06 --- /dev/null +++ b/Editor/Components/Atoms/DropdownAdd.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a56c8ee0400e4882937932ebbbf8a923 +timeCreated: 1685131381 \ No newline at end of file diff --git a/Editor/Components/Molecules.meta b/Editor/Components/Molecules.meta new file mode 100644 index 0000000..6bc36bb --- /dev/null +++ b/Editor/Components/Molecules.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a786f15a2afb46b2b81f9c8891c80ba0 +timeCreated: 1687027657 \ No newline at end of file diff --git a/Editor/Components/Molecules/SearchInput.meta b/Editor/Components/Molecules/SearchInput.meta new file mode 100644 index 0000000..91c1d68 --- /dev/null +++ b/Editor/Components/Molecules/SearchInput.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2ed41a3d070d4be78f6b4fde5ea4b8de +timeCreated: 1687027004 \ No newline at end of file diff --git a/Editor/Components/Molecules/SearchInput/SearchInput.cs b/Editor/Components/Molecules/SearchInput/SearchInput.cs new file mode 100644 index 0000000..5bba3ce --- /dev/null +++ b/Editor/Components/Molecules/SearchInput/SearchInput.cs @@ -0,0 +1,16 @@ +using UnityEngine.UIElements; + +namespace CleverCrow.Fluid.ElasticInventory.Editors { + public class SearchInput : ComponentBase { + public SearchInput (VisualElement container) : base(container) { + } + + public void BindChange (System.Action callback) { + _container + .Q("search-input__text") + .RegisterValueChangedCallback(evt => { + callback(evt.newValue); + }); + } + } +} diff --git a/Editor/Components/Molecules/SearchInput/SearchInput.cs.meta b/Editor/Components/Molecules/SearchInput/SearchInput.cs.meta new file mode 100644 index 0000000..849931c --- /dev/null +++ b/Editor/Components/Molecules/SearchInput/SearchInput.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9c1e019e610b4760b08103ddfb46c965 +timeCreated: 1687026948 \ No newline at end of file diff --git a/Editor/Components/Molecules/SearchInput/SearchInput.uxml b/Editor/Components/Molecules/SearchInput/SearchInput.uxml new file mode 100644 index 0000000..5530b73 --- /dev/null +++ b/Editor/Components/Molecules/SearchInput/SearchInput.uxml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Editor/Components/Molecules/SearchInput/SearchInput.uxml.meta b/Editor/Components/Molecules/SearchInput/SearchInput.uxml.meta new file mode 100644 index 0000000..7d3a5b0 --- /dev/null +++ b/Editor/Components/Molecules/SearchInput/SearchInput.uxml.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3286c8d6a80c4136b7085788ed96667c +timeCreated: 1687027033 \ No newline at end of file diff --git a/Editor/Components/Organisms.meta b/Editor/Components/Organisms.meta new file mode 100644 index 0000000..be38930 --- /dev/null +++ b/Editor/Components/Organisms.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f0de0154cb114d03a31b3ad92e70a2b6 +timeCreated: 1685139178 \ No newline at end of file diff --git a/Editor/Components/Organisms/ItemEntry.meta b/Editor/Components/Organisms/ItemEntry.meta new file mode 100644 index 0000000..0c4e93b --- /dev/null +++ b/Editor/Components/Organisms/ItemEntry.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c8b9f1d5d48b4d53a28e6e9b15050dd7 +timeCreated: 1685139047 \ No newline at end of file diff --git a/Editor/Components/Organisms/ItemEntry/ItemEntry.cs b/Editor/Components/Organisms/ItemEntry/ItemEntry.cs new file mode 100644 index 0000000..e5df704 --- /dev/null +++ b/Editor/Components/Organisms/ItemEntry/ItemEntry.cs @@ -0,0 +1,34 @@ +using System; +using UnityEditor; +using UnityEditor.UIElements; +using UnityEngine.UIElements; + +namespace CleverCrow.Fluid.ElasticInventory.Editors { + public class ItemEntry : ComponentBase { + public ItemEntry ( + VisualElement container, + ItemDefinitionBase definition, + Action deleteCallback + ) : base(container) { + var title = _container.Q