Skip to content

Commit 3c2b184

Browse files
committed
issue cocos2d#3192 fixed some bug for cocostudio reader
1 parent bf6c6d4 commit 3c2b184

File tree

2 files changed

+28
-146
lines changed

2 files changed

+28
-146
lines changed

extensions/CocoStudio/Reader/GUIReader.js

Lines changed: 23 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -370,26 +370,6 @@ ccs.WidgetPropertiesReader0250 = ccs.WidgetPropertiesReader.extend({
370370
}
371371

372372
this.setColorPropsForWidgetFromJsonDictionary(widget, options);
373-
374-
this.setPropsForWidgetFromJsonDictionary(widget, options);
375-
var checkBox = widget;
376-
377-
var backGroundDic = options["backGroundBoxData"];
378-
var backGroundType = backGroundDic["resourceType"];
379-
switch (backGroundType) {
380-
case 0:
381-
var backGroundFileName = backGroundDic["path"];
382-
var backGroundFileName_tp = backGroundFileName ? this._filePath + backGroundFileName : null;
383-
checkBox.loadTextureBackGround(backGroundFileName_tp);
384-
break;
385-
case 1:
386-
var backGroundFileName = backGroundDic["path"];
387-
checkBox.loadTextureBackGround(backGroundFileName, ccs.TextureResType.plist);
388-
break;
389-
default:
390-
break;
391-
}
392-
backGroundDic = null;
393373
},
394374

395375
setPropsForImageViewFromJsonDictionary: function (widget, options) {
@@ -545,7 +525,7 @@ ccs.WidgetPropertiesReader0250 = ccs.WidgetPropertiesReader.extend({
545525

546526

547527
setPropsForScrollViewFromJsonDictionary: function (widget, options) {
548-
this.setPropsForPanelFromJsonDictionary(widget, options);
528+
this.setPropsForLayoutFromJsonDictionary(widget, options);
549529
var scrollView = widget;
550530
var innerWidth = options["innerWidth"];
551531
var innerHeight = options["innerHeight"];
@@ -566,121 +546,6 @@ ccs.WidgetPropertiesReader0250 = ccs.WidgetPropertiesReader.extend({
566546
this.setColorPropsForWidgetFromJsonDictionary(widget, options);
567547
},
568548

569-
setPropsForPanelFromJsonDictionary: function (widget, options) {
570-
if (this._olderVersion) {
571-
this.setPropsForContainerWidgetFromJsonDictionary(widget, options);
572-
var panel = widget;
573-
var backGroundScale9Enable = options["backGroundScale9Enable"];
574-
panel.setBackGroundImageScale9Enabled(backGroundScale9Enable);
575-
var cr = options["bgColorR"];
576-
var cg = options["bgColorG"];
577-
var cb = options["bgColorB"];
578-
579-
var scr = options["bgStartColorR"];
580-
var scg = options["bgStartColorG"];
581-
var scb = options["bgStartColorB"];
582-
583-
var ecr = options["bgEndColorR"];
584-
var ecg = options["bgEndColorG"];
585-
var ecb = options["bgEndColorB"];
586-
587-
var bgcv1 = options["vectorX"];
588-
var bgcv2 = options["vectorY"];
589-
panel.setBackGroundColorVector(cc.p(bgcv1, bgcv2));
590-
591-
var co = options["bgColorOpacity"];
592-
593-
var colorType = options["colorType"];
594-
panel.setBackGroundColorType(colorType);
595-
panel.setBackGroundColor(cc.c3b(scr, scg, scb), cc.c3b(ecr, ecg, ecb));
596-
panel.setBackGroundColor(cc.c3b(cr, cg, cb));
597-
panel.setBackGroundColorOpacity(co);
598-
599-
var imageFileName = options["backGroundImage"];
600-
var imageFileName_tp = imageFileName ? this._filePath + imageFileName : null;
601-
var useMergedTexture = options["useMergedTexture"];
602-
if (backGroundScale9Enable) {
603-
var cx = options["capInsetsX"];
604-
var cy = options["capInsetsY"];
605-
var cw = options["capInsetsWidth"];
606-
var ch = options["capInsetsHeight"];
607-
if (useMergedTexture) {
608-
panel.setBackGroundImage(imageFileName, ccs.TextureResType.plist);
609-
}
610-
else {
611-
panel.setBackGroundImage(imageFileName_tp);
612-
}
613-
panel.setBackGroundImageCapInsets(cc.rect(cx, cy, cw, ch));
614-
}
615-
else {
616-
617-
if (useMergedTexture) {
618-
panel.setBackGroundImage(imageFileName, ccs.TextureResType.plist);
619-
}
620-
else {
621-
panel.setBackGroundImage(imageFileName_tp);
622-
}
623-
}
624-
this.setColorPropsForWidgetFromJsonDictionary(widget, options);
625-
}
626-
else {
627-
this.setPropsForContainerWidgetFromJsonDictionary(widget, options);
628-
var panel = widget;
629-
var backGroundScale9Enable = options["backGroundScale9Enable"];
630-
panel.setBackGroundImageScale9Enabled(backGroundScale9Enable);
631-
var cr = options["bgColorR"];
632-
var cg = options["bgColorG"]
633-
var cb = options["bgColorB"];
634-
635-
var scr = options["bgStartColorR"];
636-
var scg = options["bgStartColorG"]
637-
var scb = options["bgStartColorB"];
638-
639-
var ecr = options["bgEndColorR"];
640-
var ecg = options["bgEndColorG"];
641-
var ecb = options["bgEndColorB"];
642-
643-
var bgcv1 = options["vectorX"];
644-
var bgcv2 = options["vectorY"];
645-
panel.setBackGroundColorVector(cc.p(bgcv1, bgcv2));
646-
647-
var co = options["bgColorOpacity"];
648-
649-
var colorType = options["colorType"];
650-
panel.setBackGroundColorType(colorType);
651-
panel.setBackGroundColor(cc.c3b(scr, scg, scb), cc.c3b(ecr, ecg, ecb));
652-
panel.setBackGroundColor(cc.c3b(cr, cg, cb));
653-
panel.setBackGroundColorOpacity(co);
654-
655-
656-
var imageFileNameDic = options["backGroundImageData"] || {};
657-
var imageFileNameType = imageFileNameDic["resourceType"];
658-
switch (imageFileNameType) {
659-
case 0:
660-
var imageFileName = imageFileNameDic["path"];
661-
var imageFileName_tp = imageFileName ? this._filePath + imageFileName : null;
662-
panel.setBackGroundImage(imageFileName_tp);
663-
break;
664-
case 1:
665-
var imageFileName = imageFileNameDic["path"];
666-
panel.setBackGroundImage(imageFileName, ccs.TextureResType.plist);
667-
break;
668-
default:
669-
break;
670-
}
671-
imageFileNameDic = null;
672-
673-
if (backGroundScale9Enable) {
674-
var cx = options["capInsetsX"];
675-
var cy = options["capInsetsY"];
676-
var cw = options["capInsetsWidth"];
677-
var ch = options["capInsetsHeight"];
678-
panel.setBackGroundImageCapInsets(cc.rect(cx, cy, cw, ch));
679-
}
680-
this.setColorPropsForWidgetFromJsonDictionary(widget, options);
681-
}
682-
},
683-
684549
setPropsForSliderFromJsonDictionary: function (widget, options) {
685550

686551
this.setPropsForWidgetFromJsonDictionary(widget, options);
@@ -844,8 +709,8 @@ ccs.WidgetPropertiesReader0250 = ccs.WidgetPropertiesReader.extend({
844709
},
845710

846711
setPropsForPageViewFromJsonDictionary: function (widget, options) {
847-
this.setPropsForPanelFromJsonDictionary(widget, options);
848-
this.setColorPropsForWidgetFromJsonDictionary(widget, options);
712+
/* this.setPropsForPanelFromJsonDictionary(widget, options);
713+
this.setColorPropsForWidgetFromJsonDictionary(widget, options);*/
849714
},
850715

851716
setPropsForLabelBMFontFromJsonDictionary: function (widget, options) {
@@ -1156,7 +1021,24 @@ ccs.WidgetPropertiesReader0300 = ccs.WidgetPropertiesReader.extend({
11561021
},
11571022

11581023
setPropsForCheckBoxFromJsonDictionary: function (widget, options) {
1024+
this.setPropsForWidgetFromJsonDictionary(widget, options);
11591025
var checkBox = widget;
1026+
var backGroundDic = options["backGroundBoxData"];
1027+
var backGroundType = backGroundDic["resourceType"];
1028+
switch (backGroundType) {
1029+
case 0:
1030+
var backGroundFileName = backGroundDic["path"];
1031+
var backGroundFileName_tp = backGroundFileName ? this._filePath + backGroundFileName : null;
1032+
checkBox.loadTextureBackGround(backGroundFileName_tp);
1033+
break;
1034+
case 1:
1035+
var backGroundFileName = backGroundDic["path"];
1036+
checkBox.loadTextureBackGround(backGroundFileName, ccs.TextureResType.plist);
1037+
break;
1038+
default:
1039+
break;
1040+
}
1041+
backGroundDic = null;
11601042
var backGroundSelectedDic = options["backGroundBoxSelectedData"];
11611043
var backGroundSelectedType = backGroundSelectedDic["resourceType"];
11621044
switch (backGroundSelectedType) {
@@ -1393,7 +1275,7 @@ ccs.WidgetPropertiesReader0300 = ccs.WidgetPropertiesReader.extend({
13931275

13941276

13951277
setPropsForScrollViewFromJsonDictionary: function (widget, options) {
1396-
this.setPropsForPanelFromJsonDictionary(widget, options);
1278+
this.setPropsForLayoutFromJsonDictionary(widget, options);
13971279
var scrollView = widget;
13981280
var innerWidth = options["innerWidth"];
13991281
var innerHeight = options["innerHeight"];
@@ -1656,8 +1538,8 @@ ccs.WidgetPropertiesReader0300 = ccs.WidgetPropertiesReader.extend({
16561538
},
16571539

16581540
setPropsForPageViewFromJsonDictionary: function (widget, options) {
1659-
this.setPropsForPanelFromJsonDictionary(widget, options);
1660-
this.setColorPropsForWidgetFromJsonDictionary(widget, options);
1541+
/*this.setPropsForPanelFromJsonDictionary(widget, options);
1542+
this.setColorPropsForWidgetFromJsonDictionary(widget, options);*/
16611543
},
16621544

16631545
setPropsForLabelBMFontFromJsonDictionary: function (widget, options) {

extensions/CocoStudio/Reader/SceneReader.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ ccs.SceneReader = cc.Class.extend({
237237
var attribute = null;
238238
if (resType == 0) {
239239
attribute = ccs.ComAttribute.create();
240-
var size = 0;
241-
var data = 0;
242-
data = cc.FileUtils.getInstance().getTextFileData(path);
243-
if (data) {
244-
attribute.setDict(JSON.parse(data));
240+
if(this._baseBath!=path){
241+
var data = cc.FileUtils.getInstance().getTextFileData(path);
242+
if (data) {
243+
attribute.setDict(JSON.parse(data));
244+
}
245245
}
246246
}
247247
else {

0 commit comments

Comments
 (0)