mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-08 23:07:46 +07:00
Improved item drop labels
Improved item drop labels Created Item Details header table Changed Entity label to be an Actor Changed ItemHolder label to the item details header Added copy constructor to Label
This commit is contained in:
@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectIntMap;
|
||||
@ -235,7 +236,7 @@ public abstract class Entity implements Animation.AnimationListener {
|
||||
Animation animation;
|
||||
|
||||
String name;
|
||||
Label label;
|
||||
Actor label;
|
||||
boolean over;
|
||||
|
||||
byte nextMode = -1;
|
||||
@ -282,10 +283,11 @@ public abstract class Entity implements Animation.AnimationListener {
|
||||
invalidate();
|
||||
|
||||
// TODO: lazy init
|
||||
label = new Label(Riiablo.fonts.font16);
|
||||
Label label = new Label(Riiablo.fonts.font16);
|
||||
label.setUserObject(this);
|
||||
label.setAlignment(Align.center);
|
||||
label.getStyle().background = Label.MODAL;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public void setMode(byte mode) {
|
||||
@ -593,10 +595,13 @@ public abstract class Entity implements Animation.AnimationListener {
|
||||
}
|
||||
|
||||
public void name(String name) {
|
||||
label.setText(this.name = name);
|
||||
this.name = name;
|
||||
if (label instanceof Label) {
|
||||
((Label) label).setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
public Label getLabel() {
|
||||
public Actor getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ public class ItemHolder extends Entity {
|
||||
super(Type.ITM, "item", null);
|
||||
this.item = item;
|
||||
name(item.getName());
|
||||
label = item.details.header;
|
||||
|
||||
flippyDescriptor = new AssetDescriptor<>(Type.ITM.PATH + "\\" + item.getFlippyFile() + ".dc6", DC6.class);
|
||||
}
|
||||
|
@ -775,6 +775,8 @@ public class Item extends Actor implements Disposable {
|
||||
public class Details extends Table {
|
||||
private static final float SPACING = 2;
|
||||
|
||||
public final Table header;
|
||||
|
||||
Label name;
|
||||
Label type;
|
||||
Label usable;
|
||||
@ -819,6 +821,14 @@ public class Item extends Actor implements Disposable {
|
||||
if (quality.ordinal() > Quality.MAGIC.ordinal() || (flags & RUNEWORD) == RUNEWORD)
|
||||
add(type).center().space(SPACING).row();
|
||||
|
||||
header = new Table() {{
|
||||
setBackground(PaletteIndexedColorDrawable.MODAL_FONT16);
|
||||
add(new Label(name)).center().space(SPACING).row();
|
||||
if (quality.ordinal() > Quality.MAGIC.ordinal() || (flags & RUNEWORD) == RUNEWORD)
|
||||
add(new Label(type)).center().space(SPACING).row();
|
||||
pack();
|
||||
}};
|
||||
|
||||
if (socketed.size > 0) {
|
||||
String runequote = Riiablo.string.lookup("RuneQuote");
|
||||
StringBuilder runewordBuilder = null;
|
||||
|
@ -42,6 +42,11 @@ public class Label extends com.badlogic.gdx.scenes.scene2d.ui.Label {
|
||||
this(null, font);
|
||||
}
|
||||
|
||||
public Label(Label src) {
|
||||
super(src.getText(), src.getStyle());
|
||||
setColor(src.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float a) {
|
||||
if (batch instanceof PaletteIndexedBatch) {
|
||||
|
Reference in New Issue
Block a user