Esempio n. 1
0
bool OnShopCityContentSelChanged(const CEGUI::EventArgs& e)
{
    CEGUI::TabControl* tbs = WTabControl(WEArgs(e).window);
    if(tbs)
    {
        CEGUI::Window* tbcontent =  tbs->getTabContentsAtIndex(tbs->getSelectedTabIndex());
        if(tbcontent)
        {
            tbcontent->addChildWindow(GetWindow(SHOPCITY_CHILD_PAGE_NAME));//把唯一ShopCityChild加到当前选中tbcontent上
            //更新ItemSet的显示
            FireUIEvent(SHOPCITY_ITEMSET_PAGE_NAME,SHOPCITY_ITEMSET_EVENT_UPDATE);
            //更新最近购买
            FireUIEvent(SHOPCITY_LATESTBUY_NAME,SHOPCITY_PAGE_EVENT_UPDATE_LATESTBUY);
            //更新推荐
            FireUIEvent(SHOPCITY_TWITTER_NAME,SHOPCITY_TWITTER_EVENT_NAME);
            //更新左搜索(导购)菜单
            FireUIEvent(SHOPCITY_SEARCH_LEFTWND_NAME,SHOPCITY_SEARCHLEFT_EVENT_MENUUPDATE_NAME);
            //更新右搜索(筛选)菜单
            FireUIEvent(SHOPCITY_SEARCH_RIGHTWND_NAME,SHOPCITY_SEARCHRIGHT_EVENT_MENUUPDATE_NAME);
            //设置更新源类型
            ShopCityMsgMgr& msgMgr = GetInst(ShopCityMsgMgr);
            msgMgr.SetStateUpdateUIByType(0);//由选中的商城商店类型来更新
        }
    }
    return true;
}
bool GameInputHandler::mousePressed(const OIS::MouseEvent& evt, OIS::MouseButtonID btn)
{
	if (game.getSubState() != SUBST_EDITOR && game.getSubState() != SUBST_GAMESTART)
		return true;
	
	CEGUIInputHandler::mousePressed(evt, btn);
	
	if (game.getSubState() != SUBST_EDITOR)
		return true;
	
	CEGUI::TabControl* tabWindow = (CEGUI::TabControl*)CEGUI::WindowManager::getSingleton().getWindow("EditorTabControl");
	if (inputManager->processMouse && (tabWindow->getSelectedTabIndex() == 2))
	{
		if (objectManager.getEditObjects() && objectManager.isEditModeActive())
		{
			if (btn == OIS::MB_Left)
				objectManager.finishEditing();
			else if (btn == OIS::MB_Right)
				objectManager.abortEditing();
		}
		else
		{
			// Select objects
			if (btn == OIS::MB_Left)
				objectManager.selectObjectBelowCursor();
		}
	}
	
	return true;
}
Esempio n. 3
0
CGUITab* CGUITabPanel_Impl::GetSelectedTab ( void )
{
    CEGUI::TabControl* pControl = reinterpret_cast < CEGUI::TabControl* > ( m_pWindow );

    if ( pControl->getTabCount() > 0 )
    {
        CEGUI::Window* pTab = pControl->getTabContentsAtIndex ( pControl->getSelectedTabIndex() );

        try
        {
            return reinterpret_cast < CGUITab* > ( pTab->getUserData() );
        }
        catch ( CEGUI::Exception )
        {
            return NULL;
        }
    }
    return NULL;
}
void GameInputHandler::handleMouse(float timeSinceLastFrame)
{
	const OIS::MouseState &ms = inputManager->mouseState;

	static float delay = 0.0f;
	delay -= timeSinceLastFrame;
	
	if (game.getSubState() != SUBST_EDITOR)
	{
		windowManager.showCursor(game.getSubState() == SUBST_GAMESTART);
		return;
	}

	if (!inputManager->isMouseDown(OIS::MB_Middle))
	{
		windowManager.showCursor(true);

		// Edit geometry with left and right clicks
		CEGUI::TabControl* tabWindow = (CEGUI::TabControl*)CEGUI::WindowManager::getSingleton().getWindow("EditorTabControl");
		if (inputManager->processMouse && (tabWindow->getSelectedTabIndex() == 1) && (delay <= 0) && (inputManager->isMouseDown(OIS::MB_Left) || inputManager->isMouseDown(OIS::MB_Right)))
		{
			Ray r = camera->getCameraToViewportRay(CEGUI::MouseCursor::getSingleton().getPosition().d_x / settings.resolution_Width,
														 CEGUI::MouseCursor::getSingleton().getPosition().d_y / settings.resolution_Height);
			Vector3 pos = camera->getDerivedPosition();
			Vector3 dir = r.getDirection();
			dir.normalise();

			game.editLevel(inputManager->isMouseDown(OIS::MB_Left), pos, dir);
			delay = 0.12f;
		}
	}
	else
	{
		windowManager.showCursor(false);

		rotX = Degree(-ms.X.rel * settings.mouseSensitivity);
		rotY = Degree(-ms.Y.rel * settings.mouseSensitivity);
	}
}
Esempio n. 5
0
void SetInitProShopCity(CEGUI::Window* pageWnd)
{
    CEGUI::TabControl* tbs = WTabControl(pageWnd->getChildRecursive(SHOPCITY_TAB_NAME));
    if(tbs)
    {
        //默认让第一个TabContent可见
        tbs->setSelectedTabAtIndex(0);
        CEGUI::Window* tbs1 = tbs->getTabContentsAtIndex(tbs->getSelectedTabIndex());
#ifdef _DEBUG
        const char* name = tbs1->getName().c_str();
        OutputDebugStr(name);
        OutputDebugStr("\n");
#endif
        tbs1->setVisible(true);
        //将唯一ShopCityChild添加到上面
        CEGUI::TabControl* child = WTabControl(InitShopCityChild());
        //默认让第一tabContent可见
        child->setSelectedTabAtIndex(0);
        tbs1->addChildWindow(child);
    }
    //清空moneyEdboxes
    FireUIEvent(SHOPCITY_PAGE_NAME,SHOPCITY_PAGE_EVENT_CLEARMONEYEDBOXES);
    //moneyEdboxes属性设置
    CEGUI::Editbox* edbox = NULL;
    //星钻
    edbox = WEditBox(pageWnd->getChildRecursive(SHOPCITY_XINGZUAN_EDBOX_NAME));
    if(edbox)
    {
        //只能输入数字
        edbox->setValidationString("[0-9]*");
        //数字宽
        edbox->setMaxTextLength(9);
        //只读
        edbox->setReadOnly(true);
    }
    //点券
    edbox = WEditBox(pageWnd->getChildRecursive(SHOPCITY_DIANJUAN_EDBOX_NAME));
    if(edbox)
    {
        //只能输入数字
        edbox->setValidationString("[0-9]*");
        //数字宽
        edbox->setMaxTextLength(9);
        //只读
        edbox->setReadOnly(true);
    }
    //位面
    edbox = WEditBox(pageWnd->getChildRecursive(SHOPCITY_WEIMIAN_EDBOX_NAME));
    if(edbox)
    {
        //只能输入数字
        edbox->setValidationString("[0-9]*");
        //数字宽
        edbox->setMaxTextLength(9);
        //只读
        edbox->setReadOnly(true);
    }
    //左搜素框
    CEGUI::Combobox* cbboxL = WComboBox(pageWnd->getChildRecursive(SHOPCITY_SEARCH_LEFTWND_NAME));
    if(cbboxL)
    {
        cbboxL->setReadOnly(true);
    }
    //右搜素框
    CEGUI::Combobox* cbboxR = WComboBox(pageWnd->getChildRecursive(SHOPCITY_SEARCH_RIGHTWND_NAME));
    if(cbboxR)
    {
        cbboxR->setReadOnly(true);
    }
}