void CMainWindow::onCommand (xl::uint id, xl::ui::CControlPtr /*ctrl*/) { switch (id) { case ID_NAV_NEXT: cmdNext(); break; case ID_NAV_PREV: cmdPrev(); break; case ID_NAV_ZOOMIN: case ID_NAV_ZOOMOUT: case ID_NAV_SWITCH: { CImageView *pView = (CImageView *)m_view.get(); assert(pView); if (id == ID_NAV_ZOOMIN) { pView->showLarger(CPoint(-1, -1)); } else if (id == ID_NAV_ZOOMOUT) { pView->showSmaller(CPoint(-1, -1)); } else { pView->showSwitch(CPoint(-1, -1)); } } break; case ID_SETTING: // launchAssociation(); { m_toolbar->setOpacity(0); CSettingDialog dlg(&m_gestureMap); dlg.DoModal(m_hWnd); } break; default: break; } }
void CHandBookHeroLayer::initCellIconByData( AData *pAData, CLayout *pCell ) { //message AData{ // optional int32 type = 1; //类型 1英雄,2装备,3怪物 // optional int32 thumb = 2; // optional int32 color = 3; //边框颜色 // optional int32 process = 4; //英雄、装备代表进阶数,怪物代表击杀数 // optional int32 max_process = 5; // optional int32 param = 6; //} Prize *prize = new Prize; //获取数据 int iType = 1; if ( pAData->type()==1 || pAData->type()==3 ) { iType = 2; } int iColor = pAData->color(); int iIconId = pAData->thumb(); int iRank = pAData->process(); string str = GetImageName(iType, iColor, iIconId); //图标 CImageView* pBgRect = (CImageView *)pCell->findWidgetById("headBg"); CImageView *itemSpr = CImageView::create(str.c_str()); if (!itemSpr) { itemSpr = CImageView::create("prop/32003.png"); CCLOG("[ ERROR ] CPopItem::addTableCell Lost Image = %d"); } pBgRect->addChild(itemSpr); NodeFillParent(itemSpr); //品质+事件 CImageView *mask= (CImageView *)pCell->findWidgetById("head"); mask->setTexture(setItemQualityTexture(iColor)); mask->setUserData(pAData); mask->setTag(iType); mask->setTouchEnabled(true); mask->setOnClickListener(this, ccw_click_selector(CHandBookHeroLayer::onShowRankUp)); //进阶 for ( int i=0; i<5; i++) { CImageView *pStar = (CImageView *)pCell->getChildByTag(i+3); //阶级到,点亮 if (i<iRank) { pStar->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault)); } else { pStar->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); } } }
/** * @brief Set image view mode. * @param hwnd - parent window handle. */ static void SetImageView(HWND hwnd) { _ASSERTE(g_hBitmap != INVALID_HANDLE_VALUE); g_eFileViewType = FVT_IMAGEVIEW; HWND hwndFileView = GetDlgItem(hwnd, IDC_FILEVIEW); g_ImageView.Attach(hwndFileView); g_ImageView.SetImage(g_hBitmap); }
void CSharpTollgate::addTableCell(unsigned int uIdx, CTableViewCell * pCell) { const vector<StageWidget> *data = DataCenter::sharedData()->getStageData() ->getStageWidgets(m_chapter); CStage &stage = m_stageList.at(uIdx); for (int i = 0; i < 2; i++) { CCNode * node = (CCNode*)m_cell->getChildren()->objectAtIndex(i); if (node->getTag()==1) { const StageWidget *widget = nullptr; CCString *strId = CCString::createWithFormat("hero%d",uIdx+1); for (int j=0; j<data->size();++j) { widget = &data->at(j); if (widget->widgetId!=""&&widget->widgetId.compare(strId->getCString())==0) { CButton *btn = CButton::create(widget->normalImage.c_str()); btn->setScaleX(widget->scaleX); btn->setScaleY(widget->scaleY); btn->setPosition(ccp(100, 80/*btn->boundingBox().size.height*/)); btn->setAnchorPoint(ccp(0.5, 0.0)); btn->setUserData(&m_stageList.at(uIdx)); btn->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onBattle)); btn->setTag(1); pCell->addChild(btn); if (!stage.isOpen) { btn->getNormalImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); // btn->getSelectedImage()->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); } break; } } } else if (node->getTag()==2) { CImageView *image = UICloneMgr::cloneImageView((CImageView*)node); if (stage.star>0) { image->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/star_%d.png",stage.star)->getCString())); } else { image->setTexture(CCTextureCache::sharedTextureCache()->addImage("tollgate/star_3.png")); image->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); } image->setAnchorPoint(ccp(0.5f,0)); pCell->addChild(image); } } pCell->setVisible(false); pCell->setScale(1.15f); pCell->runAction(CCSequence::create(CCDelayTime::create(0.1f+0.15f*uIdx),CCShow::create(),CCScaleTo::create(0.05f,1.0f),CCCallFuncN::create(this,callfuncN_selector(CSharpTollgate::heroCall)),nullptr)); }
void CSignLayer::callBackForTotalSignUiUpdate() { CImageView* pSprite = (CImageView*)m_ui->findWidgetById("mask_copy"); pSprite->removeFromParentAndCleanup(true); //更新阶段签到情况 updateTotoalSign(); //加黄标提示 showTipsOnNextTotalSign(); }
void CChangeHeadImg::onChangHeadImg(CCObject* pSender) { PlayEffectSound(SFX_Button); CImageView *head = (CImageView *)pSender; int *icon = (int*)head->getUserData(); CPlayerControl::getInstance().sendChangeHeadImg(*icon); LayerManager::instance()->pop(); LayerManager::instance()->pop(); }
CImageView* CImageView::createWithTexture(CCTexture2D *pTexture, const CCRect& rect) { CImageView *pobSprite = new CImageView(); if (pobSprite && pobSprite->initWithTexture(pTexture, rect)) { pobSprite->autorelease(); return pobSprite; } CC_SAFE_DELETE(pobSprite); return NULL; }
CImageView* CImageView::create() { CImageView *pSprite = new CImageView(); if (pSprite && pSprite->init()) { pSprite->autorelease(); return pSprite; } CC_SAFE_DELETE(pSprite); return NULL; }
CImageView* CImageView::create(const char *pszFileName) { CImageView *pobSprite = new CImageView(); if (pobSprite && pobSprite->initWithFile(pszFileName)) { pobSprite->autorelease(); return pobSprite; } CC_SAFE_DELETE(pobSprite); return NULL; }
CImageView* CImageView::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame) { CImageView *pobSprite = new CImageView(); if (pSpriteFrame && pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame)) { pobSprite->autorelease(); return pobSprite; } CC_SAFE_DELETE(pobSprite); return NULL; }
CImageView* CImageView::create(const char *pszFileName, const CCRect& rect) { CImageView *pobSprite = new CImageView(); if (pobSprite && pobSprite->initWithFile(pszFileName, rect)) { pobSprite->setTouchEnabled(false); pobSprite->autorelease(); return pobSprite; } CC_SAFE_DELETE(pobSprite); return NULL; }
CImageView* CImageView::createWithTexture(CCTexture2D *pTexture) { CImageView *pobSprite = new CImageView(); if (pobSprite && pobSprite->initWithTexture(pTexture)) { pobSprite->setTouchEnabled(false); pobSprite->autorelease(); return pobSprite; } CC_SAFE_DELETE(pobSprite); return NULL; }
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 CTopLayer::onEnter() { BaseLayer::onEnter(); this->setTouchPriority(-100); UserData *user = DataCenter::sharedData()->getUser()->getUserData(); m_coinLabel = (CLabel*)m_ui->getChildByTag(13); m_coinLabel->setString(ToString(user->getCoin())); m_moneyLabel = (CLabel*)m_ui->getChildByTag(14); m_moneyLabel->setString(ToString(user->getRoleGold())); // m_foodLabel = (CLabel*)m_ui->getChildByTag(17); //m_foodLabel->setString(ToString(user->getRoleFood())); m_foodLabel->setString(ToString(user->getFriends())); CLabel *action = (CLabel*)(m_ui->findWidgetById("action")); action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(),user->getActionLimit())->getCString()); CButton* add_food = (CButton*)m_ui->findWidgetById("btn_add_food"); CButton* add_copper = (CButton*)m_ui->findWidgetById("btn_add_copper"); CButton* add_soul = (CButton*)m_ui->findWidgetById("btn_add_soul"); CButton* add_gold = (CButton*)m_ui->findWidgetById("btn_add_gold"); CButton* add_friendship = (CButton*)m_ui->findWidgetById("btn_add_friendship"); add_food->getSelectedImage()->setScale(1.1f); add_copper->getSelectedImage()->setScale(1.1f); add_soul->getSelectedImage()->setScale(1.1f); add_gold->getSelectedImage()->setScale(1.1f); add_friendship->getSelectedImage()->setScale(1.1f); add_food->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn)); add_copper->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn)); add_soul->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn)); add_gold->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn)); add_friendship->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CTopLayer::updateRoleProperty)); //绑定场景隐藏和显示的消息 NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::show), SHOW_TOP_LAYER, nullptr); NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::hide), HIDE_TOP_LAYER, nullptr); CImageView *coin = (CImageView*)(m_ui->findWidgetById("coin")); CCAnimation *coinAnim = AnimationManager::sharedAction()->getAnimation("7033"); coinAnim->setDelayPerUnit(0.3f); coin->runAction(CCRepeatForever::create(CCAnimate::create(coinAnim))); CImageView *gold = (CImageView*)(m_ui->findWidgetById("gold")); CCAnimation *goldAnim = AnimationManager::sharedAction()->getAnimation("7034"); goldAnim->setDelayPerUnit(0.3f); gold->runAction(CCRepeatForever::create(CCAnimate::create(goldAnim))); }
bool GetDCImage( CImage32* dest, HDC dc, int width, int height ) { dest->Resize( width, height ); CImageView* tmp = new CImageView( dest->Width(), dest->Height() ); BitBlt( tmp->hDC(), 0,0, width,height, dc, 0,0, SRCCOPY ); dest->Blt( 0,0, tmp ); dest->Filter( FLT_OR, Bpp32(0xFF000000) ); delete tmp; return TRUE; }
CImageViewScale9 *TuiManager::createImage9(float tag,const char* file,float x,float y,float w,float h,float up,float down,float left, float right,float rotation){ CImageViewScale9* pSprite = NULL; if(m_isUseSpriteFrame){ pSprite = CImageViewScale9::createWithSpriteFrameName(file,Rect(up,down,left,right)); }else{ CImageView *temp = CImageView::create(file); Size size = temp->getContentSize(); pSprite = CImageViewScale9::create(file, Rect(0,0,size.width,size.height),Rect(up,down,left,right)); } pSprite->setContentSize(Size(w,h)); pSprite->setPosition(Point(x,-y)); pSprite->setRotation(rotation); pSprite->setTag(tag); return pSprite; }
void CChangeHeadImg::addGridCell(unsigned int uIdx, CGridViewCell* pCell) { CLayout *lay = UICloneMgr::cloneLayout(m_cell); for (int i=1; i<=2; i++) { CCNode *child = lay->getChildByTag(i); lay->removeChild(child); pCell->addChild(child); if (i==1) { if (m_headIconList.at(uIdx)>0) { CImageView* pHead = CImageView::create(CCString::createWithFormat("headImg/%d.png", m_headIconList.at(uIdx))->getCString()); if(!pHead) { pHead = CImageView::create("headImg/null.png"); CCLOG("ERROR_____CChangeHeadImg::addGridCell"); } child->addChild(pHead); NodeFillParent(pHead); } else { UserData *data = DataCenter::sharedData()->getUser()->getUserData(); string fbName = data->getFbId() +".jpg"; string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str()); bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName); if(isFileExist) { CCSprite* spr =CCSprite::create(fullName.c_str()); child->addChild(spr); NodeFillParent(spr); } } } else if(i==2) { CImageView* pBtn = (CImageView*)child; pBtn->setTouchEnabled(true); pBtn->setUserData(&m_headIconList.at(uIdx)); pBtn->setOnClickListener(this,ccw_click_selector(CChangeHeadImg::onChangHeadImg)); } } }
void LoginLayerUC::selectServer( CCObject* pObj ) { PlayEffectSound(SFX_Button); CImageView* pImageView = (CImageView*)pObj; if(m_iSelectServerIndex != pImageView->getParent()->getTag()) { m_iSelectServerIndex = pImageView->getParent()->getTag(); CNetClient *tcp = CNetClient::getShareInstance(); if (tcp->isConnected()) { tcp->close(); } } updateSelectServer(); hideServerList(); }
CImageView *TuiManager::createImage(float tag, const char* file, float scaleX, float scaleY, int flipX, int flipY, float x, float y, float rotation, int isUseFrame){ CImageView *pImg = isUseFrame ? CImageView::createWithSpriteFrameName(file) : CImageView::create(file); Size size = pImg->getContentSize(); pImg->setPosition(Vec2(x,-y)); pImg->setFlippedX(flipX == 1); pImg->setFlippedY(flipY == 1); pImg->setScale(scaleX, scaleY); pImg->setRotation(rotation); pImg->setTag(tag); return pImg; }
void CSignLayer::updateTotoalSign() { //更新 //已领取的,宝箱变灰,加对勾 //未领取的,宝箱变亮, //将要领取的,加黄色标题突出 for (int i = 0; i < m_signData.totalList.size()&&i<4; i++) { CSign &sign = m_signData.totalList.at(i); //宝箱 CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString()); mask->setVisible(true); //mask->setTexture(CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("sign/box_%d.png", i+1)->getCString())); mask->setUserData(&sign); mask->setTouchEnabled(true); mask->setOnPressListener(this, ccw_press_selector(CSignLayer::onPress)); //天数 CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString())); day->setString(CCString::createWithFormat(GETLANGSTR(209),sign.day)->getCString()); //获得字样 CImageView *getspr = (CImageView*)(m_ui->findWidgetById(CCString::createWithFormat("get%d",i+1)->getCString())); //已领取 if (sign.status==1) { //宝箱变灰 mask->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); //加对勾 getspr->setVisible(true); } //未领取 else if(sign.status==2) { //宝箱变灰 mask->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault)); //加对勾 getspr->setVisible(false); } } }
void CSignLayer::showTipsOnNextTotalSign() { m_pYellowTip->setVisible(false); //遍历阶段签到 for (int i = 0; i < m_signData.totalList.size()&&i<4; i++) { CSign &sign = m_signData.totalList.at(i); //未领取 if(sign.status==2) { if(sign.day>m_signData.sign) { //当前底加高亮 CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString()); //pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone)); pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_02.png")); //pBg->setScale(0.85f); //拿到当前宝箱 CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString()); //隐藏自己的日期 CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString())); day->setVisible(false); //加黄标提示 m_pYellowTip->setVisible(true); m_pYellowTip->setPosition(ccp(mask->getPositionX()+mask->getContentSize().width/2, mask->getPositionY()+mask->getContentSize().height-60)); m_pYellowTipText->setString(day->getString()); break; } } else { //当前底加高亮 CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString()); //pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault)); pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_01.png")); //pBg->setScale(1.0f); //天数 CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString())); day->setVisible(true); } } }
void CSharpTollgate::setStageList(const vector<CStage>& stageList, int chapter, int openChapter) { m_stageList = stageList; m_chapter = chapter; m_openChapter = openChapter; m_tableView->setCountOfCell(stageList.size()); m_tableView->reloadData(); CTableViewCell *cell = m_tableView->cellAtIndex(3); cell->setPositionX(cell->getPositionX()+115); CImageView *name = (CImageView*)(m_ui->findWidgetById("name")); CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(CCString::createWithFormat("tollgate/chapter_%d.png",chapter)->getCString()); if(!texture) { texture = CCTextureCache::sharedTextureCache()->addImage("tollgate/chapter_1.png"); } name->setTexture(texture); name->setTextureRect(CCRectMake(0,0,texture->getContentSize().width,texture->getContentSize().height)); }
void LoginLayerUC::addTableCell( unsigned int uIdx, CTableViewCell * pCell ) { CLayout *lay = UICloneMgr::cloneLayout(m_pCell); const Server& server = m_serverInfo.server_list().Get(uIdx); for (unsigned int i=1; i<=4; i++) { CCNode *child = lay->getChildByTag(i); lay->removeChild(child); child->setTag(i); pCell->addChild(child); pCell->setTag(uIdx); switch (i) { case 1: { CImageView* pBoard = (CImageView*)child; pBoard->setTouchEnabled(true); pBoard->setOnClickListener(this, ccw_click_selector(LoginLayerUC::selectServer)); } break; case 3: { CLabel* pLabel = (CLabel*)child; pLabel->setString(server.server_name().c_str()); } break; case 4: { CLabel* pLabel = (CLabel*)child; int iShowText[5] = {2002, 1184, 1185, 1186, 1187}; pLabel->setString(GETLANGSTR(iShowText[server.server_status()])); } break; default: break; } } }
bool LoginLayerUC::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { if(!m_ui)return false; CCPoint pos = convertToNodeSpace(pTouch->getLocation()); if(m_pTableView->isVisible()) { return false; } //按钮 CImageView* pBtnServer = (CImageView*)m_ui->findWidgetById("serverBtn"); if(pBtnServer->boundingBox().containsPoint(pos) && m_pTableView->getCountOfCell()>1) { showServerList(); return true; } return false; }
bool LoadResource( CImage32* dest, HINSTANCE hInstance, WORD resnum ) { #ifdef __NEET_API_WIN32__ HBITMAP tmpImage = (HBITMAP)::LoadImage( hInstance, MAKEINTRESOURCE(resnum),IMAGE_BITMAP, dest->Width(),dest->Height(), LR_CREATEDIBSECTION ); #else HBITMAP tmpImage = (HBITMAP)::LoadImage( hInstance, MAKEINTRESOURCE(resnum),IMAGE_BITMAP, 0,0, 0 ); #endif if (tmpImage == NULL) return false; CImageView* tmp = new CImageView( dest->Width(), dest->Height() ); HDC hMemDC = CreateCompatibleDC( tmp->hDC() ); SelectObject( hMemDC, tmpImage); BitBlt( tmp->hDC(), 0,0, dest->Width(),dest->Height(), hMemDC, 0,0, SRCCOPY ); // 転送 dest->Blt( 0,0, tmp ); delete tmp; DeleteDC(hMemDC); DeleteObject(tmpImage); // BMP解放 return true; }
CImageView *TuiManager::createImage(float tag, const char* file, float scaleX, float scaleY,float x, float y, float rotation){ CImageView *pImg = m_isUseSpriteFrame ? CImageView::createWithSpriteFrameName(file) : CImageView::create(file); Size size = pImg->getContentSize(); pImg->setPosition(Point(x,-y)); pImg->setScale(scaleX, scaleY); pImg->setRotation(rotation); pImg->setTag(tag); return pImg; }
/** * @brief WM_COMMAND handler of Preview dialog. * @param hwnd - window handle. * @param id - control ID. * @param hwndCtl - control handle. * @param codeNotify - notification code. */ static void PreviewDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { codeNotify; hwndCtl; switch (id) { case IDC_TEXTVIEW: if (g_eFileViewType == FVT_HEXVIEW) { g_HexView.Detach(); SetTextView(hwnd); } break; case IDC_HEXVIEW: if (g_eFileViewType == FVT_TEXTVIEW) { g_TextView.Detach(); SetHexView(hwnd); } break; case IDC_FITIMAGE: g_ImageView.FitImage(); break; case IDC_RESETSIZE: g_ImageView.ResetSize(); break; case IDC_ZOOMIN: g_ImageView.ZoomIn(); break; case IDC_ZOOMOUT: g_ImageView.ZoomOut(); break; case IDOK: case IDCANCEL: EndDialog(hwnd, FALSE); break; } }
void CSmeltArmor::onEnter() { BaseLayer::onEnter(); //四个选择框 for (unsigned int i=0; i<4; ++i) { CCheckBox *checkBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check")); checkBtn->setOnCheckListener(this,ccw_check_selector(CSmeltArmor::onCheckAttr)); } //选择武器 CButton *select = (CButton*)(m_ui->findWidgetById("select")); select->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onSelectItem)); //洗练 CButton *refine = (CButton*)(m_ui->findWidgetById("refine")); refine->setOnClickListener(this, ccw_click_selector(CSmeltArmor::onRefineItem)); //初始化火 initFire(); //旋转圈 CImageView *circleFire = (CImageView*)(m_ui->findWidgetById("fire_circle")); circleFire->setScale(1.95f); circleFire->runAction(CCRepeatForever::create(CCRotateBy::create(1.0f, 60))); circleFire->runAction(CCRepeatForever::create(CCSequence::createWithTwoActions(CCScaleTo::create(1.2f, 2.1f), CCScaleTo::create(1.2f, 1.95f)))); GetTcpNet->registerMsgHandler(SmeltArmorMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage)); GetTcpNet->registerMsgHandler(SmeltDataRequestMsg,this,CMsgHandler_selector(CSmeltArmor::proceesMessage)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO, this, GameMsghandler_selector(CSmeltArmor::roleUpdate)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_ITEM_DATA, this, GameMsghandler_selector(CSmeltArmor::updateStar)); }
/** * @brief Close previous file view. * @param hwnd - parent window handle. */ static void CloseFileView(HWND hwnd) { switch (g_eFileViewType) { case FVT_TEXTVIEW: ShowFileFormatOptions(hwnd, FALSE); g_TextView.Detach(); break; case FVT_HEXVIEW: ShowFileFormatOptions(hwnd, FALSE); g_HexView.Detach(); break; case FVT_IMAGEVIEW: ShowImageCommands(hwnd, FALSE); g_ImageView.Detach(); break; } g_eFileViewType = FVT_NONE; }
void CSignLayer::callBackForTotalSignEffectOneFrameLater() { //隐藏黄标 m_pYellowTip->setVisible(false); //触摸屏蔽 MaskLayer* pLayer1 = MaskLayer::create("CSignLayer::callBackForTotalSignEffect1"); pLayer1->setOpacity(0); LayerManager::instance()->push(pLayer1); MaskLayer* lay = MaskLayer::create("CSignLayer::callBackForTotalSignEffect2"); lay->setContentSize(CCSizeMake(1138,640)); lay->setAnchorPoint(ccp(0.5f, 0.5f)); lay->setPosition(VCENTER); lay->setOpacity(0); LayerManager::instance()->push(lay); //开宝箱 int iIndexTotal = checkTotalBox(); if(iIndexTotal==-1) { //触摸释放 LayerManager::instance()->pop(); LayerManager::instance()->pop(); return; } int iTag = 9065+iIndexTotal; CCString* pStr = CCString::createWithFormat("%d", iTag); CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(CCString::createWithFormat("skill/%s.plist", pStr->getCString())->getCString()); AnimationManager::sharedAction()->ParseAnimation(pStr->getCString()); CCAnimation *culAnim = AnimationManager::sharedAction()->getAnimation(pStr->getCString()); culAnim->setDelayPerUnit(0.15f); CCAnimate* pAnimate = CCAnimate::create(culAnim); CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",iIndexTotal+1)->getCString()); mask->setVisible(false); CImageView* pSprite = UICloneMgr::cloneImageView(mask); pSprite->setVisible(true); pSprite->setId("mask_copy"); pSprite->runAction(CCSequence::create( pAnimate, CCCallFunc::create(this, callfunc_selector(CSignLayer::callBackForTotalSignEffectEnd)), nullptr )); mask->getParent()->addChild(pSprite); }