Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. include( "contenticon.lua" )
  2. include( "postprocessicon.lua" )
  3.  
  4. include( "contentcontainer.lua" )
  5. include( "contentsidebar.lua" )
  6.  
  7. include( "contenttypes/custom.lua" )
  8. include( "contenttypes/npcs.lua" )
  9. include( "contenttypes/weapons.lua" )
  10. include( "contenttypes/entities.lua" )
  11. -- include( "contenttypes/postprocess.lua" )
  12. include( "contenttypes/vehicles.lua" )
  13. -- include( "contenttypes/saves.lua" )
  14. -- include( "contenttypes/dupes.lua" )
  15.  
  16. include( "contenttypes/gameprops.lua" )
  17. include( "contenttypes/addonprops.lua" )
  18.  
  19. local PANEL = {}
  20.  
  21. AccessorFunc( PANEL, "m_pSelectedPanel", "SelectedPanel" )
  22.  
  23. function PANEL:Init()
  24.  
  25. self:SetPaintBackground( false )
  26.  
  27. self.CategoryTable = {}
  28.  
  29. self.HorizontalDivider = vgui.Create( "DHorizontalDivider", self )
  30. self.HorizontalDivider:Dock( FILL )
  31. self.HorizontalDivider:SetLeftWidth( 192 )
  32. self.HorizontalDivider:SetLeftMin( 192 )
  33. self.HorizontalDivider:SetRightMin( 400 )
  34. self.HorizontalDivider:SetDividerWidth( 6 )
  35. --self.HorizontalDivider:SetCookieName( "SpawnMenuCreationMenuDiv" )
  36.  
  37. self.ContentNavBar = vgui.Create( "ContentSidebar", self.HorizontalDivider )
  38. self.HorizontalDivider:SetLeft( self.ContentNavBar )
  39.  
  40. end
  41.  
  42. function PANEL:EnableModify()
  43. self.ContentNavBar:EnableModify()
  44. end
  45.  
  46. function PANEL:EnableSearch( ... )
  47. self.ContentNavBar:EnableSearch( ... )
  48. end
  49.  
  50. function PANEL:CallPopulateHook( HookName )
  51.  
  52. hook.Call( HookName, GAMEMODE, self, self.ContentNavBar.Tree, self.OldSpawnlists )
  53.  
  54. end
  55.  
  56. function PANEL:SwitchPanel( panel )
  57.  
  58. if ( IsValid( self.SelectedPanel ) ) then
  59. self.SelectedPanel:SetVisible( false )
  60. self.SelectedPanel = nil
  61. end
  62.  
  63. self.SelectedPanel = panel
  64.  
  65. self.HorizontalDivider:SetRight( self.SelectedPanel )
  66. self.HorizontalDivider:InvalidateLayout( true )
  67.  
  68. self.SelectedPanel:SetVisible( true )
  69. self:InvalidateParent()
  70.  
  71. end
  72.  
  73. vgui.Register( "SpawnmenuContentPanel", PANEL, "DPanel" )
  74.  
  75. local function CreateContentPanel()
  76.  
  77. local ctrl = vgui.Create( "SpawnmenuContentPanel" )
  78.  
  79. ctrl.OldSpawnlists = ctrl.ContentNavBar.Tree:AddNode( "#spawnmenu.category.browse", "icon16/cog.png" )
  80.  
  81. ctrl:EnableModify()
  82. hook.Call( "PopulatePropMenu", GAMEMODE )
  83. ctrl:CallPopulateHook( "PopulateContent" )
  84.  
  85. ctrl.OldSpawnlists:MoveToFront()
  86. ctrl.OldSpawnlists:SetExpanded( true )
  87.  
  88. return ctrl
  89.  
  90. end
  91.  
  92. spawnmenu.AddCreationTab( "#spawnmenu.content_tab", CreateContentPanel, "icon16/application_view_tile.png", -10 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement