• 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[0]);
        for(int i = 0; i < nSize; i++)
        {
            m_pAttribute->mapAchievementComplete[i] = false;
        }
    
        nSize = sizeof(GAMECENTER_ID_PerfectToComplete) / sizeof(GAMECENTER_ID_PerfectToComplete[0]);
        for (int i = 0; i < nSize; i++)
        {
            m_pAttribute->mapAchievementPerfectToComplete[i] = false;
        }
    
        for (int i = 0; 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;
    }
  • 相关阅读:
    Sql诊断之Explain
    Cenos7安装docker环境以及docker-compose
    uniapp苹果内购获取不到苹果的iap支付通道
    iOS云打包如何设置通用链接等Capabilities配置
    iOS应用id,套装id,appid,BundleID申请教程
    利用Appuploader在window上申请IOS开发所需要的证书及描述文件
    浅析GET和POST请求的本质区别以及关于get请求的长度限制到底是多少的问题
    iOS苹果开发者组织账号申请时的坑
    apache开源项目--HIVE
    [Unit testing Java] Unit testing Junit Controller
  • 原文地址:https://www.cnblogs.com/newlist/p/3163539.html
Copyright © 2020-2023  润新知