Many bugfixes and tweaks
This commit is contained in:
@@ -14,6 +14,7 @@ import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Section;
|
||||
import io.anuke.mindustry.ui.FloatingDialog;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.ui.*;
|
||||
@@ -105,7 +106,7 @@ public class BlocksFragment implements Fragment{
|
||||
//image.setDisabled(!has);
|
||||
image.setChecked(player.recipe == r);
|
||||
image.setTouchable(canPlace ? Touchable.enabled : Touchable.disabled);
|
||||
image.getImage().setColor(has ? Color.WHITE : Color.DARK_GRAY);
|
||||
image.getImage().setColor(has ? Color.WHITE : Hue.lightness(0.33f));
|
||||
});
|
||||
|
||||
if(i % rows == rows-1)
|
||||
@@ -195,7 +196,7 @@ public class BlocksFragment implements Fragment{
|
||||
}).size(110, 50).pad(10f).units(Unit.dp);
|
||||
|
||||
d.show();
|
||||
}).expandX().padLeft(4).top().right().size(36f, 40f).units(Unit.dp);
|
||||
}).expandX().padLeft(4).top().right().size(42f, 46f).padTop(-2).units(Unit.dp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import io.anuke.ucore.scene.actions.Actions;
|
||||
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.Image;
|
||||
import io.anuke.ucore.scene.ui.Label;
|
||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||
@@ -42,7 +43,7 @@ public class HudFragment implements Fragment{
|
||||
|
||||
new table(){{
|
||||
left();
|
||||
defaults().size(66).units(Unit.dp).left();
|
||||
defaults().size(68).units(Unit.dp).left();
|
||||
float isize = Unit.dp.inPixels(40);
|
||||
|
||||
new imagebutton("icon-menu", isize, ()->{
|
||||
@@ -64,6 +65,12 @@ public class HudFragment implements Fragment{
|
||||
|
||||
row();
|
||||
|
||||
new table(){{
|
||||
addWaveTable();
|
||||
}}.fillX().end();
|
||||
|
||||
row();
|
||||
|
||||
itemtable = new table("button").end().top().left().fillX().size(-1).get();
|
||||
itemtable.setVisible(()-> control.getMode() != GameMode.sandbox);
|
||||
itemcell = get().getCell(itemtable);
|
||||
@@ -95,29 +102,16 @@ public class HudFragment implements Fragment{
|
||||
|
||||
//wave table...
|
||||
new table(){{
|
||||
atop();
|
||||
aright();
|
||||
|
||||
float uheight = 72f;
|
||||
if(!Vars.android){
|
||||
atop();
|
||||
aright();
|
||||
}else{
|
||||
abottom();
|
||||
aleft();
|
||||
}
|
||||
|
||||
new imagebutton("icon-play", Unit.dp.inPixels(30f), ()->{
|
||||
Vars.control.runWave();
|
||||
}).size(uheight).uniformY().units(Unit.dp)
|
||||
.visible(()-> Vars.control.getMode() == GameMode.sandbox && Vars.control.getEnemiesRemaining() <= 0);
|
||||
|
||||
new table("button"){{
|
||||
|
||||
new label(()->"[orange]Wave " + control.getWave()).scale(fontscale*2f).left();
|
||||
|
||||
row();
|
||||
|
||||
new label(()-> control.getEnemiesRemaining() > 0 ?
|
||||
control.getEnemiesRemaining() + " Enemies remaining" :
|
||||
(control.getTutorial().active() || Vars.control.getMode() == GameMode.sandbox) ? "waiting..." : "New wave in " + (int) (control.getWaveCountdown() / 60f))
|
||||
.minWidth(150);
|
||||
|
||||
get().pad(Unit.dp.inPixels(12));
|
||||
}}.height(uheight).units(Unit.dp);
|
||||
//addWaveTable();
|
||||
|
||||
visible(()->!GameState.is(State.menu));
|
||||
}}.end();
|
||||
@@ -166,6 +160,46 @@ public class HudFragment implements Fragment{
|
||||
}
|
||||
}
|
||||
|
||||
private void addWaveTable(){
|
||||
float uheight = 66f;
|
||||
|
||||
new table("button"){{
|
||||
aleft();
|
||||
new table(){{
|
||||
aleft();
|
||||
|
||||
new label(()->"[orange]Wave " + control.getWave()).scale(fontscale*1.5f).left();
|
||||
|
||||
row();
|
||||
|
||||
new label(()-> control.getEnemiesRemaining() > 0 ?
|
||||
control.getEnemiesRemaining() + " enemies" :
|
||||
(control.getTutorial().active() || Vars.control.getMode() == GameMode.sandbox) ? "waiting..." : "Wave in " + (int) (control.getWaveCountdown() / 60f))
|
||||
.minWidth(140).left();
|
||||
|
||||
get().pad(Unit.dp.inPixels(12));
|
||||
}}.left().padLeft(-6).end();
|
||||
|
||||
playButton(uheight);
|
||||
//get().padTop(Unit.dp.inPixels(1));
|
||||
//get().padBottom(Unit.dp.inPixels(1));
|
||||
}}.height(uheight).units(Unit.dp).fillX().expandX().end();
|
||||
|
||||
}
|
||||
|
||||
private void playButton(float uheight){
|
||||
new imagebutton("icon-play", Unit.dp.inPixels(30f), ()->{
|
||||
Vars.control.runWave();
|
||||
}).height(uheight).fillX().padTop(-8f).padBottom(-12f).padRight(-18f).padLeft(-10f).width(40f).units(Unit.dp).update(l->{
|
||||
boolean vis = Vars.control.getMode() == GameMode.sandbox && Vars.control.getEnemiesRemaining() <= 0;
|
||||
boolean paused = GameState.is(State.paused) || !vis;
|
||||
|
||||
l.setVisible(vis);
|
||||
l.getStyle().imageUp = Core.skin.getDrawable(vis ? "icon-play" : "clear");
|
||||
l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled);
|
||||
});
|
||||
}
|
||||
|
||||
public void updateItems(){
|
||||
|
||||
itemtable.clear();
|
||||
|
||||
Reference in New Issue
Block a user