initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
45
java/src/game/gui/GuiConfirm.java
Executable file
45
java/src/game/gui/GuiConfirm.java
Executable file
|
@ -0,0 +1,45 @@
|
|||
package game.gui;
|
||||
|
||||
import game.ActButton;
|
||||
import game.ActButton.Mode;
|
||||
import game.Gui;
|
||||
import game.Label;
|
||||
import game.Textbox;
|
||||
|
||||
public class GuiConfirm extends Gui implements ActButton.Callback {
|
||||
public static interface Callback {
|
||||
void confirm(boolean confirmed);
|
||||
}
|
||||
|
||||
protected Callback callback;
|
||||
protected String messageLine1;
|
||||
private String messageLine2;
|
||||
protected String confirmButtonText;
|
||||
protected String cancelButtonText;
|
||||
private ActButton confirmBtn;
|
||||
private ActButton cancelBtn;
|
||||
|
||||
public GuiConfirm(Callback callback, String msg1, String msg2, String msgConfirm, String msgCancel) {
|
||||
this.callback = callback;
|
||||
this.messageLine1 = msg1;
|
||||
this.messageLine2 = msg2;
|
||||
this.confirmButtonText = msgConfirm;
|
||||
this.cancelButtonText = msgCancel;
|
||||
}
|
||||
|
||||
public void init(int width, int height) {
|
||||
this.add(new Label(0, 0, 500, 24, this.messageLine1, true));
|
||||
this.add(new Textbox(0, 80, 500, 300, this.messageLine2));
|
||||
this.confirmBtn = this.add(new ActButton(48, 500, 200, 24, (ActButton.Callback)this, this.confirmButtonText));
|
||||
this.cancelBtn = this.add(new ActButton(252, 500, 200, 24, (ActButton.Callback)this, this.cancelButtonText));
|
||||
this.shift();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Aktion bestätigen";
|
||||
}
|
||||
|
||||
public void use(ActButton btn, Mode mode) {
|
||||
this.callback.confirm(btn == this.confirmBtn);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue