zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    HDU1443_Joseph_约瑟环
    HDU1568_求fibonacci的前四位
    HDU3368_翻转棋
    HDU1134_catalan_大数运算
    HDU1032_The 3n+1_数学题
    HDU2674_N!模2009
    HDU2067_小兔的棋盘_catalan_递推
    文件读写操作inputStream转为byte[] , 将InputStream写入本地文件
    JVM堆内存调优
    Java使用 POI 操作Excel
  • 原文地址:https://www.cnblogs.com/newlist/p/3163539.html
Copyright © 2011-2022 走看看