Example #1
0
void BlankTile::onClickTeleport(CCObject * pSender, Control::EventType pCCControlEvent) {
    SoundController::sharedSound()->playEffects(Music_Sfx_click_button);
    //王国远争后,迁回原服
    if(CCCommonUtils::isKuaFuWangZhan() &&  GlobalData::shared()->playerInfo.crossFightSrcServerId==GlobalData::shared()->playerInfo.currentServerId){
        PopupViewController::getInstance()->addPopupView(MoveCityPopUpView::create(MoveCity_Castle));
		closeThis();
        return;
    }
    if (!WorldController::isInSelfServer(m_cityInfo.tileServerId)) {
        if(ActivityController::getInstance()->checkServerCanJoin(GlobalData::shared()->playerInfo.currentServerId) && m_cityInfo.cityOriginType == "neutrally"){
            PopupViewController::getInstance()->addPopupView(CrossServerMoveCityPopUpView::create());
            closeThis();
            return ;
        }
    }
    if(WorldController::getInstance()->isInFresherForbidenArea(m_cityInfo.cityIndex) && FunBuildController::getInstance()->getMainCityLv() <= _limit_cross_server){
        if(!WorldController::isInSelfServer(m_cityInfo.tileServerId)){
            CCCommonUtils::flyText(_lang("104948"));
        }else{
            CCCommonUtils::flyText(_lang("108878"));
        }
        return;
    }
    
    if(!WorldController::isInSelfServer(m_cityInfo.tileServerId)){
        
        bool is_teleport_limit_open = GlobalData::shared()->teleport_limit_open;
        bool isGm = GlobalData::shared()->playerInfo.gmFlag == 1;
        bool haveLimit = false;
        if(is_teleport_limit_open && !isGm)//限制功能开启
        {
            double closeTime = GlobalData::shared()->playerInfo.regTime + GlobalData::shared()->teleport_limit_time * 3600;
            double currentTime = GlobalData::shared()->getTimeStamp();
            if(currentTime >= closeTime)
            {
                haveLimit = true;
            }
        }
        
       if( haveLimit || FunBuildController::getInstance()->getMainCityLv() > _limit_cross_server){
            CCCommonUtils::flyHint("", "", _lang("108751"));
            return;
        }

        PopupViewController::getInstance()->addPopupView(CrossServerMoveCityPopUpView::create());
    }else{
        PopupViewController::getInstance()->addPopupView(MoveCityPopUpView::create(MoveCity_Castle));
    }

    closeThis();
}
Example #2
0
void BlankTile::onClickOccupy(CCObject * pSender, Control::EventType pCCControlEvent) {
    SoundController::sharedSound()->playEffects(Music_Sfx_click_button);
    if (!canOccupy()) {
        CCCommonUtils::flyHint("", "", _lang("108733"));
        return;
    }
    auto button = dynamic_cast<CCControlButton*>(pSender);
    if (button) {
        button->setEnabled(false);
    }
    WorldController::getInstance()->alertProectFlag = true;
    if (!m_cityInfo.playerName.empty())
    {
        // have owner
        WorldController::getInstance()->m_alertStateFlag = 2;
    }
    else
    {
        // no owner
        WorldController::getInstance()->m_alertStateFlag = 0;
        
        for(auto it :WorldController::getInstance()->m_marchInfo)
        {
            if(it.second.stateType == StateMarch && it.second.endPointIndex == this->m_cityInfo.cityIndex)
            {
                WorldController::getInstance()->m_alertStateFlag = 1;
                break;
            }
        }
    }
    WorldController::getInstance()->openMarchDeploy(m_cityInfo.cityIndex,0);

    closeThis();
}
Example #3
0
void BlankTile::onClickPlace(cocos2d::CCObject *pSender, Control::EventType pCCControlEvent)
{
    SoundController::sharedSound()->playEffects(Music_Sfx_click_button);
    AllianceManager::getInstance()->tmpCityIndex = m_cityInfo.cityIndex;
    PopupViewController::getInstance()->addPopupInView(AllianceTerritoryView::create(m_cityInfo.cityIndex,true));
    closeThis();
}
Example #4
0
void BlankTile::onClickInviteTeleport(cocos2d::CCObject *pSender, Control::EventType pCCControlEvent)
{
    SoundController::sharedSound()->playEffects(Music_Sfx_click_button);
    AllianceManager::getInstance()->tmpCityIndex = m_cityInfo.cityIndex;
    PopupViewController::getInstance()->addPopupInView(AllianceInfoMembersView::create(GlobalData::shared()->playerInfo.allianceInfo.uid, false, 1));
    closeThis();
}
Example #5
0
void TroopInfoPanel::timeCount(float dt) {
    auto &marchInfos = WorldController::getInstance()->m_marchInfo;
    auto it = marchInfos.find(m_marchId);
    if (it == marchInfos.end()) {
        closeThis();
        return;
    }
    
    auto &info = it->second;
    
    double remainTime = info.endStamp - WorldController::getInstance()->getTime();
    if (remainTime <= 0) {
        closeThis();
        return;
    }

    string stateStr = "";
    switch (info.stateType) {
        case StateMarch:{
            if (info.marchType == MethodDeal){
                stateStr = _lang("102280"); //"Trade\n"
            }
            else if (info.marchType == MethodScout)
            {
                stateStr = _lang("108539"); //"Scout\n"
            }
            else {
                stateStr = _lang("108562");//"Attack\n";
            }
        }
            break;
        case StateReturn:{
            stateStr = _lang("108572");//"return\n";
        }
            break;
        default:
            break;
    }
    std::string str = stateStr;
    if(info.ownerType != PlayerSelf){
        int bid = FunBuildController::getInstance()->getMaxLvBuildByType(FUN_BUILD_WATCH_TOWER);
        int lv3 = GlobalData::shared()->imperialInfo[bid].level;
        str = stateStr  + "\n" + CCCommonUtils::timeLeftToCountDown(remainTime / 1000);
    }
    m_tilePoint->setString(str);
}
Example #6
0
void TroopInfoPanel::onTouchEnded(CCTouch *pTouch, CCEvent *pEvent){
    if (isTouchInside(m_infoBG, pTouch)) {
        if(SceneController::getInstance()->currentSceneId != SCENE_ID_WORLD){
            return;
        }
        auto &marchInfos = WorldController::getInstance()->m_marchInfo;
        auto it = marchInfos.find(m_marchId);
        if (it == marchInfos.end()) {
            closeThis();
            return;
        }

        auto &info = it->second;
        if(info.ownerType == PlayerSelf && info.stateType == StateMarch){
            CCPoint endPt = WorldController::getPointByIndex(info.endPointIndex);
            //zym 2015.12.11
           // PopupViewController::getInstance()->forceClearAll(true);
            
            WorldMapView::instance()->gotoTilePoint(endPt, GlobalData::shared()->playerInfo.selfServerId);
 
        }
    }
    closeThis();
}
Example #7
0
EditorTab::EditorTab(QWidget *parent)
	: QTabWidget(parent)
{
	this->setTabsClosable(true);
    this->setTabShape(Triangular);

	LoadStyleSheet(this, "style_code_tab.css");

	connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

	//create context menu
	context= new QMenu(this);		
	LoadStyleSheet(context, "style_menu.css");
	QAction * action = context->addAction("Close tab");
	connect(action, SIGNAL(triggered()), this, SLOT(closeThis()));
	action = context->addAction("Close all but this");
	connect(action, SIGNAL(triggered()), this, SLOT(closeAllButThis()));
	//projectContext->addAction(action);
	//projectContext->addSeparator();
}
Example #8
0
EditorTab::EditorTab(QWidget *parent)
	: QTabWidget(parent)
{
	this->setTabsClosable(true);
	this->setTabShape(Triangular);

	LoadStyleSheet(this, "style_code_tab.css");

	connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

	//create context menu
	context= new QMenu(this);		
	LoadStyleSheet(context, "style_menu.css");
	QAction * action = context->addAction("Close tab");
	connect(action, SIGNAL(triggered()), this, SLOT(closeThis()));
	action = context->addAction("Close all but this");
	connect(action, SIGNAL(triggered()), this, SLOT(closeAllButThis()));

	tabBar()->installEventFilter( this );

    setAttribute(Qt::WA_DeleteOnClose);
}
Example #9
0
StartSplash::StartSplash(QPixmap &p)
	: QSplashScreen(p)
{
	QTimer::singleShot(3000, this, SLOT(closeThis()));
}