Added chat icons for in-game items and blocks
This commit is contained in:
@@ -176,6 +176,10 @@ public class Generators{
|
||||
Image image = new Image(icon.size, icon.size);
|
||||
image.drawScaled(base);
|
||||
image.save(item.getContentType().name() + "-" + item.name + "-" + icon.name(), false);
|
||||
|
||||
if(icon == Cicon.medium){
|
||||
image.save("../ui/" + item.getContentType() + "-" + item.name + "-icon");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -254,12 +258,11 @@ public class Generators{
|
||||
image.save("../blocks/environment/ore-" + item.name + (i + 1));
|
||||
image.save("../editor/editor-ore-" + item.name + (i + 1));
|
||||
|
||||
//save icons
|
||||
image.save("block-" + ore.name + "-full");
|
||||
for(Cicon icon : Cicon.scaled){
|
||||
Image scaled = new Image(icon.size, icon.size);
|
||||
scaled.drawScaled(image);
|
||||
scaled.save("block-" + ore.name + "-" + icon.name());
|
||||
scaled.save("../ui/block-" + ore.name + "-" + icon.name());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,8 +7,13 @@ import arc.graphics.g2d.TextureAtlas.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.Log.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
import javax.imageio.*;
|
||||
import java.awt.image.*;
|
||||
@@ -93,6 +98,42 @@ public class ImagePacker{
|
||||
Log.info("&ly[Generator]&lc Total time to generate: &lg{0}&lcms", Time.elapsed());
|
||||
Log.info("&ly[Generator]&lc Total images created: &lg{0}", Image.total());
|
||||
Image.dispose();
|
||||
|
||||
//format:
|
||||
//character-ID=contentname:texture-name
|
||||
Fi iconfile = Fi.get("../../../assets/icons/icons.properties");
|
||||
OrderedMap<String, String> map = new OrderedMap<>();
|
||||
PropertiesUtils.load(map, iconfile.reader(256));
|
||||
|
||||
ObjectMap<String, String> content2id = new ObjectMap<>();
|
||||
map.each((key, val) -> content2id.put(val.split("\\|")[0], key));
|
||||
|
||||
Array<UnlockableContent> cont = Array.withArrays(Vars.content.blocks(), Vars.content.items(), Vars.content.liquids());
|
||||
cont.removeAll(u -> u instanceof BlockPart || u instanceof BuildBlock || u == Blocks.air);
|
||||
|
||||
int minid = 0xF8FF;
|
||||
for(String key : map.keys()){
|
||||
minid = Math.min(Integer.parseInt(key) - 1, minid);
|
||||
}
|
||||
|
||||
for(UnlockableContent c : cont){
|
||||
if(!content2id.containsKey(c.name)){
|
||||
map.put(minid + "", c.name + "|" + texname(c));
|
||||
minid --;
|
||||
}
|
||||
}
|
||||
|
||||
Writer writer = iconfile.writer(false);
|
||||
for(String key : map.keys()){
|
||||
writer.write(key + "=" + map.get(key) + "\n");
|
||||
}
|
||||
|
||||
writer.close();
|
||||
}
|
||||
|
||||
static String texname(UnlockableContent c){
|
||||
if(c instanceof Block) return "block-" + c.name + "-medium";
|
||||
return c.getContentType() + "-" + c.name + "-icon";
|
||||
}
|
||||
|
||||
static void generate(String name, Runnable run){
|
||||
|
||||
Reference in New Issue
Block a user