Ejemplo n.º 1
0
bool TabSupervisor::closeRequest()
{
    if (getGameCount()) {
        if (QMessageBox::question(this, tr("Are you sure?"), tr("There are still open games. Are you sure you want to quit?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
            return false;
        }
    }

    foreach(TabDeckEditor *tab,  deckEditorTabs)
    {
        if(!tab->confirmClose())
            return false;
    }

    return true;
}
Ejemplo n.º 2
0
void ChallengeGameManager::timer()
{
    std::vector<DWORD> del_vec;
    std::vector<DWORD>::iterator iter;
    for(GAMEMAP_ITER it=gameMap.begin(); it!=gameMap.end(); ++it)
    {
	if(it->second)
	{
	    if(CHALLENGE_STATE_CANCLEAR == it->second->state)
	    {
		Cmd::Session::t_PutOneGameIDBack_SceneSession cmd;		//回收ID
		cmd.type = it->second->gameType;
		cmd.gameID = it->second->getGameID();
		sessionClient->sendCmd(&cmd, sizeof(cmd));

		del_vec.push_back(it->first);
		SAFE_DELETE((it->second));		    //释放掉一个战场的内存
	    }
	    else
	    {
		it->second->timer();
	    }
	}
    }
    for(iter=del_vec.begin(); iter!=del_vec.end(); iter++)
    {
	gameMap.erase(*iter);
	decreaseGameCount();
    }

    if(_ten_sec(SceneTimeTick::currentTime.sec()))
    {//同步服务器战斗总局数到会话
	WORD countryID = SceneManager::getInstance().getServerCountryID();
	Cmd::Session::t_NotifySceneServerGameCount_SceneSession send;
	send.countryID = countryID;
	send.gameCount = getGameCount();
	sessionClient->sendCmd(&send, sizeof(send));
	//Zebra::logger->debug("[卡牌]发送当前场景对战局数到会话 countryID:%u(%u)",countryID, send.gameCount);
    }
}