Merge pull request #3671 from chengstory/#4684

Remove unused files from mk files.
This commit is contained in:
minggo 2013-09-17 22:08:38 -07:00
commit 801b7831df
30 changed files with 2092 additions and 791 deletions

View File

@ -1 +1 @@
29c3c2dfd8b683a800709d085839444c3a304a0d
8b8a994b2fdf6fd8ef65f714619ce35ff1ca09cf

View File

@ -55,10 +55,6 @@ CocoStudio/Components/CCComAudio.cpp \
CocoStudio/Components/CCComController.cpp \
CocoStudio/Components/CCComRender.cpp \
CocoStudio/Components/CCInputDelegate.cpp \
CocoStudio/GUI/Action/UIAction.cpp \
CocoStudio/GUI/Action/UIActionFrame.cpp \
CocoStudio/GUI/Action/UIActionManager.cpp \
CocoStudio/GUI/Action/UIActionNode.cpp \
CocoStudio/GUI/BaseClasses/UIRootWidget.cpp \
CocoStudio/GUI/BaseClasses/UIWidget.cpp \
CocoStudio/GUI/Layouts/Layout.cpp \
@ -89,6 +85,11 @@ CocoStudio/Json/lib_json/json_value.cpp \
CocoStudio/Json/lib_json/json_writer.cpp \
CocoStudio/Reader/CCSGUIReader.cpp \
CocoStudio/Reader/CCSSceneReader.cpp \
CocoStudio/Action/CCActionFrame.cpp \
CocoStudio/Action/CCActionFrameEasing.cpp \
CocoStudio/Action/CCActionManagerEx.cpp \
CocoStudio/Action/CCActionNode.cpp \
CocoStudio/Action/CCActionObject.cpp \
GUI/CCControlExtension/CCControl.cpp \
GUI/CCControlExtension/CCControlButton.cpp \
GUI/CCControlExtension/CCControlColourPicker.cpp \

View File

@ -0,0 +1,225 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCActionFrame.h"
NS_CC_EXT_BEGIN
ActionFrame::ActionFrame()
: _frameType(0)
, _easingType(0)
, _frameIndex(0)
, _fTime(0.0f)
{
}
ActionFrame::~ActionFrame()
{
}
void ActionFrame::setFrameIndex(int index)
{
_frameIndex = index;
}
int ActionFrame::getFrameIndex()
{
return _frameIndex;
}
void ActionFrame::setFrameTime(float fTime)
{
_fTime = fTime;
}
float ActionFrame::getFrameTime()
{
return _fTime;
}
void ActionFrame::setFrameType(int frameType)
{
_frameType = frameType;
}
int ActionFrame::getFrameType()
{
return _frameType;
}
void ActionFrame::setEasingType(int easingType)
{
_easingType = easingType;
}
int ActionFrame::getEasingType()
{
return _easingType;
}
Action* ActionFrame::getAction(float fDuration)
{
log("Need a definition of <getAction> for ActionFrame");
return NULL;
}
//////////////////////////////////////////////////////////////////////////
ActionMoveFrame::ActionMoveFrame()
: _position(Point(0.0f,0.0f))
{
_frameType = (int)kKeyframeMove;
}
ActionMoveFrame::~ActionMoveFrame()
{
}
void ActionMoveFrame::setPosition(Point pos)
{
_position = pos;
}
Point ActionMoveFrame::getPosition()
{
return _position;
}
Action* ActionMoveFrame::getAction(float fDuration)
{
return MoveTo::create(fDuration,_position);
}
//////////////////////////////////////////////////////////////////////////
ActionScaleFrame::ActionScaleFrame()
: _scaleX(1.0f)
, _scaleY(1.0f)
{
_frameType = (int)kKeyframeScale;
}
ActionScaleFrame::~ActionScaleFrame()
{
}
void ActionScaleFrame::setScaleX(float scaleX)
{
_scaleX = scaleX;
}
float ActionScaleFrame::getScaleX()
{
return _scaleX;
}
void ActionScaleFrame::setScaleY(float scaleY)
{
_scaleY = scaleY;
}
float ActionScaleFrame::getScaleY()
{
return _scaleY;
}
Action* ActionScaleFrame::getAction(float fDuration)
{
return ScaleTo::create(fDuration,_scaleX,_scaleY);
}
ActionRotationFrame::ActionRotationFrame()
: _rotation(0.0f)
{
_frameType = (int)kKeyframeRotate;
}
ActionRotationFrame::~ActionRotationFrame()
{
}
void ActionRotationFrame::setRotation(float rotation)
{
_rotation = rotation;
}
float ActionRotationFrame::getRotation()
{
return _rotation;
}
Action* ActionRotationFrame::getAction(float fDuration)
{
return RotateTo::create(fDuration,_rotation);
}
ActionFadeFrame::ActionFadeFrame()
: _opacity(255)
{
_frameType = (int)kKeyframeFade;
}
ActionFadeFrame::~ActionFadeFrame()
{
}
void ActionFadeFrame::setOpacity(int opacity)
{
_opacity = opacity;
}
int ActionFadeFrame::getOpacity()
{
return _opacity;
}
Action* ActionFadeFrame::getAction(float fDuration)
{
return FadeTo::create(fDuration,_opacity);
}
ActionTintFrame::ActionTintFrame()
: _color(Color3B(255,255,255))
{
_frameType = (int)kKeyframeTint;
}
ActionTintFrame::~ActionTintFrame()
{
}
void ActionTintFrame::setColor(Color3B ccolor)
{
_color = ccolor;
}
Color3B ActionTintFrame::getColor()
{
return _color;
}
Action* ActionTintFrame::getAction(float fDuration)
{
return TintTo::create(fDuration,_color.r,_color.g,_color.b);
}
NS_CC_EXT_END

View File

@ -0,0 +1,347 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __ActionFRAME_H__
#define __ActionFRAME_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
NS_CC_EXT_BEGIN
enum FrameType
{
kKeyframeMove = 0,
kKeyframeScale,
kKeyframeRotate,
kKeyframeTint,
kKeyframeFade,
kKeyframeMax
};
class ActionFrame:public Object
{
public:
/**
* Default constructor
*/
ActionFrame();
/**
* Default destructor
*/
virtual ~ActionFrame();
/**
* Changes the index of action frame
*
* @param index the index of action frame
*/
void setFrameIndex(int index);
/**
* Gets the index of action frame
*
* @return the index of action frame
*/
int getFrameIndex();
/**
* Changes the time of action frame
*
* @param fTime the time of action frame
*/
void setFrameTime(float fTime);
/**
* Gets the time of action frame
*
* @return fTime the time of action frame
*/
float getFrameTime();
/**
* Changes the type of action frame
*
* @param frameType the type of action frame
*/
void setFrameType(int frameType);
/**
* Gets the type of action frame
*
* @return the type of action frame
*/
int getFrameType();
/**
* Changes the easing type.
*
* @param easingType the easing type.
*/
void setEasingType(int easingType);
/**
* Gets the easing type.
*
* @return the easing type.
*/
int getEasingType();
/**
* Gets the CCAction of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
*
* @return CCAction
*/
virtual Action* getAction(float fDuration);
protected:
int _frameType;
int _easingType;
int _frameIndex;
float _fTime;
};
class ActionMoveFrame:public ActionFrame
{
public:
/**
* Default constructor
*/
ActionMoveFrame();
/**
* Default destructor
*/
virtual ~ActionMoveFrame();
/**
* Changes the move action position.
*
* @param the move action position.
*/
void setPosition(Point pos);
/**
* Gets the move action position.
*
* @return the move action position.
*/
Point getPosition();
/**
* Gets the CCAction of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
*
* @return CCAction
*/
virtual Action* getAction(float fDuration);
protected:
Point _position;
};
class ActionScaleFrame:public ActionFrame
{
public:
/**
* Default constructor
*/
ActionScaleFrame();
/**
* Default destructor
*/
virtual ~ActionScaleFrame();
/**
* Changes the scale action scaleX.
*
* @param the scale action scaleX.
*/
void setScaleX(float scaleX);
/**
* Gets the scale action scaleX.
*
* @return the scale action scaleX.
*/
float getScaleX();
/**
* Changes the scale action scaleY.
*
* @param rotation the scale action scaleY.
*/
void setScaleY(float scaleY);
/**
* Gets the scale action scaleY.
*
* @return the the scale action scaleY.
*/
float getScaleY();
/**
* Gets the CCAction of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
*
* @return CCAction
*/
virtual Action* getAction(float fDuration);
protected:
float _scaleX;
float _scaleY;
};
class ActionRotationFrame:public ActionFrame
{
public:
/**
* Default constructor
*/
ActionRotationFrame();
/**
* Default destructor
*/
virtual ~ActionRotationFrame();
/**
* Changes rotate action rotation.
*
* @param rotation rotate action rotation.
*/
void setRotation(float rotation);
/**
* Gets the rotate action rotation.
*
* @return the rotate action rotation.
*/
float getRotation();
/**
* Gets the CCAction of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
*
* @return CCAction
*/
virtual Action* getAction(float fDuration);
protected:
float _rotation;
};
class ActionFadeFrame:public ActionFrame
{
public:
/**
* Default constructor
*/
ActionFadeFrame();
/**
* Default destructor
*/
virtual ~ActionFadeFrame();
/**
* Changes the fade action opacity.
*
* @param opacity the fade action opacity
*/
void setOpacity(int opacity);
/**
* Gets the fade action opacity.
*
* @return the fade action opacity.
*/
int getOpacity();
/**
* Gets the CCAction of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
*
* @return CCAction
*/
virtual Action* getAction(float fDuration);
protected:
float _opacity;
};
class ActionTintFrame:public ActionFrame
{
public:
/**
* Default constructor
*/
ActionTintFrame();
/**
* Default destructor
*/
virtual ~ActionTintFrame();
/**
* Changes the tint action color.
*
* @param ccolor the tint action color
*/
void setColor(Color3B ccolor);
/**
* Gets the tint action color.
*
* @return the tint action color.
*/
Color3B getColor();
/**
* Gets the CCAction of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
*
* @return CCAction
*/
virtual Action* getAction(float fDuration);
protected:
Color3B _color;
};
NS_CC_EXT_END
#endif

View File

@ -0,0 +1,189 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include <math.h>
#include "CCActionFrameEasing.h"
#include "../Json/DictionaryHelper.h"
NS_CC_EXT_BEGIN
#ifndef M_PI_X_2
#define M_PI_X_2 (float)M_PI * 2.0f
#endif
ActionFrameEasing::ActionFrameEasing()
{
}
ActionFrameEasing::~ActionFrameEasing()
{
}
float ActionFrameEasing::bounceTime(float t)
{
if (t < 1 / 2.75) {
return 7.5625f * t * t;
}
else if (t < 2 / 2.75) {
t -= 1.5f / 2.75f;
return 7.5625f * t * t + 0.75f;
}
else if (t < 2.5 / 2.75) {
t -= 2.25f / 2.75f;
return 7.5625f * t * t + 0.9375f;
}
t -= 2.625f / 2.75f;
return 7.5625f * t * t + 0.984375f;
}
float ActionFrameEasing::easeValue(float t)
{
if (_type == FrameEasingType::kframeEasingInstant)
{
if (t < 1) return 0;
else return 1;
}
else if (_type == FrameEasingType::kframeEasingLinear)
{
return t;
}
else if (_type == FrameEasingType::kframeEasingCubicIn)
{
float rate = _fValue;
return powf(t,rate);
}
else if (_type == FrameEasingType::kframeEasingCubicOut)
{
float rate = _fValue;
return powf(t,1/rate);
}
else if (_type == FrameEasingType::kframeEasingCubicInOut)
{
float rate = _fValue;
t *= 2;
if (t < 1)
{
return 0.5f * powf (t, rate);
}
else
{
return 1.0f - 0.5f * powf(2-t, rate);
}
}
else if (_type == FrameEasingType::kframeEasingElasticIn)
{
float period = _fValue;
float newT = 0;
if (t == 0 || t == 1)
newT = t;
else {
float s = period / 4;
t = t - 1;
newT = -powf(2, 10 * t) * sinf( (t-s) * M_PI_X_2 / period);
}
return newT;
}
else if (_type == FrameEasingType::kframeEasingElasticOut)
{
float period = _fValue;
float newT = 0;
if (t == 0 || t == 1) {
newT = t;
} else {
float s = period / 4;
newT = powf(2, -10 * t) * sinf( (t-s) *M_PI_X_2 / period) + 1;
}
return newT;
}
else if (_type == FrameEasingType::kframeEasingElasticInOut)
{
float period = _fValue;
float newT = 0;
if( t == 0 || t == 1 )
newT = t;
else {
t = t * 2;
if(! period )
period = 0.3f * 1.5f;
float s = period / 4;
t = t -1;
if( t < 0 )
newT = -0.5f * powf(2, 10 * t) * sinf((t - s) * M_PI_X_2 / period);
else
newT = powf(2, -10 * t) * sinf((t - s) * M_PI_X_2 / period) * 0.5f + 1;
}
return newT;
}
else if (_type == FrameEasingType::kframeEasingBounceIn)
{
float newT = 1 - bounceTime(1-t);
return newT;
}
else if (_type == FrameEasingType::kframeEasingBounceOut)
{
float newT = bounceTime(t);
return newT;
}
else if (_type == FrameEasingType::kframeEasingBounceInOut)
{
float newT = 0;
if (t < 0.5) {
t = t * 2;
newT = (1 - bounceTime(1-t) ) * 0.5f;
} else
newT = bounceTime(t * 2 - 1) * 0.5f + 0.5f;
return newT;
}
else if (_type == FrameEasingType::kframeEasingBackIn)
{
float overshoot = 1.70158f;
return t * t * ((overshoot + 1) * t - overshoot);
}
else if (_type == FrameEasingType::kframeEasingBackOut)
{
float overshoot = 1.70158f;
t = t - 1;
return t * t * ((overshoot + 1) * t + overshoot) + 1;
}
else if (_type == FrameEasingType::kframeEasingBackInOut)
{
float overshoot = 1.70158f * 1.525f;
t = t * 2;
if (t < 1)
return (t * t * ((overshoot + 1) * t - overshoot)) / 2;
else {
t = t - 2;
return (t * t * ((overshoot + 1) * t + overshoot)) / 2 + 1;
}
}
return 0;
}
NS_CC_EXT_END

View File

@ -22,34 +22,50 @@
THE SOFTWARE.
****************************************************************************/
#ifndef __UIACTIONMANAGER_H__
#define __UIACTIONMANAGER_H__
#ifndef __ActionFrameEasing_H__
#define __ActionFrameEasing_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "UIAction.h"
#include "../../Json/CSContentJsonDictionary.h"
#include "../Json/CSContentJsonDictionary.h"
NS_CC_EXT_BEGIN
class UIActionManager:public Object
enum FrameEasingType
{
kframeEasingInstant,
kframeEasingLinear,
kframeEasingCubicIn,
kframeEasingCubicOut,
kframeEasingCubicInOut,
kframeEasingElasticIn,
kframeEasingElasticOut,
kframeEasingElasticInOut,
kframeEasingBounceIn,
kframeEasingBounceOut,
kframeEasingBounceInOut,
kframeEasingBackIn,
kframeEasingBackOut,
kframeEasingBackInOut,
};
class ActionFrameEasing:public cocos2d::Object
{
protected:
// CCArray* m_ActionList;/*guiaction*/
Dictionary* m_pActionDic;
FrameEasingType _type;
float _fValue;
public:
UIActionManager();
virtual ~UIActionManager();
static UIActionManager* shareManager();
static void purgeUIActionManager();
ActionFrameEasing();
virtual ~ActionFrameEasing();
UIAction* GetActionByName(const char* jsonName,const char* actionName);
float bounceTime(float t);
void PlayActionByName(const char* jsonName,const char* actionName);
void initWithDictionary(const char* jsonName, cs::JsonDictionary* dic,UIWidget* root);
void releaseActions();
float easeValue(float t);
};
NS_CC_EXT_END

View File

@ -0,0 +1,111 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCActionManagerEx.h"
#include "../Json/DictionaryHelper.h"
NS_CC_EXT_BEGIN
static ActionManagerEx* sharedActionManager = NULL;
ActionManagerEx* ActionManagerEx::shareManager()
{
if (!sharedActionManager) {
sharedActionManager = new ActionManagerEx();
}
return sharedActionManager;
}
void ActionManagerEx::purgeActionManager()
{
CC_SAFE_DELETE(sharedActionManager);
}
ActionManagerEx::ActionManagerEx()
: _pActionDic(NULL)
{
_pActionDic = Dictionary::create();
_pActionDic->retain();
}
ActionManagerEx::~ActionManagerEx()
{
_pActionDic->removeAllObjects();
_pActionDic->release();
}
void ActionManagerEx::initWithDictionary(const char* jsonName,cs::JsonDictionary *dic,Object* root)
{
std::string path = jsonName;
int pos = path.find_last_of("/");
std::string fileName = path.substr(pos+1,path.length());
CCLOG("filename == %s",fileName.c_str());
Array* actionList = Array::create();
int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
for (int i=0; i<actionCount; i++) {
ActionObject* action = new ActionObject();
action->autorelease();
cs::JsonDictionary* actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i);
action->initWithDictionary(actionDic,root);
actionList->addObject(action);
CC_SAFE_DELETE(actionDic);
}
_pActionDic->setObject(actionList, fileName);
}
ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName)
{
Array* actionList = (Array*)(_pActionDic->objectForKey(jsonName));
if (!actionList)
{
return NULL;
}
for (unsigned int i=0; i<actionList->count(); i++)
{
ActionObject* action = dynamic_cast<ActionObject*>(actionList->getObjectAtIndex(i));
if (strcmp(actionName, action->getName()) == 0)
{
return action;
}
}
return NULL;
}
void ActionManagerEx::playActionByName(const char* jsonName,const char* actionName)
{
ActionObject* action = getActionByName(jsonName,actionName);
if (action)
{
action->play();
}
}
void ActionManagerEx::releaseActions()
{
_pActionDic->removeAllObjects();
}
NS_CC_EXT_END

View File

@ -22,43 +22,71 @@
THE SOFTWARE.
****************************************************************************/
#ifndef __UIACTION_H__
#define __UIACTION_H__
#ifndef __ActionMANAGER_H__
#define __ActionMANAGER_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "UIActionNode.h"
#include "../../Json/CSContentJsonDictionary.h"
#include "CCActionObject.h"
#include "../Json/CSContentJsonDictionary.h"
NS_CC_EXT_BEGIN
class UIAction : public Object
class ActionManagerEx:public Object
{
protected:
cocos2d::Array* m_ActionNodeList;/*actionnode*/
std::string m_name;
public:
UIAction();
virtual ~UIAction();
void Play();
void Pause();
void Stop();
void UpdateToFrameByIndex(int index);
//
// CC_SYNTHESIZE(std::string, m_name, Name);
//
CC_SYNTHESIZE(bool, m_loop, Loop);
//
CC_SYNTHESIZE(float, m_fUnitTime, UnitTime);
/**
* Default constructor
*/
ActionManagerEx();
void initWithDictionary(cs::JsonDictionary* dic,UIWidget* root);
/**
* Default destructor
*/
virtual ~ActionManagerEx();
void setName(const char* name);
const char* getName() const;
/**
* Gets the static instance of ActionManager.
*/
static ActionManagerEx* shareManager();
/**
* Purges ActionManager point.
*/
static void purgeActionManager();
/**
* Gets an ActionObject with a name.
*
* @param jsonName UI file name
*
* @param actionName action name in the UI file.
*
* @return ActionObject which named as the param name
*/
ActionObject* getActionByName(const char* jsonName,const char* actionName);
/**
* Play an Action with a name.
*
* @param jsonName UI file name
*
* @param actionName action name in teh UIfile.
*/
void playActionByName(const char* jsonName,const char* actionName);
/*init properties with json dictionay*/
void initWithDictionary(const char* jsonName,cs::JsonDictionary* dic,Object* root);
/**
* Release all actions.
*
*/
void releaseActions();
protected:
Dictionary* _pActionDic;
};
NS_CC_EXT_END

View File

@ -0,0 +1,468 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCActionNode.h"
#include "CCActionFrameEasing.h"
#include "../GUI/BaseClasses/UIWidget.h"
#include "../GUI/System/UIHelper.h"
#include "../Json/DictionaryHelper.h"
NS_CC_EXT_BEGIN
ActionNode::ActionNode()
: _currentFrameIndex(0)
, _destFrameIndex(0)
, _fUnitTime(0.1f)
, _actionTag(0)
, _actionSpawn(NULL)
, _action(NULL)
, _object(NULL)
, _frameArray(NULL)
, _frameArrayNum(0)
{
_frameArray = Array::create();
_frameArray->retain();
_frameArrayNum = (int)kKeyframeMax;
for(int i = 0; i < _frameArrayNum; i++)
{
Array* cArray = Array::create();
_frameArray->addObject(cArray);
}
}
ActionNode::~ActionNode()
{
if (_action == NULL)
{
CC_SAFE_RELEASE(_actionSpawn);
}
else
{
CC_SAFE_RELEASE(_action);
}
if (_frameArray != NULL)
{
_frameArray->removeAllObjects();
CC_SAFE_RELEASE(_frameArray);
}
}
void ActionNode::initWithDictionary(cs::JsonDictionary *dic,Object* root)
{
setActionTag(DICTOOL->getIntValue_json(dic, "ActionTag"));
int actionFrameCount = DICTOOL->getArrayCount_json(dic, "actionframelist");
for (int i=0; i<actionFrameCount; i++) {
cs::JsonDictionary* actionFrameDic = DICTOOL->getDictionaryFromArray_json(dic, "actionframelist", i);
int frameInex = DICTOOL->getIntValue_json(actionFrameDic,"frameid");
bool existPosition = DICTOOL->checkObjectExist_json(actionFrameDic,"positionx");
if (existPosition)
{
float positionX = DICTOOL->getFloatValue_json(actionFrameDic, "positionx");
float positionY = DICTOOL->getFloatValue_json(actionFrameDic, "positiony");
ActionMoveFrame* actionFrame = new ActionMoveFrame();
actionFrame->setFrameIndex(frameInex);
actionFrame->setPosition(Point(positionX, positionY));
Array* cActionArray = (Array*)_frameArray->getObjectAtIndex((int)kKeyframeMove);
cActionArray->addObject(actionFrame);
}
bool existScale = DICTOOL->checkObjectExist_json(actionFrameDic,"scalex");
if (existScale)
{
float scaleX = DICTOOL->getFloatValue_json(actionFrameDic, "scalex");
float scaleY = DICTOOL->getFloatValue_json(actionFrameDic, "scaley");
ActionScaleFrame* actionFrame = new ActionScaleFrame();
actionFrame->setFrameIndex(frameInex);
actionFrame->setScaleX(scaleX);
actionFrame->setScaleY(scaleY);
Array* cActionArray = (Array*)_frameArray->getObjectAtIndex((int)kKeyframeScale);
cActionArray->addObject(actionFrame);
}
bool existRotation = DICTOOL->checkObjectExist_json(actionFrameDic,"rotation");
if (existRotation)
{
float rotation = DICTOOL->getFloatValue_json(actionFrameDic, "rotation");
ActionRotationFrame* actionFrame = new ActionRotationFrame();
actionFrame->setFrameIndex(frameInex);
actionFrame->setRotation(rotation);
Array* cActionArray = (Array*)_frameArray->getObjectAtIndex((int)kKeyframeRotate);
cActionArray->addObject(actionFrame);
}
bool existOpacity = DICTOOL->checkObjectExist_json(actionFrameDic,"opacity");
if (existOpacity)
{
int opacity = DICTOOL->getIntValue_json(actionFrameDic, "opacity");
ActionFadeFrame* actionFrame = new ActionFadeFrame();
actionFrame->setFrameIndex(frameInex);
actionFrame->setOpacity(opacity);
Array* cActionArray = (Array*)_frameArray->getObjectAtIndex((int)kKeyframeFade);
cActionArray->addObject(actionFrame);
}
bool existColor = DICTOOL->checkObjectExist_json(actionFrameDic,"colorr");
if (existColor)
{
int colorR = DICTOOL->getIntValue_json(actionFrameDic, "colorr");
int colorG = DICTOOL->getIntValue_json(actionFrameDic, "colorg");
int colorB = DICTOOL->getIntValue_json(actionFrameDic, "colorb");
ActionTintFrame* actionFrame = new ActionTintFrame();
actionFrame->setFrameIndex(frameInex);
actionFrame->setColor(Color3B(colorR,colorG,colorB));
Array* cActionArray = (Array*)_frameArray->getObjectAtIndex((int)kKeyframeTint);
cActionArray->addObject(actionFrame);
}
CC_SAFE_DELETE(actionFrameDic);
}
initActionNodeFromRoot(root);
}
void ActionNode::initActionNodeFromRoot(Object* root)
{
Node* rootNode = dynamic_cast<Node*>(root);
if (rootNode != NULL)
{
log("Need a definition of <initActionNodeFromRoot> for gameObject");
}
else
{
UIWidget* rootWidget = dynamic_cast<UIWidget*>(root);
if (rootWidget != NULL)
{
UIWidget* widget = UIHelper::instance()->seekActionWidgetByActionTag(rootWidget, getActionTag());
if (widget != NULL)
{
setObject(widget);
}
}
}
}
void ActionNode::setUnitTime(float fTime)
{
_fUnitTime = fTime;
this->refreshActionProperty();
}
float ActionNode::getUnitTime()
{
return _fUnitTime;
}
void ActionNode::setActionTag(int tag)
{
_actionTag = tag;
}
int ActionNode::getActionTag()
{
return _actionTag;
}
void ActionNode::setObject(Object* node)
{
_object = node;
}
Object* ActionNode::getObject()
{
return _object;
}
Node* ActionNode::getActionNode()
{
Node* cNode = dynamic_cast<Node*>(_object);
if (cNode != NULL)
{
return cNode;
}
else
{
UIWidget* rootWidget = dynamic_cast<UIWidget*>(_object);
if (rootWidget != NULL)
{
return rootWidget->getRenderer();
}
}
return NULL;
}
void ActionNode::insertFrame(int index, ActionFrame* frame)
{
if (frame == NULL)
{
return;
}
int frameType = frame->getFrameType();
Array* cArray = (Array*)_frameArray->getObjectAtIndex(frameType);
if (cArray == NULL)
{
return;
}
cArray->insertObject(frame,index);
}
void ActionNode::addFrame(ActionFrame* frame)
{
if (frame == NULL)
{
return;
}
int frameType = frame->getFrameType();
Array* cArray = (Array*)_frameArray->getObjectAtIndex(frameType);
if (cArray == NULL)
{
return;
}
cArray->addObject(frame);
}
void ActionNode::deleteFrame(ActionFrame* frame)
{
if (frame == NULL)
{
return;
}
int frameType = frame->getFrameType();
Array* cArray = (Array*)_frameArray->getObjectAtIndex(frameType);
if (cArray == NULL)
{
return;
}
cArray->removeObject(frame);
}
void ActionNode::clearAllFrame()
{
for (int i = 0; i < _frameArrayNum; i++)
{
_frameArray[i].removeAllObjects();
}
}
Spawn * ActionNode::refreshActionProperty()
{
if ( _object == NULL )
{
return NULL;
}
Array* cSpawnArray = Array::create();
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
Array* cSequenceArray = Array::create();
int frameCount = cArray->count();
for (int i = 0; i < frameCount; i++)
{
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(i));
if (i == 0)
{
}
else
{
ActionFrame* srcFrame = (ActionFrame*)(cArray->getObjectAtIndex(i-1));
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex()) * getUnitTime();
Action* cAction = frame->getAction(duration);
cSequenceArray->addObject(cAction);
}
}
Sequence* cSequence = Sequence::create(cSequenceArray);
cSpawnArray->addObject(cSequence);
}
if (_action == NULL)
{
CC_SAFE_RELEASE(_actionSpawn);
}
else
{
CC_SAFE_RELEASE(_action);
}
_actionSpawn = Spawn::create(cSpawnArray);
return _actionSpawn;
}
void ActionNode::playAction(bool bloop)
{
if ( _object == NULL || _actionSpawn == NULL)
{
return;
}
if (_action!=NULL)
{
_action->release();
}
if (bloop)
{
_action = RepeatForever::create(_actionSpawn);
}
else
{
_action = Sequence::create(_actionSpawn, NULL);
}
_action->retain();
this->runAction();
}
void ActionNode::runAction()
{
Node* cNode = this->getActionNode();
if (cNode != NULL && _action != NULL)
{
cNode->runAction(_action);
}
}
void ActionNode::stopAction()
{
Node* cNode = this->getActionNode();
if (cNode != NULL && _action != NULL)
{
cNode->stopAction(_action);
}
}
int ActionNode::getFirstFrameIndex()
{
int frameindex = 99999;
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(0));
int iFrameIndex = frame->getFrameIndex();
if (frameindex > iFrameIndex)
{
frameindex = iFrameIndex;
}
}
return frameindex;
}
int ActionNode::getLastFrameIndex()
{
int frameindex = -1;
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
int lastInex = cArray->count() - 1;
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(lastInex));
int iFrameIndex = frame->getFrameIndex();
if (frameindex < iFrameIndex)
{
frameindex = iFrameIndex;
}
}
return frameindex;
}
bool ActionNode::updateActionToTimeLine(float fTime)
{
bool bFindFrame = false;
ActionFrame* srcFrame = NULL;
ActionFrame* destFrame = NULL;
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL)
{
continue;
}
int frameCount = cArray->count();
for (int i = 0; i < frameCount; i++)
{
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(i));
if (frame->getFrameIndex()*getUnitTime() == fTime)
{
this->easingToFrame(1.0f,1.0f,frame);
bFindFrame = true;
break;
}
else if (frame->getFrameIndex()*getUnitTime() > fTime)
{
if (i == 0)
{
this->easingToFrame(1.0f,1.0f,frame);
bFindFrame = false;
}
else
{
srcFrame = (ActionFrame*)(cArray->getObjectAtIndex(i-1));
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex())*getUnitTime();
float delaytime = fTime - srcFrame->getFrameIndex()*getUnitTime();
this->easingToFrame(duration,1.0f,srcFrame);
//float easingTime = ActionFrameEasing::bounceTime(delaytime);
this->easingToFrame(duration,delaytime/duration,frame);
bFindFrame = true;
}
break;
}
}
}
return bFindFrame;
}
void ActionNode::easingToFrame(float duration,float delayTime,ActionFrame* destFrame)
{
Action* cAction = destFrame->getAction(duration);
Node* cNode = this->getActionNode();
if (cAction == NULL || cNode == NULL)
{
return;
}
cAction->startWithTarget(cNode);
cAction->update(delayTime);
}
NS_CC_EXT_END

View File

@ -0,0 +1,176 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __ActionNODE_H__
#define __ActionNODE_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "CCActionFrame.h"
#include "../Json/CSContentJsonDictionary.h"
NS_CC_EXT_BEGIN
class ActionNode:public Object
{
public:
/**
* Default constructor
*/
ActionNode();
/**
* Default destructor
*/
virtual ~ActionNode();
/**
* Sets the time interval of frame.
*
* @param fTime the time interval of frame
*/
void setUnitTime(float fTime);
/**
* Gets the time interval of frame.
*
* @return fTime the time interval of frame
*/
float getUnitTime();
/**
* Sets tag for ActionNode
*
* @param tag tag of ActionNode
*/
void setActionTag(int tag);
/**
* Gets tag for ActionNode
*
* @return tag tag of ActionNode
*/
int getActionTag();
/**
* Sets node which will run a action.
*
* @param node which will run a action
*/
void setObject(Object* node);
/**
* Gets node which will run a action.
*
* @return node which will run a action
*/
Object* getObject();
/**
* Insets a ActionFrame to ActionNode.
*
* @param index the index of ActionFrame
*
* @param frame the ActionFrame which will be inserted
*/
void insertFrame(int index, ActionFrame* frame);
/**
* Pushs back a ActionFrame to ActionNode.
*
* @param frame the ActionFrame which will be added
*/
void addFrame(ActionFrame* frame);
/**
* Remove a ActionFrame from ActionNode.
*
* @param frame the ActionFrame which will be removed
*/
void deleteFrame(ActionFrame* frame );
/**
* Remove all ActionFrames from ActionNode.
*/
void clearAllFrame();
/**
* Gets index of first ActionFrame.
*
* @return index of first ActionFrame
*/
int getFirstFrameIndex();
/**
* Gets index of last ActionFrame.
*
* @return index of last ActionFrame
*/
int getLastFrameIndex();
/**
* Updates action states to some time.
*
* @param fTime the time when need to update
*/
virtual bool updateActionToTimeLine(float fTime);
/**
* Play the action.
*
* @param bloop true the
*/
virtual void playAction(bool bloop);
/**
* Stop the action.
*/
virtual void stopAction();
/*init properties with a json dictionary*/
virtual void initWithDictionary(cs::JsonDictionary* dic,Object* root);
protected:
int _currentFrameIndex;
int _destFrameIndex;
float _fUnitTime;
int _actionTag;
Spawn * _actionSpawn;
Action* _action;
Object* _object;
Array* _frameArray;
int _frameArrayNum;
protected:
virtual Node* getActionNode();
virtual Spawn * refreshActionProperty();
virtual void runAction();
virtual void initActionNodeFromRoot(Object* root);
virtual void easingToFrame(float duration,float delayTime,ActionFrame* destFrame);
};
NS_CC_EXT_END
#endif

View File

@ -0,0 +1,174 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCActionObject.h"
#include "../Json/DictionaryHelper.h"
NS_CC_EXT_BEGIN
ActionObject::ActionObject()
: _actionNodeList(NULL)
, _name("")
, _loop(false)
, _bPause(false)
, _bPlaying(false)
, _fUnitTime(0.1f)
, _currentTime(0.0f)
{
_actionNodeList = Array::create();
_actionNodeList->retain();
}
ActionObject::~ActionObject()
{
_actionNodeList->removeAllObjects();
_actionNodeList->release();
}
void ActionObject::setName(const char* name)
{
_name.assign(name);
}
const char* ActionObject::getName()
{
return _name.c_str();
}
void ActionObject::setLoop(bool bLoop)
{
_loop = bLoop;
}
bool ActionObject::getLoop()
{
return _loop;
}
void ActionObject::setUnitTime(float fTime)
{
_fUnitTime = fTime;
int nodeNum = _actionNodeList->count();
for ( int i = 0; i < nodeNum; i++ )
{
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
actionNode->setUnitTime(_fUnitTime);
}
}
float ActionObject::getUnitTime()
{
return _fUnitTime;
}
float ActionObject::getCurrentTime()
{
return _currentTime;
}
void ActionObject::setCurrentTime(float fTime)
{
_currentTime = fTime;
}
bool ActionObject::isPlaying()
{
return _bPlaying;
}
void ActionObject::initWithDictionary(cs::JsonDictionary *dic,Object* root)
{
setName(DICTOOL->getStringValue_json(dic, "name"));
setLoop(DICTOOL->getBooleanValue_json(dic, "loop"));
setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime"));
int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist");
for (int i=0; i<actionNodeCount; i++) {
ActionNode* actionNode = new ActionNode();
actionNode->autorelease();
cs::JsonDictionary* actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i);
actionNode->initWithDictionary(actionNodeDic,root);
actionNode->setUnitTime(getUnitTime());
_actionNodeList->addObject(actionNode);
CC_SAFE_DELETE(actionNodeDic);
}
}
void ActionObject::addActionNode(ActionNode* node)
{
if (node == NULL)
{
return;
}
_actionNodeList->addObject(node);
}
void ActionObject::removeActionNode(ActionNode* node)
{
if (node == NULL)
{
return;
}
_actionNodeList->removeObject(node);
}
void ActionObject::play()
{
stop();
int frameNum = _actionNodeList->count();
for ( int i = 0; i < frameNum; i++ )
{
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
actionNode->playAction( getLoop());
}
}
void ActionObject::pause()
{
_bPause = true;
}
void ActionObject::stop()
{
int frameNum = _actionNodeList->count();
for ( int i = 0; i < frameNum; i++ )
{
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
actionNode->stopAction();
}
_bPause = false;
}
void ActionObject::updateToFrameByTime(float fTime)
{
_currentTime = fTime;
int nodeNum = _actionNodeList->count();
for ( int i = 0; i < nodeNum; i++ )
{
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
actionNode->updateActionToTimeLine(fTime);
}
}
NS_CC_EXT_END

View File

@ -0,0 +1,159 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __ActionObject_H__
#define __ActionObject_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "CCActionNode.h"
#include "../Json/CSContentJsonDictionary.h"
NS_CC_EXT_BEGIN
class ActionObject:public Object
{
public:
/**
* Default constructor
*/
ActionObject();
/**
* Default destructor
*/
virtual ~ActionObject();
/**
* Sets name for object
*
* @param name name of object
*/
void setName(const char* name);
/**
* Sets name for object
*
* @return name of object
*/
const char* getName();
/**
* Sets if the action will loop play.
*
* @param bLoop that if the action will loop play
*/
void setLoop(bool bLoop);
/**
* Gets if the action will loop play.
*
* @return that if the action will loop play
*/
bool getLoop();
/**
* Sets the time interval of frame.
*
* @param fTime the time interval of frame
*/
void setUnitTime(float fTime);
/**
* Gets the time interval of frame.
*
* @return fTime the time interval of frame
*/
float getUnitTime();
/**
* Sets the current time of frame.
*
* @param fTime the current time of frame
*/
void setCurrentTime(float fTime);
/**
* Gets the current time of frame.
*
* @return fTime the current time of frame
*/
float getCurrentTime();
/**
* Return if the action is playing.
*
* @return true if the action is playing, false the otherwise
*/
bool isPlaying();
/**
* Play the action.
*/
void play();
/**
* Pause the action.
*/
void pause();
/**
* Stop the action.
*/
void stop();
/**
* Adds a ActionNode to play the action.
*
* @node the ActionNode which will play the action
*/
void addActionNode(ActionNode* node);
/**
* Removes a ActionNode which play the action.
*
* @node the ActionNode which play the action
*/
void removeActionNode(ActionNode* node);
/*update frame method*/
void updateToFrameByTime(float fTime);
/*init properties with a json dictionary*/
void initWithDictionary(cs::JsonDictionary* dic,Object* root);
protected:
Array* _actionNodeList;/*actionnode*/
std::string _name;
bool _loop;
bool _bPause;
bool _bPlaying;
float _fUnitTime;
float _currentTime;
};
NS_CC_EXT_END
#endif

View File

@ -1,110 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "UIAction.h"
#include "UIActionNode.h"
#include "../../Json/DictionaryHelper.h"
NS_CC_EXT_BEGIN
UIAction::UIAction()
{
m_ActionNodeList = CCArray::create();
m_ActionNodeList->retain();
}
UIAction::~UIAction()
{
m_ActionNodeList->removeAllObjects();
m_ActionNodeList->release();
}
void UIAction::initWithDictionary(cs::JsonDictionary *dic,UIWidget* root)
{
setName(DICTOOL->getStringValue_json(dic, "name"));
setLoop(DICTOOL->getBooleanValue_json(dic, "loop"));
setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime"));
int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist");
for (int i=0; i<actionNodeCount; i++)
{
UIActionNode* actionNode = new UIActionNode();
actionNode->autorelease();
cs::JsonDictionary* actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i);
actionNode->initWithDictionary(actionNodeDic,root);
m_ActionNodeList->addObject(actionNode);
CC_SAFE_DELETE(actionNodeDic);
}
}
void UIAction::Play()
{
Stop();
int frameNum = m_ActionNodeList->count();
for ( int i = 0; i < frameNum; i++ )
{
UIActionNode* actionNode = (UIActionNode*)m_ActionNodeList->getObjectAtIndex(i);
actionNode->RunAction( getUnitTime(),getLoop() );
}
}
void UIAction::Pause()
{
}
void UIAction::Stop()
{
int frameNum = m_ActionNodeList->count();
for ( int i = 0; i < frameNum; i++ )
{
UIActionNode* actionNode = (UIActionNode*)m_ActionNodeList->getObjectAtIndex(i);
actionNode->StopAction();
}
}
void UIAction::UpdateToFrameByIndex(int index)
{
int frameNum = m_ActionNodeList->count();
for ( int i = 0; i < frameNum; i++ )
{
UIActionNode* actionNode = (UIActionNode*)m_ActionNodeList->getObjectAtIndex(i);
actionNode->UpdateToFrameByIndex(index);
}
}
void UIAction::setName(const char* name)
{
m_name = name;
}
const char* UIAction::getName() const
{
return m_name.c_str();
}
NS_CC_EXT_END

View File

@ -1,51 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "UIActionFrame.h"
#include "../../Json/DictionaryHelper.h"
NS_CC_EXT_BEGIN
UIActionFrame::UIActionFrame()
{
}
UIActionFrame::~UIActionFrame()
{
}
void UIActionFrame::initWithDictionary(cs::JsonDictionary *dic)
{
setFrameId(DICTOOL->getIntValue_json(dic, "frameid"));
setStartTime(DICTOOL->getFloatValue_json(dic, "starttime"));
setPosition(Point(DICTOOL->getFloatValue_json(dic, "positionx"), DICTOOL->getFloatValue_json(dic, "positiony")));
setScaleX(DICTOOL->getFloatValue_json(dic, "scalex"));
setScaleY(DICTOOL->getFloatValue_json(dic, "scaley"));
setRotation(DICTOOL->getFloatValue_json(dic, "rotation"));
setOpacity(DICTOOL->getIntValue_json(dic, "opacity"));
setColor(Color3B(DICTOOL->getIntValue_json(dic, "colorr"), DICTOOL->getIntValue_json(dic, "colorg"), DICTOOL->getIntValue_json(dic, "colorb")));
}
NS_CC_EXT_END

View File

@ -1,64 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __UIACTIONFRAME_H__
#define __UIACTIONFRAME_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../Json/CSContentJsonDictionary.h"
NS_CC_EXT_BEGIN
class UIActionFrame:public Object
{
protected:
public:
UIActionFrame();
virtual ~UIActionFrame();
//
CC_SYNTHESIZE(int, m_frameId, FrameId);
//
CC_SYNTHESIZE(float, m_startTime, StartTime);
//
CC_SYNTHESIZE(Point, m_position, Position);
//
CC_SYNTHESIZE(float, m_scaleX, ScaleX);
//
CC_SYNTHESIZE(float, m_scaleY, ScaleY);
//
CC_SYNTHESIZE(float, m_rotation, Rotation);
//
CC_SYNTHESIZE(float, m_opacity, Opacity);
//
CC_SYNTHESIZE(Color3B, m_color, Color);
void initWithDictionary(cs::JsonDictionary* dic);
};
NS_CC_EXT_END
#endif

View File

@ -1,112 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "UIActionManager.h"
#include "../../Json/DictionaryHelper.h"
#include "UIAction.h"
NS_CC_EXT_BEGIN
static UIActionManager* sharedActionManager = NULL;
UIActionManager* UIActionManager::shareManager()
{
if (!sharedActionManager)
{
sharedActionManager = new UIActionManager();
}
return sharedActionManager;
}
void UIActionManager::purgeUIActionManager()
{
CC_SAFE_DELETE(sharedActionManager);
}
UIActionManager::UIActionManager()
{
m_pActionDic = CCDictionary::create();
m_pActionDic->retain();
}
UIActionManager::~UIActionManager()
{
m_pActionDic->removeAllObjects();
m_pActionDic->release();
}
void UIActionManager::initWithDictionary(const char* jsonName,cs::JsonDictionary *dic,UIWidget* root)
{
std::string path = jsonName;
int pos = path.find_last_of("/");
std::string fileName = path.substr(pos+1,path.length());
CCLOG("filename == %s",fileName.c_str());
Array* actionList = Array::create();
int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist");
for (int i=0; i<actionCount; i++)
{
UIAction* action = new UIAction();
action->autorelease();
cs::JsonDictionary* actionDic = DICTOOL->getDictionaryFromArray_json(dic, "actionlist", i);
action->initWithDictionary(actionDic,root);
actionList->addObject(action);
CC_SAFE_DELETE(actionDic);
}
m_pActionDic->setObject(actionList, fileName);
}
UIAction* UIActionManager::GetActionByName(const char* jsonName,const char* actionName)
{
Array* actionList = (Array*)(m_pActionDic->objectForKey(jsonName));
if (!actionList)
{
return NULL;
}
for (unsigned int i=0; i<actionList->count(); i++)
{
UIAction* action = dynamic_cast<UIAction*>(actionList->getObjectAtIndex(i));
if (strcmp(actionName, action->getName()) == 0)
{
return action;
}
}
return NULL;
}
void UIActionManager::PlayActionByName(const char* jsonName,const char* actionName)
{
UIAction* action = GetActionByName(jsonName,actionName);
if (action)
{
action->Play();
}
}
/*temp */
void UIActionManager::releaseActions()
{
m_pActionDic->removeAllObjects();
}
NS_CC_EXT_END

View File

@ -1,228 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "UIActionNode.h"
#include "UIActionFrame.h"
#include "../../Json/DictionaryHelper.h"
#include "../System/UIHelper.h"
NS_CC_EXT_BEGIN
UIActionNode::UIActionNode()
{
currentIndex = 0;
m_actionNode = NULL;
m_action = NULL;
m_ActionFrameList = Array::create();
m_ActionFrameList->retain();
}
UIActionNode::~UIActionNode()
{
if (m_action != NULL)
{
m_action->release();
}
if (m_actionNode)
{
m_actionNode->setBindingAction(NULL);
}
m_ActionFrameList->removeAllObjects();
m_ActionFrameList->release();
}
void UIActionNode::initWithDictionary(cs::JsonDictionary *dic,UIWidget* root)
{
setActionTag(DICTOOL->getIntValue_json(dic, "ActionTag"));
int actionFrameCount = DICTOOL->getArrayCount_json(dic, "actionframelist");
UIWidget* bindingWidget = CCUIHELPER->seekActionWidgetByActionTag(root, getActionTag());
if (bindingWidget)
{
SetActionNode(bindingWidget);
bindingWidget->setBindingAction(this);
}
for (int i=0; i<actionFrameCount; i++)
{
UIActionFrame* actionFrame = new UIActionFrame();
actionFrame->autorelease();
cs::JsonDictionary* actionFrameDic = DICTOOL->getDictionaryFromArray_json(dic, "actionframelist", i);
actionFrame->initWithDictionary(actionFrameDic);
m_ActionFrameList->addObject(actionFrame);
CC_SAFE_DELETE(actionFrameDic);
}
}
void UIActionNode::SetActionNode(UIWidget* widget)
{
m_actionNode = widget;
//UpdateToFrameByIndex(currentIndex);
}
void UIActionNode::releaseBindingWidget()
{
m_actionNode = NULL;
}
void UIActionNode::InsertFrame(int index, UIActionFrame* frame)
{
m_ActionFrameList->insertObject(frame,index);
}
void UIActionNode::AddFrame(UIActionFrame* frame)
{
m_ActionFrameList->addObject(frame);
}
void UIActionNode::DeleteFrame(UIActionFrame* frame)
{
m_ActionFrameList->removeObject(frame);
}
void UIActionNode::ClearAllFrame()
{
m_ActionFrameList->removeAllObjects();
}
void UIActionNode::UpdateToFrameByIndex(int index)
{
currentIndex = index;
int frameNum = m_ActionFrameList->count();
bool bFindFrame = false;
UIActionFrame* frame = NULL;
for (int i = 0; i < frameNum; i++)
{
frame = (UIActionFrame*)m_ActionFrameList->getObjectAtIndex(index);
if (frame->getFrameId() == index)
{
bFindFrame = true;
UpdateToFrame(frame);
break;
}
}
if (!bFindFrame)
{
m_actionNode->setVisible(false);
}
}
void UIActionNode::UpdateToFrame(UIActionFrame* frame)
{
if ( m_actionNode == NULL || frame == NULL )
{
return;
}
m_actionNode->setRotation(frame->getRotation());
m_actionNode->setScaleX(frame->getScaleX());
m_actionNode->setScaleY(frame->getScaleY());
m_actionNode->setPosition(frame->getPosition());
m_actionNode->setOpacity(frame->getOpacity());
m_actionNode->setColor(frame->getColor());
}
void UIActionNode::RunAction(float fUnitTime, bool bloop)
{
int frameNum = m_ActionFrameList->count();
if ( m_actionNode == NULL || frameNum <= 0 )
{
return;
}
Array* actionFrame = Array::create();
for ( int i = 0; i < frameNum; i++ )
{
float duration;
UIActionFrame* frame = (UIActionFrame*)m_ActionFrameList->getObjectAtIndex(i);
if ( i == 0 )
{
//duration = frame->getFrameId() * fUnitTime;
duration = 0.01f;
}
else
{
UIActionFrame* frame_pre = (UIActionFrame*)m_ActionFrameList->getObjectAtIndex(i-1);
duration = (frame->getFrameId() - frame_pre->getFrameId()) * fUnitTime;
}
MoveTo* action_1 = MoveTo::create(duration,frame->getPosition());
RotateTo* action_2 = RotateTo::create(duration,frame->getRotation());
ScaleTo* action_3 = ScaleTo::create(duration,frame->getScaleX(),frame->getScaleY());
FadeTo* action_4 = FadeTo::create(duration,frame->getOpacity());
TintTo* action_5 = TintTo::create(duration,frame->getColor().r,frame->getColor().g,frame->getColor().b);
Spawn * actionSpawn = Spawn::create(action_1,action_2,action_3,action_4,action_5, NULL);
actionFrame->addObject( actionSpawn );
}
if (bloop)
{
ActionInterval* actionInterval = dynamic_cast<ActionInterval*>(Sequence::create(actionFrame));
if (actionInterval)
{
if (m_actionNode) {
if (m_action!=NULL)
{
m_action->release();
}
m_action = RepeatForever::create(actionInterval);
m_action->retain();
m_actionNode->runAction(m_action);
}
}
}
else
{
if (m_actionNode) {
if (m_action!=NULL)
{
m_action->release();
}
m_action = Sequence::create(actionFrame);
m_action->retain();
m_actionNode->runAction(m_action);
}
}
}
void UIActionNode::StopAction()
{
if (m_actionNode) {
m_actionNode->stopAction(m_action);
}
}
NS_CC_EXT_END

View File

@ -1,67 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __UIACTIONNODE_H__
#define __UIACTIONNODE_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../BaseClasses/UIWidget.h"
#include "UIActionFrame.h"
#include "../../Json/CSContentJsonDictionary.h"
NS_CC_EXT_BEGIN
class UIActionNode:public Object
{
protected:
int currentIndex;
Action* m_action;
UIWidget* m_actionNode;
//data
Array* m_ActionFrameList;/*action frame*/
CC_SYNTHESIZE(int, m_nActionTag, ActionTag);
public:
UIActionNode();
virtual ~UIActionNode();
void SetActionNode(UIWidget* widget);
void InsertFrame(int index, UIActionFrame* frame);
void AddFrame(UIActionFrame* frame);
void DeleteFrame(UIActionFrame* frame);
void ClearAllFrame();
void UpdateToFrameByIndex(int index);
void UpdateToFrame(UIActionFrame* frame);
void RunAction(float fUnitTime, bool bloop);
void StopAction();
void initWithDictionary(cs::JsonDictionary* dic,UIWidget* root);
void releaseBindingWidget();
};
NS_CC_EXT_END
#endif

View File

@ -68,10 +68,7 @@ _sizeType(SIZE_ABSOLUTE),
_sizePercent(Point::ZERO),
_positionType(POSITION_ABSOLUTE),
_positionPercent(Point::ZERO),
_isRunning(false),
/*temp action*/
_bindingAction(NULL)
_isRunning(false)
{
}
@ -1174,11 +1171,6 @@ int UIWidget::getActionTag()
return _actionTag;
}
void UIWidget::setBindingAction(UIActionNode *actionNode)
{
_bindingAction = actionNode;
}
GUIRenderer::GUIRenderer():
_enabled(true)
{

View File

@ -883,7 +883,6 @@ public:
/*temp action*/
void setActionTag(int tag);
int getActionTag();
void setBindingAction(UIActionNode* actionNode);
protected:
//call back function called when size changed.
virtual void onSizeChanged();
@ -955,9 +954,6 @@ protected:
PositionType _positionType;
Point _positionPercent;
bool _isRunning;
/*temp action*/
UIActionNode* _bindingAction;
};
class GUIRenderer : public NodeRGBA

View File

@ -46,8 +46,6 @@
#include "../../Reader/CCSGUIReader.h"
#include "UILayer.h"
#include "../Layouts/LayoutExecutant.h"
/*temp action*/
#include "../Action/UIActionManager.h"
NS_CC_EXT_BEGIN
const char* CocosGUIVersion();

View File

@ -24,7 +24,7 @@
#include "../GUI/System/CocosGUI.h"
#include "../Json/DictionaryHelper.h"
//#include "../Action/UIActionManager.h"
#include "../Action/CCActionManagerEx.h"
#include <fstream>
#include <iostream>
@ -258,10 +258,10 @@ UIWidget* CCSGUIReader::widgetFromJsonFile(const char *fileName)
// widget->setFileDesignSize(CCSizeMake(fileDesignWidth, fileDesignHeight));
cs::JsonDictionary* actions = DICTOOL->getSubDictionary_json(jsonDict, "animation");
/* *********temp********* */
// UIActionManager::shareManager()->releaseActions();
// ActionManager::shareManager()->releaseActions();
/* ********************** */
CCLOG("file name == [%s]",fileName);
UIActionManager::shareManager()->initWithDictionary(fileName,actions,widget);
ActionManagerEx::shareManager()->initWithDictionary(fileName,actions,widget);
CC_SAFE_DELETE(widgetTree);
CC_SAFE_DELETE(actions);

View File

@ -77,7 +77,7 @@
#include "CocoStudio/Reader/CCSSceneReader.h"
#include "CocoStudio/Reader/CCSGUIReader.h"
#include "CocoStudio/Action/CCActionManagerEx.h"
#include "CCDeprecated-ext.h"

View File

@ -10,8 +10,8 @@ INCLUDES = -I$(COCOS_ROOT)/external \
-I../GUI/CCControlExtension \
-I../network \
-I../GUI/CCEditBox \
-I../Components \
-I../CCArmature
-I../CocoStudio/Components \
-I../CocoStudio/Armature
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
DEFINES += -D__CC_PLATFORM_IMAGE_CPP__
@ -59,35 +59,65 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../GUI/CCEditBox/CCEditBoxImplNone.cpp \
../physics_nodes/CCPhysicsDebugNode.cpp \
../physics_nodes/CCPhysicsSprite.cpp \
../Components/CCComAttribute.cpp \
../Components/CCComAudio.cpp \
../Components/CCComController.cpp \
../Components/CCInputDelegate.cpp \
../CCArmature/CCArmature.cpp \
../CCArmature/CCBone.cpp \
../CCArmature/animation/CCArmatureAnimation.cpp \
../CCArmature/animation/CCProcessBase.cpp \
../CCArmature/animation/CCTween.cpp \
../CCArmature/datas/CCDatas.cpp \
../CCArmature/display/CCBatchNode.cpp \
../CCArmature/display/CCDecorativeDisplay.cpp \
../CCArmature/display/CCDisplayFactory.cpp \
../CCArmature/display/CCDisplayManager.cpp \
../CCArmature/display/CCShaderNode.cpp \
../CCArmature/display/CCSkin.cpp \
../CCArmature/external_tool/GLES-Render.cpp \
../CCArmature/external_tool/Json/CSContentJsonDictionary.cpp \
../CCArmature/external_tool/Json/lib_json/json_value.cpp \
../CCArmature/external_tool/Json/lib_json/json_reader.cpp \
../CCArmature/external_tool/Json/lib_json/json_writer.cpp \
../CCArmature/physics/CCColliderDetector.cpp \
../CCArmature/physics/CCPhysicsWorld.cpp \
../CCArmature/utils/CCArmatureDataManager.cpp \
../CCArmature/utils/CCDataReaderHelper.cpp \
../CCArmature/utils/CCSpriteFrameCacheHelper.cpp \
../CCArmature/utils/CCTransformHelp.cpp \
../CCArmature/utils/CCTweenFunction.cpp \
../CCArmature/utils/CCUtilMath.cpp \
../CocoStudio/Armature/CCArmature.cpp \
../CocoStudio/Armature/CCBone.cpp \
../CocoStudio/Armature/animation/CCArmatureAnimation.cpp \
../CocoStudio/Armature/animation/CCProcessBase.cpp \
../CocoStudio/Armature/animation/CCTween.cpp \
../CocoStudio/Armature/datas/CCDatas.cpp \
../CocoStudio/Armature/display/CCBatchNode.cpp \
../CocoStudio/Armature/display/CCDecorativeDisplay.cpp \
../CocoStudio/Armature/display/CCDisplayFactory.cpp \
../CocoStudio/Armature/display/CCDisplayManager.cpp \
../CocoStudio/Armature/display/CCSkin.cpp \
../CocoStudio/Armature/physics/CCColliderDetector.cpp \
../CocoStudio/Armature/utils/CCArmatureDefine.cpp \
../CocoStudio/Armature/utils/CCArmatureDataManager.cpp \
../CocoStudio/Armature/utils/CCDataReaderHelper.cpp \
../CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.cpp \
../CocoStudio/Armature/utils/CCTransformHelp.cpp \
../CocoStudio/Armature/utils/CCTweenFunction.cpp \
../CocoStudio/Armature/utils/CCUtilMath.cpp \
../CocoStudio/Components/CCComAttribute.cpp \
../CocoStudio/Components/CCComAudio.cpp \
../CocoStudio/Components/CCComController.cpp \
../CocoStudio/Components/CCComRender.cpp \
../CocoStudio/Components/CCInputDelegate.cpp \
../CocoStudio/GUI/BaseClasses/UIRootWidget.cpp \
../CocoStudio/GUI/BaseClasses/UIWidget.cpp \
../CocoStudio/GUI/Layouts/Layout.cpp \
../CocoStudio/GUI/Layouts/LayoutExecutant.cpp \
../CocoStudio/GUI/Layouts/LayoutParameter.cpp \
../CocoStudio/GUI/Layouts/UILayoutDefine.cpp \
../CocoStudio/GUI/System/CocosGUI.cpp \
../CocoStudio/GUI/System/UIHelper.cpp \
../CocoStudio/GUI/System/UIInputManager.cpp \
../CocoStudio/GUI/System/UILayer.cpp \
../CocoStudio/GUI/UIWidgets/UIButton.cpp \
../CocoStudio/GUI/UIWidgets/UICheckBox.cpp \
../CocoStudio/GUI/UIWidgets/UIImageView.cpp \
../CocoStudio/GUI/UIWidgets/UILabel.cpp \
../CocoStudio/GUI/UIWidgets/UILabelAtlas.cpp \
../CocoStudio/GUI/UIWidgets/UILabelBMFont.cpp \
../CocoStudio/GUI/UIWidgets/UILoadingBar.cpp \
../CocoStudio/GUI/UIWidgets/UISlider.cpp \
../CocoStudio/GUI/UIWidgets/UITextField.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIDragPanel.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIListView.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIPageView.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIScrollView.cpp \
../CocoStudio/Json/CSContentJsonDictionary.cpp \
../CocoStudio/Json/DictionaryHelper.cpp \
../CocoStudio/Json/lib_json/json_reader.cpp \
../CocoStudio/Json/lib_json/json_value.cpp \
../CocoStudio/Json/lib_json/json_writer.cpp \
../CocoStudio/Reader/CCSGUIReader.cpp \
../CocoStudio/Reader/CCSSceneReader.cpp \
../CocoStudio/Action/CCActionFrame.cpp \
../CocoStudio/Action/CCActionFrameEasing.cpp \
../CocoStudio/Action/CCActionManagerEx.cpp \
../CocoStudio/Action/CCActionNode.cpp \
../CocoStudio/Action/CCActionObject.cpp \
../CCDeprecated-ext.cpp
include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk

View File

@ -10,8 +10,8 @@ INCLUDES = -I$(COCOS_ROOT)/external \
-I../GUI/CCControlExtension \
-I../GUI/CCEditBox \
-I../network \
-I../Components \
-I../CCArmature
-I../CocoStudio/Components \
-I../CocoStudio/Armature
SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CCBReader/CCMenuItemImageLoader.cpp \
@ -81,10 +81,6 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CocoStudio/Components/CCComController.cpp \
../CocoStudio/Components/CCComRender.cpp \
../CocoStudio/Components/CCInputDelegate.cpp \
../CocoStudio/GUI/Action/UIAction.cpp \
../CocoStudio/GUI/Action/UIActionFrame.cpp \
../CocoStudio/GUI/Action/UIActionManager.cpp \
../CocoStudio/GUI/Action/UIActionNode.cpp \
../CocoStudio/GUI/BaseClasses/UIRootWidget.cpp \
../CocoStudio/GUI/BaseClasses/UIWidget.cpp \
../CocoStudio/GUI/Layouts/Layout.cpp \
@ -115,6 +111,11 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CocoStudio/Json/lib_json/json_writer.cpp \
../CocoStudio/Reader/CCSGUIReader.cpp \
../CocoStudio/Reader/CCSSceneReader.cpp \
../CocoStudio/Action/CCActionFrame.cpp \
../CocoStudio/Action/CCActionFrameEasing.cpp \
../CocoStudio/Action/CCActionManagerEx.cpp \
../CocoStudio/Action/CCActionNode.cpp \
../CocoStudio/Action/CCActionObject.cpp \
../spine/Animation.cpp \
../spine/AnimationState.cpp \
../spine/AnimationStateData.cpp \

View File

@ -68,12 +68,41 @@ EXTENSIONS_SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CocoStudio/Components/CCComController.cpp \
../CocoStudio/Components/CCComRender.cpp \
../CocoStudio/Components/CCInputDelegate.cpp \
../CocoStudio/GUI/BaseClasses/UIRootWidget.cpp \
../CocoStudio/GUI/BaseClasses/UIWidget.cpp \
../CocoStudio/GUI/Layouts/Layout.cpp \
../CocoStudio/GUI/Layouts/LayoutExecutant.cpp \
../CocoStudio/GUI/Layouts/LayoutParameter.cpp \
../CocoStudio/GUI/Layouts/UILayoutDefine.cpp \
../CocoStudio/GUI/System/CocosGUI.cpp \
../CocoStudio/GUI/System/UIHelper.cpp \
../CocoStudio/GUI/System/UIInputManager.cpp \
../CocoStudio/GUI/System/UILayer.cpp \
../CocoStudio/GUI/UIWidgets/UIButton.cpp \
../CocoStudio/GUI/UIWidgets/UICheckBox.cpp \
../CocoStudio/GUI/UIWidgets/UIImageView.cpp \
../CocoStudio/GUI/UIWidgets/UILabel.cpp \
../CocoStudio/GUI/UIWidgets/UILabelAtlas.cpp \
../CocoStudio/GUI/UIWidgets/UILabelBMFont.cpp \
../CocoStudio/GUI/UIWidgets/UILoadingBar.cpp \
../CocoStudio/GUI/UIWidgets/UISlider.cpp \
../CocoStudio/GUI/UIWidgets/UITextField.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIDragPanel.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIListView.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIPageView.cpp \
../CocoStudio/GUI/UIWidgets/ScrollWidget/UIScrollView.cpp \
../CocoStudio/Json/CSContentJsonDictionary.cpp \
../CocoStudio/Json/DictionaryHelper.cpp \
../CocoStudio/Json/lib_json/json_value.cpp \
../CocoStudio/Json/lib_json/json_reader.cpp \
../CocoStudio/Json/lib_json/json_writer.cpp \
../CocoStudio/Reader/CCSSceneReader.cpp \
../CocoStudio/Reader/CCSGUIReader.cpp \
../CocoStudio/Action/CCActionFrame.cpp \
../CocoStudio/Action/CCActionFrameEasing.cpp \
../CocoStudio/Action/CCActionManagerEx.cpp \
../CocoStudio/Action/CCActionNode.cpp \
../CocoStudio/Action/CCActionObject.cpp \
../spine/Animation.cpp \
../spine/AnimationState.cpp \
../spine/AnimationStateData.cpp \

View File

@ -117,6 +117,11 @@
<ClCompile Include="..\CCBReader\CCScrollViewLoader.cpp" />
<ClCompile Include="..\CCBReader\CCSpriteLoader.cpp" />
<ClCompile Include="..\CCDeprecated-ext.cpp" />
<ClCompile Include="..\CocoStudio\Action\CCActionFrame.cpp" />
<ClCompile Include="..\CocoStudio\Action\CCActionFrameEasing.cpp" />
<ClCompile Include="..\CocoStudio\Action\CCActionManagerEx.cpp" />
<ClCompile Include="..\CocoStudio\Action\CCActionNode.cpp" />
<ClCompile Include="..\CocoStudio\Action\CCActionObject.cpp" />
<ClCompile Include="..\CocoStudio\Armature\animation\CCArmatureAnimation.cpp" />
<ClCompile Include="..\CocoStudio\Armature\animation\CCProcessBase.cpp" />
<ClCompile Include="..\CocoStudio\Armature\animation\CCTween.cpp" />
@ -141,10 +146,6 @@
<ClCompile Include="..\CocoStudio\Components\CCComController.cpp" />
<ClCompile Include="..\CocoStudio\Components\CCComRender.cpp" />
<ClCompile Include="..\CocoStudio\Components\CCInputDelegate.cpp" />
<ClCompile Include="..\CocoStudio\GUI\Action\UIAction.cpp" />
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionFrame.cpp" />
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionManager.cpp" />
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionNode.cpp" />
<ClCompile Include="..\CocoStudio\GUI\BaseClasses\UIRootWidget.cpp" />
<ClCompile Include="..\CocoStudio\GUI\BaseClasses\UIWidget.cpp" />
<ClCompile Include="..\CocoStudio\GUI\Layouts\Layout.cpp" />
@ -251,6 +252,11 @@
<ClInclude Include="..\CCBReader\CCScale9SpriteLoader.h" />
<ClInclude Include="..\CCBReader\CCScrollViewLoader.h" />
<ClInclude Include="..\CCBReader\CCSpriteLoader.h" />
<ClInclude Include="..\CocoStudio\Action\CCActionFrame.h" />
<ClInclude Include="..\CocoStudio\Action\CCActionFrameEasing.h" />
<ClInclude Include="..\CocoStudio\Action\CCActionManagerEx.h" />
<ClInclude Include="..\CocoStudio\Action\CCActionNode.h" />
<ClInclude Include="..\CocoStudio\Action\CCActionObject.h" />
<ClInclude Include="..\CocoStudio\Armature\animation\CCArmatureAnimation.h" />
<ClInclude Include="..\CocoStudio\Armature\animation\CCProcessBase.h" />
<ClInclude Include="..\CocoStudio\Armature\animation\CCTween.h" />
@ -275,10 +281,6 @@
<ClInclude Include="..\CocoStudio\Components\CCComController.h" />
<ClInclude Include="..\CocoStudio\Components\CCComRender.h" />
<ClInclude Include="..\CocoStudio\Components\CCInputDelegate.h" />
<ClInclude Include="..\CocoStudio\GUI\Action\UIAction.h" />
<ClInclude Include="..\CocoStudio\GUI\Action\UIActionFrame.h" />
<ClInclude Include="..\CocoStudio\GUI\Action\UIActionManager.h" />
<ClInclude Include="..\CocoStudio\GUI\Action\UIActionNode.h" />
<ClInclude Include="..\CocoStudio\GUI\BaseClasses\UIRootWidget.h" />
<ClInclude Include="..\CocoStudio\GUI\BaseClasses\UIWidget.h" />
<ClInclude Include="..\CocoStudio\GUI\Layouts\Layout.h" />

View File

@ -67,9 +67,6 @@
<Filter Include="CocoStudio\GUI">
<UniqueIdentifier>{9af947f9-84cd-4051-953e-67291da6528c}</UniqueIdentifier>
</Filter>
<Filter Include="CocoStudio\GUI\Action">
<UniqueIdentifier>{6ad66a63-e7d6-4285-b30a-7ab70a299f7e}</UniqueIdentifier>
</Filter>
<Filter Include="CocoStudio\GUI\BaseClasses">
<UniqueIdentifier>{9713ac75-d9ba-494a-8dcf-03e30f8ee2b2}</UniqueIdentifier>
</Filter>
@ -85,6 +82,9 @@
<Filter Include="CocoStudio\GUI\UIWidgets\ScrollWidget">
<UniqueIdentifier>{1c44450b-d06e-4638-9f0c-1ff62e67ec84}</UniqueIdentifier>
</Filter>
<Filter Include="CocoStudio\Action">
<UniqueIdentifier>{bec3cdd7-e05b-42d3-97b1-86e26a528a2d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\GUI\CCScrollView\CCScrollView.cpp">
@ -427,18 +427,6 @@
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UICheckBox.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIAction.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionFrame.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionManager.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionNode.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\BaseClasses\UIRootWidget.cpp">
<Filter>CocoStudio\GUI\BaseClasses</Filter>
</ClCompile>
@ -511,18 +499,6 @@
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UICheckBox.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIAction.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionFrame.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionManager.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionNode.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\BaseClasses\UIRootWidget.cpp">
<Filter>CocoStudio\GUI\BaseClasses</Filter>
</ClCompile>
@ -556,6 +532,21 @@
<ClCompile Include="..\CocoStudio\Reader\CCSGUIReader.cpp">
<Filter>CocoStudio\Reader</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Action\CCActionFrame.cpp">
<Filter>CocoStudio\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Action\CCActionManagerEx.cpp">
<Filter>CocoStudio\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Action\CCActionNode.cpp">
<Filter>CocoStudio\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Action\CCActionObject.cpp">
<Filter>CocoStudio\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Action\CCActionFrameEasing.cpp">
<Filter>CocoStudio\Action</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\GUI\CCScrollView\CCScrollView.h">
@ -866,9 +857,6 @@
<ClInclude Include="..\CocoStudio\Armature\CCBone.h">
<Filter>CocoStudio\Armature</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Armature\external_tool\GLES-Render.h">
<Filter>CocoStudio\Armature\external_tool</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Json\CSContentJsonDictionary.h">
<Filter>CocoStudio\Json</Filter>
</ClInclude>
@ -953,18 +941,6 @@
<ClInclude Include="..\CocoStudio\GUI\UIWidgets\UIButton.h">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\GUI\Action\UIAction.h">
<Filter>CocoStudio\GUI\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\GUI\Action\UIActionFrame.h">
<Filter>CocoStudio\GUI\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\GUI\Action\UIActionManager.h">
<Filter>CocoStudio\GUI\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\GUI\Action\UIActionNode.h">
<Filter>CocoStudio\GUI\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\GUI\BaseClasses\UIRootWidget.h">
<Filter>CocoStudio\GUI\BaseClasses</Filter>
</ClInclude>
@ -998,6 +974,21 @@
<ClInclude Include="..\CocoStudio\Reader\CCSGUIReader.h">
<Filter>CocoStudio\Reader</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Action\CCActionFrame.h">
<Filter>CocoStudio\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Action\CCActionFrameEasing.h">
<Filter>CocoStudio\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Action\CCActionManagerEx.h">
<Filter>CocoStudio\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Action\CCActionNode.h">
<Filter>CocoStudio\Action</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Action\CCActionObject.h">
<Filter>CocoStudio\Action</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\CocoStudio\Json\lib_json\json_internalarray.inl">
@ -1013,4 +1004,4 @@
<Filter>CocoStudio\Json\lib_json</Filter>
</None>
</ItemGroup>
</Project>
</Project>

View File

@ -18,7 +18,7 @@ CocosGUITestScene::CocosGUITestScene(bool bPortrait)
CocosGUITestScene::~CocosGUITestScene()
{
cocos2d::extension::SceneReader::getInstance()->purgeSceneReader();
cocos2d::extension::UIActionManager::purgeUIActionManager();
cocos2d::extension::ActionManagerEx::purgeActionManager();
cocos2d::extension::UIHelper::purgeUIHelper();
}

View File

@ -8,9 +8,9 @@ using namespace cocos2d::extension;
SceneEditorTestLayer::~SceneEditorTestLayer()
{
armature::ArmatureDataManager::purge();
armature::ArmatureDataManager::getInstance()->purge();
SceneReader::getInstance()->purgeSceneReader();
cocos2d::extension::UIActionManager::shareManager()->purgeUIActionManager();
cocos2d::extension::ActionManagerEx::shareManager()->purgeActionManager();
cocos2d::extension::UIHelper::instance()->purgeUIHelper();
}
@ -77,7 +77,7 @@ cocos2d::Node* SceneEditorTestLayer::createGameScene()
pNode->addChild(menuBack);
//ui action
cocos2d::extension::UIActionManager::shareManager()->PlayActionByName("startMenu_1.json","Animation1");
cocos2d::extension::ActionManagerEx::shareManager()->playActionByName("startMenu_1.json","Animation1");
return pNode;
}