mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3-game
This commit is contained in:
commit
46f6f6bb34
|
@ -1,6 +1,7 @@
|
||||||
cocos2d-x-3.3 Dec.12
|
cocos2d-x-3.3 Dec.12
|
||||||
[FIX] Billboard: allow billboard rotate along z axis
|
[FIX] Billboard: allow billboard rotate along z axis
|
||||||
[FIX] Bundle3D: create aabb for mesh whose aabb does not exist (user custom mesh)
|
[FIX] Bundle3D: create aabb for mesh whose aabb does not exist (user custom mesh)
|
||||||
|
[FIX] EditBox: text position and move animation error on iPhone6 Plus
|
||||||
[FIX] FileUtils: createDirectory(): doesn't invoke closedir() after opendir on platforms other than WP8/WinRT/Windows
|
[FIX] FileUtils: createDirectory(): doesn't invoke closedir() after opendir on platforms other than WP8/WinRT/Windows
|
||||||
|
|
||||||
cocos2d-x-3.3-rc2 Dec.5
|
cocos2d-x-3.3-rc2 Dec.5
|
||||||
|
|
11
README.md
11
README.md
|
@ -83,6 +83,12 @@ Run
|
||||||
|
|
||||||
$ cocos run -p win32
|
$ cocos run -p win32
|
||||||
|
|
||||||
|
### Build and run new project for Windows 8.1 and Windows Phone 8.1 ###
|
||||||
|
|
||||||
|
$ cocos new MyGame -p com.bar.foo -l cpp -d projects
|
||||||
|
|
||||||
|
With the Cocos2d-x v3.3, you can create Universal App (Two projects at the same time: Windows(Tablet) and Windows Phone 8.1 )
|
||||||
|
See more info on How to install and Create games on Windows RT (Windows and Windows Phone 8.1) at http://msopentech.github.io/cocos2d-x/
|
||||||
|
|
||||||
Main features
|
Main features
|
||||||
-------------
|
-------------
|
||||||
|
@ -124,15 +130,18 @@ Build Requirements
|
||||||
* or Windows 7+, VS 2012+
|
* or Windows 7+, VS 2012+
|
||||||
* Python 2.7.5
|
* Python 2.7.5
|
||||||
* NDK r9d is required to build Android games
|
* NDK r9d is required to build Android games
|
||||||
|
* Windows Phone/Store 8.0 VS 2012+
|
||||||
|
* Windows Phone/Store 8.1 VS 2013 Update 3+
|
||||||
|
|
||||||
|
|
||||||
Runtime Requirements
|
Runtime Requirements
|
||||||
--------------------
|
--------------------
|
||||||
* iOS 5.0+ for iPhone / iPad games
|
* iOS 5.0+ for iPhone / iPad games
|
||||||
* Android 2.3+ for Android games
|
* Android 2.3+ for Android games
|
||||||
* Windows Phone 8+ for Windows Phone games
|
* Windows Phone 8 and 8.1 for Windows Phone games
|
||||||
* OS X v10.6+ for Mac games
|
* OS X v10.6+ for Mac games
|
||||||
* Windows 7+ for Win games
|
* Windows 7+ for Win games
|
||||||
|
* Windows 8+ for WinRT games (Modern Apps)
|
||||||
|
|
||||||
|
|
||||||
Running Tests
|
Running Tests
|
||||||
|
|
|
@ -52,8 +52,14 @@ public:
|
||||||
KEY_RETURN,
|
KEY_RETURN,
|
||||||
KEY_CAPS_LOCK,
|
KEY_CAPS_LOCK,
|
||||||
KEY_SHIFT,
|
KEY_SHIFT,
|
||||||
|
KEY_LEFT_SHIFT = KEY_SHIFT,
|
||||||
|
KEY_RIGHT_SHIFT,
|
||||||
KEY_CTRL,
|
KEY_CTRL,
|
||||||
|
KEY_LEFT_CTRL = KEY_CTRL,
|
||||||
|
KEY_RIGHT_CTRL,
|
||||||
KEY_ALT,
|
KEY_ALT,
|
||||||
|
KEY_LEFT_ALT = KEY_ALT,
|
||||||
|
KEY_RIGHT_ALT,
|
||||||
KEY_MENU,
|
KEY_MENU,
|
||||||
KEY_HYPER,
|
KEY_HYPER,
|
||||||
KEY_INSERT,
|
KEY_INSERT,
|
||||||
|
@ -201,13 +207,7 @@ public:
|
||||||
KEY_DPAD_DOWN,
|
KEY_DPAD_DOWN,
|
||||||
KEY_DPAD_CENTER,
|
KEY_DPAD_CENTER,
|
||||||
KEY_ENTER,
|
KEY_ENTER,
|
||||||
KEY_PLAY,
|
KEY_PLAY
|
||||||
KEY_LEFT_CTRL,
|
|
||||||
KEY_RIGHT_CTRL,
|
|
||||||
KEY_LEFT_ALT,
|
|
||||||
KEY_RIGHT_ALT,
|
|
||||||
KEY_LEFT_SHIFT,
|
|
||||||
KEY_RIGHT_SHIFT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EventKeyboard(KeyCode keyCode, bool isPressed);
|
EventKeyboard(KeyCode keyCode, bool isPressed);
|
||||||
|
|
|
@ -31,7 +31,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
CC_DLL const char* cocos2dVersion()
|
CC_DLL const char* cocos2dVersion()
|
||||||
{
|
{
|
||||||
return "cocos2d-x 3.3rc2";
|
return "cocos2d-x 3.3";
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -682,9 +682,20 @@ Frame* ActionTimelineCache::loadColorFrameWithFlatBuffers(const flatbuffers::Tim
|
||||||
|
|
||||||
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TimeLineTextureFrame *flatbuffers)
|
Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::TimeLineTextureFrame *flatbuffers)
|
||||||
{
|
{
|
||||||
|
std::string path = "";
|
||||||
|
int resourceType = 0;
|
||||||
|
std::string plist = "";
|
||||||
|
|
||||||
TextureFrame* frame = TextureFrame::create();
|
TextureFrame* frame = TextureFrame::create();
|
||||||
|
|
||||||
std::string path = flatbuffers->path()->c_str();
|
auto fileNameData = flatbuffers->fileNameData();
|
||||||
|
|
||||||
|
resourceType = fileNameData->resourceType();
|
||||||
|
switch (resourceType)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
path = fileNameData->path()->c_str();
|
||||||
if (FileUtils::getInstance()->isFileExist(path))
|
if (FileUtils::getInstance()->isFileExist(path))
|
||||||
{
|
{
|
||||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(path);
|
||||||
|
@ -694,6 +705,28 @@ Frame* ActionTimelineCache::loadTextureFrameWithFlatBuffers(const flatbuffers::T
|
||||||
{
|
{
|
||||||
path = "";
|
path = "";
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
plist = fileNameData->plistFile()->c_str();
|
||||||
|
if (FileUtils::getInstance()->isFileExist(plist))
|
||||||
|
{
|
||||||
|
path = fileNameData->path()->c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
frame->setTextureName(path);
|
frame->setTextureName(path);
|
||||||
|
|
||||||
int frameIndex = flatbuffers->frameIndex();
|
int frameIndex = flatbuffers->frameIndex();
|
||||||
|
|
|
@ -2038,13 +2038,13 @@ inline flatbuffers::Offset<TimeLineColorFrame> CreateTimeLineColorFrame(flatbuff
|
||||||
struct TimeLineTextureFrame : private flatbuffers::Table {
|
struct TimeLineTextureFrame : private flatbuffers::Table {
|
||||||
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
int32_t frameIndex() const { return GetField<int32_t>(4, 0); }
|
||||||
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
uint8_t tween() const { return GetField<uint8_t>(6, 1); }
|
||||||
const flatbuffers::String *path() const { return GetPointer<const flatbuffers::String *>(8); }
|
const ResourceData *fileNameData() const { return GetPointer<const ResourceData *>(8); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
VerifyField<int32_t>(verifier, 4 /* frameIndex */) &&
|
||||||
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
VerifyField<uint8_t>(verifier, 6 /* tween */) &&
|
||||||
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* path */) &&
|
VerifyField<flatbuffers::uoffset_t>(verifier, 8 /* fileNameData */) &&
|
||||||
verifier.Verify(path()) &&
|
verifier.VerifyTable(fileNameData()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2054,7 +2054,7 @@ struct TimeLineTextureFrameBuilder {
|
||||||
flatbuffers::uoffset_t start_;
|
flatbuffers::uoffset_t start_;
|
||||||
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
void add_frameIndex(int32_t frameIndex) { fbb_.AddElement<int32_t>(4, frameIndex, 0); }
|
||||||
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
void add_tween(uint8_t tween) { fbb_.AddElement<uint8_t>(6, tween, 1); }
|
||||||
void add_path(flatbuffers::Offset<flatbuffers::String> path) { fbb_.AddOffset(8, path); }
|
void add_fileNameData(flatbuffers::Offset<ResourceData> fileNameData) { fbb_.AddOffset(8, fileNameData); }
|
||||||
TimeLineTextureFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
TimeLineTextureFrameBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
TimeLineTextureFrameBuilder &operator=(const TimeLineTextureFrameBuilder &);
|
TimeLineTextureFrameBuilder &operator=(const TimeLineTextureFrameBuilder &);
|
||||||
flatbuffers::Offset<TimeLineTextureFrame> Finish() {
|
flatbuffers::Offset<TimeLineTextureFrame> Finish() {
|
||||||
|
@ -2066,9 +2066,9 @@ struct TimeLineTextureFrameBuilder {
|
||||||
inline flatbuffers::Offset<TimeLineTextureFrame> CreateTimeLineTextureFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
inline flatbuffers::Offset<TimeLineTextureFrame> CreateTimeLineTextureFrame(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
int32_t frameIndex = 0,
|
int32_t frameIndex = 0,
|
||||||
uint8_t tween = 1,
|
uint8_t tween = 1,
|
||||||
flatbuffers::Offset<flatbuffers::String> path = 0) {
|
flatbuffers::Offset<ResourceData> fileNameData = 0) {
|
||||||
TimeLineTextureFrameBuilder builder_(_fbb);
|
TimeLineTextureFrameBuilder builder_(_fbb);
|
||||||
builder_.add_path(path);
|
builder_.add_fileNameData(fileNameData);
|
||||||
builder_.add_frameIndex(frameIndex);
|
builder_.add_frameIndex(frameIndex);
|
||||||
builder_.add_tween(tween);
|
builder_.add_tween(tween);
|
||||||
return builder_.Finish();
|
return builder_.Finish();
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include "flatbuffers/util.h"
|
#include "flatbuffers/util.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace cocos2d::ui;
|
using namespace cocos2d::ui;
|
||||||
using namespace cocostudio;
|
using namespace cocostudio;
|
||||||
|
@ -77,6 +78,8 @@ static const char* FrameType_TextureFrame = "TextureFrame";
|
||||||
static const char* FrameType_EventFrame = "EventFrame";
|
static const char* FrameType_EventFrame = "EventFrame";
|
||||||
static const char* FrameType_ZOrderFrame = "ZOrderFrame";
|
static const char* FrameType_ZOrderFrame = "ZOrderFrame";
|
||||||
|
|
||||||
|
static FlatBuffersSerialize* _instanceFlatBuffersSerialize = nullptr;
|
||||||
|
|
||||||
FlatBuffersSerialize::FlatBuffersSerialize()
|
FlatBuffersSerialize::FlatBuffersSerialize()
|
||||||
: _isSimulator(false)
|
: _isSimulator(false)
|
||||||
, _builder(nullptr)
|
, _builder(nullptr)
|
||||||
|
@ -109,11 +112,9 @@ FlatBuffersSerialize::~FlatBuffersSerialize()
|
||||||
purge();
|
purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
static FlatBuffersSerialize* _instanceFlatBuffersSerialize = nullptr;
|
|
||||||
|
|
||||||
FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
|
FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
|
||||||
{
|
{
|
||||||
if (_instanceFlatBuffersSerialize == nullptr)
|
if (!_instanceFlatBuffersSerialize)
|
||||||
{
|
{
|
||||||
_instanceFlatBuffersSerialize = new FlatBuffersSerialize();
|
_instanceFlatBuffersSerialize = new FlatBuffersSerialize();
|
||||||
}
|
}
|
||||||
|
@ -124,6 +125,16 @@ FlatBuffersSerialize* FlatBuffersSerialize::getInstance()
|
||||||
void FlatBuffersSerialize::purge()
|
void FlatBuffersSerialize::purge()
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(_instanceFlatBuffersSerialize);
|
CC_SAFE_DELETE(_instanceFlatBuffersSerialize);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlatBuffersSerialize::deleteFlatBufferBuilder()
|
||||||
|
{
|
||||||
|
if (_builder != nullptr)
|
||||||
|
{
|
||||||
|
_builder->Clear();
|
||||||
|
CC_SAFE_DELETE(_builder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::string &xmlFileName,
|
std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::string &xmlFileName,
|
||||||
|
@ -146,7 +157,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
document->Parse(content.c_str());
|
document->Parse(content.c_str());
|
||||||
|
|
||||||
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
|
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
|
||||||
CCLOG("rootElement name = %s", rootElement->Name());
|
// CCLOG("rootElement name = %s", rootElement->Name());
|
||||||
|
|
||||||
const tinyxml2::XMLElement* element = rootElement->FirstChildElement();
|
const tinyxml2::XMLElement* element = rootElement->FirstChildElement();
|
||||||
|
|
||||||
|
@ -155,7 +166,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
|
|
||||||
while (element)
|
while (element)
|
||||||
{
|
{
|
||||||
CCLOG("entity name = %s", element->Name());
|
// CCLOG("entity name = %s", element->Name());
|
||||||
|
|
||||||
if (strcmp("Content", element->Name()) == 0)
|
if (strcmp("Content", element->Name()) == 0)
|
||||||
{
|
{
|
||||||
|
@ -209,8 +220,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
|
|
||||||
if (serializeEnabled)
|
if (serializeEnabled)
|
||||||
{
|
{
|
||||||
FlatBufferBuilder builder;
|
_builder = new FlatBufferBuilder();
|
||||||
_builder = &builder;
|
|
||||||
|
|
||||||
Offset<NodeTree> nodeTree;
|
Offset<NodeTree> nodeTree;
|
||||||
Offset<NodeAction> aciton;
|
Offset<NodeAction> aciton;
|
||||||
|
@ -236,12 +246,12 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto csparsebinary = CreateCSParseBinary(builder,
|
auto csparsebinary = CreateCSParseBinary(*_builder,
|
||||||
builder.CreateVector(_textures),
|
_builder->CreateVector(_textures),
|
||||||
builder.CreateVector(_texturePngs),
|
_builder->CreateVector(_texturePngs),
|
||||||
nodeTree,
|
nodeTree,
|
||||||
aciton);
|
aciton);
|
||||||
builder.Finish(csparsebinary);
|
_builder->Finish(csparsebinary);
|
||||||
|
|
||||||
_textures.clear();
|
_textures.clear();
|
||||||
_texturePngs.clear();
|
_texturePngs.clear();
|
||||||
|
@ -251,13 +261,15 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
|
||||||
size_t pos = outFullPath.find_last_of('.');
|
size_t pos = outFullPath.find_last_of('.');
|
||||||
std::string convert = outFullPath.substr(0, pos).append(".csb");
|
std::string convert = outFullPath.substr(0, pos).append(".csb");
|
||||||
auto save = flatbuffers::SaveFile(convert.c_str(),
|
auto save = flatbuffers::SaveFile(convert.c_str(),
|
||||||
reinterpret_cast<const char *>(builder.GetBufferPointer()),
|
reinterpret_cast<const char *>(_builder->GetBufferPointer()),
|
||||||
builder.GetSize(),
|
_builder->GetSize(),
|
||||||
true);
|
true);
|
||||||
if (!save)
|
if (!save)
|
||||||
{
|
{
|
||||||
return "couldn't save files!";
|
return "couldn't save files!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteFlatBufferBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -268,7 +280,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTree(const tinyxml2::XMLElement
|
||||||
std::string classType)
|
std::string classType)
|
||||||
{
|
{
|
||||||
std::string classname = classType.substr(0, classType.find("ObjectData"));
|
std::string classname = classType.substr(0, classType.find("ObjectData"));
|
||||||
CCLOG("classname = %s", classname.c_str());
|
// CCLOG("classname = %s", classname.c_str());
|
||||||
|
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
|
|
||||||
|
@ -301,7 +313,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTree(const tinyxml2::XMLElement
|
||||||
|
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
CCLOG("child name = %s", child->Name());
|
// CCLOG("child name = %s", child->Name());
|
||||||
|
|
||||||
if (strcmp("Children", child->Name()) == 0)
|
if (strcmp("Children", child->Name()) == 0)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +327,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTree(const tinyxml2::XMLElement
|
||||||
if (containChildrenElement)
|
if (containChildrenElement)
|
||||||
{
|
{
|
||||||
child = child->FirstChildElement();
|
child = child->FirstChildElement();
|
||||||
CCLOG("element name = %s", child->Name());
|
// CCLOG("element name = %s", child->Name());
|
||||||
|
|
||||||
while (child)
|
while (child)
|
||||||
{
|
{
|
||||||
|
@ -368,259 +380,7 @@ Offset<NodeTree> FlatBuffersSerialize::createNodeTree(const tinyxml2::XMLElement
|
||||||
_builder->CreateVector(children),
|
_builder->CreateVector(children),
|
||||||
options,
|
options,
|
||||||
_builder->CreateString(customClassName));
|
_builder->CreateString(customClassName));
|
||||||
}
|
|
||||||
|
|
||||||
FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulator(const std::string &xmlFileName)
|
|
||||||
{
|
|
||||||
std::string inFullpath = FileUtils::getInstance()->fullPathForFilename(xmlFileName).c_str();
|
|
||||||
|
|
||||||
// xml read
|
|
||||||
if (!FileUtils::getInstance()->isFileExist(inFullpath))
|
|
||||||
{
|
|
||||||
CCLOG(".csd file doesn not exists ");
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t size;
|
|
||||||
std::string content =(char*)FileUtils::getInstance()->getFileData(inFullpath, "r", &size);
|
|
||||||
|
|
||||||
// xml parse
|
|
||||||
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
|
||||||
document->Parse(content.c_str());
|
|
||||||
|
|
||||||
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
|
|
||||||
CCLOG("rootElement name = %s", rootElement->Name());
|
|
||||||
|
|
||||||
const tinyxml2::XMLElement* element = rootElement->FirstChildElement();
|
|
||||||
|
|
||||||
bool serializeEnabled = false;
|
|
||||||
std::string rootType = "";
|
|
||||||
|
|
||||||
while (element)
|
|
||||||
{
|
|
||||||
CCLOG("entity name = %s", element->Name());
|
|
||||||
|
|
||||||
if (strcmp("Content", element->Name()) == 0)
|
|
||||||
{
|
|
||||||
const tinyxml2::XMLAttribute* attribute = element->FirstAttribute();
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!attribute)
|
|
||||||
{
|
|
||||||
serializeEnabled = true;
|
|
||||||
rootType = "NodeObjectData";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serializeEnabled)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
|
||||||
if (child)
|
|
||||||
{
|
|
||||||
element = child;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
element = element->NextSiblingElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serializeEnabled)
|
|
||||||
{
|
|
||||||
_builder = new FlatBufferBuilder();
|
|
||||||
|
|
||||||
Offset<NodeTree> nodeTree;
|
|
||||||
Offset<NodeAction> aciton;
|
|
||||||
|
|
||||||
|
|
||||||
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
|
||||||
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
std::string name = child->Name();
|
|
||||||
|
|
||||||
if (name == "Animation") // action
|
|
||||||
{
|
|
||||||
const tinyxml2::XMLElement* animation = child;
|
|
||||||
aciton = createNodeAction(animation);
|
|
||||||
}
|
|
||||||
else if (name == "ObjectData") // nodeTree
|
|
||||||
{
|
|
||||||
const tinyxml2::XMLElement* objectData = child;
|
|
||||||
nodeTree = createNodeTreeForSimulator(objectData, rootType);
|
|
||||||
}
|
|
||||||
|
|
||||||
child = child->NextSiblingElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto csparsebinary = CreateCSParseBinary(*_builder,
|
|
||||||
_builder->CreateVector(_textures),
|
|
||||||
_builder->CreateVector(_texturePngs),
|
|
||||||
nodeTree,
|
|
||||||
aciton);
|
|
||||||
_builder->Finish(csparsebinary);
|
|
||||||
|
|
||||||
_textures.clear();
|
|
||||||
_texturePngs.clear();
|
|
||||||
}
|
|
||||||
return _builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
Offset<NodeTree> FlatBuffersSerialize::createNodeTreeForSimulator(const tinyxml2::XMLElement *objectData,
|
|
||||||
std::string classType)
|
|
||||||
{
|
|
||||||
std::string classname = classType.substr(0, classType.find("ObjectData"));
|
|
||||||
CCLOG("classname = %s", classname.c_str());
|
|
||||||
|
|
||||||
std::string name = "";
|
|
||||||
|
|
||||||
Offset<Options> options;
|
|
||||||
std::vector<Offset<NodeTree>> children;
|
|
||||||
|
|
||||||
if (classname == "ProjectNode")
|
|
||||||
{
|
|
||||||
auto projectNodeOptions = createProjectNodeOptionsForSimulator(objectData);
|
|
||||||
options = CreateOptions(*_builder, *(Offset<Table>*)(&projectNodeOptions));
|
|
||||||
}
|
|
||||||
else if (classname == "SimpleAudio")
|
|
||||||
{
|
|
||||||
auto reader = ComAudioReader::getInstance();
|
|
||||||
options = CreateOptions(*_builder, reader->createOptionsWithFlatBuffers(objectData, _builder));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string readername = getGUIClassName(classname);
|
|
||||||
readername.append("Reader");
|
|
||||||
|
|
||||||
NodeReaderProtocol* reader = dynamic_cast<NodeReaderProtocol*>(ObjectFactory::getInstance()->createObject(readername));
|
|
||||||
options = CreateOptions(*_builder, reader->createOptionsWithFlatBuffers(objectData, _builder));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// children
|
|
||||||
bool containChildrenElement = false;
|
|
||||||
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
|
||||||
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
CCLOG("child name = %s", child->Name());
|
|
||||||
|
|
||||||
if (strcmp("Children", child->Name()) == 0)
|
|
||||||
{
|
|
||||||
containChildrenElement = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
child = child->NextSiblingElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (containChildrenElement)
|
|
||||||
{
|
|
||||||
child = child->FirstChildElement();
|
|
||||||
CCLOG("element name = %s", child->Name());
|
|
||||||
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
|
||||||
bool bHasType = false;
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string attriname = attribute->Name();
|
|
||||||
std::string value = attribute->Value();
|
|
||||||
|
|
||||||
if (attriname == "ctype")
|
|
||||||
{
|
|
||||||
children.push_back(createNodeTreeForSimulator(child, value));
|
|
||||||
|
|
||||||
bHasType = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bHasType)
|
|
||||||
{
|
|
||||||
children.push_back(createNodeTreeForSimulator(child, "NodeObjectData"));
|
|
||||||
}
|
|
||||||
|
|
||||||
child = child->NextSiblingElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
std::string customClassName = "";
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
|
||||||
while (attribute)
|
|
||||||
{
|
|
||||||
std::string attriname = attribute->Name();
|
|
||||||
std::string value = attribute->Value();
|
|
||||||
|
|
||||||
if (attriname == "CustomClassName")
|
|
||||||
{
|
|
||||||
customClassName = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute = attribute->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreateNodeTree(*_builder,
|
|
||||||
_builder->CreateString(classname),
|
|
||||||
_builder->CreateVector(children),
|
|
||||||
options,
|
|
||||||
_builder->CreateString(customClassName));
|
|
||||||
}
|
|
||||||
|
|
||||||
Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimulator(const tinyxml2::XMLElement *objectData)
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
return CreateProjectNodeOptions(*_builder,
|
|
||||||
nodeOptions,
|
|
||||||
_builder->CreateString(filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
void FlatBuffersSerialize::deleteFlatBufferBuilder()
|
|
||||||
{
|
|
||||||
if (_builder != nullptr)
|
|
||||||
{
|
|
||||||
_builder->Clear();
|
|
||||||
CC_SAFE_DELETE(_builder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int FlatBuffersSerialize::getResourceType(std::string key)
|
int FlatBuffersSerialize::getResourceType(std::string key)
|
||||||
|
@ -737,6 +497,7 @@ std::string FlatBuffersSerialize::getWidgetReaderClassName(Widget* widget)
|
||||||
|
|
||||||
return readerName;
|
return readerName;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
// NodeAction
|
// NodeAction
|
||||||
|
@ -745,7 +506,7 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(const tinyxml2::XMLEle
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
float speed = 0.0f;
|
float speed = 0.0f;
|
||||||
|
|
||||||
CCLOG("animation name = %s", objectData->Name());
|
// CCLOG("animation name = %s", objectData->Name());
|
||||||
|
|
||||||
// ActionTimeline
|
// ActionTimeline
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
@ -822,17 +583,13 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
auto visibleFrame = createTimeLineBoolFrame(frameElement);
|
auto visibleFrame = createTimeLineBoolFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
visibleFrame);
|
visibleFrame);
|
||||||
|
|
||||||
frames.push_back(frame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ZOrderFrame)
|
else if (frameType == FrameType_ZOrderFrame)
|
||||||
{
|
{
|
||||||
auto zOrderFrame = createTimeLineIntFrame(objectData);
|
auto zOrderFrame = createTimeLineIntFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // VisibleFrame
|
||||||
zOrderFrame);
|
zOrderFrame);
|
||||||
|
|
||||||
frames.push_back(frame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_RotationSkewFrame)
|
else if (frameType == FrameType_RotationSkewFrame)
|
||||||
{
|
{
|
||||||
|
@ -841,8 +598,6 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
0, // VisibleFrame
|
0, // VisibleFrame
|
||||||
0, // ZOrderFrame
|
0, // ZOrderFrame
|
||||||
rotationSkewFrame);
|
rotationSkewFrame);
|
||||||
|
|
||||||
frames.push_back(frame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_EventFrame)
|
else if (frameType == FrameType_EventFrame)
|
||||||
{
|
{
|
||||||
|
@ -852,8 +607,6 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
0, // ZOrderFrame
|
0, // ZOrderFrame
|
||||||
0, // RotationSkewFrame
|
0, // RotationSkewFrame
|
||||||
eventFrame);
|
eventFrame);
|
||||||
|
|
||||||
frames.push_back(frame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_AnchorFrame)
|
else if (frameType == FrameType_AnchorFrame)
|
||||||
{
|
{
|
||||||
|
@ -864,8 +617,6 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
0, // RotationSkewFrame
|
0, // RotationSkewFrame
|
||||||
0, // EventFrame
|
0, // EventFrame
|
||||||
anchorPointFrame);
|
anchorPointFrame);
|
||||||
|
|
||||||
frames.push_back(frame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_PositionFrame)
|
else if (frameType == FrameType_PositionFrame)
|
||||||
{
|
{
|
||||||
|
@ -877,12 +628,10 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
0, // EventFrame
|
0, // EventFrame
|
||||||
0, // AnchorPointFrame
|
0, // AnchorPointFrame
|
||||||
positionFrame);
|
positionFrame);
|
||||||
|
|
||||||
frames.push_back(frame);
|
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ScaleFrame)
|
else if (frameType == FrameType_ScaleFrame)
|
||||||
{
|
{
|
||||||
auto scaleFrame = createTimeLinePointFrame(objectData);
|
auto scaleFrame = createTimeLinePointFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // VisibleFrame
|
||||||
0, // ZOrderFrame
|
0, // ZOrderFrame
|
||||||
|
@ -894,7 +643,7 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_ColorFrame)
|
else if (frameType == FrameType_ColorFrame)
|
||||||
{
|
{
|
||||||
auto colorFrame = createTimeLineColorFrame(objectData);
|
auto colorFrame = createTimeLineColorFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // VisibleFrame
|
||||||
0, // ZOrderFrame
|
0, // ZOrderFrame
|
||||||
|
@ -907,7 +656,7 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
}
|
}
|
||||||
else if (frameType == FrameType_TextureFrame)
|
else if (frameType == FrameType_TextureFrame)
|
||||||
{
|
{
|
||||||
auto textureFrame = createTimeLineTextureFrame(objectData);
|
auto textureFrame = createTimeLineTextureFrame(frameElement);
|
||||||
frame = CreateFrame(*_builder,
|
frame = CreateFrame(*_builder,
|
||||||
0, // VisibleFrame
|
0, // VisibleFrame
|
||||||
0, // ZOrderFrame
|
0, // ZOrderFrame
|
||||||
|
@ -919,6 +668,7 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
|
||||||
0, // ColorFrame
|
0, // ColorFrame
|
||||||
textureFrame);
|
textureFrame);
|
||||||
}
|
}
|
||||||
|
frames.push_back(frame);
|
||||||
|
|
||||||
frameElement = frameElement->NextSiblingElement();
|
frameElement = frameElement->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
@ -1136,8 +886,8 @@ Offset<TimeLineColorFrame> FlatBuffersSerialize::createTimeLineColorFrame(const
|
||||||
&f_color);
|
&f_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
Offset<TimeLineTextureFrame> FlatBuffersSerialize::createTimeLineTextureFrame(const tinyxml2::XMLElement *objectData)
|
Offset<TimeLineTextureFrame> FlatBuffersSerialize::createTimeLineTextureFrame(const tinyxml2::XMLElement *objectData)
|
||||||
{
|
{
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
bool tween = true;
|
bool tween = true;
|
||||||
|
|
||||||
|
@ -1145,6 +895,9 @@ Offset<TimeLineTextureFrame> FlatBuffersSerialize::createTimeLineTextureFrame(co
|
||||||
std::string plistFile = "";
|
std::string plistFile = "";
|
||||||
int resourceType = 0;
|
int resourceType = 0;
|
||||||
|
|
||||||
|
std::string texture = "";
|
||||||
|
std::string texturePng = "";
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
while (attribute)
|
while (attribute)
|
||||||
{
|
{
|
||||||
|
@ -1174,12 +927,6 @@ Offset<TimeLineTextureFrame> FlatBuffersSerialize::createTimeLineTextureFrame(co
|
||||||
|
|
||||||
if (attriname == "Path")
|
if (attriname == "Path")
|
||||||
{
|
{
|
||||||
std::string inFullpath = FileUtils::getInstance()->fullPathForFilename(value).c_str();
|
|
||||||
|
|
||||||
// xml read
|
|
||||||
if (!FileUtils::getInstance()->isFileExist(inFullpath))
|
|
||||||
path = "";
|
|
||||||
else
|
|
||||||
path = value;
|
path = value;
|
||||||
}
|
}
|
||||||
else if (attriname == "Type")
|
else if (attriname == "Type")
|
||||||
|
@ -1189,29 +936,275 @@ Offset<TimeLineTextureFrame> FlatBuffersSerialize::createTimeLineTextureFrame(co
|
||||||
else if (attriname == "Plist")
|
else if (attriname == "Plist")
|
||||||
{
|
{
|
||||||
plistFile = value;
|
plistFile = value;
|
||||||
|
texture = value;
|
||||||
std::string inFullpath = FileUtils::getInstance()->fullPathForFilename(value).c_str();
|
|
||||||
|
|
||||||
// xml read
|
|
||||||
if (!FileUtils::getInstance()->isFileExist(inFullpath))
|
|
||||||
{
|
|
||||||
path = "";
|
|
||||||
plistFile = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
plistFile = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute = attribute->Next();
|
attribute = attribute->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resourceType == 1)
|
||||||
|
{
|
||||||
|
_textures.push_back(_builder->CreateString(texture));
|
||||||
|
|
||||||
|
texturePng = texture.substr(0, texture.find_last_of('.')).append(".png");
|
||||||
|
_texturePngs.push_back(_builder->CreateString(texturePng));
|
||||||
|
}
|
||||||
|
|
||||||
child = child->NextSiblingElement();
|
child = child->NextSiblingElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
return CreateTimeLineTextureFrame(*_builder,
|
return CreateTimeLineTextureFrame(*_builder,
|
||||||
frameIndex,
|
frameIndex,
|
||||||
tween,
|
tween,
|
||||||
_builder->CreateString(path));
|
CreateResourceData(*_builder,
|
||||||
|
_builder->CreateString(path),
|
||||||
|
_builder->CreateString(plistFile),
|
||||||
|
resourceType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create flat buffers with XML */
|
||||||
|
FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulator(const std::string &xmlFileName)
|
||||||
|
{
|
||||||
|
std::string inFullpath = FileUtils::getInstance()->fullPathForFilename(xmlFileName).c_str();
|
||||||
|
|
||||||
|
// xml read
|
||||||
|
if (!FileUtils::getInstance()->isFileExist(inFullpath))
|
||||||
|
{
|
||||||
|
// CCLOG(".csd file doesn not exists ");
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t size;
|
||||||
|
std::string content =(char*)FileUtils::getInstance()->getFileData(inFullpath, "r", &size);
|
||||||
|
|
||||||
|
// xml parse
|
||||||
|
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
|
||||||
|
document->Parse(content.c_str());
|
||||||
|
|
||||||
|
const tinyxml2::XMLElement* rootElement = document->RootElement();// Root
|
||||||
|
// CCLOG("rootElement name = %s", rootElement->Name());
|
||||||
|
|
||||||
|
const tinyxml2::XMLElement* element = rootElement->FirstChildElement();
|
||||||
|
|
||||||
|
bool serializeEnabled = false;
|
||||||
|
std::string rootType = "";
|
||||||
|
|
||||||
|
while (element)
|
||||||
|
{
|
||||||
|
// CCLOG("entity name = %s", element->Name());
|
||||||
|
|
||||||
|
if (strcmp("Content", element->Name()) == 0)
|
||||||
|
{
|
||||||
|
const tinyxml2::XMLAttribute* attribute = element->FirstAttribute();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!attribute)
|
||||||
|
{
|
||||||
|
serializeEnabled = true;
|
||||||
|
rootType = "NodeObjectData";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serializeEnabled)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
||||||
|
if (child)
|
||||||
|
{
|
||||||
|
element = child;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element = element->NextSiblingElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serializeEnabled)
|
||||||
|
{
|
||||||
|
_builder = new FlatBufferBuilder();
|
||||||
|
|
||||||
|
Offset<NodeTree> nodeTree;
|
||||||
|
Offset<NodeAction> aciton;
|
||||||
|
|
||||||
|
|
||||||
|
const tinyxml2::XMLElement* child = element->FirstChildElement();
|
||||||
|
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
std::string name = child->Name();
|
||||||
|
|
||||||
|
if (name == "Animation") // action
|
||||||
|
{
|
||||||
|
const tinyxml2::XMLElement* animation = child;
|
||||||
|
aciton = createNodeAction(animation);
|
||||||
|
}
|
||||||
|
else if (name == "ObjectData") // nodeTree
|
||||||
|
{
|
||||||
|
const tinyxml2::XMLElement* objectData = child;
|
||||||
|
nodeTree = createNodeTreeForSimulator(objectData, rootType);
|
||||||
|
}
|
||||||
|
|
||||||
|
child = child->NextSiblingElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto csparsebinary = CreateCSParseBinary(*_builder,
|
||||||
|
_builder->CreateVector(_textures),
|
||||||
|
_builder->CreateVector(_texturePngs),
|
||||||
|
nodeTree,
|
||||||
|
aciton);
|
||||||
|
_builder->Finish(csparsebinary);
|
||||||
|
|
||||||
|
_textures.clear();
|
||||||
|
_texturePngs.clear();
|
||||||
|
}
|
||||||
|
return _builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<NodeTree> FlatBuffersSerialize::createNodeTreeForSimulator(const tinyxml2::XMLElement *objectData,
|
||||||
|
std::string classType)
|
||||||
|
{
|
||||||
|
std::string classname = classType.substr(0, classType.find("ObjectData"));
|
||||||
|
// CCLOG("classname = %s", classname.c_str());
|
||||||
|
|
||||||
|
std::string name = "";
|
||||||
|
|
||||||
|
Offset<Options> options;
|
||||||
|
std::vector<Offset<NodeTree>> children;
|
||||||
|
|
||||||
|
if (classname == "ProjectNode")
|
||||||
|
{
|
||||||
|
auto projectNodeOptions = createProjectNodeOptionsForSimulator(objectData);
|
||||||
|
options = CreateOptions(*_builder, *(Offset<Table>*)(&projectNodeOptions));
|
||||||
|
}
|
||||||
|
else if (classname == "SimpleAudio")
|
||||||
|
{
|
||||||
|
auto reader = ComAudioReader::getInstance();
|
||||||
|
options = CreateOptions(*_builder, reader->createOptionsWithFlatBuffers(objectData, _builder));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string readername = getGUIClassName(classname);
|
||||||
|
readername.append("Reader");
|
||||||
|
|
||||||
|
NodeReaderProtocol* reader = dynamic_cast<NodeReaderProtocol*>(ObjectFactory::getInstance()->createObject(readername));
|
||||||
|
options = CreateOptions(*_builder, reader->createOptionsWithFlatBuffers(objectData, _builder));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// children
|
||||||
|
bool containChildrenElement = false;
|
||||||
|
const tinyxml2::XMLElement* child = objectData->FirstChildElement();
|
||||||
|
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
// CCLOG("child name = %s", child->Name());
|
||||||
|
|
||||||
|
if (strcmp("Children", child->Name()) == 0)
|
||||||
|
{
|
||||||
|
containChildrenElement = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
child = child->NextSiblingElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (containChildrenElement)
|
||||||
|
{
|
||||||
|
child = child->FirstChildElement();
|
||||||
|
// CCLOG("element name = %s", child->Name());
|
||||||
|
|
||||||
|
while (child)
|
||||||
|
{
|
||||||
|
const tinyxml2::XMLAttribute* attribute = child->FirstAttribute();
|
||||||
|
bool bHasType = false;
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string attriname = attribute->Name();
|
||||||
|
std::string value = attribute->Value();
|
||||||
|
|
||||||
|
if (attriname == "ctype")
|
||||||
|
{
|
||||||
|
children.push_back(createNodeTreeForSimulator(child, value));
|
||||||
|
|
||||||
|
bHasType = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bHasType)
|
||||||
|
{
|
||||||
|
children.push_back(createNodeTreeForSimulator(child, "NodeObjectData"));
|
||||||
|
}
|
||||||
|
|
||||||
|
child = child->NextSiblingElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
std::string customClassName = "";
|
||||||
|
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
|
||||||
|
while (attribute)
|
||||||
|
{
|
||||||
|
std::string attriname = attribute->Name();
|
||||||
|
std::string value = attribute->Value();
|
||||||
|
|
||||||
|
if (attriname == "CustomClassName")
|
||||||
|
{
|
||||||
|
customClassName = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute = attribute->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateNodeTree(*_builder,
|
||||||
|
_builder->CreateString(classname),
|
||||||
|
_builder->CreateVector(children),
|
||||||
|
options,
|
||||||
|
_builder->CreateString(customClassName));
|
||||||
|
}
|
||||||
|
|
||||||
|
Offset<ProjectNodeOptions> FlatBuffersSerialize::createProjectNodeOptionsForSimulator(const tinyxml2::XMLElement *objectData)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateProjectNodeOptions(*_builder,
|
||||||
|
nodeOptions,
|
||||||
|
_builder->CreateString(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,18 +78,27 @@ namespace flatbuffers
|
||||||
struct TimeLineTextureFrame;
|
struct TimeLineTextureFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace tinyxml2
|
||||||
|
{
|
||||||
|
class XMLElement;
|
||||||
|
}
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
class CC_STUDIO_DLL FlatBuffersSerialize
|
class CC_STUDIO_DLL FlatBuffersSerialize
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static FlatBuffersSerialize* getInstance();
|
||||||
|
static void purge();
|
||||||
|
|
||||||
FlatBuffersSerialize();
|
FlatBuffersSerialize();
|
||||||
~FlatBuffersSerialize();
|
~FlatBuffersSerialize();
|
||||||
|
|
||||||
static FlatBuffersSerialize* getInstance();
|
void deleteFlatBufferBuilder();
|
||||||
static void purge();
|
|
||||||
|
std::string test(const std::string& xmlFileName,
|
||||||
|
const std::string& flatbuffersFileName);
|
||||||
|
|
||||||
/* serialize flat buffers with XML */
|
/* serialize flat buffers with XML */
|
||||||
std::string serializeFlatBuffersWithXMLFile(const std::string& xmlFileName,
|
std::string serializeFlatBuffersWithXMLFile(const std::string& xmlFileName,
|
||||||
|
@ -110,16 +119,16 @@ public:
|
||||||
flatbuffers::Offset<flatbuffers::TimeLineTextureFrame> createTimeLineTextureFrame(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::TimeLineTextureFrame> createTimeLineTextureFrame(const tinyxml2::XMLElement* objectData);
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
|
int getResourceType(std::string key);
|
||||||
|
std::string getGUIClassName(const std::string &name);
|
||||||
|
std::string getWidgetReaderClassName(cocos2d::ui::Widget *widget);
|
||||||
|
|
||||||
|
/* create flat buffers with XML */
|
||||||
flatbuffers::FlatBufferBuilder* createFlatBuffersWithXMLFileForSimulator(const std::string& xmlFileName);
|
flatbuffers::FlatBufferBuilder* createFlatBuffersWithXMLFileForSimulator(const std::string& xmlFileName);
|
||||||
flatbuffers::Offset<flatbuffers::NodeTree> createNodeTreeForSimulator(const tinyxml2::XMLElement* objectData,
|
flatbuffers::Offset<flatbuffers::NodeTree> createNodeTreeForSimulator(const tinyxml2::XMLElement* objectData,
|
||||||
std::string classType);
|
std::string classType);
|
||||||
flatbuffers::Offset<flatbuffers::ProjectNodeOptions> createProjectNodeOptionsForSimulator(const tinyxml2::XMLElement* objectData);
|
flatbuffers::Offset<flatbuffers::ProjectNodeOptions> createProjectNodeOptionsForSimulator(const tinyxml2::XMLElement* objectData);
|
||||||
|
/**/
|
||||||
void deleteFlatBufferBuilder();
|
|
||||||
|
|
||||||
int getResourceType(std::string key);
|
|
||||||
std::string getGUIClassName(const std::string &name);
|
|
||||||
std::string getWidgetReaderClassName(cocos2d::ui::Widget *widget);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<flatbuffers::Offset<flatbuffers::String>> _textures;
|
std::vector<flatbuffers::Offset<flatbuffers::String>> _textures;
|
||||||
|
@ -131,7 +140,6 @@ private:
|
||||||
flatbuffers::Offset<flatbuffers::CSParseBinary>* _csparsebinary;
|
flatbuffers::Offset<flatbuffers::CSParseBinary>* _csparsebinary;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(__cocos2d_libs__FlatBuffersSerialize__) */
|
#endif /* defined(__cocos2d_libs__FlatBuffersSerialize__) */
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace cocostudio
|
||||||
button->setTitleFontSize(DICTOOL->getIntValue_json(options, P_FontSize,14));
|
button->setTitleFontSize(DICTOOL->getIntValue_json(options, P_FontSize,14));
|
||||||
|
|
||||||
|
|
||||||
button->setTitleFontName(DICTOOL->getStringValue_json(options, P_FontName,"微软雅黑"));
|
button->setTitleFontName(DICTOOL->getStringValue_json(options, P_FontName, ""));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,19 +572,6 @@ namespace cocostudio
|
||||||
std::string disabledTexturePath = disabledDic->path()->c_str();
|
std::string disabledTexturePath = disabledDic->path()->c_str();
|
||||||
button->loadTextureDisabled(disabledTexturePath, (Widget::TextureResType)disabledType);
|
button->loadTextureDisabled(disabledTexturePath, (Widget::TextureResType)disabledType);
|
||||||
|
|
||||||
if (scale9Enabled)
|
|
||||||
{
|
|
||||||
button->setUnifySizeEnabled(false);
|
|
||||||
button->ignoreContentAdaptWithSize(false);
|
|
||||||
|
|
||||||
auto f_capInsets = options->capInsets();
|
|
||||||
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
|
||||||
button->setCapInsets(capInsets);
|
|
||||||
|
|
||||||
Size scale9Size(options->scale9Size()->width(), options->scale9Size()->height());
|
|
||||||
button->setContentSize(scale9Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string titleText = options->text()->c_str();
|
std::string titleText = options->text()->c_str();
|
||||||
button->setTitleText(titleText);
|
button->setTitleText(titleText);
|
||||||
|
|
||||||
|
@ -609,19 +596,20 @@ namespace cocostudio
|
||||||
button->setBright(displaystate);
|
button->setBright(displaystate);
|
||||||
button->setEnabled(displaystate);
|
button->setEnabled(displaystate);
|
||||||
|
|
||||||
Size contentSize;
|
|
||||||
if (!button->isScale9Enabled())
|
|
||||||
{
|
|
||||||
button->setUnifySizeEnabled(true);
|
|
||||||
contentSize = button->getVirtualRendererSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
if (!button->isScale9Enabled())
|
if (scale9Enabled)
|
||||||
{
|
{
|
||||||
button->setContentSize(contentSize);
|
button->setUnifySizeEnabled(false);
|
||||||
|
button->ignoreContentAdaptWithSize(false);
|
||||||
|
|
||||||
|
auto f_capInsets = options->capInsets();
|
||||||
|
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
||||||
|
button->setCapInsets(capInsets);
|
||||||
|
|
||||||
|
Size scale9Size(options->scale9Size()->width(), options->scale9Size()->height());
|
||||||
|
button->setContentSize(scale9Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace cocostudio
|
||||||
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
|
auto temp = WidgetReader::getInstance()->createOptionsWithFlatBuffers(objectData, builder);
|
||||||
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
|
auto widgetOptions = *(Offset<WidgetOptions>*)(&temp);
|
||||||
|
|
||||||
bool selectedState = true;
|
bool selectedState = false;
|
||||||
bool displaystate = true;
|
bool displaystate = true;
|
||||||
|
|
||||||
int backgroundboxResourceType = 0;
|
int backgroundboxResourceType = 0;
|
||||||
|
|
|
@ -302,6 +302,8 @@ namespace cocostudio
|
||||||
bool scale9Enabled = options->scale9Enabled();
|
bool scale9Enabled = options->scale9Enabled();
|
||||||
imageView->setScale9Enabled(scale9Enabled);
|
imageView->setScale9Enabled(scale9Enabled);
|
||||||
|
|
||||||
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
if (scale9Enabled)
|
if (scale9Enabled)
|
||||||
{
|
{
|
||||||
|
@ -318,9 +320,6 @@ namespace cocostudio
|
||||||
imageView->setCapInsets(capInsets);
|
imageView->setCapInsets(capInsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* ImageViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *imageViewOptions)
|
Node* ImageViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *imageViewOptions)
|
||||||
|
|
|
@ -606,6 +606,16 @@ namespace cocostudio
|
||||||
std::string imageFileName = imageFileNameDic->path()->c_str();
|
std::string imageFileName = imageFileNameDic->path()->c_str();
|
||||||
panel->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
panel->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
auto widgetOptions = options->widgetOptions();
|
||||||
|
auto f_color = widgetOptions->color();
|
||||||
|
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
||||||
|
panel->setColor(color);
|
||||||
|
|
||||||
|
int opacity = widgetOptions->alpha();
|
||||||
|
panel->setOpacity(opacity);
|
||||||
|
|
||||||
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
if (backGroundScale9Enabled)
|
if (backGroundScale9Enabled)
|
||||||
{
|
{
|
||||||
|
@ -619,7 +629,6 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto widgetOptions = options->widgetOptions();
|
|
||||||
if (!panel->isIgnoreContentAdaptWithSize())
|
if (!panel->isIgnoreContentAdaptWithSize())
|
||||||
{
|
{
|
||||||
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
||||||
|
@ -627,17 +636,6 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
|
||||||
auto f_color = widgetOptions->color();
|
|
||||||
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
|
||||||
panel->setColor(color);
|
|
||||||
|
|
||||||
int opacity = widgetOptions->alpha();
|
|
||||||
panel->setOpacity(opacity);
|
|
||||||
|
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* LayoutReader::createNodeWithFlatBuffers(const flatbuffers::Table *layoutOptions)
|
Node* LayoutReader::createNodeWithFlatBuffers(const flatbuffers::Table *layoutOptions)
|
||||||
|
|
|
@ -434,27 +434,6 @@ namespace cocostudio
|
||||||
std::string imageFileName = imageFileNameDic->path()->c_str();
|
std::string imageFileName = imageFileNameDic->path()->c_str();
|
||||||
listView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
listView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
|
||||||
if (backGroundScale9Enabled)
|
|
||||||
{
|
|
||||||
auto f_capInsets = options->capInsets();
|
|
||||||
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
|
||||||
listView->setBackGroundImageCapInsets(capInsets);
|
|
||||||
|
|
||||||
auto f_scale9Size = options->scale9Size();
|
|
||||||
Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
|
|
||||||
listView->setContentSize(scale9Size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
|
||||||
if (!listView->isIgnoreContentAdaptWithSize())
|
|
||||||
{
|
|
||||||
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
|
||||||
listView->setContentSize(contentSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
auto widgetOptions = options->widgetOptions();
|
||||||
auto f_color = widgetOptions->color();
|
auto f_color = widgetOptions->color();
|
||||||
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
||||||
|
@ -511,12 +490,26 @@ namespace cocostudio
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
|
if (backGroundScale9Enabled)
|
||||||
|
{
|
||||||
|
auto f_capInsets = options->capInsets();
|
||||||
|
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
||||||
|
listView->setBackGroundImageCapInsets(capInsets);
|
||||||
|
|
||||||
|
auto f_scale9Size = options->scale9Size();
|
||||||
|
Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
|
||||||
|
listView->setContentSize(scale9Size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto widgetOptions = options->widgetOptions();
|
||||||
if (!listView->isIgnoreContentAdaptWithSize())
|
if (!listView->isIgnoreContentAdaptWithSize())
|
||||||
{
|
{
|
||||||
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
||||||
listView->setContentSize(contentSize);
|
listView->setContentSize(contentSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Node* ListViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *listViewOptions)
|
Node* ListViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *listViewOptions)
|
||||||
{
|
{
|
||||||
|
|
|
@ -290,7 +290,7 @@ namespace cocostudio
|
||||||
|
|
||||||
auto options = CreateWidgetOptions(*builder,
|
auto options = CreateWidgetOptions(*builder,
|
||||||
builder->CreateString(name),
|
builder->CreateString(name),
|
||||||
actionTag,
|
(int)actionTag,
|
||||||
&f_rotationskew,
|
&f_rotationskew,
|
||||||
zOrder,
|
zOrder,
|
||||||
visible,
|
visible,
|
||||||
|
|
|
@ -348,26 +348,6 @@ namespace cocostudio
|
||||||
pageView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
pageView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
|
||||||
if (backGroundScale9Enabled)
|
|
||||||
{
|
|
||||||
auto f_capInsets = options->capInsets();
|
|
||||||
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
|
||||||
pageView->setBackGroundImageCapInsets(capInsets);
|
|
||||||
|
|
||||||
auto f_scale9Size = options->scale9Size();
|
|
||||||
Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
|
|
||||||
pageView->setContentSize(scale9Size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
|
||||||
if (!pageView->isIgnoreContentAdaptWithSize())
|
|
||||||
{
|
|
||||||
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
|
||||||
pageView->setContentSize(contentSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
auto widgetOptions = options->widgetOptions();
|
||||||
auto f_color = widgetOptions->color();
|
auto f_color = widgetOptions->color();
|
||||||
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
||||||
|
@ -380,6 +360,24 @@ namespace cocostudio
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
|
if (backGroundScale9Enabled)
|
||||||
|
{
|
||||||
|
auto f_capInsets = options->capInsets();
|
||||||
|
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
||||||
|
pageView->setBackGroundImageCapInsets(capInsets);
|
||||||
|
|
||||||
|
auto f_scale9Size = options->scale9Size();
|
||||||
|
Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
|
||||||
|
pageView->setContentSize(scale9Size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!pageView->isIgnoreContentAdaptWithSize())
|
||||||
|
{
|
||||||
|
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
||||||
|
pageView->setContentSize(contentSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* PageViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *pageViewOptions)
|
Node* PageViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *pageViewOptions)
|
||||||
|
|
|
@ -433,27 +433,6 @@ namespace cocostudio
|
||||||
std::string imageFileName = imageFileNameDic->path()->c_str();
|
std::string imageFileName = imageFileNameDic->path()->c_str();
|
||||||
scrollView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
scrollView->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
|
||||||
if (backGroundScale9Enabled)
|
|
||||||
{
|
|
||||||
auto f_capInsets = options->capInsets();
|
|
||||||
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
|
||||||
scrollView->setBackGroundImageCapInsets(capInsets);
|
|
||||||
|
|
||||||
auto f_scale9Size = options->scale9Size();
|
|
||||||
Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
|
|
||||||
scrollView->setContentSize(scale9Size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
|
||||||
if (!scrollView->isIgnoreContentAdaptWithSize())
|
|
||||||
{
|
|
||||||
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
|
||||||
scrollView->setContentSize(contentSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
auto widgetOptions = options->widgetOptions();
|
||||||
auto f_color = widgetOptions->color();
|
auto f_color = widgetOptions->color();
|
||||||
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
Color3B color(f_color->r(), f_color->g(), f_color->b());
|
||||||
|
@ -474,6 +453,25 @@ namespace cocostudio
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
|
if (backGroundScale9Enabled)
|
||||||
|
{
|
||||||
|
auto f_capInsets = options->capInsets();
|
||||||
|
Rect capInsets(f_capInsets->x(), f_capInsets->y(), f_capInsets->width(), f_capInsets->height());
|
||||||
|
scrollView->setBackGroundImageCapInsets(capInsets);
|
||||||
|
|
||||||
|
auto f_scale9Size = options->scale9Size();
|
||||||
|
Size scale9Size(f_scale9Size->width(), f_scale9Size->height());
|
||||||
|
scrollView->setContentSize(scale9Size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!scrollView->isIgnoreContentAdaptWithSize())
|
||||||
|
{
|
||||||
|
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
||||||
|
scrollView->setContentSize(contentSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* ScrollViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *scrollViewOptions)
|
Node* ScrollViewReader::createNodeWithFlatBuffers(const flatbuffers::Table *scrollViewOptions)
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace cocostudio
|
||||||
textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
|
textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
|
||||||
|
|
||||||
|
|
||||||
textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName,"微软雅黑"));
|
textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName, ""));
|
||||||
|
|
||||||
bool tsw = DICTOOL->checkObjectExist_json(options, P_TouchSizeWidth);
|
bool tsw = DICTOOL->checkObjectExist_json(options, P_TouchSizeWidth);
|
||||||
bool tsh = DICTOOL->checkObjectExist_json(options, P_TouchSizeHeight);
|
bool tsh = DICTOOL->checkObjectExist_json(options, P_TouchSizeHeight);
|
||||||
|
@ -274,9 +274,6 @@ namespace cocostudio
|
||||||
TextField* textField = static_cast<TextField*>(node);
|
TextField* textField = static_cast<TextField*>(node);
|
||||||
auto options = (TextFieldOptions*)textFieldOptions;
|
auto options = (TextFieldOptions*)textFieldOptions;
|
||||||
|
|
||||||
textField->setUnifySizeEnabled(false);
|
|
||||||
textField->ignoreContentAdaptWithSize(false);
|
|
||||||
|
|
||||||
std::string placeholder = options->placeHolder()->c_str();
|
std::string placeholder = options->placeHolder()->c_str();
|
||||||
textField->setPlaceHolder(placeholder);
|
textField->setPlaceHolder(placeholder);
|
||||||
|
|
||||||
|
@ -316,9 +313,13 @@ namespace cocostudio
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
|
textField->setUnifySizeEnabled(false);
|
||||||
|
textField->ignoreContentAdaptWithSize(false);
|
||||||
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
auto widgetOptions = options->widgetOptions();
|
||||||
if (!textField->isIgnoreContentAdaptWithSize())
|
if (!textField->isIgnoreContentAdaptWithSize())
|
||||||
{
|
{
|
||||||
|
((Label*)(textField->getVirtualRenderer()))->setLineBreakWithoutSpace(true);
|
||||||
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
Size contentSize(widgetOptions->size()->width(), widgetOptions->size()->height());
|
||||||
textField->setContentSize(contentSize);
|
textField->setContentSize(contentSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace cocostudio
|
||||||
|
|
||||||
label->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
|
label->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));
|
||||||
|
|
||||||
std::string fontName = DICTOOL->getStringValue_json(options, P_FontName, "微软雅黑");
|
std::string fontName = DICTOOL->getStringValue_json(options, P_FontName, "");
|
||||||
|
|
||||||
std::string fontFilePath = jsonPath.append(fontName);
|
std::string fontFilePath = jsonPath.append(fontName);
|
||||||
if (FileUtils::getInstance()->isFileExist(fontFilePath))
|
if (FileUtils::getInstance()->isFileExist(fontFilePath))
|
||||||
|
@ -292,11 +292,6 @@ namespace cocostudio
|
||||||
Text* label = static_cast<Text*>(node);
|
Text* label = static_cast<Text*>(node);
|
||||||
auto options = (TextOptions*)textOptions;
|
auto options = (TextOptions*)textOptions;
|
||||||
|
|
||||||
bool IsCustomSize = options->isCustomSize();
|
|
||||||
label->ignoreContentAdaptWithSize(!IsCustomSize);
|
|
||||||
|
|
||||||
label->setUnifySizeEnabled(false);
|
|
||||||
|
|
||||||
bool touchScaleEnabled = options->touchScaleEnable();
|
bool touchScaleEnabled = options->touchScaleEnable();
|
||||||
label->setTouchScaleChangeEnabled(touchScaleEnabled);
|
label->setTouchScaleChangeEnabled(touchScaleEnabled);
|
||||||
std::string text = options->text()->c_str();
|
std::string text = options->text()->c_str();
|
||||||
|
@ -330,6 +325,11 @@ namespace cocostudio
|
||||||
auto widgetReader = WidgetReader::getInstance();
|
auto widgetReader = WidgetReader::getInstance();
|
||||||
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());
|
||||||
|
|
||||||
|
label->setUnifySizeEnabled(false);
|
||||||
|
|
||||||
|
bool IsCustomSize = options->isCustomSize();
|
||||||
|
label->ignoreContentAdaptWithSize(!IsCustomSize);
|
||||||
|
|
||||||
auto widgetOptions = options->widgetOptions();
|
auto widgetOptions = options->widgetOptions();
|
||||||
if (!label->isIgnoreContentAdaptWithSize())
|
if (!label->isIgnoreContentAdaptWithSize())
|
||||||
{
|
{
|
||||||
|
|
|
@ -661,38 +661,11 @@ void GLViewImpl::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double
|
||||||
|
|
||||||
void GLViewImpl::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
void GLViewImpl::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
EventKeyboard::KeyCode additionalKeyCode = EventKeyboard::KeyCode::KEY_NONE;
|
|
||||||
|
|
||||||
switch (key)
|
|
||||||
{
|
|
||||||
case GLFW_KEY_LEFT_ALT:
|
|
||||||
case GLFW_KEY_RIGHT_ALT:
|
|
||||||
additionalKeyCode = EventKeyboard::KeyCode::KEY_ALT;
|
|
||||||
break;
|
|
||||||
case GLFW_KEY_LEFT_CONTROL:
|
|
||||||
case GLFW_KEY_RIGHT_CONTROL:
|
|
||||||
additionalKeyCode = EventKeyboard::KeyCode::KEY_CTRL;
|
|
||||||
break;
|
|
||||||
case GLFW_KEY_LEFT_SHIFT:
|
|
||||||
case GLFW_KEY_RIGHT_SHIFT:
|
|
||||||
additionalKeyCode = EventKeyboard::KeyCode::KEY_SHIFT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GLFW_REPEAT != action)
|
if (GLFW_REPEAT != action)
|
||||||
{
|
{
|
||||||
EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action);
|
EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action);
|
||||||
auto dispatcher = Director::getInstance()->getEventDispatcher();
|
auto dispatcher = Director::getInstance()->getEventDispatcher();
|
||||||
dispatcher->dispatchEvent(&event);
|
dispatcher->dispatchEvent(&event);
|
||||||
|
|
||||||
// Keep compatibility for the old keycodes like SHIFT, CTRL, ALT.
|
|
||||||
if (additionalKeyCode != EventKeyboard::KeyCode::KEY_NONE)
|
|
||||||
{
|
|
||||||
EventKeyboard additionalEvent(additionalKeyCode, GLFW_PRESS == action);
|
|
||||||
dispatcher->dispatchEvent(&additionalEvent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GLFW_RELEASE != action && g_keyCodeMap[key] == EventKeyboard::KeyCode::KEY_BACKSPACE)
|
if (GLFW_RELEASE != action && g_keyCodeMap[key] == EventKeyboard::KeyCode::KEY_BACKSPACE)
|
||||||
|
|
|
@ -778,13 +778,10 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
||||||
float scaleY = glview->getScaleY();
|
float scaleY = glview->getScaleY();
|
||||||
|
|
||||||
|
|
||||||
if (self.contentScaleFactor == 2.0f)
|
|
||||||
{
|
|
||||||
// Convert to pixel coordinate
|
|
||||||
|
|
||||||
begin = CGRectApplyAffineTransform(begin, CGAffineTransformScale(CGAffineTransformIdentity, 2.0f, 2.0f));
|
// Convert to pixel coordinate
|
||||||
end = CGRectApplyAffineTransform(end, CGAffineTransformScale(CGAffineTransformIdentity, 2.0f, 2.0f));
|
begin = CGRectApplyAffineTransform(begin, CGAffineTransformScale(CGAffineTransformIdentity, self.contentScaleFactor, self.contentScaleFactor));
|
||||||
}
|
end = CGRectApplyAffineTransform(end, CGAffineTransformScale(CGAffineTransformIdentity, self.contentScaleFactor, self.contentScaleFactor));
|
||||||
|
|
||||||
float offestY = glview->getViewPortRect().origin.y;
|
float offestY = glview->getViewPortRect().origin.y;
|
||||||
CCLOG("offestY = %f", offestY);
|
CCLOG("offestY = %f", offestY);
|
||||||
|
@ -861,10 +858,7 @@ UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrien
|
||||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||||
dis *= glview->getScaleY();
|
dis *= glview->getScaleY();
|
||||||
|
|
||||||
if (self.contentScaleFactor == 2.0f)
|
dis /= self.contentScaleFactor;
|
||||||
{
|
|
||||||
dis /= 2.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation]))
|
switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ int register_network_module(lua_State* L)
|
||||||
luaopen_lua_extensions(L);
|
luaopen_lua_extensions(L);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||||
tolua_web_socket_open(L);
|
tolua_web_socket_open(L);
|
||||||
register_web_socket_manual(L);
|
register_web_socket_manual(L);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -132,7 +132,6 @@ private:
|
||||||
Vec2 _anchorPoint;
|
Vec2 _anchorPoint;
|
||||||
UIEditBoxImplIOS_objc* _systemControl;
|
UIEditBoxImplIOS_objc* _systemControl;
|
||||||
int _maxTextLength;
|
int _maxTextLength;
|
||||||
bool _inRetinaMode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -279,9 +279,6 @@ EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText)
|
||||||
, _systemControl(nullptr)
|
, _systemControl(nullptr)
|
||||||
, _maxTextLength(-1)
|
, _maxTextLength(-1)
|
||||||
{
|
{
|
||||||
auto view = cocos2d::Director::getInstance()->getOpenGLView();
|
|
||||||
|
|
||||||
_inRetinaMode = view->isRetinaDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditBoxImplIOS::~EditBoxImplIOS()
|
EditBoxImplIOS::~EditBoxImplIOS()
|
||||||
|
@ -305,11 +302,10 @@ bool EditBoxImplIOS::initWithSize(const Size& size)
|
||||||
|
|
||||||
CGRect rect = CGRectMake(0, 0, size.width * glview->getScaleX(),size.height * glview->getScaleY());
|
CGRect rect = CGRectMake(0, 0, size.width * glview->getScaleX(),size.height * glview->getScaleY());
|
||||||
|
|
||||||
if (_inRetinaMode)
|
CCEAGLView *eaglview = static_cast<CCEAGLView *>(glview->getEAGLView());
|
||||||
{
|
float factor = eaglview.contentScaleFactor;
|
||||||
rect.size.width /= 2.0f;
|
rect.size.width /= factor;
|
||||||
rect.size.height /= 2.0f;
|
rect.size.height /= factor;
|
||||||
}
|
|
||||||
|
|
||||||
_systemControl = [[UIEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this];
|
_systemControl = [[UIEditBoxImplIOS_objc alloc] initWithFrame:rect editBox:this];
|
||||||
if (!_systemControl) break;
|
if (!_systemControl) break;
|
||||||
|
@ -376,7 +372,8 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize)
|
||||||
isValidFontName = false;
|
isValidFontName = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float retinaFactor = _inRetinaMode ? 2.0f : 1.0f;
|
CCEAGLView *eaglview = static_cast<CCEAGLView *>(cocos2d::Director::getInstance()->getOpenGLView()->getEAGLView());
|
||||||
|
float retinaFactor = eaglview.contentScaleFactor;
|
||||||
NSString * fntName = [NSString stringWithUTF8String:pFontName];
|
NSString * fntName = [NSString stringWithUTF8String:pFontName];
|
||||||
|
|
||||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||||
|
@ -554,7 +551,7 @@ void EditBoxImplIOS::setPlaceHolder(const char* pText)
|
||||||
_labelPlaceHolder->setString(pText);
|
_labelPlaceHolder->setString(pText);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CGPoint convertDesignCoordToScreenCoord(const Vec2& designCoord, bool bInRetinaMode)
|
static CGPoint convertDesignCoordToScreenCoord(const Vec2& designCoord)
|
||||||
{
|
{
|
||||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||||
CCEAGLView *eaglview = (CCEAGLView *) glview->getEAGLView();
|
CCEAGLView *eaglview = (CCEAGLView *) glview->getEAGLView();
|
||||||
|
@ -566,11 +563,10 @@ static CGPoint convertDesignCoordToScreenCoord(const Vec2& designCoord, bool bIn
|
||||||
|
|
||||||
CGPoint screenPos = CGPointMake(screenGLPos.x, viewH - screenGLPos.y);
|
CGPoint screenPos = CGPointMake(screenGLPos.x, viewH - screenGLPos.y);
|
||||||
|
|
||||||
if (bInRetinaMode)
|
float factor = eaglview.contentScaleFactor;
|
||||||
{
|
screenPos.x = screenPos.x / factor;
|
||||||
screenPos.x = screenPos.x / 2.0f;
|
screenPos.y = screenPos.y / factor;
|
||||||
screenPos.y = screenPos.y / 2.0f;
|
|
||||||
}
|
|
||||||
CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y);
|
CCLOGINFO("[EditBox] pos x = %f, y = %f", screenGLPos.x, screenGLPos.y);
|
||||||
return screenPos;
|
return screenPos;
|
||||||
}
|
}
|
||||||
|
@ -594,11 +590,11 @@ void EditBoxImplIOS::setContentSize(const Size& size)
|
||||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||||
CGSize controlSize = CGSizeMake(size.width * glview->getScaleX(),size.height * glview->getScaleY());
|
CGSize controlSize = CGSizeMake(size.width * glview->getScaleX(),size.height * glview->getScaleY());
|
||||||
|
|
||||||
if (_inRetinaMode)
|
CCEAGLView *eaglview = static_cast<CCEAGLView *>(glview->getEAGLView());
|
||||||
{
|
float factor = eaglview.contentScaleFactor;
|
||||||
controlSize.width /= 2.0f;
|
controlSize.width /= factor;
|
||||||
controlSize.height /= 2.0f;
|
controlSize.height /= factor;
|
||||||
}
|
|
||||||
[_systemControl setContentSize:controlSize];
|
[_systemControl setContentSize:controlSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -638,7 +634,7 @@ void EditBoxImplIOS::adjustTextFieldPosition()
|
||||||
rect = RectApplyAffineTransform(rect, _editBox->nodeToWorldTransform());
|
rect = RectApplyAffineTransform(rect, _editBox->nodeToWorldTransform());
|
||||||
|
|
||||||
Vec2 designCoord = Vec2(rect.origin.x, rect.origin.y + rect.size.height);
|
Vec2 designCoord = Vec2(rect.origin.x, rect.origin.y + rect.size.height);
|
||||||
[_systemControl setPosition:convertDesignCoordToScreenCoord(designCoord, _inRetinaMode)];
|
[_systemControl setPosition:convertDesignCoordToScreenCoord(designCoord)];
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditBoxImplIOS::openKeyboard()
|
void EditBoxImplIOS::openKeyboard()
|
||||||
|
|
|
@ -360,6 +360,7 @@ void Text::copySpecialProperties(Widget *widget)
|
||||||
setTextHorizontalAlignment(label->_labelRenderer->getHorizontalAlignment());
|
setTextHorizontalAlignment(label->_labelRenderer->getHorizontalAlignment());
|
||||||
setTextVerticalAlignment(label->_labelRenderer->getVerticalAlignment());
|
setTextVerticalAlignment(label->_labelRenderer->getVerticalAlignment());
|
||||||
setTextAreaSize(label->_labelRenderer->getDimensions());
|
setTextAreaSize(label->_labelRenderer->getDimensions());
|
||||||
|
setContentSize(label->getContentSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version":"v3-deps-28",
|
"version":"v3-deps-29",
|
||||||
"zip_file_size":"87419231",
|
"zip_file_size":"87419231",
|
||||||
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
||||||
"repo_parent":"https://github.com/cocos2d/",
|
"repo_parent":"https://github.com/cocos2d/",
|
||||||
|
|
|
@ -222,7 +222,7 @@ void TestChangePlaySection::onEnter()
|
||||||
ActionTimelineTestLayer::onEnter();
|
ActionTimelineTestLayer::onEnter();
|
||||||
|
|
||||||
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
|
Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
|
||||||
ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
|
action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
|
||||||
|
|
||||||
node->runAction(action);
|
node->runAction(action);
|
||||||
action->gotoFrameAndPlay(41, action->getDuration(), true);
|
action->gotoFrameAndPlay(41, action->getDuration(), true);
|
||||||
|
@ -247,9 +247,9 @@ std::string TestChangePlaySection::title() const
|
||||||
void TestChangePlaySection::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
void TestChangePlaySection::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
||||||
{
|
{
|
||||||
if(action->getStartFrame() == 0)
|
if(action->getStartFrame() == 0)
|
||||||
action->gotoFrameAndPlay(70, action->getDuration(), true);
|
action->gotoFrameAndPlay(41, action->getDuration(), true);
|
||||||
else
|
else
|
||||||
action->gotoFrameAndPlay(0, 60, true);
|
action->gotoFrameAndPlay(0, 40, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestFrameEvent
|
// TestFrameEvent
|
||||||
|
|
|
@ -1215,7 +1215,7 @@ local function ExtensionsMainLayer()
|
||||||
cc.MenuItemFont:setFontSize(24)
|
cc.MenuItemFont:setFontSize(24)
|
||||||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||||
local bSupportWebSocket = false
|
local bSupportWebSocket = false
|
||||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or (cc.PLATFORM_OS_ANDROID == targetPlatform) or (cc.PLATFORM_OS_WINDOWS == targetPlatform) then
|
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or (cc.PLATFORM_OS_ANDROID == targetPlatform) or (cc.PLATFORM_OS_WINDOWS == targetPlatform) or (cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||||
bSupportWebSocket = true
|
bSupportWebSocket = true
|
||||||
end
|
end
|
||||||
local bSupportEdit = false
|
local bSupportEdit = false
|
||||||
|
|
Loading…
Reference in New Issue