revert TextraTypist

This commit is contained in:
Anthony Calosa
2025-07-13 17:12:00 +08:00
parent 1be4880776
commit d044d0dc65
9 changed files with 40 additions and 46 deletions

View File

@@ -53,7 +53,7 @@
<dependency> <dependency>
<groupId>com.github.tommyettinger</groupId> <groupId>com.github.tommyettinger</groupId>
<artifactId>textratypist</artifactId> <artifactId>textratypist</artifactId>
<version>2.0.3</version> <version>0.8.2</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>

View File

@@ -32,25 +32,17 @@ import java.util.function.Function;
*/ */
public class Controls { public class Controls {
static public Styles.LabelStyle getLabelStyle() { static public Label.LabelStyle getLabelStyle(String name) {
return getLabelStyle("default"); return getSkin().get(name, Label.LabelStyle.class);
} }
static public Styles.LabelStyle getLabelStyle(String name) { static public TextButton.TextButtonStyle getTextButtonStyle(String name) {
return new Styles.LabelStyle(getSkin().get(name, Label.LabelStyle.class)); return getSkin().get(name, TextButton.TextButtonStyle.class);
}
static public Styles.TextButtonStyle getTextButtonStyle() {
return getTextButtonStyle("default");
}
static public Styles.TextButtonStyle getTextButtonStyle(String name) {
return new Styles.TextButtonStyle(getSkin().get(name, TextButton.TextButtonStyle.class));
} }
static class LabelFix extends TextraLabel { static class LabelFix extends TextraLabel {
public LabelFix(String text, Font font) { public LabelFix(String text, Font font) {
super(text, getLabelStyle(), font); super(text, getSkin(), font);
} }
@Override @Override
@@ -71,7 +63,7 @@ public class Controls {
static class TextButtonFix extends TextraButton { static class TextButtonFix extends TextraButton {
public TextButtonFix(@Null String text) { public TextButtonFix(@Null String text) {
super(text == null ? "NULL" : text, getTextButtonStyle(), getTextraFont()); super(text == null ? "NULL" : text, Controls.getSkin(), Controls.getTextraFont());
addListener(new ClickListener(){ addListener(new ClickListener(){
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@@ -106,7 +98,7 @@ public class Controls {
static class TypingButtonFix extends TypingButton { static class TypingButtonFix extends TypingButton {
public TypingButtonFix(@Null String text) { public TypingButtonFix(@Null String text) {
super(text == null ? "NULL" : text, getTextButtonStyle(), getTextraFont()); super(text == null ? "NULL" : text, Controls.getSkin(), Controls.getTextraFont());
addListener(new ClickListener(){ addListener(new ClickListener(){
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
@@ -474,22 +466,22 @@ public class Controls {
String nextline = vertical ? "\n" : ""; String nextline = vertical ? "\n" : "";
String colorId = ""; String colorId = "";
if (color.hasWhite()) if (color.hasWhite())
colorId += "[+pmW]"+nextline; colorId += "[+W]"+nextline;
if (color.hasBlue()) if (color.hasBlue())
colorId += "[+pmU]"+nextline; colorId += "[+U]"+nextline;
if (color.hasBlack()) if (color.hasBlack())
colorId += "[+pmB]"+nextline; colorId += "[+B]"+nextline;
if (color.hasRed()) if (color.hasRed())
colorId += "[+pmR]"+nextline; colorId += "[+R]"+nextline;
if (color.hasGreen()) if (color.hasGreen())
colorId += "[+pmG]"+nextline; colorId += "[+G]"+nextline;
if (color.isColorless()) if (color.isColorless())
colorId += "[+pmC]"+nextline; colorId += "[+C]"+nextline;
return colorId; return colorId;
} }
public static TypingLabel newTypingLabel(String name) { public static TypingLabel newTypingLabel(String name) {
TypingLabel ret = new TypingLabel(name == null ? "" : name, getLabelStyle(), getTextraFont()); TypingLabel ret = new TypingLabel(name == null ? "" : name, getSkin(), getTextraFont());
String pn = Current.player().getName(); String pn = Current.player().getName();
if (pn != null) // this variable is used for dialogs if (pn != null) // this variable is used for dialogs
ret.setVariable("player_name", pn); ret.setVariable("player_name", pn);

View File

@@ -336,9 +336,11 @@ public class Assets implements Disposable {
if (textrafonts == null) if (textrafonts == null)
textrafonts = new ObjectMap<>(); textrafonts = new ObjectMap<>();
if (!textrafonts.containsKey("textrafont")) { if (!textrafonts.containsKey("textrafont")) {
Font font = new Font(bitmapFont); Font font = new Font(bitmapFont, 0f, 2f, 0f, 1f);
font.addAtlas(item_atlas); font.addAtlas(item_atlas, 0f, 6f, 0f);
font.addAtlas(pixelmana_atlas); //problematic atlas since some buttons are small, and this is too big for some buttons, need a way to enable
//this via property
//font.addAtlas(pixelmana_atlas, -90f, 20f, 0f);
font.integerPosition = false; font.integerPosition = false;
textrafonts.put("textrafont", font); textrafonts.put("textrafont", font);
} }
@@ -350,7 +352,7 @@ public class Assets implements Disposable {
textrafonts = new ObjectMap<>(); textrafonts = new ObjectMap<>();
if (!textrafonts.containsKey("keysfont")) { if (!textrafonts.containsKey("keysfont")) {
Font font = new Font(bitmapFont); Font font = new Font(bitmapFont);
font.addAtlas(keys_atlas); font.addAtlas(keys_atlas, 0f, 6f, 0f);
font.integerPosition = false; font.integerPosition = false;
textrafonts.put("keysfont", font); textrafonts.put("keysfont", font);
} }
@@ -361,8 +363,8 @@ public class Assets implements Disposable {
if (textrafonts == null) if (textrafonts == null)
textrafonts = new ObjectMap<>(); textrafonts = new ObjectMap<>();
if (!textrafonts.containsKey(name)) { if (!textrafonts.containsKey(name)) {
Font font = new Font(bitmapFont); Font font = new Font(bitmapFont, 0f, 2f, 0f, 1f);
font.addAtlas(items_atlas); font.addAtlas(items_atlas, 0f, 6f, 0f);
font.integerPosition = false; font.integerPosition = false;
textrafonts.put(name, font); textrafonts.put(name, font);
} }
@@ -373,7 +375,7 @@ public class Assets implements Disposable {
if (textrafonts == null) if (textrafonts == null)
textrafonts = new ObjectMap<>(); textrafonts = new ObjectMap<>();
if (!textrafonts.containsKey("GenericHeaderFont")) { if (!textrafonts.containsKey("GenericHeaderFont")) {
Font font = new Font(bitmapFont); Font font = new Font(bitmapFont, 0f, -0.5f, 0f, -2.5f);
font.integerPosition = false; font.integerPosition = false;
textrafonts.put("GenericHeaderFont", font); textrafonts.put("GenericHeaderFont", font);
} }

View File

@@ -5,7 +5,7 @@
"playerBaseSpeed": 32, "playerBaseSpeed": 32,
"minDeckSize": 40, "minDeckSize": 40,
"colorIds":["W","U","B","R","G"], "colorIds":["W","U","B","R","G"],
"colorIdNames":["tr(lblWhite) [+pmW]","tr(lblBlue) [+pmU]","tr(lblBlack) [+pmB]","tr(lblRed) [+pmR]","tr(lblGreen) [+pmG]"], "colorIdNames":["tr(lblWhite) [+W]","tr(lblBlue) [+U]","tr(lblBlack) [+B]","tr(lblRed) [+R]","tr(lblGreen) [+G]"],
"restrictedCards": [ "restrictedCards": [
"Black Lotus", "Black Lotus",
"Mox Emerald", "Mox Emerald",

View File

@@ -5,7 +5,7 @@
"playerBaseSpeed": 32, "playerBaseSpeed": 32,
"minDeckSize": 40, "minDeckSize": 40,
"colorIds":["W","U","B","R","G"], "colorIds":["W","U","B","R","G"],
"colorIdNames":["tr(lblWhite) [+pmW]","tr(lblBlue) [+pmU]","tr(lblBlack) [+pmB]","tr(lblRed) [+pmR]","tr(lblGreen) [+pmG]"], "colorIdNames":["tr(lblWhite) [+W]","tr(lblBlue) [+U]","tr(lblBlack) [+B]","tr(lblRed) [+R]","tr(lblGreen) [+G]"],
"restrictedCards": [ "restrictedCards": [
"Black Lotus", "Black Lotus",
"Mox Emerald", "Mox Emerald",

View File

@@ -5,7 +5,7 @@
"playerBaseSpeed": 45, "playerBaseSpeed": 45,
"minDeckSize": 40, "minDeckSize": 40,
"colorIds":["W","U","B","R","G"], "colorIds":["W","U","B","R","G"],
"colorIdNames":["tr(lblWhite) [+pmW]","tr(lblBlue) [+pmU]","tr(lblBlack) [+pmB]","tr(lblRed) [+pmR]","tr(lblGreen) [+pmG]"], "colorIdNames":["tr(lblWhite) [+W]","tr(lblBlue) [+U]","tr(lblBlack) [+B]","tr(lblRed) [+R]","tr(lblGreen) [+G]"],
"restrictedCards": [ "restrictedCards": [
"Black Lotus", "Black Lotus",
"Mox Emerald", "Mox Emerald",

View File

@@ -5,7 +5,7 @@
"playerBaseSpeed": 32, "playerBaseSpeed": 32,
"minDeckSize": 40, "minDeckSize": 40,
"colorIds":["W","U","B","R","G"], "colorIds":["W","U","B","R","G"],
"colorIdNames":["tr(lblWhite) [+pmW]","tr(lblBlue) [+pmU]","tr(lblBlack) [+pmB]","tr(lblRed) [+pmR]","tr(lblGreen) [+pmG]"], "colorIdNames":["tr(lblWhite) [+W]","tr(lblBlue) [+U]","tr(lblBlack) [+B]","tr(lblRed) [+R]","tr(lblGreen) [+G]"],
"restrictedCards": [ "restrictedCards": [
"Black Lotus", "Black Lotus",
"Mox Emerald", "Mox Emerald",

View File

@@ -74,7 +74,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BBlack", "name": "BBlack",
"text": "[+pmB]", "text": "[+B]",
"x": 15, "x": 15,
"y": 120, "y": 120,
"width": 45, "width": 45,
@@ -84,7 +84,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BBlue", "name": "BBlue",
"text": "[+pmU]", "text": "[+U]",
"x": 65, "x": 65,
"y": 120, "y": 120,
"width": 45, "width": 45,
@@ -94,7 +94,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BGreen", "name": "BGreen",
"text": "[+pmG]", "text": "[+G]",
"x": 115, "x": 115,
"y": 120, "y": 120,
"width": 45, "width": 45,
@@ -104,7 +104,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BRed", "name": "BRed",
"text": "[+pmR]", "text": "[+R]",
"x": 165, "x": 165,
"y": 120, "y": 120,
"width": 45, "width": 45,
@@ -114,7 +114,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BWhite", "name": "BWhite",
"text": "[+pmW]", "text": "[+W]",
"x": 215, "x": 215,
"y": 120, "y": 120,
"width": 45, "width": 45,
@@ -124,7 +124,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BColorless", "name": "BColorless",
"text": "[+pmC]", "text": "[+C]",
"x": 265, "x": 265,
"y": 120, "y": 120,
"width": 45, "width": 45,

View File

@@ -73,7 +73,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BBlack", "name": "BBlack",
"text": "[+pmB]", "text": "[+B]",
"x": 58, "x": 58,
"y": 290, "y": 290,
"width": 45, "width": 45,
@@ -83,7 +83,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BBlue", "name": "BBlue",
"text": "[+pmU]", "text": "[+U]",
"x": 113, "x": 113,
"y": 290, "y": 290,
"width": 45, "width": 45,
@@ -93,7 +93,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BGreen", "name": "BGreen",
"text": "[+pmG]", "text": "[+G]",
"x": 168, "x": 168,
"y": 290, "y": 290,
"width": 45, "width": 45,
@@ -103,7 +103,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BRed", "name": "BRed",
"text": "[+pmR]", "text": "[+R]",
"x": 58, "x": 58,
"y": 320, "y": 320,
"width": 45, "width": 45,
@@ -113,7 +113,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BWhite", "name": "BWhite",
"text": "[+pmW]", "text": "[+W]",
"x": 113, "x": 113,
"y": 320, "y": 320,
"width": 45, "width": 45,
@@ -123,7 +123,7 @@
"type": "TextButton", "type": "TextButton",
"selectable": true, "selectable": true,
"name": "BColorless", "name": "BColorless",
"text": "[+pmC]", "text": "[+C]",
"x": 168, "x": 168,
"y": 320, "y": 320,
"width": 45, "width": 45,