Skip to content

Commit 71d7bf1

Browse files
authored
Merge pull request #26 from ashblue/feature/semantic-release-fix
fix(semantic-release): was not picking up the main branch
0 parents  commit 71d7bf1

File tree

127 files changed

+3238
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3238
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replaced when project is built from commit logs via Semantic Release.

CHANGELOG.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Documentation beyond README.md goes here.

Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Components.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Components/Atoms.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System.Collections.Generic;
2+
using UnityEngine.UIElements;
3+
4+
namespace CleverCrow.Fluid.ElasticInventory.Editors {
5+
public class DropdownAdd<T> : ComponentBase {
6+
readonly DropdownField _dropdown;
7+
readonly List<KeyValuePair<string, T>> _choices;
8+
readonly string _addText;
9+
readonly VisualElement _containerParent;
10+
readonly bool _resetOnInteract;
11+
12+
// @TODO Make addText optional so the categories will update on click
13+
public DropdownAdd (
14+
VisualElement containerParent,
15+
string addText,
16+
List<KeyValuePair<string, T>> choices,
17+
bool resetOnInteract = true
18+
) : base(containerParent) {
19+
_containerParent = containerParent;
20+
_choices = choices;
21+
_addText = addText;
22+
_resetOnInteract = resetOnInteract;
23+
24+
var keys = choices.ConvertAll(choice => choice.Key);
25+
keys.Insert(0, addText);
26+
27+
_dropdown = CreateDropdownField(keys);
28+
}
29+
30+
public void BindClick (System.Action<T> callback) {
31+
_dropdown.RegisterCallback<ChangeEvent<string>>(e => {
32+
if (_resetOnInteract) _dropdown.value = _addText;
33+
if (e.newValue == _addText) {
34+
callback(default);
35+
return;
36+
}
37+
38+
var choice = _choices.Find(c => c.Key == e.newValue);
39+
callback(choice.Value);
40+
});
41+
}
42+
43+
private DropdownField CreateDropdownField (List<string> keys) {
44+
var dropdown = new DropdownField() {
45+
choices = keys,
46+
value = _addText
47+
};
48+
49+
_containerParent.Add(dropdown);
50+
51+
return dropdown;
52+
}
53+
54+
public void SetValue (int indexOf) {
55+
if (indexOf < 0 || indexOf >= _choices.Count) return;
56+
_dropdown.value = _choices[indexOf].Key;
57+
}
58+
}
59+
}

Editor/Components/Atoms/DropdownAdd.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Components/Molecules.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Components/Molecules/SearchInput.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)