void TaskChatLayer::processItemExchangeFunc(bool visible)
{
    UIButton* btnLeft = taskChatLayout->FindChildObjectByName<UIButton>("ItemExchangShopBtn");
    UILabel* labelLeft = taskChatLayout->FindChildObjectByName<UILabel>("ItemExchangText");
    btnLeft->setVisible(visible);
    labelLeft->setVisible(visible);
    labelLeft->setString(Localizatioin::getLocalization("M_EXCHANGESHOP_TITLE"));
    UIButton* btnRight = taskChatLayout->FindChildObjectByName<UIButton>("CityDefendBtn");
    UILabel* labelRight = taskChatLayout->FindChildObjectByName<UILabel>("CityDefendText");
    btnRight->setVisible(visible);
    labelRight->setVisible(visible);
    labelRight->setString(Localizatioin::getLocalization("M_CITYDEFEND_TITLE"));
    mShopType = 8;
}
void TaskChatLayer::processGuildChat(int type, bool visible)
{
    UIButton* btnLeft = taskChatLayout->FindChildObjectByName<UIButton>("ItemExchangShopBtn");
    UILabel* labelLeft = taskChatLayout->FindChildObjectByName<UILabel>("ItemExchangText");
    btnLeft->setVisible(visible);
    labelLeft->setVisible(visible);
    
    // type 10 11 12 13 分别代表公会商人、祈福、活动、排行
    if(type == 10)
    {
        labelLeft->setString(Localizatioin::getLocalization("G_SHOP_TITLE"));
    }
    else if(type == 11)
    {
        labelLeft->setString(Localizatioin::getLocalization("G_BENEDICTION_TITLE"));
    }
    else if(type == 12)
    {
        labelLeft->setString(Localizatioin::getLocalization("G_INSTANCE"));
    }
    else if(type == 13)
    {
        labelLeft->setString(Localizatioin::getLocalization("G_RANK"));
    }
    mShopType = type;
}
void GameWeekRewardLayer::BindingUIItems(CCObject *p)
{
    CCString str;
    str.initWithFormat("%d%d",eNetMsgTypeMissionSys, eNetMsgMissionSysWeekRewardKind);
    CSJson::Value root = XQDate::sharedInstance().GetDate(str.getCString());
    
    bool isShowBtn = false;
    
    for (int i = 0; i < root.size(); i ++) {
        CSJson::Value & val = root[i];
        if (val["iscomplete"].asInt() == 1) {
            isShowBtn = true;
        }
    }
    
    ul = UILayer::create();
    addChild(ul, 1);
    auto myLayout = static_cast<Layout*>(GUIReader::shareReader() -> widgetFromJsonFile("./CocoStudioResources/WeekRewardLayer.json"));
    ul -> addWidget(myLayout);
    
    UIPanel *myPanel = dynamic_cast<UIPanel*>(ul -> getWidgetByName("Panel_2"));
    myPanel -> addReleaseEvent(this, coco_releaseselector(GameWeekRewardLayer::touchWindow));
    // bind ui images
    
    UIButton *btn = dynamic_cast<UIButton*>(ul -> getWidgetByName("LotteryBtn"));
    if (isShowBtn) {
        btn->disable();
        btn->setVisible(false);
    }
    else {
        btn -> addReleaseEvent(this, coco_releaseselector(GameWeekRewardLayer::getWeekRewardBtnClick));
    }

	//设置字体不被选中;
}
void GameLayer_Menu::setNoLogin(bool visiable)
{
    UIPanel* dayLoginPanel = dynamic_cast<UIPanel*>(gameMenu->getWidgetByName("MenuBtn"));
    dayLoginPanel->setVisible(visiable);
    UIButton* taskBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("SysInfoBtn"));
    taskBtn->setTouchEnable(visiable);
    UIButton* emailBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("EmailBtn"));
    emailBtn->setTouchEnable(visiable);
    UIButton* addFriendBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("AddFriendBtn"));
    addFriendBtn->setTouchEnable(visiable);
    UIButton* rankBtn = dynamic_cast<UIButton*>(gameMenu->getWidgetByName("RankBtn"));
    rankBtn->setVisible(visiable);
    rankBtn->setTouchEnable(visiable);
}
예제 #5
0
bool AdResponseBox::createButtons() {
	clearButtons();

	_scrollOffset = 0;
	for (uint32 i = 0; i < _responses.size(); i++) {
		UIButton *btn = new UIButton(_gameRef);
		if (btn) {
			btn->_parent = _window;
			btn->setSharedFonts(true);
			btn->setSharedImages(true);
			btn->_sharedCursors = true;
			// iconic
			if (_responses[i]->getIcon()) {
				btn->setImage(_responses[i]->getIcon());
				if (_responses[i]->getIconHover()) {
					btn->setImageHover(_responses[i]->getIconHover());
				}
				if (_responses[i]->getIconPressed()) {
					btn->setImagePress(_responses[i]->getIconPressed());
				}

				btn->setCaption(_responses[i]->getText());
				if (_cursor) {
					btn->_cursor = _cursor;
				} else if (_gameRef->_activeCursor) {
					btn->_cursor = _gameRef->_activeCursor;
				}
			}
			// textual
			else {
				btn->setText(_responses[i]->getText());
				if (_font == nullptr) {
					btn->setFont(_gameRef->getSystemFont());
				} else {
					btn->setFont(_font);
				}
				btn->setFontHover((_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover);
				btn->setFontPress(btn->getFontHover());
				btn->setTextAlign(_align);

				if (_gameRef->_touchInterface) {
					btn->setFontHover(btn->getFont());
				}


				if (_responses[i]->getFont()) {
					btn->setFont(_responses[i]->getFont());
				}

				int width = _responseArea.right - _responseArea.left;

				if (width <= 0) {
					btn->setWidth(_gameRef->_renderer->getWidth());
				} else {
					btn->setWidth(width);
				}
			}
			btn->setName("response");
			btn->correctSize();

			// make the responses touchable
			if (_gameRef->_touchInterface) {
				btn->setHeight(MAX<int32>(btn->getHeight(), 50));
			}

			//btn->SetListener(this, btn, _responses[i]->_iD);
			btn->setListener(this, btn, i);
			btn->setVisible(false);
			_respButtons.add(btn);

			if (_responseArea.bottom - _responseArea.top < btn->getHeight()) {
				_gameRef->LOG(0, "Warning: Response '%s' is too high to be displayed within response box. Correcting.", _responses[i]->getText());
				_responseArea.bottom += (btn->getHeight() - (_responseArea.bottom - _responseArea.top));
			}
		}
	}
	_ready = false;

	return STATUS_OK;
}