Esempio n. 1
0
    UILayout*  UICreator::CreateUILayoutFromFile(const char* file, cocos2d::CCNode *pParent,
                                                     bool bShow )
    {
        // Load plist layout file
        UILayout* pLayer = NULL;    
        NiStream * pkStream = new NiStream();
        pLayer = (UILayout*)(pkStream->CreateControlFromFile(file, pParent));     
        delete pkStream;

		if(NULL == pLayer)
		{
			return NULL;
		}

		// update containers reference object
		std::list<UIControlBase*> childContainers = pLayer->getAllChildEndsWithName("Container");
		for(std::list<UIControlBase*>::iterator it = childContainers.begin();
			it != childContainers.end(); it++)
		{
			if(dynamic_cast<UIContainer*>(*it) != NULL)
			{
				UIContainer *tmp = static_cast<UIContainer*>(*it);

				if(tmp->getRefMode() == OBJECT_REFERENCE)
				{
					std::string refObjName = tmp->getRefObjName();
					UIControlBase *refObj = pLayer->FindChildObjectByName(refObjName);
					if(refObj != NULL && dynamic_cast<UIContainer*>(refObj) != NULL)
					{
						tmp->setRefObj(static_cast<UIContainer*>(refObj));
					}
				}
			}
		}

		// update scroll pages
		std::list<UIControlBase*> childScrollPages = pLayer->getAllChildEndsWithName("ScrollPage");
		for(std::list<UIControlBase*>::iterator it = childScrollPages.begin();
			it != childScrollPages.end(); it++)
		{
			if(dynamic_cast<UIScrollPage*>(*it) != NULL)
			{
				UIScrollPage *tmp = static_cast<UIScrollPage*>(*it);
				tmp->addPagesByChildren();
			}
		}

		float scaleFactor = UIManager::sharedManager()->getScaleFactor();
		//float scaleFactorX = UIManager::sharedManager()->getScaleFactorX();
		//float scaleFactorY = UIManager::sharedManager()->getScaleFactorY();
		pLayer->setScale(scaleFactor);
		//pLayer->setScale(scaleFactorX, scaleFactorY);

        return pLayer;
    }
Esempio n. 2
0
UIWidget* UI::WrapWidget(tb::TBWidget* widget)
{
    if (!widget)
        return NULL;

    if (widgetWrap_.Contains(widget))
        return widgetWrap_[widget];

    // switch this to use a factory?

    // this is order dependent as we're using IsOfType which also works if a base class

    if (widget->IsOfType<TBPopupWindow>())
    {
        UIPopupWindow* popupWindow = new UIPopupWindow(context_, false);
        popupWindow->SetWidget(widget);
        widgetWrap_[widget] = popupWindow;
        return popupWindow;
    }

    if (widget->IsOfType<TBDimmer>())
    {
        UIDimmer* dimmer = new UIDimmer(context_, false);
        dimmer->SetWidget(widget);
        widgetWrap_[widget] = dimmer;
        return dimmer;
    }

    if (widget->IsOfType<TBScrollContainer>())
    {
        UIScrollContainer* container = new UIScrollContainer(context_, false);
        container->SetWidget(widget);
        widgetWrap_[widget] = container;
        return container;
    }

    if (widget->IsOfType<TBInlineSelect>())
    {
        UIInlineSelect* select = new UIInlineSelect(context_, false);
        select->SetWidget(widget);
        widgetWrap_[widget] = select;
        return select;
    }

    if (widget->IsOfType<TBSection>())
    {
        UISection* section = new UISection(context_, false);
        section->SetWidget(widget);
        widgetWrap_[widget] = section;
        return section;
    }

    if (widget->IsOfType<TBSeparator>())
    {
        UISeparator* sep = new UISeparator(context_, false);
        sep->SetWidget(widget);
        widgetWrap_[widget] = sep;
        return sep;
    }

    if (widget->IsOfType<TBContainer>())
    {
        UIContainer* container = new UIContainer(context_, false);
        container->SetWidget(widget);
        widgetWrap_[widget] = container;
        return container;
    }

    if (widget->IsOfType<TBSelectDropdown>())
    {
        UISelectDropdown* select = new UISelectDropdown(context_, false);
        select->SetWidget(widget);
        widgetWrap_[widget] = select;
        return select;
    }

    if (widget->IsOfType<TBButton>())
    {
        // don't wrap the close button of a TBWindow.close
        if (widget->GetID() == TBIDC("TBWindow.close"))
            return 0;

        UIButton* button = new UIButton(context_, false);
        button->SetWidget(widget);
        widgetWrap_[widget] = button;
        return button;
    }

    if (widget->IsOfType<TBTextField>())
    {
        UITextField* textfield = new UITextField(context_, false);
        textfield->SetWidget(widget);
        widgetWrap_[widget] = textfield;
        return textfield;
    }

    if (widget->IsOfType<TBEditField>())
    {
        UIEditField* editfield = new UIEditField(context_, false);
        editfield->SetWidget(widget);
        widgetWrap_[widget] = editfield;
        return editfield;
    }

    if (widget->IsOfType<TBSkinImage>())
    {
        UISkinImage* skinimage = new UISkinImage(context_, "", false);
        skinimage->SetWidget(widget);
        widgetWrap_[widget] = skinimage;
        return skinimage;
    }

    if (widget->IsOfType<TBImageWidget>())
    {
        UIImageWidget* imagewidget = new UIImageWidget(context_, false);
        imagewidget->SetWidget(widget);
        widgetWrap_[widget] = imagewidget;
        return imagewidget;
    }
    if (widget->IsOfType<TBClickLabel>())
    {
        UIClickLabel* nwidget = new UIClickLabel(context_, false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }

    if (widget->IsOfType<TBCheckBox>())
    {
        UICheckBox* nwidget = new UICheckBox(context_, false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }

    if (widget->IsOfType<TBSelectList>())
    {
        UISelectList* nwidget = new UISelectList(context_, false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }

    if (widget->IsOfType<TBMessageWindow>())
    {
        UIMessageWindow* nwidget = new UIMessageWindow(context_, NULL, "", false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }

    if (widget->IsOfType<TBTabContainer>())
    {
        UITabContainer* nwidget = new UITabContainer(context_, false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }

    if (widget->IsOfType<SceneViewWidget>())
    {
        UISceneView* nwidget = new UISceneView(context_, false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }


    if (widget->IsOfType<TBLayout>())
    {
        UILayout* layout = new UILayout(context_, (UI_AXIS) widget->GetAxis(), false);
        layout->SetWidget(widget);
        widgetWrap_[widget] = layout;
        return layout;
    }

    if (widget->IsOfType<TBWidget>())
    {
        UIWidget* nwidget = new UIWidget(context_, false);
        nwidget->SetWidget(widget);
        widgetWrap_[widget] = nwidget;
        return nwidget;
    }


    return 0;
}
Esempio n. 3
0
void PvAIManager::refreshPvAILayer()
{
    UIManager *manager = UIManager::sharedManager();
    pvaiLayout = manager->getUILayout("PvAILayout");

    if (pvaiLayout)
    {
        //玩家昵称
        UILabel *heroNameLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcName");
        if (heroNameLabel)
        {
            string heroName = UserData::getUserName();
            heroNameLabel->setString(heroName.c_str());
        }

        //玩家排名
        UILabel *heroRankLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcRank");
        if (heroRankLabel)
        {
            stringstream heroRankStream;
            heroRankStream << heroRank;
            string heroRankStr = heroRankStream.str();
            string heroRankText = Localizatioin::getLocalization("M_PVAI_RANK");

            heroRankText += heroRankStr;
            heroRankLabel->setString(heroRankText.c_str());
        }

        //玩家声望
        UILabel *heroReputationLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcReputation");
        if (heroReputationLabel)
        {
            int heroReputation = UserData::GetUserInfo().m_reputation;

            stringstream heroReputationStream;
            heroReputationStream << heroReputation;
            string heroReputationStr = heroReputationStream.str();
            string heroReputationText = Localizatioin::getLocalization("M_PVAI_REPUTATION");

            heroReputationText += heroReputationStr;
            heroReputationLabel->setString(heroReputationText.c_str());
        }

        ////剩余挑战次数
        //UILabel *lastTimeLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiTodayLastTime");
        //if (lastTimeLabel)
        //{
        //	stringstream herolastTimeStream;
        //	herolastTimeStream << basicInfo.remainCount;
        //	string herolastTimeStr = herolastTimeStream.str();
        //	lastTimeLabel->setString(herolastTimeStr.c_str());
        //}

        ////奖励金币数
        //UILabel *rewardCoinLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiRewardCoin");
        //if (rewardCoinLabel)
        //{
        //	stringstream herolastTimeStream;
        //	herolastTimeStream << basicInfo.rewardCoin;
        //	string herolastTimeStr = herolastTimeStream.str();
        //	rewardCoinLabel->setString(herolastTimeStr.c_str());
        //}

        ////奖励声望
        //UILabel *rewardReputationLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiRewardReputation");
        //if (rewardReputationLabel)
        //{
        //	stringstream herolastTimeStream;
        //	herolastTimeStream << basicInfo.rewardReputation;
        //	string herolastTimeStr = herolastTimeStream.str();
        //	rewardReputationLabel->setString(herolastTimeStr.c_str());
        //}

        ////奖励领取时间
        //TimeManager::Get()->renewTimer(TIMER_PVAI_REWARD, TimeManager::Get()->getCurServerTime() + basicInfo.rewardGetTime);

        ////冷却时间
        //TimeManager::Get()->renewTimer(TIMER_PVAI_COOLDOWN, TimeManager::Get()->getCurServerTime() + basicInfo.coolDownTime);

        //挑战玩家列表
        int playerCount = aiPlayerVec.size();
        int minPlayerCount = min(playerCount, 5);
        for (int i = minPlayerCount; i < 5; i++)
        {
            stringstream iconOtherStream;
            iconOtherStream << "iconOther" << i+1;
            string iconOtherStr = iconOtherStream.str();
            UIPicture *iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr);
            iconOtherPic->setVisible(false);

            iconOtherStream.str("");
            iconOtherStream << "gridOther" << i+1;
            iconOtherStr = iconOtherStream.str();
            iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr);
            iconOtherPic->setVisible(false);

            iconOtherStream.str("");
            iconOtherStream << "pvaiOtherPlayerName" << i+1;
            iconOtherStr = iconOtherStream.str();
            UILabel * iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr);
            iconOtherLabel->setVisible(false);

            iconOtherStream.str("");
            iconOtherStream << "pvaiOtherPlayerLevel" << i+1;
            iconOtherStr = iconOtherStream.str();
            iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr);
            iconOtherLabel->setVisible(false);

            iconOtherStream.str("");
            iconOtherStream << "pvaiOtherPlayerRank" << i+1;
            iconOtherStr = iconOtherStream.str();
            iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr);
            iconOtherLabel->setVisible(false);

            iconOtherStream.str("");
            iconOtherStream << "pvaiFightBtn" << i+1;
            iconOtherStr = iconOtherStream.str();
            UIButton * iconOtherBtn= pvaiLayout->FindChildObjectByName<UIButton>(iconOtherStr);
            iconOtherBtn->setVisible(false);

            iconOtherStream.str("");
            iconOtherStream << "pvaiFightText" << i+1;
            iconOtherStr = iconOtherStream.str();
            iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr);
            iconOtherLabel->setVisible(false);
        }
        for (int i = 0; i < minPlayerCount; i++)
        {
            //头像
            stringstream iconOtherStream;
            iconOtherStream << "iconOther" << i+1;
            string iconOtherStr = iconOtherStream.str();
            UIPicture *iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr);

            int playerType = aiPlayerVec[i].type;
            const char * playerIconName = LuaTinkerManager::Get()->getLuaConfig<const char *>("characterString", "Characters", playerType, "HeadPicture");
            int idx = getResourceIDByName(playerIconName);
            CCPoint pt;
            ASprite *as = AspriteManager::getInstance()->getAsprite(KICON_BIN);
            CCSprite * headPic = as->getSpriteFromFrame_Middle( idx, 0, pt);
            if(headPic)
            {
                iconOtherPic->addExtraPic(headPic);
            }

            //昵称
            stringstream otherPlayerNameStream;
            otherPlayerNameStream << "pvaiOtherPlayerName" << i+1;
            string otherPlayerNameStr = otherPlayerNameStream.str();
            UILabel *otherPlayerNameLabel = pvaiLayout->FindChildObjectByName<UILabel>(otherPlayerNameStr);

            otherPlayerNameLabel->setString(aiPlayerVec[i].name.c_str());

            //等级
            stringstream otherPlayerLevelStream;
            otherPlayerLevelStream << "pvaiOtherPlayerLevel" << i+1;
            string otherPlayerLevelStr = otherPlayerLevelStream.str();
            UILabel *otherPlayerLevelLabel = pvaiLayout->FindChildObjectByName<UILabel>(otherPlayerLevelStr);

            int playerLevel = aiPlayerVec[i].level;
            stringstream levelStream;
            levelStream << "Lv" << playerLevel;
            string levelStr = levelStream.str();

            otherPlayerLevelLabel->setString(levelStr.c_str());

            //排名
            stringstream otherPlayerRankStream;
            otherPlayerRankStream << "pvaiOtherPlayerRank" << i+1;
            string otherPlayerRankStr = otherPlayerRankStream.str();
            UILabel *otherPlayerRankLabel = pvaiLayout->FindChildObjectByName<UILabel>(otherPlayerRankStr);

            int playerRank = aiPlayerVec[i].rank;
            string rankText = Localizatioin::getLocalization("M_PVAI_RANK2");
            stringstream rankStream;
            rankStream << rankText << playerRank;
            string rankStr = rankStream.str();

            otherPlayerRankLabel->setString(rankStr.c_str());
        }

        //最近日志列表
        float fontSize = GameFontManager::smallFontSize();
        int logCount = aiLogInfoVec.size();
        int minLogCount = min(logCount, 4);
        //隐藏多余项目
        for (int i = minLogCount; i < 4; i++)
        {
            stringstream attackTextStream;
            attackTextStream << "pvaiChallenge" << i+1;
            string attackTextStr = attackTextStream.str();
            UILabel *attackOrgLabel = pvaiLayout->FindChildObjectByName<UILabel>(attackTextStr);
            attackOrgLabel->setVisible(false);

            stringstream resultStream;
            resultStream << "pvaiChallengeResult" << i+1;
            string resultStr = resultStream.str();
            UILabel *resultLabel = pvaiLayout->FindChildObjectByName<UILabel>(resultStr);
            resultLabel->setVisible(false);
        }

        for (int i = 0; i < minLogCount; i++)
        {
            float factor = UIManager::sharedManager()->getScaleFactor();
            stringstream attackTextStream;
            attackTextStream << "pvaiChallenge" << i+1;
            string attackTextStr = attackTextStream.str();
            UILabel *attackOrgLabel = pvaiLayout->FindChildObjectByName<UILabel>(attackTextStr);
            UIContainer * container = pvaiLayout->FindChildObjectByName<UIContainer>("pvaiLayerContainer");
            attackOrgLabel->setVisible(false);
            CCPoint orgPos = attackOrgLabel->getPosition();
            CCPoint orgLeftPos = ccp(orgPos.x - attackOrgLabel->getLabelTTF()->getContentSize().width * factor / 2, orgPos.y);

            //挑战方向
            if (aiLogInfoVec[i].direct)
            {
                //主动攻击
                string attackText = Localizatioin::getLocalization("M_PVAI_FIGHT1");
                string attackName = aiLogInfoVec[i].name;
                UILabelTTF * attackTextLabel = UILabelTTF::create(attackText.c_str(), KJLinXin, fontSize * factor, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom);
                UILabelTTF * attackNameLabel = UILabelTTF::create(attackName.c_str(), KJLinXin, fontSize * factor, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom);

                attackTextLabel->setPosition(ccp(orgLeftPos.x + attackTextLabel->getContentSize().width / 2, orgLeftPos.y));
                attackNameLabel->setPosition(ccp(orgLeftPos.x + attackTextLabel->getContentSize().width + attackNameLabel->getContentSize().width/ 2, orgLeftPos.y));

                UILabel * aTextLabel = new UILabel(attackTextLabel, container->getCurrentNode());
                UILabel * aNameLabel = new UILabel(attackNameLabel, container->getCurrentNode());
                aNameLabel->setColor(KAILogNameColor);
            }
            else
            {
                //被攻击
                string defenceName = aiLogInfoVec[i].name;
                string defenceText = Localizatioin::getLocalization("M_PVAI_FIGHT2");
                UILabelTTF * defenceTextLabel = UILabelTTF::create(defenceText.c_str(), KJLinXin, fontSize, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom);
                UILabelTTF * defenceNameLabel = UILabelTTF::create(defenceName.c_str(), KJLinXin, fontSize, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom);

                defenceNameLabel->setPosition(ccp(orgLeftPos.x + defenceNameLabel->getContentSize().width / 2, orgLeftPos.y));
                defenceTextLabel->setPosition(ccp(orgLeftPos.x + defenceNameLabel->getContentSize().width + defenceTextLabel->getContentSize().width / 2, orgLeftPos.y));

                UILabel * aTextLabel = new UILabel(defenceTextLabel, container->getCurrentNode());
                UILabel * aNameLabel = new UILabel(defenceNameLabel, container->getCurrentNode());
                aNameLabel->setColor(KAILogNameColor);
            }

            //挑战结果
            stringstream resultStream;
            resultStream << "pvaiChallengeResult" << i+1;
            string resultStr = resultStream.str();
            UILabel *resultLabel = pvaiLayout->FindChildObjectByName<UILabel>(resultStr);

            if (aiLogInfoVec[i].win == aiLogInfoVec[i].direct)
            {
                string resultText = Localizatioin::getLocalization("M_PVAI_WIN");
                resultLabel->setString(resultText.c_str());
                resultLabel->setColor(ccYELLOW);
            }
            else
            {
                string resultText = Localizatioin::getLocalization("M_PVAI_LOST");
                resultLabel->setString(resultText.c_str());
                resultLabel->setColor(ccRED);
            }
        }
    }
}
Esempio n. 4
0
UIWidget* UI::WrapWidget(tb::TBWidget* widget)
{
    if (!widget)
        return NULL;

    if (widgetWrap_.Contains(widget))
        return widgetWrap_[widget];

    // switch this to use a factory?

    // this is order dependent as we're using IsOfType which also works if a base class

    if (widget->IsOfType<TBPopupWindow>())
    {
        UIPopupWindow* popupWindow = new UIPopupWindow(context_, false);
        popupWindow->SetWidget(widget);
        WrapWidget(popupWindow, widget);
        return popupWindow;
    }

    if (widget->IsOfType<TBDimmer>())
    {
        UIDimmer* dimmer = new UIDimmer(context_, false);
        dimmer->SetWidget(widget);
        WrapWidget(dimmer, widget);
        return dimmer;
    }

    if (widget->IsOfType<TBScrollContainer>())
    {
        UIScrollContainer* container = new UIScrollContainer(context_, false);
        container->SetWidget(widget);
        WrapWidget(container, widget);
        return container;
    }

    if (widget->IsOfType<TBInlineSelect>())
    {
        UIInlineSelect* select = new UIInlineSelect(context_, false);
        select->SetWidget(widget);
        WrapWidget(select, widget);
        return select;
    }

    if (widget->IsOfType<TBSlider>())
    {
        UISlider* slider = new UISlider(context_, false);
        slider->SetWidget(widget);
        WrapWidget(slider, widget);
        return slider;
    }

    if (widget->IsOfType<TBScrollBar>())
    {
        UIScrollBar* slider = new UIScrollBar(context_, false);
        slider->SetWidget(widget);
        WrapWidget(slider, widget);
        return slider;
    }

    if (widget->IsOfType<TBColorWidget>())
    {
        UIColorWidget* colorWidget = new UIColorWidget(context_, false);
        colorWidget->SetWidget(widget);
        WrapWidget(colorWidget, widget);
        return colorWidget;
    }

    if (widget->IsOfType<TBColorWheel>())
    {
        UIColorWheel* colorWheel = new UIColorWheel(context_, false);
        colorWheel->SetWidget(widget);
        WrapWidget(colorWheel, widget);
        return colorWheel;
    }

    if (widget->IsOfType<TBSection>())
    {
        UISection* section = new UISection(context_, false);
        section->SetWidget(widget);
        WrapWidget(section, widget);
        return section;
    }

    if (widget->IsOfType<TBSeparator>())
    {
        UISeparator* sep = new UISeparator(context_, false);
        sep->SetWidget(widget);
        WrapWidget(sep, widget);
        return sep;
    }

    if (widget->IsOfType<TBContainer>())
    {
        UIContainer* container = new UIContainer(context_, false);
        container->SetWidget(widget);
        WrapWidget(container, widget);
        return container;
    }

    if (widget->IsOfType<TBSelectDropdown>())
    {
        UISelectDropdown* select = new UISelectDropdown(context_, false);
        select->SetWidget(widget);
        WrapWidget(select, widget);
        return select;
    }

    if (widget->IsOfType<TBPulldownMenu>())
    {
        UIPulldownMenu* select = new UIPulldownMenu(context_, false);
        select->SetWidget(widget);
        WrapWidget(select, widget);
        return select;
    }

    if (widget->IsOfType<TBButton>())
    {
        // don't wrap the close button of a TBWindow.close
        if (widget->GetID() == TBIDC("TBWindow.close"))
            return 0;

        UIButton* button = new UIButton(context_, false);
        button->SetWidget(widget);
        WrapWidget(button, widget);
        return button;
    }

    if (widget->IsOfType<TBTextField>())
    {
        UITextField* textfield = new UITextField(context_, false);
        textfield->SetWidget(widget);
        WrapWidget(textfield, widget);
        return textfield;
    }

    if (widget->IsOfType<TBEditField>())
    {
        UIEditField* editfield = new UIEditField(context_, false);
        editfield->SetWidget(widget);
        WrapWidget(editfield, widget);
        return editfield;
    }

    if (widget->IsOfType<TBSkinImage>())
    {
        UISkinImage* skinimage = new UISkinImage(context_, "", false);
        skinimage->SetWidget(widget);
        WrapWidget(skinimage, widget);
        return skinimage;
    }

    if (widget->IsOfType<TBImageWidget>())
    {
        UIImageWidget* imagewidget = new UIImageWidget(context_, false);
        imagewidget->SetWidget(widget);
        WrapWidget(imagewidget, widget);
        return imagewidget;
    }
    if (widget->IsOfType<TBClickLabel>())
    {
        UIClickLabel* nwidget = new UIClickLabel(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBCheckBox>())
    {
        UICheckBox* nwidget = new UICheckBox(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBRadioButton>())
    {
        UIRadioButton* nwidget = new UIRadioButton(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBBarGraph>())
    {
        UIBargraph* nwidget = new UIBargraph(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBSelectList>())
    {
        UISelectList* nwidget = new UISelectList(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBMessageWindow>())
    {
        UIMessageWindow* nwidget = new UIMessageWindow(context_, NULL, "", false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBPromptWindow>())
    {
        UIPromptWindow* nwidget = new UIPromptWindow(context_, NULL, "", false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBFinderWindow>())
    {
        UIFinderWindow* nwidget = new UIFinderWindow(context_, NULL, "", false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<TBTabContainer>())
    {
        UITabContainer* nwidget = new UITabContainer(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }

    if (widget->IsOfType<SceneViewWidget>())
    {
        UISceneView* nwidget = new UISceneView(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }


    if (widget->IsOfType<TBLayout>())
    {
        UILayout* layout = new UILayout(context_, (UI_AXIS) widget->GetAxis(), false);
        layout->SetWidget(widget);
        WrapWidget(layout, widget);
        return layout;
    }

    if (widget->IsOfType<TBWidget>())
    {
        UIWidget* nwidget = new UIWidget(context_, false);
        nwidget->SetWidget(widget);
        WrapWidget(nwidget, widget);
        return nwidget;
    }


    return 0;
}