Fixed custom game waves / Fixed Windows appdata being incorrect

This commit is contained in:
Anuken
2018-09-29 14:25:29 -11:00
parent 5e1aaf11a7
commit e7533232c0
5 changed files with 34 additions and 30 deletions

View File

@@ -27,7 +27,7 @@ allprojects {
appName = 'Mindustry' appName = 'Mindustry'
gdxVersion = '1.9.8' gdxVersion = '1.9.8'
roboVMVersion = '2.3.0' roboVMVersion = '2.3.0'
uCoreVersion = '1a357ce1714f20663ec1680f64f4ff43631de07d' uCoreVersion = '1b74e58413f4885f204c441f88464d8c82c5433b'
getVersionString = { getVersionString = {
String buildVersion = getBuildVersion() String buildVersion = getBuildVersion()

View File

@@ -199,10 +199,10 @@ text.changelog.latest=[orange][[Latest version]
text.loading=[accent]Loading... text.loading=[accent]Loading...
text.saving=[accent]Saving... text.saving=[accent]Saving...
text.wave=[orange]Wave {0} text.wave=[orange]Wave {0}
text.wave.waiting=Wave in {0} text.wave.waiting=[LIGHT_GRAY]Wave in {0}
text.waiting=Waiting... text.waiting=[LIGHT_GRAY]Waiting...
text.enemies={0} Enemies text.wave.enemies=[LIGHT_GRAY]{0} Enemies Remaining
text.enemies.single={0} Enemy text.wave.enemy=[LIGHT_GRAY]{0} Enemy Remaining
text.loadimage=Load Image text.loadimage=Load Image
text.saveimage=Save Image text.saveimage=Save Image
text.unknown=Unknown text.unknown=Unknown
@@ -540,7 +540,7 @@ block.conveyor.name=Conveyor
block.titanium-conveyor.name=Titanium Conveyor block.titanium-conveyor.name=Titanium Conveyor
block.junction.name=Junction block.junction.name=Junction
block.router.name=Router block.router.name=Router
block.router.description=Splits items into all 4 directions. Can store items as a buffer. block.router.description=Splits items into all 4 directions.
block.distributor.name=Distributor block.distributor.name=Distributor
block.distributor.description=A splitter that can split items into 8 directions. block.distributor.description=A splitter that can split items into 8 directions.
block.sorter.name=Sorter block.sorter.name=Sorter

View File

@@ -136,7 +136,7 @@ public class Control extends Module{
int last = Settings.getInt("hiscore" + world.getMap().name, 0); int last = Settings.getInt("hiscore" + world.getMap().name, 0);
if(state.wave > last && !state.mode.infiniteResources && !state.mode.disableWaveTimer){ if(state.wave > last && !state.mode.infiniteResources && !state.mode.disableWaveTimer && world.getSector() == null){
Settings.putInt("hiscore" + world.getMap().name, state.wave); Settings.putInt("hiscore" + world.getMap().name, state.wave);
Settings.save(); Settings.save();
hiscore = true; hiscore = true;

View File

@@ -32,10 +32,6 @@ public class Maps implements Disposable{
/**Used for storing a list of custom map names for GWT.*/ /**Used for storing a list of custom map names for GWT.*/
private Array<String> customMapNames; private Array<String> customMapNames;
public Maps(){
}
/**Returns a list of all maps, including custom ones.*/ /**Returns a list of all maps, including custom ones.*/
public Array<Map> all(){ public Array<Map> all(){
return allMaps; return allMaps;

View File

@@ -103,8 +103,16 @@ public class HudFragment extends Fragment{
cont.row(); cont.row();
TextButton waves = cont.addButton("", ()->{}).fillX().height(66f).get(); Stack stack = new Stack();
TextButton waves = new TextButton("");
Table btable = new Table();
stack.add(waves);
stack.add(btable);
addWaveTable(waves); addWaveTable(waves);
addPlayButton(btable);
cont.add(stack).fillX().height(66f);
cont.row(); cont.row();
@@ -335,28 +343,30 @@ public class HudFragment extends Fragment{
} }
} }
private String getEnemiesRemaining(){
int enemies = unitGroups[Team.red.ordinal()].size();
if(enemies == 1){
return Bundles.format("text.enemies.single", enemies);
}else{
return Bundles.format("text.enemies", enemies);
}
}
private void addWaveTable(TextButton table){ private void addWaveTable(TextButton table){
wavetable = table; wavetable = table;
float uheight = 66f;
IntFormat wavef = new IntFormat("text.wave"); IntFormat wavef = new IntFormat("text.wave");
IntFormat timef = new IntFormat("text.wave.waiting"); IntFormat waitf = new IntFormat("text.wave.waiting");
IntFormat enemyf = new IntFormat("text.wave.enemy");
IntFormat enemiesf = new IntFormat("text.wave.enemies");
table.clearChildren(); table.clearChildren();
table.setTouchable(Touchable.enabled); table.setTouchable(Touchable.enabled);
table.background("button"); table.background("button");
table.labelWrap(() -> world.getSector() == null ? wavef.get(state.wave) :
Bundles.format("text.mission.display", world.getSector().currentMission().displayString())).growX(); table.labelWrap(() ->
world.getSector() == null ?
(unitGroups[waveTeam.ordinal()].size() > 0 && state.mode.disableWaveTimer ?
wavef.get(state.wave) + "\n" + (unitGroups[waveTeam.ordinal()].size() == 1 ?
enemyf.get(unitGroups[waveTeam.ordinal()].size()) :
enemiesf.get(unitGroups[waveTeam.ordinal()].size())) :
wavef.get(state.wave) + "\n" +
(!state.mode.disableWaveTimer ?
Bundles.format("text.wave.waiting", (int)(state.wavetime/60)) :
Bundles.get("text.waiting"))) :
Bundles.format("text.mission.display", world.getSector().currentMission().displayString())).growX();
table.clicked(() -> { table.clicked(() -> {
if(world.getSector() != null && world.getSector().currentMission().hasMessage()){ if(world.getSector() != null && world.getSector().currentMission().hasMessage()){
@@ -366,18 +376,16 @@ public class HudFragment extends Fragment{
table.setDisabled(() -> !(world.getSector() != null && world.getSector().currentMission().hasMessage())); table.setDisabled(() -> !(world.getSector() != null && world.getSector().currentMission().hasMessage()));
table.visible(() -> !((world.getSector() == null && state.mode.disableWaves) || !state.mode.showMission)); table.visible(() -> !((world.getSector() == null && state.mode.disableWaves) || !state.mode.showMission));
//playButton(uheight);
} }
private void playButton(float uheight){ private void addPlayButton(Table table){
wavetable.addImageButton("icon-play", 30f, () -> { table.right().addImageButton("icon-play", 30f, () -> {
if(Net.client() && players[0].isAdmin){ if(Net.client() && players[0].isAdmin){
Call.onAdminRequest(players[0], AdminAction.wave); Call.onAdminRequest(players[0], AdminAction.wave);
}else{ }else{
state.wavetime = 0f; state.wavetime = 0f;
} }
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padLeft(-15).padRight(-10).width(40f).update(l -> { }).growY().fillX().right().width(40f).update(l -> {
boolean vis = state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active()); boolean vis = state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active());
boolean paused = state.is(State.paused) || !vis; boolean paused = state.is(State.paused) || !vis;