mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-13 15:43:44 +03:00
Un-broke editor block icons
This commit is contained in:
parent
66c9fd8431
commit
5ec495987e
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.latest=[orange][[Latest version]
|
||||
text.loading=[accent]Loading...
|
||||
text.saving=[accent]Saving...
|
||||
text.wave=[orange]Wave {0}
|
||||
text.wave.waiting=Wave in {0}
|
||||
text.waiting=Waiting...
|
||||
|
@ -213,7 +213,11 @@ public class UI extends SceneModule{
|
||||
}
|
||||
|
||||
public void loadAnd(Callable call){
|
||||
loadfrag.show();
|
||||
loadAnd("$text.loading", call);
|
||||
}
|
||||
|
||||
public void loadAnd(String text, Callable call){
|
||||
loadfrag.show(text);
|
||||
Timers.run(6f, () -> {
|
||||
call.run();
|
||||
loadfrag.hide();
|
||||
|
@ -23,6 +23,7 @@ import io.anuke.ucore.core.Inputs;
|
||||
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;
|
||||
@ -582,7 +583,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
for(Block block : Block.all()){
|
||||
TextureRegion[] regions = block.getCompactIcon();
|
||||
|
||||
if(regions.length == 0) continue;
|
||||
if(regions.length == 0 || regions[0] == Draw.region("jjfgj")) continue;
|
||||
|
||||
Stack stack = new Stack();
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class MapRenderer implements Disposable{
|
||||
TextureRegion region;
|
||||
|
||||
if(bw != 0) {
|
||||
region = Draw.region("block-icon-" + wall.name, Draw.region("clear"));
|
||||
region = wall.getEditorIcon();
|
||||
|
||||
if (wall.rotate) {
|
||||
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region,
|
||||
@ -129,7 +129,7 @@ public class MapRenderer implements Disposable{
|
||||
region.getRegionWidth(), region.getRegionHeight());
|
||||
}
|
||||
}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);
|
||||
}
|
||||
|
@ -29,8 +29,10 @@ public class SaveDialog extends LoadDialog{
|
||||
slots.row();
|
||||
slots.addImageTextButton("$text.save.new", "icon-add", "clear", 14*3, () ->
|
||||
ui.showTextInput("$text.save", "$text.save.newslot", "", text -> {
|
||||
control.getSaves().addSave(text);
|
||||
setup();
|
||||
ui.loadAnd("$text.saving", () -> {
|
||||
control.getSaves().addSave(text);
|
||||
setup();
|
||||
});
|
||||
})
|
||||
).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[] icon;
|
||||
protected TextureRegion[] compactIcon;
|
||||
protected TextureRegion editorIcon;
|
||||
|
||||
/**internal 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*/
|
||||
public TextureRegion[] getIcon(){
|
||||
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*/
|
||||
public TextureRegion[] getCompactIcon(){
|
||||
if(compactIcon == null) {
|
||||
compactIcon = new TextureRegion[]{iconRegion(Draw.region("block-icon-" + name))};
|
||||
}
|
||||
if(compactIcon == null) {
|
||||
compactIcon = new TextureRegion[getIcon().length];
|
||||
for (int i = 0; i < compactIcon.length; i++) {
|
||||
compactIcon[i] = iconRegion(getIcon()[i]);
|
||||
}
|
||||
}
|
||||
return compactIcon;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
@ -21,6 +22,14 @@ public class OreBlock extends Floor {
|
||||
this.edge = base.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion getEditorIcon(){
|
||||
if(editorIcon == null){
|
||||
editorIcon = variantRegions[0];
|
||||
}
|
||||
return editorIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] getCompactIcon(){
|
||||
if(compactIcon == null) {
|
||||
compactIcon = new TextureRegion[]{iconRegion(Draw.region("block-icon-" + name))};
|
||||
}
|
||||
return compactIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
Draw.color(tile.getTeam().color);
|
||||
|
Loading…
Reference in New Issue
Block a user