Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local y = 0
- function Auth.render()
- dxDrawImage(0, 0, sx, sy, Auth.textures["background"])
- local fft = getSoundFFTData(Auth.music, 2048, 256)
- if fft[0] then fft = math.sqrt(fft[0]) end
- fft = (math.max(0, math.min(fft, 1)) * 135)
- if Auth.inAnimation then
- dxDrawImage(sx / 2 - 187 / zoom, sy / 2 - 385 / zoom, 375 / zoom, 375 / zoom, Auth.textures["bass2"], 0, 0, 0, tocolor(245, 34, 87, fft))
- dxDrawImage(sx / 2 - 154 / zoom, sy / 2 - 385 / zoom, 309 / zoom, 354 / zoom, Auth.textures["logo"])
- end
- dxDrawImage(0, 0 + y, sx, sy, Auth.textures["background"], 0, 0, 0)
- local fft2 = getSoundFFTData(Auth.music, 2048, 256)
- if fft2 then
- for i = 0, 255 do
- if tonumber(math.sqrt(fft2[i])) then
- dxDrawRectangle(i*15/zoom, sy, 10 / zoom, -(math.sqrt(fft2[i]) * 256), tocolor(0, 0, 0, 25))
- end
- end
- end
- for k, v in pairs(Auth.ui) do
- if Auth.inAnimation then
- if not v.initPos then
- v.initPos = v.y
- v.postgui = true
- end
- v.y = v.initPos + y
- end
- end
- dxDrawImage(0, 0, sx, sy, Auth.textures["bass"], 0, 0, 0, tocolor(255, 255, 255, fft))
- -- dxDrawImage(sx / 2 - 154 / zoom - fft / 2, sy / 2 - 385 / zoom - fft / 2, 309 / zoom + fft, 354 / zoom + fft, Auth.textures["logo"])
- dxDrawImage(sx / 2 - 187 / zoom, sy / 2 - 385 / zoom + y, 375 / zoom, 375 / zoom, Auth.textures["bass2"], 0, 0, 0, tocolor(245, 34, 87, fft))
- dxDrawImage(sx / 2 - 154 / zoom, sy / 2 - 385 / zoom + y, 309 / zoom, 354 / zoom, Auth.textures["logo"], 0, 0, 0)
- dxDrawText("♫ Aktualnie: Dua Lipa - Don't Start Now", 0, 0, sx, sy, white, 1, Auth.roboto_big, "left", "bottom")
- if Auth.page == 1 then
- dxDrawText("Nie posiadasz konta?", 0, 35 / zoom + y, sx - 310 / zoom, 90 / zoom + y, white, 1, Auth.roboto, "right", "center")
- elseif Auth.page == 2 then
- dxDrawText("Posiadasz już konto?", 0, 35 / zoom + y, sx - 310 / zoom, 90 / zoom + y, white, 1, Auth.roboto, "right", "center")
- end
- end
- function Auth.initGUI()
- for k, v in pairs(Auth.ui) do
- v:destroy()
- end
- if Auth.page == 1 then
- Auth.ui.sign_up = GUI.createButton({x = sx - 300 / zoom, y = 35 / zoom, width = 197 / zoom, height = 55 / zoom, text = "Zarejestruj się", color = {30, 30, 30, 140}})
- Auth.ui.user_edit = GUI.createEdit({x = sx / 2 - 259 / zoom, y = sy / 2 - 50 / zoom, width = 518 / zoom, height = 50 / zoom, placeholder = "Wpisz login..", textOffset = {10 / zoom, 0}, icon = {Auth.textures["user"], 25 / zoom, 25 / zoom, -35 / zoom, 18 / zoom}})
- Auth.ui.pass_edit = GUI.createEdit({x = sx / 2 - 259 / zoom, y = sy / 2 + 15 / zoom, width = 518 / zoom, height = 50 / zoom, placeholder = "Wpisz hasło..", textOffset = {10 / zoom, 0}, icon = {Auth.textures["pass"], 25 / zoom, 25 / zoom, -35 / zoom, 18 / zoom}})
- Auth.ui.pass_edit.masking = true
- Auth.ui.login = GUI.createButton({x = sx / 2 + 62 / zoom, y = sy / 2 + 110 / zoom, width = 197 / zoom, height = 55 / zoom, text = "Zaloguj", color = {19, 161, 216}})
- Auth.ui.checkbox = GUI.createCheckbox({x = sx / 2 - 292 / zoom, y = sy / 2 + 125 / zoom, textColor = {215, 215, 215}, text = "Zapamiętaj mnie"})
- Auth.ui.login.click = function()
- local user = Auth.ui.user_edit:getText()
- local pass = Auth.ui.pass_edit:getText()
- triggerServerEvent("Authorization.checkCredentials", localPlayer, user, pass)
- end
- Auth.ui.sign_up.click = function()
- Auth.page = 2
- Auth.inAnimation = true
- animate(0, sy, "OutQuad", 2500, function(_) y = _ end, function() y = 0 Auth.initGUI() Auth.inAnimation = false end)
- end
- elseif Auth.page == 2 then
- Auth.ui.login = GUI.createButton({x = sx - 300 / zoom, y = 35 / zoom, width = 197 / zoom, height = 55 / zoom, text = "Zaloguj się", color = {30, 30, 30, 140}})
- Auth.ui.user_edit = GUI.createEdit({x = sx / 2 - 259 / zoom, y = sy / 2 - 50 / zoom, width = 518 / zoom, height = 50 / zoom, placeholder = "Wpisz login..", textOffset = {10 / zoom, 0}, icon = {Auth.textures["user"], 25 / zoom, 25 / zoom, -35 / zoom, 18 / zoom}})
- Auth.ui.pass_edit = GUI.createEdit({x = sx / 2 - 259 / zoom, y = sy / 2 + 15 / zoom, width = 518 / zoom, height = 50 / zoom, placeholder = "Wpisz hasło..", textOffset = {10 / zoom, 0}, icon = {Auth.textures["pass"], 25 / zoom, 25 / zoom, -35 / zoom, 18 / zoom}})
- Auth.ui.pass_edit.masking = true
- Auth.ui.email_edit = GUI.createEdit({x = sx / 2 - 259 / zoom, y = sy / 2 + 80 / zoom, width = 518 / zoom, height = 50 / zoom, placeholder = "Wpisz e-mail..", textOffset = {10 / zoom, 0}, icon = {Auth.textures["mail"], 25 / zoom, 25 / zoom, -35 / zoom, 18 / zoom}})
- Auth.ui.register = GUI.createButton({x = sx / 2 + 62 / zoom, y = sy / 2 + 175 / zoom, width = 197 / zoom, height = 55 / zoom, text = "Zarejestruj", color = {19, 161, 216}})
- Auth.ui.register.click = function()
- local user = Auth.ui.user_edit:getText()
- local pass = Auth.ui.pass_edit:getText()
- local email = Auth.ui.email_edit:getText()
- triggerServerEvent("Authorization.createAccount", localPlayer, user, pass, email)
- end
- Auth.ui.login.click = function()
- Auth.page = 1
- Auth.inAnimation = true
- animate(0, -sy, "OutQuad", 2500, function(_) y = _ end, function() y = 0 Auth.initGUI() Auth.inAnimation = false end)
- end
- end
- for k, v in pairs(Auth.ui) do
- v:setAlpha(0)
- end
- animate(0, 255, "Linear", 500, function(alpha)
- for k, v in pairs(Auth.ui) do
- v:setAlpha(alpha)
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement