From 6cfb967ab49cdf8a2daf147b83b51d7894d5ea4b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 4 Nov 2015 02:10:42 -0500 Subject: [PATCH] v0.3.2: added ability to customize the button text for the new notification window --- .../windows/WndHardNotification.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java index ab875c206..19f2bd1b8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndHardNotification.java @@ -12,17 +12,19 @@ public class WndHardNotification extends WndTitledMessage{ RedButton btnOkay; private double timeLeft; + private String btnMessage; - public WndHardNotification( Image icon, String title, String message, int time) { - this(new IconTitle(icon, title), message, time); + public WndHardNotification( Image icon, String title, String message, String btnMessage, int time) { + this(new IconTitle(icon, title), message, btnMessage, time); } - public WndHardNotification(Component titlebar, String message, int time) { + public WndHardNotification(Component titlebar, String message, String btnMessage, int time) { super(titlebar, message); timeLeft = time; + this.btnMessage = btnMessage; - btnOkay = new RedButton("Okay (" + time +")"){ + btnOkay = new RedButton(btnMessage + " (" + time +")"){ @Override protected void onClick() { hide(); @@ -42,9 +44,9 @@ public class WndHardNotification extends WndTitledMessage{ timeLeft -= Game.elapsed; if (timeLeft <= 0 ){ btnOkay.enable(true); - btnOkay.text("Okay"); + btnOkay.text(btnMessage); } else { - btnOkay.text("Okay (" + (int)Math.ceil(timeLeft) + ")"); + btnOkay.text(btnMessage + " (" + (int)Math.ceil(timeLeft) + ")"); } }