From 32724e559dbee4711ae646b1d7afa3cd498cd008 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 3 Jul 2014 14:38:45 +0800 Subject: [PATCH] fix container default color issue --- .../editor-support/cocostudio/CocoLoader.cpp | 5 +- .../LayoutReader/LayoutReader.cpp | 72 ++++++++++++++++--- .../TextFieldReader/TextFieldReader.cpp | 2 +- 3 files changed, 65 insertions(+), 14 deletions(-) diff --git a/cocos/editor-support/cocostudio/CocoLoader.cpp b/cocos/editor-support/cocostudio/CocoLoader.cpp index e8708d0628..8a0aeced5b 100644 --- a/cocos/editor-support/cocostudio/CocoLoader.cpp +++ b/cocos/editor-support/cocostudio/CocoLoader.cpp @@ -44,7 +44,7 @@ Type stExpCocoNode::GetType(CocoLoader* pCoco) stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].GetAttribDescArray(pCoco); tType = Type(tpAttribDescArray[m_AttribIndex].m_cTypeName - 'N' + kNullType); - if('F' == tType || 'T' == tType) + if(kFalseType == tType || kTrueType == tType) { char* szValue = (char*)GetValue(pCoco); if(szValue[0] == '0') @@ -103,16 +103,13 @@ char* stExpCocoNode::GetName(CocoLoader* pCoco) } else { - //»Áπ˚√˚◊÷”ο‡√˚≥∆≤ªÕ¨£¨‘Ú∞¥’Ê µ÷µ…Ë÷√ char* szValue = GetValue(pCoco); if(szValue[0]) { - // ˝◊È szName = GetValue(pCoco); } else { - //Ω·ππ szName = tpCocoObjectDesc[m_ObjIndex].GetName(pCoco); } } diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index b41cebbcde..7fe7a9dcaa 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -3,6 +3,9 @@ #include "LayoutReader.h" #include "ui/UILayout.h" #include "cocostudio/CocoLoader.h" +#include "ui/UIScrollView.h" +#include "ui/UIPageView.h" +#include "ui/UIListView.h" USING_NS_CC; using namespace ui; @@ -194,17 +197,67 @@ namespace cocostudio bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, P_BackGroundScale9Enable); panel->setBackGroundImageScale9Enabled(backGroundScale9Enable); - int cr = DICTOOL->getIntValue_json(options, P_BgColorR,150); - int cg = DICTOOL->getIntValue_json(options, P_BgColorG,150); - int cb = DICTOOL->getIntValue_json(options, P_BgColorB,100); - int scr = DICTOOL->getIntValue_json(options, P_BgStartColorR,255); - int scg = DICTOOL->getIntValue_json(options, P_BgStartColorG, 255); - int scb = DICTOOL->getIntValue_json(options, P_BgStartColorB, 255); - int ecr = DICTOOL->getIntValue_json(options, P_BgEndColorR,150); - int ecg = DICTOOL->getIntValue_json(options, P_BgEndColorG,200); - int ecb = DICTOOL->getIntValue_json(options, P_BgEndColorB,255); + int cr; + int cg; + int cb; + int scr; + int scg; + int scb; + int ecr; + int ecg; + int ecb; + + if (dynamic_cast(widget)) { + cr = DICTOOL->getIntValue_json(options, "bgColorR",150); + cg = DICTOOL->getIntValue_json(options, "bgColorG",150); + cb = DICTOOL->getIntValue_json(options, "bgColorB",100); + + scr = DICTOOL->getIntValue_json(options, "bgStartColorR",255); + scg = DICTOOL->getIntValue_json(options, "bgStartColorG",255); + scb = DICTOOL->getIntValue_json(options, "bgStartColorB",255); + + ecr = DICTOOL->getIntValue_json(options, "bgEndColorR",255); + ecg = DICTOOL->getIntValue_json(options, "bgEndColorG",150); + ecb = DICTOOL->getIntValue_json(options, "bgEndColorB",100); + }else if(dynamic_cast(widget)){ + cr = DICTOOL->getIntValue_json(options, "bgColorR",150); + cg = DICTOOL->getIntValue_json(options, "bgColorG",150); + cb = DICTOOL->getIntValue_json(options, "bgColorB",255); + + scr = DICTOOL->getIntValue_json(options, "bgStartColorR",255); + scg = DICTOOL->getIntValue_json(options, "bgStartColorG",255); + scb = DICTOOL->getIntValue_json(options, "bgStartColorB",255); + + ecr = DICTOOL->getIntValue_json(options, "bgEndColorR",150); + ecg = DICTOOL->getIntValue_json(options, "bgEndColorG",150); + ecb = DICTOOL->getIntValue_json(options, "bgEndColorB",255); + }else if(dynamic_cast(widget)){ + cr = DICTOOL->getIntValue_json(options, "bgColorR",255); + cg = DICTOOL->getIntValue_json(options, "bgColorG",150); + cb = DICTOOL->getIntValue_json(options, "bgColorB",100); + + scr = DICTOOL->getIntValue_json(options, "bgStartColorR",255); + scg = DICTOOL->getIntValue_json(options, "bgStartColorG",255); + scb = DICTOOL->getIntValue_json(options, "bgStartColorB",255); + + ecr = DICTOOL->getIntValue_json(options, "bgEndColorR",255); + ecg = DICTOOL->getIntValue_json(options, "bgEndColorG",150); + ecb = DICTOOL->getIntValue_json(options, "bgEndColorB",100); + }else{ + cr = DICTOOL->getIntValue_json(options, "bgColorR",150); + cg = DICTOOL->getIntValue_json(options, "bgColorG",200); + cb = DICTOOL->getIntValue_json(options, "bgColorB",255); + + scr = DICTOOL->getIntValue_json(options, "bgStartColorR",255); + scg = DICTOOL->getIntValue_json(options, "bgStartColorG",255); + scb = DICTOOL->getIntValue_json(options, "bgStartColorB",255); + + ecr = DICTOOL->getIntValue_json(options, "bgEndColorR",150); + ecg = DICTOOL->getIntValue_json(options, "bgEndColorG",200); + ecb = DICTOOL->getIntValue_json(options, "bgEndColorB",255); + } float bgcv1 = DICTOOL->getFloatValue_json(options, P_VectorX); float bgcv2 = DICTOOL->getFloatValue_json(options, P_VectorY,-0.5); @@ -214,6 +267,7 @@ namespace cocostudio int colorType = DICTOOL->getIntValue_json(options, P_ColorType,1); panel->setBackGroundColorType(Layout::BackGroundColorType(colorType)); + panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb)); panel->setBackGroundColor(Color3B(cr, cg, cb)); panel->setBackGroundColorOpacity(co); diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp index ae5dc10d37..5d844a5cff 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp @@ -96,7 +96,7 @@ namespace cocostudio { textField->setPlaceHolder(DICTOOL->getStringValue_json(options, P_PlaceHolder,"input words here")); } - textField->setText(DICTOOL->getStringValue_json(options, P_Text,"text Field")); + textField->setText(DICTOOL->getStringValue_json(options, P_Text,"Text Tield")); textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize,20));