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

EVENGINE_API_FOUNDATION public API. 更多...

#include <Item.h>

静态 Public 成员函数

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

成员函数说明

◆ clear()

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

Clears clear.

在文件 Item.cpp 第 61 行定义.

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

◆ count()

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

Returns the number of count.

在文件 Item.cpp 第 63 行定义.

引用了 size.

被这些函数引用 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.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().

◆ registerItem()

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

◆ remove()

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

Removes remove.

在文件 Item.cpp 第 59 行定义.


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