Пример #1
0
void EntityCreatorTypeHelper::buildWidget(CEGUI::Tree& typeTree, CEGUI::PushButton& pushButton, CEGUI::Window& modelPreview)
{

	typeTree.setItemTooltipsEnabled(true);
	typeTree.setSortingEnabled(true);

	typeTree.subscribeEvent(CEGUI::Tree::EventSelectionChanged, CEGUI::Event::Subscriber(&EntityCreatorTypeHelper::typeTree_SelectionChanged, this));
	mCreateButton = &pushButton;
	mCreateButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&EntityCreatorTypeHelper::createButton_Click, this));

	mRuleTreeAdapter = new Adapters::Eris::RuleTreeAdapter(mConnection, typeTree);
	mRuleTreeAdapter->refresh("game_entity");

	mModelPreviewRenderer = new ModelRenderer(&modelPreview, "modelPreview");
	mModelPreviewManipulator = new CameraEntityTextureManipulator(modelPreview, mModelPreviewRenderer->getEntityTexture());


	mConnection.getTypeService()->BoundType.connect(sigc::mem_fun(*this, &EntityCreatorTypeHelper::typeService_BoundType));

}
Пример #2
0
/***********************************************************
initalize the box
***********************************************************/
void JournalBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "questbook.layout",
								"", "", &MyPropertyCallback);
		Root->addChildWindow(_myBox);


		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("JournalFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&JournalBox::HandleClose, this));

		CEGUI::Tree * tree = static_cast<CEGUI::Tree *> (
			CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questtab/Tree"));

		tree->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
							CEGUI::Event::Subscriber (&JournalBox::HandleQuestTreeSelected, this));


		CEGUI::Tree * tree2 = static_cast<CEGUI::Tree *> (
			CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questdonetab/Tree"));

		tree2->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
							CEGUI::Event::Subscriber (&JournalBox::HandleQuestDoneTreeSelected, this));


		float PosX = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.PosX", 0.65f);
		float PosY = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.PosY", 0.56f);
		float SizeX = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.SizeX", 0.35f);
		float SizeY = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.SizeY", 0.34f);
		bool Visible = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.Visible", false);
		frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, 0), CEGUI::UDim(PosY, 0)));
		frw->setWidth(CEGUI::UDim(SizeX, 0));
		frw->setHeight(CEGUI::UDim(SizeY, 0));

		if(Visible)
			frw->show();
		else
			frw->hide();


		// get quest topic tree which should be opened
		std::string treeqopen = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestTreeOpen", "");
		std::string treedqopen = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestDoneTreeOpen", "");

		_selected_tree_quests = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestTreeSelected", "");
		_selected_tree_done_quests = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestDoneTreeSelected", "");

		StringHelper::Tokenize(treeqopen, _open_tree_quests, "##");
		StringHelper::Tokenize(treedqopen, _open_tree_done_quests, "##");


		static_cast<CEGUI::TabControl *> (
			CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab"))->setSelectedTab("Root/JournalWin/tab/questtab");
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init InventoryBox: ") + ex.getMessage().c_str());
	}
}