Make TradeWindow not depend on DialogueWindow

new-script-api
scrawl 7 years ago
parent 82a211ba03
commit b7752ec52d

@ -270,6 +270,11 @@ namespace MWGui
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
}
void DialogueWindow::onTradeComplete()
{
addResponse(MyGUI::LanguageManager::getInstance().replaceTags("#{sBarterDialog5}"));
}
bool DialogueWindow::exit()
{
if ((!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())

@ -99,6 +99,8 @@ namespace MWGui
public:
DialogueWindow();
void onTradeComplete();
virtual bool exit();
// Events

@ -27,7 +27,6 @@
#include "containeritemmodel.hpp"
#include "tradeitemmodel.hpp"
#include "countdialog.hpp"
#include "dialogue.hpp"
#include "controllers.hpp"
namespace
@ -358,8 +357,7 @@ namespace MWGui
mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance );
}
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse(
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString());
eventTradeDone();
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);

@ -41,6 +41,9 @@ namespace MWGui
virtual void resetReference();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_TradeDone;
EventHandle_TradeDone eventTradeDone;
private:
ItemView* mItemView;
SortFilterItemModel* mSortModel;

@ -337,7 +337,6 @@ namespace MWGui
mTradeWindow = new TradeWindow();
mWindows.push_back(mTradeWindow);
trackWindow(mTradeWindow, "barter");
mGuiModeStates[GM_Barter] = GuiModeState({mInventoryWindow, mTradeWindow});
mConsole = new Console(w,h, mConsoleOnlyScripts);
@ -366,6 +365,7 @@ namespace MWGui
mWindows.push_back(mDialogueWindow);
trackWindow(mDialogueWindow, "dialogue");
mGuiModeStates[GM_Dialogue] = GuiModeState(mDialogueWindow);
mTradeWindow->eventTradeDone += MyGUI::newDelegate(mDialogueWindow, &DialogueWindow::onTradeComplete);
ContainerWindow* containerWindow = new ContainerWindow(mDragAndDrop);
mWindows.push_back(containerWindow);

Loading…
Cancel
Save