forked from mirror/openmw-tes3mp
Merge pull request #1481 from scrawl/keyfocus
WindowManager overhaul & improved keyboard support
This commit is contained in:
commit
64e27c032b
144 changed files with 2069 additions and 1613 deletions
|
@ -42,7 +42,7 @@ add_openmw_dir (mwgui
|
||||||
itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview
|
itemmodel containeritemmodel inventoryitemmodel sortfilteritemmodel itemview
|
||||||
tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog
|
tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog
|
||||||
recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview
|
recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview
|
||||||
draganddrop timeadvancer jailscreen itemchargeview
|
draganddrop timeadvancer jailscreen itemchargeview keyboardnavigation
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwdialogue
|
add_openmw_dir (mwdialogue
|
||||||
|
|
|
@ -161,11 +161,6 @@ void OMW::Engine::frame(float frametime)
|
||||||
|
|
||||||
// update GUI
|
// update GUI
|
||||||
mEnvironment.getWindowManager()->onFrame(frametime);
|
mEnvironment.getWindowManager()->onFrame(frametime);
|
||||||
if (mEnvironment.getStateManager()->getState()!=
|
|
||||||
MWBase::StateManager::State_NoGame)
|
|
||||||
{
|
|
||||||
mEnvironment.getWindowManager()->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int frameNumber = mViewer->getFrameStamp()->getFrameNumber();
|
unsigned int frameNumber = mViewer->getFrameStamp()->getFrameNumber();
|
||||||
osg::Stats* stats = mViewer->getViewerStats();
|
osg::Stats* stats = mViewer->getViewerStats();
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define GAME_MWBASE_DIALOGUEMANAGER_H
|
#define GAME_MWBASE_DIALOGUEMANAGER_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -42,24 +44,29 @@ namespace MWBase
|
||||||
|
|
||||||
virtual bool isInChoice() const = 0;
|
virtual bool isInChoice() const = 0;
|
||||||
|
|
||||||
virtual void startDialogue (const MWWorld::Ptr& actor) = 0;
|
typedef std::pair<std::string, std::string> Response; // title, text
|
||||||
|
virtual bool startDialogue (const MWWorld::Ptr& actor, Response& response) = 0;
|
||||||
|
|
||||||
virtual void addTopic (const std::string& topic) = 0;
|
virtual void addTopic (const std::string& topic) = 0;
|
||||||
|
|
||||||
virtual void askQuestion (const std::string& question,int choice) = 0;
|
virtual void addChoice (const std::string& text,int choice) = 0;
|
||||||
|
virtual const std::vector<std::pair<std::string, int> >& getChoices() = 0;
|
||||||
|
|
||||||
|
virtual bool isGoodbye() = 0;
|
||||||
|
|
||||||
virtual void goodbye() = 0;
|
virtual void goodbye() = 0;
|
||||||
|
|
||||||
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0;
|
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0;
|
||||||
|
|
||||||
//calbacks for the GUI
|
virtual Response keywordSelected (const std::string& keyword) = 0;
|
||||||
virtual void keywordSelected (const std::string& keyword) = 0;
|
|
||||||
virtual void goodbyeSelected() = 0;
|
virtual void goodbyeSelected() = 0;
|
||||||
virtual void questionAnswered (int answer) = 0;
|
virtual Response questionAnswered (int answer) = 0;
|
||||||
|
|
||||||
virtual bool checkServiceRefused () = 0;
|
virtual std::list<std::string> getAvailableTopics() = 0;
|
||||||
|
|
||||||
virtual void persuade (int type) = 0;
|
virtual bool checkServiceRefused (Response& response) = 0;
|
||||||
|
|
||||||
|
virtual Response persuade (int type) = 0;
|
||||||
virtual int getTemporaryDispositionChange () const = 0;
|
virtual int getTemporaryDispositionChange () const = 0;
|
||||||
|
|
||||||
/// @note This change is temporary and gets discarded when dialogue ends.
|
/// @note This change is temporary and gets discarded when dialogue ends.
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include <MyGUI_KeyCode.h>
|
||||||
|
|
||||||
#include "../mwgui/mode.hpp"
|
#include "../mwgui/mode.hpp"
|
||||||
|
|
||||||
namespace Loading
|
namespace Loading
|
||||||
|
@ -100,23 +102,17 @@ namespace MWBase
|
||||||
|
|
||||||
virtual ~WindowManager() {}
|
virtual ~WindowManager() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Should be called each frame to update windows/gui elements.
|
|
||||||
* This could mean updating sizes of gui elements or opening
|
|
||||||
* new dialogs.
|
|
||||||
*/
|
|
||||||
virtual void update() = 0;
|
|
||||||
|
|
||||||
/// @note This method will block until the video finishes playing
|
/// @note This method will block until the video finishes playing
|
||||||
/// (and will continually update the window while doing so)
|
/// (and will continually update the window while doing so)
|
||||||
virtual void playVideo(const std::string& name, bool allowSkipping) = 0;
|
virtual void playVideo(const std::string& name, bool allowSkipping) = 0;
|
||||||
|
|
||||||
virtual void setNewGame(bool newgame) = 0;
|
virtual void setNewGame(bool newgame) = 0;
|
||||||
|
|
||||||
|
virtual void pushGuiMode (MWGui::GuiMode mode, const MWWorld::Ptr& arg) = 0;
|
||||||
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
||||||
virtual void popGuiMode() = 0;
|
virtual void popGuiMode(bool noSound=false) = 0;
|
||||||
|
|
||||||
virtual void removeGuiMode (MWGui::GuiMode mode) = 0;
|
virtual void removeGuiMode (MWGui::GuiMode mode, bool noSound=false) = 0;
|
||||||
///< can be anywhere in the stack
|
///< can be anywhere in the stack
|
||||||
|
|
||||||
virtual void goToJail(int days) = 0;
|
virtual void goToJail(int days) = 0;
|
||||||
|
@ -144,7 +140,6 @@ namespace MWBase
|
||||||
virtual bool isAllowed (MWGui::GuiWindow wnd) const = 0;
|
virtual bool isAllowed (MWGui::GuiWindow wnd) const = 0;
|
||||||
|
|
||||||
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||||
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
|
||||||
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
||||||
virtual MWGui::CountDialog* getCountDialog() = 0;
|
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||||
|
@ -185,6 +180,7 @@ namespace MWBase
|
||||||
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y) = 0;
|
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y) = 0;
|
||||||
|
|
||||||
virtual void setCursorVisible(bool visible) = 0;
|
virtual void setCursorVisible(bool visible) = 0;
|
||||||
|
virtual void setCursorActive(bool active) = 0;
|
||||||
virtual void getMousePosition(int &x, int &y) = 0;
|
virtual void getMousePosition(int &x, int &y) = 0;
|
||||||
virtual void getMousePosition(float &x, float &y) = 0;
|
virtual void getMousePosition(float &x, float &y) = 0;
|
||||||
virtual void setDragDrop(bool dragDrop) = 0;
|
virtual void setDragDrop(bool dragDrop) = 0;
|
||||||
|
@ -228,7 +224,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void showCrosshair(bool show) = 0;
|
virtual void showCrosshair(bool show) = 0;
|
||||||
virtual bool getSubtitlesEnabled() = 0;
|
virtual bool getSubtitlesEnabled() = 0;
|
||||||
virtual bool toggleGui() = 0;
|
virtual bool toggleHud() = 0;
|
||||||
|
|
||||||
virtual void disallowMouse() = 0;
|
virtual void disallowMouse() = 0;
|
||||||
virtual void allowMouse() = 0;
|
virtual void allowMouse() = 0;
|
||||||
|
@ -282,21 +278,6 @@ namespace MWBase
|
||||||
virtual bool getPlayerSleeping() = 0;
|
virtual bool getPlayerSleeping() = 0;
|
||||||
virtual void wakeUpPlayer() = 0;
|
virtual void wakeUpPlayer() = 0;
|
||||||
|
|
||||||
virtual void showCompanionWindow(MWWorld::Ptr actor) = 0;
|
|
||||||
virtual void startSpellMaking(MWWorld::Ptr actor) = 0;
|
|
||||||
virtual void startEnchanting(MWWorld::Ptr actor) = 0;
|
|
||||||
virtual void startRecharge(MWWorld::Ptr soulgem) = 0;
|
|
||||||
virtual void startSelfEnchanting(MWWorld::Ptr soulgem) = 0;
|
|
||||||
virtual void startTraining(MWWorld::Ptr actor) = 0;
|
|
||||||
virtual void startRepair(MWWorld::Ptr actor) = 0;
|
|
||||||
virtual void startRepairItem(MWWorld::Ptr item) = 0;
|
|
||||||
virtual void startTravel(const MWWorld::Ptr& actor) = 0;
|
|
||||||
virtual void startSpellBuying(const MWWorld::Ptr& actor) = 0;
|
|
||||||
virtual void startTrade(const MWWorld::Ptr& actor) = 0;
|
|
||||||
virtual void openContainer(const MWWorld::Ptr& container, bool loot) = 0;
|
|
||||||
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton) = 0;
|
|
||||||
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton) = 0;
|
|
||||||
|
|
||||||
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
||||||
|
|
||||||
virtual void changePointer (const std::string& name) = 0;
|
virtual void changePointer (const std::string& name) = 0;
|
||||||
|
@ -338,11 +319,11 @@ namespace MWBase
|
||||||
virtual void pinWindow (MWGui::GuiWindow window) = 0;
|
virtual void pinWindow (MWGui::GuiWindow window) = 0;
|
||||||
|
|
||||||
/// Fade the screen in, over \a time seconds
|
/// Fade the screen in, over \a time seconds
|
||||||
virtual void fadeScreenIn(const float time, bool clearQueue=true) = 0;
|
virtual void fadeScreenIn(const float time, bool clearQueue=true, float delay=0.f) = 0;
|
||||||
/// Fade the screen out to black, over \a time seconds
|
/// Fade the screen out to black, over \a time seconds
|
||||||
virtual void fadeScreenOut(const float time, bool clearQueue=true) = 0;
|
virtual void fadeScreenOut(const float time, bool clearQueue=true, float delay=0.f) = 0;
|
||||||
/// Fade the screen to a specified percentage of black, over \a time seconds
|
/// Fade the screen to a specified percentage of black, over \a time seconds
|
||||||
virtual void fadeScreenTo(const int percent, const float time, bool clearQueue=true) = 0;
|
virtual void fadeScreenTo(const int percent, const float time, bool clearQueue=true, float delay=0.f) = 0;
|
||||||
/// Darken the screen to a specified percentage
|
/// Darken the screen to a specified percentage
|
||||||
virtual void setBlindness(const int percent) = 0;
|
virtual void setBlindness(const int percent) = 0;
|
||||||
|
|
||||||
|
@ -368,6 +349,8 @@ namespace MWBase
|
||||||
virtual void writeFog(MWWorld::CellStore* cell) = 0;
|
virtual void writeFog(MWWorld::CellStore* cell) = 0;
|
||||||
|
|
||||||
virtual const MWGui::TextColours& getTextColours() = 0;
|
virtual const MWGui::TextColours& getTextColours() = 0;
|
||||||
|
|
||||||
|
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -457,11 +457,11 @@ namespace MWClass
|
||||||
|
|
||||||
// by default user can loot friendly actors during death animation
|
// by default user can loot friendly actors during death animation
|
||||||
if (canLoot && !stats.getAiSequence().isInCombat())
|
if (canLoot && !stats.getAiSequence().isInCombat())
|
||||||
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
|
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
|
||||||
|
|
||||||
// otherwise wait until death animation
|
// otherwise wait until death animation
|
||||||
if(stats.isDeathAnimationFinished())
|
if(stats.isDeathAnimationFinished())
|
||||||
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
|
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
|
||||||
|
|
||||||
// death animation is not finished, do nothing
|
// death animation is not finished, do nothing
|
||||||
return std::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction(""));
|
return std::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction(""));
|
||||||
|
|
|
@ -872,11 +872,11 @@ namespace MWClass
|
||||||
|
|
||||||
// by default user can loot friendly actors during death animation
|
// by default user can loot friendly actors during death animation
|
||||||
if (canLoot && !stats.getAiSequence().isInCombat())
|
if (canLoot && !stats.getAiSequence().isInCombat())
|
||||||
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
|
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
|
||||||
|
|
||||||
// otherwise wait until death animation
|
// otherwise wait until death animation
|
||||||
if(stats.isDeathAnimationFinished())
|
if(stats.isDeathAnimationFinished())
|
||||||
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
|
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
|
||||||
|
|
||||||
// death animation is not finished, do nothing
|
// death animation is not finished, do nothing
|
||||||
return std::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction(""));
|
return std::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction(""));
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <components/esm/loaddial.hpp>
|
#include <components/esm/loaddial.hpp>
|
||||||
#include <components/esm/loadinfo.hpp>
|
#include <components/esm/loadinfo.hpp>
|
||||||
|
@ -33,8 +34,6 @@
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwgui/dialogue.hpp"
|
|
||||||
|
|
||||||
#include "../mwscript/compilercontext.hpp"
|
#include "../mwscript/compilercontext.hpp"
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
#include "../mwscript/interpretercontext.hpp"
|
||||||
#include "../mwscript/extensions.hpp"
|
#include "../mwscript/extensions.hpp"
|
||||||
|
@ -59,16 +58,8 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
mIsInChoice = false;
|
mIsInChoice = false;
|
||||||
|
mGoodbye = false;
|
||||||
mCompilerContext.setExtensions (&extensions);
|
mCompilerContext.setExtensions (&extensions);
|
||||||
|
|
||||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
|
||||||
|
|
||||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
|
||||||
for (; it != dialogs.end(); ++it)
|
|
||||||
{
|
|
||||||
mDialogueMap[Misc::StringUtils::lowerCase(it->mId)] = *it;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::clear()
|
void DialogueManager::clear()
|
||||||
|
@ -108,17 +99,15 @@ namespace MWDialogue
|
||||||
if (mActorKnownTopics.count( topicId ))
|
if (mActorKnownTopics.count( topicId ))
|
||||||
mKnownTopics.insert( topicId );
|
mKnownTopics.insert( topicId );
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTopics();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::startDialogue (const MWWorld::Ptr& actor)
|
bool DialogueManager::startDialogue (const MWWorld::Ptr& actor, Response& response)
|
||||||
{
|
{
|
||||||
updateGlobals();
|
updateGlobals();
|
||||||
|
|
||||||
// Dialogue with dead actor (e.g. through script) should not be allowed.
|
// Dialogue with dead actor (e.g. through script) should not be allowed.
|
||||||
if (actor.getClass().getCreatureStats(actor).isDead())
|
if (actor.getClass().getCreatureStats(actor).isDead())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
mLastTopic = "";
|
mLastTopic = "";
|
||||||
mPermanentDispositionChange = 0;
|
mPermanentDispositionChange = 0;
|
||||||
|
@ -126,6 +115,8 @@ namespace MWDialogue
|
||||||
|
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
mIsInChoice = false;
|
mIsInChoice = false;
|
||||||
|
mGoodbye = false;
|
||||||
|
mChoices.clear();
|
||||||
|
|
||||||
mActor = actor;
|
mActor = actor;
|
||||||
|
|
||||||
|
@ -134,13 +125,6 @@ namespace MWDialogue
|
||||||
|
|
||||||
mActorKnownTopics.clear();
|
mActorKnownTopics.clear();
|
||||||
|
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
|
||||||
|
|
||||||
// If the dialogue window was already open, keep the existing history
|
|
||||||
bool resetHistory = (!MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue));
|
|
||||||
|
|
||||||
win->startDialogue(actor, actor.getClass().getName (actor), resetHistory);
|
|
||||||
|
|
||||||
//greeting
|
//greeting
|
||||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
@ -154,9 +138,6 @@ namespace MWDialogue
|
||||||
// Search a response (we do not accept a fallback to "Info refusal" here)
|
// Search a response (we do not accept a fallback to "Info refusal" here)
|
||||||
if (const ESM::DialInfo *info = filter.search (*it, false))
|
if (const ESM::DialInfo *info = filter.search (*it, false))
|
||||||
{
|
{
|
||||||
//initialise the GUI
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Dialogue);
|
|
||||||
|
|
||||||
creatureStats.talkedToPlayer();
|
creatureStats.talkedToPlayer();
|
||||||
|
|
||||||
if (!info->mSound.empty())
|
if (!info->mSound.empty())
|
||||||
|
@ -165,29 +146,23 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
|
|
||||||
// first topics update so that parseText knows the keywords to highlight
|
// first topics update so that parseText knows the keywords to highlight
|
||||||
updateTopics();
|
updateActorKnownTopics();
|
||||||
|
|
||||||
parseText (info->mResponse);
|
parseText (info->mResponse);
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), "", false);
|
response = Response ("", Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
||||||
executeScript (info->mResultScript, mActor);
|
executeScript (info->mResultScript, mActor);
|
||||||
mLastTopic = Misc::StringUtils::lowerCase(it->mId);
|
mLastTopic = it->mId;
|
||||||
|
|
||||||
// update topics again to accommodate changes resulting from executeScript
|
// update topics again to accommodate changes resulting from executeScript
|
||||||
updateTopics();
|
updateActorKnownTopics();
|
||||||
|
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
// No greetings found. The dialogue window should not be shown.
|
|
||||||
// If this is a companion, we must show the companion window directly (used by BM_bear_be_unique).
|
|
||||||
bool isCompanion = !mActor.getClass().getScript(mActor).empty()
|
|
||||||
&& mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion");
|
|
||||||
if (isCompanion)
|
|
||||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogueManager::compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor)
|
bool DialogueManager::compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor)
|
||||||
|
@ -265,8 +240,9 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::executeTopic (const std::string& topic)
|
DialogueManager::Response DialogueManager::executeTopic (const std::string& topic)
|
||||||
{
|
{
|
||||||
|
DialogueManager::Response response;
|
||||||
Filter filter (mActor, mChoice, mTalkedTo);
|
Filter filter (mActor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
const MWWorld::Store<ESM::Dialogue> &dialogues =
|
const MWWorld::Store<ESM::Dialogue> &dialogues =
|
||||||
|
@ -274,8 +250,6 @@ namespace MWDialogue
|
||||||
|
|
||||||
const ESM::Dialogue& dialogue = *dialogues.find (topic);
|
const ESM::Dialogue& dialogue = *dialogues.find (topic);
|
||||||
|
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
|
||||||
|
|
||||||
const ESM::DialInfo* info = filter.search(dialogue, true);
|
const ESM::DialInfo* info = filter.search(dialogue, true);
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
|
@ -300,7 +274,7 @@ namespace MWDialogue
|
||||||
title = topic;
|
title = topic;
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), title);
|
response = Response(title, Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
||||||
|
|
||||||
if (dialogue.mType == ESM::Dialogue::Topic)
|
if (dialogue.mType == ESM::Dialogue::Topic)
|
||||||
{
|
{
|
||||||
|
@ -311,7 +285,7 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
if (iter->mId == info->mId)
|
if (iter->mId == info->mId)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getJournal()->addTopic (topic, info->mId, mActor);
|
MWBase::Environment::get().getJournal()->addTopic (Misc::StringUtils::lowerCase(topic), info->mId, mActor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,11 +295,12 @@ namespace MWDialogue
|
||||||
|
|
||||||
mLastTopic = topic;
|
mLastTopic = topic;
|
||||||
}
|
}
|
||||||
else
|
return response;
|
||||||
{
|
|
||||||
// no response found, print a fallback text
|
|
||||||
win->addResponse ("…", topic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ESM::Dialogue *DialogueManager::searchDialogue(const std::string& id)
|
||||||
|
{
|
||||||
|
return MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().search(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::updateGlobals()
|
void DialogueManager::updateGlobals()
|
||||||
|
@ -333,19 +308,16 @@ namespace MWDialogue
|
||||||
MWBase::Environment::get().getWorld()->updateDialogueGlobals();
|
MWBase::Environment::get().getWorld()->updateDialogueGlobals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::updateTopics()
|
void DialogueManager::updateActorKnownTopics()
|
||||||
{
|
{
|
||||||
updateGlobals();
|
updateGlobals();
|
||||||
|
|
||||||
std::list<std::string> keywordList;
|
|
||||||
int choice = mChoice;
|
|
||||||
mChoice = -1;
|
|
||||||
mActorKnownTopics.clear();
|
mActorKnownTopics.clear();
|
||||||
|
|
||||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
|
||||||
Filter filter (mActor, mChoice, mTalkedTo);
|
Filter filter (mActor, -1, mTalkedTo);
|
||||||
|
|
||||||
for (MWWorld::Store<ESM::Dialogue>::iterator iter = dialogs.begin(); iter != dialogs.end(); ++iter)
|
for (MWWorld::Store<ESM::Dialogue>::iterator iter = dialogs.begin(); iter != dialogs.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
@ -355,90 +327,42 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
std::string lower = Misc::StringUtils::lowerCase(iter->mId);
|
std::string lower = Misc::StringUtils::lowerCase(iter->mId);
|
||||||
mActorKnownTopics.insert (lower);
|
mActorKnownTopics.insert (lower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<std::string> DialogueManager::getAvailableTopics()
|
||||||
|
{
|
||||||
|
updateActorKnownTopics();
|
||||||
|
|
||||||
|
std::list<std::string> keywordList;
|
||||||
|
|
||||||
|
for (const std::string& topic : mActorKnownTopics)
|
||||||
|
{
|
||||||
//does the player know the topic?
|
//does the player know the topic?
|
||||||
if (mKnownTopics.count(lower))
|
if (mKnownTopics.count(Misc::StringUtils::lowerCase(topic)))
|
||||||
{
|
keywordList.push_back(topic);
|
||||||
keywordList.push_back (iter->mId);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the available services of this actor
|
|
||||||
int services = 0;
|
|
||||||
if (mActor.getTypeName() == typeid(ESM::NPC).name())
|
|
||||||
{
|
|
||||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mActor.get<ESM::NPC>();
|
|
||||||
if (ref->mBase->mHasAI)
|
|
||||||
services = ref->mBase->mAiData.mServices;
|
|
||||||
}
|
|
||||||
else if (mActor.getTypeName() == typeid(ESM::Creature).name())
|
|
||||||
{
|
|
||||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mActor.get<ESM::Creature>();
|
|
||||||
if (ref->mBase->mHasAI)
|
|
||||||
services = ref->mBase->mAiData.mServices;
|
|
||||||
}
|
|
||||||
|
|
||||||
int windowServices = 0;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Weapon
|
|
||||||
|| services & ESM::NPC::Armor
|
|
||||||
|| services & ESM::NPC::Clothing
|
|
||||||
|| services & ESM::NPC::Books
|
|
||||||
|| services & ESM::NPC::Ingredients
|
|
||||||
|| services & ESM::NPC::Picks
|
|
||||||
|| services & ESM::NPC::Probes
|
|
||||||
|| services & ESM::NPC::Lights
|
|
||||||
|| services & ESM::NPC::Apparatus
|
|
||||||
|| services & ESM::NPC::RepairItem
|
|
||||||
|| services & ESM::NPC::Misc)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
|
||||||
|
|
||||||
if((mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->getTransport().empty())
|
|
||||||
|| (mActor.getTypeName() == typeid(ESM::Creature).name() && !mActor.get<ESM::Creature>()->mBase->getTransport().empty()))
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Spells)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_BuySpells;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Spellmaking)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_CreateSpells;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Training)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Training;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Enchanting)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Enchant;
|
|
||||||
|
|
||||||
if (services & ESM::NPC::Repair)
|
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Repair;
|
|
||||||
|
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
|
||||||
|
|
||||||
win->setServices (windowServices);
|
|
||||||
|
|
||||||
// sort again, because the previous sort was case-sensitive
|
// sort again, because the previous sort was case-sensitive
|
||||||
keywordList.sort(Misc::StringUtils::ciLess);
|
keywordList.sort(Misc::StringUtils::ciLess);
|
||||||
win->setKeywords(keywordList);
|
return keywordList;
|
||||||
|
|
||||||
mChoice = choice;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::keywordSelected (const std::string& keyword)
|
DialogueManager::Response DialogueManager::keywordSelected (const std::string& keyword)
|
||||||
{
|
{
|
||||||
|
Response response;
|
||||||
if(!mIsInChoice)
|
if(!mIsInChoice)
|
||||||
{
|
{
|
||||||
if(mDialogueMap.find(keyword) != mDialogueMap.end())
|
const ESM::Dialogue* dialogue = searchDialogue(keyword);
|
||||||
|
if (dialogue && dialogue->mType == ESM::Dialogue::Topic)
|
||||||
{
|
{
|
||||||
if (mDialogueMap[keyword].mType == ESM::Dialogue::Topic)
|
response = executeTopic (keyword);
|
||||||
{
|
|
||||||
executeTopic (keyword);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return response;
|
||||||
|
|
||||||
updateTopics();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogueManager::isInChoice() const
|
bool DialogueManager::isInChoice() const
|
||||||
|
@ -448,8 +372,6 @@ namespace MWDialogue
|
||||||
|
|
||||||
void DialogueManager::goodbyeSelected()
|
void DialogueManager::goodbyeSelected()
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
|
||||||
|
|
||||||
// Apply disposition change to NPC's base disposition
|
// Apply disposition change to NPC's base disposition
|
||||||
if (mActor.getClass().isNpc())
|
if (mActor.getClass().isNpc())
|
||||||
{
|
{
|
||||||
|
@ -465,37 +387,38 @@ namespace MWDialogue
|
||||||
mTemporaryDispositionChange = 0;
|
mTemporaryDispositionChange = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::questionAnswered (int answer)
|
DialogueManager::Response DialogueManager::questionAnswered (int answer)
|
||||||
{
|
{
|
||||||
mChoice = answer;
|
mChoice = answer;
|
||||||
|
DialogueManager::Response response;
|
||||||
|
|
||||||
if (mDialogueMap.find(mLastTopic) != mDialogueMap.end())
|
const ESM::Dialogue* dialogue = searchDialogue(mLastTopic);
|
||||||
|
if (dialogue)
|
||||||
{
|
{
|
||||||
Filter filter (mActor, mChoice, mTalkedTo);
|
Filter filter (mActor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
if (mDialogueMap[mLastTopic].mType == ESM::Dialogue::Topic
|
if (dialogue->mType == ESM::Dialogue::Topic || dialogue->mType == ESM::Dialogue::Greeting)
|
||||||
|| mDialogueMap[mLastTopic].mType == ESM::Dialogue::Greeting)
|
|
||||||
{
|
{
|
||||||
if (const ESM::DialInfo *info = filter.search (mDialogueMap[mLastTopic], true))
|
if (const ESM::DialInfo *info = filter.search (*dialogue, true))
|
||||||
{
|
{
|
||||||
std::string text = info->mResponse;
|
std::string text = info->mResponse;
|
||||||
parseText (text);
|
parseText (text);
|
||||||
|
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
mIsInChoice = false;
|
mIsInChoice = false;
|
||||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->clearChoices();
|
mChoices.clear();
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse (Interpreter::fixDefinesDialog(text, interpreterContext));
|
response = Response("", Interpreter::fixDefinesDialog(text, interpreterContext));
|
||||||
|
|
||||||
// Make sure the returned DialInfo is from the Dialogue we supplied. If could also be from the Info refusal group,
|
// Make sure the returned DialInfo is from the Dialogue we supplied. If could also be from the Info refusal group,
|
||||||
// in which case it should not be added to the journal.
|
// in which case it should not be added to the journal.
|
||||||
for (ESM::Dialogue::InfoContainer::const_iterator iter = mDialogueMap[mLastTopic].mInfo.begin();
|
for (ESM::Dialogue::InfoContainer::const_iterator iter = dialogue->mInfo.begin();
|
||||||
iter!=mDialogueMap[mLastTopic].mInfo.end(); ++iter)
|
iter!=dialogue->mInfo.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (iter->mId == info->mId)
|
if (iter->mId == info->mId)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId, mActor);
|
MWBase::Environment::get().getJournal()->addTopic (Misc::StringUtils::lowerCase(mLastTopic), info->mId, mActor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,32 +429,39 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
mIsInChoice = false;
|
mIsInChoice = false;
|
||||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->clearChoices();
|
mChoices.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTopics();
|
updateActorKnownTopics();
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::askQuestion (const std::string& question, int choice)
|
void DialogueManager::addChoice (const std::string& text, int choice)
|
||||||
{
|
{
|
||||||
mIsInChoice = true;
|
mIsInChoice = true;
|
||||||
|
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
mChoices.push_back(std::make_pair(text, choice));
|
||||||
win->addChoice(question, choice);
|
}
|
||||||
|
|
||||||
|
const std::vector<std::pair<std::string, int> >& DialogueManager::getChoices()
|
||||||
|
{
|
||||||
|
return mChoices;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DialogueManager::isGoodbye()
|
||||||
|
{
|
||||||
|
return mGoodbye;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::goodbye()
|
void DialogueManager::goodbye()
|
||||||
{
|
{
|
||||||
mIsInChoice = true;
|
mIsInChoice = false;
|
||||||
|
mGoodbye = true;
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
|
||||||
|
|
||||||
win->goodbye();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::persuade(int type)
|
DialogueManager::Response DialogueManager::persuade(int type)
|
||||||
{
|
{
|
||||||
bool success;
|
bool success;
|
||||||
float temp, perm;
|
float temp, perm;
|
||||||
|
@ -580,7 +510,7 @@ namespace MWDialogue
|
||||||
text = "Bribe";
|
text = "Bribe";
|
||||||
}
|
}
|
||||||
|
|
||||||
executeTopic (text + (success ? " Success" : " Fail"));
|
return executeTopic (text + (success ? " Success" : " Fail"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int DialogueManager::getTemporaryDispositionChange() const
|
int DialogueManager::getTemporaryDispositionChange() const
|
||||||
|
@ -593,7 +523,7 @@ namespace MWDialogue
|
||||||
mTemporaryDispositionChange += delta;
|
mTemporaryDispositionChange += delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogueManager::checkServiceRefused()
|
bool DialogueManager::checkServiceRefused(Response& response)
|
||||||
{
|
{
|
||||||
Filter filter (mActor, mChoice, mTalkedTo);
|
Filter filter (mActor, mChoice, mTalkedTo);
|
||||||
|
|
||||||
|
@ -601,7 +531,6 @@ namespace MWDialogue
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
|
||||||
const ESM::Dialogue& dialogue = *dialogues.find ("Service Refusal");
|
const ESM::Dialogue& dialogue = *dialogues.find ("Service Refusal");
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
|
||||||
|
|
||||||
std::vector<const ESM::DialInfo *> infos = filter.list (dialogue, false, false, true);
|
std::vector<const ESM::DialInfo *> infos = filter.list (dialogue, false, false, true);
|
||||||
if (!infos.empty())
|
if (!infos.empty())
|
||||||
|
@ -615,8 +544,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||||
|
|
||||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext),
|
response = Response(gmsts.find ("sServiceRefusal")->getString(), Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
||||||
gmsts.find ("sServiceRefusal")->getString());
|
|
||||||
|
|
||||||
executeScript (info->mResultScript, mActor);
|
executeScript (info->mResultScript, mActor);
|
||||||
return true;
|
return true;
|
||||||
|
@ -750,7 +678,7 @@ namespace MWDialogue
|
||||||
if (actor == mActor && !mLastTopic.empty())
|
if (actor == mActor && !mLastTopic.empty())
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getJournal()->removeLastAddedTopicResponse(
|
MWBase::Environment::get().getJournal()->removeLastAddedTopicResponse(
|
||||||
mLastTopic, actor.getClass().getName(actor));
|
Misc::StringUtils::lowerCase(mLastTopic), actor.getClass().getName(actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
class DialogueManager : public MWBase::DialogueManager
|
class DialogueManager : public MWBase::DialogueManager
|
||||||
{
|
{
|
||||||
std::map<std::string, ESM::Dialogue> mDialogueMap;
|
|
||||||
std::set<std::string> mKnownTopics;// Those are the topics the player knows.
|
std::set<std::string> mKnownTopics;// Those are the topics the player knows.
|
||||||
|
|
||||||
// Modified faction reactions. <Faction1, <Faction2, Difference> >
|
// Modified faction reactions. <Faction1, <Faction2, Difference> >
|
||||||
|
@ -42,19 +41,24 @@ namespace MWDialogue
|
||||||
int mChoice;
|
int mChoice;
|
||||||
std::string mLastTopic; // last topic ID, lowercase
|
std::string mLastTopic; // last topic ID, lowercase
|
||||||
bool mIsInChoice;
|
bool mIsInChoice;
|
||||||
|
bool mGoodbye;
|
||||||
|
|
||||||
|
std::vector<std::pair<std::string, int> > mChoices;
|
||||||
|
|
||||||
float mTemporaryDispositionChange;
|
float mTemporaryDispositionChange;
|
||||||
float mPermanentDispositionChange;
|
float mPermanentDispositionChange;
|
||||||
|
|
||||||
void parseText (const std::string& text);
|
void parseText (const std::string& text);
|
||||||
|
|
||||||
void updateTopics();
|
void updateActorKnownTopics();
|
||||||
void updateGlobals();
|
void updateGlobals();
|
||||||
|
|
||||||
bool compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor);
|
bool compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor);
|
||||||
void executeScript (const std::string& script, const MWWorld::Ptr& actor);
|
void executeScript (const std::string& script, const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void executeTopic (const std::string& topic);
|
Response executeTopic (const std::string& topic);
|
||||||
|
|
||||||
|
const ESM::Dialogue* searchDialogue(const std::string& id);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -64,24 +68,29 @@ namespace MWDialogue
|
||||||
|
|
||||||
virtual bool isInChoice() const;
|
virtual bool isInChoice() const;
|
||||||
|
|
||||||
virtual void startDialogue (const MWWorld::Ptr& actor);
|
virtual bool startDialogue (const MWWorld::Ptr& actor, Response& response);
|
||||||
|
|
||||||
|
std::list<std::string> getAvailableTopics();
|
||||||
|
|
||||||
virtual void addTopic (const std::string& topic);
|
virtual void addTopic (const std::string& topic);
|
||||||
|
|
||||||
virtual void askQuestion (const std::string& question,int choice);
|
virtual void addChoice (const std::string& text,int choice);
|
||||||
|
const std::vector<std::pair<std::string, int> >& getChoices();
|
||||||
|
|
||||||
|
virtual bool isGoodbye();
|
||||||
|
|
||||||
virtual void goodbye();
|
virtual void goodbye();
|
||||||
|
|
||||||
virtual bool checkServiceRefused ();
|
virtual bool checkServiceRefused (Response& response);
|
||||||
|
|
||||||
virtual void say(const MWWorld::Ptr &actor, const std::string &topic);
|
virtual void say(const MWWorld::Ptr &actor, const std::string &topic);
|
||||||
|
|
||||||
//calbacks for the GUI
|
//calbacks for the GUI
|
||||||
virtual void keywordSelected (const std::string& keyword);
|
virtual Response keywordSelected (const std::string& keyword);
|
||||||
virtual void goodbyeSelected();
|
virtual void goodbyeSelected();
|
||||||
virtual void questionAnswered (int answer);
|
virtual Response questionAnswered (int answer);
|
||||||
|
|
||||||
virtual void persuade (int type);
|
virtual Response persuade (int type);
|
||||||
virtual int getTemporaryDispositionChange () const;
|
virtual int getTemporaryDispositionChange () const;
|
||||||
|
|
||||||
/// @note This change is temporary and gets discarded when dialogue ends.
|
/// @note This change is temporary and gets discarded when dialogue ends.
|
||||||
|
|
|
@ -193,7 +193,8 @@ bool MWDialogue::Filter::testFunctionLocal(const MWDialogue::SelectWrapper& sele
|
||||||
return false; // shouldn't happen, we checked that variable has a type above, so must exist
|
return false; // shouldn't happen, we checked that variable has a type above, so must exist
|
||||||
|
|
||||||
const MWScript::Locals& locals = mActor.getRefData().getLocals();
|
const MWScript::Locals& locals = mActor.getRefData().getLocals();
|
||||||
|
if (locals.isEmpty())
|
||||||
|
return select.selectCompare(0);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 's': return select.selectCompare (static_cast<int> (locals.mShorts[index]));
|
case 's': return select.selectCompare (static_cast<int> (locals.mShorts[index]));
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "alchemywindow.hpp"
|
#include "alchemywindow.hpp"
|
||||||
|
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
|
#include <MyGUI_EditBox.h>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -19,6 +21,7 @@
|
||||||
#include "sortfilteritemmodel.hpp"
|
#include "sortfilteritemmodel.hpp"
|
||||||
#include "itemview.hpp"
|
#include "itemview.hpp"
|
||||||
#include "itemwidget.hpp"
|
#include "itemwidget.hpp"
|
||||||
|
#include "widgets.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -54,12 +57,19 @@ namespace MWGui
|
||||||
mCreateButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCreateButtonClicked);
|
mCreateButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCreateButtonClicked);
|
||||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCancelButtonClicked);
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCancelButtonClicked);
|
||||||
|
|
||||||
|
mNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &AlchemyWindow::onAccept);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlchemyWindow::onAccept(MyGUI::EditBox* sender)
|
||||||
|
{
|
||||||
|
onCreateButtonClicked(sender);
|
||||||
|
}
|
||||||
|
|
||||||
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
|
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
@ -101,8 +111,9 @@ namespace MWGui
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlchemyWindow::open()
|
void AlchemyWindow::onOpen()
|
||||||
{
|
{
|
||||||
|
mAlchemy->clear();
|
||||||
mAlchemy->setAlchemist (MWMechanics::getPlayer());
|
mAlchemy->setAlchemist (MWMechanics::getPlayer());
|
||||||
|
|
||||||
InventoryItemModel* model = new InventoryItemModel(MWMechanics::getPlayer());
|
InventoryItemModel* model = new InventoryItemModel(MWMechanics::getPlayer());
|
||||||
|
@ -127,12 +138,8 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
|
||||||
|
|
||||||
void AlchemyWindow::exit() {
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit);
|
||||||
mAlchemy->clear();
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* _sender)
|
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* _sender)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include "../mwmechanics/alchemy.hpp"
|
#include "../mwmechanics/alchemy.hpp"
|
||||||
|
|
||||||
#include "widgets.hpp"
|
|
||||||
#include "windowbase.hpp"
|
#include "windowbase.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
|
@ -24,8 +23,9 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
AlchemyWindow();
|
AlchemyWindow();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void exit();
|
|
||||||
|
void onResChange(int, int) { center(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mSuggestedPotionName;
|
std::string mSuggestedPotionName;
|
||||||
|
@ -43,6 +43,7 @@ namespace MWGui
|
||||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onCreateButtonClicked(MyGUI::Widget* _sender);
|
void onCreateButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onIngredientSelected(MyGUI::Widget* _sender);
|
void onIngredientSelected(MyGUI::Widget* _sender);
|
||||||
|
void onAccept(MyGUI::EditBox*);
|
||||||
|
|
||||||
void onSelectedItem(int index);
|
void onSelectedItem(int index);
|
||||||
|
|
||||||
|
|
|
@ -64,11 +64,12 @@ namespace MWGui
|
||||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BirthDialog::open()
|
void BirthDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
updateBirths();
|
updateBirths();
|
||||||
updateSpells();
|
updateSpells();
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mBirthList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,9 @@ namespace MWGui
|
||||||
void setBirthId(const std::string &raceId);
|
void setBirthId(const std::string &raceId);
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "bookwindow.hpp"
|
#include "bookwindow.hpp"
|
||||||
|
|
||||||
#include <MyGUI_TextBox.h>
|
#include <MyGUI_TextBox.h>
|
||||||
|
#include <MyGUI_InputManager.h>
|
||||||
|
|
||||||
#include <components/esm/loadbook.hpp>
|
#include <components/esm/loadbook.hpp>
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "formatting.hpp"
|
#include "formatting.hpp"
|
||||||
|
|
||||||
|
@ -51,6 +53,11 @@ namespace MWGui
|
||||||
mRightPage->setNeedMouseFocus(true);
|
mRightPage->setNeedMouseFocus(true);
|
||||||
mRightPage->eventMouseWheel += MyGUI::newDelegate(this, &BookWindow::onMouseWheel);
|
mRightPage->eventMouseWheel += MyGUI::newDelegate(this, &BookWindow::onMouseWheel);
|
||||||
|
|
||||||
|
mNextPageButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &BookWindow::onKeyButtonPressed);
|
||||||
|
mPrevPageButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &BookWindow::onKeyButtonPressed);
|
||||||
|
mTakeButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &BookWindow::onKeyButtonPressed);
|
||||||
|
mCloseButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &BookWindow::onKeyButtonPressed);
|
||||||
|
|
||||||
if (mNextPageButton->getSize().width == 64)
|
if (mNextPageButton->getSize().width == 64)
|
||||||
{
|
{
|
||||||
// english button has a 7 pixel wide strip of garbage on its right edge
|
// english button has a 7 pixel wide strip of garbage on its right edge
|
||||||
|
@ -74,15 +81,16 @@ namespace MWGui
|
||||||
mPages.clear();
|
mPages.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookWindow::openBook (MWWorld::Ptr book, bool showTakeButton)
|
void BookWindow::setPtr (const MWWorld::Ptr& book)
|
||||||
{
|
{
|
||||||
mBook = book;
|
mBook = book;
|
||||||
|
|
||||||
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
bool showTakeButton = book.getContainerStore() != &player.getClass().getContainerStore(player);
|
||||||
|
|
||||||
clearPages();
|
clearPages();
|
||||||
mCurrentPage = 0;
|
mCurrentPage = 0;
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("book open");
|
|
||||||
|
|
||||||
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
|
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
|
||||||
|
|
||||||
Formatting::BookFormatter formatter;
|
Formatting::BookFormatter formatter;
|
||||||
|
@ -92,14 +100,8 @@ namespace MWGui
|
||||||
updatePages();
|
updatePages();
|
||||||
|
|
||||||
setTakeButtonShow(showTakeButton);
|
setTakeButtonShow(showTakeButton);
|
||||||
}
|
|
||||||
|
|
||||||
void BookWindow::exit()
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCloseButton);
|
||||||
{
|
|
||||||
// no 3d sounds because the object could be in a container.
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("book close");
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookWindow::setTakeButtonShow(bool show)
|
void BookWindow::setTakeButtonShow(bool show)
|
||||||
|
@ -108,6 +110,14 @@ namespace MWGui
|
||||||
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
|
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookWindow::onKeyButtonPressed(MyGUI::Widget *sender, MyGUI::KeyCode key, MyGUI::Char character)
|
||||||
|
{
|
||||||
|
if (key == MyGUI::KeyCode::ArrowUp)
|
||||||
|
prevPage();
|
||||||
|
else if (key == MyGUI::KeyCode::ArrowDown)
|
||||||
|
nextPage();
|
||||||
|
}
|
||||||
|
|
||||||
void BookWindow::setInventoryAllowed(bool allowed)
|
void BookWindow::setInventoryAllowed(bool allowed)
|
||||||
{
|
{
|
||||||
mTakeButtonAllowed = allowed;
|
mTakeButtonAllowed = allowed;
|
||||||
|
@ -116,7 +126,7 @@ namespace MWGui
|
||||||
|
|
||||||
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
|
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)
|
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)
|
||||||
|
@ -144,20 +154,16 @@ namespace MWGui
|
||||||
mLeftPageNumber->setCaption( MyGUI::utility::toString(mCurrentPage*2 + 1) );
|
mLeftPageNumber->setCaption( MyGUI::utility::toString(mCurrentPage*2 + 1) );
|
||||||
mRightPageNumber->setCaption( MyGUI::utility::toString(mCurrentPage*2 + 2) );
|
mRightPageNumber->setCaption( MyGUI::utility::toString(mCurrentPage*2 + 2) );
|
||||||
|
|
||||||
//If it is the last page, hide the button "Next Page"
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
if ( (mCurrentPage+1)*2 == mPages.size()
|
bool nextPageVisible = (mCurrentPage+1)*2 < mPages.size();
|
||||||
|| (mCurrentPage+1)*2 == mPages.size() + 1)
|
mNextPageButton->setVisible(nextPageVisible);
|
||||||
{
|
bool prevPageVisible = mCurrentPage != 0;
|
||||||
mNextPageButton->setVisible(false);
|
mPrevPageButton->setVisible(prevPageVisible);
|
||||||
} else {
|
|
||||||
mNextPageButton->setVisible(true);
|
if (focus == mNextPageButton && !nextPageVisible && prevPageVisible)
|
||||||
}
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mPrevPageButton);
|
||||||
//If it is the fist page, hide the button "Prev Page"
|
else if (focus == mPrevPageButton && !prevPageVisible && nextPageVisible)
|
||||||
if (mCurrentPage == 0) {
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNextPageButton);
|
||||||
mPrevPageButton->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mPrevPageButton->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPages.empty())
|
if (mPages.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -14,11 +14,11 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
BookWindow();
|
BookWindow();
|
||||||
|
|
||||||
virtual void exit();
|
void setPtr(const MWWorld::Ptr& book);
|
||||||
|
|
||||||
void openBook(MWWorld::Ptr book, bool showTakeButton);
|
|
||||||
void setInventoryAllowed(bool allowed);
|
void setInventoryAllowed(bool allowed);
|
||||||
|
|
||||||
|
void onResChange(int, int) { center(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onNextPageButtonClicked (MyGUI::Widget* sender);
|
void onNextPageButtonClicked (MyGUI::Widget* sender);
|
||||||
void onPrevPageButtonClicked (MyGUI::Widget* sender);
|
void onPrevPageButtonClicked (MyGUI::Widget* sender);
|
||||||
|
@ -27,6 +27,8 @@ namespace MWGui
|
||||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
void setTakeButtonShow(bool show);
|
void setTakeButtonShow(bool show);
|
||||||
|
|
||||||
|
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
|
||||||
|
|
||||||
void nextPage();
|
void nextPage();
|
||||||
void prevPage();
|
void prevPage();
|
||||||
|
|
||||||
|
|
|
@ -125,11 +125,12 @@ namespace MWGui
|
||||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PickClassDialog::open()
|
void PickClassDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open ();
|
WindowModal::onOpen ();
|
||||||
updateClasses();
|
updateClasses();
|
||||||
updateStats();
|
updateStats();
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mClassList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,9 +342,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBoxDialog::open()
|
void InfoBoxDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
// Fix layout
|
// Fix layout
|
||||||
layoutVertically(mTextBox, 4);
|
layoutVertically(mTextBox, 4);
|
||||||
layoutVertically(mButtonBar, 6);
|
layoutVertically(mButtonBar, 6);
|
||||||
|
@ -730,9 +731,10 @@ namespace MWGui
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectSpecializationDialog::exit()
|
bool SelectSpecializationDialog::exit()
|
||||||
{
|
{
|
||||||
eventCancel();
|
eventCancel();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SelectAttributeDialog */
|
/* SelectAttributeDialog */
|
||||||
|
@ -778,9 +780,10 @@ namespace MWGui
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectAttributeDialog::exit()
|
bool SelectAttributeDialog::exit()
|
||||||
{
|
{
|
||||||
eventCancel();
|
eventCancel();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -869,9 +872,10 @@ namespace MWGui
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectSkillDialog::exit()
|
bool SelectSkillDialog::exit()
|
||||||
{
|
{
|
||||||
eventCancel();
|
eventCancel();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DescriptionDialog */
|
/* DescriptionDialog */
|
||||||
|
|
|
@ -21,7 +21,9 @@ namespace MWGui
|
||||||
std::string getText() const;
|
std::string getText() const;
|
||||||
void setButtons(ButtonList &buttons);
|
void setButtons(ButtonList &buttons);
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
|
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
|
||||||
|
@ -67,6 +69,8 @@ namespace MWGui
|
||||||
std::string getClassId() const;
|
std::string getClassId() const;
|
||||||
void setClassId(const std::string &classId);
|
void setClassId(const std::string &classId);
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
|
@ -100,7 +104,9 @@ namespace MWGui
|
||||||
void setClassId(const std::string &classId);
|
void setClassId(const std::string &classId);
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
@ -142,7 +148,7 @@ namespace MWGui
|
||||||
SelectSpecializationDialog();
|
SelectSpecializationDialog();
|
||||||
~SelectSpecializationDialog();
|
~SelectSpecializationDialog();
|
||||||
|
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
|
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
|
||||||
|
|
||||||
|
@ -175,7 +181,7 @@ namespace MWGui
|
||||||
SelectAttributeDialog();
|
SelectAttributeDialog();
|
||||||
~SelectAttributeDialog();
|
~SelectAttributeDialog();
|
||||||
|
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
|
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
|
||||||
|
|
||||||
|
@ -206,7 +212,7 @@ namespace MWGui
|
||||||
SelectSkillDialog();
|
SelectSkillDialog();
|
||||||
~SelectSkillDialog();
|
~SelectSkillDialog();
|
||||||
|
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
||||||
|
|
||||||
|
@ -262,6 +268,8 @@ namespace MWGui
|
||||||
CreateClassDialog();
|
CreateClassDialog();
|
||||||
virtual ~CreateClassDialog();
|
virtual ~CreateClassDialog();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
std::string getName() const;
|
std::string getName() const;
|
||||||
std::string getDescription() const;
|
std::string getDescription() const;
|
||||||
ESM::Class::Specialization getSpecializationId() const;
|
ESM::Class::Specialization getSpecializationId() const;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "companionitemmodel.hpp"
|
#include "companionitemmodel.hpp"
|
||||||
#include "draganddrop.hpp"
|
#include "draganddrop.hpp"
|
||||||
#include "countdialog.hpp"
|
#include "countdialog.hpp"
|
||||||
|
#include "widgets.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -103,7 +104,7 @@ void CompanionWindow::onBackgroundSelected()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompanionWindow::openCompanion(const MWWorld::Ptr& npc)
|
void CompanionWindow::setPtr(const MWWorld::Ptr& npc)
|
||||||
{
|
{
|
||||||
mPtr = npc;
|
mPtr = npc;
|
||||||
updateEncumbranceBar();
|
updateEncumbranceBar();
|
||||||
|
@ -116,8 +117,9 @@ void CompanionWindow::openCompanion(const MWWorld::Ptr& npc)
|
||||||
setTitle(npc.getClass().getName(npc));
|
setTitle(npc.getClass().getName(npc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompanionWindow::onFrame()
|
void CompanionWindow::onFrame(float dt)
|
||||||
{
|
{
|
||||||
|
checkReferenceAvailable();
|
||||||
updateEncumbranceBar();
|
updateEncumbranceBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,10 +141,11 @@ void CompanionWindow::updateEncumbranceBar()
|
||||||
|
|
||||||
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
if (exit())
|
||||||
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompanionWindow::exit()
|
bool CompanionWindow::exit()
|
||||||
{
|
{
|
||||||
if (mModel && mModel->hasProfit(mPtr) && getProfit(mPtr) < 0)
|
if (mModel && mModel->hasProfit(mPtr) && getProfit(mPtr) < 0)
|
||||||
{
|
{
|
||||||
|
@ -151,9 +154,9 @@ void CompanionWindow::exit()
|
||||||
buttons.push_back("#{sCompanionWarningButtonTwo}");
|
buttons.push_back("#{sCompanionWarningButtonTwo}");
|
||||||
mMessageBoxManager->createInteractiveMessageBox("#{sCompanionWarningMessage}", buttons);
|
mMessageBoxManager->createInteractiveMessageBox("#{sCompanionWarningMessage}", buttons);
|
||||||
mMessageBoxManager->eventButtonPressed += MyGUI::newDelegate(this, &CompanionWindow::onMessageBoxButtonClicked);
|
mMessageBoxManager->eventButtonPressed += MyGUI::newDelegate(this, &CompanionWindow::onMessageBoxButtonClicked);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
return true;
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompanionWindow::onMessageBoxButtonClicked(int button)
|
void CompanionWindow::onMessageBoxButtonClicked(int button)
|
||||||
|
@ -162,7 +165,7 @@ void CompanionWindow::onMessageBoxButtonClicked(int button)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
|
||||||
// Important for Calvus' contract script to work properly
|
// Important for Calvus' contract script to work properly
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
#ifndef OPENMW_MWGUI_COMPANIONWINDOW_H
|
#ifndef OPENMW_MWGUI_COMPANIONWINDOW_H
|
||||||
#define OPENMW_MWGUI_COMPANIONWINDOW_H
|
#define OPENMW_MWGUI_COMPANIONWINDOW_H
|
||||||
|
|
||||||
#include "widgets.hpp"
|
|
||||||
#include "windowbase.hpp"
|
#include "windowbase.hpp"
|
||||||
#include "referenceinterface.hpp"
|
#include "referenceinterface.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
namespace Widgets
|
||||||
|
{
|
||||||
|
class MWDynamicStat;
|
||||||
|
}
|
||||||
|
|
||||||
class MessageBoxManager;
|
class MessageBoxManager;
|
||||||
class ItemView;
|
class ItemView;
|
||||||
class DragAndDrop;
|
class DragAndDrop;
|
||||||
|
@ -18,12 +22,13 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
|
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
|
||||||
|
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
virtual void resetReference();
|
virtual void resetReference();
|
||||||
|
|
||||||
void openCompanion(const MWWorld::Ptr& npc);
|
void setPtr(const MWWorld::Ptr& npc);
|
||||||
void onFrame ();
|
void onFrame (float dt);
|
||||||
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ItemView* mItemView;
|
ItemView* mItemView;
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_EditBox.h>
|
#include <MyGUI_EditBox.h>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
ConfirmationDialog::ConfirmationDialog() :
|
ConfirmationDialog::ConfirmationDialog() :
|
||||||
|
@ -16,14 +19,6 @@ namespace MWGui
|
||||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onOkButtonClicked);
|
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onOkButtonClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmationDialog::askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage)
|
|
||||||
{
|
|
||||||
mCancelButton->setCaptionWithReplacing(cancelMessage);
|
|
||||||
mOkButton->setCaptionWithReplacing(confirmMessage);
|
|
||||||
|
|
||||||
askForConfirmation(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmationDialog::askForConfirmation(const std::string& message)
|
void ConfirmationDialog::askForConfirmation(const std::string& message)
|
||||||
{
|
{
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
@ -38,18 +33,21 @@ namespace MWGui
|
||||||
|
|
||||||
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height + 24);
|
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height + 24);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mOkButton);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmationDialog::exit()
|
bool ConfirmationDialog::exit()
|
||||||
{
|
{
|
||||||
setVisible(false);
|
|
||||||
|
|
||||||
eventCancelClicked();
|
eventCancelClicked();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
|
setVisible(false);
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
ConfirmationDialog();
|
ConfirmationDialog();
|
||||||
void askForConfirmation(const std::string& message);
|
void askForConfirmation(const std::string& message);
|
||||||
void askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage);
|
virtual bool exit();
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
|
|
|
@ -145,25 +145,13 @@ namespace MWGui
|
||||||
mCompilerContext.setExtensions (&mExtensions);
|
mCompilerContext.setExtensions (&mExtensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::open()
|
void Console::onOpen()
|
||||||
{
|
{
|
||||||
// Give keyboard focus to the combo box whenever the console is
|
// Give keyboard focus to the combo box whenever the console is
|
||||||
// turned on
|
// turned on
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCommandLine);
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCommandLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::close()
|
|
||||||
{
|
|
||||||
// Apparently, hidden widgets can retain key focus
|
|
||||||
// Remove for MyGUI 3.2.2
|
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Console);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::setFont(const std::string &fntName)
|
void Console::setFont(const std::string &fntName)
|
||||||
{
|
{
|
||||||
mHistory->setFontName(fntName);
|
mHistory->setFontName(fntName);
|
||||||
|
|
|
@ -39,10 +39,7 @@ namespace MWGui
|
||||||
|
|
||||||
Console(int w, int h, bool consoleOnlyScripts);
|
Console(int w, int h, bool consoleOnlyScripts);
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void close();
|
|
||||||
|
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
void setFont(const std::string &fntName);
|
void setFont(const std::string &fntName);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ namespace MWGui
|
||||||
|
|
||||||
mDisposeCorpseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onDisposeCorpseButtonClicked);
|
mDisposeCorpseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onDisposeCorpseButtonClicked);
|
||||||
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onCloseButtonClicked);
|
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onCloseButtonClicked);
|
||||||
mCloseButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ContainerWindow::onKeyPressed);
|
|
||||||
mTakeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onTakeAllButtonClicked);
|
mTakeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onTakeAllButtonClicked);
|
||||||
|
|
||||||
setCoord(200,0,600,300);
|
setCoord(200,0,600,300);
|
||||||
|
@ -130,11 +129,13 @@ namespace MWGui
|
||||||
dropItem();
|
dropItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainerWindow::openContainer(const MWWorld::Ptr& container, bool loot)
|
void ContainerWindow::setPtr(const MWWorld::Ptr& container)
|
||||||
{
|
{
|
||||||
mPickpocketDetected = false;
|
mPickpocketDetected = false;
|
||||||
mPtr = container;
|
mPtr = container;
|
||||||
|
|
||||||
|
bool loot = mPtr.getClass().isActor() && mPtr.getClass().getCreatureStats(mPtr).isDead();
|
||||||
|
|
||||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot)
|
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot)
|
||||||
{
|
{
|
||||||
// we are stealing stuff
|
// we are stealing stuff
|
||||||
|
@ -157,14 +158,6 @@ namespace MWGui
|
||||||
setTitle(container.getClass().getName(container));
|
setTitle(container.getClass().getName(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainerWindow::onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char)
|
|
||||||
{
|
|
||||||
if (_key == MyGUI::KeyCode::Space)
|
|
||||||
onCloseButtonClicked(mCloseButton);
|
|
||||||
if (_key == MyGUI::KeyCode::Return || _key == MyGUI::KeyCode::NumpadEnter)
|
|
||||||
onTakeAllButtonClicked(mTakeButton);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContainerWindow::resetReference()
|
void ContainerWindow::resetReference()
|
||||||
{
|
{
|
||||||
ReferenceInterface::resetReference();
|
ReferenceInterface::resetReference();
|
||||||
|
@ -173,9 +166,9 @@ namespace MWGui
|
||||||
mSortModel = NULL;
|
mSortModel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainerWindow::close()
|
void ContainerWindow::onClose()
|
||||||
{
|
{
|
||||||
WindowBase::close();
|
WindowBase::onClose();
|
||||||
|
|
||||||
if (dynamic_cast<PickpocketItemModel*>(mModel)
|
if (dynamic_cast<PickpocketItemModel*>(mModel)
|
||||||
// Make sure we were actually closed, rather than just temporarily hidden (e.g. console or main menu opened)
|
// Make sure we were actually closed, rather than just temporarily hidden (e.g. console or main menu opened)
|
||||||
|
@ -197,17 +190,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainerWindow::exit()
|
|
||||||
{
|
|
||||||
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
|
void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
|
|
@ -33,13 +33,14 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
ContainerWindow(DragAndDrop* dragAndDrop);
|
ContainerWindow(DragAndDrop* dragAndDrop);
|
||||||
|
|
||||||
void openContainer(const MWWorld::Ptr& container, bool loot=false);
|
void setPtr(const MWWorld::Ptr& container);
|
||||||
virtual void close();
|
virtual void onClose();
|
||||||
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
|
void onFrame(float dt) { checkReferenceAvailable(); }
|
||||||
|
|
||||||
virtual void resetReference();
|
virtual void resetReference();
|
||||||
|
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
|
@ -61,7 +62,6 @@ namespace MWGui
|
||||||
void onCloseButtonClicked(MyGUI::Widget* _sender);
|
void onCloseButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onTakeAllButtonClicked(MyGUI::Widget* _sender);
|
void onTakeAllButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onDisposeCorpseButtonClicked(MyGUI::Widget* sender);
|
void onDisposeCorpseButtonClicked(MyGUI::Widget* sender);
|
||||||
void onKeyPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char);
|
|
||||||
|
|
||||||
/// @return is taking the item allowed?
|
/// @return is taking the item allowed?
|
||||||
bool onTakeItem(const ItemStack& item, int count);
|
bool onTakeItem(const ItemStack& item, int count);
|
||||||
|
|
|
@ -56,19 +56,9 @@ namespace MWGui
|
||||||
mItemEdit->setValue(maxCount);
|
mItemEdit->setValue(maxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::cancel() //Keeping this here as I don't know if anything else relies on it.
|
|
||||||
{
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountDialog::exit()
|
|
||||||
{
|
|
||||||
setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
cancel();
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
|
|
@ -15,8 +15,6 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
CountDialog();
|
CountDialog();
|
||||||
void openCountDialog(const std::string& item, const std::string& message, const int maxCount);
|
void openCountDialog(const std::string& item, const std::string& message, const int maxCount);
|
||||||
void cancel();
|
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <MyGUI_LanguageManager.h>
|
#include <MyGUI_LanguageManager.h>
|
||||||
#include <MyGUI_Window.h>
|
#include <MyGUI_Window.h>
|
||||||
#include <MyGUI_ProgressBar.h>
|
#include <MyGUI_ProgressBar.h>
|
||||||
|
#include <MyGUI_ScrollBar.h>
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
|
|
||||||
#include <components/widgets/list.hpp>
|
#include <components/widgets/list.hpp>
|
||||||
#include <components/translation/translation.hpp>
|
#include <components/translation/translation.hpp>
|
||||||
|
@ -20,7 +22,6 @@
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "widgets.hpp"
|
|
||||||
#include "bookpage.hpp"
|
#include "bookpage.hpp"
|
||||||
#include "textcolours.hpp"
|
#include "textcolours.hpp"
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ namespace MWGui
|
||||||
|
|
||||||
void PersuasionDialog::onCancel(MyGUI::Widget *sender)
|
void PersuasionDialog::onCancel(MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
exit();
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PersuasionDialog::onPersuade(MyGUI::Widget *sender)
|
void PersuasionDialog::onPersuade(MyGUI::Widget *sender)
|
||||||
|
@ -68,14 +69,15 @@ namespace MWGui
|
||||||
else /*if (sender == mBribe1000Button)*/
|
else /*if (sender == mBribe1000Button)*/
|
||||||
type = MWBase::MechanicsManager::PT_Bribe1000;
|
type = MWBase::MechanicsManager::PT_Bribe1000;
|
||||||
|
|
||||||
MWBase::Environment::get().getDialogueManager()->persuade(type);
|
MWBase::DialogueManager::Response response = MWBase::Environment::get().getDialogueManager()->persuade(type);
|
||||||
|
|
||||||
|
eventPersuadeMsg(response.first, response.second);
|
||||||
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PersuasionDialog::open()
|
void PersuasionDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
|
||||||
center();
|
center();
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
@ -86,11 +88,12 @@ namespace MWGui
|
||||||
mBribe1000Button->setEnabled (playerGold >= 1000);
|
mBribe1000Button->setEnabled (playerGold >= 1000);
|
||||||
|
|
||||||
mGoldLabel->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
|
mGoldLabel->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
|
||||||
|
WindowModal::onOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PersuasionDialog::exit()
|
MyGUI::Widget* PersuasionDialog::getDefaultKeyFocus()
|
||||||
{
|
{
|
||||||
setVisible(false);
|
return mAdmireButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
@ -219,31 +222,27 @@ namespace MWGui
|
||||||
|
|
||||||
void Choice::activated()
|
void Choice::activated()
|
||||||
{
|
{
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
|
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
|
||||||
MWBase::Environment::get().getDialogueManager()->questionAnswered(mChoiceId);
|
eventChoiceActivated(mChoiceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Topic::activated()
|
void Topic::activated()
|
||||||
{
|
{
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
|
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
|
||||||
MWBase::Environment::get().getDialogueManager()->keywordSelected(Misc::StringUtils::lowerCase(mTopicId));
|
eventTopicActivated(mTopicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Goodbye::activated()
|
void Goodbye::activated()
|
||||||
{
|
{
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
|
MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
eventActivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
DialogueWindow::DialogueWindow()
|
DialogueWindow::DialogueWindow()
|
||||||
: WindowBase("openmw_dialogue_window.layout")
|
: WindowBase("openmw_dialogue_window.layout")
|
||||||
, mServices(0)
|
, mIsCompanion(false)
|
||||||
, mEnabled(false)
|
|
||||||
, mGoodbye(false)
|
, mGoodbye(false)
|
||||||
, mPersuasionDialog()
|
, mPersuasionDialog()
|
||||||
{
|
{
|
||||||
|
@ -251,17 +250,17 @@ namespace MWGui
|
||||||
center();
|
center();
|
||||||
|
|
||||||
mPersuasionDialog.setVisible(false);
|
mPersuasionDialog.setVisible(false);
|
||||||
|
mPersuasionDialog.eventPersuadeMsg += MyGUI::newDelegate(this, &DialogueWindow::onPersuadeResult);
|
||||||
|
|
||||||
//History view
|
//History view
|
||||||
getWidget(mHistory, "History");
|
getWidget(mHistory, "History");
|
||||||
|
|
||||||
//Topics list
|
//Topics list
|
||||||
getWidget(mTopicsList, "TopicsList");
|
getWidget(mTopicsList, "TopicsList");
|
||||||
mTopicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
mTopicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectListItem);
|
||||||
|
|
||||||
MyGUI::Button* byeButton;
|
getWidget(mGoodbyeButton, "ByeButton");
|
||||||
getWidget(byeButton, "ByeButton");
|
mGoodbyeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
||||||
byeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
|
||||||
|
|
||||||
getWidget(mDispositionBar, "Disposition");
|
getWidget(mDispositionBar, "Disposition");
|
||||||
getWidget(mDispositionText,"DispositionText");
|
getWidget(mDispositionText,"DispositionText");
|
||||||
|
@ -276,18 +275,36 @@ namespace MWGui
|
||||||
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
|
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::exit()
|
DialogueWindow::~DialogueWindow()
|
||||||
{
|
{
|
||||||
if ((!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
|
mPersuasionDialog.eventPersuadeMsg.clear();
|
||||||
&& !mGoodbye)
|
|
||||||
|
deleteLater();
|
||||||
|
for (Link* link : mLinks)
|
||||||
|
delete link;
|
||||||
|
for (auto link : mTopicLinks)
|
||||||
|
delete link.second;
|
||||||
|
for (auto history : mHistoryContents)
|
||||||
|
delete history;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::onTradeComplete()
|
||||||
{
|
{
|
||||||
// in choice, not allowed to escape, but give access to main menu to allow loading other saves
|
addResponse("", MyGUI::LanguageManager::getInstance().replaceTags("#{sBarterDialog5}"));
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
|
}
|
||||||
|
|
||||||
|
bool DialogueWindow::exit()
|
||||||
|
{
|
||||||
|
if ((MWBase::Environment::get().getDialogueManager()->isInChoice()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
resetReference();
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||||
mTopicsList->scrollToTop();
|
mTopicsList->scrollToTop();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,12 +329,13 @@ namespace MWGui
|
||||||
|
|
||||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
if (exit())
|
||||||
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onSelectTopic(const std::string& topic, int id)
|
void DialogueWindow::onSelectListItem(const std::string& topic, int id)
|
||||||
{
|
{
|
||||||
if (!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
|
if (mGoodbye || MWBase::Environment::get().getDialogueManager()->isInChoice())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int separatorPos = 0;
|
int separatorPos = 0;
|
||||||
|
@ -328,63 +346,83 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id >= separatorPos)
|
if (id >= separatorPos)
|
||||||
MWBase::Environment::get().getDialogueManager()->keywordSelected(Misc::StringUtils::lowerCase(topic));
|
{
|
||||||
|
onTopicActivated(topic);
|
||||||
|
if (mGoodbyeButton->getEnabled())
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mGoodbyeButton);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
MWBase::DialogueManager::Response response;
|
||||||
if (topic == gmst.find("sPersuasion")->getString())
|
if (topic == gmst.find("sPersuasion")->getString())
|
||||||
mPersuasionDialog.setVisible(true);
|
mPersuasionDialog.setVisible(true);
|
||||||
else if (topic == gmst.find("sCompanionShare")->getString())
|
else if (topic == gmst.find("sCompanionShare")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion, mPtr);
|
||||||
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
|
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused(response))
|
||||||
{
|
{
|
||||||
if (topic == gmst.find("sBarter")->getString())
|
if (topic == gmst.find("sBarter")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startTrade(mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter, mPtr);
|
||||||
else if (topic == gmst.find("sSpells")->getString())
|
else if (topic == gmst.find("sSpells")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startSpellBuying(mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying, mPtr);
|
||||||
else if (topic == gmst.find("sTravel")->getString())
|
else if (topic == gmst.find("sTravel")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startTravel(mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel, mPtr);
|
||||||
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation, mPtr);
|
||||||
else if (topic == gmst.find("sEnchanting")->getString())
|
else if (topic == gmst.find("sEnchanting")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting, mPtr);
|
||||||
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training, mPtr);
|
||||||
else if (topic == gmst.find("sRepair")->getString())
|
else if (topic == gmst.find("sRepair")->getString())
|
||||||
MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair, mPtr);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
addResponse(response.first, response.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory)
|
void DialogueWindow::setPtr(const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
|
MWBase::DialogueManager::Response response;
|
||||||
|
if (!MWBase::Environment::get().getDialogueManager()->startDialogue(actor, response))
|
||||||
|
{
|
||||||
|
// No greetings found. The dialogue window should not be shown.
|
||||||
|
// If this is a companion, we must show the companion window directly (used by BM_bear_be_unique).
|
||||||
|
if (isCompanion())
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Companion, mPtr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mGoodbyeButton);
|
||||||
|
|
||||||
mGoodbye = false;
|
mGoodbye = false;
|
||||||
mEnabled = true;
|
|
||||||
bool sameActor = (mPtr == actor);
|
bool sameActor = (mPtr == actor);
|
||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
mTopicsList->setEnabled(true);
|
mTopicsList->setEnabled(true);
|
||||||
setTitle(npcName);
|
setTitle(mPtr.getClass().getName(mPtr));
|
||||||
|
|
||||||
clearChoices();
|
|
||||||
|
|
||||||
mTopicsList->clear();
|
mTopicsList->clear();
|
||||||
|
|
||||||
if (resetHistory || !sameActor)
|
if (!sameActor)
|
||||||
{
|
{
|
||||||
for (std::vector<DialogueText*>::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
|
for (std::vector<DialogueText*>::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
|
||||||
delete (*it);
|
delete (*it);
|
||||||
mHistoryContents.clear();
|
mHistoryContents.clear();
|
||||||
|
|
||||||
|
mKeywords.clear();
|
||||||
|
updateTopicsPane();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<Link*>::iterator it = mLinks.begin(); it != mLinks.end(); ++it)
|
for (std::vector<Link*>::iterator it = mLinks.begin(); it != mLinks.end(); ++it)
|
||||||
delete (*it);
|
mDeleteLater.push_back(*it); // Links are not deleted right away to prevent issues with event handlers
|
||||||
mLinks.clear();
|
mLinks.clear();
|
||||||
|
|
||||||
updateOptions();
|
updateDisposition();
|
||||||
|
|
||||||
restock();
|
restock();
|
||||||
|
|
||||||
|
addResponse(response.first, response.second, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::restock()
|
void DialogueWindow::restock()
|
||||||
|
@ -401,16 +439,35 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::deleteLater()
|
||||||
|
{
|
||||||
|
for (Link* link : mDeleteLater)
|
||||||
|
delete link;
|
||||||
|
mDeleteLater.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
||||||
|
{
|
||||||
|
if (mKeywords == keyWords && isCompanion() == mIsCompanion)
|
||||||
|
return;
|
||||||
|
mIsCompanion = isCompanion();
|
||||||
|
mKeywords = keyWords;
|
||||||
|
|
||||||
|
updateTopicsPane();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::updateTopicsPane()
|
||||||
{
|
{
|
||||||
mTopicsList->clear();
|
mTopicsList->clear();
|
||||||
for (std::map<std::string, Link*>::iterator it = mTopicLinks.begin(); it != mTopicLinks.end(); ++it)
|
for (std::map<std::string, Link*>::iterator it = mTopicLinks.begin(); it != mTopicLinks.end(); ++it)
|
||||||
delete it->second;
|
mDeleteLater.push_back(it->second);
|
||||||
mTopicLinks.clear();
|
mTopicLinks.clear();
|
||||||
mKeywordSearch.clear();
|
mKeywordSearch.clear();
|
||||||
|
|
||||||
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
int services = mPtr.getClass().getServices(mPtr);
|
||||||
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
|
||||||
|
bool travel = (mPtr.getTypeName() == typeid(ESM::NPC).name() && !mPtr.get<ESM::NPC>()->mBase->getTransport().empty())
|
||||||
|
|| (mPtr.getTypeName() == typeid(ESM::Creature).name() && !mPtr.get<ESM::Creature>()->mBase->getTransport().empty());
|
||||||
|
|
||||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
@ -418,39 +475,40 @@ namespace MWGui
|
||||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||||
mTopicsList->addItem(gmst.find("sPersuasion")->getString());
|
mTopicsList->addItem(gmst.find("sPersuasion")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Trade)
|
if (services & ESM::NPC::AllItems)
|
||||||
mTopicsList->addItem(gmst.find("sBarter")->getString());
|
mTopicsList->addItem(gmst.find("sBarter")->getString());
|
||||||
|
|
||||||
if (mServices & Service_BuySpells)
|
if (services & ESM::NPC::Spells)
|
||||||
mTopicsList->addItem(gmst.find("sSpells")->getString());
|
mTopicsList->addItem(gmst.find("sSpells")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Travel)
|
if (services & travel)
|
||||||
mTopicsList->addItem(gmst.find("sTravel")->getString());
|
mTopicsList->addItem(gmst.find("sTravel")->getString());
|
||||||
|
|
||||||
if (mServices & Service_CreateSpells)
|
if (services & ESM::NPC::Spellmaking)
|
||||||
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Enchant)
|
if (services & ESM::NPC::Enchanting)
|
||||||
mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Training)
|
if (services & ESM::NPC::Training)
|
||||||
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Repair)
|
if (services & ESM::NPC::Repair)
|
||||||
mTopicsList->addItem(gmst.find("sRepair")->getString());
|
mTopicsList->addItem(gmst.find("sRepair")->getString());
|
||||||
|
|
||||||
if (isCompanion)
|
if (isCompanion())
|
||||||
mTopicsList->addItem(gmst.find("sCompanionShare")->getString());
|
mTopicsList->addItem(gmst.find("sCompanionShare")->getString());
|
||||||
|
|
||||||
if (mTopicsList->getItemCount() > 0)
|
if (mTopicsList->getItemCount() > 0)
|
||||||
mTopicsList->addSeparator();
|
mTopicsList->addSeparator();
|
||||||
|
|
||||||
|
|
||||||
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
|
for(std::list<std::string>::iterator it = mKeywords.begin(); it != mKeywords.end(); ++it)
|
||||||
{
|
{
|
||||||
mTopicsList->addItem(*it);
|
mTopicsList->addItem(*it);
|
||||||
|
|
||||||
Topic* t = new Topic(*it);
|
Topic* t = new Topic(*it);
|
||||||
|
t->eventTopicActivated += MyGUI::newDelegate(this, &DialogueWindow::onTopicActivated);
|
||||||
mTopicLinks[Misc::StringUtils::lowerCase(*it)] = t;
|
mTopicLinks[Misc::StringUtils::lowerCase(*it)] = t;
|
||||||
|
|
||||||
mKeywordSearch.seed(Misc::StringUtils::lowerCase(*it), intptr_t(t));
|
mKeywordSearch.seed(Misc::StringUtils::lowerCase(*it), intptr_t(t));
|
||||||
|
@ -484,9 +542,11 @@ namespace MWGui
|
||||||
typesetter->sectionBreak(9);
|
typesetter->sectionBreak(9);
|
||||||
// choices
|
// choices
|
||||||
const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
|
||||||
for (std::vector<std::pair<std::string, int> >::iterator it = mChoices.begin(); it != mChoices.end(); ++it)
|
mChoices = MWBase::Environment::get().getDialogueManager()->getChoices();
|
||||||
|
for (std::vector<std::pair<std::string, int> >::const_iterator it = mChoices.begin(); it != mChoices.end(); ++it)
|
||||||
{
|
{
|
||||||
Choice* link = new Choice(it->second);
|
Choice* link = new Choice(it->second);
|
||||||
|
link->eventChoiceActivated += MyGUI::newDelegate(this, &DialogueWindow::onChoiceActivated);
|
||||||
mLinks.push_back(link);
|
mLinks.push_back(link);
|
||||||
|
|
||||||
typesetter->lineBreak();
|
typesetter->lineBreak();
|
||||||
|
@ -496,9 +556,11 @@ namespace MWGui
|
||||||
typesetter->write(questionStyle, to_utf8_span(it->first.c_str()));
|
typesetter->write(questionStyle, to_utf8_span(it->first.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mGoodbye = MWBase::Environment::get().getDialogueManager()->isGoodbye();
|
||||||
if (mGoodbye)
|
if (mGoodbye)
|
||||||
{
|
{
|
||||||
Goodbye* link = new Goodbye();
|
Goodbye* link = new Goodbye();
|
||||||
|
link->eventActivated += MyGUI::newDelegate(this, &DialogueWindow::onGoodbyeActivated);
|
||||||
mLinks.push_back(link);
|
mLinks.push_back(link);
|
||||||
std::string goodbye = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGoodbye")->getString();
|
std::string goodbye = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGoodbye")->getString();
|
||||||
BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, textColours.answer, textColours.answerOver,
|
BookTypesetter::Style* questionStyle = typesetter->createHotStyle(body, textColours.answer, textColours.answerOver,
|
||||||
|
@ -528,10 +590,11 @@ namespace MWGui
|
||||||
onScrollbarMoved(mScrollBar, 0);
|
onScrollbarMoved(mScrollBar, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::Button* byeButton;
|
|
||||||
getWidget(byeButton, "ByeButton");
|
|
||||||
bool goodbyeEnabled = !MWBase::Environment::get().getDialogueManager()->isInChoice() || mGoodbye;
|
bool goodbyeEnabled = !MWBase::Environment::get().getDialogueManager()->isInChoice() || mGoodbye;
|
||||||
byeButton->setEnabled(goodbyeEnabled);
|
bool goodbyeWasEnabled = mGoodbyeButton->getEnabled();
|
||||||
|
mGoodbyeButton->setEnabled(goodbyeEnabled);
|
||||||
|
if (goodbyeEnabled && !goodbyeWasEnabled)
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mGoodbyeButton);
|
||||||
|
|
||||||
bool topicsEnabled = !MWBase::Environment::get().getDialogueManager()->isInChoice() && !mGoodbye;
|
bool topicsEnabled = !MWBase::Environment::get().getDialogueManager()->isInChoice() && !mGoodbye;
|
||||||
mTopicsList->setEnabled(topicsEnabled);
|
mTopicsList->setEnabled(topicsEnabled);
|
||||||
|
@ -542,32 +605,35 @@ namespace MWGui
|
||||||
reinterpret_cast<Link*>(link)->activated();
|
reinterpret_cast<Link*>(link)->activated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::onTopicActivated(const std::string &topicId)
|
||||||
|
{
|
||||||
|
MWBase::DialogueManager::Response response = MWBase::Environment::get().getDialogueManager()->keywordSelected(topicId);
|
||||||
|
addResponse(response.first, response.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::onChoiceActivated(int id)
|
||||||
|
{
|
||||||
|
MWBase::DialogueManager::Response response = MWBase::Environment::get().getDialogueManager()->questionAnswered(id);
|
||||||
|
addResponse(response.first, response.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::onGoodbyeActivated()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||||
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||||
|
resetReference();
|
||||||
|
}
|
||||||
|
|
||||||
void DialogueWindow::onScrollbarMoved(MyGUI::ScrollBar *sender, size_t pos)
|
void DialogueWindow::onScrollbarMoved(MyGUI::ScrollBar *sender, size_t pos)
|
||||||
{
|
{
|
||||||
mHistory->setPosition(0, static_cast<int>(pos) * -1);
|
mHistory->setPosition(0, static_cast<int>(pos) * -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::addResponse(const std::string &text, const std::string &title, bool needMargin)
|
void DialogueWindow::addResponse(const std::string &title, const std::string &text, bool needMargin)
|
||||||
{
|
{
|
||||||
// This is called from the dialogue manager, so text is
|
mHistoryContents.push_back(new Response(text, title, needMargin));
|
||||||
// case-smashed - thus we have to retrieve the correct case
|
|
||||||
// of the title through the topic list.
|
|
||||||
std::string realTitle = title;
|
|
||||||
if (realTitle != "")
|
|
||||||
{
|
|
||||||
for (size_t i=0; i<mTopicsList->getItemCount(); ++i)
|
|
||||||
{
|
|
||||||
std::string item = mTopicsList->getItemNameAt(i);
|
|
||||||
if (Misc::StringUtils::ciEqual(item, title))
|
|
||||||
{
|
|
||||||
realTitle = item;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mHistoryContents.push_back(new Response(text, realTitle, needMargin));
|
|
||||||
updateHistory();
|
updateHistory();
|
||||||
|
updateTopics();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::addMessageBox(const std::string& text)
|
void DialogueWindow::addMessageBox(const std::string& text)
|
||||||
|
@ -576,25 +642,10 @@ namespace MWGui
|
||||||
updateHistory();
|
updateHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::addChoice(const std::string& choice, int id)
|
void DialogueWindow::updateDisposition()
|
||||||
{
|
{
|
||||||
mChoices.push_back(std::make_pair(choice, id));
|
|
||||||
updateHistory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogueWindow::clearChoices()
|
|
||||||
{
|
|
||||||
mChoices.clear();
|
|
||||||
updateHistory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogueWindow::updateOptions()
|
|
||||||
{
|
|
||||||
//Clear the list of topics
|
|
||||||
mTopicsList->clear();
|
|
||||||
|
|
||||||
bool dispositionVisible = false;
|
bool dispositionVisible = false;
|
||||||
if (mPtr.getClass().isNpc())
|
if (!mPtr.isEmpty() && mPtr.getClass().isNpc())
|
||||||
{
|
{
|
||||||
dispositionVisible = true;
|
dispositionVisible = true;
|
||||||
mDispositionBar->setProgressRange(100);
|
mDispositionBar->setProgressRange(100);
|
||||||
|
@ -620,26 +671,38 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::goodbye()
|
|
||||||
{
|
|
||||||
mGoodbye = true;
|
|
||||||
mEnabled = false;
|
|
||||||
updateHistory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogueWindow::onReferenceUnavailable()
|
void DialogueWindow::onReferenceUnavailable()
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onFrame()
|
void DialogueWindow::onFrame(float dt)
|
||||||
{
|
{
|
||||||
if(mMainWidget->getVisible() && mPtr.getTypeName() == typeid(ESM::NPC).name())
|
checkReferenceAvailable();
|
||||||
{
|
if (mPtr.isEmpty())
|
||||||
int disp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr);
|
return;
|
||||||
mDispositionBar->setProgressRange(100);
|
|
||||||
mDispositionBar->setProgressPosition(disp);
|
updateDisposition();
|
||||||
mDispositionText->setCaption(MyGUI::utility::toString(disp)+std::string("/100"));
|
deleteLater();
|
||||||
|
|
||||||
|
if (mChoices != MWBase::Environment::get().getDialogueManager()->getChoices()
|
||||||
|
|| mGoodbye != MWBase::Environment::get().getDialogueManager()->isGoodbye())
|
||||||
|
updateHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::updateTopics()
|
||||||
|
{
|
||||||
|
setKeywords(MWBase::Environment::get().getDialogueManager()->getAvailableTopics());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DialogueWindow::isCompanion()
|
||||||
|
{
|
||||||
|
return !mPtr.getClass().getScript(mPtr).empty()
|
||||||
|
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::onPersuadeResult(const std::string &title, const std::string &text)
|
||||||
|
{
|
||||||
|
addResponse(title, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include "../mwdialogue/keywordsearch.hpp"
|
#include "../mwdialogue/keywordsearch.hpp"
|
||||||
|
|
||||||
|
#include <MyGUI_Delegate.h>
|
||||||
|
|
||||||
namespace Gui
|
namespace Gui
|
||||||
{
|
{
|
||||||
class MWList;
|
class MWList;
|
||||||
|
@ -20,16 +22,17 @@ namespace MWGui
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class DialogueHistoryViewModel;
|
|
||||||
class BookPage;
|
|
||||||
|
|
||||||
class PersuasionDialog : public WindowModal
|
class PersuasionDialog : public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PersuasionDialog();
|
PersuasionDialog();
|
||||||
|
|
||||||
virtual void open();
|
typedef MyGUI::delegates::CMultiDelegate2<const std::string&, const std::string&> EventHandle_Result;
|
||||||
virtual void exit();
|
EventHandle_Result eventPersuadeMsg;
|
||||||
|
|
||||||
|
virtual void onOpen();
|
||||||
|
|
||||||
|
virtual MyGUI::Widget* getDefaultKeyFocus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
@ -54,6 +57,8 @@ namespace MWGui
|
||||||
|
|
||||||
struct Topic : Link
|
struct Topic : Link
|
||||||
{
|
{
|
||||||
|
typedef MyGUI::delegates::CMultiDelegate1<const std::string&> EventHandle_TopicId;
|
||||||
|
EventHandle_TopicId eventTopicActivated;
|
||||||
Topic(const std::string& id) : mTopicId(id) {}
|
Topic(const std::string& id) : mTopicId(id) {}
|
||||||
std::string mTopicId;
|
std::string mTopicId;
|
||||||
virtual void activated ();
|
virtual void activated ();
|
||||||
|
@ -61,6 +66,8 @@ namespace MWGui
|
||||||
|
|
||||||
struct Choice : Link
|
struct Choice : Link
|
||||||
{
|
{
|
||||||
|
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_ChoiceId;
|
||||||
|
EventHandle_ChoiceId eventChoiceActivated;
|
||||||
Choice(int id) : mChoiceId(id) {}
|
Choice(int id) : mChoiceId(id) {}
|
||||||
int mChoiceId;
|
int mChoiceId;
|
||||||
virtual void activated ();
|
virtual void activated ();
|
||||||
|
@ -68,6 +75,8 @@ namespace MWGui
|
||||||
|
|
||||||
struct Goodbye : Link
|
struct Goodbye : Link
|
||||||
{
|
{
|
||||||
|
typedef MyGUI::delegates::CMultiDelegate0 Event_Activated;
|
||||||
|
Event_Activated eventActivated;
|
||||||
virtual void activated ();
|
virtual void activated ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,46 +108,41 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DialogueWindow();
|
DialogueWindow();
|
||||||
|
~DialogueWindow();
|
||||||
|
|
||||||
virtual void exit();
|
void onTradeComplete();
|
||||||
|
|
||||||
|
virtual bool exit();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
void notifyLinkClicked (TypesetBook::InteractiveId link);
|
void notifyLinkClicked (TypesetBook::InteractiveId link);
|
||||||
|
|
||||||
void startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory);
|
void setPtr(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void setKeywords(std::list<std::string> keyWord);
|
void setKeywords(std::list<std::string> keyWord);
|
||||||
|
|
||||||
void addResponse (const std::string& text, const std::string& title="", bool needMargin = true);
|
void addResponse (const std::string& title, const std::string& text, bool needMargin = true);
|
||||||
|
|
||||||
void addMessageBox(const std::string& text);
|
void addMessageBox(const std::string& text);
|
||||||
|
|
||||||
void addChoice(const std::string& choice, int id);
|
void onFrame(float dt);
|
||||||
void clearChoices();
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
void goodbye();
|
|
||||||
void onFrame();
|
|
||||||
|
|
||||||
// make sure to call these before setKeywords()
|
|
||||||
void setServices(int services) { mServices = services; }
|
|
||||||
|
|
||||||
enum Services
|
|
||||||
{
|
|
||||||
Service_Trade = 0x01,
|
|
||||||
Service_BuySpells = 0x02,
|
|
||||||
Service_CreateSpells = 0x04,
|
|
||||||
Service_Enchant = 0x08,
|
|
||||||
Service_Training = 0x10,
|
|
||||||
Service_Travel = 0x20,
|
|
||||||
Service_Repair = 0x40
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onSelectTopic(const std::string& topic, int id);
|
void updateTopics();
|
||||||
|
void updateTopicsPane();
|
||||||
|
bool isCompanion();
|
||||||
|
|
||||||
|
void onPersuadeResult(const std::string& title, const std::string& text);
|
||||||
|
void onSelectListItem(const std::string& topic, int id);
|
||||||
void onByeClicked(MyGUI::Widget* _sender);
|
void onByeClicked(MyGUI::Widget* _sender);
|
||||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
void onWindowResize(MyGUI::Window* _sender);
|
void onWindowResize(MyGUI::Window* _sender);
|
||||||
|
void onTopicActivated(const std::string& topicId);
|
||||||
|
void onChoiceActivated(int id);
|
||||||
|
void onGoodbyeActivated();
|
||||||
|
|
||||||
void onScrollbarMoved (MyGUI::ScrollBar* sender, size_t pos);
|
void onScrollbarMoved (MyGUI::ScrollBar* sender, size_t pos);
|
||||||
|
|
||||||
|
@ -147,21 +151,24 @@ namespace MWGui
|
||||||
virtual void onReferenceUnavailable();
|
virtual void onReferenceUnavailable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateOptions();
|
void updateDisposition();
|
||||||
void restock();
|
void restock();
|
||||||
|
void deleteLater();
|
||||||
int mServices;
|
|
||||||
|
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
||||||
bool mGoodbye;
|
bool mIsCompanion;
|
||||||
|
std::list<std::string> mKeywords;
|
||||||
|
|
||||||
std::vector<DialogueText*> mHistoryContents;
|
std::vector<DialogueText*> mHistoryContents;
|
||||||
std::vector<std::pair<std::string, int> > mChoices;
|
std::vector<std::pair<std::string, int> > mChoices;
|
||||||
|
bool mGoodbye;
|
||||||
|
|
||||||
std::vector<Link*> mLinks;
|
std::vector<Link*> mLinks;
|
||||||
std::map<std::string, Link*> mTopicLinks;
|
std::map<std::string, Link*> mTopicLinks;
|
||||||
|
|
||||||
|
std::vector<Link*> mDeleteLater;
|
||||||
|
|
||||||
KeywordSearchT mKeywordSearch;
|
KeywordSearchT mKeywordSearch;
|
||||||
|
|
||||||
BookPage* mHistory;
|
BookPage* mHistory;
|
||||||
|
@ -169,6 +176,7 @@ namespace MWGui
|
||||||
MyGUI::ScrollBar* mScrollBar;
|
MyGUI::ScrollBar* mScrollBar;
|
||||||
MyGUI::ProgressBar* mDispositionBar;
|
MyGUI::ProgressBar* mDispositionBar;
|
||||||
MyGUI::TextBox* mDispositionText;
|
MyGUI::TextBox* mDispositionText;
|
||||||
|
MyGUI::Button* mGoodbyeButton;
|
||||||
|
|
||||||
PersuasionDialog mPersuasionDialog;
|
PersuasionDialog mPersuasionDialog;
|
||||||
|
|
||||||
|
|
|
@ -121,10 +121,18 @@ void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView)
|
||||||
mSourceView->update();
|
mSourceView->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DragAndDrop::onFrame()
|
||||||
|
{
|
||||||
|
if (mIsOnDragAndDrop && mItem.mBase.getRefData().getCount() == 0)
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
void DragAndDrop::finish()
|
void DragAndDrop::finish()
|
||||||
{
|
{
|
||||||
mIsOnDragAndDrop = false;
|
mIsOnDragAndDrop = false;
|
||||||
mSourceSortModel->clearDragItems();
|
mSourceSortModel->clearDragItems();
|
||||||
|
// since mSourceView doesn't get updated in drag()
|
||||||
|
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView();
|
||||||
|
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mDraggedWidget);
|
MyGUI::Gui::getInstance().destroyWidget(mDraggedWidget);
|
||||||
mDraggedWidget = 0;
|
mDraggedWidget = 0;
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace MWGui
|
||||||
|
|
||||||
void startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count);
|
void startDrag (int index, SortFilterItemModel* sortModel, ItemModel* sourceModel, ItemView* sourceView, int count);
|
||||||
void drop (ItemModel* targetModel, ItemView* targetView);
|
void drop (ItemModel* targetModel, ItemView* targetView);
|
||||||
|
void onFrame();
|
||||||
|
|
||||||
void finish();
|
void finish();
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
|
#include <MyGUI_EditBox.h>
|
||||||
|
|
||||||
#include <components/widgets/list.hpp>
|
#include <components/widgets/list.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
|
@ -53,6 +53,7 @@ namespace MWGui
|
||||||
mSoulBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectSoul);
|
mSoulBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectSoul);
|
||||||
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onBuyButtonClicked);
|
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onBuyButtonClicked);
|
||||||
mTypeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onTypeButtonClicked);
|
mTypeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onTypeButtonClicked);
|
||||||
|
mName->eventEditSelectAccept += MyGUI::newDelegate(this, &EnchantingDialog::onAccept);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnchantingDialog::~EnchantingDialog()
|
EnchantingDialog::~EnchantingDialog()
|
||||||
|
@ -60,9 +61,10 @@ namespace MWGui
|
||||||
delete mItemSelectionDialog;
|
delete mItemSelectionDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::open()
|
void EnchantingDialog::onOpen()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::setSoulGem(const MWWorld::Ptr &gem)
|
void EnchantingDialog::setSoulGem(const MWWorld::Ptr &gem)
|
||||||
|
@ -100,11 +102,6 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnchantingDialog::updateLabels()
|
void EnchantingDialog::updateLabels()
|
||||||
{
|
{
|
||||||
std::stringstream enchantCost;
|
std::stringstream enchantCost;
|
||||||
|
@ -143,57 +140,41 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::startEnchanting (MWWorld::Ptr actor)
|
void EnchantingDialog::setPtr (const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
mName->setCaption("");
|
mName->setCaption("");
|
||||||
|
|
||||||
|
if (ptr.getClass().isActor())
|
||||||
|
{
|
||||||
mEnchanting.setSelfEnchanting(false);
|
mEnchanting.setSelfEnchanting(false);
|
||||||
mEnchanting.setEnchanter(actor);
|
mEnchanting.setEnchanter(ptr);
|
||||||
|
|
||||||
mBuyButton->setCaptionWithReplacing("#{sBuy}");
|
mBuyButton->setCaptionWithReplacing("#{sBuy}");
|
||||||
|
|
||||||
mChanceLayout->setVisible(false);
|
mChanceLayout->setVisible(false);
|
||||||
|
mPtr = ptr;
|
||||||
mPtr = actor;
|
|
||||||
|
|
||||||
setSoulGem(MWWorld::Ptr());
|
setSoulGem(MWWorld::Ptr());
|
||||||
setItem(MWWorld::Ptr());
|
|
||||||
|
|
||||||
startEditing ();
|
|
||||||
mPrice->setVisible(true);
|
mPrice->setVisible(true);
|
||||||
mPriceText->setVisible(true);
|
mPriceText->setVisible(true);
|
||||||
updateLabels();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
|
|
||||||
{
|
{
|
||||||
mName->setCaption("");
|
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
||||||
|
|
||||||
mEnchanting.setSelfEnchanting(true);
|
mEnchanting.setSelfEnchanting(true);
|
||||||
mEnchanting.setEnchanter(player);
|
mEnchanting.setEnchanter(MWMechanics::getPlayer());
|
||||||
|
|
||||||
mBuyButton->setCaptionWithReplacing("#{sCreate}");
|
mBuyButton->setCaptionWithReplacing("#{sCreate}");
|
||||||
|
|
||||||
bool enabled = Settings::Manager::getBool("show enchant chance","Game");
|
bool enabled = Settings::Manager::getBool("show enchant chance","Game");
|
||||||
|
|
||||||
mChanceLayout->setVisible(enabled);
|
mChanceLayout->setVisible(enabled);
|
||||||
|
mPtr = MWMechanics::getPlayer();
|
||||||
mPtr = player;
|
setSoulGem(ptr);
|
||||||
startEditing();
|
|
||||||
|
|
||||||
setSoulGem(soulgem);
|
|
||||||
setItem(MWWorld::Ptr());
|
|
||||||
|
|
||||||
mPrice->setVisible(false);
|
mPrice->setVisible(false);
|
||||||
mPriceText->setVisible(false);
|
mPriceText->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
setItem(MWWorld::Ptr());
|
||||||
|
startEditing ();
|
||||||
updateLabels();
|
updateLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::onReferenceUnavailable ()
|
void EnchantingDialog::onReferenceUnavailable ()
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Dialogue);
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||||
resetReference();
|
resetReference();
|
||||||
}
|
}
|
||||||
|
@ -209,7 +190,7 @@ namespace MWGui
|
||||||
|
|
||||||
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Enchanting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)
|
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)
|
||||||
|
@ -304,6 +285,11 @@ namespace MWGui
|
||||||
updateEffectsView();
|
updateEffectsView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onAccept(MyGUI::EditBox *sender)
|
||||||
|
{
|
||||||
|
onBuyButtonClicked(sender);
|
||||||
|
}
|
||||||
|
|
||||||
void EnchantingDialog::onBuyButtonClicked(MyGUI::Widget* sender)
|
void EnchantingDialog::onBuyButtonClicked(MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
if (mEffects.size() <= 0)
|
if (mEffects.size() <= 0)
|
||||||
|
@ -364,7 +350,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, item, mPtr, 1);
|
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, item, mPtr, 1);
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,17 @@ namespace MWGui
|
||||||
EnchantingDialog();
|
EnchantingDialog();
|
||||||
virtual ~EnchantingDialog();
|
virtual ~EnchantingDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
void onFrame(float dt) { checkReferenceAvailable(); }
|
||||||
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
void setSoulGem (const MWWorld::Ptr& gem);
|
void setSoulGem (const MWWorld::Ptr& gem);
|
||||||
void setItem (const MWWorld::Ptr& item);
|
void setItem (const MWWorld::Ptr& item);
|
||||||
|
|
||||||
void startEnchanting(MWWorld::Ptr actor);
|
/// Actor Ptr: buy enchantment from this actor
|
||||||
void startSelfEnchanting(MWWorld::Ptr soulgem);
|
/// Soulgem Ptr: player self-enchant
|
||||||
|
void setPtr(const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
virtual void resetReference();
|
virtual void resetReference();
|
||||||
|
|
||||||
|
@ -46,6 +48,7 @@ namespace MWGui
|
||||||
void onBuyButtonClicked(MyGUI::Widget* sender);
|
void onBuyButtonClicked(MyGUI::Widget* sender);
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
void onTypeButtonClicked(MyGUI::Widget* sender);
|
void onTypeButtonClicked(MyGUI::Widget* sender);
|
||||||
|
void onAccept(MyGUI::EditBox* sender);
|
||||||
|
|
||||||
ItemSelectionDialog* mItemSelectionDialog;
|
ItemSelectionDialog* mItemSelectionDialog;
|
||||||
|
|
||||||
|
@ -58,7 +61,7 @@ namespace MWGui
|
||||||
MyGUI::Button* mTypeButton;
|
MyGUI::Button* mTypeButton;
|
||||||
MyGUI::Button* mBuyButton;
|
MyGUI::Button* mBuyButton;
|
||||||
|
|
||||||
MyGUI::TextBox* mName;
|
MyGUI::EditBox* mName;
|
||||||
MyGUI::TextBox* mEnchantmentPoints;
|
MyGUI::TextBox* mEnchantmentPoints;
|
||||||
MyGUI::TextBox* mCastCost;
|
MyGUI::TextBox* mCastCost;
|
||||||
MyGUI::TextBox* mCharge;
|
MyGUI::TextBox* mCharge;
|
||||||
|
|
|
@ -406,10 +406,11 @@ namespace MWGui
|
||||||
MyGUI::EditBox* box = parent->createWidget<MyGUI::EditBox>("NormalText",
|
MyGUI::EditBox* box = parent->createWidget<MyGUI::EditBox>("NormalText",
|
||||||
MyGUI::IntCoord(0, pag.getCurrentTop(), pag.getPageWidth(), 0), MyGUI::Align::Left | MyGUI::Align::Top,
|
MyGUI::IntCoord(0, pag.getCurrentTop(), pag.getPageWidth(), 0), MyGUI::Align::Left | MyGUI::Align::Top,
|
||||||
parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
|
parent->getName() + MyGUI::utility::toString(parent->getChildCount()));
|
||||||
box->setProperty("Static", "true");
|
box->setEditStatic(true);
|
||||||
box->setProperty("MultiLine", "true");
|
box->setEditMultiLine(true);
|
||||||
box->setProperty("WordWrap", "true");
|
box->setEditWordWrap(true);
|
||||||
box->setProperty("NeedMouse", "false");
|
box->setNeedMouseFocus(false);
|
||||||
|
box->setNeedKeyFocus(false);
|
||||||
box->setMaxTextLength(text.size());
|
box->setMaxTextLength(text.size());
|
||||||
box->setTextAlign(mBlockStyle.mAlign);
|
box->setTextAlign(mBlockStyle.mAlign);
|
||||||
box->setTextColour(mTextStyle.mColour);
|
box->setTextColour(mTextStyle.mColour);
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace MWGui
|
||||||
|
|
||||||
|
|
||||||
HUD::HUD(CustomMarkerCollection &customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender)
|
HUD::HUD(CustomMarkerCollection &customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender)
|
||||||
: Layout("openmw_hud.layout")
|
: WindowBase("openmw_hud.layout")
|
||||||
, LocalMapBase(customMarkers, localMapRender, Settings::Manager::getBool("local map hud fog of war", "Map"))
|
, LocalMapBase(customMarkers, localMapRender, Settings::Manager::getBool("local map hud fog of war", "Map"))
|
||||||
, mHealth(NULL)
|
, mHealth(NULL)
|
||||||
, mMagicka(NULL)
|
, mMagicka(NULL)
|
||||||
|
@ -371,6 +371,20 @@ namespace MWGui
|
||||||
|
|
||||||
if (mIsDrowning)
|
if (mIsDrowning)
|
||||||
mDrowningFlashTheta += dt * osg::PI*2;
|
mDrowningFlashTheta += dt * osg::PI*2;
|
||||||
|
|
||||||
|
mSpellIcons->updateWidgets(mEffectBox, true);
|
||||||
|
|
||||||
|
if (mEnemyActorId != -1 && mEnemyHealth->getVisible())
|
||||||
|
{
|
||||||
|
updateEnemyHealthBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mIsDrowning)
|
||||||
|
{
|
||||||
|
float intensity = (cos(mDrowningFlashTheta) + 2.0f) / 3.0f;
|
||||||
|
|
||||||
|
mDrowningFlash->setAlpha(intensity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
||||||
|
@ -602,23 +616,6 @@ namespace MWGui
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::update()
|
|
||||||
{
|
|
||||||
mSpellIcons->updateWidgets(mEffectBox, true);
|
|
||||||
|
|
||||||
if (mEnemyActorId != -1 && mEnemyHealth->getVisible())
|
|
||||||
{
|
|
||||||
updateEnemyHealthBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mIsDrowning)
|
|
||||||
{
|
|
||||||
float intensity = (cos(mDrowningFlashTheta) + 2.0f) / 3.0f;
|
|
||||||
|
|
||||||
mDrowningFlash->setAlpha(intensity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HUD::setEnemy(const MWWorld::Ptr &enemy)
|
void HUD::setEnemy(const MWWorld::Ptr &enemy)
|
||||||
{
|
{
|
||||||
mEnemyActorId = enemy.getClass().getCreatureStats(enemy).getActorId();
|
mEnemyActorId = enemy.getClass().getCreatureStats(enemy).getActorId();
|
||||||
|
@ -635,6 +632,13 @@ namespace MWGui
|
||||||
mEnemyHealthTimer = -1;
|
mEnemyHealthTimer = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HUD::clear()
|
||||||
|
{
|
||||||
|
unsetSelectedSpell();
|
||||||
|
unsetSelectedWeapon();
|
||||||
|
resetEnemy();
|
||||||
|
}
|
||||||
|
|
||||||
void HUD::customMarkerCreated(MyGUI::Widget *marker)
|
void HUD::customMarkerCreated(MyGUI::Widget *marker)
|
||||||
{
|
{
|
||||||
marker->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
marker->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MWGui
|
||||||
class SpellIcons;
|
class SpellIcons;
|
||||||
class ItemWidget;
|
class ItemWidget;
|
||||||
|
|
||||||
class HUD : public Layout, public LocalMapBase
|
class HUD : public WindowBase, public LocalMapBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender);
|
HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender);
|
||||||
|
@ -55,11 +55,11 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::Widget* getEffectBox() { return mEffectBox; }
|
MyGUI::Widget* getEffectBox() { return mEffectBox; }
|
||||||
|
|
||||||
void update();
|
|
||||||
|
|
||||||
void setEnemy(const MWWorld::Ptr& enemy);
|
void setEnemy(const MWWorld::Ptr& enemy);
|
||||||
void resetEnemy();
|
void resetEnemy();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
|
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
|
||||||
MyGUI::Widget* mHealthFrame;
|
MyGUI::Widget* mHealthFrame;
|
||||||
|
|
|
@ -363,7 +363,7 @@ namespace MWGui
|
||||||
dirtyPreview();
|
dirtyPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::open()
|
void InventoryWindow::onOpen()
|
||||||
{
|
{
|
||||||
if (!mPtr.isEmpty())
|
if (!mPtr.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -589,11 +589,8 @@ namespace MWGui
|
||||||
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
|
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::onFrame()
|
void InventoryWindow::onFrame(float dt)
|
||||||
{
|
{
|
||||||
if (!mMainWidget->getVisible())
|
|
||||||
return;
|
|
||||||
|
|
||||||
updateEncumbranceBar();
|
updateEncumbranceBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,12 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem);
|
InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem);
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
/// start trading, disables item drag&drop
|
/// start trading, disables item drag&drop
|
||||||
void setTrading(bool trading);
|
void setTrading(bool trading);
|
||||||
|
|
||||||
void onFrame();
|
void onFrame(float dt);
|
||||||
|
|
||||||
void pickUpObject (MWWorld::Ptr object);
|
void pickUpObject (MWWorld::Ptr object);
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,10 @@ namespace MWGui
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemSelectionDialog::exit()
|
bool ItemSelectionDialog::exit()
|
||||||
{
|
{
|
||||||
eventDialogCanceled();
|
eventDialogCanceled();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemSelectionDialog::openContainer(const MWWorld::Ptr& container)
|
void ItemSelectionDialog::openContainer(const MWWorld::Ptr& container)
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
ItemSelectionDialog(const std::string& label);
|
ItemSelectionDialog(const std::string& label);
|
||||||
|
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;
|
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;
|
||||||
|
|
|
@ -26,8 +26,6 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
getWidget(mProgressBar, "ProgressBar");
|
getWidget(mProgressBar, "ProgressBar");
|
||||||
|
|
||||||
setVisible(false);
|
|
||||||
|
|
||||||
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &JailScreen::onJailProgressChanged);
|
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &JailScreen::onJailProgressChanged);
|
||||||
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &JailScreen::onJailFinished);
|
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &JailScreen::onJailFinished);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace MWGui
|
||||||
|
|
||||||
void onFrame(float dt);
|
void onFrame(float dt);
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mDays;
|
int mDays;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <MyGUI_TextBox.h>
|
#include <MyGUI_TextBox.h>
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
|
#include <MyGUI_InputManager.h>
|
||||||
|
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
#include <components/widgets/imagebutton.hpp>
|
#include <components/widgets/imagebutton.hpp>
|
||||||
|
@ -44,7 +45,7 @@ namespace
|
||||||
static char const LeftTopicIndex [] = "LeftTopicIndex";
|
static char const LeftTopicIndex [] = "LeftTopicIndex";
|
||||||
static char const RightTopicIndex [] = "RightTopicIndex";
|
static char const RightTopicIndex [] = "RightTopicIndex";
|
||||||
|
|
||||||
struct JournalWindowImpl : MWGui::WindowBase, MWGui::JournalBooks, MWGui::JournalWindow
|
struct JournalWindowImpl : MWGui::JournalBooks, MWGui::JournalWindow
|
||||||
{
|
{
|
||||||
struct DisplayState
|
struct DisplayState
|
||||||
{
|
{
|
||||||
|
@ -84,19 +85,24 @@ namespace
|
||||||
|
|
||||||
void adviseButtonClick (char const * name, void (JournalWindowImpl::*Handler) (MyGUI::Widget* _sender))
|
void adviseButtonClick (char const * name, void (JournalWindowImpl::*Handler) (MyGUI::Widget* _sender))
|
||||||
{
|
{
|
||||||
getWidget <Gui::ImageButton> (name) ->
|
getWidget <MyGUI::Widget> (name) ->
|
||||||
eventMouseButtonClick += newDelegate(this, Handler);
|
eventMouseButtonClick += newDelegate(this, Handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void adviseKeyPress (char const * name, void (JournalWindowImpl::*Handler) (MyGUI::Widget* _sender, MyGUI::KeyCode key, MyGUI::Char character))
|
||||||
|
{
|
||||||
|
getWidget <MyGUI::Widget> (name) ->
|
||||||
|
eventKeyButtonPressed += newDelegate(this, Handler);
|
||||||
|
}
|
||||||
|
|
||||||
MWGui::BookPage* getPage (char const * name)
|
MWGui::BookPage* getPage (char const * name)
|
||||||
{
|
{
|
||||||
return getWidget <MWGui::BookPage> (name);
|
return getWidget <MWGui::BookPage> (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList)
|
JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList)
|
||||||
: WindowBase("openmw_journal.layout"), JournalBooks (Model)
|
: JournalBooks (Model), JournalWindow()
|
||||||
{
|
{
|
||||||
mMainWidget->setVisible(false);
|
|
||||||
center();
|
center();
|
||||||
|
|
||||||
adviseButtonClick (OptionsBTN, &JournalWindowImpl::notifyOptions );
|
adviseButtonClick (OptionsBTN, &JournalWindowImpl::notifyOptions );
|
||||||
|
@ -112,6 +118,12 @@ namespace
|
||||||
adviseButtonClick (ShowAllBTN, &JournalWindowImpl::notifyShowAll );
|
adviseButtonClick (ShowAllBTN, &JournalWindowImpl::notifyShowAll );
|
||||||
adviseButtonClick (ShowActiveBTN, &JournalWindowImpl::notifyShowActive);
|
adviseButtonClick (ShowActiveBTN, &JournalWindowImpl::notifyShowActive);
|
||||||
|
|
||||||
|
adviseKeyPress (OptionsBTN, &JournalWindowImpl::notifyKeyPress);
|
||||||
|
adviseKeyPress (PrevPageBTN, &JournalWindowImpl::notifyKeyPress);
|
||||||
|
adviseKeyPress (NextPageBTN, &JournalWindowImpl::notifyKeyPress);
|
||||||
|
adviseKeyPress (CloseBTN, &JournalWindowImpl::notifyKeyPress);
|
||||||
|
adviseKeyPress (JournalBTN, &JournalWindowImpl::notifyKeyPress);
|
||||||
|
|
||||||
Gui::MWList* list = getWidget<Gui::MWList>(QuestsList);
|
Gui::MWList* list = getWidget<Gui::MWList>(QuestsList);
|
||||||
list->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyQuestClicked);
|
list->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyQuestClicked);
|
||||||
|
|
||||||
|
@ -211,7 +223,7 @@ namespace
|
||||||
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void open()
|
void onOpen()
|
||||||
{
|
{
|
||||||
if (!MWBase::Environment::get().getWindowManager ()->getJournalAllowed ())
|
if (!MWBase::Environment::get().getWindowManager ()->getJournalAllowed ())
|
||||||
{
|
{
|
||||||
|
@ -238,9 +250,11 @@ namespace
|
||||||
--page;
|
--page;
|
||||||
}
|
}
|
||||||
updateShowingPages();
|
updateShowingPages();
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(getWidget<MyGUI::Widget>(CloseBTN));
|
||||||
}
|
}
|
||||||
|
|
||||||
void close()
|
void onClose()
|
||||||
{
|
{
|
||||||
mModel->unload ();
|
mModel->unload ();
|
||||||
|
|
||||||
|
@ -349,8 +363,19 @@ namespace
|
||||||
relPages = 0;
|
relPages = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible (PrevPageBTN, page > 0);
|
MyGUI::Widget* nextPageBtn = getWidget<MyGUI::Widget>(NextPageBTN);
|
||||||
setVisible (NextPageBTN, relPages > 2);
|
MyGUI::Widget* prevPageBtn = getWidget<MyGUI::Widget>(PrevPageBTN);
|
||||||
|
|
||||||
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
bool nextPageVisible = relPages > 2;
|
||||||
|
nextPageBtn->setVisible(nextPageVisible);
|
||||||
|
bool prevPageVisible = page > 0;
|
||||||
|
prevPageBtn->setVisible(prevPageVisible);
|
||||||
|
|
||||||
|
if (focus == nextPageBtn && !nextPageVisible && prevPageVisible)
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(prevPageBtn);
|
||||||
|
else if (focus == prevPageBtn && !prevPageVisible && nextPageVisible)
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(nextPageBtn);
|
||||||
|
|
||||||
setVisible (PageOneNum, relPages > 0);
|
setVisible (PageOneNum, relPages > 0);
|
||||||
setVisible (PageTwoNum, relPages > 1);
|
setVisible (PageTwoNum, relPages > 1);
|
||||||
|
@ -362,6 +387,14 @@ namespace
|
||||||
setText (PageTwoNum, page + 2);
|
setText (PageTwoNum, page + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void notifyKeyPress(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character)
|
||||||
|
{
|
||||||
|
if (key == MyGUI::KeyCode::ArrowUp)
|
||||||
|
notifyPrevPage(sender);
|
||||||
|
else if (key == MyGUI::KeyCode::ArrowDown)
|
||||||
|
notifyNextPage(sender);
|
||||||
|
}
|
||||||
|
|
||||||
void notifyTopicClicked (intptr_t linkId)
|
void notifyTopicClicked (intptr_t linkId)
|
||||||
{
|
{
|
||||||
Book topicBook = createTopicBook (linkId);
|
Book topicBook = createTopicBook (linkId);
|
||||||
|
@ -603,3 +636,9 @@ MWGui::JournalWindow * MWGui::JournalWindow::create (JournalViewModel::Ptr Model
|
||||||
{
|
{
|
||||||
return new JournalWindowImpl (Model, questList);
|
return new JournalWindowImpl (Model, questList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWGui::JournalWindow::JournalWindow()
|
||||||
|
:WindowBase("openmw_journal.layout")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef MWGUI_JOURNAL_H
|
#ifndef MWGUI_JOURNAL_H
|
||||||
#define MWGUI_JOURNAL_H
|
#define MWGUI_JOURNAL_H
|
||||||
|
|
||||||
|
#include "windowbase.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace MWBase { class WindowManager; }
|
namespace MWBase { class WindowManager; }
|
||||||
|
@ -9,8 +11,10 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
struct JournalViewModel;
|
struct JournalViewModel;
|
||||||
|
|
||||||
struct JournalWindow
|
struct JournalWindow : public WindowBase
|
||||||
{
|
{
|
||||||
|
JournalWindow();
|
||||||
|
|
||||||
/// construct a new instance of the one JournalWindow implementation
|
/// construct a new instance of the one JournalWindow implementation
|
||||||
static JournalWindow * create (std::shared_ptr <JournalViewModel> Model, bool questList);
|
static JournalWindow * create (std::shared_ptr <JournalViewModel> Model, bool questList);
|
||||||
|
|
||||||
|
|
283
apps/openmw/mwgui/keyboardnavigation.cpp
Normal file
283
apps/openmw/mwgui/keyboardnavigation.cpp
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
#include "keyboardnavigation.hpp"
|
||||||
|
|
||||||
|
#include <MyGUI_InputManager.h>
|
||||||
|
#include <MyGUI_WidgetManager.h>
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
|
#include <MyGUI_Gui.h>
|
||||||
|
#include <MyGUI_Window.h>
|
||||||
|
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
/// Recursively get all child widgets that accept keyboard input
|
||||||
|
void getKeyFocusWidgets(MyGUI::Widget* parent, std::vector<MyGUI::Widget*>& results)
|
||||||
|
{
|
||||||
|
if (!parent->getVisible() || !parent->getEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
MyGUI::EnumeratorWidgetPtr enumerator = parent->getEnumerator();
|
||||||
|
while (enumerator.next())
|
||||||
|
{
|
||||||
|
MyGUI::Widget* w = enumerator.current();
|
||||||
|
if (!w->getVisible() || !w->getEnabled())
|
||||||
|
continue;
|
||||||
|
if (w->getNeedKeyFocus())
|
||||||
|
results.push_back(w);
|
||||||
|
else
|
||||||
|
getKeyFocusWidgets(w, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shouldAcceptKeyFocus(MyGUI::Widget* w)
|
||||||
|
{
|
||||||
|
return w && !w->castType<MyGUI::Window>(false) && w->getInheritedEnabled() && w->getInheritedVisible() && w->getVisible() && w->getEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyboardNavigation::KeyboardNavigation()
|
||||||
|
: mCurrentFocus(nullptr)
|
||||||
|
, mModalWindow(nullptr)
|
||||||
|
{
|
||||||
|
MyGUI::WidgetManager::getInstance().registerUnlinker(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyboardNavigation::~KeyboardNavigation()
|
||||||
|
{
|
||||||
|
MyGUI::WidgetManager::getInstance().unregisterUnlinker(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyboardNavigation::saveFocus(int mode)
|
||||||
|
{
|
||||||
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
if (shouldAcceptKeyFocus(focus))
|
||||||
|
{
|
||||||
|
mKeyFocus[mode] = focus;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mKeyFocus[mode] = mCurrentFocus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyboardNavigation::restoreFocus(int mode)
|
||||||
|
{
|
||||||
|
std::map<int, MyGUI::Widget*>::const_iterator found = mKeyFocus.find(mode);
|
||||||
|
if (found != mKeyFocus.end())
|
||||||
|
{
|
||||||
|
MyGUI::Widget* w = found->second;
|
||||||
|
if (w && w->getVisible() && w->getEnabled())
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(found->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyboardNavigation::_unlinkWidget(MyGUI::Widget *widget)
|
||||||
|
{
|
||||||
|
for (std::pair<const int, MyGUI::Widget*>& w : mKeyFocus)
|
||||||
|
if (w.second == widget)
|
||||||
|
w.second = nullptr;
|
||||||
|
if (widget == mCurrentFocus)
|
||||||
|
mCurrentFocus = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void styleFocusedButton(MyGUI::Widget* w)
|
||||||
|
{
|
||||||
|
if (w)
|
||||||
|
{
|
||||||
|
if (MyGUI::Button* b = w->castType<MyGUI::Button>(false))
|
||||||
|
{
|
||||||
|
b->_setWidgetState("highlighted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isRootParent(MyGUI::Widget* widget, MyGUI::Widget* root)
|
||||||
|
{
|
||||||
|
while (widget && widget->getParent())
|
||||||
|
widget = widget->getParent();
|
||||||
|
return widget == root;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyboardNavigation::onFrame()
|
||||||
|
{
|
||||||
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
|
||||||
|
if (focus == mCurrentFocus)
|
||||||
|
{
|
||||||
|
styleFocusedButton(mCurrentFocus);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// workaround incorrect key focus resets (fix in MyGUI TBD)
|
||||||
|
if (!shouldAcceptKeyFocus(focus) && shouldAcceptKeyFocus(mCurrentFocus) && (!mModalWindow || isRootParent(mCurrentFocus, mModalWindow)))
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCurrentFocus);
|
||||||
|
focus = mCurrentFocus;
|
||||||
|
}
|
||||||
|
|
||||||
|
// style highlighted button (won't be needed for MyGUI 3.2.3)
|
||||||
|
if (focus != mCurrentFocus)
|
||||||
|
{
|
||||||
|
if (mCurrentFocus)
|
||||||
|
{
|
||||||
|
if (MyGUI::Button* b = mCurrentFocus->castType<MyGUI::Button>(false))
|
||||||
|
b->_setWidgetState("normal");
|
||||||
|
}
|
||||||
|
|
||||||
|
mCurrentFocus = focus;
|
||||||
|
}
|
||||||
|
|
||||||
|
styleFocusedButton(mCurrentFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyboardNavigation::setDefaultFocus(MyGUI::Widget *window, MyGUI::Widget *defaultFocus)
|
||||||
|
{
|
||||||
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
if (!focus || !shouldAcceptKeyFocus(focus))
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(defaultFocus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!isRootParent(focus, window))
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(defaultFocus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyboardNavigation::setModalWindow(MyGUI::Widget *window)
|
||||||
|
{
|
||||||
|
mModalWindow = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Direction
|
||||||
|
{
|
||||||
|
D_Left,
|
||||||
|
D_Up,
|
||||||
|
D_Right,
|
||||||
|
D_Down,
|
||||||
|
D_Next,
|
||||||
|
D_Prev
|
||||||
|
};
|
||||||
|
|
||||||
|
bool KeyboardNavigation::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
|
||||||
|
{
|
||||||
|
switch (key.getValue())
|
||||||
|
{
|
||||||
|
case MyGUI::KeyCode::ArrowLeft:
|
||||||
|
return switchFocus(D_Left, false);
|
||||||
|
case MyGUI::KeyCode::ArrowRight:
|
||||||
|
return switchFocus(D_Right, false);
|
||||||
|
case MyGUI::KeyCode::ArrowUp:
|
||||||
|
return switchFocus(D_Up, false);
|
||||||
|
case MyGUI::KeyCode::ArrowDown:
|
||||||
|
return switchFocus(D_Down, false);
|
||||||
|
case MyGUI::KeyCode::Tab:
|
||||||
|
return switchFocus(MyGUI::InputManager::getInstance().isShiftPressed() ? D_Prev : D_Next, true);
|
||||||
|
case MyGUI::KeyCode::Return:
|
||||||
|
case MyGUI::KeyCode::NumpadEnter:
|
||||||
|
case MyGUI::KeyCode::Space:
|
||||||
|
return accept();
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KeyboardNavigation::switchFocus(int direction, bool wrap)
|
||||||
|
{
|
||||||
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
|
||||||
|
bool isCycle = (direction == D_Prev || direction == D_Next);
|
||||||
|
|
||||||
|
if ((focus && focus->getTypeName().find("Button") == std::string::npos) && !isCycle)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (focus && isCycle && focus->getUserString("AcceptTab") == "true")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ((!focus || !focus->getNeedKeyFocus()) && isCycle)
|
||||||
|
{
|
||||||
|
// if nothing is selected, select the first widget
|
||||||
|
return selectFirstWidget();
|
||||||
|
}
|
||||||
|
if (!focus)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MyGUI::Widget* window = focus;
|
||||||
|
while (window && window->getParent())
|
||||||
|
window = window->getParent();
|
||||||
|
MyGUI::VectorWidgetPtr keyFocusList;
|
||||||
|
getKeyFocusWidgets(window, keyFocusList);
|
||||||
|
|
||||||
|
if (keyFocusList.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MyGUI::VectorWidgetPtr::iterator found = std::find(keyFocusList.begin(), keyFocusList.end(), focus);
|
||||||
|
if (found == keyFocusList.end())
|
||||||
|
{
|
||||||
|
if (isCycle)
|
||||||
|
return selectFirstWidget();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool forward = (direction == D_Next || direction == D_Right || direction == D_Down);
|
||||||
|
|
||||||
|
int index = found - keyFocusList.begin();
|
||||||
|
index = forward ? (index+1) : (index-1);
|
||||||
|
if (wrap)
|
||||||
|
index = (index + keyFocusList.size())%keyFocusList.size();
|
||||||
|
else
|
||||||
|
index = std::min(std::max(0, index), static_cast<int>(keyFocusList.size())-1);
|
||||||
|
|
||||||
|
MyGUI::Widget* next = keyFocusList[index];
|
||||||
|
int vertdiff = next->getTop() - focus->getTop();
|
||||||
|
int horizdiff = next->getLeft() - focus->getLeft();
|
||||||
|
bool isVertical = std::abs(vertdiff) > std::abs(horizdiff);
|
||||||
|
if (direction == D_Right && (horizdiff <= 0 || isVertical))
|
||||||
|
return false;
|
||||||
|
else if (direction == D_Left && (horizdiff >= 0 || isVertical))
|
||||||
|
return false;
|
||||||
|
else if (direction == D_Down && (vertdiff <= 0 || !isVertical))
|
||||||
|
return false;
|
||||||
|
else if (direction == D_Up && (vertdiff >= 0 || !isVertical))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(keyFocusList[index]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KeyboardNavigation::selectFirstWidget()
|
||||||
|
{
|
||||||
|
MyGUI::VectorWidgetPtr keyFocusList;
|
||||||
|
MyGUI::EnumeratorWidgetPtr enumerator = MyGUI::Gui::getInstance().getEnumerator();
|
||||||
|
if (mModalWindow)
|
||||||
|
enumerator = mModalWindow->getEnumerator();
|
||||||
|
while (enumerator.next())
|
||||||
|
getKeyFocusWidgets(enumerator.current(), keyFocusList);
|
||||||
|
|
||||||
|
if (!keyFocusList.empty())
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(keyFocusList[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KeyboardNavigation::accept()
|
||||||
|
{
|
||||||
|
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
|
||||||
|
if (!focus)
|
||||||
|
return false;
|
||||||
|
//MyGUI::Button* button = focus->castType<MyGUI::Button>(false);
|
||||||
|
//if (button && button->getEnabled())
|
||||||
|
if (focus->getTypeName().find("Button") != std::string::npos && focus->getEnabled())
|
||||||
|
{
|
||||||
|
focus->eventMouseButtonClick(focus);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
47
apps/openmw/mwgui/keyboardnavigation.hpp
Normal file
47
apps/openmw/mwgui/keyboardnavigation.hpp
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#ifndef OPENMW_MWGUI_KEYBOARDNAVIGATION_H
|
||||||
|
#define OPENMW_MWGUI_KEYBOARDNAVIGATION_H
|
||||||
|
|
||||||
|
#include <MyGUI_KeyCode.h>
|
||||||
|
#include <MyGUI_IUnlinkWidget.h>
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
class KeyboardNavigation : public MyGUI::IUnlinkWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KeyboardNavigation();
|
||||||
|
~KeyboardNavigation();
|
||||||
|
|
||||||
|
/// @return Was the key handled by this class?
|
||||||
|
bool injectKeyPress(MyGUI::KeyCode key, unsigned int text);
|
||||||
|
|
||||||
|
void saveFocus(int mode);
|
||||||
|
void restoreFocus(int mode);
|
||||||
|
|
||||||
|
void _unlinkWidget(MyGUI::Widget* widget);
|
||||||
|
|
||||||
|
void onFrame();
|
||||||
|
|
||||||
|
/// Set a key focus widget for this window, if one isn't already set.
|
||||||
|
void setDefaultFocus(MyGUI::Widget* window, MyGUI::Widget* defaultFocus);
|
||||||
|
|
||||||
|
void setModalWindow(MyGUI::Widget* window);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool switchFocus(int direction, bool wrap);
|
||||||
|
|
||||||
|
bool selectFirstWidget();
|
||||||
|
|
||||||
|
/// Send button press event to focused button
|
||||||
|
bool accept();
|
||||||
|
|
||||||
|
std::map<int, MyGUI::Widget*> mKeyFocus;
|
||||||
|
|
||||||
|
MyGUI::Widget* mCurrentFocus;
|
||||||
|
MyGUI::Widget* mModalWindow;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -41,6 +41,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
MyGUI::TextBox* t;
|
MyGUI::TextBox* t;
|
||||||
getWidget(t, "AttribVal" + MyGUI::utility::toString(i));
|
getWidget(t, "AttribVal" + MyGUI::utility::toString(i));
|
||||||
|
mAttributeValues.push_back(t);
|
||||||
|
|
||||||
MyGUI::Button* b;
|
MyGUI::Button* b;
|
||||||
getWidget(b, "Attrib" + MyGUI::utility::toString(i));
|
getWidget(b, "Attrib" + MyGUI::utility::toString(i));
|
||||||
|
@ -48,10 +49,7 @@ namespace MWGui
|
||||||
b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked);
|
b->eventMouseButtonClick += MyGUI::newDelegate(this, &LevelupDialog::onAttributeClicked);
|
||||||
mAttributes.push_back(b);
|
mAttributes.push_back(b);
|
||||||
|
|
||||||
mAttributeValues.push_back(t);
|
|
||||||
|
|
||||||
getWidget(t, "AttribMultiplier" + MyGUI::utility::toString(i));
|
getWidget(t, "AttribMultiplier" + MyGUI::utility::toString(i));
|
||||||
|
|
||||||
mAttributeMultipliers.push_back(t);
|
mAttributeMultipliers.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +126,7 @@ namespace MWGui
|
||||||
setAttributeValues();
|
setAttributeValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelupDialog::open()
|
void LevelupDialog::onOpen()
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
MWWorld::Ptr player = world->getPlayerPtr();
|
MWWorld::Ptr player = world->getPlayerPtr();
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
LevelupDialog();
|
LevelupDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
|
|
|
@ -51,8 +51,6 @@ namespace MWGui
|
||||||
mBackgroundImage = MyGUI::Gui::getInstance().createWidgetReal<BackgroundImage>("ImageBox", 0,0,1,1,
|
mBackgroundImage = MyGUI::Gui::getInstance().createWidgetReal<BackgroundImage>("ImageBox", 0,0,1,1,
|
||||||
MyGUI::Align::Stretch, "Menu");
|
MyGUI::Align::Stretch, "Menu");
|
||||||
|
|
||||||
setVisible(false);
|
|
||||||
|
|
||||||
findSplashScreens();
|
findSplashScreens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
MainMenu::MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription)
|
MainMenu::MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription)
|
||||||
: Layout("openmw_mainmenu.layout")
|
: WindowBase("openmw_mainmenu.layout")
|
||||||
, mWidth (w), mHeight (h)
|
, mWidth (w), mHeight (h)
|
||||||
, mVFS(vfs), mButtonBox(0)
|
, mVFS(vfs), mButtonBox(0)
|
||||||
, mBackground(NULL)
|
, mBackground(NULL)
|
||||||
|
@ -56,15 +56,31 @@ namespace MWGui
|
||||||
if (visible)
|
if (visible)
|
||||||
updateMenu();
|
updateMenu();
|
||||||
|
|
||||||
showBackground(
|
bool isMainMenu =
|
||||||
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
|
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
|
||||||
MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame);
|
MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame;
|
||||||
|
|
||||||
|
showBackground(isMainMenu);
|
||||||
|
|
||||||
|
if (visible)
|
||||||
|
{
|
||||||
|
if (isMainMenu)
|
||||||
|
{
|
||||||
|
if (mButtons["loadgame"]->getVisible())
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mButtons["loadgame"]);
|
||||||
|
else
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mButtons["newgame"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mButtons["return"]);
|
||||||
|
}
|
||||||
|
|
||||||
Layout::setVisible (visible);
|
Layout::setVisible (visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::onNewGameConfirmed()
|
void MainMenu::onNewGameConfirmed()
|
||||||
{
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_MainMenu);
|
||||||
MWBase::Environment::get().getStateManager()->newGame();
|
MWBase::Environment::get().getStateManager()->newGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +198,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainMenu::update(float dt)
|
void MainMenu::onFrame(float dt)
|
||||||
{
|
{
|
||||||
if (mVideo)
|
if (mVideo)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +247,8 @@ namespace MWGui
|
||||||
buttons.push_back("exitgame");
|
buttons.push_back("exitgame");
|
||||||
|
|
||||||
// Create new buttons if needed
|
// Create new buttons if needed
|
||||||
for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it)
|
std::vector<std::string> allButtons { "return", "newgame", "savegame", "loadgame", "options", "credits", "exitgame"};
|
||||||
|
for (std::vector<std::string>::iterator it = allButtons.begin(); it != allButtons.end(); ++it)
|
||||||
{
|
{
|
||||||
if (mButtons.find(*it) == mButtons.end())
|
if (mButtons.find(*it) == mButtons.end())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef OPENMW_GAME_MWGUI_MAINMENU_H
|
#ifndef OPENMW_GAME_MWGUI_MAINMENU_H
|
||||||
#define OPENMW_GAME_MWGUI_MAINMENU_H
|
#define OPENMW_GAME_MWGUI_MAINMENU_H
|
||||||
|
|
||||||
#include "layout.hpp"
|
#include "windowbase.hpp"
|
||||||
|
|
||||||
namespace Gui
|
namespace Gui
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace MWGui
|
||||||
class SaveGameDialog;
|
class SaveGameDialog;
|
||||||
class VideoWidget;
|
class VideoWidget;
|
||||||
|
|
||||||
class MainMenu : public Layout
|
class MainMenu : public WindowBase
|
||||||
{
|
{
|
||||||
int mWidth;
|
int mWidth;
|
||||||
int mHeight;
|
int mHeight;
|
||||||
|
@ -36,7 +36,7 @@ namespace MWGui
|
||||||
|
|
||||||
virtual void setVisible (bool visible);
|
virtual void setVisible (bool visible);
|
||||||
|
|
||||||
void update(float dt);
|
void onFrame(float dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const VFS::Manager* mVFS;
|
const VFS::Manager* mVFS;
|
||||||
|
|
|
@ -701,7 +701,7 @@ namespace MWGui
|
||||||
void MapWindow::onNoteEditDelete()
|
void MapWindow::onNoteEditDelete()
|
||||||
{
|
{
|
||||||
ConfirmationDialog* confirmation = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
|
ConfirmationDialog* confirmation = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
|
||||||
confirmation->askForConfirmation("#{sDeleteNote}", "#{sYes}", "#{sNo}");
|
confirmation->askForConfirmation("#{sDeleteNote}");
|
||||||
confirmation->eventCancelClicked.clear();
|
confirmation->eventCancelClicked.clear();
|
||||||
confirmation->eventOkClicked.clear();
|
confirmation->eventOkClicked.clear();
|
||||||
confirmation->eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDeleteConfirm);
|
confirmation->eventOkClicked += MyGUI::newDelegate(this, &MapWindow::onNoteEditDeleteConfirm);
|
||||||
|
@ -943,7 +943,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Map);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::open()
|
void MapWindow::onOpen()
|
||||||
{
|
{
|
||||||
ensureGlobalMapLoaded();
|
ensureGlobalMapLoaded();
|
||||||
|
|
||||||
|
@ -1107,18 +1107,13 @@ namespace MWGui
|
||||||
return MyGUI::TextIterator::getOnlyText(mTextEdit->getCaption());
|
return MyGUI::TextIterator::getOnlyText(mTextEdit->getCaption());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditNoteDialog::open()
|
void EditNoteDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
center();
|
center();
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditNoteDialog::exit()
|
|
||||||
{
|
|
||||||
setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditNoteDialog::onCancelButtonClicked(MyGUI::Widget *sender)
|
void EditNoteDialog::onCancelButtonClicked(MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
|
@ -169,8 +169,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
EditNoteDialog();
|
EditNoteDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
void showDeleteButton(bool show);
|
void showDeleteButton(bool show);
|
||||||
bool getDeleteButtonShown();
|
bool getDeleteButtonShown();
|
||||||
|
@ -218,7 +217,7 @@ namespace MWGui
|
||||||
|
|
||||||
void ensureGlobalMapLoaded();
|
void ensureGlobalMapLoaded();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
void onFrame(float dt);
|
void onFrame(float dt);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ MerchantRepair::MerchantRepair()
|
||||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onOkButtonClick);
|
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onOkButtonClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
void MerchantRepair::setPtr(const MWWorld::Ptr &actor)
|
||||||
{
|
{
|
||||||
mActor = actor;
|
mActor = actor;
|
||||||
|
|
||||||
|
@ -111,18 +111,13 @@ void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
mList->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mList->getViewOffset().top + _rel*0.3f)));
|
mList->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mList->getViewOffset().top + _rel*0.3f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MerchantRepair::open()
|
void MerchantRepair::onOpen()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
// Reset scrollbars
|
// Reset scrollbars
|
||||||
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MerchantRepair::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
@ -145,12 +140,12 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
||||||
MWMechanics::CreatureStats& actorStats = mActor.getClass().getCreatureStats(mActor);
|
MWMechanics::CreatureStats& actorStats = mActor.getClass().getCreatureStats(mActor);
|
||||||
actorStats.setGoldPool(actorStats.getGoldPool() + price);
|
actorStats.setGoldPool(actorStats.getGoldPool() + price);
|
||||||
|
|
||||||
startRepair(mActor);
|
setPtr(mActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MerchantRepair::onOkButtonClick(MyGUI::Widget *sender)
|
void MerchantRepair::onOkButtonClick(MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,9 @@ class MerchantRepair : public WindowBase
|
||||||
public:
|
public:
|
||||||
MerchantRepair();
|
MerchantRepair();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
void setPtr(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void startRepair(const MWWorld::Ptr& actor);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::ScrollView* mList;
|
MyGUI::ScrollView* mList;
|
||||||
|
|
|
@ -36,8 +36,13 @@ namespace MWGui
|
||||||
|
|
||||||
void MessageBoxManager::clear()
|
void MessageBoxManager::clear()
|
||||||
{
|
{
|
||||||
|
if (mInterMessageBoxe)
|
||||||
|
{
|
||||||
|
mInterMessageBoxe->setVisible(false);
|
||||||
|
|
||||||
delete mInterMessageBoxe;
|
delete mInterMessageBoxe;
|
||||||
mInterMessageBoxe = NULL;
|
mInterMessageBoxe = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<MessageBox*>::iterator it(mMessageBoxes.begin());
|
std::vector<MessageBox*>::iterator it(mMessageBoxes.begin());
|
||||||
for (; it != mMessageBoxes.end(); ++it)
|
for (; it != mMessageBoxes.end(); ++it)
|
||||||
|
@ -77,6 +82,7 @@ namespace MWGui
|
||||||
|
|
||||||
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
|
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
|
||||||
mLastButtonPressed = mInterMessageBoxe->readPressedButton();
|
mLastButtonPressed = mInterMessageBoxe->readPressedButton();
|
||||||
|
mInterMessageBoxe->setVisible(false);
|
||||||
delete mInterMessageBoxe;
|
delete mInterMessageBoxe;
|
||||||
mInterMessageBoxe = NULL;
|
mInterMessageBoxe = NULL;
|
||||||
MWBase::Environment::get().getInputManager()->changeInputMode(
|
MWBase::Environment::get().getInputManager()->changeInputMode(
|
||||||
|
@ -200,7 +206,7 @@ namespace MWGui
|
||||||
, mMessageBoxManager(parMessageBoxManager)
|
, mMessageBoxManager(parMessageBoxManager)
|
||||||
, mButtonPressed(-1)
|
, mButtonPressed(-1)
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
setVisible(true);
|
||||||
|
|
||||||
int textPadding = 10; // padding between text-widget and main-widget
|
int textPadding = 10; // padding between text-widget and main-widget
|
||||||
int textButtonPadding = 10; // padding between the text-widget und the button-widget
|
int textButtonPadding = 10; // padding between the text-widget und the button-widget
|
||||||
|
@ -229,8 +235,7 @@ namespace MWGui
|
||||||
int buttonHeight = 0;
|
int buttonHeight = 0;
|
||||||
MyGUI::IntCoord dummyCoord(0, 0, 0, 0);
|
MyGUI::IntCoord dummyCoord(0, 0, 0, 0);
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator it;
|
for(std::vector<std::string>::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
|
||||||
for(it = buttons.begin(); it != buttons.end(); ++it)
|
|
||||||
{
|
{
|
||||||
MyGUI::Button* button = mButtonsWidget->createWidget<MyGUI::Button>(
|
MyGUI::Button* button = mButtonsWidget->createWidget<MyGUI::Button>(
|
||||||
MyGUI::WidgetStyle::Child,
|
MyGUI::WidgetStyle::Child,
|
||||||
|
@ -290,8 +295,7 @@ namespace MWGui
|
||||||
MyGUI::IntSize buttonSize(0, buttonHeight);
|
MyGUI::IntSize buttonSize(0, buttonHeight);
|
||||||
int left = (mainWidgetSize.width - buttonsWidth)/2;
|
int left = (mainWidgetSize.width - buttonsWidth)/2;
|
||||||
|
|
||||||
std::vector<MyGUI::Button*>::const_iterator button;
|
for(std::vector<MyGUI::Button*>::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
|
||||||
{
|
{
|
||||||
buttonCord.left = left;
|
buttonCord.left = left;
|
||||||
buttonCord.top = messageWidgetCoord.top + textSize.height + textButtonPadding;
|
buttonCord.top = messageWidgetCoord.top + textSize.height + textButtonPadding;
|
||||||
|
@ -320,8 +324,7 @@ namespace MWGui
|
||||||
|
|
||||||
int top = textPadding + textSize.height + textButtonPadding;
|
int top = textPadding + textSize.height + textButtonPadding;
|
||||||
|
|
||||||
std::vector<MyGUI::Button*>::const_iterator button;
|
for(std::vector<MyGUI::Button*>::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
|
||||||
{
|
{
|
||||||
buttonSize.width = (*button)->getTextSize().width + buttonLabelLeftPadding*2;
|
buttonSize.width = (*button)->getTextSize().width + buttonLabelLeftPadding*2;
|
||||||
buttonSize.height = (*button)->getTextSize().height + buttonLabelTopPadding*2;
|
buttonSize.height = (*button)->getTextSize().height + buttonLabelTopPadding*2;
|
||||||
|
@ -355,23 +358,18 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set key focus to "Ok" button
|
// Set key focus to "Ok" button
|
||||||
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
std::vector<std::string> keywords { "sOk", "sYes" };
|
||||||
std::vector<MyGUI::Button*>::const_iterator button;
|
for(std::vector<MyGUI::Button*>::const_iterator button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
|
||||||
{
|
{
|
||||||
if(Misc::StringUtils::ciEqual((*button)->getCaption(), ok))
|
for (const std::string& keyword : keywords)
|
||||||
|
{
|
||||||
|
if(Misc::StringUtils::ciEqual(MyGUI::LanguageManager::getInstance().replaceTags("#{" + keyword + "}"), (*button)->getCaption()))
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(*button);
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(*button);
|
||||||
(*button)->eventKeyButtonPressed += MyGUI::newDelegate(this, &InteractiveMessageBox::onKeyPressed);
|
return;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveMessageBox::onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char)
|
|
||||||
{
|
|
||||||
if (_key == MyGUI::KeyCode::Return || _key == MyGUI::KeyCode::NumpadEnter || _key == MyGUI::KeyCode::Space)
|
|
||||||
buttonActivated(_sender);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
|
void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
|
||||||
|
|
|
@ -77,11 +77,12 @@ namespace MWGui
|
||||||
void mousePressed (MyGUI::Widget* _widget);
|
void mousePressed (MyGUI::Widget* _widget);
|
||||||
int readPressedButton ();
|
int readPressedButton ();
|
||||||
|
|
||||||
|
virtual bool exit() { return false; }
|
||||||
|
|
||||||
bool mMarkedToDelete;
|
bool mMarkedToDelete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buttonActivated (MyGUI::Widget* _widget);
|
void buttonActivated (MyGUI::Widget* _widget);
|
||||||
void onKeyPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char);
|
|
||||||
|
|
||||||
MessageBoxManager& mMessageBoxManager;
|
MessageBoxManager& mMessageBoxManager;
|
||||||
MyGUI::EditBox* mMessageWidget;
|
MyGUI::EditBox* mMessageWidget;
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace MWGui
|
||||||
GM_Dialogue, // NPC interaction
|
GM_Dialogue, // NPC interaction
|
||||||
GM_Barter,
|
GM_Barter,
|
||||||
GM_Rest,
|
GM_Rest,
|
||||||
GM_RestBed,
|
|
||||||
GM_SpellBuying,
|
GM_SpellBuying,
|
||||||
GM_Travel,
|
GM_Travel,
|
||||||
GM_SpellCreation,
|
GM_SpellCreation,
|
||||||
|
|
|
@ -64,11 +64,6 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickKeysMenu::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_QuickKeysMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickKeysMenu::clear()
|
void QuickKeysMenu::clear()
|
||||||
{
|
{
|
||||||
mActivatedIndex = -1;
|
mActivatedIndex = -1;
|
||||||
|
@ -449,11 +444,6 @@ namespace MWGui
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickKeysMenuAssign::exit()
|
|
||||||
{
|
|
||||||
setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickKeysMenu::write(ESM::ESMWriter &writer)
|
void QuickKeysMenu::write(ESM::ESMWriter &writer)
|
||||||
{
|
{
|
||||||
writer.startRecord(ESM::REC_KEYS);
|
writer.startRecord(ESM::REC_KEYS);
|
||||||
|
@ -585,14 +575,15 @@ namespace MWGui
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MagicSelectionDialog::exit()
|
bool MagicSelectionDialog::exit()
|
||||||
{
|
{
|
||||||
mParent->onAssignMagicCancel();
|
mParent->onAssignMagicCancel();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MagicSelectionDialog::open ()
|
void MagicSelectionDialog::onOpen ()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
|
|
||||||
mMagicList->setModel(new SpellModel(MWMechanics::getPlayer()));
|
mMagicList->setModel(new SpellModel(MWMechanics::getPlayer()));
|
||||||
mMagicList->resetScrollbars();
|
mMagicList->resetScrollbars();
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MWGui
|
||||||
QuickKeysMenu();
|
QuickKeysMenu();
|
||||||
~QuickKeysMenu();
|
~QuickKeysMenu();
|
||||||
|
|
||||||
virtual void exit();
|
void onResChange(int, int) { center(); }
|
||||||
|
|
||||||
void onItemButtonClicked(MyGUI::Widget* sender);
|
void onItemButtonClicked(MyGUI::Widget* sender);
|
||||||
void onMagicButtonClicked(MyGUI::Widget* sender);
|
void onMagicButtonClicked(MyGUI::Widget* sender);
|
||||||
|
@ -77,7 +77,6 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QuickKeysMenuAssign(QuickKeysMenu* parent);
|
QuickKeysMenuAssign(QuickKeysMenu* parent);
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::TextBox* mLabel;
|
MyGUI::TextBox* mLabel;
|
||||||
|
@ -94,8 +93,8 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
MagicSelectionDialog(QuickKeysMenu* parent);
|
MagicSelectionDialog(QuickKeysMenu* parent);
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
|
|
@ -120,9 +120,9 @@ namespace MWGui
|
||||||
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::open()
|
void RaceDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
|
|
||||||
updateRaces();
|
updateRaces();
|
||||||
updateSkills();
|
updateSkills();
|
||||||
|
@ -163,6 +163,8 @@ namespace MWGui
|
||||||
size_t initialPos = mHeadRotate->getScrollRange()/2+mHeadRotate->getScrollRange()/10;
|
size_t initialPos = mHeadRotate->getScrollRange()/2+mHeadRotate->getScrollRange()/10;
|
||||||
mHeadRotate->setScrollPosition(initialPos);
|
mHeadRotate->setScrollPosition(initialPos);
|
||||||
onHeadRotate(mHeadRotate, initialPos);
|
onHeadRotate(mHeadRotate, initialPos);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mRaceList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::setRaceId(const std::string &raceId)
|
void RaceDialog::setRaceId(const std::string &raceId)
|
||||||
|
@ -183,8 +185,10 @@ namespace MWGui
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::close()
|
void RaceDialog::onClose()
|
||||||
{
|
{
|
||||||
|
WindowModal::onClose();
|
||||||
|
|
||||||
mPreviewImage->setRenderItemTexture(NULL);
|
mPreviewImage->setRenderItemTexture(NULL);
|
||||||
|
|
||||||
mPreviewTexture.reset(NULL);
|
mPreviewTexture.reset(NULL);
|
||||||
|
|
|
@ -51,8 +51,10 @@ namespace MWGui
|
||||||
void setGender(Gender gender) { mGenderIndex = gender == GM_Male ? 0 : 1; }
|
void setGender(Gender gender) { mGenderIndex = gender == GM_Male ? 0 : 1; }
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void close();
|
virtual void onClose();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "widgets.hpp"
|
|
||||||
#include "itemwidget.hpp"
|
#include "itemwidget.hpp"
|
||||||
#include "itemchargeview.hpp"
|
#include "itemchargeview.hpp"
|
||||||
#include "sortfilteritemmodel.hpp"
|
#include "sortfilteritemmodel.hpp"
|
||||||
|
@ -46,11 +45,9 @@ Recharge::Recharge()
|
||||||
mBox->setDisplayMode(ItemChargeView::DisplayMode_EnchantmentCharge);
|
mBox->setDisplayMode(ItemChargeView::DisplayMode_EnchantmentCharge);
|
||||||
|
|
||||||
mGemIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onSelectItem);
|
mGemIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onSelectItem);
|
||||||
|
|
||||||
setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Recharge::open()
|
void Recharge::onOpen()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
|
|
||||||
|
@ -62,12 +59,7 @@ void Recharge::open()
|
||||||
mBox->resetScrollbars();
|
mBox->resetScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Recharge::exit()
|
void Recharge::setPtr (const MWWorld::Ptr &item)
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Recharge::start (const MWWorld::Ptr &item)
|
|
||||||
{
|
{
|
||||||
mGemIcon->setItem(item);
|
mGemIcon->setItem(item);
|
||||||
mGemIcon->setUserString("ToolTipType", "ItemPtr");
|
mGemIcon->setUserString("ToolTipType", "ItemPtr");
|
||||||
|
@ -107,7 +99,7 @@ void Recharge::updateView()
|
||||||
|
|
||||||
void Recharge::onCancel(MyGUI::Widget *sender)
|
void Recharge::onCancel(MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Recharge::onSelectItem(MyGUI::Widget *sender)
|
void Recharge::onSelectItem(MyGUI::Widget *sender)
|
||||||
|
|
|
@ -22,11 +22,9 @@ class Recharge : public WindowBase
|
||||||
public:
|
public:
|
||||||
Recharge();
|
Recharge();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
void setPtr (const MWWorld::Ptr& gem);
|
||||||
|
|
||||||
void start (const MWWorld::Ptr& gem);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ItemChargeView* mBox;
|
ItemChargeView* mBox;
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
#include "referenceinterface.hpp"
|
#include "referenceinterface.hpp"
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
|
||||||
#include "../mwbase/environment.hpp"
|
|
||||||
|
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
ReferenceInterface::ReferenceInterface()
|
ReferenceInterface::ReferenceInterface()
|
||||||
: mCurrentPlayerCell(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +12,6 @@ namespace MWGui
|
||||||
|
|
||||||
void ReferenceInterface::checkReferenceAvailable()
|
void ReferenceInterface::checkReferenceAvailable()
|
||||||
{
|
{
|
||||||
MWWorld::CellStore* playerCell = MWMechanics::getPlayer().getCell();
|
|
||||||
|
|
||||||
// check if count of the reference has become 0
|
// check if count of the reference has become 0
|
||||||
if (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0)
|
if (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +21,5 @@ namespace MWGui
|
||||||
onReferenceUnavailable();
|
onReferenceUnavailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentPlayerCell = playerCell;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,12 @@ namespace MWGui
|
||||||
|
|
||||||
void checkReferenceAvailable(); ///< closes the window, if the MW-reference has become unavailable
|
void checkReferenceAvailable(); ///< closes the window, if the MW-reference has become unavailable
|
||||||
|
|
||||||
virtual void resetReference() { mPtr = MWWorld::Ptr(); mCurrentPlayerCell = NULL; }
|
virtual void resetReference() { mPtr = MWWorld::Ptr(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onReferenceUnavailable() = 0; ///< called when reference has become unavailable
|
virtual void onReferenceUnavailable() = 0; ///< called when reference has become unavailable
|
||||||
|
|
||||||
MWWorld::Ptr mPtr;
|
MWWorld::Ptr mPtr;
|
||||||
|
|
||||||
private:
|
|
||||||
MWWorld::CellStore* mCurrentPlayerCell;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "widgets.hpp"
|
|
||||||
|
|
||||||
#include "itemwidget.hpp"
|
#include "itemwidget.hpp"
|
||||||
#include "itemchargeview.hpp"
|
#include "itemchargeview.hpp"
|
||||||
#include "sortfilteritemmodel.hpp"
|
#include "sortfilteritemmodel.hpp"
|
||||||
|
@ -46,7 +44,7 @@ Repair::Repair()
|
||||||
mToolIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onSelectItem);
|
mToolIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onSelectItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repair::open()
|
void Repair::onOpen()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
|
|
||||||
|
@ -58,12 +56,7 @@ void Repair::open()
|
||||||
mRepairBox->resetScrollbars();
|
mRepairBox->resetScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repair::exit()
|
void Repair::setPtr(const MWWorld::Ptr &item)
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Repair::startRepairItem(const MWWorld::Ptr &item)
|
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up");
|
MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up");
|
||||||
|
|
||||||
|
@ -145,7 +138,7 @@ void Repair::onItemCancel()
|
||||||
|
|
||||||
void Repair::onCancel(MyGUI::Widget* /*sender*/)
|
void Repair::onCancel(MyGUI::Widget* /*sender*/)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repair::onRepairItem(MyGUI::Widget* /*sender*/, const MWWorld::Ptr& ptr)
|
void Repair::onRepairItem(MyGUI::Widget* /*sender*/, const MWWorld::Ptr& ptr)
|
||||||
|
|
|
@ -19,11 +19,9 @@ class Repair : public WindowBase
|
||||||
public:
|
public:
|
||||||
Repair();
|
Repair();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
void setPtr (const MWWorld::Ptr& item);
|
||||||
|
|
||||||
void startRepairItem (const MWWorld::Ptr& item);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ItemChargeView* mRepairBox;
|
ItemChargeView* mRepairBox;
|
||||||
|
|
|
@ -101,9 +101,9 @@ namespace MWGui
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::open()
|
void ReviewDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
mUpdateSkillArea = true;
|
mUpdateSkillArea = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace MWGui
|
||||||
|
|
||||||
ReviewDialog();
|
ReviewDialog();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
void setPlayerName(const std::string &name);
|
void setPlayerName(const std::string &name);
|
||||||
void setRace(const std::string &raceId);
|
void setRace(const std::string &raceId);
|
||||||
void setClass(const ESM::Class& class_);
|
void setClass(const ESM::Class& class_);
|
||||||
|
@ -45,7 +47,7 @@ namespace MWGui
|
||||||
void configureSkills(const SkillList& major, const SkillList& minor);
|
void configureSkills(const SkillList& major, const SkillList& minor);
|
||||||
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::SkillValue& value);
|
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::SkillValue& value);
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
void onFrame(float duration);
|
void onFrame(float duration);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include "../mwstate/character.hpp"
|
#include "../mwstate/character.hpp"
|
||||||
|
|
||||||
#include "confirmationdialog.hpp"
|
#include "confirmationdialog.hpp"
|
||||||
#include "widgets.hpp"
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -58,6 +57,9 @@ namespace MWGui
|
||||||
mSaveList->eventKeyButtonPressed += MyGUI::newDelegate(this, &SaveGameDialog::onKeyButtonPressed);
|
mSaveList->eventKeyButtonPressed += MyGUI::newDelegate(this, &SaveGameDialog::onKeyButtonPressed);
|
||||||
mSaveNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onEditSelectAccept);
|
mSaveNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onEditSelectAccept);
|
||||||
mSaveNameEdit->eventEditTextChange += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameChanged);
|
mSaveNameEdit->eventEditTextChange += MyGUI::newDelegate(this, &SaveGameDialog::onSaveNameChanged);
|
||||||
|
|
||||||
|
// To avoid accidental deletions
|
||||||
|
mDeleteButton->setNeedKeyFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGameDialog::onSlotActivated(MyGUI::ListBox *sender, size_t pos)
|
void SaveGameDialog::onSlotActivated(MyGUI::ListBox *sender, size_t pos)
|
||||||
|
@ -106,6 +108,11 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveGameDialog::onDeleteSlotCancel()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mSaveList);
|
||||||
|
}
|
||||||
|
|
||||||
void SaveGameDialog::onSaveNameChanged(MyGUI::EditBox *sender)
|
void SaveGameDialog::onSaveNameChanged(MyGUI::EditBox *sender)
|
||||||
{
|
{
|
||||||
// This might have previously been a save slot from the list. If so, that is no longer the case
|
// This might have previously been a save slot from the list. If so, that is no longer the case
|
||||||
|
@ -118,9 +125,9 @@ namespace MWGui
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGameDialog::open()
|
void SaveGameDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
|
|
||||||
mSaveNameEdit->setCaption ("");
|
mSaveNameEdit->setCaption ("");
|
||||||
if (mSaving)
|
if (mSaving)
|
||||||
|
@ -191,11 +198,6 @@ namespace MWGui
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGameDialog::exit()
|
|
||||||
{
|
|
||||||
setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveGameDialog::setLoadOrSave(bool load)
|
void SaveGameDialog::setLoadOrSave(bool load)
|
||||||
{
|
{
|
||||||
mSaving = !load;
|
mSaving = !load;
|
||||||
|
@ -217,7 +219,7 @@ namespace MWGui
|
||||||
|
|
||||||
void SaveGameDialog::onCancelButtonClicked(MyGUI::Widget *sender)
|
void SaveGameDialog::onCancelButtonClicked(MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
exit();
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGameDialog::onDeleteButtonClicked(MyGUI::Widget *sender)
|
void SaveGameDialog::onDeleteButtonClicked(MyGUI::Widget *sender)
|
||||||
|
@ -231,6 +233,11 @@ namespace MWGui
|
||||||
accept(true);
|
accept(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveGameDialog::onConfirmationCancel()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mSaveList);
|
||||||
|
}
|
||||||
|
|
||||||
void SaveGameDialog::accept(bool reallySure)
|
void SaveGameDialog::accept(bool reallySure)
|
||||||
{
|
{
|
||||||
// Remove for MyGUI 3.2.2
|
// Remove for MyGUI 3.2.2
|
||||||
|
@ -246,6 +253,7 @@ namespace MWGui
|
||||||
dialog->eventOkClicked.clear();
|
dialog->eventOkClicked.clear();
|
||||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
|
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
|
||||||
dialog->eventCancelClicked.clear();
|
dialog->eventCancelClicked.clear();
|
||||||
|
dialog->eventCancelClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationCancel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mSaveNameEdit->getCaption().empty())
|
if (mSaveNameEdit->getCaption().empty())
|
||||||
|
@ -266,6 +274,7 @@ namespace MWGui
|
||||||
dialog->eventOkClicked.clear();
|
dialog->eventOkClicked.clear();
|
||||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
|
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
|
||||||
dialog->eventCancelClicked.clear();
|
dialog->eventCancelClicked.clear();
|
||||||
|
dialog->eventCancelClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationCancel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
SaveGameDialog();
|
SaveGameDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
void setLoadOrSave(bool load);
|
void setLoadOrSave(bool load);
|
||||||
|
|
||||||
|
@ -39,10 +37,12 @@ namespace MWGui
|
||||||
void onSlotMouseClick(MyGUI::ListBox* sender, size_t pos);
|
void onSlotMouseClick(MyGUI::ListBox* sender, size_t pos);
|
||||||
|
|
||||||
void onDeleteSlotConfirmed();
|
void onDeleteSlotConfirmed();
|
||||||
|
void onDeleteSlotCancel();
|
||||||
|
|
||||||
void onEditSelectAccept (MyGUI::EditBox* sender);
|
void onEditSelectAccept (MyGUI::EditBox* sender);
|
||||||
void onSaveNameChanged (MyGUI::EditBox* sender);
|
void onSaveNameChanged (MyGUI::EditBox* sender);
|
||||||
void onConfirmationGiven();
|
void onConfirmationGiven();
|
||||||
|
void onConfirmationCancel();
|
||||||
|
|
||||||
void accept(bool reallySure=false);
|
void accept(bool reallySure=false);
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
FadeOp::FadeOp(ScreenFader * fader, float time, float targetAlpha)
|
FadeOp::FadeOp(ScreenFader * fader, float time, float targetAlpha, float delay)
|
||||||
: mFader(fader),
|
: mFader(fader),
|
||||||
mRemainingTime(time),
|
mRemainingTime(time+delay),
|
||||||
mTargetTime(time),
|
mTargetTime(time),
|
||||||
mTargetAlpha(targetAlpha),
|
mTargetAlpha(targetAlpha),
|
||||||
mStartAlpha(0.f),
|
mStartAlpha(0.f),
|
||||||
|
mDelay(delay),
|
||||||
mRunning(false)
|
mRunning(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -26,7 +27,7 @@ namespace MWGui
|
||||||
if (mRunning)
|
if (mRunning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mRemainingTime = mTargetTime;
|
mRemainingTime = mTargetTime + mDelay;
|
||||||
mStartAlpha = mFader->getCurrentAlpha();
|
mStartAlpha = mFader->getCurrentAlpha();
|
||||||
mRunning = true;
|
mRunning = true;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +43,12 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mRemainingTime > mTargetTime)
|
||||||
|
{
|
||||||
|
mRemainingTime -= dt;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float currentAlpha = mFader->getCurrentAlpha();
|
float currentAlpha = mFader->getCurrentAlpha();
|
||||||
if (mStartAlpha > mTargetAlpha)
|
if (mStartAlpha > mTargetAlpha)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +81,6 @@ namespace MWGui
|
||||||
, mRepeat(false)
|
, mRepeat(false)
|
||||||
{
|
{
|
||||||
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
|
mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());
|
||||||
setVisible(false);
|
|
||||||
|
|
||||||
MyGUI::ImageBox* imageBox = mMainWidget->castType<MyGUI::ImageBox>(false);
|
MyGUI::ImageBox* imageBox = mMainWidget->castType<MyGUI::ImageBox>(false);
|
||||||
if (imageBox)
|
if (imageBox)
|
||||||
|
@ -104,19 +110,25 @@ namespace MWGui
|
||||||
mMainWidget->setAlpha(1.f-((1.f-mCurrentAlpha) * mFactor));
|
mMainWidget->setAlpha(1.f-((1.f-mCurrentAlpha) * mFactor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFader::fadeIn(float time)
|
void ScreenFader::fadeIn(float time, float delay)
|
||||||
{
|
{
|
||||||
queue(time, 1.f);
|
queue(time, 1.f, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFader::fadeOut(const float time)
|
void ScreenFader::fadeOut(const float time, float delay)
|
||||||
{
|
{
|
||||||
queue(time, 0.f);
|
queue(time, 0.f, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFader::fadeTo(const int percent, const float time)
|
void ScreenFader::fadeTo(const int percent, const float time, float delay)
|
||||||
{
|
{
|
||||||
queue(time, percent/100.f);
|
queue(time, percent/100.f, delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenFader::clear()
|
||||||
|
{
|
||||||
|
clearQueue();
|
||||||
|
notifyAlphaChanged(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFader::setFactor(float factor)
|
void ScreenFader::setFactor(float factor)
|
||||||
|
@ -130,7 +142,7 @@ namespace MWGui
|
||||||
mRepeat = repeat;
|
mRepeat = repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenFader::queue(float time, float targetAlpha)
|
void ScreenFader::queue(float time, float targetAlpha, float delay)
|
||||||
{
|
{
|
||||||
if (time < 0.f)
|
if (time < 0.f)
|
||||||
return;
|
return;
|
||||||
|
@ -142,7 +154,7 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mQueue.push_back(FadeOp::Ptr(new FadeOp(this, time, targetAlpha)));
|
mQueue.push_back(FadeOp::Ptr(new FadeOp(this, time, targetAlpha, delay)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScreenFader::isEmpty()
|
bool ScreenFader::isEmpty()
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<FadeOp> Ptr;
|
typedef std::shared_ptr<FadeOp> Ptr;
|
||||||
|
|
||||||
FadeOp(ScreenFader * fader, float time, float targetAlpha);
|
FadeOp(ScreenFader * fader, float time, float targetAlpha, float delay);
|
||||||
|
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ namespace MWGui
|
||||||
float mTargetTime;
|
float mTargetTime;
|
||||||
float mTargetAlpha;
|
float mTargetAlpha;
|
||||||
float mStartAlpha;
|
float mStartAlpha;
|
||||||
|
float mDelay;
|
||||||
bool mRunning;
|
bool mRunning;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,14 +39,16 @@ namespace MWGui
|
||||||
|
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
void fadeIn(const float time);
|
void fadeIn(const float time, float delay=0);
|
||||||
void fadeOut(const float time);
|
void fadeOut(const float time, float delay=0);
|
||||||
void fadeTo(const int percent, const float time);
|
void fadeTo(const int percent, const float time, float delay=0);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
void setFactor (float factor);
|
void setFactor (float factor);
|
||||||
void setRepeat(bool repeat);
|
void setRepeat(bool repeat);
|
||||||
|
|
||||||
void queue(float time, float targetAlpha);
|
void queue(float time, float targetAlpha, float delay);
|
||||||
bool isEmpty();
|
bool isEmpty();
|
||||||
void clearQueue();
|
void clearQueue();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "formatting.hpp"
|
#include "formatting.hpp"
|
||||||
|
|
||||||
|
@ -46,16 +47,19 @@ namespace MWGui
|
||||||
adjustButton(mCloseButton);
|
adjustButton(mCloseButton);
|
||||||
adjustButton(mTakeButton);
|
adjustButton(mTakeButton);
|
||||||
|
|
||||||
|
mCloseButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ScrollWindow::onKeyButtonPressed);
|
||||||
|
mTakeButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ScrollWindow::onKeyButtonPressed);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::openScroll (MWWorld::Ptr scroll, bool showTakeButton)
|
void ScrollWindow::setPtr (const MWWorld::Ptr& scroll)
|
||||||
{
|
{
|
||||||
// no 3d sounds because the object could be in a container.
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("scroll");
|
|
||||||
|
|
||||||
mScroll = scroll;
|
mScroll = scroll;
|
||||||
|
|
||||||
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
bool showTakeButton = scroll.getContainerStore() != &player.getClass().getContainerStore(player);
|
||||||
|
|
||||||
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
|
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
|
||||||
|
|
||||||
Formatting::BookFormatter formatter;
|
Formatting::BookFormatter formatter;
|
||||||
|
@ -65,21 +69,28 @@ namespace MWGui
|
||||||
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
|
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
|
||||||
mTextView->setVisibleVScroll(false);
|
mTextView->setVisibleVScroll(false);
|
||||||
if (size.height > mTextView->getSize().height)
|
if (size.height > mTextView->getSize().height)
|
||||||
mTextView->setCanvasSize(MyGUI::IntSize(410, size.height));
|
mTextView->setCanvasSize(mTextView->getWidth(), size.height);
|
||||||
else
|
else
|
||||||
mTextView->setCanvasSize(410, mTextView->getSize().height);
|
mTextView->setCanvasSize(mTextView->getWidth(), mTextView->getSize().height);
|
||||||
mTextView->setVisibleVScroll(true);
|
mTextView->setVisibleVScroll(true);
|
||||||
|
|
||||||
mTextView->setViewOffset(MyGUI::IntPoint(0,0));
|
mTextView->setViewOffset(MyGUI::IntPoint(0,0));
|
||||||
|
|
||||||
setTakeButtonShow(showTakeButton);
|
setTakeButtonShow(showTakeButton);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mCloseButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::exit()
|
void ScrollWindow::onKeyButtonPressed(MyGUI::Widget *sender, MyGUI::KeyCode key, MyGUI::Char character)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("scroll");
|
int scroll = 0;
|
||||||
|
if (key == MyGUI::KeyCode::ArrowUp)
|
||||||
|
scroll = 40;
|
||||||
|
else if (key == MyGUI::KeyCode::ArrowDown)
|
||||||
|
scroll = -40;
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
if (scroll != 0)
|
||||||
|
mTextView->setViewOffset(mTextView->getViewOffset() + MyGUI::IntPoint(0, scroll));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::setTakeButtonShow(bool show)
|
void ScrollWindow::setTakeButtonShow(bool show)
|
||||||
|
@ -96,7 +107,7 @@ namespace MWGui
|
||||||
|
|
||||||
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
|
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
|
||||||
|
@ -106,6 +117,6 @@ namespace MWGui
|
||||||
MWWorld::ActionTake take(mScroll);
|
MWWorld::ActionTake take(mScroll);
|
||||||
take.execute (MWMechanics::getPlayer());
|
take.execute (MWMechanics::getPlayer());
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,16 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
ScrollWindow ();
|
ScrollWindow ();
|
||||||
|
|
||||||
void openScroll (MWWorld::Ptr scroll, bool showTakeButton);
|
void setPtr (const MWWorld::Ptr& scroll);
|
||||||
virtual void exit();
|
|
||||||
void setInventoryAllowed(bool allowed);
|
void setInventoryAllowed(bool allowed);
|
||||||
|
|
||||||
|
void onResChange(int, int) { center(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
||||||
void onTakeButtonClicked (MyGUI::Widget* _sender);
|
void onTakeButtonClicked (MyGUI::Widget* _sender);
|
||||||
void setTakeButtonShow(bool show);
|
void setTakeButtonShow(bool show);
|
||||||
|
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gui::ImageButton* mCloseButton;
|
Gui::ImageButton* mCloseButton;
|
||||||
|
|
|
@ -258,7 +258,7 @@ namespace MWGui
|
||||||
|
|
||||||
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
|
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
|
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
|
||||||
|
@ -553,17 +553,12 @@ namespace MWGui
|
||||||
updateControlsBox ();
|
updateControlsBox ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWindow::open()
|
void SettingsWindow::onOpen()
|
||||||
{
|
{
|
||||||
updateControlsBox ();
|
updateControlsBox ();
|
||||||
resetScrollbars();
|
resetScrollbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWindow::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsWindow::onWindowResize(MyGUI::Window *_sender)
|
void SettingsWindow::onWindowResize(MyGUI::Window *_sender)
|
||||||
{
|
{
|
||||||
layoutControlsBox();
|
layoutControlsBox();
|
||||||
|
|
|
@ -15,12 +15,12 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
SettingsWindow();
|
SettingsWindow();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
|
||||||
|
|
||||||
void updateControlsBox();
|
void updateControlsBox();
|
||||||
|
|
||||||
|
void onResChange(int, int) { center(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::TabControl* mSettingsTab;
|
MyGUI::TabControl* mSettingsTab;
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
|
|
|
@ -22,13 +22,11 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (button == 0)
|
if (button == 0)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Recharge);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Recharge, mSoulgem);
|
||||||
MWBase::Environment::get().getWindowManager()->startRecharge(mSoulgem);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting, mSoulgem);
|
||||||
MWBase::Environment::get().getWindowManager()->startSelfEnchanting(mSoulgem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,6 @@ namespace MWGui
|
||||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SpellBuyingWindow::sortSpells (const ESM::Spell* left, const ESM::Spell* right)
|
bool SpellBuyingWindow::sortSpells (const ESM::Spell* left, const ESM::Spell* right)
|
||||||
{
|
{
|
||||||
std::string leftName = Misc::StringUtils::lowerCase(left->mName);
|
std::string leftName = Misc::StringUtils::lowerCase(left->mName);
|
||||||
|
@ -88,7 +83,12 @@ namespace MWGui
|
||||||
mSpellsWidgetMap.clear();
|
mSpellsWidgetMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::startSpellBuying(const MWWorld::Ptr& actor, int startOffset)
|
void SpellBuyingWindow::setPtr(const MWWorld::Ptr &actor)
|
||||||
|
{
|
||||||
|
setPtr(actor, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpellBuyingWindow::setPtr(const MWWorld::Ptr& actor, int startOffset)
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
|
@ -161,14 +161,14 @@ namespace MWGui
|
||||||
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
|
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
|
||||||
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||||
|
|
||||||
startSpellBuying(mPtr, mSpellsView->getViewOffset().top);
|
setPtr(mPtr, mSpellsView->getViewOffset().top);
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
|
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellBuying);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::updateLabels()
|
void SpellBuyingWindow::updateLabels()
|
||||||
|
@ -187,7 +187,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
// remove both Spells and Dialogue (since you always trade with the NPC/creature that you have previously talked to)
|
// remove both Spells and Dialogue (since you always trade with the NPC/creature that you have previously talked to)
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellBuyingWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
void SpellBuyingWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
|
|
|
@ -25,9 +25,13 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
SpellBuyingWindow();
|
SpellBuyingWindow();
|
||||||
|
|
||||||
void startSpellBuying(const MWWorld::Ptr& actor, int startOffset);
|
void setPtr(const MWWorld::Ptr& actor);
|
||||||
|
void setPtr(const MWWorld::Ptr& actor, int startOffset);
|
||||||
|
|
||||||
virtual void exit();
|
void onFrame(float dt) { checkReferenceAvailable(); }
|
||||||
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
|
void onResChange(int, int) { center(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
|
|
@ -96,19 +96,19 @@ namespace MWGui
|
||||||
mConstantEffect = constant;
|
mConstantEffect = constant;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::open()
|
void EditEffectDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::exit()
|
bool EditEffectDialog::exit()
|
||||||
{
|
{
|
||||||
setVisible(false);
|
|
||||||
if(mEditing)
|
if(mEditing)
|
||||||
eventEffectModified(mOldEffect);
|
eventEffectModified(mOldEffect);
|
||||||
else
|
else
|
||||||
eventEffectRemoved(mEffect);
|
eventEffectRemoved(mEffect);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditEffectDialog::newEffect (const ESM::MagicEffect *effect)
|
void EditEffectDialog::newEffect (const ESM::MagicEffect *effect)
|
||||||
|
@ -275,6 +275,7 @@ namespace MWGui
|
||||||
|
|
||||||
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
|
setVisible(false);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,11 +349,12 @@ namespace MWGui
|
||||||
|
|
||||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onCancelButtonClicked);
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onCancelButtonClicked);
|
||||||
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onBuyButtonClicked);
|
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellCreationDialog::onBuyButtonClicked);
|
||||||
|
mNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SpellCreationDialog::onAccept);
|
||||||
|
|
||||||
setWidgets(mAvailableEffectsList, mUsedEffectsView);
|
setWidgets(mAvailableEffectsList, mUsedEffectsView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCreationDialog::startSpellMaking (MWWorld::Ptr actor)
|
void SpellCreationDialog::setPtr (const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
mNameEdit->setCaption("");
|
mNameEdit->setCaption("");
|
||||||
|
@ -362,7 +364,7 @@ namespace MWGui
|
||||||
|
|
||||||
void SpellCreationDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
void SpellCreationDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCreationDialog::onBuyButtonClicked (MyGUI::Widget* sender)
|
void SpellCreationDialog::onBuyButtonClicked (MyGUI::Widget* sender)
|
||||||
|
@ -415,14 +417,15 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_SpellCreation);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_SpellCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCreationDialog::open()
|
void SpellCreationDialog::onAccept(MyGUI::EditBox *sender)
|
||||||
{
|
{
|
||||||
center();
|
onBuyButtonClicked(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCreationDialog::exit()
|
void SpellCreationDialog::onOpen()
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellCreation);
|
center();
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellCreationDialog::onReferenceUnavailable ()
|
void SpellCreationDialog::onReferenceUnavailable ()
|
||||||
|
|
|
@ -23,8 +23,8 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
EditEffectDialog();
|
EditEffectDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
void setConstantEffect(bool constant);
|
void setConstantEffect(bool constant);
|
||||||
|
|
||||||
|
@ -150,16 +150,19 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
SpellCreationDialog();
|
SpellCreationDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
virtual void exit();
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
void startSpellMaking(MWWorld::Ptr actor);
|
void onFrame(float dt) { checkReferenceAvailable(); }
|
||||||
|
|
||||||
|
void setPtr(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onReferenceUnavailable ();
|
virtual void onReferenceUnavailable ();
|
||||||
|
|
||||||
void onCancelButtonClicked (MyGUI::Widget* sender);
|
void onCancelButtonClicked (MyGUI::Widget* sender);
|
||||||
void onBuyButtonClicked (MyGUI::Widget* sender);
|
void onBuyButtonClicked (MyGUI::Widget* sender);
|
||||||
|
void onAccept(MyGUI::EditBox* sender);
|
||||||
|
|
||||||
virtual void notifyEffectsChanged ();
|
virtual void notifyEffectsChanged ();
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,7 @@ namespace MWGui
|
||||||
|
|
||||||
Gui::SharedStateButton* t = mScrollView->createWidget<Gui::SharedStateButton>(skin,
|
Gui::SharedStateButton* t = mScrollView->createWidget<Gui::SharedStateButton>(skin,
|
||||||
MyGUI::IntCoord(0, 0, 0, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
MyGUI::IntCoord(0, 0, 0, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||||
|
t->setNeedKeyFocus(true);
|
||||||
t->setCaption(spell.mName);
|
t->setCaption(spell.mName);
|
||||||
t->setTextAlign(MyGUI::Align::Left);
|
t->setTextAlign(MyGUI::Align::Left);
|
||||||
adjustSpellWidget(spell, i, t);
|
adjustSpellWidget(spell, i, t);
|
||||||
|
|
|
@ -62,14 +62,12 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellWindow::open()
|
void SpellWindow::onOpen()
|
||||||
{
|
{
|
||||||
updateSpells();
|
updateSpells();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellWindow::onFrame(float dt)
|
void SpellWindow::onFrame(float dt)
|
||||||
{
|
|
||||||
if (mMainWidget->getVisible())
|
|
||||||
{
|
{
|
||||||
NoDrop::onFrame(dt);
|
NoDrop::onFrame(dt);
|
||||||
mUpdateTimer += dt;
|
mUpdateTimer += dt;
|
||||||
|
@ -79,7 +77,6 @@ namespace MWGui
|
||||||
mSpellView->incrementalUpdate();
|
mSpellView->incrementalUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SpellWindow::updateSpells()
|
void SpellWindow::updateSpells()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWGui
|
||||||
|
|
||||||
virtual void onPinToggled();
|
virtual void onPinToggled();
|
||||||
virtual void onTitleDoubleClicked();
|
virtual void onTitleDoubleClicked();
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
SpellView* mSpellView;
|
SpellView* mSpellView;
|
||||||
SpellIcons* mSpellIcons;
|
SpellIcons* mSpellIcons;
|
||||||
|
|
|
@ -297,9 +297,6 @@ namespace MWGui
|
||||||
|
|
||||||
void StatsWindow::onFrame (float dt)
|
void StatsWindow::onFrame (float dt)
|
||||||
{
|
{
|
||||||
if (!mMainWidget->getVisible())
|
|
||||||
return;
|
|
||||||
|
|
||||||
NoDrop::onFrame(dt);
|
NoDrop::onFrame(dt);
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWGui
|
||||||
void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
|
void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
|
||||||
void updateSkillArea();
|
void updateSkillArea();
|
||||||
|
|
||||||
virtual void open() { onWindowResize(mMainWidget->castType<MyGUI::Window>()); }
|
virtual void onOpen() { onWindowResize(mMainWidget->castType<MyGUI::Window>()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
|
|
|
@ -42,9 +42,9 @@ namespace MWGui
|
||||||
setText("LabelT", label);
|
setText("LabelT", label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextInputDialog::open()
|
void TextInputDialog::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::onOpen();
|
||||||
// Make sure the edit box has focus
|
// Make sure the edit box has focus
|
||||||
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,9 @@ namespace MWGui
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void setTextLabel(const std::string &label);
|
void setTextLabel(const std::string &label);
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
|
bool exit() { return false; }
|
||||||
|
|
||||||
/** Event : Dialog finished, OK button clicked.\n
|
/** Event : Dialog finished, OK button clicked.\n
|
||||||
signature : void method()\n
|
signature : void method()\n
|
||||||
|
|
|
@ -97,6 +97,8 @@ namespace MWGui
|
||||||
|
|
||||||
if (guiMode)
|
if (guiMode)
|
||||||
{
|
{
|
||||||
|
if (!MWBase::Environment::get().getWindowManager()->getCursorVisible())
|
||||||
|
return;
|
||||||
const MyGUI::IntPoint& mousePos = MyGUI::InputManager::getInstance().getMousePosition();
|
const MyGUI::IntPoint& mousePos = MyGUI::InputManager::getInstance().getMousePosition();
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getWorldMouseOver() && ((MWBase::Environment::get().getWindowManager()->getMode() == GM_Console)
|
if (MWBase::Environment::get().getWindowManager()->getWorldMouseOver() && ((MWBase::Environment::get().getWindowManager()->getMode() == GM_Console)
|
||||||
|
@ -422,18 +424,20 @@ namespace MWGui
|
||||||
std::string realImage = MWBase::Environment::get().getWindowManager()->correctIconPath(image);
|
std::string realImage = MWBase::Environment::get().getWindowManager()->correctIconPath(image);
|
||||||
|
|
||||||
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
|
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
|
||||||
captionWidget->setProperty("Static", "true");
|
captionWidget->setEditStatic(true);
|
||||||
|
captionWidget->setNeedKeyFocus(false);
|
||||||
captionWidget->setCaptionWithReplacing(caption);
|
captionWidget->setCaptionWithReplacing(caption);
|
||||||
MyGUI::IntSize captionSize = captionWidget->getTextSize();
|
MyGUI::IntSize captionSize = captionWidget->getTextSize();
|
||||||
|
|
||||||
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
|
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
|
||||||
|
|
||||||
MyGUI::EditBox* textWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("SandText", MyGUI::IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), MyGUI::Align::Stretch, "ToolTipText");
|
MyGUI::EditBox* textWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("SandText", MyGUI::IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), MyGUI::Align::Stretch, "ToolTipText");
|
||||||
textWidget->setProperty("Static", "true");
|
textWidget->setEditStatic(true);
|
||||||
textWidget->setProperty("MultiLine", "true");
|
textWidget->setEditMultiLine(true);
|
||||||
textWidget->setProperty("WordWrap", info.wordWrap ? "true" : "false");
|
textWidget->setEditWordWrap(info.wordWrap);
|
||||||
textWidget->setCaptionWithReplacing(text);
|
textWidget->setCaptionWithReplacing(text);
|
||||||
textWidget->setTextAlign(MyGUI::Align::HCenter | MyGUI::Align::Top);
|
textWidget->setTextAlign(MyGUI::Align::HCenter | MyGUI::Align::Top);
|
||||||
|
textWidget->setNeedKeyFocus(false);
|
||||||
MyGUI::IntSize textSize = textWidget->getTextSize();
|
MyGUI::IntSize textSize = textWidget->getTextSize();
|
||||||
|
|
||||||
captionSize += MyGUI::IntSize(imageSize, 0); // adjust for image
|
captionSize += MyGUI::IntSize(imageSize, 0); // adjust for image
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "containeritemmodel.hpp"
|
#include "containeritemmodel.hpp"
|
||||||
#include "tradeitemmodel.hpp"
|
#include "tradeitemmodel.hpp"
|
||||||
#include "countdialog.hpp"
|
#include "countdialog.hpp"
|
||||||
#include "dialogue.hpp"
|
|
||||||
#include "controllers.hpp"
|
#include "controllers.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -96,6 +95,7 @@ namespace MWGui
|
||||||
mDecreaseButton->eventMouseButtonReleased += MyGUI::newDelegate(this, &TradeWindow::onBalanceButtonReleased);
|
mDecreaseButton->eventMouseButtonReleased += MyGUI::newDelegate(this, &TradeWindow::onBalanceButtonReleased);
|
||||||
|
|
||||||
mTotalBalance->eventValueChanged += MyGUI::newDelegate(this, &TradeWindow::onBalanceValueChanged);
|
mTotalBalance->eventValueChanged += MyGUI::newDelegate(this, &TradeWindow::onBalanceValueChanged);
|
||||||
|
mTotalBalance->eventEditSelectAccept += MyGUI::newDelegate(this, &TradeWindow::onAccept);
|
||||||
mTotalBalance->setMinValue(INT_MIN+1); // disallow INT_MIN since abs(INT_MIN) is undefined
|
mTotalBalance->setMinValue(INT_MIN+1); // disallow INT_MIN since abs(INT_MIN) is undefined
|
||||||
|
|
||||||
setCoord(400, 0, 400, 300);
|
setCoord(400, 0, 400, 300);
|
||||||
|
@ -115,7 +115,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::startTrade(const MWWorld::Ptr& actor)
|
void TradeWindow::setPtr(const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
|
|
||||||
|
@ -140,6 +140,13 @@ namespace MWGui
|
||||||
setTitle(actor.getClass().getName(actor));
|
setTitle(actor.getClass().getName(actor));
|
||||||
|
|
||||||
onFilterChanged(mFilterAll);
|
onFilterChanged(mFilterAll);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTotalBalance);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TradeWindow::onFrame(float dt)
|
||||||
|
{
|
||||||
|
checkReferenceAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::onFilterChanged(MyGUI::Widget* _sender)
|
void TradeWindow::onFilterChanged(MyGUI::Widget* _sender)
|
||||||
|
@ -171,11 +178,11 @@ namespace MWGui
|
||||||
return mPtr.getClass().getServices(mPtr);
|
return mPtr.getClass().getServices(mPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::exit()
|
bool TradeWindow::exit()
|
||||||
{
|
{
|
||||||
mTradeModel->abort();
|
mTradeModel->abort();
|
||||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
|
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::onItemSelected (int index)
|
void TradeWindow::onItemSelected (int index)
|
||||||
|
@ -315,7 +322,7 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, it->mBase, mPtr, it->mCount);
|
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, it->mBase, mPtr, it->mCount);
|
||||||
|
|
||||||
onCancelButtonClicked(mCancelButton);
|
onCancelButtonClicked(mCancelButton);
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,8 +357,7 @@ namespace MWGui
|
||||||
mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance );
|
mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance );
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse(
|
eventTradeDone();
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString());
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
|
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
||||||
|
@ -359,9 +365,15 @@ namespace MWGui
|
||||||
restock();
|
restock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TradeWindow::onAccept(MyGUI::EditBox *sender)
|
||||||
|
{
|
||||||
|
onOfferButtonClicked(sender);
|
||||||
|
}
|
||||||
|
|
||||||
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
exit();
|
||||||
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TradeWindow::onMaxSaleButtonClicked(MyGUI::Widget* _sender)
|
void TradeWindow::onMaxSaleButtonClicked(MyGUI::Widget* _sender)
|
||||||
|
@ -490,7 +502,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
// remove both Trade and Dialogue (since you always trade with the NPC/creature that you have previously talked to)
|
// remove both Trade and Dialogue (since you always trade with the NPC/creature that you have previously talked to)
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TradeWindow::getMerchantGold()
|
int TradeWindow::getMerchantGold()
|
||||||
|
|
|
@ -27,17 +27,23 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
TradeWindow();
|
TradeWindow();
|
||||||
|
|
||||||
void startTrade(const MWWorld::Ptr& actor);
|
void setPtr(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
|
void onFrame(float dt);
|
||||||
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
void borrowItem (int index, size_t count);
|
void borrowItem (int index, size_t count);
|
||||||
void returnItem (int index, size_t count);
|
void returnItem (int index, size_t count);
|
||||||
|
|
||||||
int getMerchantServices();
|
int getMerchantServices();
|
||||||
|
|
||||||
virtual void exit();
|
virtual bool exit();
|
||||||
|
|
||||||
virtual void resetReference();
|
virtual void resetReference();
|
||||||
|
|
||||||
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_TradeDone;
|
||||||
|
EventHandle_TradeDone eventTradeDone;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ItemView* mItemView;
|
ItemView* mItemView;
|
||||||
SortFilterItemModel* mSortModel;
|
SortFilterItemModel* mSortModel;
|
||||||
|
@ -81,6 +87,7 @@ namespace MWGui
|
||||||
|
|
||||||
void onFilterChanged(MyGUI::Widget* _sender);
|
void onFilterChanged(MyGUI::Widget* _sender);
|
||||||
void onOfferButtonClicked(MyGUI::Widget* _sender);
|
void onOfferButtonClicked(MyGUI::Widget* _sender);
|
||||||
|
void onAccept(MyGUI::EditBox* sender);
|
||||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onMaxSaleButtonClicked(MyGUI::Widget* _sender);
|
void onMaxSaleButtonClicked(MyGUI::Widget* _sender);
|
||||||
void onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
void onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
|
@ -40,7 +39,6 @@ namespace MWGui
|
||||||
|
|
||||||
TrainingWindow::TrainingWindow()
|
TrainingWindow::TrainingWindow()
|
||||||
: WindowBase("openmw_trainingwindow.layout")
|
: WindowBase("openmw_trainingwindow.layout")
|
||||||
, mFadeTimeRemaining(0)
|
|
||||||
, mTimeAdvancer(0.05f)
|
, mTimeAdvancer(0.05f)
|
||||||
{
|
{
|
||||||
getWidget(mTrainingOptions, "TrainingOptions");
|
getWidget(mTrainingOptions, "TrainingOptions");
|
||||||
|
@ -51,21 +49,22 @@ namespace MWGui
|
||||||
|
|
||||||
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &TrainingWindow::onTrainingProgressChanged);
|
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &TrainingWindow::onTrainingProgressChanged);
|
||||||
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &TrainingWindow::onTrainingFinished);
|
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &TrainingWindow::onTrainingFinished);
|
||||||
|
|
||||||
mProgressBar.setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrainingWindow::open()
|
void TrainingWindow::onOpen()
|
||||||
{
|
{
|
||||||
|
if (mTimeAdvancer.isRunning())
|
||||||
|
{
|
||||||
|
mProgressBar.setVisible(true);
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mProgressBar.setVisible(false);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrainingWindow::exit()
|
void TrainingWindow::setPtr (const MWWorld::Ptr& actor)
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrainingWindow::startTraining (MWWorld::Ptr actor)
|
|
||||||
{
|
{
|
||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
|
|
||||||
|
@ -124,7 +123,7 @@ namespace MWGui
|
||||||
|
|
||||||
void TrainingWindow::onCancelButtonClicked (MyGUI::Widget *sender)
|
void TrainingWindow::onCancelButtonClicked (MyGUI::Widget *sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Training);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrainingWindow::onTrainingSelected (MyGUI::Widget *sender)
|
void TrainingWindow::onTrainingSelected (MyGUI::Widget *sender)
|
||||||
|
@ -171,21 +170,18 @@ namespace MWGui
|
||||||
// add gold to NPC trading gold pool
|
// add gold to NPC trading gold pool
|
||||||
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
||||||
|
|
||||||
// go back to game mode
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
|
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
|
||||||
|
|
||||||
// advance time
|
// advance time
|
||||||
MWBase::Environment::get().getMechanicsManager()->rest(false);
|
MWBase::Environment::get().getMechanicsManager()->rest(false);
|
||||||
MWBase::Environment::get().getMechanicsManager()->rest(false);
|
MWBase::Environment::get().getMechanicsManager()->rest(false);
|
||||||
MWBase::Environment::get().getWorld ()->advanceTime (2);
|
MWBase::Environment::get().getWorld ()->advanceTime (2);
|
||||||
|
|
||||||
|
setVisible(false);
|
||||||
mProgressBar.setVisible(true);
|
mProgressBar.setVisible(true);
|
||||||
mProgressBar.setProgress(0, 2);
|
mProgressBar.setProgress(0, 2);
|
||||||
mTimeAdvancer.run(2);
|
mTimeAdvancer.run(2);
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.25);
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0.25);
|
||||||
mFadeTimeRemaining = 0.5;
|
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.25, false, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrainingWindow::onTrainingProgressChanged(int cur, int total)
|
void TrainingWindow::onTrainingProgressChanged(int cur, int total)
|
||||||
|
@ -196,18 +192,15 @@ namespace MWGui
|
||||||
void TrainingWindow::onTrainingFinished()
|
void TrainingWindow::onTrainingFinished()
|
||||||
{
|
{
|
||||||
mProgressBar.setVisible(false);
|
mProgressBar.setVisible(false);
|
||||||
|
|
||||||
|
// go back to game mode
|
||||||
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
|
||||||
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrainingWindow::onFrame(float dt)
|
void TrainingWindow::onFrame(float dt)
|
||||||
{
|
{
|
||||||
|
checkReferenceAvailable();
|
||||||
mTimeAdvancer.onFrame(dt);
|
mTimeAdvancer.onFrame(dt);
|
||||||
|
|
||||||
if (mFadeTimeRemaining <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mFadeTimeRemaining -= dt;
|
|
||||||
|
|
||||||
if (mFadeTimeRemaining <= 0)
|
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.25);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,18 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
TrainingWindow();
|
TrainingWindow();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
virtual void exit();
|
bool exit() { return false; }
|
||||||
|
|
||||||
void startTraining(MWWorld::Ptr actor);
|
void setPtr(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void onFrame(float dt);
|
void onFrame(float dt);
|
||||||
|
|
||||||
|
WindowBase* getProgressBar() { return &mProgressBar; }
|
||||||
|
|
||||||
|
void clear() { resetReference(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onReferenceUnavailable ();
|
virtual void onReferenceUnavailable ();
|
||||||
|
|
||||||
|
@ -35,8 +39,6 @@ namespace MWGui
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
MyGUI::TextBox* mPlayerGold;
|
MyGUI::TextBox* mPlayerGold;
|
||||||
|
|
||||||
float mFadeTimeRemaining;
|
|
||||||
|
|
||||||
WaitDialogProgressBar mProgressBar;
|
WaitDialogProgressBar mProgressBar;
|
||||||
TimeAdvancer mTimeAdvancer;
|
TimeAdvancer mTimeAdvancer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
|
||||||
|
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
#include "../mwmechanics/actorutil.hpp"
|
#include "../mwmechanics/actorutil.hpp"
|
||||||
|
@ -45,11 +44,6 @@ namespace MWGui
|
||||||
mSelect->getHeight());
|
mSelect->getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TravelWindow::exit()
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TravelWindow::addDestination(const std::string& name,ESM::Position pos,bool interior)
|
void TravelWindow::addDestination(const std::string& name,ESM::Position pos,bool interior)
|
||||||
{
|
{
|
||||||
int price;
|
int price;
|
||||||
|
@ -108,7 +102,7 @@ namespace MWGui
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mDestinationsView->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mDestinationsView->getChildAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TravelWindow::startTravel(const MWWorld::Ptr& actor)
|
void TravelWindow::setPtr(const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
mPtr = actor;
|
mPtr = actor;
|
||||||
|
@ -182,7 +176,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
||||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
|
|
||||||
// Teleports any followers, too.
|
// Teleports any followers, too.
|
||||||
MWWorld::ActionTeleport action(interior ? cellname : "", pos, true);
|
MWWorld::ActionTeleport action(interior ? cellname : "", pos, true);
|
||||||
|
@ -194,7 +188,7 @@ namespace MWGui
|
||||||
|
|
||||||
void TravelWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
void TravelWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TravelWindow::updateLabels()
|
void TravelWindow::updateLabels()
|
||||||
|
@ -212,7 +206,7 @@ namespace MWGui
|
||||||
void TravelWindow::onReferenceUnavailable()
|
void TravelWindow::onReferenceUnavailable()
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TravelWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
void TravelWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
|
|
|
@ -24,9 +24,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
TravelWindow();
|
TravelWindow();
|
||||||
|
|
||||||
virtual void exit();
|
void setPtr (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void startTravel(const MWWorld::Ptr& actor);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "waitdialog.hpp"
|
#include "waitdialog.hpp"
|
||||||
|
|
||||||
#include <MyGUI_ProgressBar.h>
|
#include <MyGUI_ProgressBar.h>
|
||||||
|
#include <MyGUI_InputManager.h>
|
||||||
|
#include <MyGUI_ScrollBar.h>
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
|
@ -23,8 +25,6 @@
|
||||||
|
|
||||||
#include "../mwstate/charactermanager.hpp"
|
#include "../mwstate/charactermanager.hpp"
|
||||||
|
|
||||||
#include "widgets.hpp"
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace MWGui
|
||||||
getWidget(mProgressText, "ProgressText");
|
getWidget(mProgressText, "ProgressText");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitDialogProgressBar::open()
|
void WaitDialogProgressBar::onOpen()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
@ -72,21 +72,43 @@ namespace MWGui
|
||||||
mWaitButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WaitDialog::onWaitButtonClicked);
|
mWaitButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WaitDialog::onWaitButtonClicked);
|
||||||
mHourSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &WaitDialog::onHourSliderChangedPosition);
|
mHourSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &WaitDialog::onHourSliderChangedPosition);
|
||||||
|
|
||||||
|
mCancelButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &WaitDialog::onKeyButtonPressed);
|
||||||
|
mWaitButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &WaitDialog::onKeyButtonPressed);
|
||||||
|
mUntilHealedButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &WaitDialog::onKeyButtonPressed);
|
||||||
|
|
||||||
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &WaitDialog::onWaitingProgressChanged);
|
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &WaitDialog::onWaitingProgressChanged);
|
||||||
mTimeAdvancer.eventInterrupted += MyGUI::newDelegate(this, &WaitDialog::onWaitingInterrupted);
|
mTimeAdvancer.eventInterrupted += MyGUI::newDelegate(this, &WaitDialog::onWaitingInterrupted);
|
||||||
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished);
|
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished);
|
||||||
|
|
||||||
mProgressBar.setVisible (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitDialog::exit()
|
void WaitDialog::setPtr(const MWWorld::Ptr &ptr)
|
||||||
{
|
{
|
||||||
if(!mProgressBar.isVisible()) //Only exit if not currently waiting
|
setCanRest(!ptr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == 0);
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
||||||
|
if (mUntilHealedButton->getVisible())
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mUntilHealedButton);
|
||||||
|
else
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mWaitButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitDialog::open()
|
bool WaitDialog::exit()
|
||||||
{
|
{
|
||||||
|
return (!mTimeAdvancer.isRunning()); //Only exit if not currently waiting
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaitDialog::onOpen()
|
||||||
|
{
|
||||||
|
if (mTimeAdvancer.isRunning())
|
||||||
|
{
|
||||||
|
mProgressBar.setVisible(true);
|
||||||
|
setVisible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mProgressBar.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!MWBase::Environment::get().getWindowManager ()->getRestEnabled ())
|
if (!MWBase::Environment::get().getWindowManager ()->getRestEnabled ())
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||||
|
@ -101,8 +123,6 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||||
}
|
}
|
||||||
|
|
||||||
setCanRest(canRest == 0);
|
|
||||||
|
|
||||||
onHourSliderChangedPosition(mHourSlider, 0);
|
onHourSliderChangedPosition(mHourSlider, 0);
|
||||||
mHourSlider->setScrollPosition (0);
|
mHourSlider->setScrollPosition (0);
|
||||||
|
|
||||||
|
@ -177,13 +197,25 @@ namespace MWGui
|
||||||
|
|
||||||
void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||||
{
|
{
|
||||||
exit();
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)
|
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)
|
||||||
{
|
{
|
||||||
mHourText->setCaptionWithReplacing (MyGUI::utility::toString(position+1) + " #{sRestMenu2}");
|
mHourText->setCaptionWithReplacing (MyGUI::utility::toString(position+1) + " #{sRestMenu2}");
|
||||||
mManualHours = position+1;
|
mManualHours = position+1;
|
||||||
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mWaitButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaitDialog::onKeyButtonPressed(MyGUI::Widget *sender, MyGUI::KeyCode key, MyGUI::Char character)
|
||||||
|
{
|
||||||
|
if (key == MyGUI::KeyCode::ArrowDown)
|
||||||
|
mHourSlider->setScrollPosition(std::min(mHourSlider->getScrollPosition()+1, mHourSlider->getScrollRange()-1));
|
||||||
|
else if (key == MyGUI::KeyCode::ArrowUp)
|
||||||
|
mHourSlider->setScrollPosition(std::max(static_cast<int>(mHourSlider->getScrollPosition())-1, 0));
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
onHourSliderChangedPosition(mHourSlider, mHourSlider->getScrollPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitDialog::onWaitingProgressChanged(int cur, int total)
|
void WaitDialog::onWaitingProgressChanged(int cur, int total)
|
||||||
|
@ -265,7 +297,6 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f);
|
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f);
|
||||||
mProgressBar.setVisible (false);
|
mProgressBar.setVisible (false);
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Rest);
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Rest);
|
||||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_RestBed);
|
|
||||||
mTimeAdvancer.stop();
|
mTimeAdvancer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
WaitDialogProgressBar();
|
WaitDialogProgressBar();
|
||||||
|
|
||||||
virtual void open();
|
virtual void onOpen();
|
||||||
|
|
||||||
void setProgress(int cur, int total);
|
void setProgress(int cur, int total);
|
||||||
|
|
||||||
|
@ -27,18 +27,20 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
WaitDialog();
|
WaitDialog();
|
||||||
|
|
||||||
virtual void open();
|
void setPtr(const MWWorld::Ptr &ptr);
|
||||||
|
|
||||||
virtual void exit();
|
virtual void onOpen();
|
||||||
|
|
||||||
|
virtual bool exit();
|
||||||
|
|
||||||
void onFrame(float dt);
|
void onFrame(float dt);
|
||||||
|
|
||||||
void bedActivated() { setCanRest(true); }
|
|
||||||
|
|
||||||
bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; }
|
bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; }
|
||||||
void wakeUp();
|
void wakeUp();
|
||||||
void autosave();
|
void autosave();
|
||||||
|
|
||||||
|
WindowBase* getProgressBar() { return &mProgressBar; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MyGUI::TextBox* mDateTimeText;
|
MyGUI::TextBox* mDateTimeText;
|
||||||
MyGUI::TextBox* mRestText;
|
MyGUI::TextBox* mRestText;
|
||||||
|
@ -63,6 +65,7 @@ namespace MWGui
|
||||||
void onWaitButtonClicked(MyGUI::Widget* sender);
|
void onWaitButtonClicked(MyGUI::Widget* sender);
|
||||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||||
void onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position);
|
void onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position);
|
||||||
|
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
|
||||||
|
|
||||||
void onWaitingProgressChanged(int cur, int total);
|
void onWaitingProgressChanged(int cur, int total);
|
||||||
void onWaitingInterrupted();
|
void onWaitingInterrupted();
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace MWGui
|
||||||
assignWidget(button, "StatValueButton");
|
assignWidget(button, "StatValueButton");
|
||||||
if (button)
|
if (button)
|
||||||
{
|
{
|
||||||
mSkillNameWidget = button;
|
mSkillValueWidget = button;
|
||||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MWSkill::onClicked);
|
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MWSkill::onClicked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue