Major bugfix, new incomplete placemodes

This commit is contained in:
Anuken
2017-12-15 01:39:54 -05:00
parent 52a996cf77
commit 64439126a3
22 changed files with 728 additions and 535 deletions

View File

@@ -14,7 +14,6 @@ import io.anuke.mindustry.world.GameMode;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.function.StringSupplier;
import io.anuke.ucore.scene.actions.Actions;
import io.anuke.ucore.scene.builders.imagebutton;
import io.anuke.ucore.scene.builders.label;
@@ -25,7 +24,6 @@ import io.anuke.ucore.scene.ui.Label;
import io.anuke.ucore.scene.ui.layout.Cell;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.ui.layout.Unit;
import io.anuke.ucore.util.Profiler;
public class HudFragment implements Fragment{
private Table itemtable, respawntable;
@@ -137,26 +135,14 @@ public class HudFragment implements Fragment{
new table(){{
abottom();
aleft();
new label((StringSupplier)()->"[purple]tiles: " + Vars.control.tileGroup.amount()).left();
new label(()->"[purple]tiles: " + Vars.control.tileGroup.amount()).left();
row();
new label((StringSupplier)()->"[purple]enemies: " + Vars.control.enemyGroup.amount()).left();
new label(()->"[purple]enemies: " + Vars.control.enemyGroup.amount()).left();
row();
new label((StringSupplier)()->"[orange]noclip: " + Vars.noclip).left();
new label(()->"[orange]noclip: " + Vars.noclip).left();
row();
new label("[red]DEBUG MODE").scale(0.5f).left();
}}.end();
if(profile){
new table(){{
atop();
new table("button"){{
defaults().left().growX();
atop();
aleft();
new label((StringSupplier)()->Profiler.formatDisplayTimes());
}}.width(400f).units(Unit.dp).end();
}}.end();
}
}
}
@@ -188,8 +174,6 @@ public class HudFragment implements Fragment{
}}.left().end();
playButton(uheight);
//get().padTop(Unit.dp.inPixels(1));
//get().padBottom(Unit.dp.inPixels(1));
}}.height(uheight).units(Unit.dp).fillX().expandX().end();
}

View File

@@ -8,7 +8,6 @@ import io.anuke.mindustry.core.GameState;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.input.PlaceMode;
import io.anuke.ucore.scene.builders.imagebutton;
import io.anuke.ucore.scene.builders.label;
import io.anuke.ucore.scene.builders.table;
import io.anuke.ucore.scene.event.Touchable;
import io.anuke.ucore.scene.ui.ButtonGroup;
@@ -28,8 +27,8 @@ public class PlacementFragment implements Fragment{
new table("pane"){{
get().setTouchable(Touchable.enabled);
new label(()->"Placement Mode: [orange]" + player.placeMode.name()).pad(4).units(Unit.dp);
row();
//new label(()->"Placement Mode: [orange]" + player.placeMode.name()).pad(4).units(Unit.dp);
//row();
aleft();
@@ -37,19 +36,28 @@ public class PlacementFragment implements Fragment{
aleft();
ButtonGroup<ImageButton> group = new ButtonGroup<>();
defaults().size(58, 62).pad(6).units(Unit.dp);
defaults().size(52, 56).pad(0).units(Unit.dp);
int d = 0;
for(PlaceMode mode : PlaceMode.values()){
if(!mode.shown) continue;
new imagebutton("icon-" + mode.name(), "toggle", Unit.dp.inPixels(10*3), ()->{
control.getInput().resetCursor();
player.placeMode = mode;
}){{
group.add(get());
}};
}}.padBottom(-5.5f).units(Unit.dp);
if(++d % 2 == 0){
row();
}
}
new imagebutton("icon-cancel", Unit.dp.inPixels(14*3), ()->{
player.recipe = null;
}).visible(()->player.recipe != null && player.placeMode == PlaceMode.touch);
}).visible(()->player.recipe != null && player.placeMode.showCancel);
new imagebutton("icon-rotate-arrow", Unit.dp.inPixels(14*3), ()->{
player.rotation ++;
@@ -57,7 +65,7 @@ public class PlacementFragment implements Fragment{
}).update(i->{
i.getImage().setOrigin(Align.center);
i.getImage().setRotation(player.rotation*90);
}).visible(()->player.recipe != null && player.placeMode == PlaceMode.touch
}).visible(() -> player.recipe != null && player.placeMode.showRotate
&& player.recipe.result.rotate);
}}.left().end();

View File

@@ -27,8 +27,7 @@ public class ToolFragment implements Fragment{
});
tools.addIButton("icon-check", Unit.dp.inPixels(42), ()->{
player.placeMode.tapped(control.getInput().getBlockX(), control.getInput().getBlockY(),
control.getInput().getBlockEndX(), control.getInput().getBlockEndY());
player.placeMode.tapped(control.getInput().getBlockX(), control.getInput().getBlockY());
});
Core.scene.add(tools);