utils/CCDataReaderHelper

#ifndef __CCDATAREADERHELPER_H__

#define __CCDATAREADERHELPER_H__


#include "CCArmatureDefine.h"

#include "../datas/CCDatas.h"

#include "../utils/CCConstValue.h"

#include "../CCArmature.h"

#include "../external_tool/Json/CSContentJsonDictionary.h"


namespace tinyxml2 { class XMLElement; }


NS_CC_EXT_BEGIN



class  CCDataReaderHelper

{


public:

    /**

     * Scale the position data, used for multiresolution adapter

     * It won't effect the data already read.

     */

    static void setPositionReadScale(float scale);

    static float getPositionReadScale();


    static void addDataFromFile(const char *filePath);


    static void clear();

public:


    /**

     * Translate XML export from Dragon CCBone flash tool to datas, and save them.

     * When you add a new xml, the data already saved will be keeped.

     *

     * @param xmlPath Path of xml file

     */

    static void addDataFromXML(const char *xmlPath);


    /**

     * Translate XML export from Dragon CCBone flash tool to datas, and save them.

     * When you add a new xml, the data already saved will be keeped.

     *

     * @param xmlPath Path of pak file

     */

    static void addDataFromXMLPak(const char *xmlPakPath);


    /**

     * Translate XML export from Dragon CCBone flash tool to datas, and save them.

     * When you add a new xml, the data already saved will be keeped.

     *

     * @param xmlPath The cache of the xml

     */

    static void addDataFromCache(const char *pFileContent);




    /**

     * Decode CCArmature Datas from xml export from Dragon CCBone flash tool

     */

    static CCArmatureData *decodeArmature(tinyxml2::XMLElement *armatureXML);

    static CCBoneData *decodeBone(tinyxml2::XMLElement *boneXML, tinyxml2::XMLElement *parentXML);

    static CCDisplayData *decodeBoneDisplay(tinyxml2::XMLElement *displayXML);



    /**

     * Decode CCArmatureAnimation Datas from xml export from Dragon CCBone flash tool

     */

    static CCAnimationData *decodeAnimation(tinyxml2::XMLElement *animationXML);

    static CCMovementData *decodeMovement(tinyxml2::XMLElement *movementXML, CCArmatureData *armatureData);

    static CCMovementBoneData *decodeMovementBone(tinyxml2::XMLElement *movBoneXml, tinyxml2::XMLElement *parentXml, CCBoneData *boneData);

    static CCFrameData *decodeFrame(tinyxml2::XMLElement *frameXML, tinyxml2::XMLElement *parentFrameXml, CCBoneData *boneData);



    /**

     * Decode Texture Datas from xml export from Dragon CCBone flash tool

     */

    static CCTextureData *decodeTexture(tinyxml2::XMLElement *textureXML);


    /**

     * Decode Contour Datas from xml export from Dragon CCBone flash tool

     */

    static CCContourData *decodeContour(tinyxml2::XMLElement *contourXML);


public:


    static void addDataFromJson(const char *filePath);

    static void addDataFromJsonCache(const char *fileContent);


    static CCArmatureData *decodeArmature(cs::CSJsonDictionary &json);

    static CCBoneData *decodeBone(cs::CSJsonDictionary &json);

    static CCDisplayData *decodeBoneDisplay(cs::CSJsonDictionary &json);


    static CCAnimationData *decodeAnimation(cs::CSJsonDictionary &json);

    static CCMovementData *decodeMovement(cs::CSJsonDictionary &json);

    static CCMovementBoneData *decodeMovementBone(cs::CSJsonDictionary &json);

    static CCFrameData *decodeFrame(cs::CSJsonDictionary &json);


    static CCTextureData *decodeTexture(cs::CSJsonDictionary &json);


    static CCContourData *decodeContour(cs::CSJsonDictionary &json);


    static void decodeNode(CCBaseData *node, cs::CSJsonDictionary &json);

};


NS_CC_EXT_END


#endif /*__CCDATAREADERHELPER_H__*/


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值