summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/SequenceAction.java
blob: 6eb257ca523ab507060e253ed96fcb4ec064906e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*     */ 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<Action> 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<Action> 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
 */