void Message::setMessageButton(MessageBoxStyle _info) { clearButton(); std::vector<MessageBoxStyle> buttons = _info.getButtons(); for (size_t index=0; index<buttons.size(); ++index) { // корректируем ее номер MessageBoxStyle info = buttons[index]; // если бит есть то ставим кнопку addButtonName(getButtonName(info)); // внутри адд сбрасывается mVectorButton.back()->_setInternalData(info); // первая кнопка if (mVectorButton.size() == 1) mInfoOk = info; // последняя кнопка mInfoCancel = info; } updateSize(); }
void BetControler::radioButtonsCallback( CCObject* pSender ) { SoundPlayer::play(SNDI_CLICK); int data=(int)(static_cast<CCMenuItemSprite*>(pSender)->getUserData()); if(preSelection==data){ unFocusButton(data); preSelection=Player::DECISION_NONE; }else{ clearButton(); focusButton(data); preSelection=data; } }
void JoyButtonContextMenu::buildMenu() { QAction *action = 0; action = this->addAction(tr("Toggle")); action->setCheckable(true); action->setChecked(button->getToggleState()); connect(action, SIGNAL(triggered()), this, SLOT(switchToggle())); action = this->addAction(tr("Turbo")); action->setCheckable(true); action->setChecked(button->isUsingTurbo()); connect(action, SIGNAL(triggered()), this, SLOT(switchToggle())); this->addSeparator(); action = this->addAction(tr("Clear")); action->setCheckable(false); connect(action, SIGNAL(triggered()), this, SLOT(clearButton())); this->addSeparator(); QMenu *setSectionMenu = this->addMenu(tr("Set Select")); action = setSectionMenu->addAction(tr("Disabled")); if (button->getChangeSetCondition() == JoyButton::SetChangeDisabled) { action->setCheckable(true); action->setChecked(true); } connect(action, SIGNAL(triggered()), this, SLOT(disableSetMode())); setSectionMenu->addSeparator(); for (int i=0; i < InputDevice::NUMBER_JOYSETS; i++) { QMenu *tempSetMenu = setSectionMenu->addMenu(tr("Set %1").arg(i+1)); int setSelection = i*3; if (i == button->getSetSelection()) { QFont tempFont = tempSetMenu->menuAction()->font(); tempFont.setBold(true); tempSetMenu->menuAction()->setFont(tempFont); } QActionGroup *tempGroup = new QActionGroup(tempSetMenu); action = tempSetMenu->addAction(tr("Set %1 1W").arg(i+1)); action->setData(QVariant(setSelection + 0)); action->setCheckable(true); if (button->getSetSelection() == i && button->getChangeSetCondition() == JoyButton::SetChangeOneWay) { action->setChecked(true); } connect(action, SIGNAL(triggered()), this, SLOT(switchSetMode())); tempGroup->addAction(action); action = tempSetMenu->addAction(tr("Set %1 2W").arg(i+1)); action->setData(QVariant(setSelection + 1)); action->setCheckable(true); if (button->getSetSelection() == i && button->getChangeSetCondition() == JoyButton::SetChangeTwoWay) { action->setChecked(true); } connect(action, SIGNAL(triggered()), this, SLOT(switchSetMode())); tempGroup->addAction(action); action = tempSetMenu->addAction(tr("Set %1 WH").arg(i+1)); action->setData(QVariant(setSelection + 2)); action->setCheckable(true); if (button->getSetSelection() == i && button->getChangeSetCondition() == JoyButton::SetChangeWhileHeld) { action->setChecked(true); } connect(action, SIGNAL(triggered()), this, SLOT(switchSetMode())); tempGroup->addAction(action); if (i == button->getParentSet()->getIndex()) { tempSetMenu->setEnabled(false); } } }
void BetControler::clear(){ actionID=Player::DECISION_NONE; raiseData=0; preSelection=Player::DECISION_NONE; clearButton(); }
//whether has new card released, we need to clear MaxBet for new circle at this point void BetControler::updateButtons( GameScreen* gameScreen,const JSONNode& node,float delayTime/*=0*/ ) { this->gameScreen=gameScreen; TableLayer* table=gameScreen->table; Player* mySelf=table->mySelf; INT64 betAmount=0,chipsInGame=0; if(mySelf != NULL) { betAmount=mySelf->m_betAmount; chipsInGame=mySelf->m_chipsInGame; } INT64 maxBet=table->maxBet; //hide all buttons first hideAllBtns(); int next=node["next"].as_int(); int currentDecision = JsonHelper::optInt(node,"decision"); if(preSelection!=Player::DECISION_NONE){ switch(preSelection){ case Player::DECISION_CHECK_FOLD: if(next==table->myPosition&&table->isSitDown){ if(betAmount<maxBet){ preSelection=Player::DECISION_FOLD; }else { preSelection=Player::DECISION_CHECK; } } break; case Player::DECISION_CALL_ANY: if(next==table->myPosition&&table->isSitDown){ if(betAmount==maxBet){ preSelection=Player::DECISION_CHECK; }else{ preSelection=Player::DECISION_CALL; } } break; case Player::DECISION_ALLIN: break; case Player::DECISION_CHECK: if(betAmount < maxBet) { preSelection=Player::DECISION_NONE; clearButton(); } break; case Player::DECISION_CALL: if (currentDecision == Player::DECISION_RAISE && betAmount < maxBet) { clearButton(); preSelection=Player::DECISION_NONE; } break; } } if(preSelection!=Player::DECISION_NONE&&next==table->myPosition&&table->isSitDown){ actionID=preSelection; raiseData=0; JSONCommand* lcmd=JSONCommand::createJSONCMD(JSONCommand::CMD_U_COMMIT); char* msg=lcmd->encode(gameScreen); gameScreen->gameSocket->sendMsg(msg); delete lcmd; clearButton(); preSelection=Player::DECISION_NONE;//comments this out to turn the auto debug on return; } if(next==table->myPosition&&table->isSitDown)//big select button { m_ptrCheckTimer->stopAllActions(); m_ptrCheckTimer->setVisible(false); m_ptrFoldTimer->stopAllActions(); m_ptrFoldTimer->setVisible(false); m_foldButton->setVisible(true); m_raiseButton->setVisible(true); m_raiseButton->setEnabled(true); m_checkButton->setVisible(true); if(betAmount<maxBet){ if(chipsInGame+betAmount>maxBet){ m_callButton->setVisible(true); m_checkButton->setVisible(false); m_ptrLbCallAmount->setString( CCString::createWithFormat("%s",GameUtils::num2tableStr(maxBet-betAmount,table->blindBet,6).c_str())->getCString()); }else{ m_allinButton->setVisible(true); m_raiseButton->setEnabled(false); m_checkButton->setVisible(false); } }else if(betAmount==maxBet){ if(chipsInGame+betAmount>=maxBet){ m_checkButton->setVisible(true); m_ptrCheckTimer->setVisible(true); m_ptrCheckTimer->runAction(CCSequence::create( CCDelayTime::create(delayTime), CCProgressFromTo::create(((TableLayer*)getParent())->thinkTime, 100,0),NULL)); }else{//shouldn't happen m_checkButton->setVisible(true); m_raiseButton->setEnabled(false); } } if (!m_checkButton->isVisible()) { m_ptrFoldTimer->setVisible(true); m_ptrFoldTimer->runAction(CCSequence::create( CCDelayTime::create(delayTime), CCProgressFromTo::create(((TableLayer*)getParent())->thinkTime, 100,0),NULL)); } }else{//small radio button if(mySelf && mySelf->m_state==Player::GAME_PLAYING&&table->isSitDown){ m_checkFoldRadioButton->setVisible(true); m_callanyRadioButton->setVisible(true); m_callanyRadioButton->setEnabled(true); m_checkRadioButton->setVisible(true); if(betAmount<maxBet){//not check if(chipsInGame+betAmount>maxBet){ m_callRadioButton->setVisible(true); m_checkRadioButton->setVisible(false); }else{ m_allinRadioButton->setVisible(true); m_checkRadioButton->setVisible(false); m_callanyRadioButton->setEnabled(false); } }else if(betAmount==maxBet){ m_checkRadioButton->setVisible(true); } } } }
int main(void){ // initialize init(); while(1) { // input & process if (Stylus.Released) { clearButton(); } if (Pad.Released.L || Pad.Released.R) { pushed_trig = 0; } if (Pad.Released.Left || Pad.Released.Y) { pushed_left = 0; } if (Pad.Released.Right || Pad.Released.A) { pushed_right = 0; } if (Pad.Released.Up || Pad.Released.X) { pushed_up = 0; } if (Pad.Released.Down || Pad.Released.B) { pushed_down = 0; } if (Stylus.Held) { if (!pushed_stylus) { if (result_print == 2) { insertString(inputValue, inputPos, " ", 100); inputValue[inputPos] = getStylusValue(); if (actionStylus2(checkValue(inputValue[inputPos]))) goto LOOP_END; // if (on_graph) { // // } else { // // } } else { insertString(expr, exprPos, " ", 200); expr[exprPos] = getStylusValue(); insertString(p_expr, printStrPos, " ", 340); p_expr[printStrPos] = expr[exprPos]; if (actionStylus(checkValue(expr[exprPos]))) goto LOOP_END; } } pushed_stylus = 1; } if (Pad.Held.L || Pad.Held.R) { if (!pushed_trig) { stylus_page = stylus_page == 1 ? 2 : 1; changeLabel(stylus_page); } pushed_trig = 1; } if (Pad.Held.Left || Pad.Held.Y) { if (!pushed_left) { moveCursor(-1); // left move } pushed_left = 1; } if (Pad.Held.Right || Pad.Held.A) { if (!pushed_right) { moveCursor(1); // right move } pushed_right = 1; } if (Pad.Held.Up || Pad.Held.X) { if (!pushed_up) { overviewPrevExpr(); } pushed_up = 1; } if (Pad.Held.Down || Pad.Held.B) { if (!pushed_down) { overviewNextExpr(); } pushed_down = 1; } // teardown printExpr(); //moveCursor(1); LOOP_END: PA_WaitForVBL(); // process interrupt } return 0; }