2010-11-03 20:21:08 +00:00
|
|
|
#ifndef MWGUI_DIALOGE_H
|
|
|
|
#define MWGUI_DIALOGE_H
|
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
#include "windowbase.hpp"
|
2012-05-26 23:14:33 +00:00
|
|
|
#include "referenceinterface.hpp"
|
2012-05-17 15:15:44 +00:00
|
|
|
|
2013-05-04 12:15:47 +00:00
|
|
|
#include "bookpage.hpp"
|
|
|
|
|
2014-10-18 17:51:07 +00:00
|
|
|
#include "../mwdialogue/keywordsearch.hpp"
|
2013-05-04 12:15:47 +00:00
|
|
|
|
2014-09-25 14:25:08 +00:00
|
|
|
namespace Gui
|
|
|
|
{
|
|
|
|
class MWList;
|
|
|
|
}
|
|
|
|
|
2011-02-21 19:36:35 +00:00
|
|
|
namespace MWGui
|
2010-11-03 20:21:08 +00:00
|
|
|
{
|
2011-02-21 19:36:35 +00:00
|
|
|
class WindowManager;
|
2010-11-03 20:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2013-05-04 12:15:47 +00:00
|
|
|
class DialogueHistoryViewModel;
|
|
|
|
class BookPage;
|
2010-11-03 20:21:08 +00:00
|
|
|
|
2012-11-09 19:18:38 +00:00
|
|
|
class PersuasionDialog : public WindowModal
|
|
|
|
{
|
|
|
|
public:
|
2013-04-10 18:46:21 +00:00
|
|
|
PersuasionDialog();
|
2012-11-09 19:18:38 +00:00
|
|
|
|
|
|
|
virtual void open();
|
2014-05-27 07:00:31 +00:00
|
|
|
virtual void exit();
|
2012-11-09 19:18:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
MyGUI::Button* mCancelButton;
|
|
|
|
MyGUI::Button* mAdmireButton;
|
|
|
|
MyGUI::Button* mIntimidateButton;
|
|
|
|
MyGUI::Button* mTauntButton;
|
|
|
|
MyGUI::Button* mBribe10Button;
|
|
|
|
MyGUI::Button* mBribe100Button;
|
|
|
|
MyGUI::Button* mBribe1000Button;
|
|
|
|
MyGUI::TextBox* mGoldLabel;
|
|
|
|
|
|
|
|
void onCancel (MyGUI::Widget* sender);
|
|
|
|
void onPersuade (MyGUI::Widget* sender);
|
|
|
|
};
|
|
|
|
|
2013-05-04 12:15:47 +00:00
|
|
|
|
|
|
|
struct Link
|
|
|
|
{
|
|
|
|
virtual ~Link() {}
|
|
|
|
virtual void activated () = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Topic : Link
|
|
|
|
{
|
|
|
|
Topic(const std::string& id) : mTopicId(id) {}
|
|
|
|
std::string mTopicId;
|
|
|
|
virtual void activated ();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Choice : Link
|
|
|
|
{
|
|
|
|
Choice(int id) : mChoiceId(id) {}
|
|
|
|
int mChoiceId;
|
|
|
|
virtual void activated ();
|
|
|
|
};
|
|
|
|
|
2013-05-04 13:15:44 +00:00
|
|
|
struct Goodbye : Link
|
|
|
|
{
|
|
|
|
virtual void activated ();
|
|
|
|
};
|
|
|
|
|
2014-10-18 17:51:07 +00:00
|
|
|
typedef MWDialogue::KeywordSearch <std::string, intptr_t> KeywordSearchT;
|
2013-05-04 12:15:47 +00:00
|
|
|
|
|
|
|
struct DialogueText
|
|
|
|
{
|
|
|
|
virtual ~DialogueText() {}
|
2013-05-06 11:13:14 +00:00
|
|
|
virtual void write (BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const = 0;
|
2013-05-04 12:15:47 +00:00
|
|
|
std::string mText;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Response : DialogueText
|
|
|
|
{
|
|
|
|
Response(const std::string& text, const std::string& title = "");
|
2013-05-06 11:13:14 +00:00
|
|
|
virtual void write (BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const;
|
|
|
|
void addTopicLink (BookTypesetter::Ptr typesetter, intptr_t topicId, size_t begin, size_t end) const;
|
2013-05-04 12:15:47 +00:00
|
|
|
std::string mTitle;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Message : DialogueText
|
|
|
|
{
|
|
|
|
Message(const std::string& text);
|
2013-05-06 11:13:14 +00:00
|
|
|
virtual void write (BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const;
|
2013-05-04 12:15:47 +00:00
|
|
|
};
|
|
|
|
|
2012-05-26 23:14:33 +00:00
|
|
|
class DialogueWindow: public WindowBase, public ReferenceInterface
|
2010-11-03 20:21:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-04-10 18:46:21 +00:00
|
|
|
DialogueWindow();
|
2010-11-03 20:21:08 +00:00
|
|
|
|
2014-05-27 03:13:37 +00:00
|
|
|
virtual void exit();
|
|
|
|
|
2010-11-03 20:21:08 +00:00
|
|
|
// Events
|
2012-04-23 13:29:15 +00:00
|
|
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
2010-11-03 20:21:08 +00:00
|
|
|
|
2013-05-04 12:15:47 +00:00
|
|
|
void notifyLinkClicked (TypesetBook::InteractiveId link);
|
2010-11-03 20:21:08 +00:00
|
|
|
|
2014-06-10 14:00:02 +00:00
|
|
|
void startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory);
|
2012-03-19 17:30:52 +00:00
|
|
|
void setKeywords(std::list<std::string> keyWord);
|
2013-05-04 12:15:47 +00:00
|
|
|
|
|
|
|
void addResponse (const std::string& text, const std::string& title="");
|
|
|
|
|
2012-12-27 15:28:13 +00:00
|
|
|
void addMessageBox(const std::string& text);
|
2013-05-04 12:15:47 +00:00
|
|
|
|
|
|
|
void addChoice(const std::string& choice, int id);
|
|
|
|
void clearChoices();
|
|
|
|
|
2012-05-11 05:18:41 +00:00
|
|
|
void goodbye();
|
2012-11-05 22:16:37 +00:00
|
|
|
void onFrame();
|
2012-01-27 13:50:13 +00:00
|
|
|
|
2012-05-17 12:54:03 +00:00
|
|
|
// make sure to call these before setKeywords()
|
2012-09-22 22:36:20 +00:00
|
|
|
void setServices(int services) { mServices = services; }
|
|
|
|
|
|
|
|
enum Services
|
|
|
|
{
|
|
|
|
Service_Trade = 0x01,
|
|
|
|
Service_BuySpells = 0x02,
|
2012-09-27 06:47:47 +00:00
|
|
|
Service_CreateSpells = 0x04,
|
2012-10-17 16:03:02 +00:00
|
|
|
Service_Enchant = 0x08,
|
2012-10-17 16:17:53 +00:00
|
|
|
Service_Training = 0x10,
|
2013-03-22 13:13:10 +00:00
|
|
|
Service_Travel = 0x20,
|
|
|
|
Service_Repair = 0x40
|
2012-09-22 22:36:20 +00:00
|
|
|
};
|
2012-05-17 12:54:03 +00:00
|
|
|
|
2010-11-03 20:21:08 +00:00
|
|
|
protected:
|
2013-03-09 20:50:01 +00:00
|
|
|
void onSelectTopic(const std::string& topic, int id);
|
2010-11-03 20:21:08 +00:00
|
|
|
void onByeClicked(MyGUI::Widget* _sender);
|
2012-04-29 22:57:41 +00:00
|
|
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
2012-05-10 09:19:22 +00:00
|
|
|
void onWindowResize(MyGUI::Window* _sender);
|
2010-11-03 20:21:08 +00:00
|
|
|
|
2013-05-04 12:15:47 +00:00
|
|
|
void onScrollbarMoved (MyGUI::ScrollBar* sender, size_t pos);
|
|
|
|
|
|
|
|
void updateHistory(bool scrollbar=false);
|
|
|
|
|
2012-05-26 23:14:33 +00:00
|
|
|
virtual void onReferenceUnavailable();
|
|
|
|
|
2010-11-03 20:21:08 +00:00
|
|
|
private:
|
|
|
|
void updateOptions();
|
2014-07-28 00:27:48 +00:00
|
|
|
void restock();
|
2010-11-03 20:21:08 +00:00
|
|
|
|
2012-09-22 22:36:20 +00:00
|
|
|
int mServices;
|
|
|
|
|
2012-05-11 05:18:41 +00:00
|
|
|
bool mEnabled;
|
|
|
|
|
2013-05-04 13:15:44 +00:00
|
|
|
bool mGoodbye;
|
|
|
|
|
2013-05-04 12:15:47 +00:00
|
|
|
std::vector<DialogueText*> mHistoryContents;
|
2014-09-18 02:10:17 +00:00
|
|
|
std::vector<std::pair<std::string, int> > mChoices;
|
2013-05-04 12:15:47 +00:00
|
|
|
|
|
|
|
std::vector<Link*> mLinks;
|
|
|
|
std::map<std::string, Link*> mTopicLinks;
|
|
|
|
|
|
|
|
KeywordSearchT mKeywordSearch;
|
|
|
|
|
|
|
|
BookPage* mHistory;
|
2014-09-25 14:25:08 +00:00
|
|
|
Gui::MWList* mTopicsList;
|
2013-05-04 12:15:47 +00:00
|
|
|
MyGUI::ScrollBar* mScrollBar;
|
2015-01-10 01:50:43 +00:00
|
|
|
MyGUI::ProgressBar* mDispositionBar;
|
2013-03-03 12:11:02 +00:00
|
|
|
MyGUI::EditBox* mDispositionText;
|
2012-11-09 19:18:38 +00:00
|
|
|
|
|
|
|
PersuasionDialog mPersuasionDialog;
|
2010-11-03 20:21:08 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|