Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- surface.CreateFont( "ServerIntroButtonFont", {
- font = "Bebas Neue",
- size = 40,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true
- } )
- surface.CreateFont( "ServerIntroTitleFont", {
- font = "Bebas Neue",
- size = 80,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true
- } )
- net.Receive("ServerIntroMenuStart", function()
- local blur = Material("pp/blurscreen")
- local function DrawBlur(panel, amount)
- local x, y = panel:LocalToScreen(0, 0)
- local scrW, scrH = ScrW(), ScrH()
- surface.SetDrawColor(255, 255, 255)
- surface.SetMaterial(blur)
- for i = 1, 3 do
- blur:SetFloat("$blur", (i / 3) * (amount or 6))
- blur:Recompute()
- render.UpdateScreenEffectTexture()
- surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)
- end
- end
- local ServerIntroMenu = vgui.Create("DFrame")
- ServerIntroMenu:SetSize(900, 450)
- ServerIntroMenu:Center()
- ServerIntroMenu:SetTitle("")
- ServerIntroMenu:MakePopup()
- ServerIntroMenu:ShowCloseButton(false)
- ServerIntroMenu.Paint = function(self, w, h)
- if SERVER_INTRO_CONFIG.BlurredBackground then
- DrawBlur(ServerIntroMenu, 3)
- end
- end
- local ServerIntroTitle = vgui.Create("DLabel", ServerIntroMenu)
- ServerIntroTitle:SetSize(ServerIntroMenu:GetWide(), 80)
- ServerIntroTitle:SetContentAlignment(5)
- ServerIntroTitle:SetTextColor(SERVER_INTRO_CONFIG.TitleColor)
- ServerIntroTitle:SetText(SERVER_INTRO_CONFIG.Title)
- ServerIntroTitle:SetFont("ServerIntroTitleFont")
- local ServerIntroPanel = vgui.Create("DPanel", ServerIntroMenu)
- ServerIntroPanel:SetSize(400, 350)
- ServerIntroPanel:SetPos(ServerIntroMenu:GetWide() / 2 - ServerIntroPanel:GetWide() / 2, ServerIntroMenu:GetTall() - ServerIntroPanel:GetTall() + 8)
- ServerIntroPanel.Paint = function(self, w, h)
- DrawBlur(ServerIntroPanel, 5)
- end
- local SpawnButton = vgui.Create("DButton", ServerIntroPanel)
- SpawnButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
- SpawnButton:SetPos(0, 0)
- SpawnButton:SetFont("ServerIntroButtonFont")
- SpawnButton:SetText(SERVER_INTRO_CONFIG.SpawnButtonText)
- SpawnButton:SetTextColor(Color(255, 255, 255))
- SpawnButton.Paint = function(self, w, h)
- if self:IsHovered() then
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
- --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 200) )
- else
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
- --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 180) )
- end
- end
- SpawnButton.DoClick = function()
- ServerIntroMenu:Remove()
- net.Start("ServerIntroMenuSpawn")
- net.SendToServer()
- end
- SpawnButton.OnCursorEntered = function()
- surface.PlaySound("buttons/lightswitch2.wav")
- end
- local DonateButton = vgui.Create("DButton", ServerIntroPanel)
- DonateButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
- DonateButton:SetPos(0, ServerIntroPanel:GetTall() / 4)
- DonateButton:SetFont("ServerIntroButtonFont")
- DonateButton:SetText(SERVER_INTRO_CONFIG.DonateButtonText)
- DonateButton:SetTextColor(Color(255, 255, 255))
- DonateButton.Paint = function(self, w, h)
- if self:IsHovered() then
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
- --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 200) )
- else
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
- --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 180) )
- end
- end
- DonateButton.DoClick = function()
- gui.OpenURL(SERVER_INTRO_CONFIG.DonateLink)
- end
- DonateButton.OnCursorEntered = function()
- surface.PlaySound("buttons/lightswitch2.wav")
- end
- local HomepageButton = vgui.Create("DButton", ServerIntroPanel)
- HomepageButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
- HomepageButton:SetPos(0, ServerIntroPanel:GetTall() / 4 * 2 - 1)
- HomepageButton:SetFont("ServerIntroButtonFont")
- HomepageButton:SetText(SERVER_INTRO_CONFIG.HomepageButtonText)
- HomepageButton:SetTextColor(Color(255, 255, 255))
- HomepageButton.Paint = function(self, w, h)
- if self:IsHovered() then
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
- --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 200) )
- else
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
- --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 180) )
- end
- end
- HomepageButton.DoClick = function()
- gui.OpenURL(SERVER_INTRO_CONFIG.HomepageLink)
- end
- HomepageButton.OnCursorEntered = function()
- surface.PlaySound("buttons/lightswitch2.wav")
- end
- local DisconnectButton = vgui.Create("DButton", ServerIntroPanel)
- DisconnectButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
- DisconnectButton:SetPos(0, ServerIntroPanel:GetTall() / 4 * 3 - 1)
- DisconnectButton:SetFont("ServerIntroButtonFont")
- DisconnectButton:SetText(SERVER_INTRO_CONFIG.DisconnectButtonText)
- DisconnectButton:SetTextColor(Color(255, 255, 255))
- DisconnectButton.Paint = function(self, w, h)
- if self:IsHovered() then
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
- draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 0, 0, 200) )
- else
- draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
- draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 0, 0, 180) )
- end
- end
- DisconnectButton.DoClick = function()
- LocalPlayer():ConCommand("disconnect")
- end
- DisconnectButton.OnCursorEntered = function()
- surface.PlaySound("buttons/lightswitch2.wav")
- end
- end)
- net.Receive("ServerIntroCamUpdate", function()
- local DataRead = net.ReadTable()
- local ply = LocalPlayer()
- ply.Cam = DataRead.Cam
- ply.Spawned = DataRead.Spawned
- end)
- hook.Add( "CalcView", "MyCalcView", function()
- local ply = LocalPlayer()
- if !ply.Spawned then
- local view = {}
- view.origin = SERVER_INTRO_CONFIG.Cam[game.GetMap()][ply.Cam or 1].pos
- view.angles = SERVER_INTRO_CONFIG.Cam[game.GetMap()][ply.Cam or 1].angle
- view.fov = SERVER_INTRO_CONFIG.Cam[game.GetMap()][ply.Cam or 1].fov
- view.drawviewer = true
- return view
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement