Skip to content

Commit 8e160c6

Browse files
committed
Merge pull request cocos2d#1261 from xingsenma/develop_action
closed cocos2d#3256: Fixed a bug of CCActionInterval that it will error when target have not own RGBAProtocol.
2 parents 184a56d + 0e70d57 commit 8e160c6

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

cocos2d/actions/CCActionInterval.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,9 @@ cc.FadeIn = cc.ActionInterval.extend(/** @lends cc.FadeIn# */{
18271827
* @param {Number} time time in seconds
18281828
*/
18291829
update:function (time) {
1830-
this._target.setOpacity(255 * time);
1830+
if (this._target.RGBAProtocol) {
1831+
this._target.setOpacity(255 * time);
1832+
}
18311833
},
18321834

18331835
/**
@@ -1872,7 +1874,9 @@ cc.FadeOut = cc.ActionInterval.extend(/** @lends cc.FadeOut# */{
18721874
* @param {Number} time time in seconds
18731875
*/
18741876
update:function (time) {
1875-
this._target.setOpacity(255 * (1 - time));
1877+
if (this._target.RGBAProtocol) {
1878+
this._target.setOpacity(255 * (1 - time));
1879+
}
18761880
},
18771881

18781882
/**
@@ -1948,15 +1952,19 @@ cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{
19481952
* @param {Number} time time in seconds
19491953
*/
19501954
update:function (time) {
1951-
this._target.setOpacity((this._fromOpacity + (this._toOpacity - this._fromOpacity) * time));
1955+
if (this._target.RGBAProtocol) {
1956+
this._target.setOpacity((this._fromOpacity + (this._toOpacity - this._fromOpacity) * time));
1957+
}
19521958
},
19531959

19541960
/**
19551961
* @param {cc.Sprite} target
19561962
*/
19571963
startWithTarget:function (target) {
19581964
cc.ActionInterval.prototype.startWithTarget.call(this, target);
1959-
this._fromOpacity = target.getOpacity();
1965+
if(this._target.RGBAProtocol){
1966+
this._fromOpacity = target.getOpacity();
1967+
}
19601968
}
19611969
});
19621970

@@ -2020,16 +2028,20 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{
20202028
*/
20212029
startWithTarget:function (target) {
20222030
cc.ActionInterval.prototype.startWithTarget.call(this, target);
2023-
this._from = this._target.getColor();
2031+
if (this._target.RGBAProtocol) {
2032+
this._from = this._target.getColor();
2033+
}
20242034
},
20252035

20262036
/**
20272037
* @param {Number} time time in seconds
20282038
*/
20292039
update:function (time) {
20302040
var locFrom = this._from, locTo = this._to;
2031-
this._target.setColor(cc.c3b(locFrom.r + (locTo.r - locFrom.r) * time,
2032-
(locFrom.g + (locTo.g - locFrom.g) * time), (locFrom.b + (locTo.b - locFrom.b) * time)));
2041+
if (this._target.RGBAProtocol) {
2042+
this._target.setColor(cc.c3b(locFrom.r + (locTo.r - locFrom.r) * time,
2043+
(locFrom.g + (locTo.g - locFrom.g) * time), (locFrom.b + (locTo.b - locFrom.b) * time)));
2044+
}
20332045
}
20342046
});
20352047

cocos2d/tileMap_parallax_nodes/CCTMXLayer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
105105
cc.Node.prototype.setContentSize.call(this, size);
106106

107107
if(cc.renderContextType === cc.CANVAS){
108+
var eglViewer = cc.EGLView.getInstance();
108109
var locCanvas = this._cacheCanvas;
109-
locCanvas.width = 0|(size.width * 1.5);
110-
locCanvas.height = 0|(size.height * 1.5);
110+
locCanvas.width = 0|(size.width * 1.5 * eglViewer._scaleX);
111+
locCanvas.height = 0|(size.height * 1.5 * eglViewer._scaleY);
111112
this._cacheContext.translate(0, locCanvas.height);
112113
var locContentSize = this._cacheTexture._contentSize;
113114
locContentSize.width = locCanvas.width;

extensions/CocoStudio/Armature/utils/CCDataReaderHelper.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -715,16 +715,20 @@ ccs.DataReaderHelper.decodeBoneDisplayFromJson = function (json, dataInfo) {
715715
var dicArray = json[ccs.CONST_SKIN_DATA]|| [];
716716
var dic = dicArray[0];
717717
if(dic){
718-
displayData.skinData.x = (dic[ccs.CONST_A_X]|| 0) * this._positionReadScale;
719-
displayData.skinData.y = (dic[ccs.CONST_A_Y]||0) * this._positionReadScale;
718+
var skinData = displayData.skinData;
719+
skinData.x = (dic[ccs.CONST_A_X]|| 0) * this._positionReadScale;
720+
skinData.y = (dic[ccs.CONST_A_Y]||0) * this._positionReadScale;
720721
if(dic.hasOwnProperty(ccs.CONST_A_SCALE_X)){
721-
displayData.skinData.scaleX = dic[ccs.CONST_A_SCALE_X];
722+
skinData.scaleX = dic[ccs.CONST_A_SCALE_X];
722723
}
723724
if(dic.hasOwnProperty(ccs.CONST_A_SCALE_Y)){
724-
displayData.skinData.scaleY = dic[ccs.CONST_A_SCALE_Y];
725+
skinData.scaleY = dic[ccs.CONST_A_SCALE_Y];
725726
}
726-
displayData.skinData.skewX = dic[ccs.CONST_A_SKEW_X]|| 0;
727-
displayData.skinData.skewY = dic[ccs.CONST_A_SKEW_Y]||0;
727+
skinData.skewX = dic[ccs.CONST_A_SKEW_X]|| 0;
728+
skinData.skewY = dic[ccs.CONST_A_SKEW_Y]||0;
729+
730+
skinData.x *= dataInfo.contentScale;
731+
skinData.y *= dataInfo.contentScale;
728732
dic = null;
729733
}
730734
break;

extensions/CocoStudio/GUI/System/UIHelper.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ ccs.UIHelper.seekActionWidgetByActionTag = function (root, tag) {
107107
return root;
108108
}
109109
var arrayRootChildren = root.getChildren();
110-
var length = arrayRootChildren.num;
111110
for (var i = 0; i < arrayRootChildren.length; i++) {
112111
var child = arrayRootChildren[i];
113112
var res = this.seekActionWidgetByActionTag(child, tag);

0 commit comments

Comments
 (0)