mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-31 07:00:06 +07:00
Added requirement display / Text fixes / Better crash reports
This commit is contained in:
@ -27,7 +27,7 @@ allprojects {
|
||||
gdxVersion = '1.9.8'
|
||||
roboVMVersion = '2.3.0'
|
||||
aiVersion = '1.8.1'
|
||||
uCoreVersion = 'f937c5cad6'
|
||||
uCoreVersion = 'e1749b8798'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
BIN
core/assets-raw/sprites/ui/icons/icon-item.png
Normal file
BIN
core/assets-raw/sprites/ui/icons/icon-item.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 189 B |
BIN
core/assets-raw/sprites/ui/icons/icon-missing.png
Normal file
BIN
core/assets-raw/sprites/ui/icons/icon-missing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 B |
@ -292,6 +292,7 @@ text.blocks.inputfuel=Fuel
|
||||
text.blocks.fuelburntime=Fuel Burn Time
|
||||
text.blocks.inputcapacity=Input capacity
|
||||
text.blocks.outputcapacity=Output capacity
|
||||
text.blocks.required=Required:
|
||||
|
||||
text.unit.blocks=blocks
|
||||
text.unit.powersecond=power units/second
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 133 KiB |
@ -128,6 +128,7 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
||||
itemCapacity = 20;
|
||||
hasItems = true;
|
||||
hasPower = true;
|
||||
hasLiquids = true;
|
||||
output = Items.blastCompound;
|
||||
size = 2;
|
||||
|
||||
|
@ -3,7 +3,6 @@ package io.anuke.mindustry.editor;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
@ -26,7 +25,6 @@ import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Pixmaps;
|
||||
import io.anuke.ucore.input.Input;
|
||||
import io.anuke.ucore.scene.actions.Actions;
|
||||
import io.anuke.ucore.scene.builders.build;
|
||||
@ -115,10 +113,10 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
}
|
||||
});
|
||||
}, true, mapExtension);
|
||||
},
|
||||
}/*,
|
||||
"$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Listenable)() -> {
|
||||
if(gwt){
|
||||
ui.showError("text.web.unsupported");
|
||||
ui.showError("$text.web.unsupported");
|
||||
}else {
|
||||
Platform.instance.showFileChooser("$text.loadimage", "Image Files", file -> {
|
||||
ui.loadAnd(() -> {
|
||||
@ -134,7 +132,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
});
|
||||
}, true, "png");
|
||||
}
|
||||
}));
|
||||
}*/));
|
||||
|
||||
t.addImageTextButton("$text.editor.export", "icon-save-map", isize, () -> createDialog("$text.editor.export",
|
||||
"$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Listenable)() -> {
|
||||
@ -165,11 +163,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
Log.err(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
}/*,
|
||||
"$text.editor.exportimage", "$text.editor.exportimage.description", "icon-file-image", (Listenable)() -> {
|
||||
if(gwt){
|
||||
ui.showError("text.web.unsupported");
|
||||
}else {
|
||||
ui.showError("$text.web.unsupported");
|
||||
}else{
|
||||
Platform.instance.showFileChooser("$text.saveimage", "Image Files", file -> {
|
||||
file = file.parent().child(file.nameWithoutExtension() + ".png");
|
||||
FileHandle result = file;
|
||||
@ -183,7 +181,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
});
|
||||
}, false, "png");
|
||||
}
|
||||
}));
|
||||
}*/));
|
||||
|
||||
t.row();
|
||||
|
||||
|
@ -130,18 +130,6 @@ public class OverlayRenderer {
|
||||
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1], values[1]);
|
||||
}
|
||||
|
||||
Draw.color(Palette.bar);
|
||||
|
||||
int idx = 0;
|
||||
for(Consume cons : block.consumes.all()){
|
||||
if(!cons.isOptional() && !cons.valid(block, entity)){
|
||||
Fill.crect(entity.x - 4 + idx*4, entity.y + block.size*tilesize/2f + values[0] + 4, 3, 3);
|
||||
idx ++;
|
||||
}
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
doDraw[0] = true;
|
||||
values[0] = 0;
|
||||
values[1] = 1;
|
||||
|
@ -12,7 +12,7 @@ public class Version {
|
||||
public static String name;
|
||||
public static String type;
|
||||
public static String code;
|
||||
public static int build;
|
||||
public static int build = 0;
|
||||
public static String buildName;
|
||||
|
||||
public static void init(){
|
||||
|
@ -18,9 +18,7 @@ public class ItemImage extends Stack {
|
||||
t.row();
|
||||
t.label(text).get().setFontScale(Unit.dp.scl(0.5f));
|
||||
|
||||
Image image = new Image(region);
|
||||
|
||||
add(image);
|
||||
add(new Image(region));
|
||||
add(t);
|
||||
}
|
||||
|
||||
@ -31,9 +29,7 @@ public class ItemImage extends Stack {
|
||||
t.row();
|
||||
t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f));
|
||||
|
||||
Image image = new Image(stack.item.region);
|
||||
|
||||
add(image);
|
||||
add(new Image(stack.item.region));
|
||||
add(t);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
||||
public class ContentInfoDialog extends FloatingDialog {
|
||||
|
||||
public ContentInfoDialog(){
|
||||
super("$text.info");
|
||||
super("$text.info.title");
|
||||
|
||||
addCloseButton();
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.Consume;
|
||||
@ -13,8 +15,7 @@ import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class BlockConsumeFragment extends Fragment {
|
||||
private Table table;
|
||||
@ -33,6 +34,9 @@ public class BlockConsumeFragment extends Fragment {
|
||||
ObjectSet<Consume> consumers = new ObjectSet<>();
|
||||
TileEntity entity = tile.entity;
|
||||
Block block = tile.block();
|
||||
Consume[] lastCurrent = {null};
|
||||
|
||||
table.clearChildren();
|
||||
|
||||
//table.background("clear");
|
||||
rebuild(block, entity);
|
||||
@ -64,7 +68,7 @@ public class BlockConsumeFragment extends Fragment {
|
||||
rebuild(block, entity);
|
||||
}
|
||||
|
||||
Vector2 v = Graphics.screen(tile.drawx() - tile.block().size * tilesize/2f, tile.drawy() + tile.block().size * tilesize/2f);
|
||||
Vector2 v = Graphics.screen(tile.drawx() - tile.block().size * tilesize/2f, tile.drawy() + tile.block().size * tilesize/2f);
|
||||
table.pack();
|
||||
table.setPosition(v.x, v.y, Align.topRight);
|
||||
});
|
||||
@ -80,10 +84,27 @@ public class BlockConsumeFragment extends Fragment {
|
||||
|
||||
private void rebuild(Block block, TileEntity entity){
|
||||
table.clearChildren();
|
||||
table.left();
|
||||
|
||||
int scale = mobile ? 4 : 3;
|
||||
|
||||
for(Consume c : block.consumes.array()){
|
||||
if(!c.isOptional() && !c.valid(block, entity)){
|
||||
c.build(table);
|
||||
boolean[] hovered = {false};
|
||||
|
||||
table.table("inventory", c::buildTooltip).visible(() -> hovered[0]).height(scale * 10 + 6).padBottom(-4).right().update(t -> {
|
||||
if(t.getChildren().size == 0) t.remove();
|
||||
});
|
||||
|
||||
Table result = table.table(out -> {
|
||||
out.addImage(c.getIcon()).size(10*scale).color(Color.DARK_GRAY).padRight(-10*scale).padBottom(-scale*2);
|
||||
out.addImage(c.getIcon()).size(10*scale).color(Palette.accent);
|
||||
out.addImage("icon-missing").size(10*scale).color(Palette.remove).padLeft(-10*scale);
|
||||
}).size(10*scale).get();
|
||||
|
||||
result.hovered(() -> hovered[0] = true);
|
||||
result.exited(() -> hovered[0] = false);
|
||||
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,15 @@
|
||||
package io.anuke.mindustry.world.consumers;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.ucore.scene.ui.Tooltip;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.mobile;
|
||||
|
||||
public abstract class Consume {
|
||||
private boolean optional;
|
||||
private boolean update = true;
|
||||
@ -35,19 +37,18 @@ public abstract class Consume {
|
||||
t.margin(4);
|
||||
buildTooltip(t);
|
||||
|
||||
table.table("clear", out -> {
|
||||
out.addImage(getIcon()).size(10*4).color(Color.RED);
|
||||
}).size(10*4).get().addListener(new Tooltip<>(t));
|
||||
int scale = mobile ? 4 : 3;
|
||||
|
||||
table.table(out -> {
|
||||
out.addImage(getIcon()).size(10*scale).color(Color.DARK_GRAY).padRight(-10*scale).padBottom(-scale*2);
|
||||
out.addImage(getIcon()).size(10*scale).color(Palette.accent);
|
||||
out.addImage("icon-missing").size(10*scale).color(Palette.remove).padLeft(-10*scale);
|
||||
}).size(10*scale).get().addListener(new Tooltip<>(t));
|
||||
}
|
||||
|
||||
public void buildTooltip(Table table){
|
||||
table.add("no " + ClassReflection.getSimpleName(getClass()).replace("Consume", ""));
|
||||
}
|
||||
|
||||
public String getIcon(){
|
||||
return "icon-power";
|
||||
}
|
||||
public abstract void buildTooltip(Table table);
|
||||
|
||||
public abstract String getIcon();
|
||||
public abstract void update(Block block, TileEntity entity);
|
||||
public abstract boolean valid(Block block, TileEntity entity);
|
||||
public abstract void display(BlockStats stats);
|
||||
|
@ -2,9 +2,12 @@ package io.anuke.mindustry.world.consumers;
|
||||
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.ui.ItemImage;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class ConsumeItem extends Consume {
|
||||
private final Item item;
|
||||
@ -28,6 +31,16 @@ public class ConsumeItem extends Consume {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTooltip(Table table) {
|
||||
table.add(new ItemImage(new ItemStack(item, amount))).size(8*4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return "icon-item";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Block block, TileEntity entity) {
|
||||
//doesn't update because consuming items is very specific
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.consumers;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
@ -7,12 +8,35 @@ import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.mindustry.world.meta.values.ItemFilterValue;
|
||||
import io.anuke.ucore.function.Predicate;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class ConsumeItemFilter extends Consume{
|
||||
private final Predicate<Item> item;
|
||||
private final Predicate<Item> filter;
|
||||
|
||||
public ConsumeItemFilter(Predicate<Item> item) {
|
||||
this.item = item;
|
||||
this.filter = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTooltip(Table table) {
|
||||
Array<Item> list = new Array<>();
|
||||
|
||||
for(Item item : Item.all()){
|
||||
if(filter.test(item)) list.add(item);
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size; i++) {
|
||||
Item item = list.get(i);
|
||||
table.addImage(item.region).size(8*4).padRight(2).padLeft(2);
|
||||
if(i != list.size - 1){
|
||||
table.add("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return "icon-item";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -24,7 +48,7 @@ public class ConsumeItemFilter extends Consume{
|
||||
public boolean valid(Block block, TileEntity entity) {
|
||||
for(int i = 0; i < Item.all().size; i ++){
|
||||
Item item = Item.getByID(i);
|
||||
if(entity.items.has(item) && this.item.test(item)){
|
||||
if(entity.items.has(item) && this.filter.test(item)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -33,6 +57,6 @@ public class ConsumeItemFilter extends Consume{
|
||||
|
||||
@Override
|
||||
public void display(BlockStats stats) {
|
||||
stats.add(BlockStat.inputItems, new ItemFilterValue(item));
|
||||
stats.add(BlockStat.inputItems, new ItemFilterValue(filter));
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,12 @@ package io.anuke.mindustry.world.consumers;
|
||||
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.ui.ItemImage;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.mindustry.world.meta.values.ItemListValue;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class ConsumeItems extends Consume {
|
||||
private ItemStack[] items;
|
||||
@ -18,6 +20,18 @@ public class ConsumeItems extends Consume {
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTooltip(Table table) {
|
||||
for(ItemStack stack : items){
|
||||
table.add(new ItemImage(stack)).size(8*4).padRight(5);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return "icon-item";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Block block, TileEntity entity) {
|
||||
|
||||
|
@ -7,6 +7,7 @@ import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.mindustry.world.meta.StatUnit;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class ConsumeLiquid extends Consume {
|
||||
protected final float use;
|
||||
@ -25,6 +26,16 @@ public class ConsumeLiquid extends Consume {
|
||||
return liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTooltip(Table table) {
|
||||
table.addImage(liquid.getContentIcon()).size(8*3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return "icon-liquid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Block block, TileEntity entity) {
|
||||
entity.liquids.remove(liquid, Math.min(use(block), entity.liquids.get(liquid)));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.consumers;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
@ -9,14 +10,16 @@ import io.anuke.mindustry.world.meta.StatUnit;
|
||||
import io.anuke.mindustry.world.meta.values.LiquidFilterValue;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.function.Predicate;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
public class ConsumeLiquidFilter extends Consume{
|
||||
private final Predicate<Liquid> liquid;
|
||||
private final Predicate<Liquid> filter;
|
||||
private final float use;
|
||||
private final boolean isFuel;
|
||||
|
||||
public ConsumeLiquidFilter(Predicate<Liquid> liquid, float amount, boolean isFuel) {
|
||||
this.liquid = liquid;
|
||||
this.filter = liquid;
|
||||
this.use = amount;
|
||||
this.isFuel = isFuel;
|
||||
}
|
||||
@ -25,23 +28,47 @@ public class ConsumeLiquidFilter extends Consume{
|
||||
this(liquid, amount, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void buildTooltip(Table table) {
|
||||
Array<Liquid> list = new Array<>();
|
||||
|
||||
for(Liquid item : Liquid.all()){
|
||||
if(!item.isHidden() && filter.test(item)) list.add(item);
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size; i++) {
|
||||
Liquid item = list.get(i);
|
||||
table.addImage(item.getContentIcon()).size(8*3).padRight(2).padLeft(2).padTop(2).padBottom(2);
|
||||
if(i != list.size - 1){
|
||||
table.add("/");
|
||||
}
|
||||
}
|
||||
|
||||
table.add("x" + Strings.toFixed(use * 60f, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return "icon-liquid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Block block, TileEntity entity) {
|
||||
entity.liquids.remove(entity.liquids.current(), use(block));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean valid(Block block, TileEntity entity) {
|
||||
return liquid.test(entity.liquids.current()) && entity.liquids.currentAmount() >= use(block);
|
||||
return filter.test(entity.liquids.current()) && entity.liquids.currentAmount() >= use(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(BlockStats stats) {
|
||||
if(isFuel){
|
||||
stats.add(BlockStat.inputLiquidFuel, new LiquidFilterValue(liquid));
|
||||
stats.add(BlockStat.inputLiquidFuel, new LiquidFilterValue(filter));
|
||||
stats.add(BlockStat.liquidFuelUse, 60f * use, StatUnit.liquidSecond);
|
||||
}else {
|
||||
stats.add(BlockStat.inputLiquid, new LiquidFilterValue(liquid));
|
||||
stats.add(BlockStat.inputLiquid, new LiquidFilterValue(filter));
|
||||
stats.add(BlockStat.liquidUse, 60f * use, StatUnit.liquidSecond);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import io.anuke.mindustry.world.meta.BlockStat;
|
||||
import io.anuke.mindustry.world.meta.BlockStats;
|
||||
import io.anuke.mindustry.world.meta.StatUnit;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class ConsumePower extends Consume {
|
||||
private final float use;
|
||||
@ -14,6 +15,16 @@ public class ConsumePower extends Consume {
|
||||
this.use = use;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTooltip(Table table) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon() {
|
||||
return "icon-power";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Block block, TileEntity entity) {
|
||||
entity.power.amount -= Math.min(use(block), entity.power.amount);
|
||||
|
@ -38,10 +38,10 @@ public class CrashHandler {
|
||||
header += "Build: " + Version.build + "\n";
|
||||
header += "Net Active: " + netActive + "\n";
|
||||
header += "Net Server: " + netServer + "\n";
|
||||
header += "OS: " + System.getProperty("os.name")+ "\n----\n";
|
||||
header += "Multithreading: " + Settings.getBool("multithread")+ "\n";
|
||||
header += "OS: " + System.getProperty("os.name") + "\n";
|
||||
header += "Multithreading: " + Settings.getBool("multithread")+ "\n----\n";
|
||||
}catch (Throwable e4){
|
||||
header += "[Error getting additional game info.]\n";
|
||||
header += "\n--error getting additional info--\n";
|
||||
e4.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -32,56 +32,54 @@ public class DesktopLauncher extends Lwjgl3Application{
|
||||
ObjectMap<String, Preferences> prefmap;
|
||||
|
||||
public static void main (String[] arg) {
|
||||
|
||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||
config.setTitle("Mindustry");
|
||||
config.setMaximized(true);
|
||||
config.setWindowedMode(960, 540);
|
||||
config.setWindowIcon("sprites/icon.png");
|
||||
try {
|
||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||
config.setTitle("Mindustry");
|
||||
config.setMaximized(true);
|
||||
config.setWindowedMode(960, 540);
|
||||
config.setWindowIcon("sprites/icon.png");
|
||||
|
||||
if(OS.isMac) {
|
||||
Application.getApplication().setOpenFileHandler(e -> {
|
||||
List list = e.getFiles();
|
||||
if(OS.isMac) {
|
||||
Application.getApplication().setOpenFileHandler(e -> {
|
||||
List list = e.getFiles();
|
||||
|
||||
File target = (File)list.get(0);
|
||||
File target = (File)list.get(0);
|
||||
|
||||
Gdx.app.postRunnable(() -> {
|
||||
FileHandle file = OS.getAppDataDirectory("Mindustry").child("tmp").child(target.getName());
|
||||
Gdx.app.postRunnable(() -> {
|
||||
FileHandle file = OS.getAppDataDirectory("Mindustry").child("tmp").child(target.getName());
|
||||
|
||||
Gdx.files.absolute(target.getAbsolutePath()).copyTo(file);
|
||||
Gdx.files.absolute(target.getAbsolutePath()).copyTo(file);
|
||||
|
||||
if(file.extension().equalsIgnoreCase(saveExtension)){ //open save
|
||||
if(file.extension().equalsIgnoreCase(saveExtension)){ //open save
|
||||
|
||||
if(SaveIO.isSaveValid(file)){
|
||||
try{
|
||||
SaveSlot slot = control.getSaves().importSave(file);
|
||||
ui.load.runLoadSave(slot);
|
||||
}catch (IOException e2){
|
||||
ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e2, false)));
|
||||
if(SaveIO.isSaveValid(file)){
|
||||
try{
|
||||
SaveSlot slot = control.getSaves().importSave(file);
|
||||
ui.load.runLoadSave(slot);
|
||||
}catch (IOException e2){
|
||||
ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e2, false)));
|
||||
}
|
||||
}else{
|
||||
ui.showError("$text.save.import.invalid");
|
||||
}
|
||||
}else{
|
||||
ui.showError("$text.save.import.invalid");
|
||||
|
||||
}else if(file.extension().equalsIgnoreCase(mapExtension)){ //open map
|
||||
Gdx.app.postRunnable(() -> {
|
||||
if (!ui.editor.isShown()) {
|
||||
ui.editor.show();
|
||||
}
|
||||
|
||||
ui.editor.beginEditMap(file.read());
|
||||
});
|
||||
}
|
||||
|
||||
}else if(file.extension().equalsIgnoreCase(mapExtension)){ //open map
|
||||
Gdx.app.postRunnable(() -> {
|
||||
if (!ui.editor.isShown()) {
|
||||
ui.editor.show();
|
||||
}
|
||||
|
||||
ui.editor.beginEditMap(file.read());
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Platform.instance = new DesktopPlatform(arg);
|
||||
Platform.instance = new DesktopPlatform(arg);
|
||||
|
||||
Net.setClientProvider(new KryoClient());
|
||||
Net.setServerProvider(new KryoServer());
|
||||
|
||||
try {
|
||||
Net.setClientProvider(new KryoClient());
|
||||
Net.setServerProvider(new KryoServer());
|
||||
new DesktopLauncher(new Mindustry(), config);
|
||||
}catch (Throwable e){
|
||||
CrashHandler.handle(e);
|
||||
|
Reference in New Issue
Block a user