Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ply = LocalPlayer()
- local PANEL = { }
- function PANEL:Init( )
- self.Label = vgui.Create( "DLabel", self )
- self.Label:SetText( "GoFish" )
- self.Label:SetTextColor( Color( 255, 255, 255, 255 ) )
- self.Label:SizeToContents( )
- self.ListList = vgui.Create( "DPanelList", self )
- self.IconList = {}
- self.IconListCollapse = {}
- for k,v in pairs (BAITGROUPS) do
- self.IconList[k] = vgui.Create( "DPanelList", self )
- self.IconList[k]:EnableVerticalScrollbar( true )
- self.IconList[k]:EnableHorizontal( true )
- self.IconList[k]:SetPadding( 4 )
- self.IconList[k]:SetVisible( true )
- self.IconListCollapse[k] = vgui.Create( "DCollapsibleCategory", self )
- self.IconListCollapse[k]:SetSize( 610,20 )
- self.IconListCollapse[k]:SetLabel( v )
- self.IconListCollapse[k]:SetVisible( true )
- self.IconListCollapse[k]:SetContents(self.IconList[k])
- self.ListList:AddItem( self.IconListCollapse[k] )
- end
- for k,v in pairs( FISH ) do
- local ent = ents.Create("prop_physics") -- lol ailias filthy hack
- ent:SetAngles(Angle(0,0,0))
- ent:SetPos(Vector(0,0,0))
- ent:SetModel(k)
- ent:Spawn()
- ent:Activate()
- ent:PhysicsInit( SOLID_VPHYSICS )
- local ico = vgui.Create( "DModelPanel", self )
- ico:SetModel(k)
- ico.Skin = math.random(0,util.GetModelInfo(k).SkinCount-1)
- ico.Entity:SetSkin(ico.Skin)
- ico.DoClick = function( ico )
- RunConsoleCommand("ProcessCommand"..v.NAME)
- surface.PlaySound( "ui/buttonclick.wav" )
- end
- ico:SetSize(55,55)
- local center = ent:OBBCenter()
- local dist = ent:BoundingRadius()*v.VIEW
- ico:SetToolTip( Format( "%s", v.DESCRIPTION.." - Cost: $"..v.PRICE ) )
- ico:SetLookAt( center )
- ico:SetCamPos( center+Vector(dist,dist,dist) )
- ico:InvalidateLayout( true )
- if v.GROUP then
- self.IconList[v.GROUP]:AddItem( ico )
- end
- ent:Remove()
- end
- end
- function PANEL:PerformLayout( )
- self:StretchToParent( 2, 24, 2, 2 )
- self.Label:SetPos( 2, 2 )
- self.ListList:StretchToParent( 4, 26, 4, 4 )
- self.ListList:InvalidateLayout()
- for k,v in pairs (self.IconList) do
- --v:StretchToParent( 4, 26, 4, 4 )
- v:SizeToContents( )
- v:InvalidateLayout()
- end
- end
- function PANEL:OnVScroll( iOffset )
- self.pnlCanvas:SetPos( 25, 25 + iOffset )
- end
- function PANEL:OnMouseWheeled( dlta )
- if ( self.VBar ) then
- return self.VBar:OnMouseWheeled( dlta )
- end
- end
- vgui.Register( "gofish_menu", PANEL, "DPanel" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement