Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local matClose = Material("shenesis/f4menu/close.png", "noclamp smooth")
- local matList = Material("shenesis/f4menu/list.png", "noclamp smooth")
- local font = LOUNGE_MOTD.Font
- local font_bold = LOUNGE_MOTD.FontBold
- --
- function L_QuickLabel(t, f, c, p)
- local l = vgui.Create("DLabel", p)
- l:SetText(t)
- l:SetFont(f)
- l:SetColor(c)
- l:SizeToContents()
- return l
- end
- // The MOTD
- function LOUNGE_MOTD:Show()
- if (IsValid(_LOUNGE_MOTD)) then
- _LOUNGE_MOTD:Remove()
- end
- local curpage
- local scale = math.Clamp(ScrH() / 1080, 0.6, 1)
- surface.CreateFont("MOTD_LOUNGE_Medium", {font = font, size = 16 * scale})
- surface.CreateFont("MOTD_LOUNGE_Large", {font = font, size = 20 * scale})
- surface.CreateFont("MOTD_LOUNGE_Larger", {font = font, size = 24 * scale})
- surface.CreateFont("MOTD_LOUNGE_MediumB", {font = font_bold, size = 16 * scale})
- surface.CreateFont("MOTD_LOUNGE_LargeB", {font = font_bold, size = 20 * scale})
- surface.CreateFont("MOTD_LOUNGE_LargerB", {font = font_bold, size = 24 * scale})
- surface.CreateFont("MOTD_LOUNGE_LargestB", {font = font_bold, size = 32 * scale})
- surface.CreateFont( "Font_UI", { font = "Circular Std Bold", size = 20, italic = false, shadow = false, } )
- local wi, he = 1500 * scale, 900 * scale
- local pnl = vgui.Create("EditablePanel")
- pnl:SetSize(wi, he)
- pnl:Center()
- pnl:MakePopup()
- pnl.Paint = function(me, w, h)
- draw.RoundedBox(4, 0, 0, w, h, self.Style.bg)
- end
- pnl.Close = function(me)
- if (me.m_bClosing) then
- return end
- me.m_bClosing = true
- me:AlphaTo(0, 0.1, 0, function()
- me:Remove()
- end)
- end
- _LOUNGE_MOTD = pnl
- local th = 48 * scale
- local m = th * 0.25
- local header = vgui.Create("DPanel", pnl)
- header:SetTall(th)
- header:Dock(TOP)
- header.Paint = function(me, w, h)
- draw.RoundedBoxEx(4, 0, 0, w, h, self.Style.header, true, true, false, false)
- end
- local titlelbl = L_QuickLabel(self.Language.motd, "MOTD_LOUNGE_Larger", self.Style.text, header)
- titlelbl:Dock(LEFT)
- titlelbl:DockMargin(m, 0, 0, 0)
- local close = vgui.Create("DButton", header)
- close:SetText("")
- close:SetWide(th)
- close:Dock(RIGHT)
- close.Paint = function(me, w, h)
- if (me.Hovered) then
- draw.RoundedBoxEx(4, 0, 0, w, h, self.Style.close_hover, false, true, false, false)
- end
- if (me:IsDown()) then
- draw.RoundedBoxEx(4, 0, 0, w, h, self.Style.hover, false, true, false, false)
- end
- surface.SetDrawColor(me:IsDown() and self.Style.text_down or self.Style.text)
- surface.SetMaterial(matClose)
- surface.DrawTexturedRectRotated(w * 0.5, h * 0.5, 16 * scale, 16 * scale, 0)
- end
- close.DoClick = function(me)
- pnl:Close()
- end
- local body = vgui.Create("DPanel", pnl)
- body:SetDrawBackground(false)
- body:Dock(FILL)
- local contents = vgui.Create("DHTML", body)
- contents:SetWide(wi - th)
- contents:DockPadding(m, m, m, m)
- contents:Dock(FILL)
- local toggled = cookie.GetNumber("LoungeMOTD_ToggleOff", 0) == 0
- local navbar = vgui.Create("DPanel", body)
- navbar:SetWide(toggled and th * 3 or th)
- navbar:Dock(LEFT)
- navbar:DockPadding(0, th, 0, 0)
- navbar.Paint = function(me, w, h)
- draw.RoundedBoxEx(4, 0, 0, w, h, self.Style.inbg, true, true, false, false)
- end
- local togglenavbar = vgui.Create("DButton", navbar)
- togglenavbar:SetText("")
- togglenavbar:SetToolTip(self.Language.toggle)
- togglenavbar:SetSize(th, th)
- togglenavbar.Paint = function(me, w, h)
- surface.SetDrawColor(self.Style.text)
- surface.SetMaterial(matList)
- surface.DrawTexturedRectRotated(w * 0.5, h * 0.5, 24 * scale, 24 * scale, 0)
- end
- togglenavbar.DoClick = function()
- toggled = !toggled
- cookie.Set("LoungeMOTD_ToggleOff", toggled and 0 or 1)
- navbar:Stop()
- navbar:SizeTo(toggled and th * 3 or th, -1, 0.1, 0, 0.2, function()
- end)
- end
- for _, page in ipairs (LOUNGE_MOTD.Pages) do
- if (page.display and !page.display()) then
- continue end
- local tx = self.Language[page.text] or page.text
- local btn = vgui.Create("DButton", navbar)
- btn:SetText("")
- btn:SetToolTip(tx)
- btn:SetTall(th)
- btn:Dock(TOP)
- btn.Paint = function(me, w, h)
- if (me.Hovered) then
- surface.SetDrawColor(self.Style.hover)
- surface.DrawRect(0, 0, w, h)
- end
- if (me:IsDown()) then
- surface.SetDrawColor(self.Style.hover)
- surface.DrawRect(0, 0, w, h)
- end
- surface.SetDrawColor(self.Style.text)
- surface.SetMaterial(page.icon)
- surface.DrawTexturedRectRotated(24 * scale, 24 * scale, 24 * scale, 24 * scale, 0)
- if (curpage == page.id) then
- surface.SetDrawColor(self.Style.header)
- surface.DrawRect(0, 0, th * 0.1, h)
- end
- end
- btn.DoClick = function()
- if (page.urloverlay) then
- gui.OpenURL(page.urloverlay)
- return
- else
- contents:OpenURL(page.url)
- end
- curpage = page.id
- end
- local lbl = L_QuickLabel(tx, "MOTD_LOUNGE_Medium", self.Style.text, btn)
- lbl:Dock(LEFT)
- lbl:DockMargin(th, 0, 0, 0)
- if (!curpage and page.url) then
- btn:DoClick()
- end
- end
- pnl:SetAlpha(0)
- pnl:AlphaTo(255, 0.1)
- end
- // The Mini Menu
- local function miniMenu()
- if IsValid(ba) then ba:Close() end
- gui.EnableScreenClicker(true)
- --[ Top of the frame ]--
- local ba = FutureRP.CreateDFrame( 500, 170, '', false, false, true )
- ba.Paint = function( obj, w, h )
- FutureRP.BlurMenu( obj, 13, 20, 200 )
- FutureRP.DrawRect( 0, 0, w, h , Color( 0,0,0,220 ) )
- FutureRP.DrawRoundedBox( 6, 0, 0, w, 30, Color( 72,8,159,220 ) )
- FutureRP.DrawText( 'Do you want to view the server rules?', 'Font_UI', 240, 5, Color( 255, 255, 255 ) )
- end
- function ba:Close()
- gui.EnableScreenClicker(false)
- self:Remove()
- end
- --[ The 'Yes' button ]--
- local YesButton = vgui.Create("DButton", ba)
- YesButton:SetSize( ba:GetWide() * 0.3, ba:GetTall() * 0.2 )
- YesButton:SetPos( ba:GetWide() * 0.02, ba:GetTall() * 0.35 )
- YesButton:SetText( "" )
- YesButton.Paint = function()
- draw.RoundedBox(0, 0, 0, YesButton:GetWide(), YesButton:GetTall(), Color(72,8,159,220));
- draw.SimpleText("Yes, view them.", "Font_UI", YesButton:GetWide() * 0.5, 5, color_white, TEXT_ALIGN_CENTER);
- end
- function YesButton:DoClick()
- surface.PlaySound("buttons/button14.wav")
- LOUNGE_MOTD:Show()
- ba:Close()
- end
- --[ The 'No' button ]--
- local NoButton = vgui.Create("DButton", ba)
- NoButton:SetSize( ba:GetWide() * 0.3, ba:GetTall() * 0.2 )
- NoButton:SetPos( ba:GetWide() * 0.68, ba:GetTall() * 0.35 )
- NoButton:SetText( "" )
- NoButton.Paint = function()
- draw.RoundedBox(0, 0, 0, NoButton:GetWide(), NoButton:GetTall(), Color(72,8,159,220));
- draw.SimpleText("No, I'm good.", "Font_UI", NoButton:GetWide() * 0.5, 5, color_white, TEXT_ALIGN_CENTER);
- end
- function NoButton:DoClick()
- surface.PlaySound("buttons/button14.wav")
- ba:Close()
- end
- end -- Need to add new stuff before this end.
- // Making the Mini Menu pop up on spawn
- hook.Add("InitPostEntity","MiniMOTDMenuShow",function()
- timer.Simple(10,function()
- miniMenu()
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement