예제 #1
0
	void Application::LoadStates()
	{
		SettingsManager::VectorString values = SettingsManager::getInstance().getValueList("Editor/States/State.List");
		for (SettingsManager::VectorString::const_iterator value = values.begin(); value != values.end(); value ++)
		{
			StateController* state = components::FactoryManager::GetInstance().CreateItem<StateController>(*value);
			if (state != nullptr)
				StateManager::getInstance().registerState(state, *value);
		}

		pugi::xpath_node_set events = SettingsManager::getInstance().getValueNodeList("Editor/States/Event.List");
		for (pugi::xpath_node_set::const_iterator event = events.begin(); event != events.end(); event ++)
		{
			StateManager::getInstance().registerEventState(
				(*event).node().child("From").child_value(),
				(*event).node().child("Name").child_value(),
				(*event).node().child("To").child_value());
		}

		std::string firstState = SettingsManager::getInstance().getValue("Editor/States/FirstState/Name");
		StateManager::getInstance().pushState(firstState);

		std::string firstEvent = SettingsManager::getInstance().getValue("Editor/States/FirstState/Event");
		StateManager::getInstance().stateEvent(firstState, firstEvent);
	}
	void SettingsResourcePathsControl::loadSettings()
	{
		mResourcePaths->removeAllItems();
		SettingsManager::VectorString paths = SettingsManager::getInstance().getValueList("Resources/AdditionalPath.List");
		for (SettingsManager::VectorString::const_iterator item = paths.begin(); item != paths.end(); ++ item)
			mResourcePaths->addItem(*item);
	}
	void SettingsResourcePathsControl::saveSettings()
	{
		SettingsManager::VectorString paths;
		for (size_t index = 0; index < mResourcePaths->getItemCount(); ++ index)
			paths.push_back(mResourcePaths->getItemNameAt(index));
		SettingsManager::getInstance().setValueList("Resources/AdditionalPath.List", paths);
	}
예제 #4
0
	SettingsManager::VectorString SettingsManager::getValueList(const std::string& _path)
	{
		SettingsManager::VectorString result;
		std::string path = _path + "/Value";

		pugi::xpath_node_set nodes = mUserDocument->document_element().select_nodes(path.c_str());
		if (!nodes.empty())
		{
			for (pugi::xpath_node_set::const_iterator node = nodes.begin(); node != nodes.end(); node ++)
				result.push_back((*node).node().child_value());
		}
		else
		{
			nodes = mDocument->document_element().select_nodes(path.c_str());
			for (pugi::xpath_node_set::const_iterator node = nodes.begin(); node != nodes.end(); node ++)
				result.push_back((*node).node().child_value());
		}

		return result;
	}
예제 #5
0
	void EditorState::command_UpdateResources(const MyGUI::UString& _commandName, bool& _result)
	{
		if (!checkCommand())
			return;

		SettingsManager::VectorString resources = SettingsManager::getInstance().getValueList("Resources/UpdateResource.List");
		if (resources.empty())
			return;

		for (SettingsManager::VectorString::iterator resource = resources.begin(); resource != resources.end(); ++resource)
			MyGUI::ResourceManager::getInstance().load(*resource);

		MyGUI::xml::Document* savedDoc = EditorWidgets::getInstance().savexmlDocument();
		EditorWidgets::getInstance().clear();
		EditorWidgets::getInstance().loadxmlDocument(savedDoc);
		delete savedDoc;
		WidgetSelectorManager::getInstance().setSelectedWidget(nullptr);

		_result = true;
	}