mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
protocol via script
This commit is contained in:
@@ -1,11 +1,34 @@
|
||||
function autoDestroyParent()
|
||||
self.parent:destroy()
|
||||
MessageBox = {}
|
||||
MessageBox.__index = MessageBox
|
||||
|
||||
function MessageBox.create(title, text)
|
||||
local msgBox = {}
|
||||
setmetatable(msgBox, MessageBox)
|
||||
|
||||
local window = UI.load("messagebox.yml")
|
||||
window.locked = true
|
||||
window.title = title
|
||||
window:child("textLabel").text = text
|
||||
window:child("okButton").onClick = function()
|
||||
self.parent:destroy()
|
||||
end
|
||||
window.onDestroy = function()
|
||||
if msgBox.onDestroy then
|
||||
msgBox.onDestroy()
|
||||
end
|
||||
end
|
||||
|
||||
msgBox.window = window
|
||||
return msgBox
|
||||
end
|
||||
|
||||
function MessageBox:destroy()
|
||||
if self.window then
|
||||
self.window:destroy()
|
||||
self.window = nil
|
||||
end
|
||||
end
|
||||
|
||||
function messageBox(title, text)
|
||||
local msgBox = UI.load("messagebox.yml")
|
||||
msgBox.locked = true
|
||||
msgBox.title = title
|
||||
msgBox:child("textLabel").text = text
|
||||
msgBox:child("okButton").onClick = autoDestroyParent
|
||||
return MessageBox.create(title, text)
|
||||
end
|
||||
|
Reference in New Issue
Block a user