|
| static void | registerItem (const ItemDefinition &def) |
| | Registers item.
|
| |
| static const ItemDefinition * | find (const std::string &id) |
| | Finds find.
|
| |
| static bool | remove (const std::string &id) |
| | Removes remove.
|
| |
| static void | clear () |
| | Clears clear.
|
| |
| static int | count () |
| | Returns the number of count.
|
| |
| static int | loadFromJson (const std::string &json, std::string *error=nullptr) |
| | 从 JSON 数组或单对象批量注册,返回成功数量。 元素形如: { "id": "potion.hp", "displayName": "治疗药水", "maxStack": 20, "weight": 0.2, "volume": 0.1, "category": "consumable", "tags": ["potion"], "equipSlot": "", "extra": {"icon": "ui/potion.png"} }
|
| |
EVENGINE_API_FOUNDATION public API.
在文件 Item.h 第 15 行定义.
| int eve::inventory::ItemRegistry::loadFromJson |
( |
const std::string & |
json, |
|
|
std::string * |
error = nullptr |
|
) |
| |
|
static |
从 JSON 数组或单对象批量注册,返回成功数量。 元素形如: { "id": "potion.hp", "displayName": "治疗药水", "maxStack": 20, "weight": 0.2, "volume": 0.1, "category": "consumable", "tags": ["potion"], "equipSlot": "", "extra": {"icon": "ui/potion.png"} }
在文件 Item.cpp 第 84 行定义.
引用了 error, eve::inventory::ItemDefinition::id, n, eve::json::Document::parse(), registerItem(), eve::json::Document::root(), root , 以及 eve::json::Document::valid().
被这些函数引用 eve::inventory::Inventory::registerItemsFromJson().