Class vGear_InventoryManager
The manager for inventory system.
庫存系統管理員。
Inheritance
Namespace: Votanic.vXR.vGear
Assembly: Votanic.vXR.dll
Syntax
[AddComponentMenu("")]
public class vGear_InventoryManager : MonoBehaviour
Fields
autoLoad
Auto load the items data on start.
在開始時自動讀取所有物品數據。
Declaration
[Tooltip("Auto load the items data on start.\n在開始時自動讀取所有物品數據。")]
public bool autoLoad
Field Value
| Type | Description |
|---|---|
| System.Boolean |
auxiliary
The auxiliary of inventory system.
庫存系統的輔助物。
Declaration
[Tooltip("The auxiliary of inventory system.\n庫存系統的輔助物。")]
public vGear_Auxiliary auxiliary
Field Value
| Type | Description |
|---|---|
| vGear_Auxiliary |
currencies
The currencies of inventory system.
庫存系統的所有貨幣。
Declaration
[Tooltip("The currencies of inventory system.\n庫存系統的所有貨幣。")]
public List<Currency> currencies
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<Currency> |
dataPath
Json path for saving and loading items.
用作儲存及讀取物品的 Json 路徑。
Declaration
[Tooltip("Json path for saving and loading items.\n用作儲存及讀取物品的 Json 路徑。")]
public string dataPath
Field Value
| Type | Description |
|---|---|
| System.String |
fileLocation
The relative folder location of files.
檔案的相對文件夾位置。
Declaration
[Header("[Settings]")]
[Tooltip("The relative folder location of files.\n檔案的相對文件夾位置。")]
public FileLocation fileLocation
Field Value
| Type | Description |
|---|---|
| FileLocation |
generatables
The generic prefab for generatable items.
可生成物的通用預製件。
Declaration
[Tooltip("The generic prefab for generatable items.\n可生成物的通用預製件。")]
public vGear_Item generatables
Field Value
| Type | Description |
|---|---|
| vGear_Item |
items
The items of inventory system.
庫存系統的所有物品。
Declaration
[Tooltip("The items of inventory system.\n庫存系統的所有物品。")]
public List<Item> items
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<Item> |
main
The main inventories of inventory system.
庫存系統的主庫存。
Declaration
[Header("[Components]")]
[Tooltip("The main inventories of inventory system.\n庫存系統的主庫存。")]
public vGear_Inventory main
Field Value
| Type | Description |
|---|---|
| vGear_Inventory |
qualities
The qualities of inventory system.
庫存系統的所有品質。
Declaration
[Tooltip("The qualities of inventory system.\n庫存系統的所有品質。")]
public List<Quality> qualities
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<Quality> |
quantityPanel
The panel for adjusting quantity.
調整數量的面板。
Declaration
[Tooltip("The panel for adjusting quantity.\n調整數量的面板。")]
public vGear_Panel quantityPanel
Field Value
| Type | Description |
|---|---|
| vGear_Panel |
recordName
The auto load record name.
自動讀取的記錄名稱。
Declaration
[Tooltip("The auto load record name.\n自動讀取的記錄名稱。")]
public string recordName
Field Value
| Type | Description |
|---|---|
| System.String |
Methods
AddItem(String, String, String, String, Int32, Boolean, Generatables, List<Grid>, List<String>)
Add an item to item list.
新增一個物品至物品列表。
AddItem("Item_01", "ItemName", "", "", 1, false, generatables, gridSytles, categories)
Declaration
public void AddItem(string identifier, string name, string remark, string description, int quality, bool currencyContainer, Generatables generatables, List<Grid> gridStyles, List<string> categories)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | identifier | Identifier of item. |
| System.String | name | Name of item |
| System.String | remark | Remark of item |
| System.String | description | Description of item |
| System.Int32 | quality | Quality index |
| System.Boolean | currencyContainer | This item will become a currency container |
| Generatables | generatables | Generatables setting of item |
| System.Collections.Generic.List<Grid> | gridStyles | Only the list of specific categories can store |
| System.Collections.Generic.List<System.String> | categories | Grid styles for this item |
AddItem(Item)
Add an item to item list.
新增一個物品至物品列表。
AddItem(item)
Declaration
public void AddItem(Item item)
Parameters
| Type | Name | Description |
|---|---|---|
| Item | item | Item |
AddItems()
Virtual method for adding items on start by scripting.
虛構法用於以腳本在開始時加入物品。
Declaration
public virtual void AddItems()
AddQuantity(Boolean)
Add display quantity to quantity panel.
增加數量面板的顯示數量。
AddQuantity(false)
Declaration
public void AddQuantity(bool toMax)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | toMax | Add quantity to max value |
Apply(vGear_ItemContainer, vGear_Controller)
Apply the item on container.
使用容器中的物品。
Apply(container, controller)
Declaration
public virtual void Apply(vGear_ItemContainer container, vGear_Controller controller)
Parameters
| Type | Name | Description |
|---|---|---|
| vGear_ItemContainer | container | Item ontainer |
| vGear_Controller | controller | Controller to handle the item |
CloseQuantityPanel(Boolean)
Close quantity panel.
關閉數量面板。
CloseQuantityPanel(true)
Declaration
public void CloseQuantityPanel(bool operate)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | operate | Operation comfirm |
ErrorLog(ErrorType)
Error log for operation failure.
操作失敗的錯誤報告。
ErrorLog(ErrorType.SpaceIssue)
Declaration
public virtual void ErrorLog(ErrorType msg)
Parameters
| Type | Name | Description |
|---|---|---|
| ErrorType | msg | Message of error |
HideCommands()
Close command panel.
關閉指令面板。
Declaration
public void HideCommands()
HideInfo()
Close info panel.
關閉資訊面板。
Declaration
public void HideInfo()
IsGeneratablesCreated()
Return true if a generatables is created.
當可生成物產生時傳回 true。
Declaration
public bool IsGeneratablesCreated()
Returns
| Type | Description |
|---|---|
| System.Boolean |
Load(String, Boolean, Boolean)
Load items data from json file.
讀取 Json 檔案的物品數據。
Load("Record 1")
Declaration
public void Load(string recordName, bool loadInventory = true, bool loadGeneratables = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | recordName | Name of record |
| System.Boolean | loadInventory | Load inventories preset item data |
| System.Boolean | loadGeneratables | Load scene generatables data |
OpenQuantityPanel(vGear_ItemContainer, AccessType, Parameter)
Open quantity panel.
打開數量面板。
OpenQuantityPanel(itemContainer, AccessType.Store, new InteractionParameter("command", 1, -1, 0, InteractorType.Wand))
Declaration
public void OpenQuantityPanel(vGear_ItemContainer container, AccessType operateType, Parameter parameter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| vGear_ItemContainer | container | Item container |
| AccessType | operateType | Operation type |
| Parameter | parameter | Paramter class |
ReduceQuantity(Boolean)
Reduce display quantity to quantity panel.
減少數量面板的顯示數量。
ReduceQuantity(false)
Declaration
public void ReduceQuantity(bool toOne)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | toOne | Reduce quantity to one |
Save(String, Boolean, Boolean)
Save items data to json file.
儲存物品數據至 Json 檔案。
Save("Record 1")
Declaration
public void Save(string recordName, bool saveInventory = true, bool saveGeneratables = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | recordName | Name of record |
| System.Boolean | saveInventory | Save inventories preset item data |
| System.Boolean | saveGeneratables | Save scene generatables data |
ShowCommands(vGear_ItemContainer)
Open the auxiliary command panel if the container has item.
當容器有物品時打開輔助物指令面板。
ShowCommands(container)
Declaration
public void ShowCommands(vGear_ItemContainer container)
Parameters
| Type | Name | Description |
|---|---|---|
| vGear_ItemContainer | container | Target container |
ShowInfo(vGear_ItemContainer)
Open the auxiliary info panel if the container has item.
當容器有物品時打開輔助物資訊面板。
ShowInfo(container)
Declaration
public void ShowInfo(vGear_ItemContainer container)
Parameters
| Type | Name | Description |
|---|---|---|
| vGear_ItemContainer | container | Target container |
SuccessLog(SuccessType, Item)
Success log for operation done.
操作完成的成功報告。
SuccessLog(SuccessType.Apply)
Declaration
public virtual void SuccessLog(SuccessType msg, Item item)
Parameters
| Type | Name | Description |
|---|---|---|
| SuccessType | msg | Message of success |
| Item | item | Related item |