beginnings of trade window layout.

actorid
scrawl 13 years ago
parent 0dc5e5919b
commit 5da4da820e

@ -637,7 +637,7 @@ namespace MWDialogue
//initialise the GUI //initialise the GUI
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Dialogue); MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Dialogue);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->startDialogue(MWWorld::Class::get (actor).getName (actor)); win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor));
//setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI //setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
updateTopics(); updateTopics();

@ -1,11 +1,4 @@
#include "dialogue.hpp" #include "dialogue.hpp"
#include "dialogue_history.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "list.hpp"
#include "components/esm_store/store.hpp"
#include "../mwbase/environment.hpp"
#include "../mwdialogue/dialoguemanager.hpp"
#include <assert.h> #include <assert.h>
#include <iostream> #include <iostream>
@ -14,6 +7,17 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwdialogue/dialoguemanager.hpp"
#include "dialogue_history.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "list.hpp"
#include "tradewindow.hpp"
using namespace MWGui; using namespace MWGui;
using namespace Widgets; using namespace Widgets;
@ -59,9 +63,7 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
//Topics list //Topics list
getWidget(topicsList, "TopicsList"); getWidget(topicsList, "TopicsList");
//topicsList->eventListSelectAccept += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
topicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic); topicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
//topicsList->eventListChangePosition += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
MyGUI::ButtonPtr byeButton; MyGUI::ButtonPtr byeButton;
getWidget(byeButton, "ByeButton"); getWidget(byeButton, "ByeButton");
@ -117,6 +119,9 @@ void DialogueWindow::open()
history->eraseText(0,history->getTextLength()); history->eraseText(0,history->getTextLength());
updateOptions(); updateOptions();
setVisible(true); setVisible(true);
// hide all sub-dialogues of the dialog window (trade window, persuasion, etc)
mWindowManager.getTradeWindow()->setVisible(false);
} }
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender) void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
@ -128,12 +133,20 @@ void DialogueWindow::onSelectTopic(std::string topic)
{ {
if (!mEnabled) return; if (!mEnabled) return;
MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(topic)); if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str)
{
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
mWindowManager.getTradeWindow()->startTrade(mActor);
}
else
MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(topic));
} }
void DialogueWindow::startDialogue(std::string npcName) void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
{ {
mEnabled = true; mEnabled = true;
mActor = actor;
topicsList->setEnabled(true); topicsList->setEnabled(true);
static_cast<MyGUI::Window*>(mMainWidget)->setCaption(npcName); static_cast<MyGUI::Window*>(mMainWidget)->setCaption(npcName);
adjustWindowCaption(); adjustWindowCaption();

@ -4,6 +4,8 @@
#include "window_base.hpp" #include "window_base.hpp"
#include <boost/array.hpp> #include <boost/array.hpp>
#include "../mwworld/ptr.hpp"
namespace MWGui namespace MWGui
{ {
class WindowManager; class WindowManager;
@ -38,7 +40,7 @@ namespace MWGui
*/ */
EventHandle_Void eventBye; EventHandle_Void eventBye;
void startDialogue(std::string npcName); void startDialogue(MWWorld::Ptr actor, std::string npcName);
void stopDialogue(); void stopDialogue();
void setKeywords(std::list<std::string> keyWord); void setKeywords(std::list<std::string> keyWord);
void removeKeyword(std::string keyWord); void removeKeyword(std::string keyWord);
@ -70,6 +72,8 @@ namespace MWGui
bool mEnabled; bool mEnabled;
MWWorld::Ptr mActor; // actor being talked to
DialogueHistory* history; DialogueHistory* history;
Widgets::MWList* topicsList; Widgets::MWList* topicsList;
MyGUI::ProgressPtr pDispositionBar; MyGUI::ProgressPtr pDispositionBar;

@ -7,4 +7,9 @@ namespace MWGui
ContainerBase(NULL) // no drag&drop ContainerBase(NULL) // no drag&drop
{ {
} }
void TradeWindow::startTrade(MWWorld::Ptr actor)
{
ContainerBase::openContainer(actor);
}
} }

@ -4,6 +4,8 @@
#include "container.hpp" #include "container.hpp"
#include "window_base.hpp" #include "window_base.hpp"
#include "../mwworld/ptr.hpp"
namespace MyGUI namespace MyGUI
{ {
class Gui; class Gui;
@ -23,6 +25,8 @@ namespace MWGui
public: public:
TradeWindow(WindowManager& parWindowManager); TradeWindow(WindowManager& parWindowManager);
void startTrade(MWWorld::Ptr actor);
//virtual void Update(); //virtual void Update();
//virtual void notifyContentChanged(); //virtual void notifyContentChanged();

@ -15,6 +15,7 @@
#include "hud.hpp" #include "hud.hpp"
#include "mainmenu.hpp" #include "mainmenu.hpp"
#include "countdialog.hpp" #include "countdialog.hpp"
#include "tradewindow.hpp"
#include "../mwmechanics/mechanicsmanager.hpp" #include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
@ -48,6 +49,7 @@ WindowManager::WindowManager(
, mBookWindow(NULL) , mBookWindow(NULL)
, mScrollWindow(NULL) , mScrollWindow(NULL)
, mCountDialog(NULL) , mCountDialog(NULL)
, mTradeWindow(NULL)
, mCharGen(NULL) , mCharGen(NULL)
, playerClass() , playerClass()
, playerName() , playerName()
@ -114,6 +116,7 @@ WindowManager::WindowManager(
mScrollWindow = new ScrollWindow(*this); mScrollWindow = new ScrollWindow(*this);
mBookWindow = new BookWindow(*this); mBookWindow = new BookWindow(*this);
mCountDialog = new CountDialog(*this); mCountDialog = new CountDialog(*this);
mTradeWindow = new TradeWindow(*this);
// The HUD is always on // The HUD is always on
hud->setVisible(true); hud->setVisible(true);
@ -153,6 +156,7 @@ WindowManager::~WindowManager()
delete mDragAndDrop; delete mDragAndDrop;
delete mBookWindow; delete mBookWindow;
delete mScrollWindow; delete mScrollWindow;
delete mTradeWindow;
cleanupGarbage(); cleanupGarbage();
} }

@ -136,6 +136,7 @@ namespace MWGui
MWGui::BookWindow* getBookWindow() {return mBookWindow;} MWGui::BookWindow* getBookWindow() {return mBookWindow;}
MWGui::ScrollWindow* getScrollWindow() {return mScrollWindow;} MWGui::ScrollWindow* getScrollWindow() {return mScrollWindow;}
MWGui::CountDialog* getCountDialog() {return mCountDialog;} MWGui::CountDialog* getCountDialog() {return mCountDialog;}
MWGui::TradeWindow* getTradeWindow() {return mTradeWindow;}
MyGUI::Gui* getGui() const { return gui; } MyGUI::Gui* getGui() const { return gui; }

@ -56,6 +56,7 @@ configure_file("${SDIR}/openmw_scroll_layout.xml" "${DDIR}/openmw_scroll_layout.
configure_file("${SDIR}/openmw_scroll_skin.xml" "${DDIR}/openmw_scroll_skin.xml" COPYONLY) configure_file("${SDIR}/openmw_scroll_skin.xml" "${DDIR}/openmw_scroll_skin.xml" COPYONLY)
configure_file("${SDIR}/openmw_book_layout.xml" "${DDIR}/openmw_book_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_book_layout.xml" "${DDIR}/openmw_book_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_count_window_layout.xml" "${DDIR}/openmw_count_window_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_count_window_layout.xml" "${DDIR}/openmw_count_window_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_trade_window_layout.xml" "${DDIR}/openmw_trade_window_layout.xml" COPYONLY)
configure_file("${SDIR}/atlas1.cfg" "${DDIR}/atlas1.cfg" COPYONLY) configure_file("${SDIR}/atlas1.cfg" "${DDIR}/atlas1.cfg" COPYONLY)
configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY) configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY)
configure_file("${SDIR}/transparent.png" "${DDIR}/transparent.png" COPYONLY) configure_file("${SDIR}/transparent.png" "${DDIR}/transparent.png" COPYONLY)

Loading…
Cancel
Save