Added unit type descriptions / Changed blast drill sprite

This commit is contained in:
Anuken
2018-07-30 21:20:00 -04:00
parent 22342d01a5
commit ddac5cbfbc
8 changed files with 815 additions and 775 deletions

View File

@@ -16,14 +16,19 @@ import io.anuke.ucore.function.Supplier;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Strings;
//TODO merge unit type with mech
public class UnitType implements UnlockableContent{
private static byte lastid = 0;
private static Array<UnitType> types = new Array<>();
public final String name;
public final byte id;
protected final Supplier<? extends BaseUnit> constructor;
public final String name;
public final String description;
public final byte id;
public float health = 60;
public float hitsize = 5f;
public float hitsizeTile = 4f;
@@ -51,10 +56,16 @@ public class UnitType implements UnlockableContent{
this.id = lastid++;
this.name = name;
this.constructor = mainConstructor;
this.description = Bundles.getOrNull("unit." + name + ".description");
types.add(this);
TypeTrait.registerType(type, mainConstructor);
if(!Bundles.has("unit." + this.name + ".name")){
Log.err("Warning: unit '" + name + "' is missing a localized name. Add the follow to bundle.properties:");
Log.err("unit." + this.name + ".name=" + Strings.capitalize(name.replace('-', '_')));
}
}
public static UnitType getByID(byte id){

View File

@@ -23,33 +23,19 @@ public class Item implements Comparable<Item>, UnlockableContent{
public final Color color;
public TextureRegion region;
/**
* type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}.
*/
/**type of the item; used for tabs and core acceptance. default value is {@link ItemType#resource}.*/
public ItemType type = ItemType.resource;
/**
* how explosive this item is.
*/
/**how explosive this item is.*/
public float explosiveness = 0f;
/**
* flammability above 0.3 makes this eleigible for item burners.
*/
/**flammability above 0.3 makes this eleigible for item burners.*/
public float flammability = 0f;
/**
* how radioactive this item is. 0=none, 1=chernobyl ground zero
*/
/**how radioactive this item is. 0=none, 1=chernobyl ground zero*/
public float radioactivity;
/**
* how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good
*/
/**how effective this item is as flux for smelting. 0 = not a flux, 0.5 = normal flux, 1 = very good*/
public float fluxiness = 0f;
/**
* drill hardness of the item
*/
/**drill hardness of the item*/
public int hardness = 0;
/**
* the burning color of this item
*/
/**the burning color of this item*/
public Color flameColor = Palette.darkFlame.cpy();
/**
* base material cost of this item, used for calculating place times

View File

@@ -17,6 +17,7 @@ import io.anuke.mindustry.world.meta.StatValue;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Strings;
public class ContentDisplay{
@@ -144,6 +145,31 @@ public class ContentDisplay{
}
public static void displayUnit(Table table, UnitType unit){
table.table(title -> {
title.addImage(unit.getContentIcon()).size(8 * 6);
title.add("[accent]" + unit.localizedName()).padLeft(5);
});
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
if(unit.description != null){
table.add(unit.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
table.left().defaults().fillX();
table.add(Bundles.format("text.unit.health", unit.health));
table.row();
table.add(Bundles.format("text.unit.speed", Strings.toFixed(unit.speed, 1)));
table.row();
table.row();
}
}

View File

@@ -7,6 +7,7 @@ import io.anuke.mindustry.core.ContentLoader;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.scene.event.HandCursorListener;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.Tooltip;
@@ -56,6 +57,7 @@ public class UnlocksDialog extends FloatingDialog{
if(unlock.isHidden()) continue;
Image image = control.database().isUnlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-locked");
image.addListener(new HandCursorListener());
list.add(image).size(size).pad(3);
if(control.database().isUnlocked(unlock)){