?? tvevent.java
字號:
/*
* TVEvent.java
*
* Created on 2006年5月5日, 上午11:51
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package DogPet;
import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.lcdui.*;
// Referenced classes of package com.webineti:
// GameData, GameView
public class TVEvent
{
class Task16 extends TimerTask
{
public final void run()
{
if(GameView.events == 5)
{
swapped = swapped + 1;
if(swapped > TV.length - 1)
{
swapped = 0;
repeat++;
if(repeat > 3)
{
GameView.events = -1;
repeat = 0;
}
}
view.repaint();
}
}
Task16()
{
}
}
public void add_data()
{
GameData.Intelligence += 5;
if(GameData.Intelligence > 100)
GameData.Intelligence = 100;
GameData.Capacity--;
if(GameData.Capacity < 0)
GameData.Capacity = 0;
}
public TVEvent(GameView view)
{
swapped = 0;
start_x = 0;
start_y = 0;
repeat = 0;
image_bg = null;
timer = new Timer();
flashDuration = 1000;
TV = new Image[2];
this.view = view;
try
{
TV[0] = Image.createImage("/dog_tv/dog_TV1.png");
TV[1] = Image.createImage("/dog_tv/dog_TV2.png");
}
catch(Exception ex) { }
timer.scheduleAtFixedRate(new Task16(), 0L, flashDuration);
}
public void paint(Graphics g)
{
this.g = g;
if(TV[swapped] != null)
{
view.g_cls(g, 0);
g.drawImage(TV[0], GameData.start_x + 17, GameData.start_y + 69, 20);
switch(swapped)
{
case 1: // '\001'
g.drawImage(TV[swapped], GameData.start_x + 17 + 28, GameData.start_y + 69 + 16, 20);
break;
}
}
}
public void killed()
{
timer.cancel();
timer = null;
}
GameView view;
private Graphics g;
int swapped;
private int start_x;
private int start_y;
int repeat;
private Image image_bg;
private Timer timer;
private int flashDuration;
Image TV[];
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -