mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 20:36:42 +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 InventoryWindow;
|
||||||
class ContainerWindow;
|
class ContainerWindow;
|
||||||
class DialogueWindow;
|
class DialogueWindow;
|
||||||
|
|
||||||
|
enum ShowInDialogueMode {
|
||||||
|
ShowInDialogueMode_IfPossible,
|
||||||
|
ShowInDialogueMode_Only,
|
||||||
|
ShowInDialogueMode_Never
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace SFO
|
namespace SFO
|
||||||
|
@ -226,7 +232,7 @@ namespace MWBase
|
||||||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||||
///< Hides dialog and schedules dialog to be deleted.
|
///< 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 staticMessageBox(const std::string& message) = 0;
|
||||||
virtual void removeStaticMessageBox() = 0;
|
virtual void removeStaticMessageBox() = 0;
|
||||||
virtual int readPressedButton() = 0;
|
virtual int readPressedButton() = 0;
|
||||||
|
|
|
@ -648,19 +648,14 @@ namespace MWGui
|
||||||
mGarbageDialogs.push_back(dialog);
|
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 (buttons.empty()) {
|
||||||
/* If there are no buttons, and there is a dialogue window open, messagebox goes to the dialogue window */
|
/* 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));
|
mDialogueWindow->addMessageBox(MyGUI::LanguageManager::getInstance().replaceTags(message));
|
||||||
} else {
|
} else if (showInDialogueMode != MWGui::ShowInDialogueMode_Only) {
|
||||||
if (showInDialogueModeOnly) {
|
mMessageBoxManager->createMessageBox(message);
|
||||||
if (getMode() == GM_Dialogue)
|
|
||||||
mMessageBoxManager->createMessageBox(message);
|
|
||||||
} else {
|
|
||||||
mMessageBoxManager->createMessageBox(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mMessageBoxManager->createInteractiveMessageBox(message, buttons);
|
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 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 staticMessageBox(const std::string& message);
|
||||||
virtual void removeStaticMessageBox();
|
virtual void removeStaticMessageBox();
|
||||||
virtual int readPressedButton (); ///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
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
|
/// \todo check if character is the player, if levelling is ever implemented for NPCs
|
||||||
MWBase::Environment::get().getSoundManager ()->playSound ("skillraise", 1, 1);
|
MWBase::Environment::get().getSoundManager ()->playSound ("skillraise", 1, 1);
|
||||||
|
|
||||||
|
std::vector <std::string> noButtons;
|
||||||
|
|
||||||
std::stringstream message;
|
std::stringstream message;
|
||||||
message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", ""))
|
message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", ""))
|
||||||
% std::string("#{" + ESM::Skill::sSkillNameIds[skillIndex] + "}")
|
% std::string("#{" + ESM::Skill::sSkillNameIds[skillIndex] + "}")
|
||||||
% static_cast<int> (base);
|
% 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())
|
if (mLevelProgress >= gmst.find("iLevelUpTotal")->getInt())
|
||||||
{
|
{
|
||||||
// levelup is possible now
|
// levelup is possible now
|
||||||
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}");
|
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}", noButtons, MWGui::ShowInDialogueMode_Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSkill (skillIndex).setBase (base);
|
getSkill (skillIndex).setBase (base);
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace MWScript
|
||||||
msgBox = boost::str(boost::format(msgBox) % count % itemName);
|
msgBox = boost::str(boost::format(msgBox) % count % itemName);
|
||||||
}
|
}
|
||||||
std::vector <std::string> noButtons;
|
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);
|
msgBox = boost::str (boost::format(msgBox) % itemName);
|
||||||
}
|
}
|
||||||
std::vector <std::string> noButtons;
|
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