mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 21:45:38 +00:00
finished connecting the dialogue GUI and the dialogue manager
This commit is contained in:
parent
abe38e5f87
commit
c65c160e7b
5 changed files with 45 additions and 11 deletions
|
@ -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);
|
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 "window_manager.hpp"
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
#include "components/esm_store/store.hpp"
|
#include "components/esm_store/store.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
#include "../mwdialogue/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <iostream>
|
#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)
|
DialogueWindow::DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment)
|
||||||
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
|
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager),
|
||||||
|
mEnvironment(environment)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -76,11 +79,16 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||||
UString key = history->getColorTextAt(cursorPosition);
|
UString key = history->getColorTextAt(cursorPosition);
|
||||||
|
|
||||||
//std::cout << "Clicked on key: " << key << std::endl;
|
//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")
|
if(color == "#572D21")
|
||||||
{
|
{
|
||||||
//TODO: send back the answere to the question!
|
//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)
|
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
eventBye();
|
//eventBye();
|
||||||
|
mEnvironment.mDialogueManager->goodbyeSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onSelectTopic(MyGUI::List* _sender, size_t _index)
|
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)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
std::string topic = _sender->getItem(_index);
|
std::string topic = _sender->getItem(_index);
|
||||||
|
mEnvironment.mDialogueManager->keywordSelected(lower_string(topic));
|
||||||
displayTopicText(topic);
|
displayTopicText(topic);
|
||||||
|
|
||||||
//const std::string* theTopic = topicsList->getItemDataAt<std::string>(_index);
|
//const std::string* theTopic = topicsList->getItemDataAt<std::string>(_index);
|
||||||
|
|
|
@ -9,6 +9,11 @@ namespace MWGui
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class Environment;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file contains the dialouge window
|
This file contains the dialouge window
|
||||||
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
||||||
|
@ -23,7 +28,7 @@ namespace MWGui
|
||||||
class DialogueWindow: public WindowBase
|
class DialogueWindow: public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DialogueWindow(WindowManager& parWindowManager);
|
DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment);
|
||||||
|
|
||||||
void open();
|
void open();
|
||||||
|
|
||||||
|
@ -60,6 +65,8 @@ namespace MWGui
|
||||||
MyGUI::ProgressPtr pDispositionBar;
|
MyGUI::ProgressPtr pDispositionBar;
|
||||||
MyGUI::EditPtr pDispositionText;
|
MyGUI::EditPtr pDispositionText;
|
||||||
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
||||||
|
|
||||||
|
MWWorld::Environment& mEnvironment;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,6 +64,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, environment, extensions);
|
||||||
mJournal = new JournalWindow(*this);
|
mJournal = new JournalWindow(*this);
|
||||||
mMessageBoxManager = new MessageBoxManager(this);
|
mMessageBoxManager = new MessageBoxManager(this);
|
||||||
|
dialogueWindow = new DialogueWindow(*this,environment);
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
hud->setVisible(true);
|
hud->setVisible(true);
|
||||||
|
@ -173,6 +174,7 @@ void WindowManager::updateVisible()
|
||||||
#endif
|
#endif
|
||||||
console->disable();
|
console->disable();
|
||||||
mJournal->setVisible(false);
|
mJournal->setVisible(false);
|
||||||
|
dialogueWindow->setVisible(false);
|
||||||
|
|
||||||
// Mouse is visible whenever we're not in game mode
|
// Mouse is visible whenever we're not in game mode
|
||||||
gui->setVisiblePointer(isGuiMode());
|
gui->setVisiblePointer(isGuiMode());
|
||||||
|
@ -338,11 +340,6 @@ void WindowManager::updateVisible()
|
||||||
|
|
||||||
if (mode == GM_Dialogue)
|
if (mode == GM_Dialogue)
|
||||||
{
|
{
|
||||||
if (!dialogueWindow)
|
|
||||||
{
|
|
||||||
dialogueWindow = new DialogueWindow(*this);
|
|
||||||
dialogueWindow->eventBye = MyGUI::newDelegate(this, &WindowManager::onDialogueWindowBye);
|
|
||||||
}
|
|
||||||
dialogueWindow->open();
|
dialogueWindow->open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue