当前位置: 首页>>代码示例>>C++>>正文


C++ ImageView::getChildByName方法代码示例

本文整理汇总了C++中ImageView::getChildByName方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getChildByName方法的具体用法?C++ ImageView::getChildByName怎么用?C++ ImageView::getChildByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageView的用法示例。


在下文中一共展示了ImageView::getChildByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initRoomItemCallback

void GameHallLayer::initRoomItemCallback(Widget* widget, MyRoomList room)
{
    ImageView* img = static_cast<ImageView*>(UIHelper::seekWidgetByName(widget, "Image_back"));
    ImageView* enter = static_cast<ImageView*>(img->getChildByName("Image_enter"));
    Label*  lblWord = static_cast<Label*>(enter->getChildByName("Label_word"));
    Widget* panelFree = UIHelper::seekWidgetByName(widget, "Image_free_back");
    
    string room_back;
    string word;
    int level = DataManager::sharedDataManager()->currLevel;
    unsigned long long gold = DataManager::sharedDataManager()->currGold;
    
    if (level >= room.roomLevelLimt && gold >= room.roomGoldLimt)
    {
        word = "进入";
        room_back = CCString::createWithFormat("room%d.png",room.roomid)->getCString();
        
        //显示免费转动次数
        if (1 == room.roomid && DataManager::sharedDataManager()->currFreeNum > 0)
        {
            ImageView* freeIcon = static_cast<ImageView*>(UIHelper::seekWidgetByName(panelFree, "Image_free"));
            Label* freeNum = static_cast<Label*>(UIHelper::seekWidgetByName(panelFree, "Label_freeNum"));
            
            panelFree->setVisible(true);
            freeIcon->loadTexture(CCString::createWithFormat("free%d.png",room.roomid)->getCString(),UI_TEX_TYPE_PLIST);
            freeNum->setText(CCString::createWithFormat("x%d",DataManager::sharedDataManager()->currFreeNum)->getCString());
        }
    }
    else
    {
        if (level < room.roomLevelLimt)
            word = CCString::createWithFormat("%d级" , room.roomLevelLimt)->getCString();
        else
            word = CCString::createWithFormat("%lld万", room.roomGoldLimt / 10000)->getCString();
        
        room_back = CCString::createWithFormat("room%d_grey.png",room.roomid)->getCString();
    }
    
    string room_btn = CCString::createWithFormat("button_room%d.png",room.roomid)->getCString();
    enter->loadTexture(room_btn.c_str(),UI_TEX_TYPE_PLIST);
    img->loadTexture(room_back.c_str(),UI_TEX_TYPE_PLIST);
    lblWord->setText(word);
}
开发者ID:mrktj,项目名称:SlotGame,代码行数:43,代码来源:GameHallLayer.cpp


注:本文中的ImageView::getChildByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。