lotrointerface.com
Search Downloads

LoTROInterface SVN Reminders

[/] [trunk/] [Thurallor/] [Common/] [UI/] [FreezeWarning.lua] - Rev 2

Compare with Previous | Blame | View Log

FreezeWarning = class(Turbine.UI.Lotro.Window);

function FreezeWarning:Constructor(title, text, callback)
    self.callback = callback;

    self.background = Turbine.UI.Window();
    self.background:SetSize(Turbine.UI.Display:GetSize());
    self.background:SetBackColor(Turbine.UI.Color.Black);
    self.background:SetOpacity(0.5);
    self.background:SetZOrder(2^31 - 1);
    self.background:SetVisible(true);

    Turbine.UI.Lotro.Window.Constructor(self);
    self:SetVisible(true);
    self:SetText(title);
    self:SetZOrder(2^31 - 1);

    self.hourglass = Turbine.UI.Control();
    self.hourglass:SetParent(self);
    self.hourglass:SetBackground(0x41007E2F);
    self.hourglass:SetBlendMode(Turbine.UI.BlendMode.Overlay);
    self.hourglass:SetSize(32, 32);

    if (type(text) == "string") then
        self.text = Turbine.UI.Label();
        self.text:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
        self.text:SetFont(Turbine.UI.Lotro.Font.Verdana14);
        self.text:SetFontStyle(Turbine.UI.FontStyle.Outline);
        self.text:SetText(text);
        self.text:AutoSize();
    else
        self.text = text;
    end
    self.text:SetParent(self);
    local top = 50;
    local xMargin = 20;
    local width = math.max(300, self.text:GetWidth() + 2 * xMargin);
    self:SetWidth(width);
    self.text:SetWidth(width - 2 * xMargin);
    self.text:SetPosition(xMargin, top);
    top = top + self.text:GetHeight() + 20;
    self.hourglass:SetPosition(width / 2 - 16, top);
    self:SetHeight(top + 60);
    CenterWindow(self);
    
    self.skipFrames = 1;
    self:SetWantsUpdates(true);
end

function FreezeWarning:Update()
    if (self.skipFrames == 0) then
        self.callback();
        self:SetWantsUpdates(false);
        self.background:Close();
        self:Close();
    else
        self.skipFrames = self.skipFrames - 1;
    end
end

Thurallor = Thurallor or {};
Thurallor.UI = Thurallor.UI or {};
Thurallor.UI.FreezeWarning = FreezeWarning;

Compare with Previous | Blame


All times are GMT -5. The time now is 12:22 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui