/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ import java.util.Enumeration; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class SequenceAction /* */ extends Action /* */ { /* 50 */ protected int loopCount = 1; /* 51 */ protected boolean loopInfinite = false; /* 52 */ Vector actions = new Vector(); /* */ /* */ /* */ SequenceActionState currentSeq; /* */ /* */ /* */ /* */ public Persister trigger(Event evt, Persister seqID) /* */ { /* 61 */ if (seqID != this.currentSeq) { /* 62 */ return null; /* */ } /* 64 */ if (seqID == null) { /* 65 */ this.currentSeq = new SequenceActionState(this); /* */ } /* 67 */ if (!this.currentSeq.run(evt)) { /* 68 */ this.currentSeq = null; /* */ } /* 70 */ return this.currentSeq; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void addComponent(Action act) /* */ { /* 79 */ this.actions.addElement(act); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void insertComponent(Action act, int index) /* */ { /* 89 */ this.actions.insertElementAt(act, index); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public boolean removeComponent(Action act) /* */ { /* 99 */ return this.actions.removeElement(act); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public Enumeration getComponents() /* */ { /* 108 */ return this.actions.elements(); /* */ } /* */ /* */ /* 112 */ public int getLoopCount() { return this.loopCount; } /* 113 */ public void setLoopCount(int c) { this.loopCount = c; } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 123 */ Object ret = null; /* 124 */ switch (index - offset) { /* */ case 0: /* 126 */ if (mode == 0) { /* 127 */ VectorProperty vp = /* 128 */ new VectorProperty(this, index, "Components"); /* 129 */ vp.allowSorting(false); /* 130 */ ret = ObjectPropertyAdder.make(vp, getRoot(), /* 131 */ "NET.worlds.scape.Action"); /* 132 */ } else if (mode == 1) { /* 133 */ ret = this.actions.clone(); /* 134 */ } else if (mode == 4) { /* 135 */ this.actions.removeElement(value); /* 136 */ } else if (mode == 3) { /* 137 */ this.actions.addElement((Action)value); } /* 138 */ break; /* */ case 1: /* 140 */ if (mode == 0) { /* 141 */ ret = IntegerPropertyEditor.make(new Property(this, index, /* 142 */ "Loop Count")); /* 143 */ } else if (mode == 1) { /* 144 */ ret = new Integer(this.loopCount); /* 145 */ } else if (mode == 2) /* 146 */ this.loopCount = ((Integer)value).intValue(); /* 147 */ break; /* */ case 2: /* 149 */ if (mode == 0) { /* 150 */ ret = BooleanPropertyEditor.make(new Property(this, index, /* 151 */ "Loop Infinite"), "False", "True"); /* 152 */ } else if (mode == 1) { /* 153 */ ret = new Boolean(this.loopInfinite); /* 154 */ } else if (mode == 2) /* 155 */ this.loopInfinite = ((Boolean)value).booleanValue(); /* 156 */ break; /* */ default: /* 158 */ ret = super.properties(index, offset + 3, mode, value); /* */ } /* 160 */ return ret; /* */ } /* */ /* */ /* 164 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 168 */ s.saveVersion(2, classCookie); /* 169 */ super.saveState(s); /* 170 */ s.saveBoolean(this.loopInfinite); /* 171 */ s.saveVector(this.actions); /* 172 */ s.saveInt(this.loopCount); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 177 */ switch (r.restoreVersion(classCookie)) { /* */ case 2: /* 179 */ super.restoreState(r); /* 180 */ this.loopInfinite = r.restoreBoolean(); /* 181 */ this.actions = r.restoreVectorActions(); /* 182 */ this.loopCount = r.restoreInt(); /* 183 */ break; /* */ case 1: /* 185 */ super.restoreState(r); /* 186 */ this.actions = r.restoreVectorActions(); /* 187 */ this.loopCount = r.restoreInt(); /* 188 */ this.loopInfinite = (this.loopCount < 0); /* 189 */ this.loopCount = Math.abs(this.loopCount); /* 190 */ break; /* */ case 0: /* 192 */ r.setOldFlag(); /* 193 */ super.restoreState(r); /* 194 */ this.actions = r.restoreVectorActions(); /* 195 */ this.loopCount = r.restoreInt(); /* 196 */ this.loopInfinite = (this.loopCount < 0); /* 197 */ this.loopCount = Math.abs(this.loopCount); /* 198 */ r.restoreBoolean(); /* 199 */ break; /* */ default: /* 201 */ throw new TooNewException(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SequenceAction.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */