mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Unit factory command UI cleanup
This commit is contained in:
parent
d9d5c8733b
commit
d6073201bb
@ -197,7 +197,9 @@ public class UnitFactory extends UnitBlock{
|
|||||||
|
|
||||||
public boolean canSetCommand(){
|
public boolean canSetCommand(){
|
||||||
var output = unit();
|
var output = unit();
|
||||||
return output != null && output.commands.length > 1 && output.allowChangeCommands;
|
return output != null && output.commands.length > 1 && output.allowChangeCommands &&
|
||||||
|
//to avoid cluttering UI, don't show command selection for "standard" units that only have two commands.
|
||||||
|
!(output.commands.length == 2 && output.commands[1] == UnitCommand.enterPayloadCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -247,12 +249,13 @@ public class UnitFactory extends UnitBlock{
|
|||||||
|
|
||||||
Table commands = new Table();
|
Table commands = new Table();
|
||||||
commands.top().left();
|
commands.top().left();
|
||||||
commands.background(Styles.black6);
|
|
||||||
|
|
||||||
Runnable rebuildCommands = () -> {
|
Runnable rebuildCommands = () -> {
|
||||||
commands.clear();
|
commands.clear();
|
||||||
|
commands.background(null);
|
||||||
var unit = unit();
|
var unit = unit();
|
||||||
if(unit != null && canSetCommand()){
|
if(unit != null && canSetCommand()){
|
||||||
|
commands.background(Styles.black6);
|
||||||
var group = new ButtonGroup<ImageButton>();
|
var group = new ButtonGroup<ImageButton>();
|
||||||
group.setMinCheckCount(0);
|
group.setMinCheckCount(0);
|
||||||
int i = 0, columns = Mathf.clamp(units.size, 2, selectionColumns);
|
int i = 0, columns = Mathf.clamp(units.size, 2, selectionColumns);
|
||||||
|
Loading…
Reference in New Issue
Block a user