/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.core.Std; /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class WaitAction /* */ extends Action /* */ { /* 30 */ float duration = 1.0F; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public WaitAction() {} /* */ /* */ /* */ /* */ /* */ /* */ /* */ public WaitAction(float duration) /* */ { /* 47 */ this.duration = duration; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public Persister trigger(Event evt, Persister seqID) /* */ { /* 56 */ long evttime = 0L; /* 57 */ if (evt == null) { /* 58 */ evttime = Std.getFastTime(); /* */ } else /* 60 */ evttime = evt.time; /* 61 */ if (seqID == null) { /* 62 */ seqID = new WaitActionState(evttime + (1000.0F * this.duration)); /* */ } /* 64 */ if (!((WaitActionState)seqID).run(evttime)) { /* 65 */ seqID = null; /* */ } /* 67 */ return seqID; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 77 */ Object ret = null; /* 78 */ switch (index - offset) { /* */ case 0: /* 80 */ if (mode == 0) { /* 81 */ ret = FloatPropertyEditor.make(new Property(this, index, /* 82 */ "Duration (s)")); /* 83 */ } else if (mode == 1) { /* 84 */ ret = new Float(this.duration); /* 85 */ } else if (mode == 2) /* 86 */ this.duration = ((Float)value).floatValue(); /* 87 */ break; /* */ default: /* 89 */ ret = super.properties(index, offset + 1, mode, value); /* */ } /* 91 */ return ret; /* */ } /* */ /* */ /* */ /* */ /* */ /* 98 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 102 */ s.saveVersion(2, classCookie); /* 103 */ super.saveState(s); /* 104 */ s.saveFloat(this.duration); /* */ } /* */ /* */ public void restoreState(Restorer r) /* */ throws IOException, TooNewException /* */ { /* 110 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 112 */ r.setOldFlag(); /* 113 */ super.restoreState(r); /* 114 */ this.duration = r.restoreInt(); /* 115 */ break; /* */ case 1: /* 117 */ r.setOldFlag(); /* 118 */ super.restoreState(r); /* 119 */ this.duration = r.restoreFloat(); /* 120 */ r.restoreLong(); /* 121 */ break; /* */ case 2: /* 123 */ super.restoreState(r); /* 124 */ this.duration = r.restoreFloat(); /* 125 */ break; /* */ default: /* 127 */ throw new TooNewException(); /* */ } /* */ /* */ } /* */ /* */ /* */ /* */ /* */ public String toString() /* */ { /* 137 */ return super.toString() + "[" + this.duration + " s]"; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WaitAction.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */