Renamed Table pad methods
This commit is contained in:
@@ -8,7 +8,6 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||||
import io.anuke.mindustry.entities.enemies.EnemyType;
|
import io.anuke.mindustry.entities.enemies.EnemyType;
|
||||||
import io.anuke.mindustry.net.Net;
|
|
||||||
import io.anuke.mindustry.world.SpawnPoint;
|
import io.anuke.mindustry.world.SpawnPoint;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
@@ -112,10 +111,6 @@ public class Pathfind{
|
|||||||
if(point.finder.search(point.request, ms)){
|
if(point.finder.search(point.request, ms)){
|
||||||
smoother.smoothPath(point.path);
|
smoother.smoothPath(point.path);
|
||||||
point.pathTiles = point.path.nodes.toArray(Tile.class);
|
point.pathTiles = point.path.nodes.toArray(Tile.class);
|
||||||
|
|
||||||
if(Net.active() && Net.server()){
|
|
||||||
Vars.netServer.handlePathFound(index, point.pathTiles);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}catch (ArrayIndexOutOfBoundsException e){
|
}catch (ArrayIndexOutOfBoundsException e){
|
||||||
//no path
|
//no path
|
||||||
|
|||||||
@@ -195,15 +195,6 @@ public class NetClient extends Module {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Net.handle(PathPacket.class, packet -> {
|
|
||||||
Tile[] tiles = new Tile[packet.path.length];
|
|
||||||
for(int i = 0; i < tiles.length; i ++){
|
|
||||||
int c = packet.path[i];
|
|
||||||
tiles[i] = Vars.world.tile(c % Vars.world.width(), c / Vars.world.width());
|
|
||||||
}
|
|
||||||
Vars.control.spawnpoints.get(packet.index).pathTiles = tiles;
|
|
||||||
});
|
|
||||||
|
|
||||||
Net.handle(BulletPacket.class, packet -> {
|
Net.handle(BulletPacket.class, packet -> {
|
||||||
//TODO shoot effects for enemies, clientside as well as serverside
|
//TODO shoot effects for enemies, clientside as well as serverside
|
||||||
BulletType type = (BulletType) BaseBulletType.getByID(packet.type);
|
BulletType type = (BulletType) BaseBulletType.getByID(packet.type);
|
||||||
|
|||||||
@@ -184,19 +184,6 @@ public class NetServer extends Module{
|
|||||||
Net.send(packet, SendMode.udp);
|
Net.send(packet, SendMode.udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handlePathFound(int index, Tile[] tiles){
|
|
||||||
PathPacket packet = new PathPacket();
|
|
||||||
int[] out = new int[tiles.length];
|
|
||||||
|
|
||||||
for(int p = 0; p < out.length; p ++){
|
|
||||||
out[p] = tiles[p].packedPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
packet.path = out;
|
|
||||||
packet.index = (byte)index;
|
|
||||||
Net.send(packet, SendMode.tcp);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleEnemySpawn(Enemy enemy){
|
public void handleEnemySpawn(Enemy enemy){
|
||||||
EnemySpawnPacket packet = new EnemySpawnPacket();
|
EnemySpawnPacket packet = new EnemySpawnPacket();
|
||||||
packet.type = enemy.type.id;
|
packet.type = enemy.type.id;
|
||||||
|
|||||||
@@ -231,9 +231,9 @@ public class MapEditorDialog extends Dialog{
|
|||||||
|
|
||||||
tools.defaults().size(53f, 58f).padBottom(-6);
|
tools.defaults().size(53f, 58f).padBottom(-6);
|
||||||
|
|
||||||
ImageButton undo = tools.addIButton("icon-undo", 16*2f, () -> view.undo()).get();
|
ImageButton undo = tools.addImageButton("icon-undo", 16*2f, () -> view.undo()).get();
|
||||||
ImageButton redo = tools.addIButton("icon-redo", 16*2f, () -> view.redo()).get();
|
ImageButton redo = tools.addImageButton("icon-redo", 16*2f, () -> view.redo()).get();
|
||||||
tools.addIButton("icon-grid", "toggle", 16*2f, () -> view.setGrid(!view.isGrid())).get();
|
tools.addImageButton("icon-grid", "toggle", 16*2f, () -> view.setGrid(!view.isGrid())).get();
|
||||||
|
|
||||||
undo.setDisabled(() -> !view.getStack().canUndo());
|
undo.setDisabled(() -> !view.getStack().canUndo());
|
||||||
redo.setDisabled(() -> !view.getStack().canRedo());
|
redo.setDisabled(() -> !view.getStack().canRedo());
|
||||||
|
|||||||
@@ -94,11 +94,6 @@ public class Packets {
|
|||||||
public int id;
|
public int id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PathPacket{
|
|
||||||
public int[] path;
|
|
||||||
public byte index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BlockDestroyPacket{
|
public static class BlockDestroyPacket{
|
||||||
public int position;
|
public int position;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class Registrator {
|
|||||||
StateSyncPacket.class,
|
StateSyncPacket.class,
|
||||||
BlockSyncPacket.class,
|
BlockSyncPacket.class,
|
||||||
EnemySpawnPacket.class,
|
EnemySpawnPacket.class,
|
||||||
PathPacket.class,
|
|
||||||
BulletPacket.class,
|
BulletPacket.class,
|
||||||
EnemyDeathPacket.class,
|
EnemyDeathPacket.class,
|
||||||
BlockUpdatePacket.class,
|
BlockUpdatePacket.class,
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class JoinDialog extends FloatingDialog {
|
|||||||
if(array.size == 0){
|
if(array.size == 0){
|
||||||
hosts.add("$text.hosts.none").pad(10f);
|
hosts.add("$text.hosts.none").pad(10f);
|
||||||
hosts.add().growX();
|
hosts.add().growX();
|
||||||
hosts.addIButton("icon-loading", 16*2f, this::refresh).pad(-10f).padLeft(0).padTop(-6).size(70f, 74f);
|
hosts.addImageButton("icon-loading", 16*2f, this::refresh).pad(-10f).padLeft(0).padTop(-6).size(70f, 74f);
|
||||||
}else {
|
}else {
|
||||||
for (Address a : array) {
|
for (Address a : array) {
|
||||||
TextButton button = hosts.addButton("[accent]"+a.name, "clear", () -> {
|
TextButton button = hosts.addButton("[accent]"+a.name, "clear", () -> {
|
||||||
|
|||||||
@@ -6,12 +6,8 @@ import io.anuke.mindustry.core.GameState;
|
|||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.io.SaveIO;
|
import io.anuke.mindustry.io.SaveIO;
|
||||||
import io.anuke.mindustry.io.Saves.SaveSlot;
|
import io.anuke.mindustry.io.Saves.SaveSlot;
|
||||||
import io.anuke.ucore.UCore;
|
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.scene.builders.button;
|
|
||||||
import io.anuke.ucore.scene.builders.dialog;
|
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
|
||||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
import io.anuke.ucore.scene.ui.TextButton;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Table;
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
@@ -66,18 +62,18 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
button.table(t -> {
|
button.table(t -> {
|
||||||
t.right();
|
t.right();
|
||||||
|
|
||||||
t.addIButton("icon-floppy", "emptytoggle", 14*3, () -> {
|
t.addImageButton("icon-floppy", "emptytoggle", 14*3, () -> {
|
||||||
slot.setAutosave(!slot.isAutosave());
|
slot.setAutosave(!slot.isAutosave());
|
||||||
}).checked(slot.isAutosave()).right();
|
}).checked(slot.isAutosave()).right();
|
||||||
|
|
||||||
t.addIButton("icon-trash", "empty", 14*3, () -> {
|
t.addImageButton("icon-trash", "empty", 14*3, () -> {
|
||||||
Vars.ui.showConfirm("$text.confirm", "$text.save.delete.confirm", () -> {
|
Vars.ui.showConfirm("$text.confirm", "$text.save.delete.confirm", () -> {
|
||||||
slot.delete();
|
slot.delete();
|
||||||
setup();
|
setup();
|
||||||
});
|
});
|
||||||
}).size(14*3).right();
|
}).size(14*3).right();
|
||||||
|
|
||||||
t.addIButton("icon-dots", "empty", 14*3, () -> {
|
t.addImageButton("icon-dots", "empty", 14*3, () -> {
|
||||||
FloatingDialog dialog = new FloatingDialog("Save Options");
|
FloatingDialog dialog = new FloatingDialog("Save Options");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class PlayerListFragment implements Fragment{
|
|||||||
|
|
||||||
if(Net.server() && !player.isLocal){
|
if(Net.server() && !player.isLocal){
|
||||||
button.add().growY();
|
button.add().growY();
|
||||||
button.addIButton("icon-cancel", 14*3, () ->
|
button.addImageButton("icon-cancel", 14*3, () ->
|
||||||
Net.kickConnection(player.clientid)
|
Net.kickConnection(player.clientid)
|
||||||
).pad(-5).padBottom(-10).size(h+10, h+14);
|
).pad(-5).padBottom(-10).size(h+10, h+14);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class ToolFragment implements Fragment{
|
|||||||
|
|
||||||
tools = new Table();
|
tools = new Table();
|
||||||
|
|
||||||
tools.addIButton("icon-cancel", isize, () -> {
|
tools.addImageButton("icon-cancel", isize, () -> {
|
||||||
if(input.placeMode == PlaceMode.areaDelete && confirming){
|
if(input.placeMode == PlaceMode.areaDelete && confirming){
|
||||||
confirming = false;
|
confirming = false;
|
||||||
}else{
|
}else{
|
||||||
@@ -34,12 +34,12 @@ public class ToolFragment implements Fragment{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tools.addIButton("icon-rotate", isize, () -> {
|
tools.addImageButton("icon-rotate", isize, () -> {
|
||||||
input.rotation++;
|
input.rotation++;
|
||||||
input.rotation %= 4;
|
input.rotation %= 4;
|
||||||
});
|
});
|
||||||
|
|
||||||
tools.addIButton("icon-check", isize, () -> {
|
tools.addImageButton("icon-check", isize, () -> {
|
||||||
if(input.placeMode == PlaceMode.areaDelete && confirming){
|
if(input.placeMode == PlaceMode.areaDelete && confirming){
|
||||||
input.placeMode.released(px, py, px2, py2);
|
input.placeMode.released(px, py, px2, py2);
|
||||||
confirming = false;
|
confirming = false;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class WeaponFragment implements Fragment{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
weapontable.addIButton("icon-menu", 8*4, ()->{
|
weapontable.addImageButton("icon-menu", 8*4, ()->{
|
||||||
ui.showUpgrades();
|
ui.showUpgrades();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class Sorter extends Junction implements Configurable{
|
|||||||
|
|
||||||
for(int i = 0; i < items.size; i ++){
|
for(int i = 0; i < items.size; i ++){
|
||||||
final int f = i;
|
final int f = i;
|
||||||
ImageButton button = cont.addIButton("white", "toggle", 24, () -> {
|
ImageButton button = cont.addImageButton("white", "toggle", 24, () -> {
|
||||||
entity.sortItem = items.get(f);
|
entity.sortItem = items.get(f);
|
||||||
}).size(38, 42).padBottom(-5.1f).group(group).get();
|
}).size(38, 42).padBottom(-5.1f).group(group).get();
|
||||||
button.getStyle().imageUp = new TextureRegionDrawable(new TextureRegion(Draw.region("icon-"+items.get(i).name)));
|
button.getStyle().imageUp = new TextureRegionDrawable(new TextureRegion(Draw.region("icon-"+items.get(i).name)));
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class Teleporter extends Block implements Configurable{
|
|||||||
|
|
||||||
for(int i = 0; i < colors; i ++){
|
for(int i = 0; i < colors; i ++){
|
||||||
final int f = i;
|
final int f = i;
|
||||||
ImageButton button = cont.addIButton("white", "toggle", 24, () -> {
|
ImageButton button = cont.addImageButton("white", "toggle", 24, () -> {
|
||||||
entity.color = (byte)f;
|
entity.color = (byte)f;
|
||||||
lastColor = (byte)f;
|
lastColor = (byte)f;
|
||||||
}).size(34, 38).padBottom(-5.1f).group(group).get();
|
}).size(34, 38).padBottom(-5.1f).group(group).get();
|
||||||
|
|||||||
Reference in New Issue
Block a user