mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 15:02:03 -08:00
Merge pull request #2927 from sk7725/patch-19
Let buildTable accept `closeSelect`
This commit is contained in:
commit
b40bbdad0e
1 changed files with 7 additions and 1 deletions
|
|
@ -15,6 +15,10 @@ public class ItemSelection{
|
|||
private static float scrollPos = 0f;
|
||||
|
||||
public static <T extends UnlockableContent> void buildTable(Table table, Seq<T> items, Prov<T> holder, Cons<T> consumer){
|
||||
buildTable(table, items, holder, consumer, true);
|
||||
}
|
||||
|
||||
public static <T extends UnlockableContent> void buildTable(Table table, Seq<T> items, Prov<T> holder, Cons<T> consumer, boolean closeSelect){
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
group.setMinCheckCount(0);
|
||||
|
|
@ -26,7 +30,9 @@ public class ItemSelection{
|
|||
for(T item : items){
|
||||
if(!item.unlockedNow()) continue;
|
||||
|
||||
ImageButton button = cont.button(Tex.whiteui, Styles.clearToggleTransi, 24, () -> control.input.frag.config.hideConfig()).group(group).get();
|
||||
ImageButton button = cont.button(Tex.whiteui, Styles.clearToggleTransi, 24, () -> {
|
||||
if(closeSelect) control.input.frag.config.hideConfig();
|
||||
}).group(group).get();
|
||||
button.changed(() -> consumer.get(button.isChecked() ? item : null));
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(item.icon(Cicon.small));
|
||||
button.update(() -> button.setChecked(holder.get() == item));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue