mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[General] Add optional notes to PasswordDialogs
This commit is contained in:
parent
9630f95335
commit
1f682749d6
8 changed files with 49 additions and 3 deletions
|
@ -47,13 +47,14 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIFunctions::PasswordDialog(unsigned short pid, int id, const char *label) noexcept
|
void GUIFunctions::PasswordDialog(unsigned short pid, int id, const char *label, const char *note) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
|
||||||
player->guiMessageBox.id = id;
|
player->guiMessageBox.id = id;
|
||||||
player->guiMessageBox.label = label;
|
player->guiMessageBox.label = label;
|
||||||
|
player->guiMessageBox.note = note;
|
||||||
player->guiMessageBox.type = Player::GUIMessageBox::PasswordDialog;
|
player->guiMessageBox.type = Player::GUIMessageBox::PasswordDialog;
|
||||||
|
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
static void CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept;
|
static void CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept;
|
||||||
static void InputDialog(unsigned short pid, int id, const char *label) noexcept;
|
static void InputDialog(unsigned short pid, int id, const char *label) noexcept;
|
||||||
static void PasswordDialog(unsigned short pid, int id, const char *label) noexcept;
|
static void PasswordDialog(unsigned short pid, int id, const char *label, const char *note) noexcept;
|
||||||
|
|
||||||
static void ListBox(unsigned short pid, int id, const char *label, const char *items);
|
static void ListBox(unsigned short pid, int id, const char *label, const char *items);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
TextInputDialog::TextInputDialog()
|
TextInputDialog::TextInputDialog()
|
||||||
: MWGui::WindowModal("openmw_text_input.layout")
|
: MWGui::WindowModal("tes3mp_text_input.layout")
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -50,6 +50,11 @@ namespace mwmp
|
||||||
setText("LabelT", label);
|
setText("LabelT", label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextInputDialog::setTextNote(const std::string ¬e)
|
||||||
|
{
|
||||||
|
setText("TextNote", note);
|
||||||
|
}
|
||||||
|
|
||||||
void TextInputDialog::open()
|
void TextInputDialog::open()
|
||||||
{
|
{
|
||||||
WindowModal::open();
|
WindowModal::open();
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace mwmp
|
||||||
|
|
||||||
void setNextButtonShow(bool shown);
|
void setNextButtonShow(bool shown);
|
||||||
void setTextLabel(const std::string &label);
|
void setTextLabel(const std::string &label);
|
||||||
|
void setTextNote(const std::string ¬e);
|
||||||
|
|
||||||
void setEditPassword(bool value);
|
void setEditPassword(bool value);
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,8 @@ void mwmp::GUIController::showInputBox(const BasePlayer::GUIMessageBox &guiMessa
|
||||||
mInputBox->setEditPassword(guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog);
|
mInputBox->setEditPassword(guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog);
|
||||||
|
|
||||||
mInputBox->setTextLabel(guiMessageBox.label);
|
mInputBox->setTextLabel(guiMessageBox.label);
|
||||||
|
mInputBox->setTextNote(guiMessageBox.note);
|
||||||
|
|
||||||
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::onInputBoxDone);
|
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::onInputBoxDone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@ namespace mwmp
|
||||||
ListBox
|
ListBox
|
||||||
};
|
};
|
||||||
std::string label;
|
std::string label;
|
||||||
|
std::string note;
|
||||||
std::string buttons;
|
std::string buttons;
|
||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
|
|
|
@ -25,5 +25,7 @@ void PacketGUIBoxes::Packet(RakNet::BitStream *bs, bool send)
|
||||||
|
|
||||||
if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox)
|
if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox)
|
||||||
RW(player->guiMessageBox.buttons, send);
|
RW(player->guiMessageBox.buttons, send);
|
||||||
|
else if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog)
|
||||||
|
RW(player->guiMessageBox.note, send);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
34
files/mygui/tes3mp_text_input.layout
Normal file
34
files/mygui/tes3mp_text_input.layout
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<MyGUI type="Layout">
|
||||||
|
<Widget type="VBox" skin="MW_Dialog" layer="Windows" align="Center" name="_Main">
|
||||||
|
<Property key="AutoResize" value="true"/>
|
||||||
|
<Property key="Padding" value="10"/>
|
||||||
|
<Property key="Spacing" value="12"/>
|
||||||
|
|
||||||
|
<!-- Appearance -->
|
||||||
|
<Widget type="TextBox" skin="ProgressText" position="6 6 300 18" name="LabelT" align="Left Top">
|
||||||
|
<Property key="TextAlign" value="Left Top"/>
|
||||||
|
</Widget>
|
||||||
|
<Widget type="EditBox" skin="MW_TextEdit" position="6 28 300 30" name="TextEdit" align="Left Top"/>
|
||||||
|
|
||||||
|
<!-- Dialog buttons -->
|
||||||
|
<Widget type="HBox" skin="">
|
||||||
|
<UserString key="HStretch" value="true"/>
|
||||||
|
<Widget type="Widget">
|
||||||
|
<UserString key="HStretch" value="true"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedButton" skin="MW_Button" name="OKButton">
|
||||||
|
<Property key="Caption" value="OK"/>
|
||||||
|
</Widget>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedEditBox" skin="HeaderText" position="6 96 300 0" name="TextNote" align="Left Top">
|
||||||
|
<Property key="TextAlign" value="Center"/>
|
||||||
|
<Property key="MultiLine" value="true"/>
|
||||||
|
<Property key="WordWrap" value="true"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
</Widget>
|
||||||
|
</MyGUI>
|
Loading…
Reference in a new issue