diff options
Diffstat (limited to 'core/src/com/ilotterytea/maxoning/ui')
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java b/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java index b8c44f9..7b13ec1 100644 --- a/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java +++ b/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java @@ -2,36 +2,33 @@ package com.ilotterytea.maxoning.ui; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.utils.Align; +import com.ilotterytea.maxoning.MaxonConstants; +import com.ilotterytea.maxoning.player.MaxonItem; -public class PurchaseItem extends Stack { +public class PurchaseItem extends Table { public PurchaseItem( Skin skin, Skin widgetSkin, - AnimatedImage icon, - CharSequence name, - CharSequence desc, - String price + MaxonItem item ) { - super(new Image(widgetSkin, "up")); + super(widgetSkin); + super.setBackground("up"); + super.align(Align.left | Align.center); - Table summary = new Table(); - summary.setHeight(super.getHeight()); - - Label title = new Label(String.format("%s\n(%s)", name, price), skin, "purchaseitem_title"); + super.add(item.icon).size(81f).pad(6f); - summary.add(title).fillX().row(); - - Label description = new Label(desc, skin, "purchaseitem_desc"); - description.setWrap(true); + Table summary = new Table(); + summary.align(Align.topLeft); - summary.add(description).fillX().row(); + Label name = new Label(String.format("%s ($%s) (x%s/click)", item.name, MaxonConstants.DECIMAL_FORMAT.format(item.price), MaxonConstants.DECIMAL_FORMAT.format(item.multiplier)), skin); + name.setAlignment(Align.left); - Table main = new Table(); - main.add(icon).size(81, 81).left().pad(5f); - main.add(summary).fillY().fillX().right().pad(5f); + Label desc = new Label(item.desc, skin); + desc.setAlignment(Align.left); - main.align(Align.left); + summary.add(name).width(desc.getWidth()).row(); + summary.add(desc); - super.addActor(main); + super.add(summary); } } |
