mirror of https://github.com/axmolengine/axmol.git
Merge pull request #10166 from pipu/parse_anchorpointframe
Modify bug that parses AnchorPointFrame.
This commit is contained in:
commit
f9116f7c6d
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue