Guest User

prop_spawn

a guest
Jul 25th, 2015
9
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ply = LocalPlayer()
  2. local PANEL = { }
  3. function PANEL:Init( )
  4.     self.Label = vgui.Create( "DLabel", self )
  5.     self.Label:SetText( "GoFish" )
  6.     self.Label:SetTextColor( Color( 255, 255, 255, 255 ) )
  7.     self.Label:SizeToContents( )
  8.    
  9.     self.ListList = vgui.Create( "DPanelList", self )
  10.    
  11.     self.IconList = {}
  12.     self.IconListCollapse = {}
  13.     for k,v in pairs (BAITGROUPS) do
  14.     self.IconList[k] = vgui.Create( "DPanelList", self )
  15.     self.IconList[k]:EnableVerticalScrollbar( true )
  16.     self.IconList[k]:EnableHorizontal( true )
  17.     self.IconList[k]:SetPadding( 4 )
  18.     self.IconList[k]:SetVisible( true )
  19.    
  20.     self.IconListCollapse[k] = vgui.Create( "DCollapsibleCategory", self )
  21.     self.IconListCollapse[k]:SetSize( 610,20 )
  22.     self.IconListCollapse[k]:SetLabel( v )
  23.     self.IconListCollapse[k]:SetVisible( true )
  24.     self.IconListCollapse[k]:SetContents(self.IconList[k])
  25.     self.ListList:AddItem( self.IconListCollapse[k] )
  26.     end
  27.  
  28. for k,v in pairs( FISH ) do
  29.         ents.CreateClientProp("prop_physics") -- lol ailias filthy hack
  30.         local ico = vgui.Create( "DModelPanel", self )
  31.         ico:SetModel(k)
  32.         ico.Skin = math.random(0,util.GetModelInfo(k).SkinCount-1)
  33.         ico.Entity:SetSkin(ico.Skin)
  34.         ico.DoClick = function( ico )
  35.         RunConsoleCommand("ProcessCommand"..v.NAME)
  36.         surface.PlaySound( "ui/buttonclick.wav" )      
  37.         end
  38.     end
  39. end
  40.  
  41. function PANEL:PerformLayout( )
  42.     self:StretchToParent( 2, 24, 2, 2 )
  43.     self.Label:SetPos( 2, 2 )
  44.     self.ListList:StretchToParent( 4, 26, 4, 4 )
  45.     self.ListList:InvalidateLayout()
  46.     for k,v in pairs (self.IconList) do
  47.     --v:StretchToParent( 4, 26, 4, 4 )
  48.     v:SizeToContents( )
  49.     v:InvalidateLayout()
  50.     end
  51. end
  52.  
  53. function PANEL:OnVScroll( iOffset )
  54.     self.pnlCanvas:SetPos( 25, 25 + iOffset )
  55. end
  56.  
  57. function PANEL:OnMouseWheeled( dlta )
  58.     if ( self.VBar ) then
  59.         return self.VBar:OnMouseWheeled( dlta )
  60.     end
  61. end
  62.  
  63. vgui.Register( "gofish_menu", PANEL, "DPanel" )
RAW Paste Data