mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
finished connecting the dialogue GUI and the dialogue manager
This commit is contained in:
parent
abe38e5f87
commit
c65c160e7b
@ -307,4 +307,19 @@ namespace MWDialogue
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueManager::keywordSelected(std::string keyword)
|
||||
{
|
||||
std::cout << "keyword" << keyword;
|
||||
}
|
||||
|
||||
void DialogueManager::goodbyeSelected()
|
||||
{
|
||||
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Game);
|
||||
}
|
||||
|
||||
void DialogueManager::questionAnswered(std::string answere)
|
||||
{
|
||||
std::cout << "and the ansere is..."<< answere;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,11 @@ namespace MWDialogue
|
||||
|
||||
void startDialogue (const MWWorld::Ptr& actor);
|
||||
|
||||
//calbacks for the GUI
|
||||
void keywordSelected(std::string keyword);
|
||||
void goodbyeSelected();
|
||||
void questionAnswered(std::string answere);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwdialogue/dialoguemanager.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
@ -31,8 +33,9 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
|
||||
}
|
||||
|
||||
|
||||
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
|
||||
DialogueWindow::DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment)
|
||||
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager),
|
||||
mEnvironment(environment)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
@ -76,11 +79,16 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||
UString key = history->getColorTextAt(cursorPosition);
|
||||
|
||||
//std::cout << "Clicked on key: " << key << std::endl;
|
||||
if(color == "#686EBA") displayTopicText(lower_string(key));
|
||||
if(color == "#686EBA")
|
||||
{
|
||||
mEnvironment.mDialogueManager->keywordSelected(lower_string(key));
|
||||
displayTopicText(lower_string(key));
|
||||
}
|
||||
if(color == "#572D21")
|
||||
{
|
||||
//TODO: send back the answere to the question!
|
||||
std::cout << "and the ansere is..."<< key;
|
||||
mEnvironment.mDialogueManager->questionAnswered(key);
|
||||
//std::cout << "and the ansere is..."<< key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +105,8 @@ void DialogueWindow::open()
|
||||
|
||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventBye();
|
||||
//eventBye();
|
||||
mEnvironment.mDialogueManager->goodbyeSelected();
|
||||
}
|
||||
|
||||
void DialogueWindow::onSelectTopic(MyGUI::List* _sender, size_t _index)
|
||||
@ -105,6 +114,7 @@ void DialogueWindow::onSelectTopic(MyGUI::List* _sender, size_t _index)
|
||||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
std::string topic = _sender->getItem(_index);
|
||||
mEnvironment.mDialogueManager->keywordSelected(lower_string(topic));
|
||||
displayTopicText(topic);
|
||||
|
||||
//const std::string* theTopic = topicsList->getItemDataAt<std::string>(_index);
|
||||
|
@ -9,6 +9,11 @@ namespace MWGui
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Environment;
|
||||
}
|
||||
|
||||
/*
|
||||
This file contains the dialouge window
|
||||
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
||||
@ -23,7 +28,7 @@ namespace MWGui
|
||||
class DialogueWindow: public WindowBase
|
||||
{
|
||||
public:
|
||||
DialogueWindow(WindowManager& parWindowManager);
|
||||
DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment);
|
||||
|
||||
void open();
|
||||
|
||||
@ -60,6 +65,8 @@ namespace MWGui
|
||||
MyGUI::ProgressPtr pDispositionBar;
|
||||
MyGUI::EditPtr pDispositionText;
|
||||
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
||||
|
||||
MWWorld::Environment& mEnvironment;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -64,6 +64,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||
console = new Console(w,h, environment, extensions);
|
||||
mJournal = new JournalWindow(*this);
|
||||
mMessageBoxManager = new MessageBoxManager(this);
|
||||
dialogueWindow = new DialogueWindow(*this,environment);
|
||||
|
||||
// The HUD is always on
|
||||
hud->setVisible(true);
|
||||
@ -173,6 +174,7 @@ void WindowManager::updateVisible()
|
||||
#endif
|
||||
console->disable();
|
||||
mJournal->setVisible(false);
|
||||
dialogueWindow->setVisible(false);
|
||||
|
||||
// Mouse is visible whenever we're not in game mode
|
||||
gui->setVisiblePointer(isGuiMode());
|
||||
@ -338,11 +340,6 @@ void WindowManager::updateVisible()
|
||||
|
||||
if (mode == GM_Dialogue)
|
||||
{
|
||||
if (!dialogueWindow)
|
||||
{
|
||||
dialogueWindow = new DialogueWindow(*this);
|
||||
dialogueWindow->eventBye = MyGUI::newDelegate(this, &WindowManager::onDialogueWindowBye);
|
||||
}
|
||||
dialogueWindow->open();
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user