1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
local PANEL = {}
function PANEL:Init()
//self:SetTitle( "" )
//self:ShowCloseButton( false )
//self:SetDraggable( false )
self.Items = {}
self.List = vgui.Create( "DListView", self )
local col1 = self.List:AddColumn( "Ordered Item" )
local col2 = self.List:AddColumn( "Cost" )
col1:SetMinWidth( 150 )
col2:SetMinWidth( 50 )
col2:SetMaxWidth( 100 )
self.Button = vgui.Create( "DImageButton", self )
self.Button:SetImage( "toxsin/airdrop" )
self.Button.OnMousePressed = function() self.List:Clear() self.Items = {} RunConsoleCommand( "ordershipment" ) RunConsoleCommand( "gm_showteam" ) end
end
function PANEL:AddItems( id, amt )
local tbl = item.GetByID( id )
if tbl.Price * amt > LocalPlayer():GetNWInt( "Cash", 0 ) then return end
for i=1,amt do
table.insert( self.Items, id )
end
self.List:Clear()
for k,v in pairs( self.Items ) do
local tbl = item.GetByID( v )
self.List:AddLine( tbl.Name, tbl.Price )
end
end
function PANEL:GetPadding()
return 5
end
function PANEL:PerformLayout()
local x,y = self:GetPadding(), self:GetPadding() + 30
self.List:SetSize( self:GetWide() * 0.5 - ( 2 * self:GetPadding() ), self:GetTall() - ( 2 * self:GetPadding() ) - 30 )
self.List:SetPos( x, y )
self.Button:SetSize( self:GetWide() * 0.5 - ( 2 * self:GetPadding() ), self:GetTall() - ( 2 * self:GetPadding() ) - 30 )
self.Button:SetPos( x + self.List:GetWide() + self:GetPadding(), self:GetPadding() + 30 )
self:SizeToContents()
end
function PANEL:Paint()
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide() - 2, self:GetTall() - 2, Color( 150, 150, 150, 150 ) )
draw.SimpleText( "Shipment Display", "ItemDisplayFont", self:GetWide() * 0.5, 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
end
derma.DefineControl( "ShopMenu", "A shop menu.", PANEL, "PanelBase" )
|