summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/DialogAction.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/DialogAction.java
downloadworlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz
worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/DialogAction.java')
-rw-r--r--NET/worlds/scape/DialogAction.java171
1 files changed, 171 insertions, 0 deletions
diff --git a/NET/worlds/scape/DialogAction.java b/NET/worlds/scape/DialogAction.java
new file mode 100644
index 0000000..c1c14fd
--- /dev/null
+++ b/NET/worlds/scape/DialogAction.java
@@ -0,0 +1,171 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.console.DialogReceiver;
+/* */ import NET.worlds.console.PolledDialog;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public abstract class DialogAction
+/* */ extends Action
+/* */ implements DialogReceiver
+/* */ {
+/* 28 */ boolean showDialog = true;
+/* 29 */ boolean cancelOnly = false;
+/* */
+/* 31 */ private static PolledDialog dialogUp = null;
+/* */ private PolledDialog thisDialog;
+/* 33 */ protected static boolean doCancel = false;
+/* */
+/* */
+/* */
+/* */ public void dialogDone(Object who, boolean confirmed)
+/* */ {
+/* 39 */ if (dialogUp == who) {
+/* 40 */ doCancel = true;
+/* 41 */ if (confirmed) {
+/* 42 */ doIt();
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */ public abstract void doIt();
+/* */
+/* */
+/* */
+/* */ public abstract PolledDialog getDialog();
+/* */
+/* */
+/* */
+/* */ public Persister trigger(Event e, Persister seqID)
+/* */ {
+/* 59 */ Console console = Console.getActive();
+/* */
+/* */
+/* 62 */ if (console == null) {
+/* 63 */ return null;
+/* */ }
+/* */
+/* 66 */ if ((!this.showDialog) && (!this.cancelOnly)) {
+/* 67 */ if (console != null)
+/* 68 */ doIt();
+/* 69 */ return null;
+/* */ }
+/* */
+/* 72 */ if (dialogUp != null)
+/* */ {
+/* */
+/* */
+/* 76 */ if ((this.thisDialog != dialogUp) || (seqID == null)) {
+/* 77 */ doCancel = true;
+/* 78 */ } else if (doCancel) {
+/* 79 */ dialogUp.closeIt(false);
+/* 80 */ dialogUp = null;
+/* 81 */ this.thisDialog = null;
+/* 82 */ return null;
+/* */ }
+/* 84 */ return this;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* 90 */ if (this.cancelOnly) {
+/* 91 */ return null;
+/* */ }
+/* 93 */ this.thisDialog = (dialogUp = getDialog());
+/* 94 */ doCancel = false;
+/* 95 */ return this;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 103 */ Object ret = null;
+/* 104 */ switch (index - offset) {
+/* */ case 0:
+/* 106 */ if (mode == 0) {
+/* 107 */ ret = BooleanPropertyEditor.make(
+/* 108 */ new Property(this, index, "Display Dialog Box"),
+/* 109 */ "Don't ask",
+/* 110 */ "Ask user to ok choice");
+/* */ }
+/* 112 */ else if (mode == 1) {
+/* 113 */ ret = new Boolean(this.showDialog);
+/* */ }
+/* 115 */ else if (mode == 2) {
+/* 116 */ this.showDialog = ((Boolean)value).booleanValue();
+/* */ }
+/* 118 */ break;
+/* */ case 1:
+/* 120 */ if (mode == 0) {
+/* 121 */ ret = BooleanPropertyEditor.make(
+/* 122 */ new Property(this, index, "Cancel only"),
+/* 123 */ "Regular operation",
+/* 124 */ "Cancels dialog, doesn't do action");
+/* 125 */ } else if (mode == 1) {
+/* 126 */ ret = new Boolean(this.cancelOnly);
+/* 127 */ } else if (mode == 2)
+/* 128 */ this.cancelOnly = ((Boolean)value).booleanValue();
+/* 129 */ break;
+/* */ default:
+/* 131 */ ret = super.properties(index, offset + 2, mode, value);
+/* */ }
+/* 133 */ return ret;
+/* */ }
+/* */
+/* */
+/* 137 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException {
+/* 140 */ s.saveVersion(0, classCookie);
+/* 141 */ super.saveState(s);
+/* */
+/* 143 */ s.saveBoolean(this.showDialog);
+/* 144 */ s.saveBoolean(this.cancelOnly);
+/* */ }
+/* */
+/* */ protected void dialogActionSkipRestore(Restorer r)
+/* */ throws IOException, TooNewException
+/* */ {
+/* 150 */ super.restoreState(r);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException {
+/* 154 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 0:
+/* 156 */ super.restoreState(r);
+/* 157 */ this.showDialog = r.restoreBoolean();
+/* 158 */ this.cancelOnly = r.restoreBoolean();
+/* 159 */ break;
+/* */
+/* */ default:
+/* 162 */ throw new TooNewException();
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\DialogAction.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file