diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
| commit | 2736f498f30220b858fc6fac23e7ddc4a597df6d (patch) | |
| tree | 374ceadedb654b00e09dac321620a8320830f734 /gamemode/vgui/vgui_shopmenu.lua | |
| download | redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2 redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip | |
Inital commit
Diffstat (limited to 'gamemode/vgui/vgui_shopmenu.lua')
| -rw-r--r-- | gamemode/vgui/vgui_shopmenu.lua | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gamemode/vgui/vgui_shopmenu.lua b/gamemode/vgui/vgui_shopmenu.lua new file mode 100644 index 0000000..99a201e --- /dev/null +++ b/gamemode/vgui/vgui_shopmenu.lua @@ -0,0 +1,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" ) |
