Skip to content

Commit

Permalink
Merge pull request #10 from ashblue/feature/release-fix
Browse files Browse the repository at this point in the history
ci: another fix (sob)
  • Loading branch information
ashblue committed Jul 5, 2023
0 parents commit 7b3df22
Show file tree
Hide file tree
Showing 127 changed files with 3,141 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replaced when project is built from commit logs via Semantic Release.
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Documentation~/com.fluid.elastic-inventory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Documentation beyond README.md goes here.
8 changes: 8 additions & 0 deletions Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components/Atoms.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Editor/Components/Atoms/DropdownAdd.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Collections.Generic;
using UnityEngine.UIElements;

namespace CleverCrow.Fluid.ElasticInventory.Editors {
public class DropdownAdd<T> : ComponentBase {
readonly DropdownField _dropdown;
readonly List<KeyValuePair<string, T>> _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<KeyValuePair<string, T>> 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<T> callback) {
_dropdown.RegisterCallback<ChangeEvent<string>>(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<string> 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;
}
}
}
3 changes: 3 additions & 0 deletions Editor/Components/Atoms/DropdownAdd.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components/Molecules.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components/Molecules/SearchInput.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Editor/Components/Molecules/SearchInput/SearchInput.cs
Original file line number Diff line number Diff line change
@@ -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<string> callback) {
_container
.Q<TextField>("search-input__text")
.RegisterValueChangedCallback(evt => {
callback(evt.newValue);
});
}
}
}
3 changes: 3 additions & 0 deletions Editor/Components/Molecules/SearchInput/SearchInput.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Editor/Components/Molecules/SearchInput/SearchInput.uxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui:UXML xmlns:ui="UnityEngine.UIElements">
<ui:VisualElement name="search-input" class="search-input" style="flex-direction: row;">
<ui:Label text="Search" style="flex-grow: 0; color: grey;" name="placeholderLabel" />
<ui:TextField class="search-input__text" name="search-input__text" style="width: 100px" />
</ui:VisualElement>
</ui:UXML>


3 changes: 3 additions & 0 deletions Editor/Components/Molecules/SearchInput/SearchInput.uxml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components/Organisms.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components/Organisms/ItemEntry.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Editor/Components/Organisms/ItemEntry/ItemEntry.cs
Original file line number Diff line number Diff line change
@@ -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<ItemDefinitionBase> deleteCallback
) : base(container) {
var title = _container.Q<Label>("item-entry__name");
title.text = definition.DisplayName;
title.bindingPath = "_displayName";
title.Bind(new SerializedObject(definition));

_container.Q<Button>("item-entry__edit").clicked += () => { Selection.activeObject = definition; };

_container.Q<Button>("item-entry__delete").clicked += () => {
var confirm = EditorUtility.DisplayDialog(
"Delete Item Definition",
$"Are you sure you want to delete {definition.DisplayName}?",
"Delete",
"Cancel"
);
if (!confirm) return;
_container.parent.Remove(_container);
deleteCallback(definition);
};
}
}
}
3 changes: 3 additions & 0 deletions Editor/Components/Organisms/ItemEntry/ItemEntry.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Editor/Components/Organisms/ItemEntry/ItemEntry.uss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.item-entry {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 5px;
border-bottom-color: #000;
border-bottom-width: 1px;
}

.item-entry__section {
flex-direction: row;
align-items: center;
}

.item-entry__image {
width: 20px;
height: 20px;
}
3 changes: 3 additions & 0 deletions Editor/Components/Organisms/ItemEntry/ItemEntry.uss.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Editor/Components/Organisms/ItemEntry/ItemEntry.uxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui:UXML xmlns:ui="UnityEngine.UIElements">
<Style src="./ItemEntry.uss" />

<ui:VisualElement name="item-entry" class="item-entry">
<ui:VisualElement class="item-entry__section">
<ui:Label name="item-entry__name" text="Item Name" />
</ui:VisualElement>

<ui:VisualElement class="item-entry__section">
<ui:Button name="item-entry__edit" text="Edit" />
<ui:Button name="item-entry__delete" text="Delete" />
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
3 changes: 3 additions & 0 deletions Editor/Components/Organisms/ItemEntry/ItemEntry.uxml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Editor/Components/Pages.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7b3df22

Please sign in to comment.