📄 gamerecord.java
字号:
import javax.microedition.rms.*;
/*
*游戏rms;
*/
public class GameRecord
{
RecordStore rs;
public static byte[] score = (String.valueOf(Configure.score)).getBytes();
byte[] con = new byte[5];
public GameRecord()
{
try
{
rs = RecordStore.openRecordStore("config",true);
if (rs.getVersion()==0)
{
rs.addRecord(score,0,score.length);
}
System.out.println(rs.getVersion());
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void writeRecord()
{
try
{
score = (String.valueOf(Configure.score)).getBytes();
rs.setRecord(2,score,0,score.length);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void readRecord()
{
try
{
con = rs.getRecord(1);
Configure.score = Integer.parseInt(new String(rs.getRecord(2)));
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -