Un-broke editor block icons
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 199 B |
@@ -154,6 +154,7 @@ text.changelog.error=[scarlet]Error getting changelog!\nCheck your internet conn
|
|||||||
text.changelog.current=[yellow][[Current version]
|
text.changelog.current=[yellow][[Current version]
|
||||||
text.changelog.latest=[orange][[Latest version]
|
text.changelog.latest=[orange][[Latest version]
|
||||||
text.loading=[accent]Loading...
|
text.loading=[accent]Loading...
|
||||||
|
text.saving=[accent]Saving...
|
||||||
text.wave=[orange]Wave {0}
|
text.wave=[orange]Wave {0}
|
||||||
text.wave.waiting=Wave in {0}
|
text.wave.waiting=Wave in {0}
|
||||||
text.waiting=Waiting...
|
text.waiting=Waiting...
|
||||||
|
|||||||
@@ -213,7 +213,11 @@ public class UI extends SceneModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadAnd(Callable call){
|
public void loadAnd(Callable call){
|
||||||
loadfrag.show();
|
loadAnd("$text.loading", call);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadAnd(String text, Callable call){
|
||||||
|
loadfrag.show(text);
|
||||||
Timers.run(6f, () -> {
|
Timers.run(6f, () -> {
|
||||||
call.run();
|
call.run();
|
||||||
loadfrag.hide();
|
loadfrag.hide();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import io.anuke.ucore.core.Inputs;
|
|||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.function.Listenable;
|
import io.anuke.ucore.function.Listenable;
|
||||||
|
import io.anuke.ucore.graphics.Draw;
|
||||||
import io.anuke.ucore.graphics.Pixmaps;
|
import io.anuke.ucore.graphics.Pixmaps;
|
||||||
import io.anuke.ucore.input.Input;
|
import io.anuke.ucore.input.Input;
|
||||||
import io.anuke.ucore.scene.actions.Actions;
|
import io.anuke.ucore.scene.actions.Actions;
|
||||||
@@ -582,7 +583,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
for(Block block : Block.all()){
|
for(Block block : Block.all()){
|
||||||
TextureRegion[] regions = block.getCompactIcon();
|
TextureRegion[] regions = block.getCompactIcon();
|
||||||
|
|
||||||
if(regions.length == 0) continue;
|
if(regions.length == 0 || regions[0] == Draw.region("jjfgj")) continue;
|
||||||
|
|
||||||
Stack stack = new Stack();
|
Stack stack = new Stack();
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class MapRenderer implements Disposable{
|
|||||||
TextureRegion region;
|
TextureRegion region;
|
||||||
|
|
||||||
if(bw != 0) {
|
if(bw != 0) {
|
||||||
region = Draw.region("block-icon-" + wall.name, Draw.region("clear"));
|
region = wall.getEditorIcon();
|
||||||
|
|
||||||
if (wall.rotate) {
|
if (wall.rotate) {
|
||||||
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region,
|
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region,
|
||||||
@@ -129,7 +129,7 @@ public class MapRenderer implements Disposable{
|
|||||||
region.getRegionWidth(), region.getRegionHeight());
|
region.getRegionWidth(), region.getRegionHeight());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
region = Draw.region("block-icon-" + floor.name, Draw.region("clear"));
|
region = floor.getEditorIcon();
|
||||||
|
|
||||||
mesh.draw((wx % chunksize) + (wy % chunksize)*chunksize, region, wx * tilesize, wy * tilesize, 8, 8);
|
mesh.draw((wx % chunksize) + (wy % chunksize)*chunksize, region, wx * tilesize, wy * tilesize, 8, 8);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ public class SaveDialog extends LoadDialog{
|
|||||||
slots.row();
|
slots.row();
|
||||||
slots.addImageTextButton("$text.save.new", "icon-add", "clear", 14*3, () ->
|
slots.addImageTextButton("$text.save.new", "icon-add", "clear", 14*3, () ->
|
||||||
ui.showTextInput("$text.save", "$text.save.newslot", "", text -> {
|
ui.showTextInput("$text.save", "$text.save.newslot", "", text -> {
|
||||||
control.getSaves().addSave(text);
|
ui.loadAnd("$text.saving", () -> {
|
||||||
setup();
|
control.getSaves().addSave(text);
|
||||||
|
setup();
|
||||||
|
});
|
||||||
})
|
})
|
||||||
).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
|
).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class Block extends BaseBlock implements UnlockableContent{
|
|||||||
protected TextureRegion[] blockIcon;
|
protected TextureRegion[] blockIcon;
|
||||||
protected TextureRegion[] icon;
|
protected TextureRegion[] icon;
|
||||||
protected TextureRegion[] compactIcon;
|
protected TextureRegion[] compactIcon;
|
||||||
|
protected TextureRegion editorIcon;
|
||||||
|
|
||||||
/**internal name*/
|
/**internal name*/
|
||||||
public final String name;
|
public final String name;
|
||||||
@@ -349,6 +350,13 @@ public class Block extends BaseBlock implements UnlockableContent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextureRegion getEditorIcon(){
|
||||||
|
if(editorIcon == null){
|
||||||
|
editorIcon = Draw.region("block-icon-" + name, Draw.region("clear"));
|
||||||
|
}
|
||||||
|
return editorIcon;
|
||||||
|
}
|
||||||
|
|
||||||
/**Returns the icon used for displaying this block in the place menu*/
|
/**Returns the icon used for displaying this block in the place menu*/
|
||||||
public TextureRegion[] getIcon(){
|
public TextureRegion[] getIcon(){
|
||||||
if(icon == null) {
|
if(icon == null) {
|
||||||
@@ -373,9 +381,12 @@ public class Block extends BaseBlock implements UnlockableContent{
|
|||||||
|
|
||||||
/**Returns a list of icon regions that have been cropped to 8x8*/
|
/**Returns a list of icon regions that have been cropped to 8x8*/
|
||||||
public TextureRegion[] getCompactIcon(){
|
public TextureRegion[] getCompactIcon(){
|
||||||
if(compactIcon == null) {
|
if(compactIcon == null) {
|
||||||
compactIcon = new TextureRegion[]{iconRegion(Draw.region("block-icon-" + name))};
|
compactIcon = new TextureRegion[getIcon().length];
|
||||||
}
|
for (int i = 0; i < compactIcon.length; i++) {
|
||||||
|
compactIcon[i] = iconRegion(getIcon()[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
return compactIcon;
|
return compactIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.world.blocks;
|
package io.anuke.mindustry.world.blocks;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.ItemStack;
|
import io.anuke.mindustry.type.ItemStack;
|
||||||
@@ -21,6 +22,14 @@ public class OreBlock extends Floor {
|
|||||||
this.edge = base.name;
|
this.edge = base.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion getEditorIcon(){
|
||||||
|
if(editorIcon == null){
|
||||||
|
editorIcon = variantRegions[0];
|
||||||
|
}
|
||||||
|
return editorIcon;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
Draw.rect(variantRegions[Mathf.randomSeed(tile.id(), 0, Math.max(0, variantRegions.length-1))], tile.worldx(), tile.worldy());
|
Draw.rect(variantRegions[Mathf.randomSeed(tile.id(), 0, Math.max(0, variantRegions.length-1))], tile.worldx(), tile.worldy());
|
||||||
|
|||||||
@@ -141,6 +141,14 @@ public abstract class Turret extends Block{
|
|||||||
return blockIcon;
|
return blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion[] getCompactIcon(){
|
||||||
|
if(compactIcon == null) {
|
||||||
|
compactIcon = new TextureRegion[]{iconRegion(Draw.region("block-icon-" + name))};
|
||||||
|
}
|
||||||
|
return compactIcon;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawSelect(Tile tile){
|
public void drawSelect(Tile tile){
|
||||||
Draw.color(tile.getTeam().color);
|
Draw.color(tile.getTeam().color);
|
||||||
|
|||||||
Reference in New Issue
Block a user