Exemple #1
0
//-------------------------------------------------------------------------------------
//
//
void CClientLoader::LoadBaseDataLimit()
{
	std::string fullpath(CCFileUtils::fullPathFromRelativePath(jsonFileFunctionLimit));

	std::string strBuffer = readInputTestFile( fullpath.c_str() );

	if( isCheat( strBuffer,  eventlimit_json[0]) )
	{
		char buffer[512];
		sprintf( buffer, the_message_cheat_json[g_iCurLanguageIndex], jsonFileFunctionLimit  );
		CCMessageBox( buffer, the_message_alert[g_iCurLanguageIndex] );
	}

	if( strBuffer.empty() ) 
	{ 
		CCAssert( NULL, "Can not found json file!" );
		return;
	}

	Json::Value root;
	if( parseAndSaveValueTree( strBuffer,"", root ) )
	{ 
		CCAssert( NULL, "read jsonfile is not success!" );
		return;
	}

	Json::Value Root;
	m_vBaseFunLimitData.clear();

	for( int i = 0;; i++ ) 
	{
		char buffer[32];
		sprintf( buffer, "key%d", i + 1 );
		Root = root["eventlimit"][buffer]; 
		if( Root.isNull() )
		{
			break; 
		} 
		CBaseFunLimitData BaseData;

		BaseData.m_iID		= Root["id"].asInt();
		BaseData.m_iFunId	= BaseData.FindIdFormName( FIND_TYPEID_LIMIT_NAME, Root["functionname"].asString().c_str() );
		BaseData.m_iOperator= BaseData.FindIdFormName( FIND_TYPEID_LIMIT_OPERATOR, Root["operator"].asString().c_str() );

		if( Root["param"].isArray() )
		{
			int count = Root["param"].size();
			for( int j = 0; j < count; j++ )
			{
				BaseData.m_arrParam[j]	=  Root["param"][j].asInt();
			}
		}
		m_vBaseFunLimitData.push_back( BaseData );
	} 
}