📄 gamecanvas.java
字号:
oI = Image.createImage("/optionW.png");
if(eI == null)
eI = Image.createImage("/exitW.png");
if(rI == null)
rI = Image.createImage("/retryW.png");
if(tI == null)
tI = Image.createImage("/titleW.png");
}
catch(Exception exception) { }
sFont = Font.getDefaultFont();
}
public void init(int i, boolean flag)
{
iS = 0;
pS = 0;
lV = 0;
dV = 0;
eC = 0;
sC = 0;
bR = 0;
dR = 0xbbb61;
mV = 21;
kF = false;
dF = false;
mS = 0;
eB = 0;
dB = 0;
bobP = 0;
bAnim = 0;
upA = false;
upB = false;
mH = i;
sE = flag;
aWidth = awaI[0].getWidth();
if(pA == null)
pA = new Bobble();
GameCanvas _tmp = this;
Bobble.init();
GameCanvas _tmp1 = this;
Bobble.sAID();
drawBobbles(ofSg2, 0);
gF = true;
Thread thread = new Thread(this);
thread.start();
}
private void drawBobbles(Graphics g, int i)
{
int i2 = 0;
int j = sC;
int l = bR & 0xff;
if(j >= ((dR >> dV * 2 & 0x3) + 3) - 2)
{
if(j == ((dR >> dV * 2 & 0x3) + 3) - 2)
{
if((l & 0x3) == 3)
i2 = 1;
} else
if((l & 0x1) == 1)
i2 = 1;
if(l >= 240)
bR = 0;
else
bR++;
}
g.drawImage(ofSc3, 0, 0, 0x10 | 0x4);
upB = false;
for(int k1 = 9; k1 >= 0; k1--)
{
int i1 = 0;
GameCanvas _tmp = this;
if(Bobble.aA[5 + 6 * k1] == -1)
i1 = aWidth / 2;
for(int j1 = 0; j1 < 6; j1++)
{
int l1 = j1 + 6 * k1;
GameCanvas _tmp1 = this;
int k = Bobble.aA[l1];
if(k > 0)
if((k & 0x10) == 16)
{
if(pS == 4)
{
k &= 0xf;
g.drawImage(bomI[k - 1], (j1 * aWidth + i1) - aWidth / 4, k1 * aWidth - aWidth / 4, 20);
} else
{
k &= 0xf;
g.drawImage(awaI[k - 1], j1 * aWidth + i1, k1 * aWidth + aWidth / 2, 20);
}
GameCanvas _tmp2 = this;
Bobble.cBA(l1);
} else
{
k &= 0xf;
if(pS == -1)
{
if(k1 >= i)
g.drawImage(awaI[7], j1 * aWidth + i1, k1 * aWidth, 20);
else
g.drawImage(awaI[k - 1], j1 * aWidth + i1, k1 * aWidth, 20);
} else
{
g.drawImage(awaI[k - 1], j1 * aWidth + i1, k1 * aWidth + i2, 20);
if(k1 > 5)
upB = true;
}
}
}
}
drawMoveBobble(g);
}
private void drawScore(Graphics g)
{
int i = lV + 1;
int j = mS;
if(j > 0x1869f)
j = 0x1869f;
if(mS > mH)
{
mH = mS;
setGConf(mH, sE);
saveData();
}
int k = mH;
if(k > 0x1869f)
k = 0x1869f;
try
{
char ac[] = Integer.toString(i).toCharArray();
int l = ac.length;
for(int i1 = 0; i1 < l; i1++)
g.drawImage(numI[Character.digit(ac[i1], 10)], 132 + (5 - (l - i1)) * 8, 36, 0x10 | 0x4);
ac = Integer.toString(j).toCharArray();
l = ac.length;
for(int j1 = 0; j1 < l; j1++)
g.drawImage(numI[Character.digit(ac[j1], 10)], 132 + (5 - (l - j1)) * 8, 84, 0x10 | 0x4);
ac = Integer.toString(k).toCharArray();
l = ac.length;
for(int k1 = 0; k1 < l; k1++)
g.drawImage(numI[Character.digit(ac[k1], 10)], 132 + (5 - (l - k1)) * 8, 132, 0x10 | 0x4);
}
catch(Exception exception) { }
}
private void drawGameOver(Graphics g)
{
g.setFont(sFont);
int i = sFont.getHeight();
g.setColor(0xffffff);
g.drawString("G A M E", (96 - sFont.stringWidth("G A M E")) / 2 + 4, 32, 0x10 | 0x4);
g.drawString("O V E R", (96 - sFont.stringWidth("O V E R")) / 2 + 4, 34 + i, 0x10 | 0x4);
}
public void drawMoveBobble(Graphics g)
{
GameCanvas _tmp = this;
int k = Bobble.aN - 1;
g.drawImage(awaI[k], ofSc2.getWidth() - aWidth, ofSc2.getHeight() - aWidth, 0x10 | 0x4);
if(pS >= 0)
{
g.drawImage(plyI[bobP], 0, ofSc2.getHeight() - plyI[bobP].getHeight(), 20);
if(bobP > 0)
bobP = 0;
} else
{
g.drawImage(plyI[4], 0, ofSc2.getHeight() - plyI[bobP].getHeight(), 20);
}
if(upA)
{
mV = 21;
upA = false;
}
GameCanvas _tmp1 = this;
int i = 56 + (Bobble.CO[mV] * 24) / 1000 + -8;
GameCanvas _tmp2 = this;
int j = 160 + (Bobble.SI[mV] * 24) / 1000 + -8;
GameCanvas _tmp3 = this;
k = 56 + (Bobble.CO[(21 - mV) + 21] * 16) / 1000 + -8;
GameCanvas _tmp4 = this;
int i1 = 160 + (Bobble.SI[(21 - mV) + 21] * -16) / 1000 + -8;
g.setColor(255, 255, 0);
g.drawLine(i, j, k, i1);
g.drawLine(i, j, ARW1[mV][0] + -8, ARW1[mV][1] + -8);
g.drawLine(i, j, ARW2[mV][0] + -8, ARW2[mV][1] + -8);
if(gF && pS < 3)
{
GameCanvas _tmp5 = this;
int l = Bobble.aM - 1;
GameCanvas _tmp6 = this;
GameCanvas _tmp7 = this;
g.drawImage(awaI[l], Bobble.aX - aWidth / 2, Bobble.aY - aWidth / 2, 0x10 | 0x4);
} else
if(pS == 0)
{
GameCanvas _tmp8 = this;
GameCanvas _tmp9 = this;
GameCanvas _tmp10 = this;
g.drawImage(awaI[Bobble.aM - 1], Bobble.aX - aWidth / 2, Bobble.aY - aWidth / 2, 0x10 | 0x4);
}
}
public void paint(Graphics g)
{
g.setFont(sFont);
if(tgS == -1)
{
g.setColor(0);
g.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(nI, (getWidth() - nI.getWidth()) / 2, (getHeight() - nI.getHeight()) / 2, 0x10 | 0x4);
} else
if(tgS == 0)
{
int i = sFont.getHeight();
g.setColor(0);
g.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(pI, (getWidth() - pI.getWidth()) / 2, 0, 0x10 | 0x4);
g.drawImage(sI, (getWidth() - sI.getWidth()) / 2, getHeight() - eI.getHeight(), 0x20 | 0x4);
g.drawImage(eI, getWidth() - eI.getWidth(), getHeight() - eI.getHeight(), 0x10 | 0x4);
g.drawImage(oI, 0, getHeight() - oI.getHeight(), 0x10 | 0x4);
int k = (getHeight() - eI.getHeight() - sI.getHeight() - pI.getHeight()) / 2 + pI.getHeight();
g.setColor(0xffffff);
g.drawString("PRESS JOYSTICK", (getWidth() - sFont.stringWidth("PRESS JOYSTICK")) / 2, k - 2, 0x20 | 0x4);
g.drawString("TO START", (getWidth() - sFont.stringWidth("TO START")) / 2, k + 2, 0x10 | 0x4);
} else
if(tgS == 2)
{
int j = sFont.getHeight();
g.setColor(0);
g.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(bI, getWidth() - bI.getWidth(), getHeight() - bI.getHeight(), 0x10 | 0x4);
if(indeX < 2)
{
g.setColor(0xff0000);
if(indeX == 0)
g.fillRect((getWidth() - sFont.stringWidth(" Audio off")) / 2, sFont.getHeight() * 4 - 1, sFont.stringWidth(" Audio off"), sFont.getHeight());
else
if(indeX == 1)
g.fillRect((getWidth() - sFont.stringWidth(" Show Help")) / 2, sFont.getHeight() * 6 - 1, sFont.stringWidth(" Show Help"), sFont.getHeight());
g.setColor(0xffffff);
g.drawString("== Select ==", (getWidth() - sFont.stringWidth("== Select ==")) / 2, sFont.getHeight() * 2, 0x10 | 0x4);
if(!sE)
g.drawString("Audio on ", (getWidth() - sFont.stringWidth("Audio on ")) / 2, sFont.getHeight() * 4, 0x10 | 0x4);
else
g.drawString("Audio off", (getWidth() - sFont.stringWidth("Audio off")) / 2, sFont.getHeight() * 4, 0x10 | 0x4);
g.drawString("Show Help", (getWidth() - sFont.stringWidth("Show Help")) / 2, sFont.getHeight() * 6, 0x10 | 0x4);
}
} else
{
if(pS == 0 || resumeFlag)
{
g.setColor(0);
g.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(ofSc1, 0, 0, 0x10 | 0x4);
if(pS == 0)
pS = 1;
resumeFlag = false;
}
g.drawImage(tI, getWidth() - tI.getWidth(), getHeight() - tI.getHeight(), 0x10 | 0x4);
if(pS < 0)
g.drawImage(rI, 0, getHeight() - rI.getHeight(), 0x10 | 0x4);
else
g.drawImage(oI, 0, getHeight() - oI.getHeight(), 0x10 | 0x4);
g.drawImage(ofSc2, 16, 16, 0x10 | 0x4);
drawScore(g);
}
}
public void run()
{
boolean flag = false;
byte byte0 = 0;
if(tgS == -1)
{
try
{
Thread.sleep(3000L);
}
catch(Exception exception) { }
pbInit();
initTitle();
repaint();
}
while(gF)
{
while(pauseFlag)
try
{
Thread.sleep(100L);
}
catch(Exception exception1) { }
try
{
if(pS == 4)
Thread.sleep(100L);
else
if(pS == 5)
Thread.sleep(200L);
else
Thread.sleep(10L);
}
catch(Exception exception2) { }
if(pS == 2)
{
for(int i = 0; i < 8; i++)
{
GameCanvas _tmp = this;
int k;
if((k = Bobble.move()) >= 2)
continue;
if(k == 0)
pS = 3;
break;
}
} else
if(pS == 3)
{
GameCanvas _tmp1 = this;
int l = Bobble.bom();
if(l > 0)
{
eB += l;
eC += l;
mS += l * 10;
pS = 4;
if(sD[1] != null && !sE)
{
if(sD[1].getState() == 0)
sD[1].stop();
sD[1].play(1);
}
} else
{
pS = 5;
}
} else
if(pS == 4)
{
GameCanvas _tmp2 = this;
int i1 = Bobble.drp();
if(i1 > 0)
{
dB += i1;
eC += i1;
if(i1 > 12)
i1 = 12;
mS += 20 << i1 - 1;
}
pS = 5;
} else
if(pS == 5)
{
if(sC >= (dR >> dV * 2 & 0x3) + 3)
{
sC = 0;
GameCanvas _tmp3 = this;
Bobble.dtR(dV);
}
GameCanvas _tmp4 = this;
if(Bobble.nA == 0)
mS += 5000 * (lV + 1);
if(eC >= 47 && sC == 0)
{
lV++;
dV++;
if(dV > 9)
{
dV = lV - (lV / 10) * 10;
if(lV % 10 != 0);
}
eC -= 47;
}
pS = 6;
} else
if(pS == 6)
{
for(int j = 59; j >= 54; j--)
{
GameCanvas _tmp5 = this;
if(Bobble.aA[j] > 0)
gF = false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -