SHOW:
|
|
- or go back to the newest paste.
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) |
105 | + | function parseColorLine(value, color) |
106 | local ret = {} | |
107 | ret.line = value | |
108 | if color ~= nil then | |
109 | ret.color = color | |
110 | end | |
111 | print("SEND ME THIS STUFF VVV") | |
112 | - | PrintTable({color=color, line=line}) |
112 | + | PrintTable({color=color, line=value}) |
113 | - | chat.AddText(color, line) |
113 | + | chat.AddText(color, value) |
114 | end | |
115 | for _, m in pairs(msg) do | |
116 | if type(m) == "string" then | |
117 | local splt = string.Split(tostring(m), "\n") | |
118 | if #splt > 1 then | |
119 | local start, stop = string.find(m, "\n") | |
120 | if start ~= 1 then | |
121 | line = line..splt[1] | |
122 | end | |
123 | parseColorLine(line, color) | |
124 | for i, v in pairs(splt) do | |
125 | if i == 1 and start ~= 1 then | |
126 | continue | |
127 | end | |
128 | parseColorLine(v, color) | |
129 | end | |
130 | line = "" | |
131 | else | |
132 | line = line..m | |
133 | end | |
134 | elseif type(m) == "number" then | |
135 | line = line..m | |
136 | else | |
137 | if (IsColor(m)) then | |
138 | color = m | |
139 | end | |
140 | end | |
141 | end | |
142 | end | |
143 | self.Options:AddItem(PlayerStatsBtn) | |
144 | ||
145 | local SysInfo = vgui.Create("TheaterButton") | |
146 | SysInfo:SetFont("ScoreboardMapName") | |
147 | SysInfo:SetText("System Information") | |
148 | SysInfo.DoClick = function() | |
149 | self:Remove() | |
150 | vgui.Create("SysInfo") | |
151 | end | |
152 | self.Options:AddItem(SysInfo) | |
153 | ||
154 | end | |
155 | ||
156 | local Background = Material( "purin_banner.png" ) // theater/banner.png | |
157 | function MAIN:Paint(w, h) | |
158 | ||
159 | // Background | |
160 | draw.BlurBackground(self, 8, 6) | |
161 | surface.SetDrawColor(240, 244, 195) | |
162 | surface.DrawOutlinedRect(0, 0, self:GetWide(), self:GetTall()) | |
163 | ||
164 | // Title | |
165 | surface.SetDrawColor(141, 38, 33, 255) | |
166 | surface.DrawRect(0, 0, self:GetWide(), self.Title:GetTall()) | |
167 | ||
168 | // Title Background | |
169 | surface.SetDrawColor(255, 255, 255, 255) | |
170 | surface.SetMaterial(Background) | |
171 | surface.DrawTexturedRect(0, -1, 512, self.Title:GetTall() + 1) | |
172 | ||
173 | end | |
174 | ||
175 | function MAIN:PerformLayout() | |
176 | ||
177 | self.Title:SizeToContents() | |
178 | self.Title:SetTall( self.TitleHeight ) | |
179 | self.Title:CenterHorizontal() | |
180 | ||
181 | self.Options:Dock( FILL ) | |
182 | self.Options:SizeToContents() | |
183 | ||
184 | end | |
185 | vgui.Register("MainMenu", MAIN) | |
186 | ||
187 | hook.Add("OpenPlayerMenu", "OpenF4Menu", function() | |
188 | vgui.Create("MainMenu") | |
189 | end) |