void InitPetStrenthenWnd(CEGUI::Window* mainPage, long type)
{
	if (!mainPage || (type<PET_QUALITYUP_ID || type>PET_FFUP_ID))
		return;

	char tempText[256];

	for (int i = PET_QUALITYUP_ID; i <= PET_FFUP_ID; i+=PET_QUALITYUP_ID)
	{
		sprintf(tempText, "PetStrengthen/%d", i);
		CEGUI::Window* strenthenWnd = mainPage->getChildRecursive(tempText);
		if (strenthenWnd)
		{
			strenthenWnd->setVisible(false);
		}
	}

	sprintf(tempText, "PetStrengthen/%d", type);
	CEGUI::Window* strenthenWnd = mainPage->getChildRecursive(tempText);
	if (strenthenWnd)
	{
		strenthenWnd->setVisible(true);
	}

	CEGUI::Window* explainTextWnd = mainPage->getChildRecursive("PetStrengthen/ExplainText");
	if (explainTextWnd)
	{
		explainTextWnd->setText(GetInst(PetSetup).GetExplainTextByID(type).c_str());
	}
}
Exemple #2
0
 bool onListSelectionChanged(const CEGUI::EventArgs &args) {
   int id = -1;
   if (m_pCombobox->getSelectedItem()) {
     id = m_pCombobox->getItemIndex(m_pCombobox->getSelectedItem());
     m_Exit.setExitType(static_cast<EExitTypes>(id));
   }
   m_pContentId->setVisible(id == EXIT_ENEMY_DEATH);
   m_pContentRegion->setVisible(id == EXIT_REGION);
   return true;
 }
Exemple #3
0
  CEditBoxExit(int id,
	       CEGUI::Window *pParent,
	       float fButtonSize,
	       const CEGUI::String &sTitle,
	       CExit &exit) 
    : CEditBoxBase(id, pParent, fButtonSize, sTitle),
      m_Exit(exit),
      m_BackupExit(exit) {

    using namespace CEGUI;
    Combobox *pComboBox = dynamic_cast<Combobox*>(m_pWindow->createChild("OgreTray/Combobox", "ExitSelect"));
    m_pCombobox = pComboBox;
    pComboBox->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pComboBox->setSize(USize(UDim(1, 0), UDim(0, 3 * fButtonSize)));
    pComboBox->addItem(new ListboxTextItem("Region"));
    pComboBox->addItem(new ListboxTextItem("Enemy death"));
    pComboBox->setAutoSizeListHeightToContent(true);
    pComboBox->setReadOnly(true);
    pComboBox->subscribeEvent(Combobox::EventListSelectionAccepted,
			      Event::Subscriber(&CEditBoxExit::onListSelectionChanged, this));

    // id
    m_pContentId = m_pWindow->createChild("DefaultWindow", "id");
    m_pContentId->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
    m_pContentId->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));

    Window *pLabel = m_pContentId->createChild("OgreTray/Label", "Exitidlabel");
    pLabel->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pLabel->setSize(USize(UDim(0, fButtonSize), UDim(0, fButtonSize)));
    pLabel->setText("id");

    Window *pEditBox = m_pContentId->createChild("OgreTray/Editbox", "Exitid");
    pEditBox->setPosition(UVector2(UDim(0, fButtonSize), UDim(0, 0)));
    pEditBox->setSize(USize(UDim(1, -fButtonSize), UDim(0, fButtonSize)));
    pEditBox->setText(m_Exit.getID());
    
    m_pContentId->setVisible(m_Exit.getExitType() == EXIT_ENEMY_DEATH);

    // region
    m_pContentRegion = m_pWindow->createChild("DefaultWindow", "region");
    m_pContentRegion->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
    m_pContentRegion->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));

    createVector(m_pContentRegion, "pos", m_Exit.getBoundingBox().getPosition().x, m_Exit.getBoundingBox().getPosition().y, fButtonSize, 0);
    createVector(m_pContentRegion, "size", m_Exit.getBoundingBox().getSize().x, m_Exit.getBoundingBox().getSize().y, fButtonSize, fButtonSize);

    m_pContentRegion->setVisible(m_Exit.getExitType() == EXIT_REGION);
    

    // default selected exit type
    m_pCombobox->setItemSelectState(m_Exit.getExitType(), true);
  }
bool OpenSaleUI()
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	//获取出售订单ID
	CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/BuyMCL"));
	if(!mcl)
		return false;
	CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem();
	if(!lbi)
	{
		//MessageBox(g_hWnd,AppFrame::GetText("AU_100"),"ERROR",MB_OK);
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_100"),NULL,NULL,true);
		return false;
	}

	CEGUI::Window* wnd = wndmgr.getWindow("Auction/SaleWnd");
	wnd->setVisible(true);
	wnd->setAlwaysOnTop(true);
	CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/SaleWnd/saleNum"));//出售界面编辑框激活
	editbox->activate();

	AHdata& ah = GetInst(AHdata);
	uint ID = lbi->getID();
	ah.SetCanSaleID(ID);
	return true;
}
Exemple #5
0
	bool GUIManager::loadWindow(const std::string &windowName)
	{
		bool flag = false;
		// 检测给定layout的文件是否加载,没有加载则加载
		if(!getWindowManager()->isWindowPresent(windowName))
		{
			// 从 .layout脚本文件读取一个UI布局设计,并将其放置到GUI资源组中。
			CEGUI::Window *editorGuiSheet = getWindowManager()->loadWindowLayout(windowName + ".layout");
			// 接下来我们告诉CEGUI显示哪份UI布局。当然我们可以随时更换显示的UI布局。
			CEGUI::System &sys = CEGUI::System::getSingleton();
			sys.setGUISheet(editorGuiSheet);
			//getSingletonPtr()->getGUISystem()->setGUISheet(editorGuiSheet);
			editorGuiSheet->setVisible(true);
			editorGuiSheet->setMousePassThroughEnabled(true);

			flag = true;
		}
		else
		{	
			assert(0);
			//// 如果已经加载则直接显示
			//CEGUI::Window *window = getWindowManager()->getWindow(windowName);
			//getSingletonPtr()->getGUISystem()->setGUISheet(window);
			//window->show();
		}

		return flag;
	}
Exemple #6
0
void MessageBox::SetButtons(const MessageBoxButtons& buttons)
{
	float32 sumWidth = 0;
	for (MessageBoxButtons::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
	{
		CEGUI::Window* button = GetButton(*it);
		OC_DASSERT(button != 0);
		float32 width = button->getWidth().d_offset;
		sumWidth += width;
	}

	float32 totalWidth = sumWidth + BUTTON_MARGIN * (buttons.size() - 1);

	float32 left = 0;
	for (MessageBoxButtons::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
	{
		CEGUI::Window* button = GetButton(*it);
		OC_DASSERT(button != 0);
		float32 width = button->getWidth().d_offset;

		button->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, -0.5f * totalWidth + left), button->getPosition().d_y));
		button->setWidth(CEGUI::UDim(0, width));
		button->setVisible(true);
		button->setID((CEGUI::uint)*it);
		button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::MessageBox::OnButtonClicked, this));
		
		left += width + BUTTON_MARGIN;
	}

	mMinWidth = totalWidth + 2.0f * BUTTON_MARGIN;
}
// GUIText
_MEMBER_FUNCTION_IMPL(GUIText, constructor)
{
	// Get our GUI
	CGUI * pGUI = g_pClient->GetGUI();

	CEGUI::Window * pWindow = pGUI->CreateGUIStaticText();

	if(!pWindow || SQ_FAILED(sq_setinstance(pVM, pWindow)))
	{
		CLogFile::Printf("Can't create GUIText.");
		sq_pushbool(pVM, false);
		return 1;
	}

	//_SET_RELEASE_HOOK(GUIElement);
	CClientScriptManager * pClientScriptManager = g_pClient->GetClientScriptManager();
	pClientScriptManager->GetGUIManager()->Add(pWindow, pClientScriptManager->GetScriptingManager()->Get(pVM));
	pWindow->setVisible(true);
	pWindow->setProperty("FrameEnabled", "false");
	pWindow->setProperty("BackgroundEnabled", "false");
	pWindow->setFont(pGUI->GetFont("tahoma-bold"));
	pWindow->setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
	
	SubscribeGuiEvents(pWindow);

	sq_pushbool(pVM, true);
	return 1;
}
bool PetStrenthen::OnClose(const CEGUI::EventArgs& e)
{
	CEGUI::Window* wnd = static_cast<const CEGUI::WindowEventArgs&>(e).window;
	if( !wnd ) return false;

	wnd->setVisible(false);
	return true;
}
Exemple #9
0
bool MainGameScreen::GameOptionsOpen(const CEGUI::EventArgs& pEventArgs)
{
    GAME->setPause(true);
    CEGUI::Window* GameOptionsWindow = GUI->getWindowManager()->getWindow("MainGameScreen/GameOptionsWindow");
    GameOptionsWindow->setVisible(true);
    GameOptionsWindow->moveToFront();
    return true;
}
Exemple #10
0
bool MainGameScreen::PathProfilerOpen(const CEGUI::EventArgs& pEventArgs)
{
    GAME->setPause(true);
    CEGUI::Window* PathProfileWindow = GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow");
    PathProfileWindow->setVisible(true);
    PathProfileWindow->moveToFront();
    return true;
}
bool GoodsViewerPage::Close()
{
	CEGUI::Window *pPage = GetPageWindow();
	if(pPage)
	{
		pPage->setVisible(false);
		pPage->setAlwaysOnTop(false);
	}
	else
		return false;
	return true;
}
Exemple #12
0
bool GameState::playerDestroyed(Viper *viper)
{
	if(viper == player)
	{
		CEGUI::Window *win = CEGUI::WindowManager::getSingletonPtr()->getWindow("GameState/GameOver");
		win->setVisible(true);
		isPlayerAlive = false;
		CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
		CEGUI::ProgressBar * bar = (CEGUI::ProgressBar *)wmgr.getWindow("GameState/Life");
		bar->setProgress(0);
		return false;
	}
	return true;
}
bool RankPage::Open()
{
	CEGUI::Window* wnd = GetPageWindow();
	if(wnd)
	{
		wnd->setVisible(true);
		wnd->setAlwaysOnTop(true);
	}
	else
	{
		throw CEGUI::InvalidRequestException("RankPage Open failed!");
		return false;
	}
	return true;
}
bool RankPage::Close()
{
	CEGUI::Window* pPage = GetPageWindow();
	if(!pPage)
	{
		throw CEGUI::InvalidRequestException("RankPage Close failed!");
		return false;
	}
	else
	{
		pPage->setVisible(false);
		pPage->setAlwaysOnTop(false);
	}
	return true;
}
bool GoodsViewerPage::Open()
{
	CEGUI::Window *pPage = GetPageWindow();
	if (pPage)
	{
		pPage->setVisible(true);
		pPage->activate();
		pPage->setAlwaysOnTop(true);
	}
	else
	{
		CEGUI::InvalidRequestException("GoodsViewerPage Open Failed!");
		return false;
	}
	return true;
}
CEGUI::Window* InitPlayerShopPage(void)
{
#ifdef _DEBUG
	CEGUI::Logger::getSingleton().setLogFilename("PlayerShop.log");
#endif

	CEGUI::Window* wnd = LoadUI("PlayerShop");

#ifdef _DEBUG
	CEGUI::Logger::getSingleton().setLogFilename("CEGUI.log",true);
#endif

	SubscribePlayerShopPageEvent(wnd);

	wnd->setVisible(false);
	return wnd;
}
void MinesweeperSample::gameEnd(bool victory)
{
    d_gameStarted = false;
    d_alarm->stop();
    CEGUI::String message;
    if (victory)
    {
        message = CEGUI::String("You win");
    }
    else
    {
        message = CEGUI::String("You lose");
    }
    // Display a message to the user
    d_result->setText(message);
    d_result->setVisible(true);
}
CEGUI::Window* InitPetStrengthen()
{
#ifdef _DEBUG
	CEGUI::Logger::getSingleton().setLogFilename("PetStrenthenLayout.log");
#endif

	CEGUI::Window* wnd = LoadUI("PetStrengthen");

#ifdef _DEBUG
	CEGUI::Logger::getSingleton().setLogFilename("CEGUI.log",true);
#endif

	InitPetSelectWnd(wnd);
	SubscribePetStrenthenEvent(wnd);

	wnd->setVisible(false);
	return wnd;
}
Exemple #19
0
CGUIHeartsDisplay::CGUIHeartsDisplay(CEntity *pParentEntity, CEGUI::Window *pParentWindow, const CEGUI::UVector2 &vPosition)
  : CGUIOverlay("gui_hearts_display", pParentEntity, pParentWindow, pParentWindow->createChild("DefaultWindow")),
    m_MaximalHitpoints(0),
    m_CurrentHitpoints(0) {

  m_pRoot->setPosition(vPosition);
  m_pRoot->setSize(USize(UDim(0, 10 * GUI_HEART_IMG_WITH_BORDER_SIZE), UDim(0, 2 * GUI_HEART_IMG_WITH_BORDER_SIZE)));

  for (Ogre::uint16 i = 0; i < m_uiMaxHeartCount; i++) {
		CEGUI::Window *pWindow = m_pRoot->createChild("OgreTray/StaticImage", "heart_" + CEGUI::PropertyHelper<int>::toString(i) );
		pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, (i % (m_uiMaxHeartCount / 2)) * GUI_HEART_IMG_WITH_BORDER_SIZE),CEGUI::UDim(0, (i / (m_uiMaxHeartCount / 2))* GUI_HEART_IMG_WITH_BORDER_SIZE)));
		pWindow->setSize(CEGUI::USize(CEGUI::UDim(0, GUI_HEART_IMG_SIZE),CEGUI::UDim(0, GUI_HEART_IMG_SIZE)));
		pWindow->setProperty("Image","hud/0/4");
		pWindow->setProperty("FrameEnabled","False");
		pWindow->setProperty("BackgroundEnabled","False");
		pWindow->setVisible(false);
	}
}
CEGUI::Window* InitGameExit()
{
    CEGUI::Window* wnd = LoadUI("GameExit");
	wnd->setVisible(false);
    CEGUI::PushButton* btn = WPushButton(wnd->getChild("GameExit/CharSel"));
    btn->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(OnReturnCharSel));
    btn = WPushButton(wnd->getChild("GameExit/ServerSel"));
    btn->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(OnReturnServerSel));
    btn = WPushButton(wnd->getChild("GameExit/Login"));
    btn->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(OnReturnLogin));
    btn = WPushButton(wnd->getChild("GameExit/Exit"));
    btn->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(OnReturnExit));

    return wnd;
}
// GUIProgressBar
_MEMBER_FUNCTION_IMPL(GUIProgressBar, constructor)
{
	CEGUI::Window * pWindow = g_pClient->GetGUI()->CreateGUIProgressBar();
	if(!pWindow || SQ_FAILED(sq_setinstance(pVM, pWindow)))
	{
		CLogFile::Printf("Can't create GUIProgressBar.");
		sq_pushbool(pVM, false);
		return 1;
	}

	CClientScriptManager * pClientScriptManager = g_pClient->GetClientScriptManager();
	pClientScriptManager->GetGUIManager()->Add(pWindow, pClientScriptManager->GetScriptingManager()->Get(pVM));
 	pWindow->setVisible(true);
 	pWindow->setProperty("CurrentProgress", "0.0");

	SubscribeGuiEvents(pWindow);

 	sq_pushbool(pVM, true);
	return 1;
}
// GUICheckBox
_MEMBER_FUNCTION_IMPL(GUICheckBox, constructor)
{
	CEGUI::Window * pWindow = g_pClient->GetGUI()->CreateGUICheckBox();
	if(!pWindow || SQ_FAILED(sq_setinstance(pVM, pWindow)))
	{
		CLogFile::Printf("Can't create GUICheckBox.");
		sq_pushbool(pVM, false);
		return 1;
	}

	//_SET_RELEASE_HOOK(GUIElement);
	CClientScriptManager * pClientScriptManager = g_pClient->GetClientScriptManager();
	pClientScriptManager->GetGUIManager()->Add(pWindow, pClientScriptManager->GetScriptingManager()->Get(pVM));
	pWindow->setVisible(true);

	SubscribeGuiEvents(pWindow);
	pWindow->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber(&OnCheckboxCheckStateChanged));

	sq_pushbool(pVM, true);
	return 1;
}
bool OpenBuyUI()
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/SaleMCL"));
	if(!mcl)
		return false;
	CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem();
	if(!lbi)
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_102"),NULL,NULL,true);
		return false;
	}
	CEGUI::Window* wnd = wndmgr.getWindow("Auction/BuyWnd");
	wnd->setVisible(true);
	wnd->setAlwaysOnTop(true);
	CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/Buy/buyNum"));//购买界面编辑框激活
	editbox->activate();
	AHdata& ah = GetInst(AHdata);
	//界面获取购买订单ID
	uint ID = lbi->getID();
	ah.SetCanBuyID(ID);//保存要购买的订单ID
	return true;
}
/*************************************************************************
Handle new game started event
*************************************************************************/
bool MinesweeperSample::handleGameStartClicked(const CEGUI::EventArgs&)
{
    d_result->setVisible(false);
    boardReset();
    boardPositionMines();
    for (size_t i = 0 ; i < MinesweeperSize ; ++i)
    {
        for(size_t j = 0 ; j < MinesweeperSize ; ++j)
        {
            d_buttons[i][j]->setProperty("DisabledTextColour", "FF000000");
            d_buttons[i][j]->setText("");
            d_buttons[i][j]->setEnabled(true);
        }
    }
    d_counter->setText(CEGUI::PropertyHelper<CEGUI::uint>::toString(MineCount));
    // Handle timer
    d_timerStartTime = ::clock();
    d_timerValue = 0;
    d_timer->setText("0");
    d_gameStarted = true;
    d_alarm->start();
    return true;
}
// 添加货物列表
void SetPlayerShopGoodsItemInfo(PlayerShop::tagGoodsItem& tgGoodsItem, int index)
{
	/// 项目背景图

	CEGUI::Window* wnd;
	char tempText[256];
	char strImageFilePath[128] = "";
	char strImageFileName[128] = "";

	sprintf(tempText, "PlayerShop/backgrond/Goods%d", index+1);
	CEGUI::Window* goodsWnd = GetWndMgr().getWindow(tempText);
	goodsWnd->setUserData(tgGoodsItem.pItemGoods);
	goodsWnd->setVisible(true);

	//根据商店状态设置UI排列
	int shopState = GetPlayerShop().GetCurShopState();
	if(shopState >= 0 && shopState < PlayerShop::SHOP_STATE)
	{
		//设置商店
		if(shopState == PlayerShop::SET_SHOP)
		{
			sprintf(tempText, "PlayerShop/backgrond/Goods%d/BuyNum", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);
			
			sprintf(tempText, "PlayerShop/backgrond/Goods%d/AddBuyNum", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);

			sprintf(tempText, "PlayerShop/backgrond/Goods%d/SubBuyNum", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);

			sprintf(tempText, "PlayerShop/backgrond/Goods%d/Text", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setText(ToCEGUIString("双击重新设置价格"));
		}
		//开店
		else if(shopState == PlayerShop::OPEN_SHOP)
		{
			sprintf(tempText, "PlayerShop/backgrond/Goods%d/BuyNum", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);

			sprintf(tempText, "PlayerShop/backgrond/Goods%d/AddBuyNum", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);

			sprintf(tempText, "PlayerShop/backgrond/Goods%d/SubBuyNum", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);

			sprintf(tempText, "PlayerShop/backgrond/Goods%d/Text", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);
		}
		// 逛商店页面
		else if( shopState == PlayerShop::SHOPPING_SHOP)
		{
			sprintf(tempText, "PlayerShop/backgrond/Goods%d/Text", index+1);
			wnd = GetWndMgr().getWindow(tempText);
			wnd->setVisible(false);
		}
	}

	// 设置物品上架信息
	// 物品图片
	sprintf(tempText, "PlayerShop/backgrond/Goods%d/Icon", index+1);
	CEGUI::DefaultWindow* iconWnd = WDefaultWindow(GetWndMgr().getWindow(tempText));
	if(iconWnd && tgGoodsItem.goodsIconId != 0)
	{
		// 获得当前背包栏对应的物品图标数据,并将该图标设置成对应背包组件的额外图片。
		const char *strIconPath = GetGame()->GetPicList()->GetPicFilePathName(CPicList::PT_GOODS_ICON, tgGoodsItem.goodsIconId);
		GetFilePath(strIconPath,strImageFilePath);
		GetFileName(strIconPath,strImageFileName);
		CEGUI::String strImagesetName = "GoodIcon/";
		strImagesetName += strImageFileName;
		SetBackGroundImage(iconWnd,strImagesetName.c_str(),strImageFilePath,strImageFileName);

		// 当物品数大于1的时候才显示数量
		if(tgGoodsItem.tradeType==PlayerShop::TT_GROUP && tgGoodsItem.oneGroupNum>=1)
		{
			char strGoodsNum[32];
			sprintf_s(strGoodsNum,"%4d",tgGoodsItem.oneGroupNum);
			iconWnd->setText(strGoodsNum);
		}
	}

	// 物品数
	sprintf(tempText, "PlayerShop/backgrond/Goods%d/Num", index+1);
	wnd = GetWndMgr().getWindow(tempText);
	if (wnd)
	{	
		if (tgGoodsItem.tradeType==PlayerShop::TT_SINGLE)
		{
			sprintf_s(tempText,"剩%d件",tgGoodsItem.groupNum);
		}else if (tgGoodsItem.tradeType==PlayerShop::TT_GROUP)
		{
			sprintf_s(tempText,"剩%d组",tgGoodsItem.groupNum);
		}
		wnd->setText(ToCEGUIString(tempText));
	}
	
	// 物品名
	sprintf(tempText, "PlayerShop/backgrond/Goods%d/Name", index+1);
	wnd = GetWndMgr().getWindow(tempText);
	if (wnd)
	{
		char strGoodsName[32] = "";
		DWORD dwNameSize = (DWORD)strlen(tgGoodsItem.strGoodsName.c_str());
		if (tgGoodsItem.tradeType==PlayerShop::TT_SINGLE&&dwNameSize>18)
		{
			_snprintf(strGoodsName,19,"%s",tgGoodsItem.strGoodsName.c_str());
			sprintf((strGoodsName+18),"...");
		}else if (tgGoodsItem.tradeType==PlayerShop::TT_GROUP&&dwNameSize>10)
		{
			_snprintf(strGoodsName,11,"%s",tgGoodsItem.strGoodsName.c_str());
			sprintf((strGoodsName+10),"...");
		}
		else
			sprintf(strGoodsName,"%s",tgGoodsItem.strGoodsName.c_str());
		wnd->setText(ToCEGUIString(strGoodsName));
		wnd->setTooltipText(tgGoodsItem.strGoodsName);
	}

	// 交易方式
	sprintf(tempText, "PlayerShop/backgrond/Goods%d/TradeType", index+1);
	wnd = GetWndMgr().getWindow(tempText);
	if (wnd)
	{
		if (tgGoodsItem.tradeType==PlayerShop::TT_SINGLE)
		{
			wnd->setText(ToCEGUIString("单个贩卖"));
			//CEGUI::FreeTypeFont * font = static_cast<CEGUI::FreeTypeFont*>( wnd->getFont() );
			//font->setPointSize(8);
		}
		else if (tgGoodsItem.tradeType==PlayerShop::TT_GROUP)
		{
			wnd->setText(ToCEGUIString("成组贩卖"));
		}
	}

	// 价格
	sprintf(tempText, "PlayerShop/backgrond/Goods%d/Price", index+1);
	wnd = GetWndMgr().getWindow(tempText);
	if (wnd)
	{
		sprintf(tempText,"%d",tgGoodsItem.price);
		wnd->setText(tempText);
	}
}
void SetInitializedAHUIProperty(CEGUI::Window* pageWnd)
{
	//第一次打开窗口,默认可见
	pageWnd->setVisible(false);

	CEGUI::Window* tab1 = pageWnd->getChildRecursive("Auction/Tab/BuySale");
	tab1->setVisible(true);//默认Tab1可见

	CEGUI::Editbox* editbox = WEditBox(pageWnd->getChildRecursive("Auction/Pickup/EditGold"));//金币提取编辑框只能为数字
	editbox->setText("");
	editbox->setReadOnly(true);
	//editbox->setMaxTextLength(10);
	//只能输入数字
	editbox->setValidationString("[0-9]*");

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Pickup/EditWeimian"));//位面提取编辑框只能为数字
	editbox->setText("");
	editbox->setReadOnly(true);
	editbox->setValidationString("[0-9]*");
	//editbox->setMaxTextLength(10);
	CEGUI::MultiColumnList* mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/SaleMCL"));
	mcl->setUserColumnDraggingEnabled(false);//列不可拖动
	mcl->setUserSortControlEnabled(false);//列不可排序
	mcl->setUserColumnSizingEnabled(false);//列不可调整宽度

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/BuyMCL"));
	mcl->setUserColumnDraggingEnabled(false);//列不可拖动
	mcl->setUserSortControlEnabled(false);//列不可排序
	mcl->setUserColumnSizingEnabled(false);//列不可调整宽度

	CEGUI::Window* wnd = pageWnd->getChildRecursive("Auction/SaleWnd");
	wnd->setVisible(false);//出售界面默认不可见

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/saleNum"));//出售界面编辑框只能输入数字
	editbox->setText("");
	editbox->setMaxTextLength(10);
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/Text6"));//出售界面交易文本提示
	editbox->setText("");
	editbox = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/Text61"));//
	editbox->setText("");
	

	wnd = pageWnd->getChildRecursive("Auction/BuyWnd");
	wnd->setVisible(false);//购买界面默认不可见

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Buy/buyNum"));//购买界面编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(4);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Buy/Text6"));//购买界面交易文本提示
	editbox->setText("");
	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Buy/Text61"));
	editbox->setText("");

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/Query/MCL"));//个人查询MCL属性
	mcl->setUserColumnDraggingEnabled(false);//列不可拖动
	mcl->setUserSortControlEnabled(false);//列不可排序
	mcl->setUserColumnSizingEnabled(false);//列不可调整宽度

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditNum"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditPrice"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditNum"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	editbox = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditPrice"));//编辑框只能输入数字
	editbox->setText("");
	//editbox->setReadOnly(false);
	editbox->setValidationString("[0-9]*");
	editbox->setMaxTextLength(5);

	//////////////////////////////////////////////////
	//委托页面支付提示
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/sale/subNum");//
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/sale/subGold");//
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/subNum");
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/subGold");
	wnd->setText("");
	wnd = pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/Text");
	wnd->setText("");
	////////////////////////////////////////////////////

	/////////////////////////////////////////////////
	// zhaohang  2010/5/14 
	// 刷新按钮屏蔽
	wnd = pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshSale");
	wnd->setVisible(false);
	wnd = pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshBuy");
	wnd->setVisible(false);
	wnd = pageWnd->getChildRecursive("Auction/Tab/Query/Refresh");
	wnd->setVisible(false);
	/////////////////////////////////////////////////
}
Exemple #27
0
bool MainGameScreen::GameOptionsClose(const CEGUI::EventArgs& pEventArgs)
{
    CEGUI::Window* GameOptionsWindow = GUI->getWindowManager()->getWindow("MainGameScreen/GameOptionsWindow");
    GameOptionsWindow->setVisible(false);
    return true;
}
void MenusScene::Initialize()
{
	InitializeResources(resourceGroupName);

	player1Nav = MenuNavigator(this);
	player1Nav.AllowMenuControls = true;

	player2Nav = MenuNavigator(this);

	Player1Data.MainElement = ElementEnum::Earth;
	Player2Data.MainElement = ElementEnum::Earth;

	InputNotifier::GetInstance()->AddObserver(&player1Nav);
	InputNotifier::GetInstance()->AddObserver(&player2Nav);

	guiManager->AddScheme("MainMenu.scheme");
	guiManager->LoadLayout("MainMenuLayout.layout", nullptr);
	guiManager->LoadLayout("GameSetupMenu.layout", nullptr);
	guiManager->LoadLayout("TutorialLayout.layout", nullptr);

	//guiManager->LoadLayout("CharacterSetupMenu.layout", nullptr);
	
	if(progressBar.GetWindow() == NULL)
	{
		CEGUI::Window* progressWindow = CEGUI::WindowManager::getSingleton().createWindow("Generic/Image", "CursorProgress");
		progressWindow->setSize( CEGUI::USize(CEGUI::UDim( 0.1f, 0 ), CEGUI::UDim( 0.1f, 0 ) ) );
		progressWindow->setPosition( CEGUI::UVector2(CEGUI::UDim( 0.5f, 0 ), CEGUI::UDim( 0.5f, 0 ) ) );
		progressWindow->setAlwaysOnTop(true);
		progressWindow->setMousePassThroughEnabled(true);

		guiManager->GetRootWindow()->addChild(progressWindow);
		progressBar.SetWindow(progressWindow);
		progressWindow->setVisible(true);
	}

	handlers[Screens::MainMenu] = new MainMenuHandler(this);
	//handlers[Screens::CharacterSetup] = new CharacterMenuHandler(this);
	handlers[Screens::GameSetup] = new GameSetupMenuHandler(this);
	handlers[Screens::Tutorial] = new TutorialMenuHandler(this);

	for (unsigned int i = 0; i < Screens::Count; i++)
	{
		handlers[i]->Hide();
	}

	//currentScreen = GameSetup;
	handlers[currentScreen]->Show();

	InputManager* inputManager = InputManager::GetInstance();

	KinectSpeechReader* speechReader = inputManager->GetSpeechReader();
	if(speechReader)
	{
		inputManager->RegisterAudioListener(&player1Nav);
		//Load the grammar for this scene
		if(!speechReader->LoadGrammarFile("MenusSpeech.grxml"))
			printf("Grammer Load Fail\n");
		//Set the confidence threshold
		speechReader->SetConfidenceThreshold(0.6f);
	}

	ogreSceneManager->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 1.0f));

	CreateCameraAndViewport(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 0.0f));

}
bool OnBuyUIClosed(const CEGUI::EventArgs& e)
{
	CEGUI::Window* wnd = WEArgs(e).window;
	wnd->setVisible(false);
	return true;
}
Exemple #30
0
bool MainGameScreen::PathProfilerClose(const CEGUI::EventArgs& pEventArgs)
{
    CEGUI::Window* PathProfileWindow = GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow");
    PathProfileWindow->setVisible(false);
    return true;
}