Class IShopList
Contains the list of ShopItemInfo for purchasing characters and items. It handles the methods for adding and removing ShopItemInfo from the list, as well as getting a number of random ShopItemInfo to be displayed in the ShopUI.
Inheritance
Namespace: AutoBattleFramework.Shop.ShopList
Assembly: cs.temp.dll.dll
Syntax
public abstract class IShopList : ScriptableObject
Methods
AddItemInfo(ShopItemInfo)
Adds a ShopItemInfo to the list.
Declaration
public abstract ShopItemInfo AddItemInfo(ShopItemInfo info)
Parameters
Type | Name | Description |
---|---|---|
ShopItemInfo | info | Item to be added. |
Returns
Type | Description |
---|---|
ShopItemInfo | The added item. |
Backup()
It makes a copy of the list. It is used to not overwrite the ScriptableObject.
Declaration
public abstract IShopList Backup()
Returns
Type | Description |
---|---|
IShopList |
Draw(List<ShopItemInfo>, Boolean)
Retrieves a single ShopItemInfo from the list and add it to an exisiting list.
Declaration
public abstract ShopItemInfo Draw(List<ShopItemInfo> items, bool RepeatItems)
Parameters
Type | Name | Description |
---|---|---|
List<ShopItemInfo> | items | Item list |
Boolean | RepeatItems | Allow to retrieve an exisiting item in the list. |
Returns
Type | Description |
---|---|
ShopItemInfo |
GetRandomItems(Int32, Boolean)
Get a list of random ShopItemInfo from the list.
Declaration
public abstract List<ShopItemInfo> GetRandomItems(int numberOfItems, bool RepeatItems)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numberOfItems | Number of items to retrieve |
Boolean | RepeatItems | Allow repeated items |
Returns
Type | Description |
---|---|
List<ShopItemInfo> | List of items from the lsit. |
GetRandomWeightedIndex(Int32[])
Given a list of weights, return a list of random indices. Used to extract ShopItemInfo based on their itemProbabilityWeight.
Declaration
protected int GetRandomWeightedIndex(int[] weights)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | weights |
Returns
Type | Description |
---|---|
Int32 |
Initialize()
Method called when the list is created. Used if it is necessary to initialize some variable of the list.
Declaration
public virtual void Initialize()
ModifyGameActor(GameActor)
Modify the stats of a GameActor.
Declaration
public abstract void ModifyGameActor(GameActor actor)
Parameters
Type | Name | Description |
---|---|---|
GameActor | actor | GameActor to modify |
OnBuy(ShopItemInfo)
Method called when an object is purchased from the list.
Declaration
public abstract void OnBuy(ShopItemInfo info)
Parameters
Type | Name | Description |
---|---|---|
ShopItemInfo | info | The bought item. |
RemoveItemInfo(ShopItemInfo)
Removes a ShopItemInfo from the list. Returns true if successful.
Declaration
public abstract bool RemoveItemInfo(ShopItemInfo info)
Parameters
Type | Name | Description |
---|---|---|
ShopItemInfo | info | Item to be removed. |
Returns
Type | Description |
---|---|
Boolean | True if succesful |
RestoreItemInfo(ScriptableShopItem)
Restore a ShopItemInfo that has been bought before. Returns true if successful.
Declaration
public abstract bool RestoreItemInfo(ScriptableShopItem info)
Parameters
Type | Name | Description |
---|---|---|
ScriptableShopItem | info | Item to be restored. |
Returns
Type | Description |
---|---|
Boolean | True if succesful |