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
|
/* */ package NET.worlds.console;
/* */
/* */ import NET.worlds.scape.FrameEvent;
/* */ import java.awt.Container;
/* */ import java.awt.Dimension;
/* */ import java.awt.Event;
/* */ import java.awt.Graphics;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class AnimationButton
/* */ extends ImageCanvas
/* */ implements MainCallback, FramePart, DialogDisabled
/* */ {
/* */ private static final long serialVersionUID = 5605353426438467905L;
/* */ private static final int frameInterval = 33;
/* */ private String movieName;
/* */ private int frameCount;
/* */ private int curFrame;
/* */ private int width;
/* */ private int height;
/* */ private boolean playVideoNext;
/* 29 */ private int videoHandle = -1;
/* */ private boolean isDialogDisabled;
/* */
/* */ public AnimationButton(String imageName, int frameCount, String movieName) {
/* 33 */ super(imageName);
/* 34 */ this.frameCount = frameCount;
/* 35 */ this.movieName = movieName;
/* */ }
/* */
/* */ public void paint(Graphics g)
/* */ {
/* 40 */ g.clipRect(0, 0, this.width, this.height);
/* 41 */ g.drawImage(this.image_, -this.width * this.curFrame, 0, null);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Dimension getPreferredSize()
/* */ {
/* 60 */ Dimension d = super.getPreferredSize();
/* 61 */ return new Dimension(this.width = d.width / this.frameCount, this.height = d.height);
/* */ }
/* */
/* */ public Dimension getMinimumSize()
/* */ {
/* 66 */ return getPreferredSize();
/* */ }
/* */
/* */ public void mainCallback() {
/* 70 */ if (this.videoHandle == -1) {
/* 71 */ this.videoHandle = Window.playVideoClip(this, this.movieName);
/* 72 */ if (this.videoHandle == -1) {
/* 73 */ this.videoHandle = Window.playVideoClip(this, "..\\" + this.movieName);
/* 74 */ if (this.videoHandle == -1)
/* 75 */ Main.unregister(this);
/* */ }
/* 77 */ } else if (!Window.isVideoPlaying(this.videoHandle)) {
/* 78 */ Main.unregister(this);
/* 79 */ this.videoHandle = -1;
/* 80 */ repaint();
/* */ }
/* */ }
/* */
/* */ public boolean mouseDown(Event e, int x, int y)
/* */ {
/* 86 */ if (this.isDialogDisabled) {
/* 87 */ return false;
/* */ }
/* 89 */ if (this.playVideoNext) {
/* 90 */ Main.register(this);
/* 91 */ this.playVideoNext = false;
/* 92 */ } else if (this.videoHandle == -1) {
/* 93 */ Graphics g = getGraphics();
/* 94 */ g.clipRect(0, 0, this.width, this.height);
/* 95 */ int nextFrameIncr = this.curFrame == 0 ? 1 : -1;
/* 96 */ long startTime = System.currentTimeMillis();
/* 97 */ long frameTime = 0L;
/* 98 */ for (int i = 1; i < this.frameCount; i++) {
/* 99 */ this.curFrame += nextFrameIncr;
/* 100 */ g.drawImage(this.image_, -this.width * this.curFrame, 0, null);
/* 101 */ long elapsedTime = System.currentTimeMillis() - startTime;
/* 102 */ frameTime += 33L;
/* 103 */ long sleepTime = frameTime - elapsedTime;
/* 104 */ if (sleepTime > 0L) {
/* */ try {
/* 106 */ Thread.sleep(sleepTime);
/* */ }
/* */ catch (InterruptedException localInterruptedException) {}
/* */ }
/* */ }
/* 111 */ if (this.curFrame == this.frameCount - 1)
/* 112 */ this.playVideoNext = true;
/* 113 */ g.dispose();
/* */ }
/* 115 */ return true;
/* */ }
/* */
/* */
/* */
/* */ public void activate(Console c, Container f, Console prev) {}
/* */
/* */
/* */ public void deactivate() {}
/* */
/* */
/* */ public boolean action(Event event, Object what)
/* */ {
/* 128 */ return false;
/* */ }
/* */
/* */ public boolean handle(FrameEvent f) {
/* 132 */ return false;
/* */ }
/* */
/* */
/* */ public void dialogDisable(boolean disable)
/* */ {
/* 138 */ this.isDialogDisabled = disable;
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\AnimationButton.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|