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;
    }
  • 相关阅读:
    Big Data 應用:第二季(4~6月)台湾地区Game APP 变动分布趋势图
    大数据应用:五大地区喜新厌旧游戏APP类别之比较与分析
    Big Data應用:以"玩家意見"之數據分析來探討何謂"健康型線上遊戲"(上)
    Example:PanGu分詞系統-批次匯入新詞
    C#数据类型02--结构
    C#数据类型01--数组
    C#基础知识点
    陌生Layout属性
    LinearLayout(线性布局)
    Android--入门常识
  • 原文地址:https://www.cnblogs.com/newlist/p/3163539.html
Copyright © 2011-2022 走看看