当前位置: 首页>>代码示例>>C++>>正文


C++ GlobalObject::GetCount方法代码示例

本文整理汇总了C++中GlobalObject::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ GlobalObject::GetCount方法的具体用法?C++ GlobalObject::GetCount怎么用?C++ GlobalObject::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GlobalObject的用法示例。


在下文中一共展示了GlobalObject::GetCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Initialize

void TreasureSupervisor::Initialize(MapTreasure* treasure) {
	if (!treasure) {
		IF_PRINT_WARNING(MAP_DEBUG) << "function argument was NULL" << std::endl;
		return;
	}
	_treasure = treasure;
	MapMode::CurrentInstance()->PushState(STATE_TREASURE);

	// Construct the object list, including any drunes that were contained within the treasure
	if (_treasure->_drunes != 0) {
		_list_options.AddOption(MakeUnicodeString("<img/icons/drunes.png>       Drunes<R>" + NumberToString(_treasure->_drunes)));
		_coins_snd.Play();
	}
	else {
		_items_snd.Play();
	}

	for (uint32 i = 0; i < _treasure->_objects_list.size(); i++) {
		if (_treasure->_objects_list[i]->GetCount() > 1) {
			_list_options.AddOption(MakeUnicodeString("<" + _treasure->_objects_list[i]->GetIconImage().GetFilename() + ">       ") +
				_treasure->_objects_list[i]->GetName() +
				MakeUnicodeString("<R>x" + NumberToString(_treasure->_objects_list[i]->GetCount())));
		}
		else {
			_list_options.AddOption(MakeUnicodeString("<" + _treasure->_objects_list[i]->GetIconImage().GetFilename() + ">       ") +
				_treasure->_objects_list[i]->GetName());
		}
	}

	for (uint32 i = 0; i < _list_options.GetNumberOptions(); i++) {
		_list_options.GetEmbeddedImage(i)->SetDimensions(30.0f, 30.0f);
	}

	_action_options.SetSelection(0);
	_action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE);
	_list_options.SetSelection(0);
	_list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN);

	_selection = ACTION_SELECTED;
	_action_window.Show();
	_list_window.Show();

	// Immediately add the drunes and objects to the player's inventory
	GlobalManager->AddDrunes(_treasure->_drunes);

	for (uint32 i = 0; i < _treasure->_objects_list.size(); ++i) {
		GlobalObject* obj = _treasure->_objects_list[i];
		if (!obj)
			continue;
		if (!GlobalManager->IsObjectInInventory(obj->GetID())) {
			// Pass a copy to the inventory, the treasure object will delete its content on destruction.
			hoa_global::GlobalObject* obj_copy = GlobalCreateNewObject(obj->GetID(), obj->GetCount());
			GlobalManager->AddToInventory(obj_copy);
		}
		else {
			GlobalManager->IncrementObjectCount(obj->GetID(), obj->GetCount());
		}
	}
} // void TreasureSupervisor::Initialize(MapTreasure* treasure)
开发者ID:triptych,项目名称:ValyriaTear,代码行数:59,代码来源:map_treasure.cpp


注:本文中的GlobalObject::GetCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。