More map editor improvements, turret outline rendering

This commit is contained in:
Anuken
2018-03-21 16:45:05 -04:00
parent 23e6f89eef
commit 85988a2ff9
10 changed files with 476 additions and 438 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Wed Mar 21 00:30:33 EDT 2018
#Wed Mar 21 16:44:11 EDT 2018
version=release
androidBuildCode=582
androidBuildCode=587
name=Mindustry
code=3.4
build=custom build

View File

@ -23,6 +23,7 @@ import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.input.PlaceMode;
import io.anuke.mindustry.ui.fragments.ToolFragment;
import io.anuke.mindustry.world.BlockBar;
import io.anuke.mindustry.world.Layer;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.ucore.core.*;
@ -183,12 +184,13 @@ public class Renderer extends RendererModule{
blocks.drawFloor();
blocks.processBlocks();
blocks.drawBlocks(false);
blocks.drawBlocks(Layer.overlay);
drawAllTeams(false);
Entities.draw(Entities.defaultGroup());
blocks.drawBlocks(true);
blocks.skipLayer(Layer.turret);
blocks.drawBlocks(Layer.laser);
drawAllTeams(true);
@ -221,6 +223,9 @@ public class Renderer extends RendererModule{
Graphics.beginShaders(Shaders.outline);
Graphics.shader(Shaders.hit, false);
drawTeam(team, flying);
Draw.alpha(0f);
blocks.drawTeamBlocks(Layer.turret, team);
Draw.alpha(1f);
Graphics.shader();
Graphics.endShaders();
}

View File

@ -29,6 +29,8 @@ import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Strings;
import java.io.DataInputStream;
import static io.anuke.mindustry.Vars.*;
public class MapEditorDialog extends Dialog{
@ -70,39 +72,14 @@ public class MapEditorDialog extends Dialog{
});
});
menu = new FloatingDialog("$text.menu");
menu.addCloseButton();
menu.content().defaults().size(240f, 60f).padBottom(5);
float isize = 16*2f;
menu.content().addImageButton("icon-back", isize, () -> {
if(!saved){
ui.showConfirm("$text.confirm", "$text.editor.unsaved", this::hide);
}else{
hide();
}
});
menu.content().row();
menu.content().addImageButton("icon-save", isize, () -> {
saveFile.show();
});
/*
openFile = new FileChooser("$text.loadimage", FileChooser.pngFilter, true, file -> {
openFile = new FileChooser("$text.loadimage", FileChooser.mapFilter, true, file -> {
ui.loadfrag.show();
Timers.run(3f, () -> {
try{
Pixmap pixmap = new Pixmap(file);
if(verifySize(pixmap)){
editor.setPixmap(pixmap);
view.clearStack();
}else{
ui.showError(Bundles.format("text.editor.badsize", Arrays.toString(MapEditor.validMapSizes)));
}
MapTileData data = MapIO.readTileData(new DataInputStream(file.read()));
editor.beginEdit(data);
view.clearStack();
}catch (Exception e){
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
Log.err(e);
@ -110,8 +87,39 @@ public class MapEditorDialog extends Dialog{
ui.loadfrag.hide();
});
});
menu = new FloatingDialog("$text.menu");
menu.addCloseButton();
menu.content().defaults().size(280f, 60f).padBottom(5);
float isize = 16*2f;
menu.content().addImageTextButton("$text.quit", "icon-back", isize, () -> {
if(!saved){
ui.showConfirm("$text.confirm", "$text.editor.unsaved", this::hide);
}else{
hide();
}
menu.hide();
});
menu.content().row();
menu.content().addImageTextButton("$text.editor.savemap", "icon-save-map", isize, () -> {
saveFile.show();
menu.hide();
});
menu.content().row();
menu.content().addImageTextButton("$text.editor.loadmap", "icon-load-map", isize, () -> {
openFile.show();
menu.hide();
});
*/
/*
loadDialog = new MapLoadDialog(map -> {
saveDialog.setFieldText(map.name);
@ -205,7 +213,7 @@ public class MapEditorDialog extends Dialog{
@Override
public Dialog show(){
return super.show(Core.scene, Actions.sequence(Actions.scaleTo(1f, 1f), Actions.alpha(0f), Actions.fadeIn(0.3f)));
return super.show(Core.scene, Actions.sequence(Actions.alpha(0f), Actions.scaleTo(1f, 1f), Actions.fadeIn(0.3f)));
}
public MapView getView() {
@ -247,9 +255,9 @@ public class MapEditorDialog extends Dialog{
tools.defaults().size(60f, 64f).padBottom(-5.1f);
tools.addImageButton("icon-arrow-left", 14*3f, () -> hide());
tools.addImageButton("icon-back", 16*2, () -> hide());
tools.addImageButton("icon-menu", 14*3f, menu::show);
tools.addImageButton("icon-menu-large", 16*2f, menu::show);
tools.row();

View File

@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Layer;
import io.anuke.mindustry.world.Tile;
@ -120,8 +121,7 @@ public class BlockRenderer{
return requestidx;
}
public void drawBlocks(boolean top){
Layer stopAt = top ? Layer.laser : Layer.overlay;
public void drawBlocks(Layer stopAt){
for(; iterateidx < requestidx; iterateidx ++){
@ -141,6 +141,36 @@ public class BlockRenderer{
}
}
}
public void drawTeamBlocks(Layer layer, Team team){
int iterateidx = this.iterateidx;
for(; iterateidx < requestidx; iterateidx ++){
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > layer.ordinal()){
break;
}
BlockRequest req = requests.get(iterateidx);
if(req.tile.getTeam() != team) continue;
Block block = req.tile.block();
if(req.layer == block.layer){
block.drawLayer(req.tile);
}else if(req.layer == block.layer2){
block.drawLayer2(req.tile);
}
}
}
public void skipLayer(Layer stopAt){
for(; iterateidx < requestidx; iterateidx ++){
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
break;
}
}
}
private void addRequest(Tile tile, Layer layer){
if(requestidx >= requests.size){

View File

@ -25,7 +25,7 @@ public class Recipes {
new Recipe(distribution, DistributionBlocks.conveyor, stack(Item.iron, 1)),
new Recipe(distribution, DistributionBlocks.steelconveyor, stack(Item.steel, 1)),
new Recipe(distribution, DistributionBlocks.pulseconveyor, stack(Item.dirium, 1)),
new Recipe(distribution, DistributionBlocks.router, stack(Item.stone, 2)),
new Recipe(distribution, DistributionBlocks.router, stack(Item.iron, 2)),
new Recipe(distribution, DistributionBlocks.multiplexer, stack(Item.iron, 8)),
new Recipe(distribution, DistributionBlocks.junction, stack(Item.iron, 2)),
new Recipe(distribution, DistributionBlocks.tunnel, stack(Item.iron, 2)),
@ -35,8 +35,8 @@ public class Recipes {
new Recipe(distribution, DistributionBlocks.unloader, stack(Item.steel, 5)),
new Recipe(distribution, DistributionBlocks.sortedunloader, stack(Item.steel, 5)),
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.stone, 7)),
new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Item.iron, 8), stack(Item.stone, 10)),
new Recipe(weapon, WeaponBlocks.doubleturret, stack(Item.iron, 7)),
new Recipe(weapon, WeaponBlocks.gatlingturret, stack(Item.iron, 8)),
new Recipe(weapon, WeaponBlocks.flameturret, stack(Item.iron, 12), stack(Item.steel, 9)),
new Recipe(weapon, WeaponBlocks.railgunturret, stack(Item.iron, 15), stack(Item.steel, 10)),
new Recipe(weapon, WeaponBlocks.laserturret, stack(Item.steel, 12), stack(Item.titanium, 12)),
@ -48,7 +48,7 @@ public class Recipes {
new Recipe(weapon, WeaponBlocks.missileturret, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),
new Recipe(weapon, WeaponBlocks.fornaxcannon, stack(Item.steel, 70), stack(Item.titanium, 50), stack(Item.dirium, 55)),
new Recipe(crafting, ProductionBlocks.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
new Recipe(crafting, ProductionBlocks.smelter, stack(Item.iron, 40)),
new Recipe(crafting, ProductionBlocks.alloysmelter, stack(Item.titanium, 50), stack(Item.steel, 50)),
new Recipe(crafting, ProductionBlocks.coalextractor, stack(Item.steel, 10), stack(Item.iron, 10)),
new Recipe(crafting, ProductionBlocks.titaniumextractor, stack(Item.steel, 30), stack(Item.iron, 30)),
@ -61,8 +61,8 @@ public class Recipes {
//new Recipe(crafting, ProductionBlocks.centrifuge, stack(Item.steel, 30), stack(Item.iron, 30)),
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
new Recipe(production, ProductionBlocks.irondrill, stack(Item.stone, 25)),
new Recipe(production, ProductionBlocks.coaldrill, stack(Item.stone, 25), stack(Item.iron, 40)),
new Recipe(production, ProductionBlocks.irondrill, stack(Item.iron, 25)),
new Recipe(production, ProductionBlocks.coaldrill, stack(Item.iron, 25), stack(Item.iron, 40)),
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Item.iron, 50), stack(Item.steel, 50)),
new Recipe(production, ProductionBlocks.uraniumdrill, stack(Item.iron, 40), stack(Item.steel, 40)),
new Recipe(production, ProductionBlocks.quartzextractor, stack(Item.titanium, 40), stack(Item.dirium, 40)),
@ -71,9 +71,9 @@ public class Recipes {
new Recipe(production, ProductionBlocks.waterextractor, stack(Item.titanium, 40), stack(Item.dirium, 40)),
new Recipe(production, ProductionBlocks.oilextractor, stack(Item.titanium, 40), stack(Item.dirium, 40)),
new Recipe(power, ProductionBlocks.coalgenerator, stack(Item.iron, 30), stack(Item.stone, 20)),
new Recipe(power, ProductionBlocks.thermalgenerator, stack(Item.steel, 30), stack(Item.iron, 30)),
new Recipe(power, ProductionBlocks.combustiongenerator, stack(Item.iron, 30), stack(Item.stone, 20)),
new Recipe(power, ProductionBlocks.coalgenerator, stack(Item.iron, 30)),
new Recipe(power, ProductionBlocks.thermalgenerator, stack(Item.steel, 30)),
new Recipe(power, ProductionBlocks.combustiongenerator, stack(Item.iron, 30)),
new Recipe(power, ProductionBlocks.solarpanel, stack(Item.iron, 30), stack(Item.silicon, 20)),
new Recipe(power, ProductionBlocks.largesolarpanel, stack(Item.iron, 30), stack(Item.silicon, 20)),
new Recipe(power, ProductionBlocks.rtgenerator, stack(Item.titanium, 20), stack(Item.steel, 20)),

View File

@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pools;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.io.Platform;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Timers;
@ -321,6 +322,7 @@ public class FileChooser extends FloatingDialog {
}
public static Predicate<FileHandle> pngFilter = file -> file.extension().equalsIgnoreCase("png");
public static Predicate<FileHandle> mapFilter = file -> file.extension().equalsIgnoreCase(Vars.mapExtension);
public static Predicate<FileHandle> jpegFilter = file -> file.extension().equalsIgnoreCase("png") || file.extension().equalsIgnoreCase("jpg") || file.extension().equalsIgnoreCase("jpeg");
public static Predicate<FileHandle> defaultFilter = file -> true;
}