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
2 changes: 1 addition & 1 deletion frameworks/cocos2d-html5
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
// WIDGET //
////////////

parser.widgetAttributes = function(widget, json){
parser.widgetAttributes = function(widget, json) {
widget.setCascadeColorEnabled(true);
widget.setCascadeOpacityEnabled(true);

Expand All @@ -219,33 +219,33 @@
setContentSize(widget, json["Size"]);

var name = json["Name"];
if(name)
if (name)
widget.setName(name);

var actionTag = json["ActionTag"] || 0;
widget.setActionTag(actionTag);
widget.setUserObject(new ccs.ActionTimelineData(actionTag));

var rotationSkewX = json["RotationSkewX"];
if(rotationSkewX)
if (rotationSkewX)
widget.setRotationX(rotationSkewX);

var rotationSkewY = json["RotationSkewY"];
if(rotationSkewY)
if (rotationSkewY)
widget.setRotationY(rotationSkewY);

//var rotation = json["Rotation"];

var flipX = json["FlipX"];
if(flipX)
if (flipX)
widget.setFlippedX(true);

var flipY = json["FlipY"];
if(flipY)
if (flipY)
widget.setFlippedY(true);

var zOrder = json["zOrder"];
if(zOrder != null)
if (zOrder != null)
widget.setLocalZOrder(zOrder);

//var visible = json["Visible"];
Expand All @@ -254,7 +254,7 @@
widget.setVisible(visible);

var alpha = json["Alpha"];
if(alpha != null)
if (alpha != null)
widget.setOpacity(alpha);

widget.setTag(json["Tag"] || 0);
Expand All @@ -265,100 +265,97 @@
// -- var frameEvent = json["FrameEvent"];

var callBackType = json["CallBackType"];
if(callBackType != null)
if (callBackType != null)
widget.setCallbackType(callBackType);

var callBackName = json["CallBackName"];
if(callBackName)
if (callBackName)
widget.setCallbackName(callBackName);

var position = json["Position"];
if(position != null)
if (position != null)
widget.setPosition(position["X"] || 0, position["Y"] || 0);

var scale = json["Scale"];
if(scale != null){
if (scale != null) {
var scaleX = getParam(scale["ScaleX"], 1);
var scaleY = getParam(scale["ScaleY"], 1);
widget.setScaleX(scaleX);
widget.setScaleY(scaleY);
}

var anchorPoint = json["AnchorPoint"];
if(anchorPoint != null)
if (anchorPoint != null)
widget.setAnchorPoint(anchorPoint["ScaleX"] || 0, anchorPoint["ScaleY"] || 0);

var color = json["CColor"];
if(color != null)
if (color != null)
widget.setColor(getColor(color));

if(widget instanceof ccui.Layout){
var layoutComponent = ccui.LayoutComponent.bindLayoutComponent(widget);

var positionXPercentEnabled = json["PositionPercentXEnable"] || false;
var positionYPercentEnabled = json["PositionPercentYEnable"] || false;
var positionXPercent = 0,
positionYPercent = 0,
PrePosition = json["PrePosition"];
if(PrePosition != null){
positionXPercent = PrePosition["X"] || 0;
positionYPercent = PrePosition["Y"] || 0;
}
var sizeXPercentEnable = json["PercentWidthEnable"] || false;
var sizeYPercentEnable = json["PercentHeightEnable"] || false;
var sizeXPercent = 0,
sizeYPercent = 0,
PreSize = json["PreSize"];
if(PrePosition != null){
sizeXPercent = PreSize["X"] || 0;
sizeYPercent = PreSize["Y"] || 0;
}
var stretchHorizontalEnabled = json["StretchWidthEnable"] || false;
var stretchVerticalEnabled = json["StretchHeightEnable"] || false;
var horizontalEdge = json["HorizontalEdge"];// = ccui.LayoutComponent.horizontalEdge.LEFT;
var verticalEdge = json["VerticalEdge"]; // = ccui.LayoutComponent.verticalEdge.TOP;
var leftMargin = json["LeftMargin"] || 0;
var rightMargin = json["RightMargin"] || 0;
var topMargin = json["TopMargin"] || 0;
var bottomMargin = json["BottomMargin"] || 0;

layoutComponent.setPositionPercentXEnabled(positionXPercentEnabled);
layoutComponent.setPositionPercentYEnabled(positionYPercentEnabled);
layoutComponent.setPositionPercentX(positionXPercent);
layoutComponent.setPositionPercentY(positionYPercent);
layoutComponent.setPercentWidthEnabled(sizeXPercentEnable);
layoutComponent.setPercentHeightEnabled(sizeYPercentEnable);
layoutComponent.setPercentWidth(sizeXPercent);
layoutComponent.setPercentHeight(sizeYPercent);
layoutComponent.setStretchWidthEnabled(stretchHorizontalEnabled);
layoutComponent.setStretchHeightEnabled(stretchVerticalEnabled);

var horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.NONE;
if (horizontalEdge == "LeftEdge"){
horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.LEFT;
}else if (horizontalEdge == "RightEdge"){
horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.RIGHT;
}else if (horizontalEdge == "BothEdge"){
horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.CENTER;
}
layoutComponent.setHorizontalEdge(horizontalEdgeType);

var verticalEdgeType = ccui.LayoutComponent.verticalEdge.NONE;
if (verticalEdge == "TopEdge"){
verticalEdgeType = ccui.LayoutComponent.verticalEdge.TOP;
}else if (verticalEdge == "BottomEdge"){
verticalEdgeType = ccui.LayoutComponent.verticalEdge.BOTTOM;
}else if (verticalEdge == "BothEdge"){
verticalEdgeType = ccui.LayoutComponent.verticalEdge.CENTER;
}
layoutComponent.setVerticalEdge(verticalEdgeType);
var layoutComponent = ccui.LayoutComponent.bindLayoutComponent(widget);

layoutComponent.setTopMargin(topMargin);
layoutComponent.setBottomMargin(bottomMargin);
layoutComponent.setLeftMargin(leftMargin);
layoutComponent.setRightMargin(rightMargin);
var positionXPercentEnabled = json["PositionPercentXEnable"] || false;
var positionYPercentEnabled = json["PositionPercentYEnable"] || false;
var positionXPercent = 0,
positionYPercent = 0,
PrePosition = json["PrePosition"];
if (PrePosition != null) {
positionXPercent = PrePosition["X"] || 0;
positionYPercent = PrePosition["Y"] || 0;
}
var sizeXPercentEnable = json["PercentWidthEnable"] || false;
var sizeYPercentEnable = json["PercentHeightEnable"] || false;
var sizeXPercent = 0,
sizeYPercent = 0,
PreSize = json["PreSize"];
if (PrePosition != null) {
sizeXPercent = PreSize["X"] || 0;
sizeYPercent = PreSize["Y"] || 0;
}
var stretchHorizontalEnabled = json["StretchWidthEnable"] || false;
var stretchVerticalEnabled = json["StretchHeightEnable"] || false;
var horizontalEdge = json["HorizontalEdge"];// = ccui.LayoutComponent.horizontalEdge.LEFT;
var verticalEdge = json["VerticalEdge"]; // = ccui.LayoutComponent.verticalEdge.TOP;
var leftMargin = json["LeftMargin"] || 0;
var rightMargin = json["RightMargin"] || 0;
var topMargin = json["TopMargin"] || 0;
var bottomMargin = json["BottomMargin"] || 0;

layoutComponent.setPositionPercentXEnabled(positionXPercentEnabled);
layoutComponent.setPositionPercentYEnabled(positionYPercentEnabled);
layoutComponent.setPositionPercentX(positionXPercent);
layoutComponent.setPositionPercentY(positionYPercent);
layoutComponent.setPercentWidthEnabled(sizeXPercentEnable);
layoutComponent.setPercentHeightEnabled(sizeYPercentEnable);
layoutComponent.setPercentWidth(sizeXPercent);
layoutComponent.setPercentHeight(sizeYPercent);
layoutComponent.setStretchWidthEnabled(stretchHorizontalEnabled);
layoutComponent.setStretchHeightEnabled(stretchVerticalEnabled);

var horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.NONE;
if (horizontalEdge == "LeftEdge") {
horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.LEFT;
} else if (horizontalEdge == "RightEdge") {
horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.RIGHT;
} else if (horizontalEdge == "BothEdge") {
horizontalEdgeType = ccui.LayoutComponent.horizontalEdge.CENTER;
}
layoutComponent.setHorizontalEdge(horizontalEdgeType);

var verticalEdgeType = ccui.LayoutComponent.verticalEdge.NONE;
if (verticalEdge == "TopEdge") {
verticalEdgeType = ccui.LayoutComponent.verticalEdge.TOP;
} else if (verticalEdge == "BottomEdge") {
verticalEdgeType = ccui.LayoutComponent.verticalEdge.BOTTOM;
} else if (verticalEdge == "BothEdge") {
verticalEdgeType = ccui.LayoutComponent.verticalEdge.CENTER;
}
layoutComponent.setVerticalEdge(verticalEdgeType);

layoutComponent.setTopMargin(topMargin);
layoutComponent.setBottomMargin(bottomMargin);
layoutComponent.setLeftMargin(leftMargin);
layoutComponent.setRightMargin(rightMargin);
};

/**
Expand Down