📄 country.java
字号:
/*
* Country.java
*
* Created on 12 October 2006, 08:08
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package wpc.data;
import java.awt.Graphics;
/**
*
* @author User
*/
public class Country extends DataObject{
County[] data;
/** Creates a new instance of Country
* A country is split into multiple counties. Each county may have its own rules and stuff
* and a main town. If no int is provided, the Country makes a random number of counties, else
* it makes number of counties
*
*/
public Country(wpc.MainFrame mainFrame) {
super(mainFrame);
createData(mainFrame.getRandom(mainFrame.getMaxRandomCounties())+1);
}
public Country(int number, wpc.MainFrame mainFrame) {
super(mainFrame);
createData(number);
}
public void createData(int number){
if(number<=0){
number=1;
}
if(mainFrame.getMaxWorldTraversal() >= 2) {
data = new County[number];
int n;
for(int i = 0;i<number;i++){
if(mainFrame.getDelayCountry()){
try {
Thread.sleep(mainFrame.getDelayCountryValue());
//System.out.println("Checking");
} catch (InterruptedException e){
// the VM doesn't want us to sleep anymore,
// so get back to work
}
}
n = mainFrame.getPartProgressValue();
if(mainFrame.getMediumDebugLevel()){
mainFrame.addMessageDateStringDebug("\t\tStarting County("+i+") @ ");
}
data[i]=new County(mainFrame);
if(mainFrame.getMediumDebugLevel()){
mainFrame.addMessageDateStringDebug("\t\tFinished County("+i+") @ ");
}
mainFrame.setPartProgressValue(n+mainFrame.getMaxRandomTowns());
}
super.setData(data);
//super.splitWorld();
}
}
public void draw(Graphics g){
g.drawRect(startX, startY, endX, endY);
if(data!=null){
for(int i = 0; i<data.length; i++){
if (data[i]!=null){
data[i].draw(g);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -