Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions extensions/cocostudio/action/CCActionFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,19 @@ ccs.FrameEaseType = {
Circ_EaseOut : 20,
Circ_EaseInOut : 21,

Elastic_EaesIn : 22,
Elastic_EaesOut : 23,
Elastic_EaesInOut : 24,
Elastic_EaseIn : 22,
Elastic_EaseOut : 23,
Elastic_EaseInOut : 24,

Back_EaseIn : 25,
Back_EaseOut : 26,
Back_EaseInOut : 27,

Bounce_EaseIn : 28,
Bounce_EaseOut : 29,
Bounce_EaseInOut : 30
Bounce_EaseInOut : 30,

TWEEN_EASING_MAX: 1000
};


Expand Down Expand Up @@ -227,13 +229,13 @@ ccs.ActionFrame = ccs.Class.extend(/** @lends ccs.ActionFrame# */{
case ccs.FrameEaseType.Circ_EaseInOut:
resultAction = action.easing(cc.easeCircleActionInOut());
break;
case ccs.FrameEaseType.Elastic_EaesIn:
case ccs.FrameEaseType.Elastic_EaseIn:
resultAction = action.easing(cc.easeElasticIn());
break;
case ccs.FrameEaseType.Elastic_EaesOut:
case ccs.FrameEaseType.Elastic_EaseOut:
resultAction = action.easing(cc.easeElasticOut());
break;
case ccs.FrameEaseType.Elastic_EaesInOut:
case ccs.FrameEaseType.Elastic_EaseInOut:
resultAction = action.easing(cc.easeElasticInOut());
break;
case ccs.FrameEaseType.Back_EaseIn:
Expand Down
24 changes: 22 additions & 2 deletions extensions/cocostudio/loader/parsers/action-2.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
deferred: function(json, resourcePath, action, file){
var animationlist = json["Content"]["Content"]["AnimationList"];
var length = animationlist ? animationlist.length : 0;
for (var i = 0; i < length; i++) {
for (var i = 0; i < length; i++){
var animationdata = animationlist[i];
var info = { name: null, startIndex: null, endIndex: null };
info.name = animationdata["Name"];
Expand Down Expand Up @@ -220,7 +220,7 @@
},
{
name: "ActionValue",
handle: function(options){
handle: function (options) {

var frame = new ccs.InnerActionFrame();
var innerActionType = options["InnerActionType"];
Expand All @@ -229,6 +229,10 @@

var singleFrameIndex = options["SingleFrameIndex"];

var frameIndex = options["FrameIndex"];
if(frameIndex !== undefined)
frame.setFrameIndex(frameIndex);

frame.setInnerActionType(ccs.InnerActionType[innerActionType]);
frame.setSingleFrameIndex(singleFrameIndex);

Expand All @@ -240,6 +244,18 @@
}
];

var loadEasingDataWithFlatBuffers = function(frame, options){
var type = options["Type"];
frame.setTweenType(type);
var points = options["Points"];
if(points){
points = points.map(function(p){
return cc.p(p["X"], p["Y"]);
});
frame.setEasingParams(points);
}
};

frameList.forEach(function(item){
parser.registerParser(item.name, function(options, resourcePath){
var timeline = new ccs.Timeline();
Expand All @@ -252,6 +268,10 @@
frame.setFrameIndex(frameData["FrameIndex"]);
var tween = frameData["Tween"] != null ? frameData["Tween"] : true;
frame.setTween(tween);
//https://github.com/cocos2d/cocos2d-x/pull/11388/files
var easingData = frameData["EasingData"];
if(easingData)
loadEasingDataWithFlatBuffers(frame, easingData);
timeline.addFrame(frame);
});
}
Expand Down
51 changes: 48 additions & 3 deletions extensions/cocostudio/loader/parsers/timelineParser-2.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@

node.setTag(json["Tag"] || 0);

node.setUserObject(new ccs.ActionTimelineData(json["ActionTag"] || 0));
var actionTag = json["ActionTag"] || 0;
var extensionData = new ccs.ObjectExtensionData();
var customProperty = json["UserData"];
if(customProperty !== undefined)
extensionData.setCustomProperty(customProperty);
extensionData.setActionTag(actionTag);
node.setUserObject(extensionData);

node.setCascadeColorEnabled(true);
node.setCascadeOpacityEnabled(true);
Expand Down Expand Up @@ -175,6 +181,16 @@
}
});

var blendData = json["BlendFunc"];
if(json["BlendFunc"]) {
var blendFunc = cc.BlendFunc.ALPHA_PREMULTIPLIED;
if (blendData["Src"] !== undefined)
blendFunc.src = blendData["Src"];
if (blendData["Dst"] !== undefined)
blendFunc.dst = blendData["Dst"];
node.setBlendFunc(blendFunc);
}

if(json["FlipX"])
node.setFlippedX(true);
if(json["FlipY"])
Expand Down Expand Up @@ -203,6 +219,16 @@
node = new cc.ParticleSystem(path);
self.generalAttributes(node, json);
!cc.sys.isNative && node.setDrawMode(cc.ParticleSystem.TEXTURE_MODE);

var blendData = json["BlendFunc"];
if(json["BlendFunc"]){
var blendFunc = cc.BlendFunc.ALPHA_PREMULTIPLIED;
if(blendData["Src"] !== undefined)
blendFunc.src = blendData["Src"];
if(blendData["Dst"] !== undefined)
blendFunc.dst = blendData["Dst"];
node.setBlendFunc(new cc.BlendFunc());
}
});
return node;
};
Expand All @@ -227,7 +253,12 @@

var actionTag = json["ActionTag"] || 0;
widget.setActionTag(actionTag);
widget.setUserObject(new ccs.ActionTimelineData(actionTag));
var extensionData = new ccs.ObjectExtensionData();
var customProperty = json["UserData"];
if(customProperty !== undefined)
extensionData.setCustomProperty(customProperty);
extensionData.setActionTag(actionTag);
widget.setUserObject(extensionData);

var rotationSkewX = json["RotationSkewX"];
if (rotationSkewX)
Expand Down Expand Up @@ -492,6 +523,16 @@
}
widget.setTextVerticalAlignment(v_alignment);

if(json["OutlineEnabled"] && json["OutlineColor"])
widget.enableOutline(getColor(json["OutlineColor"]), json["OutlineSize"] || 0);

if(json["ShadowEnabled"] && json["ShadowColor"])
widget.enableShadow(
getColor(json["ShadowColor"]),
cc.size(getParam(json["ShadowOffsetX"], 2), getParam(json["ShadowOffsetY"], -2)),
json["ShadowBlurRadius"] || 0
);

//todo check it
var isCustomSize = json["IsCustomSize"];
if(isCustomSize != null)
Expand Down Expand Up @@ -1157,6 +1198,9 @@
parser.generalAttributes(obj.node, json);
if(obj.action && obj.node){
obj.action.tag = obj.node.tag;
var InnerActionSpeed = json["InnerActionSpeed"];
if(InnerActionSpeed !== undefined)
obj.action.setTimeSpeed(InnerActionSpeed);
obj.node.runAction(obj.action);
obj.action.gotoFrameAndPause(0);
}
Expand Down Expand Up @@ -1245,7 +1289,8 @@
var r = json["R"] != null ? json["R"] : 255;
var g = json["G"] != null ? json["G"] : 255;
var b = json["B"] != null ? json["B"] : 255;
return cc.color(r, g, b);
var a = json["A"] != null ? json["A"] : 255;
return cc.color(r, g, b, a);
};

var setContentSize = function(node, size){
Expand Down
23 changes: 23 additions & 0 deletions extensions/cocostudio/timeline/ActionTimeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,29 @@ ccs.ActionTimelineData = ccs.Class.extend({

});

ccs.ObjectExtensionData = ccs.Class.extend({

_customProperty: null,
_timelineData: null,

ctor: function(){
this._timelineData = new ccs.ActionTimelineData(0);
return true;
},

setActionTag: function(actionTag){
this._timelineData.setActionTag(actionTag);
},

getActionTag: function(){
return this._timelineData.getActionTag();
}
});

ccs.ObjectExtensionData.create = function(){
return new ccs.ObjectExtensionData();
};

/**
* Create new ActionTimelineData.
*
Expand Down
Loading