C# Class Mooege.Core.GS.Common.InventoryGrid

This class handels the gridlayout of an stash. Possible usecases are the inventory backpack, shared stash, traders stash,... Stash is organized by adding an item to EVERY slot it fills
Inheritance: IRevealable
Mostrar archivo Open project: xsochor/mooege Class Usage Examples

Public Methods

Method Description
AddItem ( Item item ) : bool

Adds an Item at a free spot to the backpack

AddItem ( Item item, int row, int column ) : void

Adds an item to the backpack

Contains ( Item item ) : bool
Contains ( uint itemID ) : bool

Checks whether the inventory contains an item

FreeSpace ( Item item, int row, int column ) : bool
HasFreeSpace ( Item item ) : System.Boolean
InventoryGrid ( Mooege.Core.GS.Actors.Actor owner, int rows, int columns, int slot ) : System
RemoveItem ( Item item ) : void

Removes an item from the backpack

ResizeGrid ( int rows, int columns ) : void
Reveal ( Player player ) : bool
Unreveal ( Player player ) : bool

Private Methods

Method Description
CollectOverlappingItems ( Item item, int row, int column ) : int

Collects (counts) the items overlapping with the item about to be dropped. If there are none, drop item If there is exacly one, swap it with item (TODO) If there are more, item cannot be dropped

FindSlotForItem ( Item item ) : InventorySlot?

Find an inventory slot with enough space for an item

GetItemInventorySize ( Item item ) : InventorySize

Method Details

AddItem() public method

Adds an Item at a free spot to the backpack
public AddItem ( Item item ) : bool
item Item
return bool

AddItem() public method

Adds an item to the backpack
public AddItem ( Item item, int row, int column ) : void
item Item
row int
column int
return void

Contains() public method

public Contains ( Item item ) : bool
item Item
return bool

Contains() public method

Checks whether the inventory contains an item
public Contains ( uint itemID ) : bool
itemID uint
return bool

FreeSpace() public method

public FreeSpace ( Item item, int row, int column ) : bool
item Item
row int
column int
return bool

HasFreeSpace() public method

public HasFreeSpace ( Item item ) : System.Boolean
item Item
return System.Boolean

InventoryGrid() public method

public InventoryGrid ( Mooege.Core.GS.Actors.Actor owner, int rows, int columns, int slot ) : System
owner Mooege.Core.GS.Actors.Actor
rows int
columns int
slot int
return System

RemoveItem() public method

Removes an item from the backpack
public RemoveItem ( Item item ) : void
item Item
return void

ResizeGrid() public method

public ResizeGrid ( int rows, int columns ) : void
rows int
columns int
return void

Reveal() public method

public Reveal ( Player player ) : bool
player Player
return bool

Unreveal() public method

public Unreveal ( Player player ) : bool
player Player
return bool