?? ground.java
字號:
package rich;
import javax.swing.ImageIcon;
public class Ground {
int cost=0;
int lvl=0;
int profit=0;
int address;
ImageIcon icon = new ImageIcon(getClass().getResource("picture/lvl0.gif"));
Character Owner;
int x,y;
String groundType;
Ground(int cost,int profit,int address,int x,int y){
this.cost = cost;
this.profit = profit;
this.address = address;
this.x = x;
this.y = y;
Owner = null;
groundType = "house";
}
public void levelUp(){
lvl++;
switch(lvl){
case 1:
icon = new ImageIcon(getClass().getResource("picture/lvl1.gif"));
break;
case 2:
icon = new ImageIcon(getClass().getResource("picture/lvl2.gif"));
break;
case 3:
icon = new ImageIcon(getClass().getResource("picture/lvl3.gif"));
break;
case 4:
icon = new ImageIcon(getClass().getResource("picture/lvl4.gif"));
break;
case 5:
icon = new ImageIcon(getClass().getResource("picture/lvl5.gif"));
break;
case 6:
icon = new ImageIcon(getClass().getResource("picture/lvl6.gif"));
break;
case 7:
icon = new ImageIcon(getClass().getResource("picture/lvl7.gif"));
break;
case 8:
icon = new ImageIcon(getClass().getResource("picture/lvl8.gif"));
break;
}
}
public boolean gotOwner(){
if(Owner == null){
return false;
}
else{
return true;
}
}
public void setIcon(ImageIcon icon){ this.icon = icon;}
public ImageIcon getIcon(){ return icon; }
public int getLevel(){ return lvl; }
public int getAddress(){ return address; }
public int getCost(){ return cost; }
public int getProfit(){return profit+(lvl*500); }
public void setOwner(Character name){ this.Owner = name; }
public Character getOwner(){ return Owner; }
public void setX(int x){ this.x = x;}
public int getX(){ return x;}
public void setY(int y){ this.y = y; }
public int getY(){ return y; }
public int getIconHeight(){ return icon.getIconHeight(); }
public int getIconWidth(){ return icon.getIconWidth(); }
public void setGroundType(String groundType){ this.groundType = groundType;}
public String getGroundType(){ return groundType; }
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -