diff options
| author | ilotterytea <iltsu@alright.party> | 2022-09-01 14:56:47 +0600 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2022-09-01 14:56:47 +0600 |
| commit | bf81fd03e242de86bc6095d7d74c31c0094cc9ea (patch) | |
| tree | 12c121ac8505c219a5df32b6d8479616807cfab5 /core | |
| parent | e5582e6e4c1d82c7255822e3d1bd38c00e5cfcb8 (diff) | |
purchase item
Diffstat (limited to 'core')
| -rw-r--r-- | core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java b/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java new file mode 100644 index 0000000..f6a03e0 --- /dev/null +++ b/core/src/com/ilotterytea/maxoning/ui/PurchaseItem.java @@ -0,0 +1,40 @@ +package com.ilotterytea.maxoning.ui; + +import com.badlogic.gdx.graphics.g2d.NinePatch; +import com.badlogic.gdx.scenes.scene2d.ui.*; +import com.badlogic.gdx.utils.Align; + +public class PurchaseItem extends Stack { + public PurchaseItem( + Skin skin, + NinePatch ninepatch, + AnimatedImage icon, + CharSequence name, + CharSequence desc, + float price + ) { + super(new Image(ninepatch)); + + Label title = new Label(name, skin, "purchaseitem_title"); + Label description = new Label(desc, skin, "purchaseitem_desc"); + Label cost = new Label(price + "S", skin, "purchaseitem_price"); + + title.setAlignment(Align.center); + description.setAlignment(Align.center); + cost.setAlignment(Align.center); + + description.setWrap(true); + + Table table = new Table(); + + table.setPosition(0 , super.getHeight()); + table.setWidth(super.getWidth()); + + table.add(icon).pad(8).center().row(); + table.add(title).expand().padBottom(8).center().row(); + table.add(description).expand().fillX().center().row(); + table.add(cost).expand().fillX().center().row(); + + super.addActor(table); + } +} |
