/* */ 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 */