Skip to content

Instantly share code, notes, and snippets.

@kinnou02
Last active May 20, 2017 17:32
Show Gist options
  • Save kinnou02/0541542ac0cd00ef9ba7c2267fa614d6 to your computer and use it in GitHub Desktop.
Save kinnou02/0541542ac0cd00ef9ba7c2267fa614d6 to your computer and use it in GitHub Desktop.
-- Afficahge de la boit de dialogue d'invitation --
function Dialog:show(text, yesLabel, noLabel, target, yesCallback, noCallback)
if not self.dialog then
self:init()
end
local dialog = self.dialog
-- Rend visible la boite de dialogue --
dialog:SetVisible(true)
self.dialogText:SetText(text)
self.dialogButtonYes:SetText(yesLabel)
self.dialogButtonNo:SetText(noLabel)
-- Evenement en pressant le clic Gauche de la souris sur OUI --
self.dialogButtonYes:EventMacroSet(Event.UI.Button.Left.Press, "/i " .. target)
-- Evenement en pressant le clic Gauche de la souris sur NON --
self.dialogButtonNo:EventAttach(Event.UI.Button.Left.Press, function()
dialog:SetVisible(false)
noCallback()
end, "Event.UI.Button.Left.Press")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment