mirror of https://github.com/axmolengine/axmol.git
change TimelineAction to ActionTimeline
This commit is contained in:
parent
b181eaf802
commit
2031e0e92d
|
@ -22,15 +22,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCTimelineAction.h"
|
||||
#include "CCActionTimeline.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
||||
// TimelineActionData
|
||||
TimelineActionData* TimelineActionData::create(int actionTag)
|
||||
// ActionTimelineData
|
||||
ActionTimelineData* ActionTimelineData::create(int actionTag)
|
||||
{
|
||||
TimelineActionData * ret = new TimelineActionData();
|
||||
ActionTimelineData * ret = new ActionTimelineData();
|
||||
if (ret && ret->init(actionTag))
|
||||
{
|
||||
ret->autorelease();
|
||||
|
@ -42,22 +42,22 @@ TimelineActionData* TimelineActionData::create(int actionTag)
|
|||
return ret;
|
||||
}
|
||||
|
||||
TimelineActionData::TimelineActionData()
|
||||
ActionTimelineData::ActionTimelineData()
|
||||
: _actionTag(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool TimelineActionData::init(int actionTag)
|
||||
bool ActionTimelineData::init(int actionTag)
|
||||
{
|
||||
_actionTag = actionTag;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// TimelineAction
|
||||
TimelineAction* TimelineAction::create()
|
||||
// ActionTimeline
|
||||
ActionTimeline* ActionTimeline::create()
|
||||
{
|
||||
TimelineAction* object = new TimelineAction();
|
||||
ActionTimeline* object = new ActionTimeline();
|
||||
if (object && object->init())
|
||||
{
|
||||
object->autorelease();
|
||||
|
@ -67,7 +67,7 @@ TimelineAction* TimelineAction::create()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
TimelineAction::TimelineAction()
|
||||
ActionTimeline::ActionTimeline()
|
||||
: _duration(0)
|
||||
, _time(0)
|
||||
, _timeSpeed(1)
|
||||
|
@ -79,26 +79,26 @@ TimelineAction::TimelineAction()
|
|||
{
|
||||
}
|
||||
|
||||
TimelineAction::~TimelineAction()
|
||||
ActionTimeline::~ActionTimeline()
|
||||
{
|
||||
}
|
||||
|
||||
bool TimelineAction::init()
|
||||
bool ActionTimeline::init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TimelineAction::gotoFrameAndPlay(int startIndex)
|
||||
void ActionTimeline::gotoFrameAndPlay(int startIndex)
|
||||
{
|
||||
gotoFrameAndPlay(startIndex, true);
|
||||
}
|
||||
|
||||
void TimelineAction::gotoFrameAndPlay(int startIndex, bool loop)
|
||||
void ActionTimeline::gotoFrameAndPlay(int startIndex, bool loop)
|
||||
{
|
||||
gotoFrameAndPlay(startIndex, _duration, loop);
|
||||
}
|
||||
|
||||
void TimelineAction::gotoFrameAndPlay(int startIndex, int endIndex, bool loop)
|
||||
void ActionTimeline::gotoFrameAndPlay(int startIndex, int endIndex, bool loop)
|
||||
{
|
||||
_endFrame = endIndex;
|
||||
_loop = loop;
|
||||
|
@ -109,7 +109,7 @@ void TimelineAction::gotoFrameAndPlay(int startIndex, int endIndex, bool loop)
|
|||
gotoFrame(_currentFrame);
|
||||
}
|
||||
|
||||
void TimelineAction::gotoFrameAndPause(int startIndex)
|
||||
void ActionTimeline::gotoFrameAndPause(int startIndex)
|
||||
{
|
||||
_time =_currentFrame = startIndex;
|
||||
|
||||
|
@ -117,34 +117,24 @@ void TimelineAction::gotoFrameAndPause(int startIndex)
|
|||
gotoFrame(_currentFrame);
|
||||
}
|
||||
|
||||
void TimelineAction::pause()
|
||||
void ActionTimeline::pause()
|
||||
{
|
||||
_playing = false;
|
||||
}
|
||||
|
||||
void TimelineAction::resume()
|
||||
void ActionTimeline::resume()
|
||||
{
|
||||
_playing = true;
|
||||
}
|
||||
|
||||
bool TimelineAction::isPlaying()
|
||||
bool ActionTimeline::isPlaying() const
|
||||
{
|
||||
return _playing;
|
||||
}
|
||||
|
||||
void TimelineAction::setTimeSpeed(float speed)
|
||||
ActionTimeline* ActionTimeline::clone() const
|
||||
{
|
||||
_timeSpeed = speed;
|
||||
}
|
||||
|
||||
float TimelineAction::getTimeSpeed()
|
||||
{
|
||||
return _timeSpeed;
|
||||
}
|
||||
|
||||
TimelineAction* TimelineAction::clone() const
|
||||
{
|
||||
TimelineAction* newAction = TimelineAction::create();
|
||||
ActionTimeline* newAction = ActionTimeline::create();
|
||||
newAction->setDuration(_duration);
|
||||
newAction->setTimeSpeed(_timeSpeed);
|
||||
|
||||
|
@ -160,7 +150,7 @@ TimelineAction* TimelineAction::clone() const
|
|||
return newAction;
|
||||
}
|
||||
|
||||
void TimelineAction::step(float delta)
|
||||
void ActionTimeline::step(float delta)
|
||||
{
|
||||
if (!_playing || _timelineMap.size() == 0 || _duration == 0)
|
||||
{
|
||||
|
@ -194,14 +184,14 @@ void foreachNodeDescendant(Node* parent, tCallBack callback)
|
|||
}
|
||||
}
|
||||
|
||||
void TimelineAction::startWithTarget(Node *target)
|
||||
void ActionTimeline::startWithTarget(Node *target)
|
||||
{
|
||||
Action::startWithTarget(target);
|
||||
|
||||
foreachNodeDescendant(target,
|
||||
[this, target](Node* child)
|
||||
{
|
||||
TimelineActionData* data = dynamic_cast<TimelineActionData*>(child->getUserObject());
|
||||
ActionTimelineData* data = dynamic_cast<ActionTimelineData*>(child->getUserObject());
|
||||
int actionTag = data->getActionTag();
|
||||
if(_timelineMap.find(actionTag) != _timelineMap.end())
|
||||
{
|
||||
|
@ -214,7 +204,7 @@ void TimelineAction::startWithTarget(Node *target)
|
|||
});
|
||||
}
|
||||
|
||||
void TimelineAction::addTimeline(Timeline* timeline)
|
||||
void ActionTimeline::addTimeline(Timeline* timeline)
|
||||
{
|
||||
int tag = timeline->getActionTag();
|
||||
if (_timelineMap.find(tag) == _timelineMap.end())
|
||||
|
@ -226,11 +216,11 @@ void TimelineAction::addTimeline(Timeline* timeline)
|
|||
{
|
||||
_timelineList.pushBack(timeline);
|
||||
_timelineMap[tag].pushBack(timeline);
|
||||
timeline->setTimelineAction(this);
|
||||
timeline->setActionTimeline(this);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineAction::removeTimeline(Timeline* timeline)
|
||||
void ActionTimeline::removeTimeline(Timeline* timeline)
|
||||
{
|
||||
int tag = timeline->getActionTag();
|
||||
if (_timelineMap.find(tag) != _timelineMap.end())
|
||||
|
@ -239,23 +229,23 @@ void TimelineAction::removeTimeline(Timeline* timeline)
|
|||
{
|
||||
_timelineMap[tag].eraseObject(timeline);
|
||||
_timelineList.eraseObject(timeline);
|
||||
timeline->setTimelineAction(nullptr);
|
||||
timeline->setActionTimeline(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineAction::setFrameEventCallFunc(std::function<void(Frame *)> listener)
|
||||
void ActionTimeline::setFrameEventCallFunc(std::function<void(Frame *)> listener)
|
||||
{
|
||||
_frameEventListener = listener;
|
||||
}
|
||||
|
||||
void TimelineAction::clearFrameEventCallFunc()
|
||||
void ActionTimeline::clearFrameEventCallFunc()
|
||||
{
|
||||
_frameEventListener = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void TimelineAction::emitFrameEvent(Frame* frame)
|
||||
void ActionTimeline::emitFrameEvent(Frame* frame)
|
||||
{
|
||||
if(_frameEventListener)
|
||||
{
|
||||
|
@ -263,7 +253,7 @@ void TimelineAction::emitFrameEvent(Frame* frame)
|
|||
}
|
||||
}
|
||||
|
||||
void TimelineAction::gotoFrame(int frameIndex)
|
||||
void ActionTimeline::gotoFrame(int frameIndex)
|
||||
{
|
||||
int size = _timelineList.size();
|
||||
for(int i = 0; i<size; i++)
|
||||
|
@ -272,7 +262,7 @@ void TimelineAction::gotoFrame(int frameIndex)
|
|||
}
|
||||
}
|
||||
|
||||
void TimelineAction::stepToFrame(int frameIndex)
|
||||
void ActionTimeline::stepToFrame(int frameIndex)
|
||||
{
|
||||
int size = _timelineList.size();
|
||||
for(int i = 0; i<size; i++)
|
|
@ -33,31 +33,30 @@ THE SOFTWARE.
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
typedef void (Ref::*SEL_FrameEventCallFunc)(Frame *);
|
||||
#define frameEvent_selector(_SELECTOR) (SEL_FrameEventCallFunc)(&_SELECTOR)
|
||||
|
||||
class CC_DLL TimelineActionData : public Ref
|
||||
class CC_DLL ActionTimelineData : public Ref
|
||||
{
|
||||
public:
|
||||
static TimelineActionData* create(int actionTag);
|
||||
static ActionTimelineData* create(int actionTag);
|
||||
|
||||
virtual void setActionTag(int actionTag) { _actionTag = actionTag; }
|
||||
virtual int getActionTag() { return _actionTag; }
|
||||
virtual int getActionTag() const { return _actionTag; }
|
||||
protected:
|
||||
TimelineActionData();
|
||||
ActionTimelineData();
|
||||
virtual bool init(int actionTag);
|
||||
|
||||
int _actionTag;
|
||||
};
|
||||
|
||||
|
||||
class CC_DLL TimelineAction : public Action
|
||||
class CC_DLL ActionTimeline : public Action
|
||||
{
|
||||
public:
|
||||
static TimelineAction* create();
|
||||
friend class Frame;
|
||||
|
||||
TimelineAction();
|
||||
virtual ~TimelineAction();
|
||||
static ActionTimeline* create();
|
||||
|
||||
ActionTimeline();
|
||||
virtual ~ActionTimeline();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
|
@ -90,46 +89,45 @@ public:
|
|||
virtual void resume();
|
||||
|
||||
/** Whether or not Action is playing. */
|
||||
virtual bool isPlaying();
|
||||
virtual bool isPlaying() const;
|
||||
|
||||
/** Set the animation speed, this will speed up or slow down the speed. */
|
||||
virtual void setTimeSpeed(float speed);
|
||||
virtual void setTimeSpeed(float speed) { _timeSpeed = speed; }
|
||||
/** Get current animation speed. */
|
||||
virtual float getTimeSpeed();
|
||||
virtual float getTimeSpeed() const { return _timeSpeed; }
|
||||
|
||||
/** duration of the whole action*/
|
||||
virtual void setDuration(int duration) { _duration = duration; }
|
||||
virtual int getDuration() { return _duration; }
|
||||
virtual int getDuration() const { return _duration; }
|
||||
|
||||
/** End frame of this action.
|
||||
* When action play to this frame, if action is not loop, then it will stop,
|
||||
* or it will play from start frame again. */
|
||||
virtual void setEndFrame(int endFrame) { _endFrame = endFrame; }
|
||||
virtual int getEndFrame() { return _endFrame; }
|
||||
virtual int getEndFrame() const { return _endFrame; }
|
||||
|
||||
/** Get current frame. */
|
||||
virtual int getCurrentFrame() { return _currentFrame; }
|
||||
virtual int getCurrentFrame() const { return _currentFrame; }
|
||||
|
||||
/** add Timeline to TimelineAction */
|
||||
/** add Timeline to ActionTimeline */
|
||||
virtual void addTimeline(Timeline* timeline);
|
||||
virtual void removeTimeline(Timeline* timeline);
|
||||
|
||||
/** Set TimelineAction's frame event callback function */
|
||||
virtual const Vector<Timeline*>& getTimelines() const { return _timelineList; }
|
||||
|
||||
/** Set ActionTimeline's frame event callback function */
|
||||
void setFrameEventCallFunc(std::function<void(Frame *)> listener);
|
||||
void clearFrameEventCallFunc();
|
||||
|
||||
/** emit frame event, call it when enter a frame*/
|
||||
void emitFrameEvent(Frame* frame);
|
||||
|
||||
/** Inherit from Action. */
|
||||
|
||||
/** Returns a clone of TimelineAction */
|
||||
virtual TimelineAction* clone() const override;
|
||||
/** Returns a clone of ActionTimeline */
|
||||
virtual ActionTimeline* clone() const override;
|
||||
|
||||
/** Returns a reverse of TimelineAction.
|
||||
/** Returns a reverse of ActionTimeline.
|
||||
* Not implement yet.
|
||||
*/
|
||||
virtual TimelineAction* reverse() const override { return nullptr; }
|
||||
virtual ActionTimeline* reverse() const override { return nullptr; }
|
||||
|
||||
virtual void step(float delta) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
@ -138,6 +136,9 @@ protected:
|
|||
virtual void gotoFrame(int frameIndex);
|
||||
virtual void stepToFrame(int frameIndex);
|
||||
|
||||
/** emit frame event, call it when enter a frame*/
|
||||
virtual void emitFrameEvent(Frame* frame);
|
||||
|
||||
std::map<int, Vector<Timeline*>> _timelineMap;
|
||||
Vector<Timeline*> _timelineList;
|
||||
|
|
@ -24,7 +24,8 @@ THE SOFTWARE.
|
|||
|
||||
#include "2d/CCFrame.h"
|
||||
#include "2d/CCTimeLine.h"
|
||||
#include "2d/CCTimelineAction.h"
|
||||
#include "2d/CCTimeLine.h"
|
||||
#include "2d/CCActionTimeline.h"
|
||||
#include "2d/CCSprite.h"
|
||||
#include "2d/CCSpriteFrameCache.h"
|
||||
|
||||
|
@ -43,6 +44,14 @@ Frame::~Frame()
|
|||
{
|
||||
}
|
||||
|
||||
void Frame::emitEvent()
|
||||
{
|
||||
if (_timeline)
|
||||
{
|
||||
_timeline->getActionTimeline()->emitFrameEvent(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Frame::cloneProperty(Frame* frame)
|
||||
{
|
||||
_frameIndex = frame->getFrameIndex();
|
||||
|
@ -583,10 +592,7 @@ EventFrame::EventFrame()
|
|||
|
||||
void EventFrame::onEnter(Frame *nextFrame)
|
||||
{
|
||||
if (_timeline)
|
||||
{
|
||||
_timeline->getTimelineAction()->emitFrameEvent(this);
|
||||
}
|
||||
emitEvent();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,27 +25,32 @@ THE SOFTWARE.
|
|||
#ifndef __CCFRAME_H__
|
||||
#define __CCFRAME_H__
|
||||
|
||||
#include "CCTimeLine.h"
|
||||
#include "base/CCRef.h"
|
||||
#include "math/Vec2.h"
|
||||
#include "GL/glew.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include <string>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Sprite;
|
||||
class Timeline;
|
||||
|
||||
class CC_DLL Frame : public Ref
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void setFrameIndex(unsigned int frameIndex) { _frameIndex = frameIndex; }
|
||||
virtual unsigned int getFrameIndex()const { return _frameIndex; }
|
||||
virtual unsigned int getFrameIndex() const { return _frameIndex; }
|
||||
|
||||
virtual void setTimeline(Timeline* timeline) { _timeline = timeline; }
|
||||
virtual Timeline* getTimeline() { return _timeline; }
|
||||
virtual Timeline* getTimeline() const { return _timeline; }
|
||||
|
||||
virtual void setNode(Node* node) { _node = node; }
|
||||
virtual Node* getTimelineNode() const { return _node; }
|
||||
|
||||
virtual void setTween(bool tween) { _tween = tween; }
|
||||
virtual bool isTween()const { return _tween; }
|
||||
virtual bool isTween() const { return _tween; }
|
||||
|
||||
virtual void onEnter(Frame *nextFrame) = 0;
|
||||
virtual void apply(float percent) {}
|
||||
|
@ -55,9 +60,9 @@ protected:
|
|||
Frame();
|
||||
virtual ~Frame();
|
||||
|
||||
void cloneProperty(Frame* frame);
|
||||
virtual void emitEvent();
|
||||
virtual void cloneProperty(Frame* frame);
|
||||
protected:
|
||||
friend class Timeline;
|
||||
|
||||
unsigned int _frameIndex;
|
||||
bool _tween;
|
||||
|
@ -179,8 +184,8 @@ public:
|
|||
inline void setX(float x) { _position.x = x; }
|
||||
inline void setY(float y) { _position.y = y; }
|
||||
|
||||
inline float getX() { return _position.x; }
|
||||
inline float getY() { return _position.y; }
|
||||
inline float getX() const { return _position.x; }
|
||||
inline float getY() const { return _position.y; }
|
||||
protected:
|
||||
Point _position;
|
||||
float _betweenX;
|
||||
|
|
|
@ -23,8 +23,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCTimeLine.h"
|
||||
#include "CCTimelineAction.h"
|
||||
#include "CCFrame.h"
|
||||
#include "CCActionTimeline.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -47,7 +46,7 @@ Timeline::Timeline()
|
|||
, _toIndex(0)
|
||||
, _betweenDuration(0)
|
||||
, _actionTag(0)
|
||||
, _timelineAction(nullptr)
|
||||
, _ActionTimeline(nullptr)
|
||||
, _node(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -82,7 +81,7 @@ Timeline* Timeline::clone()
|
|||
for (auto frame : _frames)
|
||||
{
|
||||
Frame* newFrame = frame->clone();
|
||||
timeline->getFrames().pushBack(newFrame);
|
||||
timeline->addFrame(newFrame);
|
||||
}
|
||||
|
||||
return timeline;
|
||||
|
@ -114,7 +113,7 @@ void Timeline::setNode(Node* node)
|
|||
}
|
||||
}
|
||||
|
||||
Node* Timeline::getNode()
|
||||
Node* Timeline::getNode() const
|
||||
{
|
||||
return _node;
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ THE SOFTWARE.
|
|||
#define __CCTIMELINE_H__
|
||||
|
||||
#include "2d/CCNode.h"
|
||||
#include "2d/CCFrame.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Frame;
|
||||
class TimelineAction;
|
||||
class ActionTimeline;
|
||||
|
||||
class CC_DLL Timeline : public Ref
|
||||
{
|
||||
|
@ -43,7 +43,6 @@ public:
|
|||
virtual void gotoFrame(int frameIndex);
|
||||
virtual void stepToFrame(int frameIndex);
|
||||
|
||||
virtual Vector<Frame*>& getFrames() { return _frames; }
|
||||
virtual const Vector<Frame*>& getFrames() const { return _frames; }
|
||||
|
||||
virtual void addFrame(Frame* frame);
|
||||
|
@ -51,17 +50,16 @@ public:
|
|||
virtual void removeFrame(Frame* frame);
|
||||
|
||||
virtual void setActionTag(int tag) { _actionTag = tag; }
|
||||
virtual int getActionTag() { return _actionTag; }
|
||||
virtual int getActionTag() const { return _actionTag; }
|
||||
|
||||
virtual void setNode(Node* node);
|
||||
virtual Node* getNode();
|
||||
virtual Node* getNode() const;
|
||||
|
||||
virtual void setTimelineAction(TimelineAction* action) { _timelineAction = action; }
|
||||
virtual TimelineAction* getTimelineAction() { return _timelineAction; }
|
||||
virtual void setActionTimeline(ActionTimeline* action) { _ActionTimeline = action; }
|
||||
virtual ActionTimeline* getActionTimeline() const { return _ActionTimeline; }
|
||||
|
||||
virtual Timeline* clone();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void apply(int frameIndex);
|
||||
|
||||
|
@ -77,7 +75,7 @@ protected:
|
|||
int _betweenDuration;
|
||||
int _actionTag;
|
||||
|
||||
TimelineAction* _timelineAction;
|
||||
ActionTimeline* _ActionTimeline;
|
||||
Node* _node;
|
||||
};
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClCompile Include="CCTextFieldTTF.cpp" />
|
||||
<ClCompile Include="CCTileMapAtlas.cpp" />
|
||||
<ClCompile Include="CCTimeLine.cpp" />
|
||||
<ClCompile Include="CCTimelineAction.cpp" />
|
||||
<ClCompile Include="CCActionTimeline.cpp" />
|
||||
<ClCompile Include="CCTMXLayer.cpp" />
|
||||
<ClCompile Include="CCTMXObjectGroup.cpp" />
|
||||
<ClCompile Include="CCTMXTiledMap.cpp" />
|
||||
|
@ -532,7 +532,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
|||
<ClInclude Include="CCTextFieldTTF.h" />
|
||||
<ClInclude Include="CCTileMapAtlas.h" />
|
||||
<ClInclude Include="CCTimeLine.h" />
|
||||
<ClInclude Include="CCTimelineAction.h" />
|
||||
<ClInclude Include="CCActionTimeline.h" />
|
||||
<ClInclude Include="CCTMXLayer.h" />
|
||||
<ClInclude Include="CCTMXObjectGroup.h" />
|
||||
<ClInclude Include="CCTMXTiledMap.h" />
|
||||
|
|
|
@ -574,7 +574,7 @@
|
|||
<ClCompile Include="CCTimeLine.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CCTimelineAction.cpp">
|
||||
<ClCompile Include="CCActionTimeline.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -1165,7 +1165,7 @@
|
|||
<ClInclude Include="CCTimeLine.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CCTimelineAction.h">
|
||||
<ClInclude Include="CCActionTimeline.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -23,7 +23,7 @@ cocos2d.cpp \
|
|||
2d/CCActionTween.cpp \
|
||||
2d/CCFrame.cpp \
|
||||
2d/CCTimeline.cpp \
|
||||
2d/CCTimelineAction.cpp \
|
||||
2d/CCActionTimeline.cpp \
|
||||
2d/CCAnimation.cpp \
|
||||
2d/CCAnimationCache.cpp \
|
||||
2d/CCAtlasNode.cpp \
|
||||
|
|
|
@ -106,7 +106,7 @@ THE SOFTWARE.
|
|||
#include "2d/CCTweenFunction.h"
|
||||
#include "2d/CCFrame.h"
|
||||
#include "2d/CCTimeLine.h"
|
||||
#include "2d/CCTimelineAction.h"
|
||||
#include "2d/CCActionTimeline.h"
|
||||
|
||||
// 2d nodes
|
||||
#include "2d/CCNode.h"
|
||||
|
|
|
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCTimelineActionCache.h"
|
||||
#include "CCActionTimelineCache.h"
|
||||
#include "CCNodeReader.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
@ -65,48 +65,48 @@ static const char* BLUE = "blue";
|
|||
static const char* Value = "value";
|
||||
|
||||
|
||||
static TimelineActionCache* _sharedActionCache = nullptr;
|
||||
static ActionTimelineCache* _sharedActionCache = nullptr;
|
||||
|
||||
TimelineActionCache* TimelineActionCache::getInstance()
|
||||
ActionTimelineCache* ActionTimelineCache::getInstance()
|
||||
{
|
||||
if (! _sharedActionCache)
|
||||
{
|
||||
_sharedActionCache = new TimelineActionCache();
|
||||
_sharedActionCache = new ActionTimelineCache();
|
||||
_sharedActionCache->init();
|
||||
}
|
||||
|
||||
return _sharedActionCache;
|
||||
}
|
||||
|
||||
void TimelineActionCache::destroyInstance()
|
||||
void ActionTimelineCache::destroyInstance()
|
||||
{
|
||||
CC_SAFE_DELETE(_sharedActionCache);
|
||||
}
|
||||
|
||||
void TimelineActionCache::purge()
|
||||
void ActionTimelineCache::purge()
|
||||
{
|
||||
_animationActions.clear();
|
||||
}
|
||||
|
||||
void TimelineActionCache::init()
|
||||
void ActionTimelineCache::init()
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
_funcs.insert(Pair(FrameType_VisibleFrame, std::bind(&TimelineActionCache::loadVisibleFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_PositionFrame, std::bind(&TimelineActionCache::loadPositionFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_ScaleFrame, std::bind(&TimelineActionCache::loadScaleFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_RotationFrame, std::bind(&TimelineActionCache::loadRotationFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_SkewFrame, std::bind(&TimelineActionCache::loadSkewFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_RotationSkewFrame, std::bind(&TimelineActionCache::loadRotationSkewFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_AnchorFrame, std::bind(&TimelineActionCache::loadAnchorPointFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_InnerActionFrame, std::bind(&TimelineActionCache::loadInnerActionFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_ColorFrame, std::bind(&TimelineActionCache::loadColorFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_TextureFrame, std::bind(&TimelineActionCache::loadTextureFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_EventFrame, std::bind(&TimelineActionCache::loadEventFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_ZOrderFrame, std::bind(&TimelineActionCache::loadZOrderFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_VisibleFrame, std::bind(&ActionTimelineCache::loadVisibleFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_PositionFrame, std::bind(&ActionTimelineCache::loadPositionFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_ScaleFrame, std::bind(&ActionTimelineCache::loadScaleFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_RotationFrame, std::bind(&ActionTimelineCache::loadRotationFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_SkewFrame, std::bind(&ActionTimelineCache::loadSkewFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_RotationSkewFrame, std::bind(&ActionTimelineCache::loadRotationSkewFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_AnchorFrame, std::bind(&ActionTimelineCache::loadAnchorPointFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_InnerActionFrame, std::bind(&ActionTimelineCache::loadInnerActionFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_ColorFrame, std::bind(&ActionTimelineCache::loadColorFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_TextureFrame, std::bind(&ActionTimelineCache::loadTextureFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_EventFrame, std::bind(&ActionTimelineCache::loadEventFrame, this, _1)));
|
||||
_funcs.insert(Pair(FrameType_ZOrderFrame, std::bind(&ActionTimelineCache::loadZOrderFrame, this, _1)));
|
||||
|
||||
}
|
||||
|
||||
void TimelineActionCache::removeAction(const std::string& fileName)
|
||||
void ActionTimelineCache::removeAction(const std::string& fileName)
|
||||
{
|
||||
if (_animationActions.find(fileName) != _animationActions.end())
|
||||
{
|
||||
|
@ -114,9 +114,9 @@ void TimelineActionCache::removeAction(const std::string& fileName)
|
|||
}
|
||||
}
|
||||
|
||||
TimelineAction* TimelineActionCache::createAction(const std::string& fileName)
|
||||
ActionTimeline* ActionTimelineCache::createAction(const std::string& fileName)
|
||||
{
|
||||
TimelineAction* action = _animationActions.at(fileName);
|
||||
ActionTimeline* action = _animationActions.at(fileName);
|
||||
if (action == nullptr)
|
||||
{
|
||||
action = loadAnimationActionWithFile(fileName);
|
||||
|
@ -124,7 +124,7 @@ TimelineAction* TimelineActionCache::createAction(const std::string& fileName)
|
|||
return action->clone();
|
||||
}
|
||||
|
||||
TimelineAction* TimelineActionCache::loadAnimationActionWithFile(const std::string& fileName)
|
||||
ActionTimeline* ActionTimelineCache::loadAnimationActionWithFile(const std::string& fileName)
|
||||
{
|
||||
// Read content from file
|
||||
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
|
||||
|
@ -133,10 +133,10 @@ TimelineAction* TimelineActionCache::loadAnimationActionWithFile(const std::stri
|
|||
return loadAnimationActionWithContent(fileName, contentStr);
|
||||
}
|
||||
|
||||
TimelineAction* TimelineActionCache::loadAnimationActionWithContent(const std::string&fileName, const std::string& content)
|
||||
ActionTimeline* ActionTimelineCache::loadAnimationActionWithContent(const std::string&fileName, const std::string& content)
|
||||
{
|
||||
// if already exists an action with filename, then return this action
|
||||
TimelineAction* action = _animationActions.at(fileName);
|
||||
ActionTimeline* action = _animationActions.at(fileName);
|
||||
if(action)
|
||||
return action;
|
||||
|
||||
|
@ -149,7 +149,7 @@ TimelineAction* TimelineActionCache::loadAnimationActionWithContent(const std::s
|
|||
|
||||
const rapidjson::Value& json = DICTOOL->getSubDictionary_json(doc, ACTION);
|
||||
|
||||
action = TimelineAction::create();
|
||||
action = ActionTimeline::create();
|
||||
|
||||
action->setDuration(DICTOOL->getIntValue_json(json, DURATION));
|
||||
action->setTimeSpeed(DICTOOL->getFloatValue_json(json, TIME_SPEED, 1.0f));
|
||||
|
@ -170,7 +170,7 @@ TimelineAction* TimelineActionCache::loadAnimationActionWithContent(const std::s
|
|||
}
|
||||
|
||||
|
||||
Timeline* TimelineActionCache::loadTimeline(const rapidjson::Value& json)
|
||||
Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json)
|
||||
{
|
||||
Timeline* timeline = nullptr;
|
||||
|
||||
|
@ -213,7 +213,7 @@ Timeline* TimelineActionCache::loadTimeline(const rapidjson::Value& json)
|
|||
return timeline;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadVisibleFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadVisibleFrame(const rapidjson::Value& json)
|
||||
{
|
||||
VisibleFrame* frame = VisibleFrame::create();
|
||||
|
||||
|
@ -223,7 +223,7 @@ Frame* TimelineActionCache::loadVisibleFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadPositionFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadPositionFrame(const rapidjson::Value& json)
|
||||
{
|
||||
PositionFrame* frame = PositionFrame::create();
|
||||
|
||||
|
@ -234,7 +234,7 @@ Frame* TimelineActionCache::loadPositionFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadScaleFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadScaleFrame(const rapidjson::Value& json)
|
||||
{
|
||||
ScaleFrame* frame = ScaleFrame::create();
|
||||
|
||||
|
@ -247,7 +247,7 @@ Frame* TimelineActionCache::loadScaleFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadSkewFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadSkewFrame(const rapidjson::Value& json)
|
||||
{
|
||||
SkewFrame* frame = SkewFrame::create();
|
||||
|
||||
|
@ -260,7 +260,7 @@ Frame* TimelineActionCache::loadSkewFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadRotationSkewFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadRotationSkewFrame(const rapidjson::Value& json)
|
||||
{
|
||||
RotationSkewFrame* frame = RotationSkewFrame::create();
|
||||
|
||||
|
@ -273,7 +273,7 @@ Frame* TimelineActionCache::loadRotationSkewFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadRotationFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadRotationFrame(const rapidjson::Value& json)
|
||||
{
|
||||
RotationFrame* frame = RotationFrame::create();
|
||||
|
||||
|
@ -283,7 +283,7 @@ Frame* TimelineActionCache::loadRotationFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadAnchorPointFrame (const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadAnchorPointFrame (const rapidjson::Value& json)
|
||||
{
|
||||
AnchorPointFrame* frame = AnchorPointFrame::create();
|
||||
|
||||
|
@ -295,7 +295,7 @@ Frame* TimelineActionCache::loadAnchorPointFrame (const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadInnerActionFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadInnerActionFrame(const rapidjson::Value& json)
|
||||
{
|
||||
InnerActionFrame* frame = InnerActionFrame::create();
|
||||
|
||||
|
@ -308,7 +308,7 @@ Frame* TimelineActionCache::loadInnerActionFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadColorFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadColorFrame(const rapidjson::Value& json)
|
||||
{
|
||||
ColorFrame* frame = ColorFrame::create();
|
||||
|
||||
|
@ -323,7 +323,7 @@ Frame* TimelineActionCache::loadColorFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadTextureFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json)
|
||||
{
|
||||
TextureFrame* frame = TextureFrame::create();
|
||||
|
||||
|
@ -345,7 +345,7 @@ Frame* TimelineActionCache::loadTextureFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadEventFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadEventFrame(const rapidjson::Value& json)
|
||||
{
|
||||
EventFrame* frame = EventFrame::create();
|
||||
|
||||
|
@ -357,7 +357,7 @@ Frame* TimelineActionCache::loadEventFrame(const rapidjson::Value& json)
|
|||
return frame;
|
||||
}
|
||||
|
||||
Frame* TimelineActionCache::loadZOrderFrame(const rapidjson::Value& json)
|
||||
Frame* ActionTimelineCache::loadZOrderFrame(const rapidjson::Value& json)
|
||||
{
|
||||
ZOrderFrame* frame = ZOrderFrame::create();
|
||||
|
|
@ -32,11 +32,11 @@ THE SOFTWARE.
|
|||
namespace cocostudio {
|
||||
namespace timeline{
|
||||
|
||||
class TimelineActionCache
|
||||
class ActionTimelineCache
|
||||
{
|
||||
public:
|
||||
/** Gets the singleton */
|
||||
static TimelineActionCache* getInstance();
|
||||
static ActionTimelineCache* getInstance();
|
||||
|
||||
/** Destroys the singleton */
|
||||
static void destroyInstance();
|
||||
|
@ -49,10 +49,10 @@ public:
|
|||
void removeAction(const std::string& fileName);
|
||||
|
||||
/** Clone a action with the specified name from the container. */
|
||||
cocos2d::TimelineAction* createAction(const std::string& fileName);
|
||||
cocos2d::ActionTimeline* createAction(const std::string& fileName);
|
||||
|
||||
cocos2d::TimelineAction* loadAnimationActionWithFile(const std::string& fileName);
|
||||
cocos2d::TimelineAction* loadAnimationActionWithContent(const std::string&fileName, const std::string& content);
|
||||
cocos2d::ActionTimeline* loadAnimationActionWithFile(const std::string& fileName);
|
||||
cocos2d::ActionTimeline* loadAnimationActionWithContent(const std::string&fileName, const std::string& content);
|
||||
protected:
|
||||
|
||||
cocos2d::Timeline* loadTimeline(const rapidjson::Value& json);
|
||||
|
@ -76,7 +76,7 @@ protected:
|
|||
typedef std::pair<std::string, FrameCreateFunc> Pair;
|
||||
|
||||
std::unordered_map<std::string, FrameCreateFunc> _funcs;
|
||||
cocos2d::Map<std::string, cocos2d::TimelineAction*> _animationActions;
|
||||
cocos2d::Map<std::string, cocos2d::ActionTimeline*> _animationActions;
|
||||
};
|
||||
|
||||
}
|
|
@ -23,7 +23,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCNodeReader.h"
|
||||
#include "CCTimelineActionCache.h"
|
||||
#include "CCActionTimelineCache.h"
|
||||
|
||||
#include "../CCSGUIReader.h"
|
||||
|
||||
|
@ -174,7 +174,7 @@ Node* NodeReader::loadNodeWithFile(const std::string& fileName)
|
|||
Node* node = loadNodeWithContent(contentStr);
|
||||
|
||||
// Load animation data from file
|
||||
TimelineActionCache::getInstance()->loadAnimationActionWithContent(fileName, contentStr);
|
||||
ActionTimelineCache::getInstance()->loadAnimationActionWithContent(fileName, contentStr);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ void NodeReader::initNode(Node* node, const rapidjson::Value& json)
|
|||
|
||||
|
||||
node->setTag(tag);
|
||||
node->setUserObject(TimelineActionData::create(actionTag));
|
||||
node->setUserObject(ActionTimelineData::create(actionTag));
|
||||
}
|
||||
|
||||
Node* NodeReader::loadSimpleNode(const rapidjson::Value& json)
|
||||
|
@ -428,7 +428,7 @@ Node* NodeReader::loadWidget(const rapidjson::Value& json)
|
|||
_guiReader->setPropsForAllWidgetFromJsonDictionary(reader, widget, json);
|
||||
|
||||
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
|
||||
widget->setUserObject(TimelineActionData::create(actionTag));
|
||||
widget->setUserObject(ActionTimelineData::create(actionTag));
|
||||
|
||||
return widget;
|
||||
}
|
|
@ -53,8 +53,8 @@ WidgetReader/TextAtlasReader/TextAtlasReader.cpp \
|
|||
WidgetReader/TextBMFontReader/TextBMFontReader.cpp \
|
||||
WidgetReader/TextFieldReader/TextFieldReader.cpp \
|
||||
WidgetReader/TextReader/TextReader.cpp \
|
||||
TimelineAction/CCNodeReader.cpp \
|
||||
TimelineAction/CCTimelineActionCache.cpp \
|
||||
ActionTimeline/CCNodeReader.cpp \
|
||||
ActionTimeline/CCActionTimelineCache.cpp \
|
||||
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
|
||||
|
|
|
@ -58,7 +58,7 @@ THE SOFTWARE.
|
|||
#include "cocostudio/CCSGUIReader.h"
|
||||
#include "cocostudio/CCSSceneReader.h"
|
||||
#include "cocostudio/TriggerBase.h"
|
||||
#include "cocostudio/TimelineAction/CCNodeReader.h"
|
||||
#include "cocostudio/TimelineAction/CCTimelineActionCache.h"
|
||||
#include "cocostudio/ActionTimeline/CCNodeReader.h"
|
||||
#include "cocostudio/ActionTimeline/CCActionTimelineCache.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||
<ClCompile Include="..\CCActionFrame.cpp" />
|
||||
<ClCompile Include="..\CCActionFrameEasing.cpp" />
|
||||
<ClCompile Include="..\CCActionManagerEx.cpp" />
|
||||
|
@ -42,8 +44,6 @@
|
|||
<ClCompile Include="..\CCTween.cpp" />
|
||||
<ClCompile Include="..\CCUtilMath.cpp" />
|
||||
<ClCompile Include="..\DictionaryHelper.cpp" />
|
||||
<ClCompile Include="..\TimelineAction\CCNodeReader.cpp" />
|
||||
<ClCompile Include="..\TimelineAction\CCTimelineActionCache.cpp" />
|
||||
<ClCompile Include="..\TriggerBase.cpp" />
|
||||
<ClCompile Include="..\TriggerMng.cpp" />
|
||||
<ClCompile Include="..\TriggerObj.cpp" />
|
||||
|
@ -73,6 +73,8 @@
|
|||
<ClInclude Include="..\..\..\..\external\json\reader.h" />
|
||||
<ClInclude Include="..\..\..\..\external\json\stringbuffer.h" />
|
||||
<ClInclude Include="..\..\..\..\external\json\writer.h" />
|
||||
<ClInclude Include="..\ActionTimeline\CCNodeReader.h" />
|
||||
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h" />
|
||||
<ClInclude Include="..\CCActionFrame.h" />
|
||||
<ClInclude Include="..\CCActionFrameEasing.h" />
|
||||
<ClInclude Include="..\CCActionManagerEx.h" />
|
||||
|
@ -105,8 +107,6 @@
|
|||
<ClInclude Include="..\CCTween.h" />
|
||||
<ClInclude Include="..\CCUtilMath.h" />
|
||||
<ClInclude Include="..\DictionaryHelper.h" />
|
||||
<ClInclude Include="..\TimelineAction\CCNodeReader.h" />
|
||||
<ClInclude Include="..\TimelineAction\CCTimelineActionCache.h" />
|
||||
<ClInclude Include="..\TriggerBase.h" />
|
||||
<ClInclude Include="..\TriggerMng.h" />
|
||||
<ClInclude Include="..\TriggerObj.h" />
|
||||
|
|
|
@ -231,10 +231,10 @@
|
|||
<ClCompile Include="..\WidgetReader\PageViewReader\PageViewReader.cpp">
|
||||
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\TimelineAction\CCTimelineActionCache.cpp">
|
||||
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp">
|
||||
<Filter>TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\TimelineAction\CCNodeReader.cpp">
|
||||
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp">
|
||||
<Filter>TimelineAction</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -419,10 +419,10 @@
|
|||
<ClInclude Include="..\WidgetReader\PageViewReader\PageViewReader.h">
|
||||
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\TimelineAction\CCTimelineActionCache.h">
|
||||
<ClInclude Include="..\ActionTimeline\CCNodeReader.h">
|
||||
<Filter>TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\TimelineAction\CCNodeReader.h">
|
||||
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h">
|
||||
<Filter>TimelineAction</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "TimelineActionTestScene.h"
|
||||
#include "ActionTimelineTestScene.h"
|
||||
#include "../../testResource.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
|
@ -20,7 +20,7 @@ Layer *CreateAnimationLayer(int index)
|
|||
switch(index)
|
||||
{
|
||||
case TEST_ANIMATIONELEMENT:
|
||||
pLayer = new TestTimelineAction();
|
||||
pLayer = new TestActionTimeline();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -62,7 +62,7 @@ Layer *RestartAnimationTest()
|
|||
}
|
||||
|
||||
|
||||
TimelineActionTestScene::TimelineActionTestScene(bool bPortrait)
|
||||
ActionTimelineTestScene::ActionTimelineTestScene(bool bPortrait)
|
||||
{
|
||||
TestScene::init();
|
||||
|
||||
|
@ -78,7 +78,7 @@ TimelineActionTestScene::TimelineActionTestScene(bool bPortrait)
|
|||
addChild(bg);
|
||||
}
|
||||
|
||||
void TimelineActionTestScene::runThisTest()
|
||||
void ActionTimelineTestScene::runThisTest()
|
||||
{
|
||||
s_nActionIdx = -1;
|
||||
addChild(NextAnimationTest());
|
||||
|
@ -86,7 +86,7 @@ void TimelineActionTestScene::runThisTest()
|
|||
Director::getInstance()->replaceScene(this);
|
||||
}
|
||||
|
||||
void TimelineActionTestScene::MainMenuCallback(Ref *pSender)
|
||||
void ActionTimelineTestScene::MainMenuCallback(Ref *pSender)
|
||||
{
|
||||
//TestScene::MainMenuCallback(pSender);
|
||||
|
||||
|
@ -95,7 +95,7 @@ void TimelineActionTestScene::MainMenuCallback(Ref *pSender)
|
|||
|
||||
|
||||
|
||||
void TimelineActionTestLayer::onEnter()
|
||||
void ActionTimelineTestLayer::onEnter()
|
||||
{
|
||||
|
||||
Layer::onEnter();
|
||||
|
@ -118,9 +118,9 @@ void TimelineActionTestLayer::onEnter()
|
|||
}
|
||||
|
||||
// add menu
|
||||
backItem = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(TimelineActionTestLayer::backCallback, this) );
|
||||
restartItem = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(TimelineActionTestLayer::restartCallback, this) );
|
||||
nextItem = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(TimelineActionTestLayer::nextCallback, this) );
|
||||
backItem = MenuItemImage::create(s_pathB1, s_pathB2, CC_CALLBACK_1(ActionTimelineTestLayer::backCallback, this) );
|
||||
restartItem = MenuItemImage::create(s_pathR1, s_pathR2, CC_CALLBACK_1(ActionTimelineTestLayer::restartCallback, this) );
|
||||
nextItem = MenuItemImage::create(s_pathF1, s_pathF2, CC_CALLBACK_1(ActionTimelineTestLayer::nextCallback, this) );
|
||||
|
||||
Menu *menu = Menu::create(backItem, restartItem, nextItem, nullptr);
|
||||
|
||||
|
@ -134,58 +134,58 @@ void TimelineActionTestLayer::onEnter()
|
|||
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
|
||||
}
|
||||
void TimelineActionTestLayer::onExit()
|
||||
void ActionTimelineTestLayer::onExit()
|
||||
{
|
||||
removeAllChildren();
|
||||
|
||||
backItem = restartItem = nextItem = nullptr;
|
||||
|
||||
TimelineActionCache::getInstance()->purge();
|
||||
ActionTimelineCache::getInstance()->purge();
|
||||
NodeReader::getInstance()->purge();
|
||||
|
||||
Layer::onExit();
|
||||
}
|
||||
|
||||
std::string TimelineActionTestLayer::title() const
|
||||
std::string ActionTimelineTestLayer::title() const
|
||||
{
|
||||
return "Armature Test Bed";
|
||||
}
|
||||
std::string TimelineActionTestLayer::subtitle() const
|
||||
std::string ActionTimelineTestLayer::subtitle() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void TimelineActionTestLayer::restartCallback(Ref *pSender)
|
||||
void ActionTimelineTestLayer::restartCallback(Ref *pSender)
|
||||
{
|
||||
Scene *s = new TimelineActionTestScene();
|
||||
Scene *s = new ActionTimelineTestScene();
|
||||
s->addChild( RestartAnimationTest() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
|
||||
void TimelineActionTestLayer::nextCallback(Ref *pSender)
|
||||
void ActionTimelineTestLayer::nextCallback(Ref *pSender)
|
||||
{
|
||||
Scene *s = new TimelineActionTestScene();
|
||||
Scene *s = new ActionTimelineTestScene();
|
||||
s->addChild( NextAnimationTest() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
void TimelineActionTestLayer::backCallback(Ref *pSender)
|
||||
void ActionTimelineTestLayer::backCallback(Ref *pSender)
|
||||
{
|
||||
Scene *s = new TimelineActionTestScene();
|
||||
Scene *s = new ActionTimelineTestScene();
|
||||
s->addChild( BackAnimationTest() );
|
||||
Director::getInstance()->replaceScene(s);
|
||||
s->release();
|
||||
}
|
||||
|
||||
void TestTimelineAction::onEnter()
|
||||
void TestActionTimeline::onEnter()
|
||||
{
|
||||
TimelineActionTestLayer::onEnter();
|
||||
ActionTimelineTestLayer::onEnter();
|
||||
|
||||
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("armature/Cowboy0.plist", "armature/Cowboy0.png");
|
||||
|
||||
Node* node = NodeReader::getInstance()->createNode("TimelineAction/boy_1.ExportJson");
|
||||
TimelineAction* action = TimelineActionCache::getInstance()->createAction("TimelineAction/boy_1.ExportJson");
|
||||
Node* node = NodeReader::getInstance()->createNode("ActionTimeline/boy_1.ExportJson");
|
||||
ActionTimeline* action = ActionTimelineCache::getInstance()->createAction("ActionTimeline/boy_1.ExportJson");
|
||||
|
||||
node->runAction(action);
|
||||
action->gotoFrameAndPlay(0, 60, true);
|
||||
|
@ -196,7 +196,7 @@ void TestTimelineAction::onEnter()
|
|||
addChild(node);
|
||||
}
|
||||
|
||||
std::string TestTimelineAction::title() const
|
||||
std::string TestActionTimeline::title() const
|
||||
{
|
||||
return "Test AnimationElement";
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
using namespace cocostudio::timeline;
|
||||
|
||||
|
||||
class TimelineActionTestScene : public TestScene
|
||||
class ActionTimelineTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
TimelineActionTestScene(bool bPortrait = false);
|
||||
ActionTimelineTestScene(bool bPortrait = false);
|
||||
|
||||
virtual void runThisTest();
|
||||
|
||||
|
@ -26,7 +26,7 @@ enum {
|
|||
TEST_ANIMATION_LAYER_COUNT
|
||||
};
|
||||
|
||||
class TimelineActionTestLayer : public Layer
|
||||
class ActionTimelineTestLayer : public Layer
|
||||
{
|
||||
public:
|
||||
virtual std::string title() const;
|
||||
|
@ -47,7 +47,7 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
class TestTimelineAction : public TimelineActionTestLayer
|
||||
class TestActionTimeline : public ActionTimelineTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
|
@ -9,7 +9,7 @@
|
|||
#include "TableViewTest/TableViewTestScene.h"
|
||||
|
||||
#include "CocoStudioArmatureTest/ArmatureScene.h"
|
||||
#include "CocoStudioTimelineActionTest/TimelineActionTestScene.h"
|
||||
#include "CocoStudioActionTimelineTest/ActionTimelineTestScene.h"
|
||||
#include "CocoStudioComponentsTest/ComponentsTestScene.h"
|
||||
#include "CocoStudioSceneTest/SceneEditorTest.h"
|
||||
|
||||
|
@ -79,7 +79,7 @@ static struct {
|
|||
scene->release();
|
||||
}
|
||||
},
|
||||
{ "CocoStudioTimelineActionTest", [](Ref *sender) { TimelineActionTestScene *scene = new TimelineActionTestScene();
|
||||
{ "CocoStudioActionTimelineTest", [](Ref *sender) { ActionTimelineTestScene *scene = new ActionTimelineTestScene();
|
||||
scene->runThisTest();
|
||||
scene->release();
|
||||
}
|
||||
|
|
|
@ -149,6 +149,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou
|
|||
<ClCompile Include="..\Classes\DataVisitorTest\DataVisitorTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsTestLayer.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest\TimelineCallbackTestLayer.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioActionTimelineTest\ActionTimelineTestScene.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioArmatureTest\ArmatureScene.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioComponentsTest\ComponentsTestScene.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioComponentsTest\EnemyController.cpp" />
|
||||
|
@ -159,7 +160,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou
|
|||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\SceneEditorTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\acts.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\cons.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioTimelineActionTest\TimelineActionTestScene.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.cpp" />
|
||||
|
@ -330,6 +330,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou
|
|||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\AnimationsTest\AnimationsTestLayer.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest\TimelineCallbackLayerLoader.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest\TimelineCallbackTestLayer.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioActionTimelineTest\ActionTimelineTestScene.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioArmatureTest\ArmatureScene.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioComponentsTest\ComponentsTestScene.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioComponentsTest\EnemyController.h" />
|
||||
|
@ -341,7 +342,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou
|
|||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\acts.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\cons.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioSceneTest\TriggerCode\EventDef.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioTimelineActionTest\TimelineActionTestScene.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlPotentiometerTest\CCControlPotentiometerTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest\CCControlStepperTest.h" />
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\EditBoxTest\EditBoxTest.h" />
|
||||
|
|
|
@ -325,7 +325,7 @@
|
|||
<Filter Include="Classes\Sprite3DTest">
|
||||
<UniqueIdentifier>{45e9becf-58e5-424e-903d-9bc7f9999d5b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes\ExtensionsTest\CocoStudioTimelineActionTest">
|
||||
<Filter Include="Classes\ExtensionsTest\CocoStudioActionTimelineTest">
|
||||
<UniqueIdentifier>{fa88df83-76d7-4f41-ad48-801dafd44889}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
|
@ -843,8 +843,8 @@
|
|||
<ClCompile Include="..\Classes\Sprite3DTest\Sprite3DTest.cpp">
|
||||
<Filter>Classes\Sprite3DTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioTimelineActionTest\TimelineActionTestScene.cpp">
|
||||
<Filter>Classes\ExtensionsTest\CocoStudioTimelineActionTest</Filter>
|
||||
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioActionTimelineTest\ActionTimelineTestScene.cpp">
|
||||
<Filter>Classes\ExtensionsTest\CocoStudioActionTimelineTest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1559,8 +1559,8 @@
|
|||
<ClInclude Include="..\Classes\Sprite3DTest\Sprite3DTest.h">
|
||||
<Filter>Classes\Sprite3DTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioTimelineActionTest\TimelineActionTestScene.h">
|
||||
<Filter>Classes\ExtensionsTest\CocoStudioTimelineActionTest</Filter>
|
||||
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioActionTimelineTest\ActionTimelineTestScene.h">
|
||||
<Filter>Classes\ExtensionsTest\CocoStudioActionTimelineTest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue