Score.java
上传用户:fanyfs
上传日期:2019-04-01
资源大小:145k
文件大小:24k
- import javax.microedition.rms.RecordStore;
- import javax.microedition.rms.RecordStoreException;
- public class Score {
- int score[] = { 1000, 1000, 1000, 1000 };
- int s_per[][];// 每局得分
- int score0 = 0;// 本家合计分数
- String s_score;
- byte bs[];
- // 存储4个玩家分数的方法
- public Score() {
- s_per = new int[2][4];// 初始化数组
- // 第1行表示该局分数
- // 第2行表示正负1表示正0表示负
- }
- // 分数计算的方法
- // 如果采用台湾或者国际麻将 可以修改此方法
- // 本方法根据 1 2 4加点炮规则算分
- public void scoreZhuang11(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 12;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 += 12;// 本家合计分数
- // 4家分数的计算
- score[0] += 12;
- score[1] -= 4;
- score[2] -= 4;
- score[3] -= 4;
- break;
- case 1:
- s_per[0][0] = 8;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 += 8;// 本家合计分数
- // 4家分数的计算
- score[0] += 8;
- score[1] -= 4;
- score[2] -= 2;
- score[3] -= 2;
- break;
- case 2:
- s_per[0][0] = 8;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 += 8;// 本家合计分数
- // 4家分数的计算
- score[0] += 8;
- score[1] -= 2;
- score[2] -= 4;
- score[3] -= 2;
- break;
- case 3:
- s_per[0][0] = 8;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 += 8;// 本家合计分数
- // 4家分数的计算
- score[0] += 8;
- score[1] -= 2;
- score[2] -= 2;
- score[3] -= 4;
- break;
- }
- }
- public void scoreZhuang12(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 4;// 本家合计分数
- // 4家分数的计算
- score[0] += 4;
- score[1] -= 4;
- score[2] -= 0;
- score[3] -= 0;
- break;
- case 1:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 4;// 本家合计分数
- // 4家分数的计算
- score[0] += 4;
- score[1] -= 4;
- score[2] -= 0;
- score[3] -= 0;
- break;
- case 2:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 2;// 本家合计分数
- // 4家分数的计算
- score[0] += 2;
- score[1] -= 2;
- score[2] -= 0;
- score[3] -= 0;
- break;
- case 3:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 2;// 本家合计分数
- // 4家分数的计算
- score[0] += 2;
- score[1] -= 2;
- score[2] -= 0;
- score[3] -= 0;
- break;
- }
- }
- public void scoreZhuang13(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 4;// 本家合计分数
- // 4家分数的计算
- score[0] += 4;
- score[2] -= 4;
- break;
- case 1:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 2;// 本家合计分数
- // 4家分数的计算
- score[0] += 2;
- score[1] -= 0;
- score[2] -= 2;
- score[3] -= 0;
- break;
- case 2:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 4;// 本家合计分数
- // 4家分数的计算
- score[0] += 4;
- score[2] -= 4;
- break;
- case 3:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 += 2;// 本家合计分数
- // 4家分数的计算
- score[0] += 2;
- score[2] -= 2;
- break;
- }
- }
- public void scoreZhuang14(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 += 4;// 本家合计分数
- // 4家分数的计算
- score[0] += 4;
- score[3] -= 4;
- break;
- case 1:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 += 2;// 本家合计分数
- // 4家分数的计算
- score[0] += 2;
- score[3] -= 2;
- break;
- case 2:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 += 2;// 本家合计分数
- // 4家分数的计算
- score[0] += 2;
- score[3] -= 2;
- break;
- case 3:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 1;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 += 4;// 本家合计分数
- // 4家分数的计算
- score[0] += 4;
- score[3] -= 4;
- break;
- }
- }
- public void scoreFP1(int FP, int zhuang) {
- switch (FP) {
- case 0:// 自摸
- scoreZhuang11(zhuang);
- break;
- case 1:
- scoreZhuang12(zhuang);
- break;
- case 2:
- scoreZhuang13(zhuang);
- break;
- case 3:
- scoreZhuang14(zhuang);
- break;
- }
- }
- public void scoreZhuang21(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] += 4;
- break;
- case 1:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] += 4;
- break;
- case 2:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] += 2;
- break;
- case 3:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] += 2;
- break;
- }
- }
- public void scoreZhuang22(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 8;
- s_per[1][1] = 1;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] += 8;
- score[2] -= 2;
- score[3] -= 2;
- break;
- case 1:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 12;
- s_per[1][1] = 1;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] += 12;
- score[2] -= 4;
- score[3] -= 4;
- break;
- case 2:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 8;
- s_per[1][1] = 1;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] += 8;
- score[2] -= 4;
- score[3] -= 2;
- break;
- case 3:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 8;
- s_per[1][1] = 1;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] += 8;
- score[2] -= 2;
- score[3] -= 4;
- break;
- }
- }
- public void scoreZhuang23(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 1;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 2;
- score[2] -= 2;
- score[3] -= 0;
- break;
- case 1:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 1;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 4;
- score[2] -= 4;
- score[3] -= 0;
- break;
- case 2:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 1;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 4;
- score[2] -= 4;
- score[3] -= 0;
- break;
- case 3:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 1;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 2;
- score[2] -= 2;
- score[3] -= 0;
- break;
- }
- }
- public void scoreZhuang24(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 2;
- score[2] -= 0;
- score[3] -= 2;
- break;
- case 1:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 4;
- score[2] -= 0;
- score[3] -= 4;
- break;
- case 2:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 2;
- score[2] -= 0;
- score[3] -= 2;
- break;
- case 3:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 1;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] += 4;
- score[2] -= 0;
- score[3] -= 4;
- break;
- }
- }
- public void scoreFP2(int FP, int zhuang) {
- switch (FP) {
- case 0:
- scoreZhuang21(zhuang);
- break;
- case 1:// 自摸
- scoreZhuang22(zhuang);
- break;
- case 2:
- scoreZhuang23(zhuang);
- break;
- case 3:
- scoreZhuang24(zhuang);
- break;
- }
- }
- public void scoreZhuang31(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 0;
- score[2] += 4;
- score[3] -= 0;
- break;
- case 1:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 0;
- score[2] += 2;
- score[3] -= 0;
- break;
- case 2:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 0;
- score[2] += 4;
- score[3] -= 0;
- break;
- case 3:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 0;
- score[2] += 2;
- score[3] -= 0;
- break;
- }
- }
- public void scoreZhuang32(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 2;
- score[2] += 2;
- score[3] -= 0;
- break;
- case 1:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 2;
- score[2] += 2;
- score[3] -= 0;
- break;
- case 2:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 4;
- score[2] += 4;
- score[3] -= 0;
- break;
- case 3:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 0;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 2;
- score[2] += 2;
- score[3] -= 0;
- break;
- }
- }
- public void scoreZhuang33(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 8;
- s_per[1][2] = 1;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 2;
- score[2] += 8;
- score[3] -= 2;
- break;
- case 1:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 8;
- s_per[1][2] = 1;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 4;
- score[2] += 8;
- score[3] -= 2;
- break;
- case 2:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 12;
- s_per[1][2] = 1;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 4;
- score[2] += 12;
- score[3] -= 4;
- break;
- case 3:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 8;
- s_per[1][2] = 1;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 2;
- score[2] += 8;
- score[3] -= 4;
- break;
- }
- }
- public void scoreZhuang34(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] += 2;
- score[3] -= 2;
- break;
- case 1:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 1;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] += 2;
- score[3] -= 2;
- break;
- case 2:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 1;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] += 4;
- score[3] -= 4;
- break;
- case 3:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 1;
- s_per[0][3] = 4;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] += 4;
- score[3] -= 4;
- break;
- }
- }
- public void scoreFP3(int FP, int zhuang) {
- switch (FP) {
- case 0:
- scoreZhuang31(zhuang);
- break;
- case 1:
- scoreZhuang32(zhuang);
- break;
- case 2:// 自摸
- scoreZhuang33(zhuang);
- break;
- case 3:
- scoreZhuang34(zhuang);
- break;
- }
- }
- public void scoreZhuang41(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 1;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 0;
- score[2] -= 0;
- score[3] += 4;
- break;
- case 1:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 1;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 0;
- score[2] -= 0;
- score[3] += 2;
- break;
- case 2:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 1;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 0;
- score[2] -= 0;
- score[3] += 2;
- break;
- case 3:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 1;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 0;
- score[2] -= 0;
- score[3] += 4;
- break;
- }
- }
- public void scoreZhuang42(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 2;
- score[2] -= 0;
- score[3] += 2;
- break;
- case 1:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 4;
- score[2] -= 0;
- score[3] += 4;
- break;
- case 2:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 2;
- score[2] -= 0;
- score[3] += 2;
- break;
- case 3:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 0;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 4;
- score[2] -= 0;
- score[3] += 4;
- break;
- }
- }
- public void scoreZhuang43(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 0;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] -= 2;
- score[3] += 2;
- break;
- case 1:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 2;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] -= 2;
- score[3] += 2;
- break;
- case 2:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] -= 4;
- score[3] += 4;
- break;
- case 3:
- s_per[0][0] = 0;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 0;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 4;
- s_per[1][3] = 1;
- // 4家分数的计算
- score[0] -= 0;
- score[1] -= 0;
- score[2] -= 4;
- score[3] += 4;
- break;
- }
- }
- public void scoreZhuang44(int zhuang) {
- switch (zhuang) {
- case 0:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 8;
- s_per[1][3] = 1;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 2;
- score[2] -= 2;
- score[3] += 8;
- break;
- case 1:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 2;
- s_per[1][2] = 0;
- s_per[0][3] = 8;
- s_per[1][3] = 1;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 4;
- score[2] -= 2;
- score[3] += 8;
- break;
- case 2:
- s_per[0][0] = 2;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 2;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 8;
- s_per[1][3] = 1;
- score0 -= 2;// 本家合计分数
- // 4家分数的计算
- score[0] -= 2;
- score[1] -= 2;
- score[2] -= 4;
- score[3] += 8;
- break;
- case 3:
- s_per[0][0] = 4;// 每个人的分数
- s_per[1][0] = 0;
- s_per[0][1] = 4;
- s_per[1][1] = 0;
- s_per[0][2] = 4;
- s_per[1][2] = 0;
- s_per[0][3] = 12;
- s_per[1][3] = 1;
- score0 -= 4;// 本家合计分数
- // 4家分数的计算
- score[0] -= 4;
- score[1] -= 4;
- score[2] -= 4;
- score[3] += 12;
- break;
- }
- }
- public void scoreFP4(int FP, int zhuang) {
- switch (FP) {
- case 0:
- scoreZhuang41(zhuang);
- break;
- case 1:
- scoreZhuang42(zhuang);
- break;
- case 2:
- scoreZhuang43(zhuang);
- break;
- case 3:// 自摸
- scoreZhuang44(zhuang);
- break;
- }
- }
- public void scoreCount(int winner, int FP, int zhuang) {// 3个参数分别是 赢家 放炮
- // 和该局的庄家
- switch (winner) {
- case 0:
- scoreFP1(FP, zhuang);
- break;
- case 1:
- scoreFP2(FP, zhuang);
- break;
- case 2:// 2赢
- scoreFP3(FP, zhuang);
- break;
- case 3:// 3赢
- scoreFP4(FP, zhuang);
- break;
- }
- }
- public void save() {
- try {
- RecordStore rs = RecordStore.openRecordStore("Score_mj", true);
- for (int i = 0; i < 4; i++) {
- s_score = String.valueOf(score[i]);
- bs = s_score.getBytes();
- if (rs.getNumRecords() > i)
- rs.setRecord(i + 1, bs, 0, bs.length);
- else
- rs.addRecord(bs, 0, bs.length);
- }
- rs.closeRecordStore();
- } catch (RecordStoreException _ex) {
- }
- }
- // 读取4个玩家分数的方法
- public void load() {
- try {
- RecordStore rs = RecordStore.openRecordStore("Score_mj", false);
- if (rs.getNumRecords() > 3) {
- for (int i = 0; i < 4; i++) {
- bs = rs.getRecord(i + 1);
- s_score = new String(bs);
- score[i] = Integer.parseInt(s_score);
- }
- }
- rs.closeRecordStore();
- } catch (RecordStoreException _ex) {
- }
- }
- // 清除个人当前得分s_per[][]
- public void scoreClear() {
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 4; j++) {
- s_per[i][j] = 0;
- }
- }
- }
- }