void CStrengthenItem::onTouchItem(CCObject* pSender) { if(isVisible()) { PlayEffectSound(SFX_Button); } CImageView * img = (CImageView*)pSender; m_item = (CItem*)img->getUserData(); m_pItemTip->showItemProperty(m_item); CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr")); attribute->setVisible(true); m_selectCellImg->removeFromParent(); img->addChild(m_selectCellImg); m_selectCellImg->setVisible(true); m_selectCellImg->setPosition(ccp(img->getContentSize().width/2,0/*img->getContentSize().height/2*/)); CButton *select = (CButton*)(m_ui->findWidgetById("select")); //sel_font CLabel *selfont = (CLabel*)(m_ui->findWidgetById("sel_font")); if (m_toHero==m_item->armor.hero&&m_toHero>0) { select->setVisible(true); selfont->setVisible(false); } else if (m_toHero>0&&!m_item->canUse) { select->setVisible(false); selfont->setVisible(false); } else { select->setVisible(true); selfont->setVisible(true); } if (m_type==2) { if (m_toHero>0) { CImageView *uninstall = (CImageView*)(m_ui->findWidgetById("uninstall")); CImageView *change = (CImageView*)(m_ui->findWidgetById("change")); CImageView *selfont = (CImageView*)(m_ui->findWidgetById("sel_font")); uninstall->setVisible(m_toHero==m_item->armor.hero); change->setVisible(m_toHero!=m_item->armor.hero&&m_item->armor.hero>0&&m_item->canUse); selfont->setVisible(m_item->armor.hero==0&&m_item->canUse); } } }
void LoginLayerUC::hideServerList() { m_pTableView->setVisible(false); CButton* pQuickLogin = (CButton *)m_ui->getChildByTag(1); pQuickLogin->setVisible(true); m_pCurrentServerUI->setVisible(true); }
void LoginLayerUC::initLogin() { CCLOG("LoginLayerUC::initLogin"); if(m_ui!=nullptr) { return; } //播放背景音乐 PlayBackgroundMusic(BGM_Login,true); m_ui = LoadComponent("EnterGameUC.xaml"); m_ui->setTag(1); m_ui->setPosition(VCENTER); m_LayoutRoot->addChild(m_ui, 2); //自己的登陆框隐藏 m_pLoginLay = (CLayout *)m_ui->getChildByTag(10); m_pLoginLay->setVisible(false); //选择好的服务器列表 m_pCurrentServerUI = (CLayout *)m_ui->findWidgetById("current_server"); m_pCurrentServerUI->setVisible(true); //默认服务器 updateSelectServer(); //服务器选区 CLayout* pLayout = (CLayout*)m_ui->findWidgetById("serverCell"); pLayout->retain(); m_ui->removeChild(pLayout); m_pCell = pLayout; //获取空的滑动列表Scroll m_pTableView = (CTableView*)m_ui->findWidgetById("serverScroll"); m_pTableView->setDirection(eScrollViewDirectionVertical); m_pTableView->setSizeOfCell(m_pCell->getContentSize()); m_pTableView->setCountOfCell(m_serverInfo.server_list().size()); m_pTableView->setBounceable(true); m_pTableView->setDataSourceAdapter(this, ccw_datasource_adapter_selector(LoginLayerUC::tableviewDataSource)); m_pTableView->reloadData(); //按钮打开服务器列表 CImageView* pBtnServer = (CImageView*)m_ui->findWidgetById("serverBtn"); //快速登录按钮 CButton * pQuickLogin = (CButton *)m_ui->getChildByTag(1); pQuickLogin->setOnClickListener(this,ccw_click_selector(LoginLayerUC::onQuickLogin)); CCActionInterval *scaleSmall = CCScaleTo::create(0.9f,0.98f); CCFadeTo *out = CCFadeTo::create(0.9f,60); CCSpawn *spawn = CCSpawn::createWithTwoActions(scaleSmall,out); CCActionInterval *scaleBig = CCScaleTo::create(1.2f,1.0f); CCFadeTo *in = CCFadeTo::create(1.2f,255); CCSpawn *spawn1 = CCSpawn::createWithTwoActions(scaleBig,in); CCSequence *seque = CCSequence::createWithTwoActions(spawn,spawn1); CCRepeatForever *action = CCRepeatForever::create(seque); pQuickLogin->runAction(action); pQuickLogin->setVisible(true); //清除用户信息 DataCenter::sharedData()->getUser()->clear(); //版本做相对位置处理 CLabel* pLabel = (CLabel *)m_ui->findWidgetById("version"); pLabel->setAnchorPoint(ccp(1.0f, 0.0f)); pLabel->setPosition(ccp(VRIGHT-20, VBOTTOM+20)); CC_SAFE_RETAIN(pLabel); pLabel->removeFromParentAndCleanup(true); this->addChild(pLabel); CC_SAFE_RELEASE(pLabel); pLabel->setString(CCString::createWithFormat("Version:%s", m_serverInfo.game_version().c_str())->getCString()); //隐藏服务器列表 showServerList(); hideServerList(); //TODO //初始化UC_SDK?-放在最前面 //还是点击登录再初始化? //点击登录再初始化吧 //初始化完直接请求登录 //先连接连接服务器 const Server& gameServer = m_serverInfo.server_list().Get(m_iSelectServerIndex); //检查服务器是否可用 if(!checkServerStatus(gameServer)) { return; } LinkedGameServer(gameServer); }