mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-05 15:58:14 +07:00
Add TapEvent/TapConfigEvent (#1018)
* Update EventType.java * Update InputHandler.java
This commit is contained in:
@ -141,6 +141,30 @@ public class EventType{
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when the player taps a block. */
|
||||
public static class TapEvent{
|
||||
public final Tile tile;
|
||||
public final Player player;
|
||||
|
||||
public TapEvent(Tile tile, Player player){
|
||||
this.tile = tile;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when the player sets a specific block. */
|
||||
public static class TapConfigEvent{
|
||||
public final Tile tile;
|
||||
public final Player player;
|
||||
public final int value;
|
||||
|
||||
public TapConfigEvent(Tile tile, Player player, int value){
|
||||
this.tile = tile;
|
||||
this.player = player;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static class GameOverEvent{
|
||||
public final Team winner;
|
||||
|
@ -145,12 +145,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(tile == null || player == null) return;
|
||||
if(!Units.canInteract(player, tile)) return;
|
||||
tile.block().tapped(tile, player);
|
||||
Core.app.post(() -> Events.fire(new TapEvent(tile, player)));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.both, forward = true)
|
||||
public static void onTileConfig(Player player, Tile tile, int value){
|
||||
if(tile == null || !Units.canInteract(player, tile)) return;
|
||||
tile.block().configured(tile, player, value);
|
||||
Core.app.post(() -> Events.fire(new TapConfigEvent(tile, player, value)));
|
||||
}
|
||||
|
||||
public Eachable<BuildRequest> allRequests(){
|
||||
|
Reference in New Issue
Block a user