Guest User

Modified to hopefully work

a guest
Jun 18th, 2018
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.21 KB | None | 0 0
  1. local MAIN = {}
  2. MAIN.TitleHeight = 64
  3.  
  4. function MAIN:Init()
  5.  
  6.     self:SetZPos(1)
  7.     self:MakePopup()
  8.     self:SetSize(300, 301)
  9.     self:Center()
  10.    
  11.     self.CloseButton = vgui.Create("TheaterButton", self)
  12.     self.CloseButton:SetPos(self:GetWide() - 28, 3)
  13.     self.CloseButton:SetSize(25, 25)
  14.     self.CloseButton:SetText("X")
  15.     self.CloseButton.DoClick = function()
  16.         self:Remove()
  17.         GAMEMODE:HideMouse()
  18.     end
  19.    
  20.     self.Title = Label("Player Menu", self)
  21.     self.Title:SetFont("ScoreboardTitle")
  22.     self.Title:SetColor(Color(93, 64, 55))
  23.    
  24.     self.Options = vgui.Create("DPanelList", self)
  25.     self.Options:DockMargin(4, self.TitleHeight + 5, 4, 5)
  26.     self.Options:SetDrawBackground(false)
  27.     self.Options:SetPadding(4)
  28.     self.Options:SetSpacing(4)
  29.    
  30.     local ShopButton = vgui.Create("TheaterButton")
  31.     ShopButton:SetFont("ScoreboardMapName")
  32.     ShopButton:SetText("Shop")
  33.     ShopButton.DoClick = function()
  34.         self:Remove()
  35.         vgui.Create("ShopSelectMenu")
  36.     end
  37.     self.Options:AddItem(ShopButton)
  38.    
  39.     local InventoryButton = vgui.Create("TheaterButton")
  40.     InventoryButton:SetFont("ScoreboardMapName")
  41.     InventoryButton:SetText("Inventory")
  42.     InventoryButton.DoClick = function()
  43.         self:Remove()
  44.         vgui.Create("InvSelectMenu")
  45.     end
  46.     self.Options:AddItem(InventoryButton)  
  47.    
  48.     local Achievements = vgui.Create("TheaterButton")
  49.     Achievements:SetFont("ScoreboardMapName")
  50.     Achievements:SetText("Achievements")
  51.     Achievements.DoClick = function()
  52.         self:Remove()
  53.         vgui.Create("AchievementsMenu")
  54.     end
  55.     self.Options:AddItem(Achievements) 
  56.    
  57.     local SettingsButton = vgui.Create("TheaterButton")
  58.     SettingsButton:SetFont("ScoreboardMapName")
  59.     SettingsButton:SetText("Settings")
  60.     SettingsButton.DoClick = function()
  61.         self:Remove()
  62.         vgui.Create("SettingsMenu")
  63.     end
  64.     self.Options:AddItem(SettingsButton)
  65.    
  66.     local YenTransferBtn = vgui.Create("TheaterButton")
  67.     YenTransferBtn:SetFont("ScoreboardMapName")
  68.     YenTransferBtn:SetText("Yen Transfer")
  69.     YenTransferBtn.DoClick = function()
  70.         self:Remove()
  71.         vgui.Create("YenTransferMenu")
  72.     end
  73.     self.Options:AddItem(YenTransferBtn)
  74.    
  75.     local PlayerStatsBtn = vgui.Create("TheaterButton")
  76.     PlayerStatsBtn:SetFont("ScoreboardMapName")
  77.     PlayerStatsBtn:SetText("Player Statistics")
  78.     PlayerStatsBtn.DoClick = function()
  79.         self:Remove()
  80.     local msg = {
  81.         theater.ColDefault,
  82.         "Your Current Statistics:\n",
  83.         "¥: ",
  84.         theater.ColHighlight,
  85.         tostring(LocalPlayer():GetNWInt("yen")),
  86.         theater.ColDefault,
  87.         "\nLevel: ",
  88.         theater.ColHighlight,
  89.         tostring(LocalPlayer():CalculateLevel(LocalPlayer():GetNWInt("exp"))),
  90.         theater.ColDefault,
  91.         "\nPlay-Time: ",
  92.         theater.ColHighlight,
  93.         string.FormatSeconds(math.Round(LocalPlayer():GetNWInt("totalPlayTime"))),
  94.         theater.ColDefault,
  95.         "\nNon-AFK-Play-Time: ",
  96.         theater.ColHighlight,
  97.         string.FormatSeconds(math.Round(LocalPlayer():GetNWInt("totalNonAFKPlayTime"))),
  98.         theater.ColDefault,
  99.         "\nAchievement Progress: ",
  100.         theater.ColHighlight,
  101.         math.Round((table.Count(LocalPlayer().achievements) / table.Count(ACHIEVEMENTS)) * 100) .. "%"
  102.     }
  103.     local line = ""
  104.     local color = nil
  105.     function parseColorLine( color)
  106.       local ret = {}
  107.       ret.line = value
  108.       if color ~= nil then
  109.         ret.color = color
  110.       end
  111.       chat.AddText(color, line)
  112.     end
  113.     for _, m in pairs(msg) do
  114.       if type(m) == "string" then
  115.         local splt = string.Split(tostring(m), "\n")
  116.         if #splt > 1 then
  117.           local start, stop = string.find(m, "\n")
  118.           if start ~= 1 then
  119.             line = line..splt[1]
  120.           end
  121.           parseColorLine(line, color)
  122.           for i, v in pairs(splt) do
  123.             if i == 1 and start ~= 1 then
  124.               continue
  125.             end
  126.             parseColorLine(v, color)
  127.           end
  128.           line = ""
  129.         else
  130.           line = line..m
  131.         end
  132.       elseif type(m) == "number" then
  133.         line = line..m
  134.       else
  135.         if (IsColor(m)) then
  136.           color = m
  137.         end
  138.       end
  139.     end
  140.     end
  141.     self.Options:AddItem(PlayerStatsBtn)
  142.    
  143.     local SysInfo = vgui.Create("TheaterButton")
  144.     SysInfo:SetFont("ScoreboardMapName")
  145.     SysInfo:SetText("System Information")
  146.     SysInfo.DoClick = function()
  147.         self:Remove()
  148.         vgui.Create("SysInfo")
  149.     end
  150.     self.Options:AddItem(SysInfo)
  151.    
  152. end
  153.  
  154. local Background = Material( "purin_banner.png" ) // theater/banner.png
  155. function MAIN:Paint(w, h)
  156.  
  157.     // Background
  158.     draw.BlurBackground(self, 8, 6)
  159.     surface.SetDrawColor(240, 244, 195)
  160.     surface.DrawOutlinedRect(0, 0, self:GetWide(), self:GetTall())
  161.  
  162.     // Title
  163.     surface.SetDrawColor(141, 38, 33, 255)
  164.     surface.DrawRect(0, 0, self:GetWide(), self.Title:GetTall())
  165.  
  166.     // Title Background
  167.     surface.SetDrawColor(255, 255, 255, 255)
  168.     surface.SetMaterial(Background)
  169.     surface.DrawTexturedRect(0, -1, 512, self.Title:GetTall() + 1)
  170.  
  171. end
  172.  
  173. function MAIN:PerformLayout()
  174.  
  175.     self.Title:SizeToContents()
  176.     self.Title:SetTall( self.TitleHeight )
  177.     self.Title:CenterHorizontal()
  178.  
  179.     self.Options:Dock( FILL )
  180.     self.Options:SizeToContents()
  181.  
  182. end
  183. vgui.Register("MainMenu", MAIN)
  184.  
  185. hook.Add("OpenPlayerMenu", "OpenF4Menu", function()
  186.     vgui.Create("MainMenu")
  187. end)
Advertisement
Add Comment
Please, Sign In to add comment