j2me_majiang.rar

  • PUDN用户
    了解作者
  • Java
    开发工具
  • 38KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 19
    下载次数
  • 2006-07-14 04:49
    上传日期
本人收集的一些j2me资料!! 有兴趣的可以
j2me_majiang.rar
  • src
  • NBMaJiang
  • images
  • wel.png
    2.1KB
  • pai1.png
    222B
  • arrowBack.png
    636B
  • ting.png
    181B
  • Thumbs.db
    22.5KB
  • pai.png
    223B
  • backImage.png
    317B
  • tiao1.png
    1.1KB
  • chi.png
    534B
  • bgImage.png
    4.4KB
  • arrow.png
    656B
  • MaJiangMidlet.java
    5.4KB
  • CoverCanvas.java
    2.9KB
  • EMMenuForm.java
    3.3KB
  • EMView.java
    3.7KB
  • Action.java
    1.1KB
  • GameCanvas.java
    46.7KB
  • ActionListener.java
    461B
  • www.pudn.com.txt
    218B
内容介绍
// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2005-4-3 23:26:50 // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: GameCanvas.java package NBMaJiang; import com.nokia.mid.ui.FullCanvas; import java.io.PrintStream; import java.util.*; import javax.microedition.lcdui.*; public class GameCanvas extends FullCanvas { private class fa extends TimerTask { public void run() { repaint(); y++; } private fa() { } } public GameCanvas() { normaly1 = 113; normaly2 = 1; value = new int[136]; value1 = new int[14]; value2 = new int[14]; value4 = new int[12]; value5 = new int[12]; chivalue = new boolean[3]; changevalue = new boolean[3]; score1 = 1000; score2 = 1000; initValue(); init(); h = getHeight(); w = getWidth(); font = Font.getFont(0, 0, 8); bigFont = Font.getFont(64, 1, 16); try { image = Image.createImage("/NBMaJiang/images/tiao1.png"); pai1 = Image.createImage("/NBMaJiang/images/pai1.png"); pai = Image.createImage("/NBMaJiang/images/pai.png"); chi1 = Image.createImage("/NBMaJiang/images/chi.png"); ting = Image.createImage("/NBMaJiang/images/ting.png"); } catch(Exception e) { System.out.println("create image error!"); } } private void newGame() { initValue(); init(); } private void initValue() { for(int i = 0; i <= 13; i++) { value1[i] = 100; value2[i] = 100; } for(int i = 0; i <= 11; i++) { value4[i] = 100; value5[i] = 100; } for(int i = 0; i <= 135; i++) { int j = i / 4; value[i] = value3[j]; } } private void init() { random = new Random(); isFirst = true; fa = false; isFinish = false; isUp = false; exeHu = false; doHu = false; hu2 = false; exeTing = false; isTing = false; isNew = false; noHu = 0; passID = 0; total = 135; tagx1 = 118; tagy1 = 110; tagx2 = 2; tagy2 = 1; tagID = 13; fan = 0; fan1 = 0; fan2 = 0; } private void hand() { int ran = Math.abs(random.nextInt()) % total; tag = value[ran]; for(int i = ran; i < total; i++) value[i] = value[i + 1]; value[total] = 100; total--; } private void finish() { int k = 0; for(int i = 0; i <= 135; i++) if(value[i] == 100) k++; if(k >= 120) isFinish = true; } public void choice(int tag) { if(tag >= 1 && tag <= 9) choicex = (tag - 1) * 8; else if(tag >= 21 && tag <= 29) choicex = ((tag - 21) + 9) * 8; else if(tag >= 41 && tag <= 49) choicex = ((tag - 41) + 18) * 8; else if(tag >= 61 && tag <= 67) choicex = ((tag - 61) + 27) * 8; } private void grounddraw(Graphics g, int x1, int y1, int x2, int y2) { g.setClip(x1, y1, x2, y2); g.setColor(67, 160, 20); g.fillRect(x1, y1, x2, y2); } private void coverdraw(Graphics g, int x1, int y1, int width, int height, Image table, int x2, int y2) { g.setClip(x1, y1, width, height); g.drawImage(table, x2, y2, 20); } private void drawpai(Graphics g, int x, int y, int pai) { choice(pai); coverdraw(g, x, y, 8, 14, image, x - choicex, y); } private void fristdraw(Graphics g) { fa = true; y = 0; changeNO1 = 0; changeNO2 = 0; changeID1 = 0; changeID2 = 0; grounddraw(g, 0, 0, w, h); coverdraw(g, 5, 97, 88, 12, chi1, 5, 97); for(int i = 0; i <= 25; i++) { hand(); if(i % 2 == 0) value1[i / 2] = tag; else if(i % 2 == 1) value2[i / 2] = tag; } for(int i = 0; i <= 8; i++) coverdraw(g, 115 - i * 8, 52, 8, 14, pai, 115 - i * 8, 52); drawpai(g, 10, 52, feng); timer = new Timer(); timer.schedule(new fa(), 300L, 300L); } private void fadraw(Graphics g) { drawpai(g, normalx1[y], normaly1, value1[y]); coverdraw(g, normalx2[y], normaly2, 8, 14, pai1, normalx2[y], normaly2); } private void handdraw1(Graphics g) { hand(); tagx1 = normalx1[value1max]; value1[value1max] = tag; isPass1 = false; isMove = false; exeMove = true; exeUp = false; isDown = false; exeChi = false; exePeng = false; exeGang = false; isChange = false; exeGang1 = false; isGang1 = false; exeHu = false; down = true; coverdraw(g, 5, 97, 88, 12, chi1, 5, 97); drawpai(g, tagx1, tagy1, tag); } private void handdraw2(Graphics g) { hand(); value2[13] = tag; coverdraw(g, tagx2, normaly2, 8, 14, pai1, tagx2, normaly2); } private void sort(int m, int value10[]) { for(int i = 1; i <= m; i++) { for(int j = 0; j < i; j++) if(value10[i] < value10[j]) { int temp = value10[i]; for(int k = i; k >= j + 1; k--) value10[k] = value10[k - 1]; value10[j] = temp; } } } private void sortdraw(Graphics g) { sort(13, value1); for(int i = 0; i <= 13 - changeNO1; i++) if(value1[i] == 100) grounddraw(g, normalx1[i], normaly1, 8, 14); else drawpai(g, normalx1[i], normaly1, value1[i]); for(int i = 0; i <= 13; i++) { if(value1[i] != 100) continue; value1max = i; tagID = i; break; } } private void sort2() { sort(13, value2); } private void movepaint(Graphics g) { grounddraw(g, oldtagx, tagy1, 8, 17); drawpai(g, oldtagx, normaly1, oldtag); grounddraw(g, tagx1, tagy1, 8, 17); drawpai(g, tagx1, tagy1, tag); } private void passpaint(Graphics g) { isPass1 = false; isFire = false; exeMove = false; grounddraw(g, tagx1, tagy1, 8, 17); if(zhuang) passx = 1 + (passID - 1 - changeID1) * 9; else if(!zhuang) passx = 1 + (passID - 2 - changeID1) * 9; passy = 67; if(passx >= 127 && passx <= 244) { passy = passy + 14; passx = passx - 126; } else if(passx >= 253 && passx <= 370) { passy = 67; passx = passx - 252; } else if(passx >= 379 && passx <= 496) { passy = passy + 14; passx = passx - 378; } drawpai(g, passx, passy, tag); value1[tagID] = 100; sortdraw(g); } private void exeGangdraw1(Graphics g) { exegang(value1); if(gang) { key1 = i1; key2 = i2; key3 = i3; exeUp = true; exeMove = true; exeGang1 = true; coverdraw(g, 5, 97, 22, 12, chi1, -83, 97); } } private void isGangdraw1(Graphics g) { exeMove = false; if(isGang1) { grounddraw(g, normalx1[key1], tagy1, 8, 17); drawpai(g, normalx1[key1], tagy1, value1[key1]); grounddraw(g, normalx1[key2], tagy1, 8, 17); drawpai(g, normalx1[key2], tagy1, value1[key2]); grounddraw(g, normalx1[key3], tagy1, 8, 17); drawpai(g, normalx1[key3], tagy1, value1[key3]); } } private void doGangdraw1(Graphics g) { if(value1[key1] >= 45 && value1[key1] <= 47) fan1 = fan1 + 1; else if(value1[key1] == feng) fan1 = fan1 + 1; int i1 = 0; int i2 = 0; int i3 = 0; i1 = value1[key1]; i2 = value1[key2]; i3 = value1[key3]; value1[key1] = 100; value1[key2] = 100; value1[key3] = 100; value1[value1max] = 100; grounddraw(g, normalx1[key1], tagy1, 8, 17); grounddraw(g, normalx1[key2], tagy1, 8, 17); grounddraw(g, normalx1[key3], tagy1, 8, 17); grounddraw(g, normalx1[value1max], tagy1, 8, 17); sortdraw(g); drawpai(g, 119 - changeNO1 * 9, normaly1, i1); drawpai(g, 110 - changeNO1 * 9, normaly1, i2); drawpai(g, 101 - changeNO1 * 9, normaly1, i3); drawpai(g, 105 - changeNO1 * 9, normaly1, tag); coverdraw(g, 5, 97, 88, 12, chi1, 5, 97); value4[changeNO1] = i1; value4[changeNO1 + 1] = i2; value4[changeNO1 + 2] = tag; changeNO1 = changeNO1 + 3; handdraw1(g); doGang1 = fals
评论
    相关推荐
    • MJ137610.rar
      一款麻将游戏的J2me源代码,对Vector的用法值得借鉴
    • majiang.rar
      J2me手机游戏麻将源代码,小屏幕的,商业版本代码。
    • TDH.rar
      中国游戏中心在线运营的几款棋牌类游戏,包括游戏大厅,斗地主、锄大地、军旗、象棋等等。
    • MahjongMidlet.rar
      J2me 麻将 能够麻将功能的代码 手机代码
    • majiang_game.rar
      三款麻将游戏的源码,希望对那些对J2ME感兴趣的人有帮助
    • Sudoku.rar
      数独游戏,既可以锻炼脑力,也可以提高自己的编程能力!
    • Java_study_zhilu.rar
      教java学习新手如何步入java殿堂,教您一条好走的路,让java学习不走弯路,看清方向
    • Javastudypdf.rar
      Java学习之路:不走弯路_就是捷径,非常好的一个java学习的资料
    • J2ME手机游戏[二人麻将]
      240X320屏幕,midp2.0 作者:雷神 QQ群:52881021 如果你喜欢这个游戏,留言到我的BLOG即可与我联系,探讨游戏,算法!
    • java学习的一些心得
      关于java学习的一些方法,心得体会,大家随便看看