c.java
来自「很好的3款手机游戏源码」· Java 代码 · 共 1,667 行 · 第 1/2 页
JAVA
1,667 行
else
dataoutputstream.writeByte(0);
if (h.cq)
dataoutputstream.writeByte(1);
else
dataoutputstream.writeByte(0);
for (int i1 = 0; i1 < bB.dn.length; i1++)
dataoutputstream.writeInt(bB.dn[i1]);
for (int j1 = 0; j1 < aw.L.length; j1++)
dataoutputstream.writeInt(aw.L[j1]);
for (int k1 = 0; k1 < aw.S.length; k1++)
dataoutputstream.writeInt(aw.S[k1]);
dataoutputstream.write(j.cW);
for (int l1 = 0; l1 < aw.ad.length; l1++)
dataoutputstream.writeInt(aw.ad[l1]);
bytearrayoutputstream.close();
dataoutputstream.close();
return bytearrayoutputstream.toByteArray();
}
private void if(byte abyte0[])
throws IOException
{
ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(abyte0);
DataInputStream datainputstream = new DataInputStream(bytearrayinputstream);
if (datainputstream.readByte() == 1)
b.R = true;
else
b.R = false;
if (datainputstream.readByte() == 1)
b.P = true;
else
b.P = false;
if (datainputstream.readByte() == 1)
b.K = true;
else
b.K = false;
bytearrayinputstream.close();
datainputstream.close();
}
private void a(byte abyte0[])
throws IOException
{
ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(abyte0);
DataInputStream datainputstream = new DataInputStream(bytearrayinputstream);
if (datainputstream.readByte() == 1)
b.R = true;
else
b.R = false;
if (datainputstream.readByte() == 1)
b.P = true;
else
b.P = false;
if (datainputstream.readByte() == 1)
b.K = true;
else
b.K = false;
bA = datainputstream.readInt();
bC = datainputstream.readInt();
bI = datainputstream.readInt();
bN = datainputstream.readInt();
k.dl = datainputstream.readInt();
k.c6 = datainputstream.readByte();
b.aa = datainputstream.readByte();
if (datainputstream.readByte() == 1)
k.da = true;
else
k.da = false;
if (datainputstream.readByte() == 1)
h.cq = true;
else
h.cq = false;
for (int i1 = 0; i1 < bB.dn.length; i1++)
bB.dn[i1] = datainputstream.readInt();
for (int j1 = 0; j1 < aw.L.length; j1++)
aw.L[j1] = datainputstream.readInt();
for (int k1 = 0; k1 < aw.S.length; k1++)
aw.S[k1] = datainputstream.readInt();
datainputstream.read(j.cW);
for (int l1 = 0; l1 < aw.ad.length; l1++)
aw.ad[l1] = datainputstream.readInt();
aM = -1;
bytearrayinputstream.close();
datainputstream.close();
}
public void f()
{
try
{
bw = RecordStore.openRecordStore("gameread", true);
byte abyte0[] = t();
if (bw.getNextRecordID() == 1)
bw.addRecord(abyte0, 0, abyte0.length);
else
bw.setRecord(1, abyte0, 0, abyte0.length);
bw.closeRecordStore();
bw = null;
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
public boolean a(int i1, boolean flag)
{
try
{
bw = RecordStore.openRecordStore("gameread", true);
int j1 = bw.getNextRecordID();
if (j1 == 1)
{
bw.closeRecordStore();
bw = null;
return false;
}
if (i1 != 0)
{
byte abyte0[] = (byte[])null;
abyte0 = bw.getRecord(1);
if (flag)
a(abyte0);
else
if(abyte0);
bw.closeRecordStore();
bw = null;
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
return true;
}
public void do(String s1)
{
bm = 20;
aX = s1;
}
private void b(Graphics g1)
{
if (bm > 0)
{
if (aX != null)
{
g1.setColor(0xa4dc58);
g1.drawString(aX, 64, 1, 17);
}
bm--;
if (bm == 0)
aX = null;
}
}
public void a(String s1, int i1, int j1)
{
bl = 0;
bK = j1;
if (s1 != null)
a(s1, i1);
bd = true;
}
public void null(Graphics g1)
{
g1.setColor(34047);
g1.fillRect(0, 160, 176, 48);
g1.setColor(0x344657);
g1.drawRect(1, 161, 174, 46);
g1.setColor(0x399dfa);
g1.drawRect(2, 162, 172, 44);
}
public void do(Graphics g1, int i1, int j1, boolean flag)
{
if (flag)
null(g1);
for(g1, i1, j1);
}
public void r()
{
aZ = a("/images/win.png");
bJ = true;
a4 = true;
}
private void else(Graphics g1)
{
g1.setColor(0);
g1.fillRect(0, 0, 176, 208);
g1.setColor(0xffffff);
for (int i1 = 0; i1 < br.size(); i1++)
g1.drawString((String)br.elementAt(i1), 88, 70 + i1 * 20, 17);
}
public void b(int i1)
{
if (br.size() - bl > bK && i1 == 1)
bl += bK;
if (bl > 0 && i1 == -1)
{
bl -= bK;
if (bl < 0)
bl = 0;
}
}
private void for(Graphics g1, int i1, int j1)
{
g1.setFont(bs);
g1.setColor(255, 255, 255);
for (int k1 = bl; k1 < (br.size() - bl < bK ? br.size() : bK + bl); k1++)
g1.drawString((String)br.elementAt(k1), 6 + i1, j1 + (a2 + 1) * (k1 - bl), 0);
}
public void a(String s1, int i1)
{
for (int j1 = 1; j1 <= s1.length(); j1++)
{
if (j1 > 1 && s1.substring(j1 - 2, j1).equals("/n"))
{
String s2 = s1.substring(0, j1 - 2);
br.addElement(s2);
s1 = s1.substring(j1);
j1 = 0;
}
if (j1 != 0 && bs.stringWidth(s1.substring(0, j1)) > i1)
{
String s3 = s1.substring(0, j1 - 1);
br.addElement(s3);
s1 = s1.substring(j1 - 1);
j1 = 0;
}
}
if (s1.length() > 0)
br.addElement(s1);
}
public void try()
{
br.removeAllElements();
a4 = false;
}
public static Image a(String s1)
{
Image image = null;
try
{
image = Image.createImage(s1);
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
}
return image;
}
public static void long(int i1)
{
System.gc();
try
{
Thread.sleep(i1);
}
catch (Exception exception) { }
}
public static int new(int i1, int j1)
{
return i1 + d((j1 - i1) + 1);
}
public static int d(int i1)
{
if (i1 <= 0)
return 0;
else
return Math.abs(bn.nextInt()) % i1;
}
public static boolean byte(int i1)
{
return d(100) < i1;
}
byte[] if(String s1)
{
byte abyte0[] = new byte[4];
ba.a("/data/map" + s1 + ".map", abyte0, 0, 2);
byte abyte1[] = new byte[abyte0[0] * 128 + abyte0[1]];
ba.a("/data/map" + s1 + ".map", abyte1, 2, abyte1.length);
return abyte1;
}
private void f(int i1)
{
f.ch[2] = null;
if (bb[i1] == 1)
{
f.ch[2] = new a(a("/images/" + i1 + ".png"), 30, 63);
f.ch[2].void(15, 55);
}
try
{
InputStream inputstream = null;
inputstream = getClass().getResourceAsStream("/data/map" + i1 + ".map");
aS = (byte)inputstream.read();
by = (byte)inputstream.read();
f.ci = null;
f.b8 = null;
f.ca = null;
f.bW = null;
f.ci = new byte[aS][by];
f.b8 = new byte[aS][by];
f.ca = new byte[aS][by];
f.bW = new byte[aS][by];
for (int j1 = 0; j1 < aS; j1++)
{
int k1 = by;
for (int l1 = 0; l1 < by; l1++)
{
k1--;
f.ci[j1][k1] = (byte)inputstream.read();
f.ca[j1][k1] = (byte)inputstream.read();
f.b8[j1][k1] = (byte)inputstream.read();
f.bW[j1][k1] = 0;
}
}
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
}
char(i1);
}
private void char(int i1)
{
if (bo != null)
bo = null;
bo = new byte[39];
byte abyte0[] = bR[i1];
bp = bR[i1].length / 3;
for (int j1 = 0; j1 < bp; j1++)
f.bW[abyte0[j1 * 3 + 1]][abyte0[j1 * 3 + 2]] = abyte0[j1 * 3];
for (int k1 = 0; k1 < bp; k1++)
{
for (int l1 = 0; l1 < 3; l1++)
bo[(abyte0[k1 * 3] - 1) * 3 + l1] = abyte0[k1 * 3 + l1];
}
bp = 13;
if (aM > 0)
{
bA = bo[(aM - 1) * 3 + 1];
bC = bo[(aM - 1) * 3 + 2];
}
bF = bu.try[i1];
bj = bF.length;
}
private void char(Graphics g1)
{
if (a5 > 0 && a5 < 5)
aW.G(a5 - 1);
aW.q(g1);
aK.d(g1);
}
private void case(int i1)
{
a5 = i1;
switch (i1)
{
case 1: // '\001'
a(2, -1, 0, -1);
break;
case 2: // '\002'
a(-2, 1, 0, 1);
break;
case 3: // '\003'
a(-2, -1, -1, 0);
break;
case 4: // '\004'
a(2, 1, 1, 0);
break;
}
}
private void a(int i1, int j1, int k1, int l1)
{
aK.byte(-i1, -j1);
if (aK.b9 == 4 || aK.b9 == -4)
{
bA += k1;
bC += l1;
aK.w();
aK.char(k1, l1);
}
}
void long()
{
aF = new g();
}
void d()
{
if (!aF.a())
{
aF.a("/sounds/00.mid");
aF.a(-1);
if (h.cq)
aF.for();
}
}
void char()
{
aF.for();
}
void g()
{
aF.if();
}
void b()
{
if (!h.cq)
return;
if (aF != null)
aF.do();
}
public void int(int i1, int j1)
{
a7 = true;
while (j1 < bC)
{
for (int k1 = 8; k1 > 0; k1--)
{
case(1);
c(30);
}
}
while (j1 > bC)
{
for (int l1 = 8; l1 > 0; l1--)
{
case(2);
c(30);
}
}
while (i1 < bA)
{
for (int i2 = 8; i2 > 0; i2--)
{
case(3);
c(30);
}
}
while (i1 > bA)
{
for (int j2 = 8; j2 > 0; j2--)
{
case(4);
c(30);
}
}
bh = 0;
a7 = false;
}
private void l()
{
if ((bh == 8) | (bh == 0))
{
if (f.h(bA * by + bC) > 0 && ba.if(bI + 1, f.h(bA * by + bC), 3))
return;
if (aA != 0)
{
bz = aA;
goto(bz);
if (aV <= 0 || aD != 0 || bz != a5)
{
a7 = false;
} else
{
a7 = true;
bh = 8;
if (!ao)
ao = true;
}
a5 = bz;
}
}
if (a7)
{
case(bz);
aE--;
bh--;
if (aE == 0 && bj > 0)
bB.a(bF, true, (byte)0);
if (aE < 0)
aE = new(100, 200) / 4;
}
if (bh == 0)
{
aW.E(0);
bz = 0;
a7 = false;
}
}
private int g(int i1)
{
if (i1 == 3)
return -1;
else
return i1 == 4 ? 1 : 0;
}
private int e(int i1)
{
if (i1 == 1)
return -1;
else
return i1 == 2 ? 1 : 0;
}
private void goto(int i1)
{
as = bA + g(i1);
ar = bC + e(i1);
if (as >= 0 && as < aS && ar >= 0 && ar < by)
{
aV = f.j(as * by + ar);
aD = f.l(as * by + ar);
aO = f.h(as * by + ar);
if (aO > 0 && aD != 0 && !aL)
ba.if(bI + 1, aO, 1);
} else
{
v();
if (f.h(bA * by + bC) > 0)
{
if (!aL)
ba.if(bI + 1, f.h(bA * by + bC), 2);
return;
}
}
}
private void else()
{
goto(a5);
if (bh == 0 && aD > 0 && aO > 0 && !aL)
ba.if(bI + 1, aO, 1);
}
public void v()
{
bh = 0;
a7 = false;
aV = 0;
aD = 0;
aO = 0;
aA = 0;
}
private boolean else(int i1)
{
switch (i1)
{
case 1: // '\001'
aA = 1;
return false;
case 6: // '\006'
aA = 2;
return false;
case 2: // '\002'
aA = 3;
return false;
case 5: // '\005'
aA = 4;
return false;
case 8: // '\b'
if (!aL && !aG)
else();
return true;
case -6:
if (!a7 && !aL)
{
h.cB = 9;
if (bQ)
h.cw = 5;
else
h.cw = 0;
try();
if (h.cr == null)
h.cr = a("/images/menu.png");
aB = 1;
}
return true;
case -7:
if (aB != 1 && !aL)
{
h.cB = 6;
aB = 1;
bm = 0;
}
return true;
}
if (i1 == 0)
{
aA = 0;
return false;
} else
{
return false;
}
}
public boolean null(int i1)
{
switch (aB)
{
case 0: // '\0'
if (a6)
{
if (i1 == 6 || i1 == 5 || i1 == 8)
new();
return true;
}
if (a4)
{
if (i1 == 8 && bJ && bS > 20)
n();
return true;
} else
{
return else(i1);
}
case 1: // '\001'
return aH.p(i1);
case 2: // '\002'
return aw.int(i1);
case 3: // '\003'
return bB.C(i1);
case 4: // '\004'
return aw.new(i1);
}
return false;
}
public void byte()
{
bT = null;
bT = new a(a("/images/Bird.png"), 29, 32);
bi = true;
}
private void goto(Graphics g1)
{
if (aP + 30 > 0 && aN + 30 > 0)
{
if (aP < 100 && aP > 40)
{
al++;
bT.try(g1, am, al, 4);
aP--;
aJ = true;
}
if (aJ)
aN -= 2;
else
aN += 2;
aP -= 5;
bT.try(g1, aP, aN, at);
} else
{
c();
}
}
private void c()
{
bi = false;
bT = null;
aP = 160;
aN = 0;
am = 95;
al = 30;
aJ = false;
}
public void h()
{
aY = null;
aY = new a(a("/images/effect.png"), 50, 47);
aR = true;
an = 0;
}
private void goto()
{
aY = null;
aR = false;
an = 0;
}
public void q()
{
a9 = true;
bf = 0;
bx = "还有事情没有完成!";
}
private void byte(Graphics g1)
{
g1.setFont(d.B);
aH.a(g1, bx, 88, 140, 255, 255, 255);
}
public void void(Graphics g1)
{
}
public void if(byte byte0)
{
bV = aB;
aB = byte0;
switch (aB)
{
case 0: // '\0'
default:
break;
case 1: // '\001'
if (bV == 3)
{
getClass();
aH.cG = a("/images/gameover.png");
h.cB = 8;
aL = false;
return;
}
break;
case 2: // '\002'
aw.V = 0;
aw.U = 0;
aw.if();
break;
case 3: // '\003'
return;
case 4: // '\004'
if (b.ah)
b.Q = bu.do[ax];
break;
case 5: // '\005'
if (bO)
return;
if (bV == 0)
{
bh = 0;
v();
break;
}
if (bV != 1)
break;
if (h.cz)
{
j();
a(1, true);
bB.H();
bv = true;
bL = false;
} else
{
j();
bv = true;
aw.if(20, 2);
a5 = 1;
}
break;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?