void CHeroEvolveEffectLayer::showDataFlyInByType( int iType ) { for(int i=0; i<9; i++) { if( (iType==1 && i<4) || (iType==2 && i>=4)) { CLayout *pLay = (CLayout *)m_pUI->findWidgetById(CCString::createWithFormat("data%d", i+1)->getCString()); pLay->setPositionX(pLay->getPositionX()-600); pLay->setVisible(false); pLay->setOpacity(0); pLay->runAction(CCSequence::create( CCDelayTime::create(0.05f*i), CCSpawn::createWithTwoActions( CCMoveBy::create(0.2f, ccp(600, 0)), CCSequence::create( CCDelayTime::create(0.05f), CCShow::create(), CCFadeIn::create(0.1f), nullptr ) ), nullptr )); } } }
void CStrengthenItem::onSetFilter(const TMessage& tMsg) { m_itemList.clear(); vector<int> *filt = (vector<int> *)tMsg.lParam; m_filterVec = *filt; for (int i=0; i<m_itemData.itemList.size(); ++i) { CItem *item =(CItem*)(&m_itemData.itemList.at(i)); bool isAdd = false; for (int j = 0; j < filt->size(); j++) { if (item->armor.armorType == filt->at(j)) { if (tMsg.nMsg == 2) { isAdd = true; } else if (tMsg.nMsg == 0&&tMsg.nMsg==item->armor.hero) { isAdd = true; } else if (tMsg.nMsg == 1&& item->armor.hero>0) { isAdd = true; } else { isAdd = false; } break; } } if (isAdd) { m_itemList.push_back(&m_itemData.itemList.at(i)); } } //排序 std::sort(m_itemList.begin(), m_itemList.end(), SortItem); m_tableView->setCountOfCell(m_itemList.size()); m_tableView->reloadData(); CLayout *attribute = (CLayout*)(m_ui->findWidgetById("attr")); attribute->setVisible(false); if (m_itemList.size()>0) { CTableViewCell *cell = (CTableViewCell*)m_tableView->getCells()->objectAtIndex(0); onTouchItem(cell->getChildByTag(1)); } }
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 CHeroEvolveEffectLayer::updateData( ) { //面板数据 int iValue[][2] = { {m_pBaseHero->combat, m_pAimHero->combat}, {m_pBaseHero->hp, m_pAimHero->hp}, {m_pBaseHero->atk, m_pAimHero->atk}, {m_pBaseHero->def, m_pAimHero->def}, {m_pBaseHero->dex, m_pAimHero->dex}, {m_pBaseHero->hit, m_pAimHero->hit}, {m_pBaseHero->crit, m_pAimHero->crit}, {m_pBaseHero->dodge, m_pAimHero->dodge}, {m_pBaseHero->renew, m_pAimHero->renew} }; //更新数据 for(int i=0; i<9; i++) { CLayout *pLay = (CLayout *)m_pUI->findWidgetById(CCString::createWithFormat("data%d", i+1)->getCString()); pLay->setVisible(false); CLabel *pBaseValue = (CLabel *)pLay->findWidgetById(CCString::createWithFormat("base_value%d", i+1)->getCString()); pBaseValue->setString(ToString(iValue[i][0])); CLabel *pAimValue = (CLabel *)pLay->findWidgetById(CCString::createWithFormat("aim_value%d", i+1)->getCString()); pAimValue->setString(ToString(iValue[i][1])); } }