summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/WaitAction.java
blob: 8bdf98122b4aa2bf3df1677355c23d204ed7482b (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
/*     */ 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
 */