⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gametask.java

📁 j2me游戏Global星球文明,是国外的游戏,45度视角.
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 


public class GameTask extends Thread
{

    public int cnt;
    public int daycnt;
    public Global gw;
    public long logotime;
    public long oldtime;
    public int period;
    public static final int periodsInDay = 100;
    public int phase;
    public int processtime;
    public int splashcnt;
    public long time;

    public GameTask(Global global)
    {
        period = 100;
        gw = global;
        cnt = 0;
        daycnt = 0;
        start();
    }

    public GameTask()
    {
        period = 100;
    }

    public void run()
    {
        try {
			while(isAlive()) 
			{
			    time = System.currentTimeMillis();
			    gw.gs.keymove();
			    if(gw.gs.mode == 1)
			    {
			        cnt = cnt + 1 & 0x7;
			        phase = cnt >> 2 & 0x1;
			        daycnt++;
			        if(daycnt >= 100)
			        {
			            gw.gm.dayFinished();
			            gw.gs.days++;
			            daycnt = 0;
			        }
			        if(gw.gs.uragan)
			            gw.gs.moveUragan();
			        if(gw.gs.earthQuake)
			        {
			            gw.gs.earthQuakePeriod--;
			            if(gw.gs.earthQuakePeriod > 0)
			                gw.gs.drawEarthQuake();
			            else
			                gw.gs.endEarthQuake();
			        }
			        if(!gw.gm.gameover)
			        {
			            gw.gm.triggerPeople();
			            if(gw.gs.gamemode == 1)
			                gw.gs.draw();
			            else
			            if(gw.gs.gamemode == 2)
			                gw.gs.drawBuild();
			            else
			            if(gw.gs.gamemode == 4)
			                gw.gs.drawMap();
			            else
			            if(gw.gs.gamemode == 3)
			                gw.gs.drawStock();
			            else
			            if(gw.gs.gamemode == 5)
			                gw.gs.drawBuilds();
			            gw.gs.repaint();
			            gw.gs.serviceRepaints();
			        }
			    } else
			    if(gw.gs.mode == 3)
			    {
			        gw.gs.xTicker -= gw.gs.dticker;
			        splashcnt++;
			        if(splashcnt >= 5)
			        {
			            splashcnt = 0;
			            gw.gs.splashPhase++;
			            if(gw.gs.splashPhase > 5)
			                gw.gs.splashPhase = 0;
			        }
			        gw.gs.drawSplash();
			        if(gw.gs.xTicker < gw.gs.endTicker)
			            if(!gw.gm.gameover)
			                gw.gs.startMainScreen();
			            else
			                gw.gs.beginPlayerName();
			    } else
			    if(gw.gs.mode == 4)
			    {
			        cnt = cnt + 1 & 0x7;
			        gw.gs.drawMenu();
			    } else
			    if(gw.gs.mode == 5)
			        gw.gs.drawHelp();
			    else
			    if(gw.gs.mode == 7)
			    {
			        if(gw.gs.logoy > 0)
			        {
			            gw.gs.logoy -= 3;
			            gw.gs.drawlogo();
			            logotime = time;
			        } else
			        if(time - logotime >= 2000L)
			        {
			            logotime = time;
			            gw.gs.drawCover();
			        }
			    } else
			    if(gw.gs.mode == 10)
			    {
			        if(time - logotime >= 1500L)
			            gw.gs.startLogo();
			    } else
			    if(gw.gs.mode == 2)
			    {
			        if(time - logotime >= 5000L)
			            gw.gs.setMenu();
			    } else
			    if(gw.gs.mode == 9)
			    {
			        cnt = cnt + 1 & 0x7;
			        if(gw.gs.keywaitcnt >= 0)
			        {
			            gw.gs.keywaitcnt++;
			            if(gw.gs.keywaitcnt >= 10)
			            {
			                gw.gs.keywaitcnt = -1;
			                gw.gs.keyi = 0;
			                gw.gs.lastkey = -1;
			                if(gw.gs.cursorpos < gw.gs.playerName.length() && gw.gs.cursorpos < 8)
			                    gw.gs.cursorpos++;
			            }
			        }
			        gw.gs.drawPlayerName();
			    }
			    processtime = (int)(System.currentTimeMillis() - time);
			    int i = period - processtime;
			    if(i < 10)
			        i = 10;
			    try
			    {
			        Thread.sleep(i);
			    }
			    catch(Exception exception) { }
			    oldtime = time;
			}
		} catch (RuntimeException e) {
			// TODO 自动生成 catch 块
			e.printStackTrace();
		}
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -