diff --git a/cocos/2d/platform/win32/CCFileUtilsWin32.cpp b/cocos/2d/platform/win32/CCFileUtilsWin32.cpp
index a5c94dac90..216797bd9e 100644
--- a/cocos/2d/platform/win32/CCFileUtilsWin32.cpp
+++ b/cocos/2d/platform/win32/CCFileUtilsWin32.cpp
@@ -121,7 +121,7 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) const
return false;
}
-unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, unsigned long* size)
+unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, long* size)
{
unsigned char * pBuffer = NULL;
CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters.");
diff --git a/cocos/2d/platform/win32/CCFileUtilsWin32.h b/cocos/2d/platform/win32/CCFileUtilsWin32.h
index 4f01adabeb..5c88d97cf9 100644
--- a/cocos/2d/platform/win32/CCFileUtilsWin32.h
+++ b/cocos/2d/platform/win32/CCFileUtilsWin32.h
@@ -58,7 +58,7 @@ protected:
* @return Upon success, a pointer to the data is returned, otherwise NULL.
* @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned.
*/
- virtual unsigned char* getFileData(const char* filename, const char* mode, unsigned long * size) override;
+ virtual unsigned char* getFileData(const char* filename, const char* mode, long * size) override;
/**
* Gets full path for filename, resolution directory and search path.
diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp
index ed7eae3aed..64a91744d0 100644
--- a/cocos/editor-support/cocostudio/CCActionNode.cpp
+++ b/cocos/editor-support/cocostudio/CCActionNode.cpp
@@ -33,16 +33,16 @@ using namespace gui;
namespace cocostudio {
- ActionNode::ActionNode()
- : _currentFrameIndex(0)
- , _destFrameIndex(0)
- , _fUnitTime(0.1f)
- , _actionTag(0)
- , _actionSpawn(NULL)
- , _action(NULL)
- , _object(NULL)
- , _frameArray(NULL)
- , _frameArrayNum(0)
+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();
@@ -322,7 +322,7 @@ Spawn * ActionNode::refreshActionProperty()
return _actionSpawn;
}
-void ActionNode::playAction(bool bloop)
+void ActionNode::playAction()
{
if ( _object == NULL || _actionSpawn == NULL)
{
@@ -333,14 +333,8 @@ void ActionNode::playAction(bool bloop)
{
_action->release();
}
- if (bloop)
- {
- _action = RepeatForever::create(_actionSpawn);
- }
- else
- {
- _action = Sequence::create(_actionSpawn, NULL);
- }
+
+ _action = Sequence::create(_actionSpawn, NULL);
_action->retain();
this->runAction();
@@ -480,4 +474,14 @@ void ActionNode::easingToFrame(float duration,float delayTime,ActionFrame* destF
cAction->update(delayTime);
}
+
+bool ActionNode::isActionDoneOnce()
+{
+ if (_action == nullptr)
+ {
+ return true;
+ }
+ return _action->isDone();
+}
+
}
\ No newline at end of file
diff --git a/cocos/editor-support/cocostudio/CCActionNode.h b/cocos/editor-support/cocostudio/CCActionNode.h
index 6f38a1a647..fc081cfb8f 100644
--- a/cocos/editor-support/cocostudio/CCActionNode.h
+++ b/cocos/editor-support/cocostudio/CCActionNode.h
@@ -136,10 +136,8 @@ public:
/**
* Play the action.
- *
- * @param bloop true the
*/
- virtual void playAction(bool bloop);
+ virtual void playAction();
/**
* Stop the action.
@@ -148,6 +146,13 @@ public:
/*init properties with a json dictionary*/
virtual void initWithDictionary(JsonDictionary* dic,cocos2d::Object* root);
+
+ /**
+ * Gets if the action is done once time.
+ *
+ * @return that if the action is done once time
+ */
+ virtual bool isActionDoneOnce();
protected:
int _currentFrameIndex;
int _destFrameIndex;
diff --git a/cocos/editor-support/cocostudio/CCActionObject.cpp b/cocos/editor-support/cocostudio/CCActionObject.cpp
index 2dd60c66f2..ba12778510 100644
--- a/cocos/editor-support/cocostudio/CCActionObject.cpp
+++ b/cocos/editor-support/cocostudio/CCActionObject.cpp
@@ -25,7 +25,7 @@
#include "cocostudio/CCActionObject.h"
#include "cocostudio/DictionaryHelper.h"
- using namespace cocos2d;
+using namespace cocos2d;
namespace cocostudio {
@@ -37,15 +37,19 @@ ActionObject::ActionObject()
, _bPlaying(false)
, _fUnitTime(0.1f)
, _currentTime(0.0f)
+, _pScheduler(NULL)
{
_actionNodeList = Array::create();
_actionNodeList->retain();
+ _pScheduler = new Scheduler();
+ Director::sharedDirector()->getScheduler()->scheduleUpdateForTarget(_pScheduler, 0, false);
}
ActionObject::~ActionObject()
{
_actionNodeList->removeAllObjects();
_actionNodeList->release();
+ CC_SAFE_DELETE(_pScheduler);
}
void ActionObject::setName(const char* name)
@@ -134,11 +138,16 @@ void ActionObject::removeActionNode(ActionNode* node)
void ActionObject::play()
{
stop();
+ this->updateToFrameByTime(0.0f);
int frameNum = _actionNodeList->count();
for ( int i = 0; i < frameNum; i++ )
{
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
- actionNode->playAction( getLoop());
+ actionNode->playAction();
+ }
+ if (_loop)
+ {
+ _pScheduler->scheduleSelector(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f , kRepeatForever, 0.0f, false);
}
}
@@ -157,6 +166,7 @@ void ActionObject::stop()
actionNode->stopAction();
}
+ _pScheduler->unscheduleSelector(schedule_selector(ActionObject::simulationActionUpdate), this);
_bPause = false;
}
@@ -174,4 +184,30 @@ void ActionObject::updateToFrameByTime(float fTime)
}
}
+void ActionObject::simulationActionUpdate(float dt)
+{
+ if (_loop)
+ {
+ bool isEnd = true;
+ int nodeNum = _actionNodeList->count();
+
+ for ( int i = 0; i < nodeNum; i++ )
+ {
+ ActionNode* actionNode = (ActionNode*)_actionNodeList->objectAtIndex(i);
+
+ if (actionNode->isActionDoneOnce() == false)
+ {
+ isEnd = false;
+ break;
+ }
+ }
+
+ if (isEnd)
+ {
+ this->play();
+ }
+
+ CCLOG("ActionObject Update");
+ }
+}
}
\ No newline at end of file
diff --git a/cocos/editor-support/cocostudio/CCActionObject.h b/cocos/editor-support/cocostudio/CCActionObject.h
index cc748eaaa8..8118fc5cf7 100644
--- a/cocos/editor-support/cocostudio/CCActionObject.h
+++ b/cocos/editor-support/cocostudio/CCActionObject.h
@@ -142,7 +142,9 @@ public:
/*init properties with a json dictionary*/
void initWithDictionary(JsonDictionary* dic,cocos2d::Object* root);
-
+
+ /*scheduler update function*/
+ void simulationActionUpdate(float dt);
protected:
cocos2d::Array* _actionNodeList;/*actionnode*/
std::string _name;
@@ -151,6 +153,7 @@ protected:
bool _bPlaying;
float _fUnitTime;
float _currentTime;
+ cocos2d::Scheduler *_pScheduler;
};
}
diff --git a/cocos/gui/UILayout.cpp b/cocos/gui/UILayout.cpp
index 70b66a0b56..130ee7ae13 100644
--- a/cocos/gui/UILayout.cpp
+++ b/cocos/gui/UILayout.cpp
@@ -953,7 +953,7 @@ bool UIRectClippingNode::init()
rect[2] = cocos2d::Point(_clippingSize.width, _clippingSize.height);
rect[3] = cocos2d::Point(0, _clippingSize.height);
- cocos2d::Color4F green = {0, 1, 0, 1};
+ cocos2d::Color4F green = cocos2d::Color4F(0, 1, 0, 1);
_innerStencil->drawPolygon(rect, 4, green, 0, green);
if (cocos2d::ClippingNode::init(_innerStencil))
{
@@ -971,7 +971,7 @@ void UIRectClippingNode::setClippingSize(const cocos2d::Size &size)
rect[1] = cocos2d::Point(_clippingSize.width, 0);
rect[2] = cocos2d::Point(_clippingSize.width, _clippingSize.height);
rect[3] = cocos2d::Point(0, _clippingSize.height);
- cocos2d::Color4F green = {0, 1, 0, 1};
+ cocos2d::Color4F green = cocos2d::Color4F(0, 1, 0, 1);
_innerStencil->clear();
_innerStencil->drawPolygon(rect, 4, green, 0, green);
}
diff --git a/cocos/gui/proj.win32/libGUI.vcxproj b/cocos/gui/proj.win32/libGUI.vcxproj
index b225eaa127..2712ae3900 100644
--- a/cocos/gui/proj.win32/libGUI.vcxproj
+++ b/cocos/gui/proj.win32/libGUI.vcxproj
@@ -12,11 +12,8 @@
-
-
-
@@ -24,7 +21,9 @@
+
+
@@ -37,11 +36,8 @@
-
-
-
@@ -49,7 +45,9 @@
+
+
diff --git a/cocos/gui/proj.win32/libGUI.vcxproj.filters b/cocos/gui/proj.win32/libGUI.vcxproj.filters
index 12f0d385ab..092f28f7e0 100644
--- a/cocos/gui/proj.win32/libGUI.vcxproj.filters
+++ b/cocos/gui/proj.win32/libGUI.vcxproj.filters
@@ -24,9 +24,6 @@
UIWidgets\ScrollWidget
-
- UIWidgets\ScrollWidget
-
UIWidgets\ScrollWidget
@@ -72,12 +69,6 @@
System
-
- Layouts
-
-
- Layouts
-
Layouts
@@ -87,14 +78,17 @@
BaseClasses
+
+ Layouts
+
+
+ Layouts
+
UIWidgets\ScrollWidget
-
- UIWidgets\ScrollWidget
-
UIWidgets\ScrollWidget
@@ -140,12 +134,6 @@
System
-
- Layouts
-
-
- Layouts
-
Layouts
@@ -155,5 +143,11 @@
BaseClasses
+
+ Layouts
+
+
+ Layouts
+
\ No newline at end of file