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;
}
CHero的更多相关文章
- LUA类
cpp_object_map = {}setmetatable(cpp_object_map, { __mode = "kv" }) local search_basesearch ...
- C# 事件编程在游戏开发的应用
2D碰撞检测:http://wenku.baidu.com/view/45544cfcfab069dc50220145.html 1.Action System.Action 等于快捷创建一个委托 2 ...
- #define 的一些用法 以及 迭代器的 [] 与 find()函数的区别
#include "stdafx.h" #include <map> #include <string> #include <iostream> ...
- LUA使用虚函数与使用回调函数
------------------虚函数overload-------------------------- --回调:寻路中格子坐标改变 CHero.OnSearchToCellsChange = ...
- C++ 一篇搞懂多态的实现原理
虚函数和多态 01 虚函数 在类的定义中,前面有 virtual 关键字的成员函数称为虚函数: virtual 关键字只用在类定义里的函数声明中,写函数体时不用. class Base { virtu ...
随机推荐
- Openshift 3.11和LDAP的集成
1. OpenLDAP的安装 只记录主要步骤,详细可参考 https://access.redhat.com/solutions/2484371 # yum install -y openldap o ...
- 6)Linux程序设计入门--消息管理
)Linux程序设计入门--消息管理 前言:Linux下的进程通信(IPC) Linux下的进程通信(IPC) POSIX无名信号量 System V信号量 System V消息队列 System V ...
- Guava API - FluentIterable Predicate Function Odering Range Splitter
这写API可解决的问题 1. 集合元素的过滤 - FluentIterable Predicate Range Function 1) 先说Predicate<T>,这个相当与一个过滤原则 ...
- 解决引用openssl静态库libcrypto.a和libssl.a出现undefined reference to错误的问题
最近在做使用openssl链接http和https的项目,编译时出现以下问题. /usr/local/openssl/lib/libcrypto.a(async.o): In function `as ...
- iOS:上线的基本流程
1.创建唯一标书符App ID 首先打开开发者网站,进入证书页面,我们点击Identifiers下边App IDs选项,然后点击右上角加号,如图: 2.申请发布证书 我们点击Certificates下 ...
- 如何快速把安卓应用移植到BlackBerry 10上
如何快速把安卓应用移植到BlackBerry 10上 相关博客: BlackBerry相关文档 http://developer.blackberry.com/android/documentatio ...
- SQL Server 2008新特性——策略管理
策略管理是SQL Server 2008中的一个新特性,用于管理数据库实例.数据库以及数据库对象的各种属性.策略管理在SSMS的对象资源管理器数据库实例下的“管理”节点下,如图: 从图中可以看到,策略 ...
- 通过Spring配置文件中bean中的property赋值
基本数据类型赋值-通过spring配置文件中bean中的property 扩展-以此方式可以通过配置为连接数据的属性赋值 1.如果是基本数据类型,可以通过setter方法为对象中的属性设置初始值,应用 ...
- windows10 phantomjs 安装和使用
1.下载phantomjs和 Casper phantomjs下载地址:http://phantomjs.org/download.html Casper下载地址:http://casperjs.or ...
- Maven核心概念之仓库,生命周期与插件
宏观图 一.仓库 统一存储全部Maven项目共享的构建的位置就是仓库. 仓库分为本地仓库和远程仓库.远程仓库又分为中央仓库(中央仓库是Maven核心自带的远程仓库),伺服(还有一种特殊的远程仓库,为节 ...