mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 01:38:13 +00:00
Merge pull request #3436 from kevlahnota/newmaster2
format win/loss ratio
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package forge.util;
|
package forge.util;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.text.Normalizer;
|
import java.text.Normalizer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -42,6 +43,10 @@ public class TextUtil {
|
|||||||
return Normalizer.normalize(text, Normalizer.Form.NFD);
|
return Normalizer.normalize(text, Normalizer.Form.NFD);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private static final DecimalFormat df = new DecimalFormat("#.##");
|
||||||
|
public static String decimalFormat(float value) {
|
||||||
|
return df.format(value);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Safely converts an object to a String.
|
* Safely converts an object to a String.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import forge.localinstance.achievements.CardActivationAchievements;
|
|||||||
import forge.localinstance.achievements.PlaneswalkerAchievements;
|
import forge.localinstance.achievements.PlaneswalkerAchievements;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.player.GamePlayerUtil;
|
import forge.player.GamePlayerUtil;
|
||||||
|
import forge.util.TextUtil;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -216,7 +217,7 @@ public class PlayerStatisticScene extends UIScene {
|
|||||||
totalLoss.setText(String.valueOf(Current.player().getStatistic().totalLoss()));
|
totalLoss.setText(String.valueOf(Current.player().getStatistic().totalLoss()));
|
||||||
}
|
}
|
||||||
if (lossWinRatio != null) {
|
if (lossWinRatio != null) {
|
||||||
lossWinRatio.setText(Float.toString(Current.player().getStatistic().winLossRatio()));
|
lossWinRatio.setText(TextUtil.decimalFormat(Current.player().getStatistic().winLossRatio()));
|
||||||
}
|
}
|
||||||
if (eventMatchWins != null) {
|
if (eventMatchWins != null) {
|
||||||
eventMatchWins.setText(String.valueOf(Current.player().getStatistic().eventWins()));
|
eventMatchWins.setText(String.valueOf(Current.player().getStatistic().eventWins()));
|
||||||
|
|||||||
Reference in New Issue
Block a user