diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/AdvancingAction.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/scape/AdvancingAction.java')
| -rw-r--r-- | NET/worlds/scape/AdvancingAction.java | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/NET/worlds/scape/AdvancingAction.java b/NET/worlds/scape/AdvancingAction.java new file mode 100644 index 0000000..ff5b434 --- /dev/null +++ b/NET/worlds/scape/AdvancingAction.java @@ -0,0 +1,186 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import java.io.IOException; +/* */ import java.util.Enumeration; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class AdvancingAction +/* */ extends Action +/* */ { +/* 29 */ private Vector<Action> actions = new Vector(); +/* */ +/* */ +/* 32 */ private int nextAction = 0; +/* */ +/* */ +/* 35 */ boolean singleTrigger = true; +/* 36 */ boolean inProgress = false; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Persister trigger(Event evt, Persister seqID) +/* */ { +/* 45 */ if ((this.singleTrigger) && (this.inProgress) && (seqID == null)) { +/* 46 */ return null; +/* */ } +/* */ +/* 49 */ if (this.nextAction >= this.actions.size()) +/* 50 */ this.nextAction = 0; +/* 51 */ Action act = (Action)this.actions.elementAt(this.nextAction); +/* */ +/* */ +/* 54 */ Persister id = null; +/* 55 */ if (act != null) { +/* 56 */ id = act.trigger(evt, seqID); +/* 57 */ this.inProgress = (id != null); +/* */ } +/* */ +/* */ +/* 61 */ if ((id == null) || (!this.singleTrigger)) { +/* 62 */ this.nextAction += 1; +/* */ } +/* 64 */ return id; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void addComponent(Action act) +/* */ { +/* 74 */ this.actions.addElement(act); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void insertComponent(Action act, int index) +/* */ { +/* 84 */ this.actions.insertElementAt(act, index); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public boolean removeComponent(Action act) +/* */ { +/* 94 */ return this.actions.removeElement(act); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Enumeration<Action> getComponents() +/* */ { +/* 103 */ return this.actions.elements(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Object properties(int index, int offset, int mode, Object value) +/* */ throws NoSuchPropertyException +/* */ { +/* 114 */ Object ret = null; +/* 115 */ switch (index - offset) { +/* */ case 0: +/* 117 */ if (mode == 0) { +/* 118 */ VectorProperty vp = +/* 119 */ new VectorProperty(this, index, "Components"); +/* 120 */ vp.allowSorting(false); +/* 121 */ ret = ObjectPropertyAdder.make(vp, getRoot(), +/* 122 */ "NET.worlds.scape.Action"); +/* 123 */ } else if (mode == 1) { +/* 124 */ ret = this.actions.clone(); +/* 125 */ } else if (mode == 4) { +/* 126 */ this.actions.removeElement(value); +/* 127 */ } else if (mode == 3) { +/* 128 */ this.actions.addElement((Action)value); } +/* 129 */ break; +/* */ case 1: +/* 131 */ if (mode == 0) { +/* 132 */ ret = BooleanPropertyEditor.make(new Property(this, index, +/* 133 */ "Prevent overlapping actions"), +/* 134 */ "Overlapping", +/* 135 */ "One at a time"); +/* 136 */ } else if (mode == 1) { +/* 137 */ ret = new Boolean(this.singleTrigger); +/* 138 */ } else if (mode == 2) +/* 139 */ this.singleTrigger = ((Boolean)value).booleanValue(); +/* 140 */ break; +/* */ default: +/* 142 */ ret = super.properties(index, offset + 2, mode, value); +/* */ } +/* 144 */ return ret; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* 151 */ private static Object classCookie = new Object(); +/* */ +/* */ public void saveState(Saver s) throws IOException +/* */ { +/* 155 */ s.saveVersion(1, classCookie); +/* 156 */ super.saveState(s); +/* 157 */ s.saveVector(this.actions); +/* 158 */ s.saveInt(this.nextAction); +/* 159 */ s.saveBoolean(this.singleTrigger); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) throws IOException, TooNewException +/* */ { +/* 164 */ switch (r.restoreVersion(classCookie)) { +/* */ case 0: +/* 166 */ super.restoreState(r); +/* 167 */ this.actions = r.restoreVectorActions(); +/* 168 */ this.nextAction = r.restoreInt(); +/* 169 */ break; +/* */ case 1: +/* 171 */ super.restoreState(r); +/* 172 */ this.actions = r.restoreVectorActions(); +/* 173 */ this.nextAction = r.restoreInt(); +/* 174 */ this.singleTrigger = r.restoreBoolean(); +/* 175 */ break; +/* */ default: +/* 177 */ throw new TooNewException(); +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\AdvancingAction.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |