/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class SequenceActionState /* */ implements Persister /* */ { /* */ int currentLoop; /* */ boolean loopInfinite; /* */ Vector actions; /* */ Persister seqID; /* */ int currentAct; /* */ /* */ SequenceActionState() {} /* */ /* */ SequenceActionState(SequenceAction sa) /* */ { /* 226 */ this.currentLoop = sa.loopCount; /* 227 */ this.loopInfinite = sa.loopInfinite; /* */ /* 229 */ this.actions = ((Vector)sa.actions.clone()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ boolean run(Event evt) /* */ { /* 238 */ if ((this.currentLoop <= 0) && (!this.loopInfinite)) { /* 239 */ return false; /* */ } /* 243 */ for (; /* */ /* 243 */ this.currentAct < this.actions.size(); this.currentAct += 1) /* */ { /* 245 */ Action act = (Action)this.actions.elementAt(this.currentAct); /* */ /* */ /* 248 */ if ((this.seqID = act.trigger(evt, this.seqID)) != null) /* 249 */ return true; /* */ } /* 251 */ this.currentAct = 0; /* */ /* 253 */ if (this.currentLoop > 0) { /* 254 */ this.currentLoop -= 1; /* */ } /* 256 */ return true; /* */ } /* */ /* */ public String toString() /* */ { /* 261 */ String stateString = "Action #" + this.currentAct + " of loop " + this.currentLoop + /* 262 */ ", status " + this.seqID; /* 263 */ if (!this.loopInfinite) /* 264 */ stateString = stateString + " NOT"; /* 265 */ stateString = stateString + " Infinite"; /* */ /* 267 */ return stateString; /* */ } /* */ /* */ /* */ /* 272 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 276 */ s.saveVersion(1, classCookie); /* 277 */ s.saveBoolean(this.loopInfinite); /* 278 */ s.saveInt(this.currentLoop); /* 279 */ s.saveInt(this.currentAct); /* 280 */ s.saveVector(this.actions); /* 281 */ s.saveMaybeNull(this.seqID); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 286 */ switch (r.restoreVersion(classCookie)) { /* */ case 1: /* 288 */ this.loopInfinite = r.restoreBoolean(); /* 289 */ this.currentLoop = r.restoreInt(); /* 290 */ this.currentAct = r.restoreInt(); /* 291 */ this.actions = r.restoreVectorActions(); /* 292 */ this.seqID = r.restoreMaybeNull(); /* 293 */ break; /* */ case 0: /* 295 */ this.currentLoop = r.restoreInt(); /* 296 */ this.loopInfinite = (this.currentLoop < 0); /* 297 */ this.currentLoop = Math.abs(this.currentLoop); /* 298 */ this.currentAct = r.restoreInt(); /* 299 */ this.actions = r.restoreVectorActions(); /* 300 */ this.seqID = r.restoreMaybeNull(); /* 301 */ break; /* */ default: /* 303 */ throw new TooNewException(); /* */ } /* */ } /* */ /* */ public void postRestore(int version) {} /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SequenceActionState.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */