From de18c6ff00a7654973f6b30387f7a58ae1370e94 Mon Sep 17 00:00:00 2001
From: Nico <122193236+Nico8340@users.noreply.github.com>
Date: Fri, 24 May 2024 01:58:11 +0200
Subject: [PATCH] Add resource 'dialogs' to replace old 'msgbox' resource
(#467)
---
[editor]/editor_gui/client/buttonclicked.lua | 17 +-
[editor]/editor_gui/client/interface.lua | 2 +-
[editor]/editor_gui/client/load.lua | 9 +-
[editor]/editor_gui/client/locations.lua | 10 +-
.../editor_gui/client/mapsettings_gui.lua | 12 +-
[editor]/editor_gui/client/me_gui.lua | 6 -
[editor]/editor_gui/client/save.lua | 31 +-
[editor]/editor_gui/meta.xml | 8 +-
.../client/saveloadtest_client.lua | 8 +-
[editor]/msgbox/script.lua | 6 +
[gameplay]/dialogs/files/error.png | Bin 0 -> 2165 bytes
[gameplay]/dialogs/files/info.png | Bin 0 -> 2225 bytes
[gameplay]/dialogs/files/question.png | Bin 0 -> 2221 bytes
[gameplay]/dialogs/files/warning.png | Bin 0 -> 1884 bytes
[gameplay]/dialogs/meta.xml | 16 +
[gameplay]/dialogs/readme.md | 230 +++++++++++++
[gameplay]/dialogs/sourceC.lua | 310 ++++++++++++++++++
[gameplay]/dialogs/sourceG.lua | 77 +++++
[gameplay]/webbrowser/WebBrowserGUI.lua | 2 +-
[gameplay]/webbrowser/meta.xml | 2 +-
20 files changed, 688 insertions(+), 58 deletions(-)
create mode 100644 [gameplay]/dialogs/files/error.png
create mode 100644 [gameplay]/dialogs/files/info.png
create mode 100644 [gameplay]/dialogs/files/question.png
create mode 100644 [gameplay]/dialogs/files/warning.png
create mode 100644 [gameplay]/dialogs/meta.xml
create mode 100644 [gameplay]/dialogs/readme.md
create mode 100644 [gameplay]/dialogs/sourceC.lua
create mode 100644 [gameplay]/dialogs/sourceG.lua
diff --git a/[editor]/editor_gui/client/buttonclicked.lua b/[editor]/editor_gui/client/buttonclicked.lua
index 5a6d6e81c..c6880752d 100644
--- a/[editor]/editor_gui/client/buttonclicked.lua
+++ b/[editor]/editor_gui/client/buttonclicked.lua
@@ -55,18 +55,19 @@ function elementIcons_Clicked ( source, mouseButton )
end
end
+function newCallback(callbackResult)
+ if callbackResult == "YES" then
+ editor_main.newResource()
+ end
+
+ guiSetInputEnabled(false)
+end
+
--These are individual functions for each topmenu button
function topMenuClicked.new ()
editor_main.dropElement ()
guiSetInputEnabled(true)
- local yes,no = guiShowMessageBox ( "Are you sure you want to create a new map?\nAny unsaved data will be lost.", "info", "New", true, "Yes", "No" )
- addEventHandler ( "onClientGUIClick",yes,function()
- editor_main.newResource()
- guiSetInputEnabled(false)
- end,false )
- addEventHandler ( "onClientGUIClick",no,function()
- guiSetInputEnabled(false)
- end,false )
+ exports.dialogs:messageBox("New", "Are you sure you want to create a new map? Any unsaved data will be lost.", "newCallback", "QUESTION", "YESNO")
end
function topMenuClicked.open ()
diff --git a/[editor]/editor_gui/client/interface.lua b/[editor]/editor_gui/client/interface.lua
index f7eee626d..ea459fbe0 100644
--- a/[editor]/editor_gui/client/interface.lua
+++ b/[editor]/editor_gui/client/interface.lua
@@ -7,7 +7,7 @@ local interface = {
move_cursor = NOT_REQUIRED,
move_freecam = NOT_REQUIRED,
move_keyboard = NOT_REQUIRED,
- msgbox = NOT_REQUIRED,
+ dialogs = NOT_REQUIRED,
tooltip = NOT_REQUIRED,
freeroam = NOT_REQUIRED,
}
diff --git a/[editor]/editor_gui/client/load.lua b/[editor]/editor_gui/client/load.lua
index 5898a29fd..f5756e2ac 100644
--- a/[editor]/editor_gui/client/load.lua
+++ b/[editor]/editor_gui/client/load.lua
@@ -34,12 +34,13 @@ function openMap()
local row = guiGridListGetSelectedItem ( loadDialog.mapsList )
if row == -1 then return end
mapName = guiGridListGetItemText ( loadDialog.mapsList, row, 1 )
- open = guiShowMessageBox ( "Are you sure you want to load map \""..mapName.."\"?\nAny unsaved changes will be lost.", "info", "Are you sure?", true, "Open", "Cancel" )
- addEventHandler ( "onClientGUIClick", open, openButton, false )
+ exports.dialogs:messageBox("Are you sure?", "Are you sure you want to load map \""..mapName.."\"?\nAny unsaved changes will be lost.", "openCallback", "QUESTION", "YESNO")
end
-function openButton ()
- editor_main.openResource ( mapName )
+function openCallback(callbackResult)
+ if callbackResult == "YES" then
+ editor_main.openResource ( mapName )
+ end
end
addEvent ( "openShowDialog",true )
diff --git a/[editor]/editor_gui/client/locations.lua b/[editor]/editor_gui/client/locations.lua
index 4061b407d..ac085aa8e 100644
--- a/[editor]/editor_gui/client/locations.lua
+++ b/[editor]/editor_gui/client/locations.lua
@@ -102,11 +102,11 @@ function addBookmark ()
local z = locations.z:getValue()
local world = locations.world:getValue()
if name == "" then
- guiShowMessageBox ( 'No location name was specified!', "error", "Bad value", true )
+ exports.dialogs:messageBox("Bad value", "No location name was specified!", false, "ERROR", "OK")
return
end
if bookmarksTable[name] then
- guiShowMessageBox ( 'A location of name "'..name..'" already exists!', "error", "Conflict", true )
+ exports.dialogs:messageBox("Bad value", "A location of name \"" .. name .."\" already exists!", false, "ERROR", "OK")
return
end
bookmarksTable[name] = {}
@@ -192,15 +192,15 @@ end
function setLocation ( x,y,z,world )
if not x then
- local button = guiShowMessageBox ( "Invalid \"x position\" specified", "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid \"x position\" specified", false, "ERROR", "OK")
return
end
if not y then
- local button = guiShowMessageBox ( "Invalid \"y position\" specified", "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid \"y position\" specified", false, "ERROR", "OK")
return
end
if not z then
- local button = guiShowMessageBox ( "Invalid \"z position\" specified", "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid \"z position\" specified", false, "ERROR", "OK")
return
end
if not world then
diff --git a/[editor]/editor_gui/client/mapsettings_gui.lua b/[editor]/editor_gui/client/mapsettings_gui.lua
index 8d520e1a9..f25aba5e7 100644
--- a/[editor]/editor_gui/client/mapsettings_gui.lua
+++ b/[editor]/editor_gui/client/mapsettings_gui.lua
@@ -170,29 +170,29 @@ end
function confirmMapSettings ()
local versionText = mapsettings.metaVersion:getValue()
if not versionText or not (( string.match (versionText, "^%d+$") ) or ( string.match (versionText, "^%d+%.%d+$") ) or ( string.match (versionText, "^%d+%.%d+%.%d+$") )) then
- guiShowMessageBox ( "Invalid META \"Version\" specified", "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid META \"Version\" specified", false, "ERROR", "OK")
return
end
if not mapsettings.timeHour:getValue() or not mapsettings.timeMinute:getValue()
or mapsettings.timeHour:getValue() > 23 or mapsettings.timeMinute:getValue() > 59 then
- guiShowMessageBox ( "Invalid Time specified", "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid time specified", false, "ERROR", "OK")
return
end
-- if mapsettings.metaAuthor:getValue() == "" then
- -- guiShowMessageBox ( "Invalid META \"Author\" specified", "error", "Bad Value", true )
+ -- exports.dialogs:messageBox("Bad value", "Invalid META \"Author\" specified", false, "ERROR", "OK")
-- return
-- end
if not tonumber(mapsettings.maxplayers:getValue()) then
- guiShowMessageBox ( 'Invalid "Maximum Players" specified', "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid \"Maximum Players\" specified", false, "ERROR", "OK")
return
end
if not tonumber(mapsettings.minplayers:getValue()) then
- guiShowMessageBox ( 'Invalid "Minimum Players" specified', "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid \"Maximum Players\" specified", false, "ERROR", "OK")
return
end
if mapsettings.minplayers:getValue() >= mapsettings.maxplayers:getValue() then
- guiShowMessageBox ( 'Invalid "Minimum Players" specified', "error", "Bad Value", true )
+ exports.dialogs:messageBox("Bad value", "Invalid \"Maximum Players\" specified", false, "ERROR", "OK")
return
end
if not tonumber(mapsettings.gamespeed:getValue()) then
diff --git a/[editor]/editor_gui/client/me_gui.lua b/[editor]/editor_gui/client/me_gui.lua
index e7477c8f3..92626c09e 100644
--- a/[editor]/editor_gui/client/me_gui.lua
+++ b/[editor]/editor_gui/client/me_gui.lua
@@ -370,12 +370,6 @@ function playSoundFrontEnd ( sound )
return returnValue
end
-function guiShowMessageBox ( message, boxType, title, forced, button1, button2, button3 )
- playSoundFrontEnd ( 5 )
- local a1,a2,a3 = msgbox.guiShowMessageBox ( message, boxType, title, forced, button1, button2, button3 )
- return a1,a2,a3
-end
-
function clearNonCreatableElements(elementTable)
for elementName,data in pairs(elementTable) do
if not data.createable then
diff --git a/[editor]/editor_gui/client/save.lua b/[editor]/editor_gui/client/save.lua
index b82508a9d..8fb6a2d62 100644
--- a/[editor]/editor_gui/client/save.lua
+++ b/[editor]/editor_gui/client/save.lua
@@ -54,33 +54,24 @@ function saveMap()
mapName = guiGetText ( saveDialog.mapName )
if mapName == "" then return end
if mapsInfo[string.lower(mapName)] then
- local save,cancel = guiShowMessageBox ( "Are you sure you want to overwrite map \""..mapName.."\"?\n" ..
- "This will cause original map data to be lost.",
- "info", "Are you sure?", true, "Save", "Cancel" )
- addEventHandler ( "onClientGUIClick", save, saveButton, false )
- addEventHandler ( "onClientGUIClick", cancel, restoreSaveDialog, false )
+ exports.dialogs:messageBox("Are you sure?", "Are you sure you want to overwrite map \""..mapName.."\"? This will cause original map data to be lost.", "saveCallback", "QUESTION", "YESNO")
guiSetProperty(saveDialog.window, "Disabled", "True")
elseif resourcesInfo[string.lower(mapName)] then
- guiShowMessageBox ( "Unable to save to \""..mapName.."\". \n" ..
- "You cannot overwrite non-map resources.",
- "error", "Cannot save", true )
+ exports.dialogs:messageBox("Cannot save", "Unable to save to \""..mapName.."\" You cannot overwrite non-map resources.", false, "ERROR", "OK")
else
- local save,cancel = guiShowMessageBox ( "Are you sure you want to save to \""..mapName.."\"?",
- "info", "Are you sure?", true, "Save", "Cancel" )
- addEventHandler ( "onClientGUIClick", save, saveButton, false )
- addEventHandler ( "onClientGUIClick", cancel, restoreSaveDialog, false )
+ exports.dialogs:messageBox("Are you sure?", "Are you sure you want to save to \""..mapName.."\"?", "saveCallback", "QUESTION", "YESNO")
guiSetProperty(saveDialog.window, "Disabled", "True")
end
end
-function saveButton()
- local resourceName = guiGetText ( saveDialog.mapName )
- local directory = guiGetText ( saveDialog.directory )
- editor_main.saveResource ( resourceName, directory )
-end
-
-function restoreSaveDialog()
- guiSetProperty(saveDialog.window, "Disabled", "False")
+function saveCallback(callbackResult)
+ if callbackResult == "YES" then
+ local resourceName = guiGetText ( saveDialog.mapName )
+ local directory = guiGetText ( saveDialog.directory )
+ editor_main.saveResource ( resourceName, directory )
+ else
+ guiSetProperty(saveDialog.window, "Disabled", "False")
+ end
end
addEvent ( "saveAsShowDialog", true )
diff --git a/[editor]/editor_gui/meta.xml b/[editor]/editor_gui/meta.xml
index 1397a1888..3d9269496 100644
--- a/[editor]/editor_gui/meta.xml
+++ b/[editor]/editor_gui/meta.xml
@@ -2,7 +2,7 @@
-
+
@@ -53,12 +53,16 @@
-
+
+
+
+
+
diff --git a/[editor]/editor_main/client/saveloadtest_client.lua b/[editor]/editor_main/client/saveloadtest_client.lua
index 028c158da..88f043768 100644
--- a/[editor]/editor_main/client/saveloadtest_client.lua
+++ b/[editor]/editor_main/client/saveloadtest_client.lua
@@ -17,22 +17,22 @@ addEventHandler ( "saveloadtest_return", root,
end
editor_gui.closeLoadDialog()
else
- editor_gui.guiShowMessageBox ( "Map resource could not be started!", "error", "Error", true )
+ exports.dialogs:messageBox("Error", "Map resource could not be started!", false, "ERROR", "OK")
end
elseif ( command ) == "save" then
if ( returnValue ) then
editor_gui.closeSaveDialog()
else
- editor_gui.guiShowMessageBox ( "Map resource could not be saved! "..reason, "error", "Error", true )
+ exports.dialogs:messageBox("Error", "Map resource could not be saved! " .. reason, false, "ERROR", "OK")
editor_gui.restoreSaveDialog()
end
elseif ( command ) == "quickSave" then
reason = reason or "The target resource may be in .zip format or corrupted."
- editor_gui.guiShowMessageBox ( "Map resource could not be saved! "..reason, "error", "Error", true )
+ exports.dialogs:messageBox("Error", "Map resource could not be saved! " .. reason, false, "ERROR", "OK")
editor_gui.restoreSaveDialog()
elseif ( command ) == "test" then
reason = reason or ""
- editor_gui.guiShowMessageBox ( "Test could not be started! "..reason, "error", "Error", true )
+ exports.dialogs:messageBox("Error", "Test resource could not be started! " .. reason, false, "ERROR", "OK")
editor_gui.stopTest()
elseif ( command == "close" ) then
editor_gui.closeSaveDialog()
diff --git a/[editor]/msgbox/script.lua b/[editor]/msgbox/script.lua
index 72f364870..17c15da53 100644
--- a/[editor]/msgbox/script.lua
+++ b/[editor]/msgbox/script.lua
@@ -1,4 +1,7 @@
--[[-----------DOCUMENTATION---------------
+WARNING:
+This resource is deprecated as the new 'dialogs' resource replaces it.
+
SYNTAX:
guibutton,guibutton,guibutton = guiShowMessageBox ( string message, string boxType, string title [, string button1, string button2, stringbutton3] )
REQUIRED ARGUMENTS
@@ -111,6 +114,9 @@ function guiShowMessageBox ( message, boxType, title, forceShowing, button1, but
if ( forceShowing ) then
guiAttached[cover] = aMessage.Form
end
+
+ outputDebugString("This resource is deprecated as the new 'dialogs' resource replaces it.", 2)
+
return guiButton1, guiButton2, guiButton3
end
diff --git a/[gameplay]/dialogs/files/error.png b/[gameplay]/dialogs/files/error.png
new file mode 100644
index 0000000000000000000000000000000000000000..18e83882412c746f20799d5e1e23c023e1213b22
GIT binary patch
literal 2165
zcmV-*2#WWKP)gvkM%FfQt
zySux?26c6H)z#Ilt*sIg5&;1LcXxNOv9T&DDgpum0RaI5
z0s;a80s;a81qB5H0s;dA0|5a600000006!Z57WiPv@R~r85y@eKD`MEs90F3SXj#q
z4aatN%3506OibmIlgkVY?0kH*Z*SMXzxdqT=+o2T%*^T6*XX*s@5IF2udl{BI^fF6
zvu$nWLqpM>oz#JW)q#Qdy}iN^5Zh{M;-sYIsHnk7NxxE3!fb506BErKAke+N#>U31
zF)_It8{gX6x&{WPMMb)so3D9!xlvKOQ&Xp4V80X;)5F8%BqY2_O0+vW#RdlE-{0|1
zPq;}*@G>&H^c)2z>JK^j*h5IOtCL7
zyGBOEgoMJ6kJ{7I)y&Mt1qHr`htd=jzzhuP<>m6)+WO_?>9DZR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V~aaFmbm4PBFC+=q-9esyuhWg~qb7vYQ|efK<|@s-_K8F$Z_UI7!qt
zl?AM_uF`Cl=iVUn`bItR;{ml()>vw*Pf$r545&2mM1`dWCcp-@Ip;D-5Clnn`9q~k
zHrY-jN*z=v-Plx1+gosMTQ7@528c-f`QbK)R8>@)Hb{jII;}LW+G#u5au;eeVzHPK
zYc$mU!%w9xEv|GLP@Fl#dMcf^mX?;>g-MANMV&onr4o~*UmS#^gEXBvYMlX}0M447
zU3A_CR%MC(z0_JNm7YvFx9zmFwAA|DL5EblU6ehWg~KIyLnw?k*=$V}wZB>EWTv#V
zoZHQ%pMK+zozX(!>j+#ebk5A|gfj{g6#oS87AK@wYAlxI-NEqU(`1{ex${Uu_RKjb
zP>eZ6n6;`ItnJ%iYj(n~wJMdWw)Ug#S=QqB(-h5}PYSbyQJO_19
zoHb^Yq-d4y3E*ah!sLiT0fhi{t%XIBQDa!Rg9c#!!&XSbm$vGjfTlgIz|l~iFv1w*?~*x)_fCttwlE)QC=c+sN8OM;ej`GS0(;ofj`7j;>-KVzIv2#+V=^Y7i`
z^94L!h|f5NKO1B>3L_8>V`y)mULpBBUVca~pWZ_m90Ys$Z39OUrZ=N!k2fJbdNRD3
r2#UY@zJ;L(%gZ0)#X`_-x2}HxlTi3ML&Wvl00000NkvXXu0mjf2Y4QC
literal 0
HcmV?d00001
diff --git a/[gameplay]/dialogs/files/info.png b/[gameplay]/dialogs/files/info.png
new file mode 100644
index 0000000000000000000000000000000000000000..6524cba600b113eb11927ac9ff7b9752d75b2ccf
GIT binary patch
literal 2225
zcmV;i2u}BjP)gwv|=H?n28p_JbySuw}b#*T
zg_X#+!sOD}>XxnfZ->=(iOF$_*ng4DR%)l{>FZc(q=S~xg_zTbn$?e+z@@FlWp=S+
zbga(M)}f}kr>wbUdcKdAu3mV{eTSxXg}8Tzx_N}Ba*gA}#?P;{$(J29aEjh
zO=!2$($Z6FwAa|%U3SQrqQQEU=T~vYgrE1Cu=RnO?f3Whji1|+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A>Ait5Us2ThCLy
zs!v_=dg0yK-~x)z6EAvgwN$T{)i=QdPOJKq3hE6~d>3{B&7Cb?Q=(8xRr;epwYN9@
z(x+5+8~%Jt%;tdqQ7oAx-=VtI%0B7xW4*nNzpA06g4LDeOyOt>CKBYkHB?8pTCG$b
zYHU1qTmfZIu;xXQoQ02~=mfU1I@n4XI=U5#?;0AG)^$)&x{WVwVrL7^r(haOR@JzJ
zJrrdybR0Rkw822NLOE!B`4yI(kDo`grn4WsZyIz5gFUSj_09hMhau!-zq$59mPiNx
zQv4p4eXq3NIOuiTrI#;}g-GtSAL(glO${kHcy)
z`=RbPnd-iW4nm97;qkh*ezV8H9)vBgsQb6eYQzgwfw6&MPI-ySBCF-TLdA~ro8849=tyl~m+aO`T6
z%jJJKImpY1uX!yYnFtU(lOW1FBcUM9e|0vB04#O#)G7DHZOYWi0u&(dwPL6+K`4rYkq?s~9{mIP
WZ-npVUnZdd0000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/[gameplay]/dialogs/readme.md b/[gameplay]/dialogs/readme.md
new file mode 100644
index 000000000..1a94dbb38
--- /dev/null
+++ b/[gameplay]/dialogs/readme.md
@@ -0,0 +1,230 @@
+# Dialogs
+
+## Description
+Create and manage dialogs with callbacks.
+
+## Pictures
+![img](https://i.imgur.com/yawOkA6.png)
+
+## Functions
+
+### MessageBeep
+
+**Description**
+This function plays a sound from the **messageSounds** table.
+
+**Syntax**
+```lua
+messageBeep( string soundType, [ int soundVolume ] )
+```
+
+**Example**
+> This example plays an info sound with the default volume (1)
+```lua
+messageBeep("INFO")
+```
+
+
+
+> This example plays a question sound with specified volume (0.5)
+```lua
+messageBeep("QUESTION", 0.5)
+```
+
+**Arguments**
+> - soundType: A string specifying the sound data, which is in the **messageSounds** table.
+> - soundVolume: An integer between 1 and 0 that specifies the volume. (optional)
+
+
+
+**Returns**
+Returns the sound element.
+
+### MessageBox
+
+**Description**
+This function creates a dialog box with a callback function.
+
+**Syntax**
+```lua
+messageBox( string messageTitle, string messageContent, string messageCallback, [ string messageIcon, string messageButton, int messageButtonDefault, string messageSound, int messageSoundVolume] )
+```
+
+**Example**
+> This example creates a dialog containing an information.
+```lua
+messageBox("Welcome", "Multi Theft Auto provides the best online Grand Theft Auto experience there is.", "callbackFunction", "INFO", "OK")
+```
+
+```lua
+function callbackFunction(callbackResult)
+ if callbackResult == "OK" then
+ print("Read")
+ end
+end
+```
+
+
+
+> This example creates a dialog containing a question.
+```lua
+messageBox("Save", "Are you sure you want to save your changes? This action will overwrite your previous saves.", "callbackFunction", "QUESTION", "YESNOCANCEL")
+```
+
+```lua
+function callbackFunction(callbackResult)
+ if callbackResult == "YES" then
+ print("Save")
+ elseif callbackResult == "NO" then
+ print("Undo")
+ else
+ print("Cancel")
+ end
+end
+```
+
+
+
+> This example creates a dialog containing a warning.
+```lua
+messageBox("Mismatch", "The selected file does not exist. Would you like to try the download again?", "callbackFunction", "WARNING", "ABORTRETRYIGNORE")
+```
+
+```lua
+function callbackFunction(callbackResult)
+ if callbackResult == "ABORT" then
+ print("Abort")
+ elseif callbackResult == "RETRY" then
+ print("Retry")
+ else
+ print("Ignore")
+ end
+end
+```
+
+
+
+> This example creates a dialog containing an error.
+```lua
+messageBox("Your wallet is empty", "You do not have enough money to purchase the selected vehicle.", "callbackFunction", "ERROR", "OK")
+```
+
+```lua
+function callbackFunction(callbackResult)
+ if callbackResult == "OK" then
+ print("Read")
+ end
+end
+```
+
+**Arguments**
+> - messageTitle: A string specifing the title of the message (note that it will be always uppercase)
+> - messageContent: A string specifing the content of the message
+> - messageCallback: A string specifying the name of the function that will be exported when a button is pressed. (Note that you must specify the function name as a string and specify the function as exportable in the meta.xml of the source.)
+> - messageIcon: A string specifing the icon of the message, which is in the **messageIcons** table.
+> - messageButton: A string specifing the button(s) of the message, which is in the **messageButtons** table.
+> - messageButtonDefault: An integer specifing the default button (note that it will receive a bolder font)
+> - messageSound: A string specifing the sound of the message, which is in the **messageSounds** table.
+> - messageSoundVolume: An integer between 1 and 0 specifing the volume of the sound.
+
+
+**Returns**
+This function does not contain returns because it uses a callback function.
+
+### MessageBoxEx
+
+**Description**
+This function creates a dialog box without a callback function.
+
+**Syntax**
+```lua
+messageBoxEx( string messageTitle, string messageContent, [ string messageIcon, string messageButton, int messageButtonDefault, string messageSound, int messageSoundVolume] )
+```
+
+**Example**
+> This example creates a dialog containing an information.
+```lua
+local buttonOK = messageBoxEx("Welcome", "Multi Theft Auto provides the best online Grand Theft Auto experience there is.", "INFO", "OK")
+
+addEventHandler("onClientGUIClick", buttonOK,
+ function()
+ print("Read")
+ end
+)
+```
+
+
+
+> This example creates a dialog containing a question.
+```lua
+local buttonYes, buttonNo, buttonCancel = messageBoxEx("Save", "Are you sure you want to save your changes? This action will overwrite your previous saves.", "QUESTION", "YESNOCANCEL")
+
+addEventHandler("onClientGUIClick", buttonYes,
+ function()
+ print("Save")
+ end
+)
+
+addEventHandler("onClientGUIClick", buttonNo,
+ function()
+ print("Undo")
+ end
+)
+
+addEventHandler("onClientGUIClick", buttonCancel,
+ function()
+ print("Cancel")
+ end
+)
+```
+
+
+
+> This example creates a dialog containing a warning.
+```lua
+local buttonAbort, buttonRetry, buttonIgnore = messageBoxEx("Save", "Are you sure you want to save your changes? This action will overwrite your previous saves.", "QUESTION", "YESNOCANCEL")
+
+addEventHandler("onClientGUIClick", buttonAbort,
+ function()
+ print("Abort")
+ end
+)
+
+addEventHandler("onClientGUIClick", buttonRetry,
+ function()
+ print("Retry")
+ end
+)
+
+addEventHandler("onClientGUIClick", buttonIgnore,
+ function()
+ print("Ignore")
+ end
+)
+```
+
+
+
+> This example creates a dialog containing an error.
+```lua
+local buttonOK = messageBoxEx("Your wallet is empty", "You do not have enough money to purchase the selected vehicle.", "ERROR", "OK")
+
+addEventHandler("onClientGUIClick", buttonOK,
+ function()
+ print("Read")
+ end
+)
+```
+
+**Arguments**
+> - messageTitle: A string specifing the title of the message (note that it will be always uppercase)
+> - messageContent: A string specifing the content of the message
+> - messageIcon: A string specifing the icon of the message, which is in the **messageIcons** table.
+> - messageButton: A string specifing the button(s) of the message, which is in the **messageButtons** table.
+> - messageButtonDefault: An integer specifing the default button (note that it will receive a bolder font)
+> - messageSound: A string specifing the sound of the message, which is in the **messageSounds** table.
+> - messageSoundVolume: An integer between 1 and 0 specifing the volume of the sound.
+
+
+**Returns**
+Returns as many buttons in order as specified in the messageButton argument.
\ No newline at end of file
diff --git a/[gameplay]/dialogs/sourceC.lua b/[gameplay]/dialogs/sourceC.lua
new file mode 100644
index 000000000..d59c6b6f2
--- /dev/null
+++ b/[gameplay]/dialogs/sourceC.lua
@@ -0,0 +1,310 @@
+local screenX, screenY = guiGetScreenSize()
+
+local messageBoxWindows = {}
+local messageBoxCallbacks = {}
+
+function messageBeep(soundType, soundVolume)
+ if not soundType or type(soundType) ~= "string" then
+ error("Bad argument @ 'messageBeep' [Expected string at argument 1, got " .. type(soundType) .. "]")
+ end
+
+ soundType = utf8.upper(soundType)
+
+ if not messageSounds[soundType] then
+ error("Bad argument @ 'messageBeep' [Invalid type at argument 1, got '" .. tostring(soundType) .. "']")
+ end
+
+ if not soundVolume or soundVolume > 1 or type(soundVolume) ~= "number" then
+ soundVolume = 1
+ end
+
+ local soundID = messageSounds[soundType].soundID
+ local soundElement = playSoundFrontEnd(soundID)
+
+ if soundElement and isElement(soundElement) then
+ setSoundVolume(soundElement, soundVolume)
+ end
+
+ return soundElement
+end
+
+function messageClick()
+ local elementParent = getElementParent(source)
+
+ if elementParent then
+ local elementBox = messageBoxWindows[elementParent]
+
+ if elementBox then
+ local elementCallback = messageBoxCallbacks[elementParent][1]
+ local elementCallbackSource = messageBoxCallbacks[elementParent][2]
+ local elementCallbackResult = guiGetText(source)
+
+ elementCallbackResult = utf8.upper(elementCallbackResult)
+
+ if elementCallback and type(elementCallback) == "string" then
+ if elementCallbackSource and getResourceState(elementCallbackSource) == "running" then
+ call(elementCallbackSource, elementCallback, elementCallbackResult)
+ end
+ end
+
+ destroyElement(elementParent)
+
+ messageBoxWindows[elementParent] = nil
+ messageBoxCallbacks[elementParent] = nil
+ end
+ end
+end
+
+function messageClickEx()
+ local elementParent = getElementParent(source)
+
+ if elementParent then
+ local elementBox = messageBoxWindows[elementParent]
+
+ if elementBox then
+ destroyElement(elementParent)
+ messageBoxWindows[elementParent] = nil
+ end
+ end
+end
+
+function messageBox(messageTitle, messageContent, messageCallback, messageIcon, messageButton, messageButtonDefault, messageSound, messageSoundVolume)
+ if not messageTitle or type(messageTitle) ~= "string" then
+ error("Bad argument @ 'messageBox' [Expected string at argument 1, got " .. type(messageTitle) .. "]")
+ end
+
+ messageTitle = utf8.upper(messageTitle)
+
+ if not messageContent or type(messageContent) ~= "string" then
+ error("Bad argument @ 'messageBox' [Expected string at argument 2, got " .. type(messageContent) .. "]")
+ end
+
+ if not messageIcon or type(messageIcon) ~= "string" then
+ messageIcon = "INFO"
+ end
+
+ messageIcon = utf8.upper(messageIcon)
+
+ if not messageIcons[messageIcon] then
+ error("Bad argument @ 'messageBox' [Invalid type at argument 4, got '" .. tostring(messageIcon) .. "']")
+ end
+
+ if not messageButton or type(messageButton) ~= "string" then
+ messageButton = "OK"
+ end
+
+ messageButton = utf8.upper(messageButton)
+
+ if not messageButtons[messageButton] then
+ error("Bad argument @ 'messageBox' [Invalid type at argument 5, got '" .. tostring(messageButton) .. "']")
+ end
+
+ if messageButtonDefault then
+ if type(messageButtonDefault) ~= "number" then
+ error("Bad argument @ 'messageBox' [Expected number at argument 6, got " .. type(messageButtonDefault) .. "]")
+ elseif #messageButtons[messageButton] < messageButtonDefault then
+ error("Bad argument @ 'messageBox' [Invalid default at argument 6, " .. messageButton .. " only have " .. tostring(#messageButtons[messageButon]) .. " buttons.]")
+ end
+ else
+ messageButtonDefault = 1
+ end
+
+ if messageSound then
+ if type(messageSound) ~= "string" then
+ error("Bad argument @ 'messageBox' [Expected string at argument 7, got " .. type(messageSound) .. "]")
+ elseif not messageSounds[messageSound] then
+ error("Bad argument @ 'messageBox' [Invalid type at argument 7, got '" .. messageSound .. "']")
+ end
+ else
+ messageSound = messageIcon
+ end
+
+ if messageSoundVolume then
+ if type(messageSoundVolume) ~= "number" then
+ error("Bad argument @ 'messageBox' [Expected number at argument 8, got " .. type(messageSoundVolume) .. "]")
+ elseif messageSoundVolume > 1 or messageSoundVolume < 1 then
+ error("Bad argument @ 'messageBox' [Invalid volume at argument 8, got '" .. tostring(messageSoundVolume) .. "']")
+ end
+ else
+ messageSoundVolume = 1
+ end
+
+ messageBeep(messageSound, messageSoundVolume)
+
+ local messageWindowWidth = 400
+ local messageWindowHeight = 200
+
+ local messageWindowPosX = (screenX - messageWindowWidth) / 2
+ local messageWindowPosY = (screenY - messageWindowHeight) / 2
+ local messageWindowElement = guiCreateWindow(messageWindowPosX, messageWindowPosY, messageWindowWidth, messageWindowHeight, messageTitle)
+
+ guiWindowSetSizable(messageWindowElement, false)
+
+ local messageIconWidth = 42
+ local messageIconHeight = 42
+
+ local messageIconPosX = (messageWindowWidth - messageIconWidth) / 8
+ local messageIconPosY = (messageWindowHeight - messageIconHeight) / 2
+
+ guiCreateStaticImage(messageIconPosX, messageIconPosY, messageIconWidth, messageIconHeight, messageIcons[messageIcon].iconPath, false, messageWindowElement)
+
+ local messageCaptionWidth = messageWindowWidth - (messageIconPosX + messageIconWidth + 10 + 5)
+ local messageCaptionHeight = 16
+
+ local messageContentWidth = messageWindowWidth - (messageIconPosX + messageIconWidth + 10 + 5)
+ local messageContentHeight = 18
+
+ local messageCaptionPosX = messageIconPosX + messageIconWidth + 10
+ local messageCaptionPosY = messageIconPosY + (messageIconHeight - messageCaptionHeight - messageContentHeight) / 2
+ local messageCaptionElement = guiCreateLabel(messageCaptionPosX, messageCaptionPosY, messageCaptionWidth, messageCaptionHeight, messageIcons[messageIcon].iconCaption, false, messageWindowElement)
+
+ guiSetFont(messageCaptionElement, "default-bold-small")
+
+ local messageContentPosX = messageIconPosX + messageIconWidth + 10
+ local messageContentPosY = messageIconPosY + (messageIconHeight - messageContentHeight) - 5
+ local messageContentElement = guiCreateLabel(messageContentPosX, messageContentPosY, messageContentWidth, messageContentHeight * 4 , messageContent, false, messageWindowElement)
+
+ guiLabelSetHorizontalAlign(messageContentElement, "left", true)
+
+ local messageButtonWidth = 50
+ local messageButtonHeight = 30
+
+ local messageButtonPosX = (messageWindowWidth - 5) - (messageButtonWidth + 5) * #messageButtons[messageButton]
+ local messageButtonPosY = (messageWindowHeight - 10) - messageButtonHeight
+
+ for i, v in ipairs(messageButtons[messageButton]) do
+ local messageButtonElement = guiCreateButton(messageButtonPosX, messageButtonPosY, messageButtonWidth, messageButtonHeight, v, false, messageWindowElement)
+
+ if i == messageButtonDefault then
+ guiSetFont(messageButtonElement, "default-bold-small")
+ end
+
+ addEventHandler("onClientGUIClick", messageButtonElement, messageClick, false)
+ messageButtonPosX = messageButtonPosX + messageButtonWidth + 5
+ end
+
+ messageBoxWindows[messageWindowElement] = {messageTitle, messageContent, messageIcon, messageButton}
+ messageBoxCallbacks[messageWindowElement] = {messageCallback, sourceResource}
+end
+
+function messageBoxEx(messageTitle, messageContent, messageIcon, messageButton, messageButtonDefault, messageSound, messageSoundVolume)
+ if not messageTitle or type(messageTitle) ~= "string" then
+ error("Bad argument @ 'messageBoxEx' [Expected string at argument 1, got " .. type(messageTitle) .. "]")
+ end
+
+ messageTitle = utf8.upper(messageTitle)
+
+ if not messageContent or type(messageContent) ~= "string" then
+ error("Bad argument @ 'messageBoxEx' [Expected string at argument 2, got " .. type(messageContent) .. "]")
+ end
+
+ if not messageIcon or type(messageIcon) ~= "string" then
+ messageIcon = "INFO"
+ end
+
+ messageIcon = utf8.upper(messageIcon)
+
+ if not messageIcons[messageIcon] then
+ error("Bad argument @ 'messageBoxEx' [Invalid type at argument 3, got '" .. tostring(messageIcon) .. "']")
+ end
+
+ if not messageButton or type(messageButton) ~= "string" then
+ messageButton = "OK"
+ end
+
+ messageButton = utf8.upper(messageButton)
+
+ if not messageButtons[messageButton] then
+ error("Bad argument @ 'messageBoxEx' [Invalid type at argument 4, got '" .. tostring(messageButton) .. "']")
+ end
+
+ if messageButtonDefault then
+ if type(messageButtonDefault) ~= "number" then
+ error("Bad argument @ 'messageBoxEx' [Expected number at argument 5, got " .. type(messageButtonDefault) .. "]")
+ elseif #messageButtons[messageButton] < messageButtonDefault then
+ error("Bad argument @ 'messageBoxEx' [Invalid default at argument 5, " .. messageButton .. " only have " .. tostring(#messageButtons[messageButon]) .. " buttons.]")
+ end
+ else
+ messageButtonDefault = 1
+ end
+
+ if messageSound then
+ if type(messageSound) ~= "string" then
+ error("Bad argument @ 'messageBoxEx' [Expected string at argument 6, got " .. type(messageSound) .. "]")
+ elseif not messageSounds[messageSound] then
+ error("Bad argument @ 'messageBoxEx' [Invalid type at argument 6, got '" .. messageSound .. "']")
+ end
+ else
+ messageSound = messageIcon
+ end
+
+ if messageSoundVolume then
+ if type(messageSoundVolume) ~= "number" then
+ error("Bad argument @ 'messageBoxEx' [Expected number at argument 7, got " .. type(messageSoundVolume) .. "]")
+ elseif messageSoundVolume > 1 or messageSoundVolume < 1 then
+ error("Bad argument @ 'messageBoxEx' [Invalid volume at argument 7, got '" .. tostring(messageSoundVolume) .. "']")
+ end
+ else
+ messageSoundVolume = 1
+ end
+
+ messageBeep(messageSound, messageSoundVolume)
+
+ local messageWindowWidth = 400
+ local messageWindowHeight = 200
+
+ local messageWindowPosX = (screenX - messageWindowWidth) / 2
+ local messageWindowPosY = (screenY - messageWindowHeight) / 2
+ local messageWindowElement = guiCreateWindow(messageWindowPosX, messageWindowPosY, messageWindowWidth, messageWindowHeight, messageTitle)
+
+ guiWindowSetSizable(messageWindowElement, false)
+
+ local messageIconWidth = 42
+ local messageIconHeight = 42
+
+ local messageIconPosX = (messageWindowWidth - messageIconWidth) / 8
+ local messageIconPosY = (messageWindowHeight - messageIconHeight) / 2
+
+ guiCreateStaticImage(messageIconPosX, messageIconPosY, messageIconWidth, messageIconHeight, messageIcons[messageIcon].iconPath, false, messageWindowElement)
+
+ local messageCaptionWidth = messageWindowWidth - (messageIconPosX + messageIconWidth + 10 + 5)
+ local messageCaptionHeight = 16
+
+ local messageContentWidth = messageWindowWidth - (messageIconPosX + messageIconWidth + 10 + 5)
+ local messageContentHeight = 18
+
+ local messageCaptionPosX = messageIconPosX + messageIconWidth + 10
+ local messageCaptionPosY = messageIconPosY + (messageIconHeight - messageCaptionHeight - messageContentHeight) / 2
+ local messageCaptionElement = guiCreateLabel(messageCaptionPosX, messageCaptionPosY, messageCaptionWidth, messageCaptionHeight, messageIcons[messageIcon].iconCaption, false, messageWindowElement)
+
+ guiSetFont(messageCaptionElement, "default-bold-small")
+
+ local messageContentPosX = messageIconPosX + messageIconWidth + 10
+ local messageContentPosY = messageIconPosY + (messageIconHeight - messageContentHeight) - 5
+ local messageContentElement = guiCreateLabel(messageContentPosX, messageContentPosY, messageContentWidth, messageContentHeight * 4 , messageContent, false, messageWindowElement)
+
+ guiLabelSetHorizontalAlign(messageContentElement, "left", true)
+
+ local messageButtonWidth = 50
+ local messageButtonHeight = 30
+
+ local messageButtonPosX = (messageWindowWidth - 5) - (messageButtonWidth + 5) * #messageButtons[messageButton]
+ local messageButtonPosY = (messageWindowHeight - 10) - messageButtonHeight
+ local messageButtonElements = {}
+
+ for i, v in ipairs(messageButtons[messageButton]) do
+ local messageButtonElement = guiCreateButton(messageButtonPosX, messageButtonPosY, messageButtonWidth, messageButtonHeight, v, false, messageWindowElement)
+
+ if i == messageButtonDefault then
+ guiSetFont(messageButtonElement, "default-bold-small")
+ end
+
+ addEventHandler("onClientGUIClick", messageButtonElement, messageClickEx, false)
+ messageButtonElements[i] = messageButtonElement
+ messageButtonPosX = messageButtonPosX + messageButtonWidth + 5
+ end
+
+ messageBoxWindows[messageWindowElement] = {messageTitle, messageContent, messageIcon, messageButton}
+
+ return messageButtonElements[1], messageButtonElements[2], messageButtonElements[3]
+end
\ No newline at end of file
diff --git a/[gameplay]/dialogs/sourceG.lua b/[gameplay]/dialogs/sourceG.lua
new file mode 100644
index 000000000..68332177d
--- /dev/null
+++ b/[gameplay]/dialogs/sourceG.lua
@@ -0,0 +1,77 @@
+messageButtons = {
+ ["ABORTRETRYIGNORE"] = {
+ [1] = "Abort",
+ [2] = "Retry",
+ [3] = "Ignore"
+ },
+ ["CANCELTRYCONTINUE"] = {
+ [1] = "Cancel",
+ [2] = "Try",
+ [3] = "Continue"
+ },
+ ["HELP"] = {
+ [1] = "Help"
+ },
+ ["OK"] = {
+ [1] = "OK"
+ },
+ ["OKCANCEL"] = {
+ [1] = "OK",
+ [2] = "Cancel"
+ },
+ ["RETRYCANCEL"] = {
+ [1] = "Retry",
+ [2] = "Cancel"
+ },
+ ["YESNO"] = {
+ [1] = "Yes",
+ [2] = "No"
+ },
+ ["YESNOCANCEL"] = {
+ [1] = "Yes",
+ [2] = "No",
+ [3] = "Cancel"
+ }
+}
+
+messageSounds = {
+ ["INFO"] = {
+ soundID = 20,
+ soundName = "Information",
+ },
+ ["QUESTION"] = {
+ soundID = 10,
+ soundName = "Question",
+ },
+ ["WARNING"] = {
+ soundID = 17,
+ soundName = "Warning",
+ },
+ ["ERROR"] = {
+ soundID = 4,
+ soundName = "Error",
+ },
+}
+
+messageIcons = {
+ ["INFO"] = {
+ iconCaption = "Information",
+ iconSound = "INFO",
+ iconPath = "files/info.png"
+ },
+ ["QUESTION"] = {
+ iconCaption = "Question",
+ iconSound = "QUESTION",
+ iconPath = "files/question.png"
+ },
+ ["WARNING"] = {
+ iconCaption = "Warning",
+ iconSound = "WARNING",
+ iconPath = "files/warning.png"
+ },
+ ["ERROR"] = {
+ iconCaption = "Error",
+ iconSound = "ERROR",
+ iconPath = "files/error.png"
+ }
+}
\ No newline at end of file
diff --git a/[gameplay]/webbrowser/WebBrowserGUI.lua b/[gameplay]/webbrowser/WebBrowserGUI.lua
index 6e82888a3..92e879f5b 100644
--- a/[gameplay]/webbrowser/WebBrowserGUI.lua
+++ b/[gameplay]/webbrowser/WebBrowserGUI.lua
@@ -107,7 +107,7 @@ end
function WebBrowserGUI:DevButton_Click(button, state)
if button == "left" and state == "up" then
if not getDevelopmentMode() then
- exports.msgbox:guiShowMessageBox("You have to enable the development using setDevelopmentMode", "error", "Development mode required", false)
+ exports.dialogs:messageBox("Development mode required", "You have to enable the development mode using setDevelopmentMode()", false, "ERROR", "OK")
return
end
diff --git a/[gameplay]/webbrowser/meta.xml b/[gameplay]/webbrowser/meta.xml
index a18dd2bc6..9909af87d 100644
--- a/[gameplay]/webbrowser/meta.xml
+++ b/[gameplay]/webbrowser/meta.xml
@@ -2,7 +2,7 @@
true
-
+