Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createnotif(text, textcolor, engtext)
- local msg = basewarslang[text]
- local color = 0
- if textcolor == 1 then
- color = Color(192, 57, 43, 180)
- elseif textcolor == 2 then
- color = Color(46, 204, 113,255)
- elseif textcolor == 3 then
- color = Color(52, 152, 219, 180)
- elseif textcolor == 4 then
- color = Color(70, 70, 70, 255)
- elseif textcolor == 5 then
- color = Color(236, 240, 241,255)
- elseif textcolor ~= 6 then
- color = Color(192, 57, 43, 180)
- end
- if not msg then
- msg = text
- end
- if engtext and not basewarslang[text] then
- if countrylist[system.GetCountry()] then
- msg = text
- else
- msg = engtext
- end
- end
- local notif = vgui.Create("DFrame")
- notif:SetSize(32 + (string.len(msg) * 9), 50) -- 38 + 20
- notif:SetPos(20,20 + (dermajump * #notiflist) + 50)
- notif:SetTitle("")
- notif:ShowCloseButton( false )
- function notif:Paint(w,h)
- if textcolor == 6 then
- draw.RoundedBox(16,0,0,w,h, HSVToColor( (engine.TickCount() * 0.75 )% 360, 1, 1 ))
- else
- draw.RoundedBox(16,0,0,w,h, color)
- end
- draw.RoundedBox(16,2,2, w - 4, h - 4, basewarslangcolor["black"])
- draw.SimpleText(msg, "BW_NotifFont", w/2, h/2, white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- notif:SetAlpha(0)
- notif:MoveTo(20,20 + dermajump * #notiflist - 1,1,0, -1, function()
- surface.PlaySound("")
- end)
- notif:AlphaTo(255,1,0)
- function notif:OnRemove() -- for animations when there are several panels
- table.RemoveByValue(notiflist, self)
- for k,v in pairs(notiflist) do
- v:MoveTo(20,20 + dermajump * (k - 1),0.5)
- end
- self:Close()
- end
- function notif:RemoveMe()
- table.RemoveByValue(notiflist, self)
- for k,v in pairs(notiflist) do
- v:MoveTo(20,20 + dermajump * (k - 1),0.5)
- end
- self:MoveTo(-50,20 + #notiflist,0.5)
- self:AlphaTo(0,0.5,0,function()
- self:Close()
- end)
- end
- table.insert(notiflist, notif)
- timer.Simple(6, function() notif:RemoveMe() end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement