mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 08:53:52 +00:00
Allow to display message box outside of dialogue window
This commit is contained in:
parent
ffd1783690
commit
8824af30b4
5 changed files with 18 additions and 15 deletions
|
@ -57,6 +57,12 @@ namespace MWGui
|
|||
class InventoryWindow;
|
||||
class ContainerWindow;
|
||||
class DialogueWindow;
|
||||
|
||||
enum ShowInDialogueMode {
|
||||
ShowInDialogueMode_IfPossible,
|
||||
ShowInDialogueMode_Only,
|
||||
ShowInDialogueMode_Never
|
||||
};
|
||||
}
|
||||
|
||||
namespace SFO
|
||||
|
@ -226,7 +232,7 @@ namespace MWBase
|
|||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||
///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), bool showInDialogueModeOnly = false) = 0;
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), enum MWGui::ShowInDialogueMode showInDialogueMode = MWGui::ShowInDialogueMode_IfPossible) = 0;
|
||||
virtual void staticMessageBox(const std::string& message) = 0;
|
||||
virtual void removeStaticMessageBox() = 0;
|
||||
virtual int readPressedButton() = 0;
|
||||
|
|
|
@ -648,19 +648,14 @@ namespace MWGui
|
|||
mGarbageDialogs.push_back(dialog);
|
||||
}
|
||||
|
||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons, bool showInDialogueModeOnly)
|
||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons, enum MWGui::ShowInDialogueMode showInDialogueMode)
|
||||
{
|
||||
if (buttons.empty()) {
|
||||
/* If there are no buttons, and there is a dialogue window open, messagebox goes to the dialogue window */
|
||||
if (getMode() == GM_Dialogue) {
|
||||
if (getMode() == GM_Dialogue && showInDialogueMode != MWGui::ShowInDialogueMode_Never) {
|
||||
mDialogueWindow->addMessageBox(MyGUI::LanguageManager::getInstance().replaceTags(message));
|
||||
} else {
|
||||
if (showInDialogueModeOnly) {
|
||||
if (getMode() == GM_Dialogue)
|
||||
} else if (showInDialogueMode != MWGui::ShowInDialogueMode_Only) {
|
||||
mMessageBoxManager->createMessageBox(message);
|
||||
} else {
|
||||
mMessageBoxManager->createMessageBox(message);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace MWGui
|
|||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), bool showInDialogueModeOnly = false);
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), enum MWGui::ShowInDialogueMode showInDialogueMode = MWGui::ShowInDialogueMode_IfPossible);
|
||||
virtual void staticMessageBox(const std::string& message);
|
||||
virtual void removeStaticMessageBox();
|
||||
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
|
|
@ -220,16 +220,18 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
|
|||
/// \todo check if character is the player, if levelling is ever implemented for NPCs
|
||||
MWBase::Environment::get().getSoundManager ()->playSound ("skillraise", 1, 1);
|
||||
|
||||
std::vector <std::string> noButtons;
|
||||
|
||||
std::stringstream message;
|
||||
message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", ""))
|
||||
% std::string("#{" + ESM::Skill::sSkillNameIds[skillIndex] + "}")
|
||||
% static_cast<int> (base);
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox(message.str());
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox(message.str(), noButtons, MWGui::ShowInDialogueMode_Never);
|
||||
|
||||
if (mLevelProgress >= gmst.find("iLevelUpTotal")->getInt())
|
||||
{
|
||||
// levelup is possible now
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}");
|
||||
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}", noButtons, MWGui::ShowInDialogueMode_Never);
|
||||
}
|
||||
|
||||
getSkill (skillIndex).setBase (base);
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace MWScript
|
|||
msgBox = boost::str(boost::format(msgBox) % count % itemName);
|
||||
}
|
||||
std::vector <std::string> noButtons;
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, noButtons, /*showInDialogueModeOnly*/ true);
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, noButtons, MWGui::ShowInDialogueMode_Only);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -142,7 +142,7 @@ namespace MWScript
|
|||
msgBox = boost::str (boost::format(msgBox) % itemName);
|
||||
}
|
||||
std::vector <std::string> noButtons;
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, noButtons, /*showInDialogueModeOnly*/ true);
|
||||
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, noButtons, MWGui::ShowInDialogueMode_Only);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue