axmol/extensions/cocostudio/WidgetReader/NodeReaderProtocol.h

144 lines
5.5 KiB
C
Raw Normal View History

2015-06-17 13:16:06 +08:00
/****************************************************************************
2014-11-21 15:15:38 +08:00
Copyright (c) 2014 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __cocos2d_libs__NodeReaderProtocol__
#define __cocos2d_libs__NodeReaderProtocol__
#include "ui/GUIDefine.h"
#include "cocostudio/CocosStudioExport.h"
#include "cocostudio/CocosStudioExtension.h"
2019-11-24 23:15:56 +08:00
#include "pugixml/pugixml_imp.hpp"
#include "pugixml/pugiext.hpp"
2014-11-21 15:15:38 +08:00
namespace flatbuffers
{
class FlatBufferBuilder;
template<typename T> struct Offset;
class Table;
2019-11-24 23:15:56 +08:00
struct ResourceData; // x-studio365 spec, csb batch load support, assets hook functions.
2014-11-21 15:15:38 +08:00
}
namespace cocos2d
{
class Node;
}
namespace cocostudio
{
2019-11-24 23:15:56 +08:00
class CC_STUDIOP_DLL NodeReaderProtocol
2014-11-21 15:15:38 +08:00
{
public:
NodeReaderProtocol() {};
virtual ~NodeReaderProtocol() {};
2019-11-24 23:15:56 +08:00
virtual void setCurrentCustomClassName(const char* className) {};
virtual flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(pugi::xml_node objectData,
2014-11-21 15:15:38 +08:00
flatbuffers::FlatBufferBuilder* builder) = 0;
virtual void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* nodeOptions) = 0;
virtual cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* nodeOptions) = 0;
};
}
2019-11-24 23:15:56 +08:00
// x-studio365 spec, csb batch load support, assets hook functions.
namespace cocostudio
{
class Armature;
namespace timeline {
class SkeletonNode;
class BoneNode;
}
};
namespace cocos2d {
// builtin ui predecl
class Sprite;
class ParticleSystemQuad;
namespace ui {
class ImageView;
class Button;
class CheckBox;
class Slider;
class LoadingBar;
class Text;
class TextField;
class TextAtlas;
class TextBMFont;
class Layout;
class ScrollView;
class ListView;
class PageView;
class Widget;
}
typedef void(*APP_LOGERROR_FUNC)(const char* pszFormat, ...);
namespace wext {
// engine extends APIs
CC_DLL extern APP_LOGERROR_FUNC getAppErrorLogFunc();
CC_STUDIOP_DLL extern void(*onLoadSpriteFramesWithFile)(std::string& file);
CC_STUDIOP_DLL extern cocos2d::ResourceData makeResourceData(const flatbuffers::ResourceData* data);
CC_STUDIOP_DLL extern cocos2d::ResourceData makeResourceData(const std::string& path, int type = 0);
CC_STUDIOP_DLL extern cocos2d::ResourceData makeResourceData(std::string&& path, int type = 0);
CC_STUDIOP_DLL extern void resetReaderAllHooks();
/// Assets Hooks
CC_STUDIOP_DLL extern bool(*onBeforeLoadObjectAsset)(cocos2d::Node*, cocos2d::ResourceData& assets, int index/*= 0*/);
CC_STUDIOP_DLL extern bool(*onAfterLoadObjectAsset)(cocos2d::Node*, cocos2d::ResourceData& assets, int index/*= 0*/);
// Object creator Hooks
CC_STUDIOP_DLL extern cocos2d::Node*(*aNode)();
CC_STUDIOP_DLL extern cocos2d::ui::Widget*(*aWidget)();
CC_STUDIOP_DLL extern cocos2d::Sprite*(*aSprite)();
CC_STUDIOP_DLL extern cocos2d::ui::ImageView*(*aImageView)();
CC_STUDIOP_DLL extern cocos2d::ui::Button*(*aButton)();
CC_STUDIOP_DLL extern cocos2d::ui::CheckBox*(*aCheckBox)();
CC_STUDIOP_DLL extern cocos2d::ui::Slider*(*aSlider)();
CC_STUDIOP_DLL extern cocos2d::ui::LoadingBar*(*aLoadingBar)();
CC_STUDIOP_DLL extern cocos2d::ui::Text*(*aText)();
CC_STUDIOP_DLL extern cocos2d::ui::TextField*(*aTextField)();
CC_STUDIOP_DLL extern cocos2d::ui::TextAtlas*(*aTextAtlas)();
CC_STUDIOP_DLL extern cocos2d::ui::TextBMFont*(*aTextBMFont)();
CC_STUDIOP_DLL extern cocos2d::ui::Layout*(*aLayout)();
CC_STUDIOP_DLL extern cocos2d::ui::ScrollView*(*aScrollView)();
CC_STUDIOP_DLL extern cocos2d::ui::ListView*(*aListView)();
CC_STUDIOP_DLL extern cocos2d::ui::PageView*(*aPageView)();
CC_STUDIOP_DLL extern cocos2d::Node*(*aArmatureNode)();
CC_STUDIOP_DLL extern cocostudio::timeline::SkeletonNode*(*aSkeletonNode)();
CC_STUDIOP_DLL extern cocostudio::timeline::BoneNode*(*aBoneNode)();
CC_STUDIOP_DLL extern cocos2d::ParticleSystemQuad*(*aParticleSystemQuad)(const std::string&);
CC_STUDIOP_DLL extern cocos2d::Node*(*aNestingNode)(std::string);
};
};
2014-11-21 15:15:38 +08:00
#endif /* defined(__cocos2d_libs__NodeReaderProtocol__) */