Modify bug that parses AnchorPointFrame.

This commit is contained in:
pipu 2015-01-22 11:20:01 +08:00
parent 0c8d10b8dd
commit c0a662ff13
3 changed files with 32 additions and 0 deletions

View File

@ -55,6 +55,7 @@ static const char* Property_CColor = "CColor";
static const char* Property_FileData = "FileData";
static const char* Property_FrameEvent = "FrameEvent";
static const char* Property_Alpha = "Alpha";
static const char* Property_AnchorPoint = "AnchorPoint";
static const char* Property_ZOrder = "ZOrder";
static const char* Property_ActionValue = "ActionValue";
@ -533,6 +534,11 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti
auto intFrame = frameFlatbuf->intFrame();
frame = loadAlphaFrameWithFlatBuffers(intFrame);
}
else if (property == Property_AnchorPoint)
{
auto scaleFrame = frameFlatbuf->scaleFrame();
frame = loadAnchorPointFrameWithFlatBuffers(scaleFrame);
}
else if (property == Property_ZOrder)
{
auto intFrame = frameFlatbuf->intFrame();
@ -737,6 +743,23 @@ Frame* ActionTimelineCache::loadAlphaFrameWithFlatBuffers(const flatbuffers::Int
return frame;
}
Frame* ActionTimelineCache::loadAnchorPointFrameWithFlatBuffers(const flatbuffers::ScaleFrame *flatbuffers)
{
AnchorPointFrame* frame = AnchorPointFrame::create();
auto f_scale = flatbuffers->scale();
Vec2 scale(f_scale->scaleX(), f_scale->scaleY());
frame->setAnchorPoint(scale);
int frameIndex = flatbuffers->frameIndex();
frame->setFrameIndex(frameIndex);
bool tween = flatbuffers->tween();
frame->setTween(tween);
return frame;
}
Frame* ActionTimelineCache::loadZOrderFrameWithFlatBuffers(const flatbuffers::IntFrame *flatbuffers)
{
ZOrderFrame* frame = ZOrderFrame::create();

View File

@ -112,6 +112,7 @@ protected:
Frame* loadTextureFrameWithFlatBuffers (const flatbuffers::TextureFrame* flatbuffers);
Frame* loadEventFrameWithFlatBuffers (const flatbuffers::EventFrame* flatbuffers);
Frame* loadAlphaFrameWithFlatBuffers (const flatbuffers::IntFrame* flatbuffers);
Frame* loadAnchorPointFrameWithFlatBuffers (const flatbuffers::ScaleFrame* flatbuffers);
Frame* loadZOrderFrameWithFlatBuffers (const flatbuffers::IntFrame* flatbuffers);
Frame* loadInnerActionFrameWithFlatBuffers (const flatbuffers::InnerActionFrame* flatbuffers);

View File

@ -76,6 +76,7 @@ static const char* Property_CColor = "CColor";
static const char* Property_FileData = "FileData";
static const char* Property_FrameEvent = "FrameEvent";
static const char* Property_Alpha = "Alpha";
static const char* Property_AnchorPoint = "AnchorPoint";
static const char* Property_ZOrder = "ZOrder";
static const char* Property_ActionValue = "ActionValue";
@ -703,6 +704,13 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
0, // EventFrame
intFrame);
}
else if (property == Property_AnchorPoint)
{
auto scaleFrame = createScaleFrame(frameElement);
frame = CreateFrame(*_builder,
0, // PointFrame
scaleFrame);
}
else if (property == Property_ZOrder)
{
auto intFrame = createIntFrame(frameElement);