mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 23:38:10 +07:00
Slightly more fleshed out sector selection
This commit is contained in:
@ -36,11 +36,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@ -55,17 +51,6 @@ public class AndroidLauncher extends PatchedAndroidApplication{
|
||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||
config.useImmersiveMode = true;
|
||||
Platform.instance = new Platform(){
|
||||
DateFormat format = SimpleDateFormat.getDateTimeInstance();
|
||||
|
||||
@Override
|
||||
public String format(Date date){
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(int number){
|
||||
return NumberFormat.getIntegerInstance().format(number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDialog(TextField field, int length){
|
||||
@ -133,6 +118,7 @@ public class AndroidLauncher extends PatchedAndroidApplication{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
try{
|
||||
ProviderInstaller.installIfNeeded(this);
|
||||
}catch(GooglePlayServicesRepairableException e){
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,7 @@ import io.anuke.ucore.util.Strings;
|
||||
|
||||
import java.net.NetworkInterface;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@ -47,16 +45,6 @@ public class DesktopPlatform extends Platform{
|
||||
new FileChooser(text, file -> file.extension().equalsIgnoreCase(filter), open, cons).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(Date date){
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(int number){
|
||||
return NumberFormat.getIntegerInstance().format(number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRPC(){
|
||||
|
||||
|
@ -19,12 +19,7 @@ import org.robovm.apple.foundation.NSURL;
|
||||
import org.robovm.apple.uikit.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static org.robovm.apple.foundation.NSPathUtilities.getDocumentsDirectory;
|
||||
@ -44,17 +39,6 @@ public class IOSLauncher extends IOSApplication.Delegate {
|
||||
}
|
||||
|
||||
Platform.instance = new Platform() {
|
||||
DateFormat format = SimpleDateFormat.getDateTimeInstance();
|
||||
|
||||
@Override
|
||||
public String format(Date date) {
|
||||
return format.format(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(int number) {
|
||||
return NumberFormat.getIntegerInstance().format(number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDialog(TextField field) {
|
||||
@ -66,11 +50,6 @@ public class IOSLauncher extends IOSApplication.Delegate {
|
||||
TextFieldDialogListener.add(field, maxLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocaleName(Locale locale) {
|
||||
return locale.getDisplayName(locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shareFile(FileHandle file){
|
||||
FileHandle to = Gdx.files.absolute(getDocumentsDirectory()).child(file.name());
|
||||
|
Reference in New Issue
Block a user