载入中...
搜索中...
未找到
eve::inventory::ItemRegistry类 参考

#include <Item.h>

静态 Public 成员函数

static void registerItem (const ItemDefinition &def)
 
static const ItemDefinitionfind (const std::string &id)
 
static bool remove (const std::string &id)
 
static void clear ()
 
static int 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"} }
 

详细描述

在文件 Item.h12 行定义.

成员函数说明

◆ clear()

void eve::inventory::ItemRegistry::clear ( )
static

在文件 Item.cpp61 行定义.

被这些函数引用 eve::inventory::Inventory::clearItemDefinitions().

◆ count()

int eve::inventory::ItemRegistry::count ( )
static

在文件 Item.cpp63 行定义.

被这些函数引用 eve::inventory::Inventory::getItemDefinitionCount().

◆ find()

◆ loadFromJson()

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.cpp84 行定义.

引用了 eve::json::Value::at(), error, eve::inventory::ItemDefinition::id, eve::json::Value::isArray(), eve::json::Value::isObject(), n, eve::json::Document::parse(), registerItem(), eve::json::Document::root(), eve::json::Value::size() , 以及 eve::json::Document::valid().

被这些函数引用 eve::inventory::Inventory::registerItemsFromJson().

◆ registerItem()

void eve::inventory::ItemRegistry::registerItem ( const ItemDefinition def)
static

◆ remove()

bool eve::inventory::ItemRegistry::remove ( const std::string &  id)
static

在文件 Item.cpp59 行定义.


该类的文档由以下文件生成: