坦克大战(一期)-添加配置文件的使用-1.1

Network
bingor_yhj 2 years ago
parent 10c7e9c552
commit 9ad46d11e1

@ -26,6 +26,10 @@ public class PropertyMgr {
return props.get(key);
}
public static String getString(String key) {
return (String) get(key);
}
public static void main(String[] args) {
System.out.println(get("initTankCount"));
}

@ -14,7 +14,7 @@ public class TankDemo {
TankFrame tankFrame = new TankFrame();
Random random = new Random();
int initTankCount = Integer.parseInt((String) PropertyMgr.get("initTankCount"));
int initTankCount = Integer.parseInt(PropertyMgr.getString("initTankCount"));
//创建5个敌方坦克
for (int i=0; i<initTankCount; i++) {

Loading…
Cancel
Save