CHero

#ifndef __HERO_H__
#define __HERO_H__ #include "GameFrameHead.h" #include "GameParam.h" class CHero
{
public: struct Attribute
{
//成就
//总
//long long llTotalMoney;
//long long llTotalScores; long long llTotalComplete;
long long llTotalPerfectToComplete; int levelComplete[LEVEL_AMOUNT];
bool levelAllComplete[LEVEL_AMOUNT]; //解锁成就 //一局 最高纪录
long long llTopMoney; //生涯存档
struct CareerArchive
{
bool bCompletion;
bool bGood;
int nScore;
int nHeightScore;
int nBestStep;
}; //完成的关卡
map<int, CareerArchive> career; //教学
bool bBaseTeaching;
bool bLigatureTeaching;
bool bRatingTeaching; //成就
map<int, bool> mapAchievementComplete;
map<int, bool> mapAchievementPerfectToComplete;
map<int, bool> mapAchievementMode;
}; public:
CHero();
~CHero(); bool init(); Attribute* getAttribute()const; Attribute::CareerArchive* getCareer(int nId); private:
Attribute* m_pAttribute; }; #endif//__HERO_H__
#include "Hero.h"
#include "GameParam.h"
#include "XCommon.h"
#include "GameConfig.h"
#include "GameLogic.h" #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "GameCenter.h"
#endif CHero::CHero()
{
m_pAttribute = new Attribute();
} CHero::~CHero()
{
SAFE_DELETE(m_pAttribute);
} CHero::Attribute* CHero::getAttribute() const
{
return m_pAttribute;
} bool CHero::init()
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) int nSize = sizeof(GAMECENTER_ID_Complete) / sizeof(GAMECENTER_ID_Complete[]);
for(int i = ; i < nSize; i++)
{
m_pAttribute->mapAchievementComplete[i] = false;
} nSize = sizeof(GAMECENTER_ID_PerfectToComplete) / sizeof(GAMECENTER_ID_PerfectToComplete[]);
for (int i = ; i < nSize; i++)
{
m_pAttribute->mapAchievementPerfectToComplete[i] = false;
} for (int i = ; i < LEVEL_AMOUNT; i++)
{
m_pAttribute->mapAchievementMode[i] = false;
} #endif return true;
} CHero::Attribute::CareerArchive* CHero::getCareer( int nId )
{
for (map<int, CHero::Attribute::CareerArchive>::iterator it = m_pAttribute->career.begin(); it != m_pAttribute->career.end(); it++)
{
if (it->first == nId)
{
return &it->second;
}
}
return NULL;
}
上一篇:BoundingBoxUV与BoundingBoxXYZ


下一篇:【转】PowerShell入门(十二):编写PowerShell管理单元和二进制模块