Add Events.fire(Trigger.unitCommandChange) in select/remove unit by type (#8406)
* Added `Events.fire(Trigger.unitCommandChange)` and `boolean fireInRebuildCommand` Added `Events.fire(Trigger.unitCommandChange)` to **left click - select** and **right click - remove**. Added `boolean fireInRebuildCommand` to prevent infinite event loop with `rebuildCommand`. * Remove useless `fireInRebuildCommand` flag.
This commit is contained in:
@@ -462,9 +462,15 @@ public class PlacementFragment{
|
|||||||
var listener = new ClickListener();
|
var listener = new ClickListener();
|
||||||
|
|
||||||
//left click -> select
|
//left click -> select
|
||||||
b.clicked(KeyCode.mouseLeft, () -> control.input.selectedUnits.removeAll(unit -> unit.type != type));
|
b.clicked(KeyCode.mouseLeft, () -> {
|
||||||
|
control.input.selectedUnits.removeAll(unit -> unit.type != type);
|
||||||
|
Events.fire(Trigger.unitCommandChange);
|
||||||
|
});
|
||||||
//right click -> remove
|
//right click -> remove
|
||||||
b.clicked(KeyCode.mouseRight, () -> control.input.selectedUnits.removeAll(unit -> unit.type == type));
|
b.clicked(KeyCode.mouseRight, () -> {
|
||||||
|
control.input.selectedUnits.removeAll(unit -> unit.type == type);
|
||||||
|
Events.fire(Trigger.unitCommandChange);
|
||||||
|
});
|
||||||
|
|
||||||
b.addListener(listener);
|
b.addListener(listener);
|
||||||
b.addListener(new HandCursorListener());
|
b.addListener(new HandCursorListener());
|
||||||
|
|||||||
Reference in New Issue
Block a user