void LockHelper::showStarTipDialog(bool dressUp) { TipDialog* pDialog = TipDialog::create("game/json/nostar.json"); WJSprite* pCancelSprite = pDialog->getLayerJson()->getSubSpriteByKey("cancel"); pCancelSprite->setVisible(false); if (!dressUp) { /* 隐藏yes按钮 */ pDialog->getLayerJson()->getSubSpriteByKey("yes")->setVisible(false); /* 调整no按钮位置和图片 */ WJButton* pNoButton = pDialog->getLayerJson()->getSubButton("no"); pNoButton->setPosition(pCancelSprite->getPosition()); pNoButton->keepContentSize(false); pNoButton->setNormalFileName(pCancelSprite->getSpriteFileName()); pNoButton->loadSpriteTexture(pCancelSprite->getSpriteFileName()); /* 调整显示的提示文本 */ pDialog->getLayerJson()->getSubSpriteByKey("words")->setVisible(false); pDialog->getLayerJson()->getSubSpriteByKey("wordp001")->setVisible(true); } Common::sound.play("Common:popup"); pDialog->setOnOkCallBack(CC_CALLBACK_1(LockHelper::onStarTipDialogOkClick, this)); Director::getInstance()->getRunningScene()->addChild(pDialog, 9999); pDialog->show(); }
void ScrollDiyItem::showDiyPopDialog() { // diy pop TipDialog* pTipDialog = TipDialog::create("game/json/diypop.json"); pTipDialog->setOnOkCallBack(CC_CALLBACK_1(ScrollDiyItem::onClickShowDiyPopOkButton, this)); Common::sound.play("Common:popup"); Director::getInstance()->getRunningScene()->addChild(pTipDialog, 9999); pTipDialog->show(LBModalDialogAnimationType::ScaleEaseBack); }
void LockHelper::showUseStarDialog(Node* pNode, WJTouchEvent* e, const char *key, bool bCallback, WJTouchCallback callback) { TipDialog* pTipDialog = TipDialog::create("game/json/usestar.json"); LockItemClickInfo* pInfo = new LockItemClickInfo(); pInfo->m_node = pNode; pInfo->cloneTouchEvent(e); pInfo->m_itemKey = key; pInfo->m_bCallback = bCallback; pInfo->m_callback = callback; pTipDialog->setUserData(pInfo); pTipDialog->setOnOkCallBack(CC_CALLBACK_1(LockHelper::onUseStarDialogOKClick, this)); pTipDialog->setOnCloseCallBack(CC_CALLBACK_1(LockHelper::onUseStarDialogCancelClick, this)); Common::sound.play("Common:popup"); LockHelper::updateMenuPositionInUseStarDialog(pNode, pTipDialog); Director::getInstance()->getRunningScene()->addChild(pTipDialog, 9999); pTipDialog->show(LBModalDialogAnimationType::ScaleEaseBack); }