Divergent/mods/FDDA/gamedata/scripts/ea_error.script

49 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
class "EA_window" (CUIScriptWnd)
local gt = game.translate_string
ea_error_text = gt("st_EA_game_ver_error_1").." "..GAME_VERSION.." "..gt("st_EA_game_ver_error_2")
ea_button_ok_text = gt("st_EA_game_ver_error_button_ok")
ea_button_cancel_text = gt("st_EA_game_ver_error_button_cancel")
function EA_window:__init() super()
self:InitControls()
self:InitCallBacks()
end
function EA_window:__finalize()
end
function EA_window:InitControls()
self:SetWndPos (vector2():set(342,199))
self:SetWndSize (vector2():set(339,369))
local xml = CScriptXmlInit()
xml:ParseFile("EA_window.xml")
self.Static1 = xml:InitStatic("Static1", self)
self.Static1:TextControl():SetText(ea_error_text)
self.btn_enter = xml:Init3tButton("btn_enter", self)
self:Register(self.btn_enter, "btn_enter")
self.btn_cancel = xml:Init3tButton("btn_cancel", self)
self:Register(self.btn_cancel, "btn_cancel")
self.btn_enter:TextControl():SetText(ea_button_ok_text)
self.btn_cancel:TextControl():SetText(ea_button_cancel_text)
end
function EA_window:InitCallBacks()
-- new game
self:AddCallback("btn_enter", ui_events.BUTTON_CLICKED, self.OnButton_OK_clicked, self)
self:AddCallback("btn_cancel", ui_events.BUTTON_CLICKED, self.OnButton_CANCEL_clicked, self)
end
function EA_window:OnButton_CANCEL_clicked()
ea_callbacks.EA_SendScriptCallback("ea_error_ONcancel")
self:HideDialog()
end
function EA_window:OnButton_OK_clicked()
ea_callbacks.EA_SendScriptCallback("ea_error_ONOk")
self:HideDialog()
end