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


C++ Window::disable方法代码示例

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


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

示例1: OnPlayerShopSubBuyNum

bool OnPlayerShopSubBuyNum(const CEGUI::EventArgs& e)
{
	CEGUI::Window* wnd = WEArgs(e).window;
	if(!wnd) return false;

	CEGUI::Window* goodsWnd = wnd->getParent();
	if (goodsWnd)
	{	
		CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData());
		if (!goods) return false;

		PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
		if (pGoodsItem!=NULL)
		{
			char str[32];
			// 取得输入框控件名
			CEGUI::String name = wnd->getName();
			name.assign(name, 0, name.find_last_of("/"));
			name += "/BuyNum";

			CEGUI::Window* buyNumWnd = GetWndMgr().getWindow(name);
			int num = atoi(buyNumWnd->getText().c_str());

			if (num<=0)
			{
				sprintf(str,"%d",0);
				wnd->disable();
			}
			else
				sprintf(str,"%d",num--);
			buyNumWnd->setText(ToCEGUIString(str));
			pGoodsItem->readyTradeNum = num;	
		}
	}

	return true;
}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:37,代码来源:PlayerShopPage.cpp

示例2: OnPlayerShopOperBtnUpdate

// 更新界面操作按钮状态
bool OnPlayerShopOperBtnUpdate(const CEGUI::EventArgs& e)
{
	CEGUI::Window* mainPage = WEArgs(e).window;
	if(!mainPage) return false;

	CEGUI::Window* messageBoardBtn = mainPage->getChildRecursive("PlayerShop/backgrond/Messageboard");
	CEGUI::Window* HideShowBtn = mainPage->getChildRecursive("PlayerShop/backgrond/HideShowBtn");
	CEGUI::Window* beginStopBtn = mainPage->getChildRecursive("PlayerShop/backgrond/BeginStopBtn");
	CEGUI::Window* closeBtn = mainPage->getChildRecursive("PlayerShop/backgrond/CloseBtn");
	if (!messageBoardBtn || !HideShowBtn || !beginStopBtn || !closeBtn) return false;

	PlayerShop& playerShop = GetPlayerShop();
	int shopState = playerShop.GetCurShopState();
	bool shopSetSure = playerShop.GetbSetTrue();
	if(shopState < 0 || shopState >= PlayerShop::SHOP_STATE)
		return false;

	vector<PlayerShop::tagGoodsItem>& myShopGoods = playerShop.GetMyShopGoods();

	// 设置商店
	if(shopState == PlayerShop::SET_SHOP)
	{
		if (!myShopGoods.empty())
		{
			// 如果商店中有物品就把开始摆摊显示出来
			beginStopBtn->setVisible(true);
			beginStopBtn->enable();
			beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("开始贩卖")));
		}else
		{
			// 如果商店中有物品就让开始摆摊不显示出来
			beginStopBtn->setVisible(false);
		}
		HideShowBtn->setVisible(false);
	}
	// 打开商店
	else if(shopState == PlayerShop::OPEN_SHOP)
	{
		// 停止摆摊 & 隐藏商店显示出来
		beginStopBtn->setVisible(true);
		beginStopBtn->enable();
		beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("停止贩卖")));
		HideShowBtn->setVisible(true);
		HideShowBtn->enable();
		HideShowBtn->setText(ToCEGUIString(AppFrame::GetText("隐藏商店")));
	}
	// 购买状态
	else if(shopState == PlayerShop::SHOPPING_SHOP)
	{	
		if (shopSetSure)
		{
			// 重设 & 购买显示出来
			beginStopBtn->setVisible(true);
			beginStopBtn->enable();
			beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("购买")));
			HideShowBtn->setVisible(true);
			HideShowBtn->enable();
			HideShowBtn->setText(ToCEGUIString(AppFrame::GetText("重设")));
		}
		else
		{
			// 确定 & 购买显示出来
			beginStopBtn->setVisible(true);
			beginStopBtn->disable();
			beginStopBtn->setText(ToCEGUIString(AppFrame::GetText("购买")));
			HideShowBtn->setVisible(true);
			HideShowBtn->enable();
			HideShowBtn->setText(ToCEGUIString(AppFrame::GetText("确定")));
		}
	}

	return true;
}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:74,代码来源:PlayerShopPage.cpp


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