Fixed commanded unit UI refresh
This commit is contained in:
@@ -32,6 +32,7 @@ public class EventType{
|
|||||||
teamCoreDamage,
|
teamCoreDamage,
|
||||||
socketConfigChanged,
|
socketConfigChanged,
|
||||||
update,
|
update,
|
||||||
|
unitCommandChange,
|
||||||
draw,
|
draw,
|
||||||
drawOver,
|
drawOver,
|
||||||
preDraw,
|
preDraw,
|
||||||
|
|||||||
@@ -757,6 +757,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
selectedUnits.clear();
|
selectedUnits.clear();
|
||||||
}
|
}
|
||||||
selectedUnits.addAll(units);
|
selectedUnits.addAll(units);
|
||||||
|
Events.fire(Trigger.unitCommandChange);
|
||||||
commandBuild = null;
|
commandBuild = null;
|
||||||
}
|
}
|
||||||
commandRect = false;
|
commandRect = false;
|
||||||
@@ -770,6 +771,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
selectedUnits.clear();
|
selectedUnits.clear();
|
||||||
camera.bounds(Tmp.r1);
|
camera.bounds(Tmp.r1);
|
||||||
selectedUnits.addAll(selectedCommandUnits(Tmp.r1.x, Tmp.r1.y, Tmp.r1.width, Tmp.r1.height, u -> u.type == unit.type));
|
selectedUnits.addAll(selectedCommandUnits(Tmp.r1.x, Tmp.r1.y, Tmp.r1.width, Tmp.r1.height, u -> u.type == unit.type));
|
||||||
|
Events.fire(Trigger.unitCommandChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,6 +798,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
commandBuild = null;
|
commandBuild = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Events.fire(Trigger.unitCommandChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class PlacementFragment{
|
|||||||
Table blockTable, toggler, topTable, blockCatTable, commandTable;
|
Table blockTable, toggler, topTable, blockCatTable, commandTable;
|
||||||
Stack mainStack;
|
Stack mainStack;
|
||||||
ScrollPane blockPane;
|
ScrollPane blockPane;
|
||||||
|
Runnable rebuildCommand;
|
||||||
boolean blockSelectEnd, wasCommandMode;
|
boolean blockSelectEnd, wasCommandMode;
|
||||||
int blockSelectSeq;
|
int blockSelectSeq;
|
||||||
long blockSelectSeqMillis;
|
long blockSelectSeqMillis;
|
||||||
@@ -77,6 +78,12 @@ public class PlacementFragment{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Events.run(Trigger.unitCommandChange, () -> {
|
||||||
|
if(rebuildCommand != null){
|
||||||
|
rebuildCommand.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Events.on(UnlockEvent.class, event -> {
|
Events.on(UnlockEvent.class, event -> {
|
||||||
if(event.content instanceof Block){
|
if(event.content instanceof Block){
|
||||||
rebuild();
|
rebuild();
|
||||||
@@ -425,7 +432,7 @@ public class PlacementFragment{
|
|||||||
UnitCommand[] currentCommand = {null};
|
UnitCommand[] currentCommand = {null};
|
||||||
var commands = new Seq<UnitCommand>();
|
var commands = new Seq<UnitCommand>();
|
||||||
|
|
||||||
Runnable rebuildCommand = () -> {
|
rebuildCommand = () -> {
|
||||||
u.clearChildren();
|
u.clearChildren();
|
||||||
var units = control.input.selectedUnits;
|
var units = control.input.selectedUnits;
|
||||||
if(units.size > 0){
|
if(units.size > 0){
|
||||||
|
|||||||
Reference in New Issue
Block a user