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

📄 score.java

📁 一个j2me游戏开发引擎
💻 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 

package mmae.game;

import mmae.util.RecordDB;

public class Score
{

    private int a;
    private RecordDB d;
    private String b;
    private int c;
    public String playerName[];
    public int playerScore[];

    public Score(String s, int i, int j)
    {
        d = new RecordDB();
        c = 0;
        b = s;
        d.open(s);
        c = j;
        a = d.getNumRecords();
        if(a <= 0)
            a(i);
        a();
        d.close();
    }

    private void a(int i)
    {
        a = i;
        for(int j = 0; j < i; j++)
            d.addRecord("XXX\007" + String.valueOf((a - j) * c));

    }

    private void a()
    {
        playerName = new String[a];
        playerScore = new int[a];
        Object obj = null;
        for(int i = 0; i < a; i++)
        {
            String s = d.getRecord(i + 1);
            playerName[i] = d.getField(s, 1, "\007");
            playerScore[i] = Integer.valueOf(d.getField(s, 2, "\007")).intValue();
        }

    }

    public boolean isHighScore(int i)
    {
        for(int j = 0; j < a; j++)
            if(playerScore[j] < i)
                return true;

        return false;
    }

    public void insert(String s, int i)
    {
        boolean flag = false;
        for(int j = 0; j < a && !flag; j++)
            if(playerScore[j] < i)
            {
                for(int k = a - 1; k > j; k--)
                {
                    playerName[k] = playerName[k - 1];
                    playerScore[k] = playerScore[k - 1];
                }

                playerName[j] = s;
                playerScore[j] = i;
                flag = true;
            }

        d.open(b);
        for(int l = 0; l < a; l++)
            d.setRecord(l + 1, playerName[l] + "\007" + playerScore[l]);

        d.close();
    }

    public int getTopX()
    {
        return a;
    }
}

⌨️ 快捷键说明

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