summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/VideoControlAction.java
blob: c1b14a553633f6a1a4eec7fd655bba3d5f273606 (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
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class VideoControlAction
/*     */   extends Action
/*     */ {
/*     */   VideoControlAction()
/*     */   {
/*  19 */     this.mode = 1;
/*  20 */     this.repeat = 1;
/*  21 */     this.videoTexture = null;
/*  22 */     this.videoWall = null;
/*     */   }
/*     */   
/*     */ 
/*  26 */   private final int play = 1;
/*  27 */   private final int stop = 2;
/*     */   private int mode;
/*     */   private int repeat;
/*     */   private VideoTexture videoTexture;
/*     */   private VideoWall videoWall;
/*     */   
/*  33 */   public Persister trigger(Event e, Persister seqID) { if (!getVideoTexture())
/*     */     {
/*  35 */       System.out.println("ERROR! Tried to attach VideoControlAction to something other than a Rect with a VideoTexture. or a VideoWall object.");
/*     */       
/*     */ 
/*  38 */       return null;
/*     */     }
/*     */     
/*  41 */     switch (this.mode)
/*     */     {
/*     */     case 1: 
/*  44 */       if (this.videoTexture == null) {
/*  45 */         this.videoWall.getVideoSurface().play(this.repeat);
/*     */       } else
/*  47 */         this.videoTexture.getDirectShow().nPlay(this.repeat);
/*  48 */       break;
/*     */     
/*     */     case 2: 
/*  51 */       if (this.videoTexture == null) {
/*  52 */         this.videoWall.getVideoSurface().stop();
/*     */       } else {
/*  54 */         this.videoTexture.getDirectShow().nStop();
/*     */       }
/*     */       break;
/*     */     }
/*  58 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   private boolean getVideoTexture()
/*     */   {
/*  65 */     if (this.videoTexture != null) {
/*  66 */       return true;
/*     */     }
/*     */     
/*     */ 
/*  70 */     Object owner = getOwner();
/*  71 */     if ((owner == null) || (!(owner instanceof Rect))) {
/*  72 */       return false;
/*     */     }
/*  74 */     Rect r = (Rect)owner;
/*  75 */     this.videoTexture = r.getVideoAttribute();
/*     */     
/*  77 */     if (this.videoTexture == null)
/*     */     {
/*  79 */       if ((owner instanceof VideoWall))
/*     */       {
/*  81 */         this.videoWall = ((VideoWall)owner);
/*  82 */         return true;
/*     */       }
/*     */       
/*  85 */       return false;
/*     */     }
/*     */     
/*  88 */     return true;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*  94 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/*  98 */     s.saveVersion(1, classCookie);
/*  99 */     super.saveState(s);
/* 100 */     s.saveInt(this.mode);
/* 101 */     s.saveInt(this.repeat);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException
/*     */   {
/* 106 */     switch (r.restoreVersion(classCookie))
/*     */     {
/*     */     case 0: 
/* 109 */       super.restoreState(r);
/* 110 */       this.mode = r.restoreInt();
/* 111 */       break;
/*     */     case 1: 
/* 113 */       super.restoreState(r);
/* 114 */       this.mode = r.restoreInt();
/* 115 */       this.repeat = r.restoreInt();
/*     */     }
/*     */     
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public Object properties(int index, int offset, int pmode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/* 126 */     Object ret = null;
/* 127 */     switch (index - offset) {
/*     */     case 0: 
/* 129 */       if (pmode == 0) {
/* 130 */         ret = IntegerPropertyEditor.make(
/* 131 */           new Property(this, index, "1=Play, 2=Stop"));
/* 132 */       } else if (pmode == 1) {
/* 133 */         ret = new Integer(this.mode);
/* 134 */       } else if (pmode == 2)
/* 135 */         this.mode = ((Integer)value).intValue();
/* 136 */       break;
/*     */     
/*     */     case 1: 
/* 139 */       if (pmode == 0) {
/* 140 */         ret = IntegerPropertyEditor.make(
/* 141 */           new Property(this, index, "Repeat count (-1 for infinite)"));
/* 142 */       } else if (pmode == 1) {
/* 143 */         ret = new Integer(this.repeat);
/* 144 */       } else if (pmode == 2)
/* 145 */         this.repeat = ((Integer)value).intValue();
/* 146 */       break;
/*     */     default: 
/* 148 */       ret = super.properties(index, offset + 2, pmode, value);
/*     */     }
/* 150 */     return ret;
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\VideoControlAction.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */