From 26a7f3474c837c35d493af502b867481131a4e98 Mon Sep 17 00:00:00 2001 From: CaiWenzhi Date: Thu, 26 Dec 2013 21:02:47 +0800 Subject: [PATCH] Modify reader --- .../cocostudio/CCSGUIReader.cpp | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index 091c3a674f..ef913c9c12 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -1025,17 +1025,22 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(JsonDictionary *dat Widget* child = widgetFromJsonDictionary(subData); if (child) { - if (dynamic_cast(widget)) + PageView* pageView = dynamic_cast(widget); + if (pageView) { - dynamic_cast(widget)->addPage(static_cast(child)); - } - else if (dynamic_cast(widget)) - { - dynamic_cast(widget)->pushBackCustomItem(child); + pageView->addPage(static_cast(child)); } else { - widget->addChild(child); + ListView* listView = dynamic_cast(widget); + if (listView) + { + listView->pushBackCustomItem(child); + } + else + { + widget->addChild(child); + } } } CC_SAFE_DELETE(subData); @@ -1949,7 +1954,7 @@ void WidgetPropertiesReader0300::setPropsForListViewFromJsonDictionary(Widget* w { setPropsForLayoutFromJsonDictionary(widget, options); - ListView* listView = (ListView*)widget; + ListView* listView = static_cast(widget); float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth"); float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");