Example #1
0
void CUIEditorView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	g_CoreSystem.getCEGUISystem()->injectMouseButtonDown(CEGUI::LeftButton);

	//找到鼠标点击的窗口
	CEGUI::Window* pWin = CEGUI::System::getSingleton().getWindowContainingMouse();
	if(pWin)
	{
		//检测窗口是否可以显示函数对话框
		BOOL bShow = g_DataPool.m_scriptModule.DoFunction("canShowFunctionDlg",pWin->getWidgetType().c_str(),NULL);
		//显示对话框
		if(bShow)
		{
			CFunctionDlg dlg;
			CString szString,szName;
			szName = pWin->getName().c_str();
			szString = szName;
			szString += "_OnClicked";
			dlg.SetLeftFunction(szString);
			szString = szName;
			szString += "_OnRClicked";
			dlg.SetRightFunction(szString);
			dlg.SetWindowName(szName);
			dlg.DoModal();
		}
	}

	CView::OnLButtonDblClk(nFlags, point);
}
bool CREvent::OnCreateRoleBtn(const CEGUI::EventArgs &e)
{
	if (GetInst(SelectRolePage).GetPlayerCount() >= 1)
	{
        GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Base_34"));   //目前不能创建更多的角色了!
		return false;
	}
	CEGUI::Window *pPageWin = GetInst(CreateRolePage).GetPageWindow();
	CEGUI::Editbox* pNameEdit = static_cast<CEGUI::Editbox*>(pPageWin->getChild("EditName"));

	const char * strName = CEGUIStringToAnsiChar(pNameEdit->getText());
	if (strcmp(strName,"") == 0)
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_72"));  //"名字不能为空"
		return false;
	}
	if (!CheckName(strName))
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_73"));  //"名字中不能有空格"
		return false; 
	}
	int  iSex  = random(2);
	//RandomChoseDetails();
	//RandomChoseCountry();
	BYTE lConstellation = random(12) + 1;
	//const char *strName,char nOccupation, char nSex, BYTE lHead, BYTE lFace, BYTE lCountry,BYTE lConstellation,BYTE bRandCountry
	GetGame()->C2L_AddRole_Send(strName, 0, (char)GetSelectSex(), GetHair(), GetFace(), GetSelectCountry(), lConstellation, 0 );
	return true;
}
 void SettingComboBox::onFontChanged(CEGUI::WindowEventArgs& e)
 {
   CEGUI::Window* name = getNameW();
   CEGUI::Combobox* box = getComboBoxW();
   name->setFont(CEGUI::Window::getFont());
   box->setFont(CEGUI::Window::getFont());
 }
Example #4
0
bool DynamicEditor::createFactory(const CEGUI::EventArgs& _args)
{
    unsigned int index = typeTab->getSelectedTabIndex();
    CEGUI::Window* tab = typeTab->getTabContentsAtIndex(index);
    static_cast<EditorFactoryType*>(tab->getUserData())->createButton(_args);
    return true;
}
bool time_panel_impl::visible()
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    return root->getChild(label_name)->isVisible();
    return true;
}
Example #6
0
//新品推荐
bool OnUpdateTwitter(const CEGUI::EventArgs& e)
{
    CEGUI::Window* twitter = WEArgs(e).window;
    CEGUI::Listbox*  lb = WListBox(twitter->getChildRecursive(SHOPCITY_TWITTER_CHILDLISTBOX_NAME));
#ifdef _DEBUG
    OutputDebugStr(lb->getName().c_str());
    OutputDebugStr("\n");
    OutputDebugStr(twitter->getChildAtIdx(0)->getName().c_str());
    OutputDebugStr("n");
#endif
    //清空
    lb->resetList();

    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    //新品推荐显示
    SCGData::MapNewestA& resdta = dt->GetNewestVec();
    SCGData::VecGDPTA& vecDTA = resdta[eCityType];
    for(uint i = 0 ; i < vecDTA.size() ; ++i)
    {
        CGoodsList::tagGoods2* ptg2 = CGoodsList::GetProperty(vecDTA[i].index);
        if(ptg2)
        {
            string str  = ptg2->BaseProperty.strName.c_str();
            //CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(str.c_str(),vecDTA[i].index);//索引关联Item ID
            CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()),vecDTA[i].index);//索引关联Item ID
            lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            lb->addItem(lti);
        }
    }
    return true;
}
Example #7
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;
	}
void LoginEvent::OnPageOpen(GamePage *pPage)
{
    CEGUI::Window *pLoginWindow = pPage->GetPageWindow();
    //设置账号编辑框并得到焦点
    CEGUI::Editbox *pIDEdit = static_cast<CEGUI::Editbox*>(pLoginWindow->getChild("LoginPage/Account"));
	/////////////////////////////////////////////////
	// zhaohang  2010/3/29 
	// 
	//读cdkey
	ifstream stream2;
	stream2.open("setup/cdkey.ini"); 
	if (stream2.is_open())
	{
		bool bRememberCdkey=false;
		stream2 >> bRememberCdkey;
		if (bRememberCdkey)
		{
			string str;
			stream2 >> str;
			pIDEdit->setText(str.c_str());

			//m_pRememberCdkey->SetSelected(true);
		}
		stream2.close();
	}
Example #9
0
    void
    setupGUI(){
        CEGUI::WindowFactoryManager::addFactory<CEGUI::TplWindowFactory<AlphaHitWindow> >();

        CEGUI::OgreRenderer::bootstrapSystem();
        CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
        CEGUI::Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
        myRoot->setProperty("MousePassThroughEnabled", "True");
        CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( myRoot );
        CEGUI::SchemeManager::getSingleton().createFromFile("Thrive.scheme");
        CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("ThriveGeneric/MouseArrow");

        //For demos:
        CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("SampleBrowser.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("OgreTray.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("GameMenu.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("AlfiskoSkin.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("VanillaSkin.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("Generic.scheme");
        CEGUI::SchemeManager::getSingleton().createFromFile("VanillaCommonDialogs.scheme");

        CEGUI::ImageManager::getSingleton().loadImageset("DriveIcons.imageset");
        CEGUI::ImageManager::getSingleton().loadImageset("GameMenu.imageset");
        CEGUI::ImageManager::getSingleton().loadImageset("HUDDemo.imageset");
    }
Example #10
0
EntityIcon* EntityIconManager::createIcon(Gui::Icons::Icon* icon, EmberEntity* entity, unsigned int pixelSize)
{
	if (!icon) {
		S_LOG_WARNING("Trying to create an EntityIcon with an invalid Icon.");
		return 0;
	}
	std::stringstream ss;
	ss << "entityIcon" << mIconsCounter++;
	
	CEGUI::DragContainer* item = static_cast<CEGUI::DragContainer*>(mGuiManager.createWindow("DragContainer", ss.str()));
	
	if (item) {
		item->setSize(CEGUI::USize(CEGUI::UDim(0, pixelSize), CEGUI::UDim(0, pixelSize)));
		//item->setTooltipText(name);
		
		ss << "Image" ;
		CEGUI::Window* iconWindow = mGuiManager.createWindow("EmberLook/StaticImage", ss.str());
		if (iconWindow) {
			iconWindow->setProperty("BackgroundEnabled", "false");
 			iconWindow->setProperty("FrameEnabled", "false");
 			iconWindow->setProperty("InheritsAlpha", "true");
			iconWindow->disable();
// 			iconWindow->setProperty("FrameEnabled", "false");
			iconWindow->setProperty("Image", CEGUI::PropertyHelper<CEGUI::Image*>::toString(icon->getImage()));
			item->addChild(iconWindow);
			
			EntityIcon* entityIcon = new EntityIcon(*this, item, iconWindow, icon, entity);
			mIcons.push_back(entityIcon);
			return entityIcon;
		}
	}
	return 0;
}
bool
CFormBackendImp::LoadLayout( GUCEF::CORE::CIOAccess& layoutStorage )
{GUCEF_TRACE;
    
    CEGUI::Window* rootWindow = NULL;
    CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr();
    
    GUCEF_DEBUG_LOG( 0, "Starting layout load for a GUI Form" );
    
    try
    {
        CORE::CDynamicBuffer memBuffer( layoutStorage );
        CEGUI::RawDataContainer container;

        container.setData( (CEGUI::uint8*) memBuffer.GetBufferPtr() );
        container.setSize( (size_t) memBuffer.GetDataSize() );

        rootWindow = wmgr->loadLayoutFromContainer( container );

        container.setData( (CEGUI::uint8*) NULL );
        container.setSize( (size_t) 0 );
    }
    catch ( CEGUI::Exception& e )
    {
        GUCEF_ERROR_LOG( 0, CString( "CEGUI Exception while attempting to load form layout: " ) + e.what() );
        return false;
    }
    
    // Now that we completed loading lets see what we got from CEGUI
    if ( NULL != rootWindow )
    {
        // Begin by providing a wrapper for the root window
        m_rootWindow = CreateAndHookWrapperForWindow( rootWindow );
        if ( NULL != m_rootWindow )
        {
            CString localWidgetName = m_rootWindow->GetName().SubstrToChar( '/', false );
            m_widgetMap[ localWidgetName ] = m_rootWindow;
            WrapAndHookChildWindows( rootWindow );
            
            // We will directly add the form as a child of the root for now
            // Note: This assumes that you have a GUISheet already set, otherwise this will result in a segfault!
            CEGUI::Window* globalRootWindow = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();
            if ( NULL != globalRootWindow )
            {
                globalRootWindow->addChild( rootWindow );
                
                GUCEF_DEBUG_LOG( 0, "Successfully loaded a GUI Form layout" );
                return true;                
            }
            else
            {
                GUCEF_ERROR_LOG( 0, "Failed to add form as a child to the global \"root\" window" );    
            }
        }
        rootWindow->hide();
    }

    GUCEF_DEBUG_LOG( 0, "Failed to load a GUI Form layout" );
    return false; 
}
Example #12
0
bool CEGUIInputHandler::mousePressed(
		const ApplicationMouseCode::MouseButton button) {
	//BOOST_LOG_SEV(mBoostLogger, boost::log::trivial::debug)<< "MOUSE BUTTON PRESSED" << button;
	CEGUI::GUIContext& context =
			CEGUI::System::getSingleton().getDefaultGUIContext();

	// Saving a mathgl graph to a file on right click
	CEGUI::Window* window = context.getWindowContainingMouse();
	if (window != NULL
			&& (window->getName() == "MathGLWindow"
					|| window->getName() == "MathGLRTTWindow")
			&& button == ApplicationMouseCode::RightButton) {
		std::vector<MathGLPanel*>::iterator it =
				SimulationManager::getSingleton()->getViewController().getGraphWindows().begin();
		for (;
				it
						!= SimulationManager::getSingleton()->getViewController().getGraphWindows().end();
				it++) {
			if ((*it)->getMathGlWindow() == window
					|| (*it)->getMathGlWindow()->getChild("MathGLRTTWindow")
							== window) {
				(*it)->makePrint();
			}
		}
	}

	context.injectMouseButtonDown(InputUtils::convertToCEGUI(button));
	return OgreInputHandler::mousePressed(button);

}
Example #13
0
GUIMessageBox::GUIMessageBox(void)
	: d_root(CEGUI::WindowManager::getSingleton().loadLayoutFromFile("MessageBox.layout"))
{
	using namespace CEGUI;

	CEGUI::Window* parent = NULL;

	// we will destroy the console box windows ourselves
	d_root->setDestroyedByParent(false);

	// Do events wire-up
//	d_root->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUIMessageBox::handleSubmit, this));

	d_root->getChild("Button")->
		subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUIMessageBox::handleSubmit, this));

	/*CEGUI::Window* d_fontNameEditbox = static_cast<CEGUI::Editbox*>(d_root->getChild("Login/Name"));
	d_fontNameEditbox->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUILogin::handleSubmit, this));

	d_root->getChild("Login/PassText")->
		subscribeEvent(Editbox::EventTextAccepted, Event::Subscriber(&GUILogin::handleSubmit, this));


	d_root->getChild("Login/Submit")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUILogin::handleSubmit, this));
	*/
	// decide where to attach the console main window
	parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

	// attach this window if parent is valid
	if (parent)
		parent->addChild(d_root);
}
Example #14
0
void CUIEditorView::OnRButtonDown(UINT nFlags, CPoint point)
{
	g_CoreSystem.getCEGUISystem()->injectMousePosition(point.x, point.y);
	g_CoreSystem.getCEGUISystem()->injectMouseButtonDown(CEGUI::RightButton);

	if( getShowMode() == false ) return;

	CMenu menu;
	menu.CreatePopupMenu();
	CEGUI::Window* mouseWindow = g_CoreSystem.getCEGUISystem()->getWindowContainingMouse();
	bool showMenu = false;
	INT menuId = ID_RIGHT_WINDOW_SELECT;
	for ( ; mouseWindow ; mouseWindow = mouseWindow->getParent(),++menuId )
	{
		if (mouseWindow != CEGUI::System::getSingleton().getGUISheet() && !mouseWindow->isAutoWindow())
		{
			menu.AppendMenu(MF_STRING, menuId,mouseWindow->getName().c_str());
			showMenu = true;
		}		
	}
	if (showMenu)
	{
		POINT pos;
		GetCursorPos(&pos);
		menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,pos.x, pos.y, this);
		g_DataPool.OnSelectWindowChanged(NULL, m_pSelectedWindow);
	}
	CView::OnRButtonDown(nFlags, point);
}
Example #15
0
bool GUIManager::handleDSActivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    std::vector<unsigned int> const & dims = dm->getDimensions();
    unsigned int dim = dims[int(sb->getScrollPosition()*(dims.size()-1))];
    float scrollPos = sb->getScrollPosition();
    dm->activate(dim);
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->enable();
    CEGUI::WindowEventArgs w(sb);
    sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
    // Set the global scrollbar to the right position.
    sb->setScrollPosition(scrollPos);
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->show();
  }
  // TODO handle else-error
  return true;
}
Example #16
0
	bool Widget::TabbableWindow_KeyDown(const CEGUI::EventArgs& args)
	{
		const CEGUI::KeyEventArgs& keyEventArgs = static_cast<const CEGUI::KeyEventArgs&>(args);
		if (keyEventArgs.scancode == CEGUI::Key::Tab)
		{
			//find the window in the list of tabbable windows
			CEGUI::Window* activeWindow = mMainWindow->getActiveChild();
			if (activeWindow) {
//				WindowMap::iterator I = std::find(mTabOrder.begin(), mTabOrder.end(), activeWindow);
				WindowMap::iterator I = mTabOrder.find(activeWindow);
				if (I != mTabOrder.end()) {
					I->second->activate();
					//we don't want to process the event any more, in case something else will try to interpret the tab event to also change the focus
					Input::getSingleton().suppressFurtherHandlingOfCurrentEvent();
					return true;
				}
			}
		} else if (keyEventArgs.scancode == CEGUI::Key::Return)
		{
			//iterate through all enter buttons, and if anyone is visible, activate it
			for (WindowStore::iterator I = mEnterButtons.begin(); I != mEnterButtons.end(); ++I) {
				if ((*I)->isVisible()) {
					CEGUI::Window* window = *I;
					WindowEventArgs args(window);
					window->fireEvent(PushButton::EventClicked, args, PushButton::EventNamespace);
					break;
				}
			}
		}
		return false;
	}
Example #17
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;
}
void UpdatePetStrenthenWnd(CEGUI::Window* mainPage, long type)
{
	if (!mainPage)
		return;

	char tempText[256];

	CPlayer* player = GetGame()->GetMainPlayer();
	map<CGUID, CPet*>* petList = player->GetPetList();
	map<CGUID, CPet*>::iterator iterPet = petList->begin();
	for (int i=0; iterPet!=petList->end(); ++iterPet,++i)
	{
		sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d/DragContainer", i+1);
		CEGUI::Window* dragItem = mainPage->getChildRecursive(tempText);
		if (dragItem)
		{
			CEGUI::GUISheet* childImg = WGUISheet(dragItem->getChildAtIdx(0));
			if(!childImg)
				return;
			SetBackGroundImage(childImg,"PetID","pictures\\Pet\\PetIcon","pet.jpg");
		}
		if (i>=PET_SELECT_WND_CNT-1)
			break;
	}
}
Example #19
0
void ActiveWidgetHandler::Input_InputModeChanged(Input::InputMode mode)
{
	if (mode != Input::IM_GUI && mLastMode == Input::IM_GUI) {
		//save the current active widget
		CEGUI::Window* window = mGuiManager.getMainSheet()->getActiveChild();
		if (window) {
			mLastActiveWindow = window;
			mLastActiveWindowDestructionStartedConnection = window->subscribeEvent(CEGUI::Window::EventDestructionStarted, CEGUI::Event::Subscriber(&ActiveWidgetHandler::lastActiveWindowDestructionStarted, this));
			window->deactivate();
			//deactivate all parents
			while ((window = window->getParent())) {
				window->deactivate();
			}
		} else {
			mLastActiveWindow = nullptr;
		}
		mLastMode = mode;
	} else if (mode == Input::IM_GUI) {
		if (mLastActiveWindow) {
			//restore the previously active widget
			try {
				mLastActiveWindow->activate();
			} catch (...)
			{
				S_LOG_WARNING("Error when trying to restore previously captured window.");
			}
			mLastActiveWindow = 0;
			mLastActiveWindowDestructionStartedConnection->disconnect();
		}
		mLastMode = mode;
	}
}
void InitPetSelectWnd(CEGUI::Window* mainPage)
{
	if (!mainPage)
		return;

	CEGUI::Window* wnd;
	char tempText[256];

	for (int i = 0; i < PET_SELECT_WND_CNT; ++i)
	{
		sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d/DragContainer", i+1);
		wnd = mainPage->getChildRecursive(tempText);
		if (wnd)
		{
			wnd->setSize(CEGUI::UVector2(cegui_absdim(32 + 0),cegui_absdim(32 + 0)));
			wnd->setPosition(CEGUI::UVector2(cegui_absdim(5),cegui_absdim(5)));
		}

		sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d", i+1);
		wnd = mainPage->getChildRecursive(tempText);
		if (wnd)
		{
			wnd->setSize(CEGUI::UVector2(cegui_absdim(32 + 10),cegui_absdim(32 + 10)));
		}
	}
}
Example #21
0
DynamicEditor::DynamicEditor(FreeCamera* camera, EditorMode* _mode)
:editorModes
({
    {{"position","dimensions"}, new DynamicEditor::DerivedModeFactory<BoxDragMode>()},
    {{"points"}, new DynamicEditor::DerivedModeFactory<PointGeometryMode>()},
    {{"position", "radius"}, new DynamicEditor::DerivedModeFactory<CircleDragMode>()},
    {{"position"}, new DynamicEditor::DerivedModeFactory<ClickPlaceMode>()},
}),
editorVariables
({
    {"skin", new ComponentObjectSelectionVariableFactory<Skin>("skin","StaticSkinFactory")},
}),
params(nullptr)
{
    //ctor
    //entityList = new EntityList("Root/EntityList/Listbox");
    camera->activate();
    mCamera = camera;
    instanceTab = getTabControl("Root/Entities");
    typeTab = getTabControl("Root/EntityTypes");
    entityName = CEGUI::System::getSingleton().getGUISheet()->getChildRecursive("Root/Entities/EntityName");
    //nameVariableController = new NameVariableController(entityName, &params);
    nameVariableControllerFactory = new NameVariableControllerFactory("ThisIsAName", entityName);
    assert(entityName);
    instanceTab->getParent()->setEnabled(false);
    typeTab->getParent()->setEnabled(false);
    instanceTab->getParent()->setVisible(false);
    typeTab->getParent()->setVisible(false);

    CEGUI::Window* button = typeTab->getParent()->getChild("Root/EntityTypes/CreateButton");
    button->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::SubscriberSlot(&DynamicEditor::createFactory,this));
    editorMode = _mode;
}
Example #22
0
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;
}
void time_panel_impl::set_visible(bool visible)
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    root->getChild(label_name)->setVisible(visible);

}
Example #24
0
//更新寄售UI提示
bool UpdateAgentSaleUIDate(const CEGUI::EventArgs& e)
{
	CEGUI::WindowManager& mgr = GetWndMgr();
	CEGUI::Window* wnd = NULL;
	CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditNum"));//寄售数量
	uint cnt = CEGUI::PropertyHelper::stringToInt(edb->getText());

	edb = WEditBox(mgr.getWindow("Auction/Tab/Agent/sale/EditPrice"));//寄售单价
	uint price = CEGUI::PropertyHelper::stringToInt(edb->getText());

	if(cnt == 0 || price == 0)//任意一个为0,则直接返回,不更新UI
	{
		//设置支付手续费提示
		wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold");
		wnd->setText("");
		return false;
	}
	//设置支付位面提示
	wnd = mgr.getWindow("Auction/Tab/Agent/sale/subNum");
	wnd->setText(CEGUI::PropertyHelper::intToString(cnt * ORDER_PER_NUM));
	//设置支付手续费提示
	wnd = mgr.getWindow("Auction/Tab/Agent/sale/subGold");
	float extraCust = cnt * price * AGENT_EXTRACUST ;
	wnd->setText(CEGUI::PropertyHelper::intToString((int)extraCust));
	return true;
}
Example #25
0
void Application::setupCEGUI()
{
	// CEGUI setup
	m_renderer = new CEGUI::OgreCEGUIRenderer(m_window, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, m_sceneManager);
	m_system = new CEGUI::System(m_renderer);

	CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");

	m_system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
	m_system->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");

	CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
	CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "Sheet");

	float distanceBorder = 0.01;
	float sizeX = 0.2;
	float sizeY = 0.05;
	float posX = distanceBorder;
	float posY = distanceBorder;

	debugWindow = win->createWindow("TaharezLook/StaticText", "Widget1");
	debugWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(posX, 0), CEGUI::UDim(posY, 0)));
	debugWindow->setSize(CEGUI::UVector2(CEGUI::UDim(sizeX, 0), CEGUI::UDim(sizeY, 0)));
	debugWindow->setText("Debug Info!");

	sheet->addChildWindow(debugWindow);
	m_system->setGUISheet(sheet);
}
Example #26
0
void EditorGUI::Update(float32 delta)
{
    // Setting the active window
    if (!gInputMgr.IsMouseButtonPressed(InputSystem::MBTN_LEFT) && !gInputMgr.IsMouseButtonPressed(InputSystem::MBTN_RIGHT))
    {
        CEGUI::Window* activeWindow = CEGUI::System::getSingleton().getGUISheet();
        if (!activeWindow || !activeWindow->getActiveChild())
        {
            if (gEditorMgr.IsLockedToGame()) mGameViewport->Activate();
            else mEditorViewport->Activate();
        }
        else
        {
            bool isEditbox = activeWindow->getActiveChild()->getType().compare("Editor/Editbox") == 0;
            bool isPopupMenu = activeWindow->getActiveChild()->getType().compare("Editor/PopupMenu") == 0;
            bool isButton = activeWindow->getActiveChild()->getType().compare("Editor/Button") == 0;
            if (!isEditbox && !isPopupMenu && !isButton)
            {
                if (gEditorMgr.IsLockedToGame() && !mEditorViewport->isCapturedByThis()) mGameViewport->Activate();
                else mEditorViewport->Activate();
            }
        }
    }

    mEntityWindow->Update(delta);

    //gGUIMgr.GetWindow("UserGUI_GameLayout")->invalidate(true);
}
void CREvent::OnPageLoad(GamePage *pPage)
{
	pPage->LoadPageWindow();
	CEGUI::Window *pPageWin = pPage->GetPageWindow();
	CEGUI::PushButton* pCreateBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChild("CreateRole"));
	pCreateBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::OnCreateRoleBtn, this));
	CEGUI::PushButton* pGoBackBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChildRecursive("BackToSelRol"));
	pGoBackBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::GoBackBtn,this));
	SetCreateRoleInitProperty(pPageWin);
	m_bRoleLeftRotate = false;    //向左旋转
	m_bRoleRightRotate = false;   //向右旋转
	if (m_SelectSence == NULL)
	{
		m_SelectSence = new GameScene();
		m_SelectSence->CreateSence("model/interface/selectchar/map",
			"model/interface/selectchar/map/camera_end",
			"model/interface/selectchar/map/envcreature",
			"model/interface/selectchar/map/enveffect");
	}
	CRFile* prfile = rfOpen("data/CreateRolePos.ini");
	if (prfile)
	{
		stringstream stream;
		prfile->ReadToStream(stream);
		rfClose(prfile);
		stream >> s_RolePos[0]  >> s_RolePos[1]  >> s_RolePos[2]  >> s_RolePos[3];
	}
	if(m_pPlayer == NULL)
		m_pPlayer = new CPlayer;
	m_pPlayer->SetGraphicsID(CREvent::GetSelectSex()+1);
	LoadFaceHairIni();
	m_pPlayer->SetDisplayModel();
	m_pPlayer->SetDisplayModelGroup();
}
Example #28
0
File: Dan2.cpp Project: dbabox/aomi
Dan2::Dan2(DanListener * listener):KeyListener(true),_n(0), _time(-1.f),_callback(listener)
{
	_win= CEGUI::WindowManager::getSingleton().loadWindowLayout("Dan2.layout");
	_win->setAlwaysOnTop(true);
	_win->hide();
	CEGUI::Window * f = CEGUI::WindowManager::getSingleton().getWindow("AnimalUI");
	f->addChildWindow(_win);
	for(int i = 0; i<9; ++i)
	{
		_editboxs[i] = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingleton().getWindow("Dan2/Bg/" + Ogre::StringConverter::toString(i+1)));
		_editboxs[i]->setMaxTextLength(1);

		_editboxs[i]->subscribeEvent(CEGUI::Editbox::EventTextAccepted, CEGUI::Event::Subscriber(&Dan2::textAccepted, this));
	}
	
	_editboxs[0]->setValidationString("[1-7]*");
	_editboxs[1]->setValidationString("[1-4]*");
	_editboxs[2]->setValidationString("[1-4]*");
	_editboxs[3]->setValidationString("[1-6]*");
	_editboxs[4]->setValidationString("[0-3]*");
	_editboxs[5]->setValidationString("[0-9]*");
	_editboxs[6]->setValidationString("[1-5]*");
	_editboxs[7]->setValidationString("[1-9]*");
	_editboxs[8]->setValidationString("[1-7]*");
	
}
Example #29
0
_MEMBER_FUNCTION_IMPL(GUIElement, setParent)
{
	const char * parent;
	sq_getstring(pVM, -1, &parent);

	CGUIFrameWindow * pWindow = sq_getinstance<CGUIFrameWindow *>(pVM);

	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}
	
	CEGUI::Window * pParentWindow = NULL;

	try
	{
		pParentWindow = g_pClient->GetGUI()->GetWindowManager()->getWindow(parent);
	}
	catch(CEGUI::UnknownObjectException &e)
	{
		(void)e;
		sq_pushbool(pVM, false);
		return 1;
	}

	pParentWindow->addChildWindow(pWindow);
	sq_pushbool(pVM, true);
	return 1;
}
bool OnPlayerShopResetGoods(const CEGUI::EventArgs& e)
{
	CEGUI::Window* wnd = WEArgs(e).window;
	if(!wnd) return false;

	CGoods* goods = static_cast<CGoods*>(wnd->getUserData());
	if (!goods) return false;

	CPlayer *pPlayer = GetGame()->GetMainPlayer();
	CMainPlayerHand* pHand = GetGame()->GetMainPlayerHand();
	if (!pPlayer || !pHand) return false;
	
	int shopState = GetPlayerShop().GetCurShopState();
	if (shopState==PlayerShop::SET_SHOP)
	{
		GetPlayerShop().ReMoveShopGoods(goods->GetIndex(),goods->GetExID());
		wnd->setUserData(NULL);
		int index = GetPlayerShop().GetCurGoodsNum();
		GetPlayerShop().OnOrderPageOpen(goods, index);

		FireUIEvent("PlayerShop","ClearGoodsInfo");
		FireUIEvent("PlayerShop","UpdateMoneyInfo");

		return true;
	}

	return false;
}