elevation is gone but this time I'm not doing the crab rave meme
This commit is contained in:
@@ -118,12 +118,13 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
i++;
|
||||
}
|
||||
|
||||
/*
|
||||
ImageButton gen = maps.addImageButton("icon-editor", "clear", 16*4, () -> {
|
||||
hide();
|
||||
world.generator.playRandomMap();
|
||||
}).growY().get();
|
||||
gen.row();
|
||||
gen.add("$map.random");
|
||||
gen.add("$map.random");*/
|
||||
|
||||
if(world.maps.all().size == 0){
|
||||
maps.add("$maps.none").pad(50);
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.ItemType;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
|
||||
import static io.anuke.mindustry.Vars.data;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class DeployDialog extends FloatingDialog{
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
t.addButton(zone.localizedName(), () -> {
|
||||
data.removeItems(zone.deployCost);
|
||||
hide();
|
||||
Vars.world.generator.playRandomMap();
|
||||
world.playGenerator(zone.generator);
|
||||
}).size(150f).disabled(b -> !data.hasItems(zone.deployCost));
|
||||
t.row();
|
||||
t.table(req -> {
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Graphics.Cursor.SystemCursor;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.GridMap;
|
||||
import io.anuke.arc.graphics.Pixmap;
|
||||
import io.anuke.arc.graphics.Pixmap.Format;
|
||||
import io.anuke.arc.graphics.Texture;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.input.KeyCode;
|
||||
import io.anuke.arc.scene.Element;
|
||||
import io.anuke.arc.scene.event.InputEvent;
|
||||
import io.anuke.arc.scene.event.InputListener;
|
||||
import io.anuke.arc.util.async.AsyncExecutor;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.maps.WorldGenerator.GenResult;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
|
||||
import static io.anuke.mindustry.Vars.sectorSize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class GenViewDialog extends FloatingDialog{
|
||||
Array<Item> ores = Array.with(Items.copper, Items.lead, Items.coal);
|
||||
|
||||
public GenViewDialog(){
|
||||
super("generate view");
|
||||
|
||||
cont.add(new GenView()).grow();
|
||||
}
|
||||
|
||||
public class GenView extends Element{
|
||||
GridMap<Texture> map = new GridMap<>();
|
||||
GridMap<Boolean> processing = new GridMap<>();
|
||||
float panX, panY;
|
||||
float lastX, lastY;
|
||||
int viewsize = 3;
|
||||
AsyncExecutor async = new AsyncExecutor(viewsize*2 * viewsize*2);
|
||||
|
||||
{
|
||||
addListener(new InputListener(){
|
||||
@Override
|
||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||
Core.graphics.cursor(SystemCursor.hand);
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchDragged(InputEvent event, float x, float y, int pointer){
|
||||
panX -= x - lastX;
|
||||
panY -= y - lastY;
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||
Core.graphics.restoreCursor();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void draw(){
|
||||
float padSectorSize = 200f;
|
||||
int tx = (int)(panX / padSectorSize);
|
||||
int ty = (int)(panY / padSectorSize);
|
||||
|
||||
Draw.color();
|
||||
|
||||
for(int x = -viewsize; x <= viewsize; x++){
|
||||
for(int y = -viewsize; y <= viewsize; y++){
|
||||
int wx = tx + x, wy = ty + y;
|
||||
if(map.get(wx, wy) == null){
|
||||
if(processing.get(wx, wy) == Boolean.TRUE){
|
||||
continue;
|
||||
}
|
||||
processing.put(wx, wy, true);
|
||||
async.submit(() -> {
|
||||
GenResult result = new GenResult();
|
||||
Pixmap pixmap = new Pixmap(sectorSize, sectorSize, Format.RGBA8888);
|
||||
for(int i = 0; i < sectorSize; i++){
|
||||
for(int j = 0; j < sectorSize; j++){
|
||||
world.generator.generateTile(result, wx, wy, i, j, true, null, ores);
|
||||
pixmap.drawPixel(i, sectorSize - 1 - j, ColorMapper.colorFor(result.floor, result.wall, Team.none, result.elevation, (byte)0));
|
||||
}
|
||||
}
|
||||
Core.app.post(() -> map.put(wx, wy, new Texture(pixmap)));
|
||||
return pixmap;
|
||||
});
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
float drawX = x + width/2f+ wx * padSectorSize - tx * padSectorSize - panX % padSectorSize;
|
||||
float drawY = y + height/2f + wy * padSectorSize - ty * padSectorSize - panY % padSectorSize;
|
||||
|
||||
Draw.rect(Draw.wrap(map.get(wx, wy)), drawX + padSectorSize/2f, drawY + padSectorSize/2f, padSectorSize, padSectorSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
hide();
|
||||
ui.paused.hide();
|
||||
|
||||
ui.loadLogic(() -> {
|
||||
ui.loadAnd(() -> {
|
||||
try{
|
||||
slot.load();
|
||||
state.set(State.playing);
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
return;
|
||||
}
|
||||
|
||||
ui.loadLogic("$saveload", () -> {
|
||||
ui.loadAnd("$saveload", () -> {
|
||||
try{
|
||||
control.saves.getCurrent().save();
|
||||
}catch(Throwable e){
|
||||
|
||||
@@ -24,7 +24,7 @@ public class SaveDialog extends LoadDialog{
|
||||
slots.row();
|
||||
slots.addImageTextButton("$save.new", "icon-add",14 * 3, () ->
|
||||
ui.showTextInput("$save", "$save.newslot", "", text -> {
|
||||
ui.loadGraphics("$saving", () -> {
|
||||
ui.loadAnd("$saving", () -> {
|
||||
control.saves.addSave(text);
|
||||
Core.app.post(() -> Core.app.post(this::setup));
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MenuFragment extends Fragment{
|
||||
maps = new MobileButton("icon-map", isize, "$maps", ui.maps::show),
|
||||
load = new MobileButton("icon-load", isize, "$load", ui.load::show),
|
||||
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
||||
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadGraphics(ui.editor::show)),
|
||||
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
||||
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
||||
unlocks = new MobileButton("icon-unlocks", isize, "$unlocks", ui.unlocks::show),
|
||||
donate = new MobileButton("icon-donate", isize, "$donate", Platform.instance::openDonations);
|
||||
@@ -115,7 +115,7 @@ public class MenuFragment extends Fragment{
|
||||
|
||||
out.row();
|
||||
|
||||
out.add(new MenuButton("icon-editor", "$editor", () -> ui.loadGraphics(ui.editor::show)));
|
||||
out.add(new MenuButton("icon-editor", "$editor", () -> ui.loadAnd(ui.editor::show)));
|
||||
|
||||
out.add(new MenuButton("icon-map", "$maps", ui.maps::show));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user