#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;
}

CHero的更多相关文章

  1. LUA类

    cpp_object_map = {}setmetatable(cpp_object_map, { __mode = "kv" }) local search_basesearch ...

  2. C# 事件编程在游戏开发的应用

    2D碰撞检测:http://wenku.baidu.com/view/45544cfcfab069dc50220145.html 1.Action System.Action 等于快捷创建一个委托 2 ...

  3. #define 的一些用法 以及 迭代器的 [] 与 find()函数的区别

    #include "stdafx.h" #include <map> #include <string> #include <iostream> ...

  4. LUA使用虚函数与使用回调函数

    ------------------虚函数overload-------------------------- --回调:寻路中格子坐标改变 CHero.OnSearchToCellsChange = ...

  5. C++ 一篇搞懂多态的实现原理

    虚函数和多态 01 虚函数 在类的定义中,前面有 virtual 关键字的成员函数称为虚函数: virtual 关键字只用在类定义里的函数声明中,写函数体时不用. class Base { virtu ...

随机推荐

  1. Kotlin【简介】Android开发 配置 扩展

    重要资源 官方资源:官网 . 官网源码 .官网文档 . 在线 IDE .GitHub 中文资源:中文官网 .中文文档  离线文档:PDF 文件 . PDF 文件 GitBook 版 .ePUB 文件  ...

  2. 转:RSA算法原理说明

    转:http://www.joenchen.com/archives/979 RSA算法可以说在我们使用计算机的每一方面都在发挥着作用, EXE文件的签名算法用的是SHA1 + RSA. 我们每天登陆 ...

  3. HDU2089 ------不要62(数位dp)

    不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  4. Android常用到的一些事件

    1:查看是否有存储卡插入 String status=Environment.getExternalStorageState(); if(status.equals(Enviroment.MEDIA_ ...

  5. 使用System.getProperty方法,如何配置JVM系统属性 (转载)

    很多时候需要在项目中读取外部属性文件,用到了System.getProperty("")方法.这个方法需要配置JVM系统属性,那么如何配置呢? 那就是使用java -D 配置系统属 ...

  6. CA证书服务器从2003迁移到2008 R2!

    1.在源 CA 服务器中备份相应的 CA :

  7. edge中断分析

    眼下正在调试msix中断,在測试过程中发现会概率性的丢失中断.Msix中断默认是edge触发的中断,edge触发的中断是在中断相应pin发生电平信号跳变的时候,会发出一个中断请求. 由于跳变是一瞬间的 ...

  8. cookie 封装

    1.代码 ;(function (factory) { var registeredInModuleLoader; if (typeof define === 'function' && ...

  9. DBMS_METADATA中使用SESSION_TRANSFORM过滤不想获取的DDL

    我们一般使用dbms_metadata.get_ddl获取对象的ddl的时候,有时会获取一些其它额外的信息,比如当你想获取表的创建语句的时候,你会得到表的约束信息,这个信息可能是你不想要的,那么就能够 ...

  10. [Done]java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

    java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed ...