summaryrefslogtreecommitdiff
path: root/core/src/kz/ilotterytea/maxon/pets
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/pets')
-rw-r--r--core/src/kz/ilotterytea/maxon/pets/PetManager.java17
-rw-r--r--core/src/kz/ilotterytea/maxon/pets/PetWidget.java15
2 files changed, 17 insertions, 15 deletions
diff --git a/core/src/kz/ilotterytea/maxon/pets/PetManager.java b/core/src/kz/ilotterytea/maxon/pets/PetManager.java
index b313704..f5f7aed 100644
--- a/core/src/kz/ilotterytea/maxon/pets/PetManager.java
+++ b/core/src/kz/ilotterytea/maxon/pets/PetManager.java
@@ -41,23 +41,22 @@ public class PetManager {
pets.add(pet);
}
- pets = pets.stream().sorted((pet, t1) -> {
- if (pet.getPrice() > t1.getPrice()) {
- return 1;
- } else if (pet.getPrice() < t1.getPrice()) {
- return -1;
- }
- return 0;
- }).collect(Collectors.toList());
+ Collections.sort(pets, (pet1, pet2) -> Double.compare(pet1.getPrice(), pet2.getPrice()));
this.pets.addAll(pets);
logger.info("Loaded {} pets", pets.size());
}
public Optional<Pet> getPet(String id) {
- return pets.stream().filter(x -> x.getId().equals(id)).findFirst();
+ for (Pet pet : pets) {
+ if (pet.getId().equals(id)) {
+ return Optional.of(pet);
+ }
+ }
+ return Optional.empty();
}
+
public ArrayList<Pet> getPets() {
return pets;
}
diff --git a/core/src/kz/ilotterytea/maxon/pets/PetWidget.java b/core/src/kz/ilotterytea/maxon/pets/PetWidget.java
index 1cd815f..54b937b 100644
--- a/core/src/kz/ilotterytea/maxon/pets/PetWidget.java
+++ b/core/src/kz/ilotterytea/maxon/pets/PetWidget.java
@@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import kz.ilotterytea.maxon.MaxonConstants;
+import kz.ilotterytea.maxon.utils.OsUtils;
import kz.ilotterytea.maxon.utils.formatters.NumberFormatter;
public class PetWidget extends Table {
@@ -33,13 +34,13 @@ public class PetWidget extends Table {
this.pet = pet;
this.skin = skin;
- super.add(pet.getIcon()).size(64f).pad(6f);
+ super.add(pet.getIcon()).size(OsUtils.isMobile ? 128f : 64f).pad(6f);
- this.idleStyle = skin.get("store_item", Label.LabelStyle.class);
+ this.idleStyle = skin.get(OsUtils.isMobile ? "store_item_mobile" : "store_item", Label.LabelStyle.class);
this.hoverStyle = skin.get("store_item_hover", Label.LabelStyle.class);
- this.disabledStyle = skin.get("store_item_disabled", Label.LabelStyle.class);
- this.availablePriceStyle = skin.get("store_item_price", Label.LabelStyle.class);
- this.disabledPriceStyle = skin.get("store_item_price_disabled", Label.LabelStyle.class);
+ this.disabledStyle = skin.get(OsUtils.isMobile ? "store_item_disabled_mobile" : "store_item_disabled", Label.LabelStyle.class);
+ this.availablePriceStyle = skin.get(OsUtils.isMobile ? "store_item_price_mobile" : "store_item_price", Label.LabelStyle.class);
+ this.disabledPriceStyle = skin.get(OsUtils.isMobile ? "store_item_price_disabled_mobile" : "store_item_price_disabled", Label.LabelStyle.class);
this.price = pet.getPrice();
@@ -64,9 +65,11 @@ public class PetWidget extends Table {
summary.add(nameLabel).align(Align.left).grow().row();
+ float iconSize = OsUtils.isMobile ? 64f : 16f;
+
Table priceTable = new Table();
priceTable.align(Align.left);
- priceTable.add(priceIcon).size(16f, 16f).padRight(5f);
+ priceTable.add(priceIcon).size(iconSize, iconSize).padRight(5f);
priceTable.add(priceLabel).grow();
summary.add(priceTable).grow();