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


C++ IActionMapManager::Reset方法代码示例

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


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

示例1: Reset

//------------------------------------------------------------------------
bool CPlayerProfile::Reset()
{
	if (IsDefault())
		return false;

	// for now, try to get the action map from the IActionMapManager
	IActionMapManager* pAM = CCryAction::GetCryAction()->GetIActionMapManager();
	pAM->Reset();
	// well, not very efficient at the moment...
	TAttributeMap::iterator iter = m_attributeMap.begin();
	while (iter != m_attributeMap.end())
	{
		TAttributeMap::iterator next = iter;
		++next;
		ResetAttribute(iter->first);
		iter = next;
	}

	LoadGamerProfileDefaults();
	gEnv->pSystem->AutoDetectSpec(false);

	return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:24,代码来源:PlayerProfile.cpp

示例2: SerializeXML

//------------------------------------------------------------------------
bool CPlayerProfile::SerializeXML(CPlayerProfileManager::IProfileXMLSerializer* pSerializer)
{
	if (pSerializer->IsLoading())
	{
		// serialize attributes
		XmlNodeRef attributesNode = pSerializer->GetSection(CPlayerProfileManager::ePPS_Attribute);
		if (attributesNode)
		{
			CPlayerProfile* pDefaultProfile = static_cast<CPlayerProfile*> (m_pManager->GetDefaultProfile());
			int requiredVersion = 0;
			if (IsDefault() == false && pDefaultProfile)
				requiredVersion = pDefaultProfile->m_attributesVersion;
			bool ok = LoadAttributes(attributesNode, requiredVersion);
		}
		else
		{
			GameWarning("CPlayerProfile::SerializeXML: No attributes tag '%s' found", ATTRIBUTES_TAG);
			return false;
		}

		// preview profiles never load actionmaps!
		if (m_bIsPreview == false)
		{
			// serialize action maps
			XmlNodeRef actionMaps = pSerializer->GetSection(CPlayerProfileManager::ePPS_Actionmap);
			if (actionMaps)
			{
				// the default profile loaded has no associated actionmaps, but
				// rather assumes that all actionmaps which are currently loaded belong to the default
				// profile
				// if it's not the default profile to be loaded, then we load the ActionMap
				// but we do a version check. if the profile's actionmaps are outdated, it's not loaded
				// but the default action map is used instead
				// on saving the profile it's automatically updated (e.g. the current actionmaps [correct version] 
				// are saved
				IActionMapManager* pAM = CCryAction::GetCryAction()->GetIActionMapManager();
				if (IsDefault() == false && pAM)
				{
					pAM->Reset();

					pAM->LoadRebindDataFromXML(actionMaps); // check version and don't load if outdated
				}
			}
			else
			{
				GameWarning("CPlayerProfile::SerializeXML: No actionmaps tag '%s' found", ACTIONMAPS_TAG);
				return false;
			}
		}
	}
	else
	{
		if (m_bIsPreview == false)
		{
			// serialize attributes
			XmlNodeRef attributesNode = pSerializer->CreateNewSection(CPlayerProfileManager::ePPS_Attribute, CPlayerProfile::ATTRIBUTES_TAG);
			bool ok = SaveAttributes(attributesNode);
			if (!ok)
				return false;
	
			// serialize action maps
			IActionMapManager* pAM = CCryAction::GetCryAction()->GetIActionMapManager();
			XmlNodeRef actionMapsNode = pSerializer->CreateNewSection(CPlayerProfileManager::ePPS_Actionmap, CPlayerProfile::ACTIONMAPS_TAG);
			pAM->SaveRebindDataToXML(actionMapsNode);
			return ok;
		}
	}
	return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:70,代码来源:PlayerProfile.cpp


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