/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ import java.util.Enumeration; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class AdvancingAction /* */ extends Action /* */ { /* 29 */ private Vector 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 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 */