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 ...
随机推荐
- SVM初学
一. 一点基础数学知识 如今硕士都快毕业了,反而将自己的很多数学知识忘的几乎相同了.所以.如今决心再捡起来.以补齐自己的数学短板.为以后的研究做好铺垫吧.如今结合自己学习SVM. ...
- VB开发ActiveX控件的一些记录
注意,下面很多语句的用法,不能放在Private Sub UserControl_Initialize()里使用,要放在Private Sub UserControl_InitProperties() ...
- javascript实现浏览器窗口传递参数
a.html <html> <head> <title>主页面</title> <script language="javascript ...
- sql表值参数
using System;using System.Collections;using System.Collections.Specialized;using System.Data;using S ...
- 如何利用WebClient模拟登陆CSRF控制的网站
一般我们都是利用WebRequest这个类来向服务器进行数据的POST,不过很多情况下相应的服务器都有验证,看你是不是登陆,是不是来自同一个域,这些都简单,我们可以更改其属性来达到欺骗服务器.不过如果 ...
- [AngularJS] Angular 1.3 $submitted for Form in Angular
AngularJS 1.3 add $submitted for form, so you can use $submitted to track whether the submit event ...
- openstack horizon CSS 离线 改动
Openstack horizon 的CSS主要保存在几个文件夹中,各自是horizon/static/dashboard/scss;horizon/openstack_dashboard/stati ...
- RaceWeb介绍(7):由500强公司数据高速生成百度地图——生成坐标字段及坐标数据
接上篇. 一.生成X坐标.Y坐标两个字段. 我们须要为每一个公司建立X坐标和Y坐标字段,用来保存XY坐标. 既然为了突出"快",这一步就有程序来完毕吧. 右键单击"世界5 ...
- 关于UbuntuMate的两个问题点:SSH问题处理与自启动项配置
一.SSH连接报错问题 ssh到某台机器时候,存在如下报错: /usr/bin/xauth: timeout in locking authority file /home/sam/.Xauthori ...
- es5||es6 - array
导航目录 /** * javascript - array * * ES5: * join() * push() * pop() * shift() * unshift() * sort() * re ...