Slightly more fleshed out sector selection
This commit is contained in:
@@ -6,18 +6,12 @@ import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.scene.ui.TextField;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class Platform {
|
||||
/**Each separate game platform should set this instance to their own implementation.*/
|
||||
public static Platform instance = new Platform() {};
|
||||
|
||||
/**Format the date using the default date formatter.*/
|
||||
public String format(Date date){return "invalid";}
|
||||
/**Format a number by adding in commas or periods where needed.*/
|
||||
public String format(int number){return "invalid";}
|
||||
|
||||
/**Add a text input dialog that should show up after the field is tapped.*/
|
||||
public void addDialog(TextField field){
|
||||
addDialog(field, 16);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.anuke.mindustry.io;
|
||||
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.maps.Map;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
@@ -23,7 +23,7 @@ public class SaveMeta{
|
||||
public SaveMeta(int version, long date, long timePlayed, int build, int sector, int mode, String map, int wave, Difficulty difficulty){
|
||||
this.version = version;
|
||||
this.build = build;
|
||||
this.date = Platform.instance.format(new Date(date));
|
||||
this.date = SimpleDateFormat.getDateTimeInstance().format(new Date(date));
|
||||
this.timePlayed = timePlayed;
|
||||
this.sector = sector;
|
||||
this.mode = GameMode.values()[mode];
|
||||
|
||||
@@ -228,11 +228,6 @@ public class Sectors{
|
||||
sector.missions.add(new BattleMission());
|
||||
}
|
||||
|
||||
//possibly another battle mission
|
||||
if(Mathf.randomSeed(sector.getSeed() + 3) < 0.3){
|
||||
sector.missions.add(new BattleMission());
|
||||
}
|
||||
|
||||
//possibly add another recipe mission
|
||||
addRecipeMission(sector, 11);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BattleMission extends Mission{
|
||||
|
||||
@Override
|
||||
public void generate(Generation gen){
|
||||
super.generate(gen);
|
||||
generateCoreAt(gen, 50, 50, defaultTeam);
|
||||
|
||||
if(state.teams.get(defaultTeam).cores.size == 0){
|
||||
return;
|
||||
|
||||
@@ -95,9 +95,7 @@ public abstract class Mission{
|
||||
return Array.with();
|
||||
}
|
||||
|
||||
public void generate(Generation gen){
|
||||
generateCoreAt(gen, 50, 50, defaultTeam);
|
||||
}
|
||||
public void generate(Generation gen){}
|
||||
|
||||
public void generateCoreAt(Generation gen, int coreX, int coreY, Team team){
|
||||
gen.tiles[coreX][coreY].setBlock(StorageBlocks.core);
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
import io.anuke.ucore.scene.event.InputEvent;
|
||||
@@ -28,7 +29,7 @@ public class SectorsDialog extends FloatingDialog{
|
||||
margin(0);
|
||||
getTitleTable().clear();
|
||||
clear();
|
||||
add(content()).grow();
|
||||
stack(content(), buttons()).grow();
|
||||
|
||||
shown(this::setup);
|
||||
}
|
||||
@@ -37,8 +38,9 @@ public class SectorsDialog extends FloatingDialog{
|
||||
selected = null;
|
||||
content().clear();
|
||||
buttons().clear();
|
||||
buttons().bottom().margin(15);
|
||||
|
||||
// addCloseButton();
|
||||
addCloseButton();
|
||||
|
||||
/*
|
||||
content().label(() -> Bundles.format("text.sector", selected == null ? Bundles.get("text.none") :
|
||||
@@ -139,18 +141,16 @@ public class SectorsDialog extends FloatingDialog{
|
||||
Sector sector = world.sectors.get(sectorX, sectorY);
|
||||
int width = 1;
|
||||
int height = 1;
|
||||
float paddingx = (width-1);
|
||||
float paddingy = (height-1);
|
||||
|
||||
if(sector == null || sector.texture == null){
|
||||
continue;
|
||||
}
|
||||
|
||||
drawX += (width-1)/2f*padSectorSize;
|
||||
drawY += (height-1)/2f*padSectorSize;
|
||||
drawX += (width)/2f*padSectorSize;
|
||||
drawY += (height)/2f*padSectorSize;
|
||||
|
||||
Draw.colorl(!sector.complete ? 0.3f : 1f);
|
||||
Draw.rect(sector.texture, drawX, drawY, sectorSize * width + paddingx, sectorSize * height + paddingy);
|
||||
Draw.rect(sector.texture, drawX, drawY, sectorSize * width + 1f, sectorSize * height + 1f);
|
||||
|
||||
float stroke = 4f;
|
||||
|
||||
@@ -170,7 +170,8 @@ public class SectorsDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
Lines.stroke(Unit.dp.scl(stroke));
|
||||
Lines.crect(drawX, drawY, sectorSize * width + paddingx, sectorSize * height + paddingy, 0);
|
||||
Fill.square(drawX, drawY, Unit.dp.scl(10f), 45f);
|
||||
//Lines.crect(drawX, drawY, sectorSize * width + paddingx, sectorSize * height + paddingy, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user