cocos2d-x  3.4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSLoader Class Reference

#include <CSLoader.h>

Public Member Functions

 CSLoader ()
void purge ()
void init ()
cocos2d::NodecreateNodeFromJson (const std::string &filename)
cocos2d::NodeloadNodeWithFile (const std::string &fileName)
cocos2d::NodeloadNodeWithContent (const std::string &content)
void setRecordJsonPath (bool record)
bool isRecordJsonPath () const
void setJsonPath (std::string jsonPath)
std::string getJsonPath () const
cocos2d::NodecreateNodeWithFlatBuffersFile (const std::string &filename)
cocos2d::NodenodeWithFlatBuffersFile (const std::string &fileName)
cocos2d::NodenodeWithFlatBuffers (const flatbuffers::NodeTree *nodetree)
bool bindCallback (const std::string &callbackName, const std::string &callbackType, cocos2d::ui::Widget *sender, cocos2d::Node *handler)
void registReaderObject (const std::string &className, ObjectFactory::Instance ins)
cocos2d::NodecreateNodeWithFlatBuffersForSimulator (const std::string &filename)
cocos2d::NodenodeWithFlatBuffersForSimulator (const flatbuffers::NodeTree *nodetree)

Static Public Member Functions

static CSLoadergetInstance ()
static void destroyInstance ()
static cocos2d::NodecreateNode (const std::string &filename)
static
cocostudio::timeline::ActionTimeline * 
createTimeline (const std::string &filename)

Protected Types

typedef std::function
< cocos2d::Node *(const
rapidjson::Value &json)> 
NodeCreateFunc
typedef std::pair< std::string,
NodeCreateFunc
Pair
typedef std::function
< cocos2d::Component *(const
rapidjson::Value &json)> 
ComponentCreateFunc
typedef std::pair< std::string,
ComponentCreateFunc
ComponentPair

Protected Member Functions

cocos2d::NodeloadNode (const rapidjson::Value &json)
void locateNodeWithMulresPosition (cocos2d::Node *node, const rapidjson::Value &json)
void initNode (cocos2d::Node *node, const rapidjson::Value &json)
cocos2d::NodeloadSimpleNode (const rapidjson::Value &json)
cocos2d::NodeloadSubGraph (const rapidjson::Value &json)
cocos2d::NodeloadSprite (const rapidjson::Value &json)
cocos2d::NodeloadParticle (const rapidjson::Value &json)
cocos2d::NodeloadTMXTiledMap (const rapidjson::Value &json)
cocos2d::NodeloadWidget (const rapidjson::Value &json)
cocos2d::ComponentloadComponent (const rapidjson::Value &json)
cocos2d::ComponentloadComAudio (const rapidjson::Value &json)
bool isWidget (const std::string &type)
bool isCustomWidget (const std::string &type)
std::string getGUIClassName (const std::string &name)
std::string getWidgetReaderClassName (cocos2d::ui::Widget *widget)

Protected Attributes

std::unordered_map
< std::string, NodeCreateFunc
_funcs
std::unordered_map
< std::string,
ComponentCreateFunc
_componentFuncs
bool _recordJsonPath
std::string _jsonPath
std::string _monoCocos2dxVersion
Node_rootNode
std::string _csBuildID

Member Typedef Documentation

typedef std::function
<cocos2d::Component*(const
rapidjson::Value& json)>
ComponentCreateFunc
protected
typedef std::pair<std::string,
ComponentCreateFunc>
ComponentPair
protected
typedef std::function
<cocos2d::Node*(const
rapidjson::Value& json)>
NodeCreateFunc
protected
typedef std::pair<std::string,
NodeCreateFunc> Pair
protected

Constructor & Destructor Documentation

CSLoader ( )

Member Function Documentation

bool bindCallback ( const std::string &  callbackName,
const std::string &  callbackType,
cocos2d::ui::Widget sender,
cocos2d::Node handler 
)
static cocos2d::Node* createNode ( const std::string &  filename)
static
cocos2d::Node* createNodeFromJson ( const std::string &  filename)
cocos2d::Node*
createNodeWithFlatBuffersFile
( const std::string &  filename)
cocos2d::Node*
createNodeWithFlatBuffersForSimulator
( const std::string &  filename)
static
cocostudio::timeline::ActionTimeline*
createTimeline
( const std::string &  filename)
static
static void destroyInstance ( )
static
std::string getGUIClassName ( const std::string &  name)
protected
static CSLoader* getInstance ( )
static
std::string getJsonPath ( ) const
inline
std::string
getWidgetReaderClassName
( cocos2d::ui::Widget widget)
protected
void init ( )
void initNode ( cocos2d::Node node,
const rapidjson::Value &  json 
)
protected
bool isCustomWidget ( const std::string &  type)
protected
bool isRecordJsonPath ( ) const
inline
bool isWidget ( const std::string &  type)
protected
cocos2d::Component* loadComAudio ( const rapidjson::Value &  json)
protected
cocos2d::Component* loadComponent ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadNode ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadNodeWithContent ( const std::string &  content)
cocos2d::Node* loadNodeWithFile ( const std::string &  fileName)
cocos2d::Node* loadParticle ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadSimpleNode ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadSprite ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadSubGraph ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadTMXTiledMap ( const rapidjson::Value &  json)
protected
cocos2d::Node* loadWidget ( const rapidjson::Value &  json)
protected
void locateNodeWithMulresPosition ( cocos2d::Node node,
const rapidjson::Value &  json 
)
protected
cocos2d::Node* nodeWithFlatBuffers ( const flatbuffers::NodeTree nodetree)
cocos2d::Node*
nodeWithFlatBuffersFile
( const std::string &  fileName)
cocos2d::Node*
nodeWithFlatBuffersForSimulator
( const flatbuffers::NodeTree nodetree)
void purge ( )
void registReaderObject ( const std::string &  className,
ObjectFactory::Instance  ins 
)
void setJsonPath ( std::string  jsonPath)
inline
void setRecordJsonPath ( bool  record)
inline

Member Data Documentation

std::unordered_map<std::string,
ComponentCreateFunc>
_componentFuncs
protected
std::string _csBuildID
protected
std::unordered_map<std::string,
NodeCreateFunc> _funcs
protected
std::string _jsonPath
protected
std::string _monoCocos2dxVersion
protected
bool _recordJsonPath
protected
Node* _rootNode
protected

The documentation for this class was generated from the following file: