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 ...
随机推荐
- 从两个TIMESTAMP中获取时间差(秒)
When you subtract two variables of type TIMESTAMP, you get an INTERVAL DAY TO SECOND which includes ...
- 开始学习深度学习和循环神经网络Some starting points for deep learning and RNNs
Bengio, LeCun, Jordan, Hinton, Schmidhuber, Ng, de Freitas and OpenAI have done reddit AMA's. These ...
- 图像处理标准图像lena的故事图The Lenna Story behind image processing
The Lenna Story - www.lenna.org Imaging Experts Meet Lenna in Person Yes, it's true! Lenna attende ...
- Python学习(六)模块 —— 包
Python 包 包 定义 为了组织好模块,会将多个模块分为包.Python 处理包也是相当方便的.简单来说,包就是文件夹,但该文件夹下必须存在 __init__.py 文件. 常见的包结构如下:
- <%@ include> <jsp:include>
1. <%@ include file=”relativeURI” %> 这个效果是将引入的文件内容直接加入当前JSP然后再编译,会造成的问题就是如果引入的页面中也写了head,conte ...
- Spark源码分析:多种部署方式之间的区别与联系(转)
原文链接:Spark源码分析:多种部署方式之间的区别与联系(1) 从官方的文档我们可以知道,Spark的部署方式有很多种:local.Standalone.Mesos.YARN.....不同部署方式的 ...
- tomcat(5)servlet容器
[0]README 0.0)本文部分文字描写叙述转自:"深入剖析tomcat",旨在学习 tomcat(5)servlet容器 的基础知识. 0.1)intro to servle ...
- 【Python】Django auth 修改密码如何实现?
使用示例1.创建用户>>> from django.contrib.auth.models import User>>> user = User.objects.c ...
- 最佳实践扩展Windows窗体DataGridView控件 .net 4.5 附示例代码
Windows窗体DataGridView控件的性能调优.net 4.5 在处理大量数据时, DataGridView 控制可以消耗大量的内存开销,除非你仔细地使用它. 在客户有限的内存,你可以避 ...
- 分享六个基于Bootstrap的实用开发教程和模板演示
关于Bootstrap,相信大家一定不陌生,它已经成为现在主流产业的一个重要工具,Bootstrap提供了优雅的HTML和CSS规范,它基于jQuery框架开发的,它在jQuery框架的基础上进行了更 ...