bool GameLayer_GoldMarket::init()
{
    if (!CCLayer::init()) {
        return false;
    }
    //系统设置界面.
    goldMarket = UILayer::create();
    auto layout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile("./CocoStudioResources/GoldMarket.json"));
    goldMarket->addWidget(layout);
    //    sysSet->setVisible(true);
    this->addChild(goldMarket, 0, 101);
    
    UIPanel* panel = dynamic_cast<UIPanel*>(goldMarket->getWidgetByName("Panel"));
    panel->setBackGroundColor(ccBLACK);
    panel->setBackGroundColorOpacity(150);
    //关闭按钮
    UIButton* closeBtn = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("CloseBtn"));
    closeBtn->setTouchEnable(true);
    closeBtn->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::closeBtnCallback));
    closeBtn->setPressedActionEnabled(true);
    
    //购买按钮.
    UIButton* buyBtn_0 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_0"));
    buyBtn_0->setTag(Buy_0);
    buyBtn_0->setPressedActionEnabled(true);
    buyBtn_0->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    UIButton* buyBtn_1 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_1"));
    buyBtn_1->setTag(Buy_1);
    buyBtn_1->setPressedActionEnabled(true);
    buyBtn_1->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    UIButton* buyBtn_2 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_2"));
    buyBtn_2->setTag(Buy_2);
    buyBtn_2->setPressedActionEnabled(true);
    buyBtn_2->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    UIButton* buyBtn_3 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_3"));
    buyBtn_3->setTag(Buy_3);
    buyBtn_3->setPressedActionEnabled(true);
    buyBtn_3->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    //UIButton* buyBtn_4 = dynamic_cast<UIButton*>(goldMarket->getWidgetByName("BuyBtn_4"));
    //buyBtn_4->setTag(Buy_4);
    //buyBtn_4->setPressedActionEnabled(true);
    //buyBtn_4->addReleaseEvent(this, coco_releaseselector(GameLayer_GoldMarket::buyBtnCallback));
    
    
    this->setValue();

    //添加兑换按钮
    this->setVisible(true);
    return true;
}
bool UIPanelTest_Color::init()
{
    if (UIScene::init())
    {
        CCSize screenSize = CCDirector::sharedDirector()->getWinSize();        
        
        // Add the alert
        UILabel *alert = UILabel::create();
        alert->setText("Panel color render");
        alert->setFontName("Marker Felt");
        alert->setFontSize(30);
        alert->setColor(ccc3(159, 168, 176));
        alert->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getRect().size.height * 2.925));
        m_pUiLayer->addWidget(alert);
        
        UIPanel *background = dynamic_cast<UIPanel*>(m_pUiLayer->getWidgetByName("background_Panel"));
        
        // Create the panel with color render
        UIPanel* panel = UIPanel::create();
        panel->setBackGroundColorType(PANEL_COLOR_SOLID);
        panel->setBackGroundColor(ccc3(128, 128, 128));
        panel->setClippingEnable(true);
        panel->setSize(CCSizeMake(280, 150));
        CCSize backgroundSize = background->getContentSize();
        panel->setPosition(ccp((screenSize.width - backgroundSize.width) / 2 +
                               (backgroundSize.width - panel->getRect().size.width) / 2,
                               (screenSize.height - backgroundSize.height) / 2 +
                               (backgroundSize.height - panel->getRect().size.height) / 2));
        m_pUiLayer->addWidget(panel);
        
        UIButton* button = UIButton::create();
        button->setTouchEnable(true);
        button->setTextures("cocosgui/animationbuttonnormal.png", "cocosgui/animationbuttonpressed.png", "");
        button->setPosition(ccp(button->getRect().size.width / 2, panel->getRect().size.height - button->getRect().size.height / 2));
        panel->addChild(button);
        
        UITextButton* textButton = UITextButton::create();
        textButton->setTouchEnable(true);
        textButton->setTextures("cocosgui/backtotopnormal.png", "cocosgui/backtotoppressed.png", "");
        textButton->setText("Text Button");
        textButton->setPosition(ccp(panel->getRect().size.width / 2, panel->getRect().size.height / 2));
        panel->addChild(textButton);
        
        UIZoomButton* zoomButton = UIZoomButton::create();
        zoomButton->setTouchEnable(true);
        zoomButton->setTextures("cocosgui/button.png", "cocosgui/buttonHighlighted.png", "cocosgui/button.png");
        zoomButton->setTitle("ControlButton", "ControlButton", "ControlButton");
        zoomButton->setNormalFontSize(16);
        zoomButton->setNormalFontName("Marker Felt");
        zoomButton->setPressedFontSize(16);
        zoomButton->setPressedFontName("Marker Felt");
        zoomButton->setDisabledFontSize(16);
        zoomButton->setDisabledFontName("Marker Felt");
        zoomButton->setPreferredSize(CCSizeMake(100, zoomButton->getContentSize().height * 2.0f));
        zoomButton->setPosition(ccp(panel->getRect().size.width - zoomButton->getRect().size.width / 2,
                                       zoomButton->getRect().size.height / 2));
        panel->addChild(zoomButton);
        
        return true;
    }
    return false;
}