Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. include( "ContentIcon.lua" )
  2. include( "PostProcessIcon.lua" )
  3.  
  4. --include( "NPCSpawnIcon.lua" )
  5. --include( "WeaponSpawnIcon.lua" )
  6.  
  7. include( "ContentContainer.lua" )
  8. include( "ContentSidebar.lua" )
  9.  
  10. include( "ContentTypes/Custom.lua" )
  11. --include( 'ContentTypes/NPCs.lua' )
  12. --include( 'ContentTypes/Weapons.lua' )
  13. --include( 'ContentTypes/Entities.lua' )
  14. --include( 'ContentTypes/PostProcess.lua' )
  15. --include( 'ContentTypes/Vehicles.lua' )
  16. --include( 'ContentTypes/saves.lua' )
  17. --include( 'ContentTypes/dupes.lua' )
  18.  
  19. include( "ContentTypes/GameProps.lua" )
  20. include( "ContentTypes/AddonProps.lua" )
  21.  
  22. local PANEL = {}
  23.  
  24. AccessorFunc( PANEL, "m_pSelectedPanel", "SelectedPanel" )
  25.  
  26. --[[---------------------------------------------------------
  27. Name: Paint
  28. -----------------------------------------------------------]]
  29. function PANEL:Init()
  30.  
  31. self:SetPaintBackground( false )
  32.  
  33. self.CategoryTable = {}
  34.  
  35. self.ContentNavBar = vgui.Create( "ContentSidebar", self );
  36. self.ContentNavBar:Dock( LEFT );
  37. self.ContentNavBar:SetSize( 190, 10 );
  38. self.ContentNavBar:DockMargin( 0, 0, 4, 0 )
  39.  
  40.  
  41. self.HorizontalDivider = vgui.Create( "DHorizontalDivider", self );
  42. self.HorizontalDivider:Dock( FILL );
  43. self.HorizontalDivider:SetLeftWidth( 175 )
  44. self.HorizontalDivider:SetLeftMin( 175 )
  45. self.HorizontalDivider:SetRightMin( 450 )
  46.  
  47. self.HorizontalDivider:SetLeft( self.ContentNavBar );
  48.  
  49. end
  50.  
  51. function PANEL:EnableModify()
  52. self.ContentNavBar:EnableModify()
  53. end
  54.  
  55. function PANEL:CallPopulateHook( HookName )
  56.  
  57. hook.Call( HookName, GAMEMODE, self, self.ContentNavBar.Tree, self.OldSpawnlists )
  58.  
  59. end
  60.  
  61. function PANEL:SwitchPanel( panel )
  62.  
  63. if ( IsValid( self.SelectedPanel ) ) then
  64. self.SelectedPanel:SetVisible( false );
  65. self.SelectedPanel = nil;
  66. end
  67.  
  68. self.SelectedPanel = panel
  69.  
  70. self.SelectedPanel:Dock( FILL )
  71. self.SelectedPanel:SetVisible( true )
  72. self:InvalidateParent()
  73.  
  74. self.HorizontalDivider:SetRight( self.SelectedPanel );
  75.  
  76. end
  77.  
  78.  
  79. vgui.Register( "SpawnmenuContentPanel", PANEL, "DPanel" )
  80.  
  81.  
  82.  
  83. local function CreateContentPanel()
  84.  
  85. local ctrl = vgui.Create( "SpawnmenuContentPanel" )
  86.  
  87. ctrl.OldSpawnlists = ctrl.ContentNavBar.Tree:AddNode( "#spawnmenu.category.browse", "icon16/cog.png" )
  88.  
  89. ctrl:EnableModify()
  90. hook.Call( "PopulatePropMenu", GAMEMODE )
  91. ctrl:CallPopulateHook( "PopulateContent" );
  92.  
  93.  
  94. ctrl.OldSpawnlists:MoveToFront()
  95. ctrl.OldSpawnlists:SetExpanded( true )
  96.  
  97. return ctrl
  98.  
  99. end
  100.  
  101. spawnmenu.AddCreationTab( "#spawnmenu.content_tab", CreateContentPanel, "icon16/application_view_tile.png", -10 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement