-
-
Save xiebaochun/835508ffa63907c1cca3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "CXmlStream.h" | |
CXmlStream::CXmlStream(const char* dicFilename) | |
{ | |
this->m_dictionary = CCDictionary::createWithContentsOfFile(dicFilename); | |
} | |
CXmlStream::~CXmlStream() | |
{ | |
} | |
const char* CXmlStream::GetStringByKey(const char* keyword) | |
{ | |
return ((CCString*)(this->m_dictionary->objectForKey(keyword)))->m_sString.c_str(); | |
} | |
const char* CXmlStream::GetStringByKeyFromFile(const char* dicFilename, const char* keyword) | |
{ | |
CCDictionary *dictionary = CCDictionary::createWithContentsOfFile(dicFilename); | |
return ((CCString*)dictionary->objectForKey(keyword))->m_sString.c_str(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __CXMLSTREAM_H__ | |
#define __CXMLSTREAM_H__ | |
#include "cocos2d.h" | |
USING_NS_CC; | |
class CXmlStream | |
{ | |
private: | |
CCDictionary* m_dictionary; | |
public: | |
CXmlStream(const char* dicFilename); | |
~CXmlStream(); | |
const char* GetStringByKey(const char* keyword); | |
static const char* GetStringByKeyFromFile(const char* dicFilename, const char* keyword); | |
}; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dict> | |
<key>HomeScene</key> | |
<string>首頁</string> | |
<key>MainScene</key> | |
<string>主頁</string> | |
<key>BookScene</key> | |
<string>百科</string> | |
<key>GameScene</key> | |
<string>遊戲</string> | |
<key>AnimScene</key> | |
<string>動畫</string> | |
<key>FOgameScene</key> | |
<string>力的作用</string> | |
<key>FOgameScene_Book</key> | |
<string>力的作用 - 百科</string> | |
<key>FOgameScene_Game</key> | |
<string>力的作用 - 遊戲</string> | |
<key>FOgameScene_Anim</key> | |
<string>力的作用 - 動畫</string> | |
<key>GVScene</key> | |
<string>地球引力</string> | |
<key>GVScene_Book</key> | |
<string>地球引力 - 百科</string> | |
<key>GVScene_Game</key> | |
<string>地球引力 - 遊戲</string> | |
<key>GVScene_Anim</key> | |
<string>地球引力 - 動畫</string> | |
</dict> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment