?? itemmanager.java
字號:
/**********************************************************
File name:ItemManager.java
Author:夏文濤
Version:Beta1.0
Data:2007/10/16
Description:
人類工具管理,以及人類工具數據的處理.
Function List:
1.getItemID() 獲取人類工具編號.
2.getItemKind() 獲取人類工具種類.
3.getBuyPrice() 獲取人類工具購買價格.
4.getSellPrice() 獲取人類工具出售價格.
5.getItemName() 獲取人類工具名稱.
6.getIsUsed() 獲取人類工具是否為消耗品.
7.useItem(int) 使用特定物品.
*********************************************************/
package com.Izual.MetalMax;
public class ItemManager {
private String itemName = ""; /*人類工具名稱*/
// private int sellPrice = 0; /*人類工具出售價格,定為購買價格的一半,省略*/
private int buyPrice = 0; /*人類工具的購買價格*/
private int itemKind = 0; /*人類工具的種類,分為戰斗物品,普通物品,事件物品*/
private int itemID = 0; /*人類工具的編號*/
private boolean isUsed = true;
/*空的構造函數*/
public ItemManager() {
// TODO 自動生成構造函數存根
}
/*構造函數,根據人類工具編號,設置相應的工具數據*/
public ItemManager(int itemID){
/*更新物品編號*/
this.itemID = itemID;
switch(itemID){
case 0:
this.itemName = "";
isUsed = false;
break;
case 1:
this.itemName = "參丸";
this.buyPrice = 10;
this.itemKind = 0;
isUsed = true;
break;
case 2:
this.itemName = "黨參";
this.buyPrice = 20;
this.itemKind = 0;
isUsed = true;
break;
case 3:
this.itemName = "人參";
this.buyPrice = 50;
this.itemKind = 0;
isUsed = true;
break;
case 4:
this.itemName = "靈丹";
this.buyPrice = 100;
this.itemKind = 0;
isUsed = true;
break;
case 5:
this.itemName = "手雷";
this.itemKind = 1;
this.buyPrice = 5;
isUsed = true;
break;
case 6:
this.itemName = "火瓶";
this.itemKind = 1;
this.buyPrice = 10;
isUsed = true;
break;
case 7:
this.itemName = "導彈";
this.itemKind = 1;
this.buyPrice = 20;
isUsed = true;
break;
case 8:
this.itemName = "榴彈";
this.itemKind = 1;
this.buyPrice = 20;
isUsed = true;
break;
case 9:
this.itemName = "花扳";
this.itemKind = 2;
this.buyPrice = 80;
isUsed = true;
break;
}
}
/*獲取人類工具編號*/
public int getItemID(){
return itemID;
}
/*獲取人類工具種類*/
public int getItemKind(){
return itemKind;
}
/*獲取人類工具購買價格*/
public int getBuyPrice(){
return buyPrice;
}
/*獲取人類工具出售價格*/
public int getSellPrice(){
return buyPrice/2;
}
/*獲取人類工具名稱*/
public String getItemName(){
return itemName;
}
/*獲取人類工具是否為消耗品*/
public boolean getIsUsed(){
return isUsed;
}
/*************************************************
Function: useItem(int)
Description: 人類工具使用處理,通過調用人類精靈方法進行人類狀態更新.
Calls: HeroSprite.setHeroHp(int);
Called By: MetalMaxCanvas.java
Input: EquItemID:人類裝備編號.
Output: 無
Return: 無
Others: 無
*************************************************/
public static void useItem(int ItemID){
switch(ItemID){
case 0:
break;
case 1:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 50);
break;
case 2:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 200);
break;
case 3:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 450);
break;
case 4:
HeroSprite.setHeroHp(HeroSprite.getHeroHp() + 9999);
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
default:
break;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -