|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectus.asciiroth.client.core.Bag<Item>
us.asciiroth.client.core.PlayerBag
public class PlayerBag
A bag that tracks the player's inventory. What makes the inventory unique, as bags go, is that one item in the bag is selected, and there is an item called "empty-handed" that simulates the player using nothing at all in the bag.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class us.asciiroth.client.core.Bag |
|---|
Bag.Entry<T extends Piece> |
| Field Summary | |
|---|---|
static EmptyHanded |
EMPTY_HANDED
An item that represents "no item". |
| Constructor Summary | |
|---|---|
PlayerBag()
Constructor. |
|
| Method Summary | |
|---|---|
void |
add(Item item)
Add one count of an item to the bag. |
Item |
exchange(Item item)
Add one instance of the supplied item and remove one instance of the currently selected item. |
Item |
getByName(java.lang.String name)
Find an item by its name, the name displayed to the user. |
Item |
getSelected()
Get the currently selected item (the item that is being "wielded" and is assumed to be in use when the player moves toward something that will respond to an item). |
boolean |
isSelected(Bag.Entry<Item> entry)
Is this entry selected |
void |
moveSelectedDown()
|
void |
moveSelectedUp()
|
void |
remove(Item item)
Remove one count of an item from the bag. |
void |
select(int index)
|
void |
selectDown()
Select the next lowest item in the bag (wraps around to the end of the list. |
void |
selectEmptyHanded()
Select the empty handed item in the bag. |
void |
selectFirstWeapon()
|
void |
selectUp()
Select the next highest item in the bag (wraps around to the end of the list. |
void |
setInitialSelection(int newIndex)
When initializing the player, this quietly sets the item that is selected. |
| Methods inherited from class us.asciiroth.client.core.Bag |
|---|
add, asEntryList, contains, findEntry, get, getCount, getIndex, isEmpty, last, size |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final EmptyHanded EMPTY_HANDED
| Constructor Detail |
|---|
public PlayerBag()
| Method Detail |
|---|
public void add(Item item)
Bag
add in class Bag<Item>public Item exchange(Item item)
item - the item the player receives
public Item getByName(java.lang.String name)
name - the name of the item as displayed to the user
public Item getSelected()
public boolean isSelected(Bag.Entry<Item> entry)
entry -
public void moveSelectedDown()
public void moveSelectedUp()
public void remove(Item item)
Bag
remove in class Bag<Item>public void select(int index)
public void selectDown()
public void selectEmptyHanded()
public void selectFirstWeapon()
public void selectUp()
public void setInitialSelection(int newIndex)
newIndex -
|
0.7 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
© 2009 Alx Dark