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