-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
ci: another fix (sob)
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Replaced when project is built from commit logs via Semantic Release. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Documentation beyond README.md goes here. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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); | ||
}); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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> | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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); | ||
}; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.