From beb3f077341d0df7661c8174f1ac3cc9eab76fb7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 10 Jun 2022 22:02:31 -0400 Subject: [PATCH] v1.3.0: fixed source merging errors with rankings --- .../shatteredpixeldungeon/Rankings.java | 2 +- .../windows/WndRanking.java | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index 3703c5e42..712149b34 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -434,7 +434,7 @@ public enum Rankings { } } - private static final Comparator scoreComparator = new Comparator() { + public static final Comparator scoreComparator = new Comparator() { @Override public int compare( Record lhs, Record rhs ) { int result = (int)Math.signum( rhs.score - lhs.score ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java index 27cca1176..09841d030 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndRanking.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.QuickSlot; import com.shatteredpixel.shatteredpixeldungeon.Rankings; +import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings; @@ -226,6 +227,39 @@ public class WndRanking extends WndTabbed { pos = statSlot( this, Messages.get(this, "gold"), num.format( Statistics.goldCollected ), pos ); pos = statSlot( this, Messages.get(this, "food"), num.format( Statistics.foodEaten ), pos ); pos = statSlot( this, Messages.get(this, "alchemy"), num.format( Statistics.itemsCrafted ), pos ); + + int buttontop = HEIGHT - 16; + + if (Dungeon.seed != -1 && (DeviceCompat.isDebug() || Badges.isUnlocked(Badges.Badge.VICTORY))){ + final Image icon = Icons.get(Icons.SEED); + RedButton btnSeed = new RedButton(Messages.get(this, "copy_seed")){ + @Override + protected void onClick() { + super.onClick(); + ShatteredPixelDungeon.scene().addToFront(new WndOptions(new Image(icon), + Messages.get(WndRanking.StatsTab.this, "copy_seed"), + Messages.get(WndRanking.StatsTab.this, "copy_seed_desc"), + Messages.get(WndRanking.StatsTab.this, "copy_seed_copy"), + Messages.get(WndRanking.StatsTab.this, "copy_seed_cancel")){ + @Override + protected void onSelect(int index) { + super.onSelect(index); + if (index == 0){ + SPDSettings.customSeed(DungeonSeed.convertToCode(Dungeon.seed)); + icon.hardlight(1f, 1.5f, 0.67f); + } + } + }); + } + }; + if (DungeonSeed.convertFromText(SPDSettings.customSeed()) == Dungeon.seed){ + icon.hardlight(1f, 1.5f, 0.67f); + } + btnSeed.icon(icon); + btnSeed.setRect(0, buttontop, 115, 16); + add(btnSeed); + } + } private float statSlot( Group parent, String label, String value, float pos ) {