From 0c7f6536eae679a2f11720a9ca6d0e36d8ff9df0 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Thu, 6 Oct 2022 17:45:58 +0600 Subject: подгон к новому формату сохранений MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ilotterytea/maxoning/ui/SaveGameWidget.java | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'core/src/com/ilotterytea/maxoning/ui') diff --git a/core/src/com/ilotterytea/maxoning/ui/SaveGameWidget.java b/core/src/com/ilotterytea/maxoning/ui/SaveGameWidget.java index cd6fa72..aa9fa85 100644 --- a/core/src/com/ilotterytea/maxoning/ui/SaveGameWidget.java +++ b/core/src/com/ilotterytea/maxoning/ui/SaveGameWidget.java @@ -3,15 +3,18 @@ package com.ilotterytea.maxoning.ui; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.utils.Align; -import com.ilotterytea.maxoning.player.MaxonPlayer; +import com.badlogic.gdx.utils.Null; +import com.ilotterytea.maxoning.player.MaxonSavegame; import com.ilotterytea.maxoning.utils.formatters.NumberFormatter; +import java.util.Date; + public class SaveGameWidget extends Button { public SaveGameWidget( Skin skin, Skin widgetSkin, - MaxonPlayer sav + @Null MaxonSavegame sav ) { // Setting the stack: super(widgetSkin, "slot"); @@ -20,14 +23,15 @@ public class SaveGameWidget extends Button { // // Info row: Table infoTable = new Table(); - // Top left label: - Label topleftLabel = new Label(String.format("%s Squish Points", (sav != null) ? NumberFormatter.format((long) sav.points) : "---"), skin); + // Top left label (name): + Label topleftLabel = new Label((sav != null) ? sav.name : "[EMPTY]", skin); topleftLabel.setAlignment(Align.left); infoTable.add(topleftLabel).width(256f); - // Top right label: + // Top right label (elapsed time): + Date date = new Date((sav != null) ? sav.elapsedTime : 0); Label toprightLabel = new Label( - String.format("%s purchased items", (sav != null) ? sav.purchasedItems.size() : "---"), + String.format("%s:%s", date.getHours(), date.getMinutes()), skin ); toprightLabel.setAlignment(Align.right); @@ -36,28 +40,28 @@ public class SaveGameWidget extends Button { // // Description row: Table descTable = new Table(); - // Bottom left label: + // Bottom left label (purchased items): Label bottomleftLabel = new Label( String.format( - "x%s", - (sav != null) ? NumberFormatter.format((long) sav.multiplier) : "?" + "%s purchased items", + (sav != null) ? sav.inv.size() : "?" ), skin ); bottomleftLabel.setAlignment(Align.left); descTable.add(bottomleftLabel).width(256f); - /* NOT IN USE. Bottom right label: + // Bottom right label (points/multiplier): Label pointsLabel = new Label( String.format( "%s$/x%s", - NumberFormatter.format(points), - NumberFormatter.format(multiplier) + (sav != null) ? NumberFormatter.format(sav.points) : "---", + (sav != null) ? NumberFormatter.format(sav.multiplier) : "0" ), skin ); pointsLabel.setAlignment(Align.right); - descTable.add(pointsLabel).width(256f);*/ + descTable.add(pointsLabel).width(256f); // Adding the tables to main table: Table summaryTable = new Table(); -- cgit v1.2.3