mirror of https://github.com/axmolengine/axmol.git
armature node reader done (projs incompleted)
This commit is contained in:
parent
92584bbc7f
commit
62c5df2d9d
|
@ -325,6 +325,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\ArmatureNodeReader.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCActionFrame.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCActionFrameEasing.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocostudio\CCActionManagerEx.cpp" />
|
||||
|
@ -724,6 +725,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimelineMacro.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CSLoader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\ArmatureNodeReader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CCActionFrame.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CCActionFrameEasing.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CCActionManagerEx.h" />
|
||||
|
@ -758,6 +760,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CocosStudioExport.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CSArmatureNode_generated.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" />
|
||||
<ClInclude Include="..\editor-support\cocostudio\FlatBuffersSerialize.h" />
|
||||
|
|
|
@ -241,6 +241,9 @@
|
|||
<Filter Include="base\allocator">
|
||||
<UniqueIdentifier>{92ff4e66-3943-47da-a439-c8f182bb871a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="cocostudio\reader\WidgetReader\ArmatureNode">
|
||||
<UniqueIdentifier>{e1848cce-b225-42c4-bb6e-6430b6da123b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
|
||||
|
@ -1301,6 +1304,9 @@
|
|||
<ClCompile Include="..\base\allocator\CCAllocatorGlobalNewDelete.cpp">
|
||||
<Filter>base\allocator</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\editor-support\cocostudio\ArmatureNodeReader.cpp">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNode</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -2544,6 +2550,12 @@
|
|||
<ClInclude Include="..\base\allocator\CCAllocatorStrategyPool.h">
|
||||
<Filter>base\allocator</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\ArmatureNodeReader.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNode</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocostudio\CSArmatureNode_generated.h">
|
||||
<Filter>cocostudio\reader\WidgetReader\ArmatureNode</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -786,12 +786,23 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
|
|||
{
|
||||
node = createNodeWithFlatBuffersFile(filePath);
|
||||
reader->setPropsWithFlatBuffers(node, options->data());
|
||||
|
||||
|
||||
bool isloop = projectNodeOptions->isLoop();
|
||||
bool isautoplay = projectNodeOptions->isAutoPlay();
|
||||
|
||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
||||
if(action)
|
||||
if (action)
|
||||
{
|
||||
node->runAction(action);
|
||||
action->gotoFrameAndPlay(0);
|
||||
if (isautoplay)
|
||||
{
|
||||
action->gotoFrameAndPlay(0, isloop);
|
||||
}
|
||||
else
|
||||
{
|
||||
action->gotoFrameAndPause(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1112,12 +1123,22 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod
|
|||
{
|
||||
node = createNodeWithFlatBuffersForSimulator(filePath);
|
||||
reader->setPropsWithFlatBuffers(node, options->data());
|
||||
|
||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath);
|
||||
|
||||
bool isloop = projectNodeOptions->isLoop();
|
||||
bool isautoplay = projectNodeOptions->isAutoPlay();
|
||||
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
|
||||
if (action)
|
||||
{
|
||||
node->runAction(action);
|
||||
action->gotoFrameAndPlay(0);
|
||||
if (isautoplay)
|
||||
{
|
||||
action->gotoFrameAndPlay(0, isloop);
|
||||
}
|
||||
else
|
||||
{
|
||||
action->gotoFrameAndPause(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
#include "tinyxml2/tinyxml2.h"
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "cocostudio/WidgetReader/NodeReader/NodeReader.h"
|
||||
#include "cocostudio/CSParseBinary_generated.h"
|
||||
#include "CSArmatureNode_generated.h"
|
||||
#include "cocostudio/ArmatureNodeReader.h"
|
||||
#include "cocostudio/CCArmature.h"
|
||||
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace cocostudio;
|
||||
using namespace flatbuffers;
|
||||
|
||||
IMPLEMENT_CLASS_NODE_READER_INFO(ArmatureNodeReader)
|
||||
|
||||
ArmatureNodeReader::ArmatureNodeReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ArmatureNodeReader::~ArmatureNodeReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static ArmatureNodeReader* _instanceArmatureNodeReader = nullptr;
|
||||
|
||||
ArmatureNodeReader* ArmatureNodeReader::getInstance()
|
||||
{
|
||||
if (_instanceArmatureNodeReader == nullptr)
|
||||
{
|
||||
_instanceArmatureNodeReader = new (std::nothrow) ArmatureNodeReader();
|
||||
}
|
||||
return _instanceArmatureNodeReader;
|
||||
}
|
||||
|
||||
Offset<Table> ArmatureNodeReader::createOptionsWithFlatBuffers(const tinyxml2::XMLElement *objectData,
|
||||
flatbuffers::FlatBufferBuilder *builder)
|
||||
{
|
||||
|
||||
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
|
||||
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||
|
||||
bool isloop = false;
|
||||
bool isAutoPlay = false;
|
||||
std::string currentAnimationName = "";
|
||||
|
||||
int type = 0;
|
||||
std::string path = "";
|
||||
|
||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||
while (attribute)
|
||||
{
|
||||
std::string attriname = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
|
||||
if (attriname == "IsLoop")
|
||||
{
|
||||
isloop = (value == "True") ? true : false;
|
||||
}
|
||||
else if (attriname == "IsAutoPlay")
|
||||
{
|
||||
isAutoPlay = (value == "True") ? true : false;
|
||||
}
|
||||
else if (attriname == "CurrentAnimationName")
|
||||
{
|
||||
currentAnimationName = value;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||
while (child)
|
||||
{
|
||||
std::string attriname = child->Name();
|
||||
if (attriname == "FileData")
|
||||
{
|
||||
attribute = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
{
|
||||
attriname = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
|
||||
if (attriname == "Type")
|
||||
{
|
||||
type = 0;
|
||||
}
|
||||
else if (attriname == "Path")
|
||||
{
|
||||
path = value;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
}
|
||||
|
||||
child = child->NextSiblingElement();
|
||||
}
|
||||
|
||||
auto options = CreateCSArmatureNodeOption(*builder,
|
||||
nodeOptions,
|
||||
CreateResourceItemData(*builder,
|
||||
type,
|
||||
builder->CreateString(path)),
|
||||
isloop,
|
||||
isAutoPlay,
|
||||
builder->CreateString(currentAnimationName));
|
||||
|
||||
return *(Offset<Table>*)(&options);
|
||||
}
|
||||
|
||||
void ArmatureNodeReader::setPropsWithFlatBuffers(cocos2d::Node *node,
|
||||
const flatbuffers::Table *nodeOptions)
|
||||
{
|
||||
|
||||
auto* custom = static_cast<CCArmature*>(node);
|
||||
auto options = (flatbuffers::CSArmatureNodeOption*)nodeOptions;
|
||||
auto reader = ArmatureNodeReader::getInstance();
|
||||
|
||||
std::string filepath(options->fileData()->path()->c_str());
|
||||
ArmatureDataManager::getInstance()->addArmatureFileInfo(FileUtils::getInstance()->fullPathForFilename(filepath));
|
||||
custom->init(getArmatureName(filepath));
|
||||
if (options->isAutoPlay())
|
||||
custom->getAnimation()->play(options->currentAnimationName()->c_str(), -1, options->isLoop());
|
||||
else
|
||||
custom->getAnimation()->setIsPlaying(false);
|
||||
}
|
||||
|
||||
cocos2d::Node* ArmatureNodeReader::createNodeWithFlatBuffers(const flatbuffers::Table *nodeOptions)
|
||||
{
|
||||
auto node = CCArmature::create();
|
||||
|
||||
// self
|
||||
auto options = (flatbuffers::CSArmatureNodeOption*)nodeOptions;
|
||||
setPropsWithFlatBuffers(node, (Table*)options);
|
||||
|
||||
// super node
|
||||
auto NodeReader = NodeReader::getInstance();
|
||||
NodeReader->setPropsWithFlatBuffers(node, (Table*)options->nodeOptions());
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::string ArmatureNodeReader::getArmatureName(const std::string& exporJsonPath)
|
||||
{
|
||||
//FileUtils.getFileData(exporJsonPath, "r", size) // need read armature name in exportJsonPath
|
||||
int end = exporJsonPath.find_last_of(".");
|
||||
int start = exporJsonPath.find_last_of("\\") + 1;
|
||||
int start1 = exporJsonPath.find_last_of("/") + 1;
|
||||
if (start < start1)
|
||||
start = start1;
|
||||
|
||||
if (start == -1)
|
||||
start = 0;
|
||||
return exporJsonPath.substr(start, end - start);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
|
||||
#ifndef __ARMATURENODEREADER_H_
|
||||
#define __ARMATURENODEREADER_H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "cocostudio/FlatBuffersSerialize.h"
|
||||
#include "cocostudio/WidgetReader/NodeReaderProtocol.h"
|
||||
#include "cocostudio/WidgetReader/NodeReaderDefine.h"
|
||||
|
||||
|
||||
/****************************************
|
||||
* reader of CSArmatureNode
|
||||
* @param register reader before use it:
|
||||
CSLoader* instance = CSLoader::getInstance();
|
||||
instance->registReaderObject("ArmatureNodeReader", (ObjectFactory::Instance)CustomSpriteReader::getInstance);
|
||||
*@param Reader's name must be CLASSNAME#Reader, CLASSNAME is the dataobject's prefix: CLASSNAME#ObjectData
|
||||
*
|
||||
*
|
||||
*****************************************/
|
||||
class ArmatureNodeReader : public cocos2d::Ref, public cocostudio::NodeReaderProtocol
|
||||
{
|
||||
DECLARE_CLASS_NODE_READER_INFO
|
||||
|
||||
public:
|
||||
|
||||
ArmatureNodeReader();
|
||||
~ArmatureNodeReader();
|
||||
|
||||
static ArmatureNodeReader* getInstance();
|
||||
static void purge();
|
||||
|
||||
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
|
||||
flatbuffers::FlatBufferBuilder* builder);
|
||||
void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* textBMFontOptions);
|
||||
|
||||
//CSArmatureNode
|
||||
cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* nodeOptions) override;
|
||||
private:
|
||||
std::string getArmatureName(const std::string& exporJsonPath);
|
||||
};
|
||||
|
||||
#endif /* defined(__ARMATURENODEREADER_H_) */
|
|
@ -0,0 +1,108 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_CSARMATURENODE_FLATBUFFERS_H_
|
||||
#define FLATBUFFERS_GENERATED_CSARMATURENODE_FLATBUFFERS_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
|
||||
namespace flatbuffers {
|
||||
|
||||
struct CSArmatureNodeOption;
|
||||
struct ResourceItemData;
|
||||
|
||||
|
||||
struct CSArmatureNodeOption : private flatbuffers::Table {
|
||||
const WidgetOptions *nodeOptions() const { return GetPointer<const WidgetOptions *>(4); }
|
||||
const ResourceItemData *fileData() const { return GetPointer<const ResourceItemData *>(6); }
|
||||
uint8_t isLoop() const { return GetField<uint8_t>(8, 1); }
|
||||
uint8_t isAutoPlay() const { return GetField<uint8_t>(10, 1); }
|
||||
const flatbuffers::String *currentAnimationName() const { return GetPointer<const flatbuffers::String *>(12); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* nodeOptions */) &&
|
||||
verifier.VerifyTable(nodeOptions()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* fileData */) &&
|
||||
verifier.VerifyTable(fileData()) &&
|
||||
VerifyField<uint8_t>(verifier, 8 /* isLoop */) &&
|
||||
VerifyField<uint8_t>(verifier, 10 /* isAutoPlay */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* currentAnimationName */) &&
|
||||
verifier.Verify(currentAnimationName()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct CSArmatureNodeOptionBuilder {
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_nodeOptions(flatbuffers::Offset<WidgetOptions> nodeOptions) { fbb_.AddOffset(4, nodeOptions); }
|
||||
void add_fileData(flatbuffers::Offset<ResourceItemData> fileData) { fbb_.AddOffset(6, fileData); }
|
||||
void add_isLoop(uint8_t isLoop) { fbb_.AddElement<uint8_t>(8, isLoop, 1); }
|
||||
void add_isAutoPlay(uint8_t isAutoPlay) { fbb_.AddElement<uint8_t>(10, isAutoPlay, 1); }
|
||||
void add_currentAnimationName(flatbuffers::Offset<flatbuffers::String> currentAnimationName) { fbb_.AddOffset(12, currentAnimationName); }
|
||||
CSArmatureNodeOptionBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
CSArmatureNodeOptionBuilder &operator=(const CSArmatureNodeOptionBuilder &);
|
||||
flatbuffers::Offset<CSArmatureNodeOption> Finish() {
|
||||
auto o = flatbuffers::Offset<CSArmatureNodeOption>(fbb_.EndTable(start_, 5));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<CSArmatureNodeOption> CreateCSArmatureNodeOption(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<WidgetOptions> nodeOptions = 0,
|
||||
flatbuffers::Offset<ResourceItemData> fileData = 0,
|
||||
uint8_t isLoop = 1,
|
||||
uint8_t isAutoPlay = 1,
|
||||
flatbuffers::Offset<flatbuffers::String> currentAnimationName = 0) {
|
||||
CSArmatureNodeOptionBuilder builder_(_fbb);
|
||||
builder_.add_currentAnimationName(currentAnimationName);
|
||||
builder_.add_fileData(fileData);
|
||||
builder_.add_nodeOptions(nodeOptions);
|
||||
builder_.add_isAutoPlay(isAutoPlay);
|
||||
builder_.add_isLoop(isLoop);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct ResourceItemData : private flatbuffers::Table {
|
||||
int32_t type() const { return GetField<int32_t>(4, 0); }
|
||||
const flatbuffers::String *path() const { return GetPointer<const flatbuffers::String *>(6); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, 4 /* type */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* path */) &&
|
||||
verifier.Verify(path()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct ResourceItemDataBuilder {
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_type(int32_t type) { fbb_.AddElement<int32_t>(4, type, 0); }
|
||||
void add_path(flatbuffers::Offset<flatbuffers::String> path) { fbb_.AddOffset(6, path); }
|
||||
ResourceItemDataBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
ResourceItemDataBuilder &operator=(const ResourceItemDataBuilder &);
|
||||
flatbuffers::Offset<ResourceItemData> Finish() {
|
||||
auto o = flatbuffers::Offset<ResourceItemData>(fbb_.EndTable(start_, 2));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<ResourceItemData> CreateResourceItemData(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t type = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> path = 0) {
|
||||
ResourceItemDataBuilder builder_(_fbb);
|
||||
builder_.add_path(path);
|
||||
builder_.add_type(type);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline const CSArmatureNodeOption *GetCSArmatureNodeOption(const void *buf) { return flatbuffers::GetRoot<CSArmatureNodeOption>(buf); }
|
||||
|
||||
inline bool VerifyCSArmatureNodeOptionBuffer(flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer<CSArmatureNodeOption>(); }
|
||||
|
||||
inline void FinishCSArmatureNodeOptionBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset<CSArmatureNodeOption> root) { fbb.Finish(root); }
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_CSARMATURENODE_FLATBUFFERS_H_
|
|
@ -12,6 +12,7 @@ struct CSParseBinary;
|
|||
struct NodeTree;
|
||||
struct Options;
|
||||
struct WidgetOptions;
|
||||
struct LayoutComponentTable;
|
||||
struct SingleNodeOptions;
|
||||
struct SpriteOptions;
|
||||
struct ParticleSystemOptions;
|
||||
|
@ -176,6 +177,7 @@ struct CSParseBinary : private flatbuffers::Table {
|
|||
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *texturePngs() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(6); }
|
||||
const NodeTree *nodeTree() const { return GetPointer<const NodeTree *>(8); }
|
||||
const NodeAction *action() const { return GetPointer<const NodeAction *>(10); }
|
||||
const flatbuffers::String *version() const { return GetPointer<const flatbuffers::String *>(12); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* textures */) &&
|
||||
|
@ -188,6 +190,8 @@ struct CSParseBinary : private flatbuffers::Table {
|
|||
verifier.VerifyTable(nodeTree()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 10 /* action */) &&
|
||||
verifier.VerifyTable(action()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 12 /* version */) &&
|
||||
verifier.Verify(version()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -199,10 +203,11 @@ struct CSParseBinaryBuilder {
|
|||
void add_texturePngs(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> texturePngs) { fbb_.AddOffset(6, texturePngs); }
|
||||
void add_nodeTree(flatbuffers::Offset<NodeTree> nodeTree) { fbb_.AddOffset(8, nodeTree); }
|
||||
void add_action(flatbuffers::Offset<NodeAction> action) { fbb_.AddOffset(10, action); }
|
||||
void add_version(flatbuffers::Offset<flatbuffers::String> version) { fbb_.AddOffset(12, version); }
|
||||
CSParseBinaryBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
CSParseBinaryBuilder &operator=(const CSParseBinaryBuilder &);
|
||||
flatbuffers::Offset<CSParseBinary> Finish() {
|
||||
auto o = flatbuffers::Offset<CSParseBinary>(fbb_.EndTable(start_, 4));
|
||||
auto o = flatbuffers::Offset<CSParseBinary>(fbb_.EndTable(start_, 5));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -211,8 +216,10 @@ inline flatbuffers::Offset<CSParseBinary> CreateCSParseBinary(flatbuffers::FlatB
|
|||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> textures = 0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> texturePngs = 0,
|
||||
flatbuffers::Offset<NodeTree> nodeTree = 0,
|
||||
flatbuffers::Offset<NodeAction> action = 0) {
|
||||
flatbuffers::Offset<NodeAction> action = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> version = 0) {
|
||||
CSParseBinaryBuilder builder_(_fbb);
|
||||
builder_.add_version(version);
|
||||
builder_.add_action(action);
|
||||
builder_.add_nodeTree(nodeTree);
|
||||
builder_.add_texturePngs(texturePngs);
|
||||
|
@ -318,6 +325,7 @@ struct WidgetOptions : private flatbuffers::Table {
|
|||
const flatbuffers::String *customProperty() const { return GetPointer<const flatbuffers::String *>(38); }
|
||||
const flatbuffers::String *callBackType() const { return GetPointer<const flatbuffers::String *>(40); }
|
||||
const flatbuffers::String *callBackName() const { return GetPointer<const flatbuffers::String *>(42); }
|
||||
const LayoutComponentTable *layoutComponent() const { return GetPointer<const LayoutComponentTable *>(44); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* name */) &&
|
||||
|
@ -345,6 +353,8 @@ struct WidgetOptions : private flatbuffers::Table {
|
|||
verifier.Verify(callBackType()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 42 /* callBackName */) &&
|
||||
verifier.Verify(callBackName()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 44 /* layoutComponent */) &&
|
||||
verifier.VerifyTable(layoutComponent()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -372,10 +382,11 @@ struct WidgetOptionsBuilder {
|
|||
void add_customProperty(flatbuffers::Offset<flatbuffers::String> customProperty) { fbb_.AddOffset(38, customProperty); }
|
||||
void add_callBackType(flatbuffers::Offset<flatbuffers::String> callBackType) { fbb_.AddOffset(40, callBackType); }
|
||||
void add_callBackName(flatbuffers::Offset<flatbuffers::String> callBackName) { fbb_.AddOffset(42, callBackName); }
|
||||
void add_layoutComponent(flatbuffers::Offset<LayoutComponentTable> layoutComponent) { fbb_.AddOffset(44, layoutComponent); }
|
||||
WidgetOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
WidgetOptionsBuilder &operator=(const WidgetOptionsBuilder &);
|
||||
flatbuffers::Offset<WidgetOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<WidgetOptions>(fbb_.EndTable(start_, 20));
|
||||
auto o = flatbuffers::Offset<WidgetOptions>(fbb_.EndTable(start_, 21));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
@ -400,8 +411,10 @@ inline flatbuffers::Offset<WidgetOptions> CreateWidgetOptions(flatbuffers::FlatB
|
|||
flatbuffers::Offset<flatbuffers::String> frameEvent = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> customProperty = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> callBackType = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> callBackName = 0) {
|
||||
flatbuffers::Offset<flatbuffers::String> callBackName = 0,
|
||||
flatbuffers::Offset<LayoutComponentTable> layoutComponent = 0) {
|
||||
WidgetOptionsBuilder builder_(_fbb);
|
||||
builder_.add_layoutComponent(layoutComponent);
|
||||
builder_.add_callBackName(callBackName);
|
||||
builder_.add_callBackType(callBackType);
|
||||
builder_.add_customProperty(customProperty);
|
||||
|
@ -425,6 +438,111 @@ inline flatbuffers::Offset<WidgetOptions> CreateWidgetOptions(flatbuffers::FlatB
|
|||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct LayoutComponentTable : private flatbuffers::Table {
|
||||
uint8_t positionXPercentEnabled() const { return GetField<uint8_t>(4, 0); }
|
||||
uint8_t positionYPercentEnabled() const { return GetField<uint8_t>(6, 0); }
|
||||
float positionXPercent() const { return GetField<float>(8, 0); }
|
||||
float positionYPercent() const { return GetField<float>(10, 0); }
|
||||
uint8_t sizeXPercentEnable() const { return GetField<uint8_t>(12, 0); }
|
||||
uint8_t sizeYPercentEnable() const { return GetField<uint8_t>(14, 0); }
|
||||
float sizeXPercent() const { return GetField<float>(16, 0); }
|
||||
float sizeYPercent() const { return GetField<float>(18, 0); }
|
||||
uint8_t stretchHorizontalEnabled() const { return GetField<uint8_t>(20, 0); }
|
||||
uint8_t stretchVerticalEnabled() const { return GetField<uint8_t>(22, 0); }
|
||||
const flatbuffers::String *horizontalEdge() const { return GetPointer<const flatbuffers::String *>(24); }
|
||||
const flatbuffers::String *verticalEdge() const { return GetPointer<const flatbuffers::String *>(26); }
|
||||
float leftMargin() const { return GetField<float>(28, 0); }
|
||||
float rightMargin() const { return GetField<float>(30, 0); }
|
||||
float topMargin() const { return GetField<float>(32, 0); }
|
||||
float bottomMargin() const { return GetField<float>(34, 0); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<uint8_t>(verifier, 4 /* positionXPercentEnabled */) &&
|
||||
VerifyField<uint8_t>(verifier, 6 /* positionYPercentEnabled */) &&
|
||||
VerifyField<float>(verifier, 8 /* positionXPercent */) &&
|
||||
VerifyField<float>(verifier, 10 /* positionYPercent */) &&
|
||||
VerifyField<uint8_t>(verifier, 12 /* sizeXPercentEnable */) &&
|
||||
VerifyField<uint8_t>(verifier, 14 /* sizeYPercentEnable */) &&
|
||||
VerifyField<float>(verifier, 16 /* sizeXPercent */) &&
|
||||
VerifyField<float>(verifier, 18 /* sizeYPercent */) &&
|
||||
VerifyField<uint8_t>(verifier, 20 /* stretchHorizontalEnabled */) &&
|
||||
VerifyField<uint8_t>(verifier, 22 /* stretchVerticalEnabled */) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 24 /* horizontalEdge */) &&
|
||||
verifier.Verify(horizontalEdge()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 26 /* verticalEdge */) &&
|
||||
verifier.Verify(verticalEdge()) &&
|
||||
VerifyField<float>(verifier, 28 /* leftMargin */) &&
|
||||
VerifyField<float>(verifier, 30 /* rightMargin */) &&
|
||||
VerifyField<float>(verifier, 32 /* topMargin */) &&
|
||||
VerifyField<float>(verifier, 34 /* bottomMargin */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
||||
struct LayoutComponentTableBuilder {
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_positionXPercentEnabled(uint8_t positionXPercentEnabled) { fbb_.AddElement<uint8_t>(4, positionXPercentEnabled, 0); }
|
||||
void add_positionYPercentEnabled(uint8_t positionYPercentEnabled) { fbb_.AddElement<uint8_t>(6, positionYPercentEnabled, 0); }
|
||||
void add_positionXPercent(float positionXPercent) { fbb_.AddElement<float>(8, positionXPercent, 0); }
|
||||
void add_positionYPercent(float positionYPercent) { fbb_.AddElement<float>(10, positionYPercent, 0); }
|
||||
void add_sizeXPercentEnable(uint8_t sizeXPercentEnable) { fbb_.AddElement<uint8_t>(12, sizeXPercentEnable, 0); }
|
||||
void add_sizeYPercentEnable(uint8_t sizeYPercentEnable) { fbb_.AddElement<uint8_t>(14, sizeYPercentEnable, 0); }
|
||||
void add_sizeXPercent(float sizeXPercent) { fbb_.AddElement<float>(16, sizeXPercent, 0); }
|
||||
void add_sizeYPercent(float sizeYPercent) { fbb_.AddElement<float>(18, sizeYPercent, 0); }
|
||||
void add_stretchHorizontalEnabled(uint8_t stretchHorizontalEnabled) { fbb_.AddElement<uint8_t>(20, stretchHorizontalEnabled, 0); }
|
||||
void add_stretchVerticalEnabled(uint8_t stretchVerticalEnabled) { fbb_.AddElement<uint8_t>(22, stretchVerticalEnabled, 0); }
|
||||
void add_horizontalEdge(flatbuffers::Offset<flatbuffers::String> horizontalEdge) { fbb_.AddOffset(24, horizontalEdge); }
|
||||
void add_verticalEdge(flatbuffers::Offset<flatbuffers::String> verticalEdge) { fbb_.AddOffset(26, verticalEdge); }
|
||||
void add_leftMargin(float leftMargin) { fbb_.AddElement<float>(28, leftMargin, 0); }
|
||||
void add_rightMargin(float rightMargin) { fbb_.AddElement<float>(30, rightMargin, 0); }
|
||||
void add_topMargin(float topMargin) { fbb_.AddElement<float>(32, topMargin, 0); }
|
||||
void add_bottomMargin(float bottomMargin) { fbb_.AddElement<float>(34, bottomMargin, 0); }
|
||||
LayoutComponentTableBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
LayoutComponentTableBuilder &operator=(const LayoutComponentTableBuilder &);
|
||||
flatbuffers::Offset<LayoutComponentTable> Finish() {
|
||||
auto o = flatbuffers::Offset<LayoutComponentTable>(fbb_.EndTable(start_, 16));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<LayoutComponentTable> CreateLayoutComponentTable(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
uint8_t positionXPercentEnabled = 0,
|
||||
uint8_t positionYPercentEnabled = 0,
|
||||
float positionXPercent = 0,
|
||||
float positionYPercent = 0,
|
||||
uint8_t sizeXPercentEnable = 0,
|
||||
uint8_t sizeYPercentEnable = 0,
|
||||
float sizeXPercent = 0,
|
||||
float sizeYPercent = 0,
|
||||
uint8_t stretchHorizontalEnabled = 0,
|
||||
uint8_t stretchVerticalEnabled = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> horizontalEdge = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> verticalEdge = 0,
|
||||
float leftMargin = 0,
|
||||
float rightMargin = 0,
|
||||
float topMargin = 0,
|
||||
float bottomMargin = 0) {
|
||||
LayoutComponentTableBuilder builder_(_fbb);
|
||||
builder_.add_bottomMargin(bottomMargin);
|
||||
builder_.add_topMargin(topMargin);
|
||||
builder_.add_rightMargin(rightMargin);
|
||||
builder_.add_leftMargin(leftMargin);
|
||||
builder_.add_verticalEdge(verticalEdge);
|
||||
builder_.add_horizontalEdge(horizontalEdge);
|
||||
builder_.add_sizeYPercent(sizeYPercent);
|
||||
builder_.add_sizeXPercent(sizeXPercent);
|
||||
builder_.add_positionYPercent(positionYPercent);
|
||||
builder_.add_positionXPercent(positionXPercent);
|
||||
builder_.add_stretchVerticalEnabled(stretchVerticalEnabled);
|
||||
builder_.add_stretchHorizontalEnabled(stretchHorizontalEnabled);
|
||||
builder_.add_sizeYPercentEnable(sizeYPercentEnable);
|
||||
builder_.add_sizeXPercentEnable(sizeXPercentEnable);
|
||||
builder_.add_positionYPercentEnabled(positionYPercentEnabled);
|
||||
builder_.add_positionXPercentEnabled(positionXPercentEnabled);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct SingleNodeOptions : private flatbuffers::Table {
|
||||
const WidgetOptions *nodeOptions() const { return GetPointer<const WidgetOptions *>(4); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
|
@ -1557,12 +1675,16 @@ inline flatbuffers::Offset<ListViewOptions> CreateListViewOptions(flatbuffers::F
|
|||
struct ProjectNodeOptions : private flatbuffers::Table {
|
||||
const WidgetOptions *nodeOptions() const { return GetPointer<const WidgetOptions *>(4); }
|
||||
const flatbuffers::String *fileName() const { return GetPointer<const flatbuffers::String *>(6); }
|
||||
uint8_t isLoop() const { return GetField<uint8_t>(8, 1); }
|
||||
uint8_t isAutoPlay() const { return GetField<uint8_t>(10, 1); }
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* nodeOptions */) &&
|
||||
verifier.VerifyTable(nodeOptions()) &&
|
||||
VerifyField<flatbuffers::uoffset_t>(verifier, 6 /* fileName */) &&
|
||||
verifier.Verify(fileName()) &&
|
||||
VerifyField<uint8_t>(verifier, 8 /* isLoop */) &&
|
||||
VerifyField<uint8_t>(verifier, 10 /* isAutoPlay */) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
};
|
||||
|
@ -1572,20 +1694,26 @@ struct ProjectNodeOptionsBuilder {
|
|||
flatbuffers::uoffset_t start_;
|
||||
void add_nodeOptions(flatbuffers::Offset<WidgetOptions> nodeOptions) { fbb_.AddOffset(4, nodeOptions); }
|
||||
void add_fileName(flatbuffers::Offset<flatbuffers::String> fileName) { fbb_.AddOffset(6, fileName); }
|
||||
void add_isLoop(uint8_t isLoop) { fbb_.AddElement<uint8_t>(8, isLoop, 1); }
|
||||
void add_isAutoPlay(uint8_t isAutoPlay) { fbb_.AddElement<uint8_t>(10, isAutoPlay, 1); }
|
||||
ProjectNodeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
ProjectNodeOptionsBuilder &operator=(const ProjectNodeOptionsBuilder &);
|
||||
flatbuffers::Offset<ProjectNodeOptions> Finish() {
|
||||
auto o = flatbuffers::Offset<ProjectNodeOptions>(fbb_.EndTable(start_, 2));
|
||||
auto o = flatbuffers::Offset<ProjectNodeOptions>(fbb_.EndTable(start_, 4));
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<ProjectNodeOptions> CreateProjectNodeOptions(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<WidgetOptions> nodeOptions = 0,
|
||||
flatbuffers::Offset<flatbuffers::String> fileName = 0) {
|
||||
flatbuffers::Offset<flatbuffers::String> fileName = 0,
|
||||
uint8_t isLoop = 1,
|
||||
uint8_t isAutoPlay = 1) {
|
||||
ProjectNodeOptionsBuilder builder_(_fbb);
|
||||
builder_.add_fileName(fileName);
|
||||
builder_.add_nodeOptions(nodeOptions);
|
||||
builder_.add_isAutoPlay(isAutoPlay);
|
||||
builder_.add_isLoop(isLoop);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1169,9 +1169,29 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
|
|||
{
|
||||
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, _builder);
|
||||
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||
|
||||
|
||||
std::string filename = "";
|
||||
|
||||
|
||||
|
||||
bool isloop = true;
|
||||
bool isAutoPlay = true;
|
||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||
while (attribute)
|
||||
{
|
||||
std::string attriname = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
if (attriname == "IsLoop")
|
||||
{
|
||||
isloop = (value == "True") ? true : false;
|
||||
|
||||
}
|
||||
else if (attriname == "IsAutoPlay")
|
||||
{
|
||||
isAutoPlay = (value == "True") ? true : false;
|
||||
}
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
||||
// FileData
|
||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||
while (child)
|
||||
|
@ -1201,7 +1221,9 @@ Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimu
|
|||
|
||||
return CreateProjectNodeOptions(*_builder,
|
||||
nodeOptions,
|
||||
_builder->CreateString(filename));
|
||||
_builder->CreateString(filename),
|
||||
isloop,
|
||||
isAutoPlay);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,27 @@ namespace cocostudio
|
|||
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||
|
||||
std::string filename = "";
|
||||
|
||||
bool isloop = true;
|
||||
bool isAutoPlay = true;
|
||||
|
||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||
while (attribute)
|
||||
{
|
||||
std::string attriname = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
|
||||
if (attriname == "IsLoop")
|
||||
{
|
||||
isloop = (value == "True") ? true : false;
|
||||
}
|
||||
else if (attriname == "IsAutoPlay")
|
||||
{
|
||||
isAutoPlay = (value == "True") ? true : false;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
|
||||
// FileData
|
||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||
while (child)
|
||||
|
@ -101,49 +121,9 @@ namespace cocostudio
|
|||
|
||||
auto options = CreateProjectNodeOptions(*builder,
|
||||
nodeOptions,
|
||||
builder->CreateString(filename));
|
||||
|
||||
return *(Offset<Table>*)(&options);
|
||||
}
|
||||
|
||||
Offset<Table> ProjectNodeReader::createOptionsWithFlatBuffersForSimulator(const tinyxml2::XMLElement *objectData,
|
||||
flatbuffers::FlatBufferBuilder *builder)
|
||||
{
|
||||
auto temp = NodeReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
|
||||
auto nodeOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||
|
||||
std::string filename = "";
|
||||
|
||||
// FileData
|
||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||
while (child)
|
||||
{
|
||||
std::string name = child->Name();
|
||||
|
||||
if (name == "FileData")
|
||||
{
|
||||
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
||||
|
||||
while (attribute)
|
||||
{
|
||||
name = attribute->Name();
|
||||
std::string value = attribute->Value();
|
||||
|
||||
if (name == "Path")
|
||||
{
|
||||
filename = value;
|
||||
}
|
||||
|
||||
attribute = attribute->Next();
|
||||
}
|
||||
}
|
||||
|
||||
child = child->NextSiblingElement();
|
||||
}
|
||||
|
||||
auto options = CreateProjectNodeOptions(*builder,
|
||||
nodeOptions,
|
||||
builder->CreateString(filename));
|
||||
builder->CreateString(filename),
|
||||
isloop,
|
||||
isAutoPlay);
|
||||
|
||||
return *(Offset<Table>*)(&options);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,7 @@ namespace cocostudio
|
|||
|
||||
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffers(const tinyxml2::XMLElement* objectData,
|
||||
flatbuffers::FlatBufferBuilder* builder);
|
||||
flatbuffers::Offset<flatbuffers::Table> createOptionsWithFlatBuffersForSimulator(const tinyxml2::XMLElement* objectData,
|
||||
flatbuffers::FlatBufferBuilder* builder);
|
||||
|
||||
void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* projectNodeOptions);
|
||||
cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* nodeOptions) { return nullptr; };
|
||||
};
|
||||
|
|
|
@ -122,6 +122,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
|
||||
searchPaths.push_back("ccs-res/hd/cocosui/CustomTest/CustomWidgetCallbackBindTest");
|
||||
searchPaths.push_back("hd/ActionTimeline");
|
||||
searchPaths.push_back("ccs-res/hd/armature");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -161,6 +162,8 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
|
||||
searchPaths.push_back("ccs-res/cocosui/CustomTest/CustomWidgetCallbackBindTest");
|
||||
searchPaths.push_back("ActionTimeline");
|
||||
searchPaths.push_back("ccs-res/armature");
|
||||
|
||||
}
|
||||
|
||||
fileUtils->setSearchPaths(searchPaths);
|
||||
|
|
|
@ -78,6 +78,9 @@ Layer *CreateLayer(int index)
|
|||
case TEST_DIRECT_FROM_BINARY:
|
||||
pLayer = new (std::nothrow) TestLoadFromBinary();
|
||||
break;
|
||||
case TEST_ARMATURE_NODE:
|
||||
pLayer = new (std::nothrow) TestArmatureNode();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1601,3 +1604,26 @@ void TestLoadFromBinary::dataLoaded( float percent )
|
|||
m_armatureIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//TestArmatureNode
|
||||
|
||||
void TestArmatureNode::onEnter()
|
||||
{
|
||||
ArmatureTestLayer::onEnter();
|
||||
|
||||
auto node = CSLoader::createNode("TestArmatureNode.csb");
|
||||
addChild(node);
|
||||
}
|
||||
|
||||
|
||||
std::string TestArmatureNode::title() const
|
||||
{
|
||||
return "Test Armature Node";
|
||||
}
|
||||
std::string TestArmatureNode::subtitle() const
|
||||
{
|
||||
return "Csb file loaded";
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ enum {
|
|||
TEST_EASING,
|
||||
TEST_CHANGE_ANIMATION_INTERNAL,
|
||||
TEST_DIRECT_FROM_BINARY,
|
||||
TEST_ARMATURE_NODE,
|
||||
|
||||
TEST_LAYER_COUNT
|
||||
};
|
||||
|
@ -412,4 +413,12 @@ private:
|
|||
int m_armatureIndex; // index of sync loaded armature, default -1 is none
|
||||
};
|
||||
|
||||
class TestArmatureNode : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
};
|
||||
|
||||
#endif // __HELLOWORLD_SCENE_H__
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1d8bede8e900625bc47972c4a925763e43f70ba2
|
||||
Subproject commit 3ff088ff83f49ccf1ecc30c58e880031aa3339ed
|
Loading…
Reference in New Issue