Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. local i = 0
  2. for _, cat in pairs(PS.Categories)do
  3. if inv then
  4. if not ShopGetCategoryOwnedCount( cat ) then continue end
  5. end
  6. if cat.AllowedUserGroups and #cat.AllowedUserGroups > 0 then
  7. if not table.HasValue(cat.AllowedUserGroups, LocalPlayer():PS_GetUsergroup()) then
  8. continue
  9. end
  10. end
  11. if cat.CanPlayerSee then
  12. if not cat:CanPlayerSee(LocalPlayer()) then
  13. continue
  14. end
  15. end
  16. local btn = vgui.Create( 'DButton', s.SideScroll)
  17. btn:SetPos( 0, i*49 )
  18. btn:SetSize( 250, 50 )
  19. btn:SetText("")
  20. btn.OnCursorEntered = function(ss) ss.s = true end
  21. btn.OnCursorExited = function(ss) ss.s = false end
  22. btn.Paint = function( ss, w, h )
  23. if _ == s.CurrentCat then
  24. draw.RoundedBox(0, 0, 0, w, h, Color(255, 102, 0, 50)) -- selected category color
  25. surface.SetDrawColor(0,0,0,70)
  26. surface.SetTexture(grad_dw)
  27. surface.DrawTexturedRect( 0, 0, w, h/5 )
  28. surface.SetDrawColor(0,0,0,70)
  29. surface.SetTexture(grad_up)
  30. surface.DrawTexturedRect( 0, h-h/5, w, h/5 )
  31. elseif ss.s then
  32. draw.RoundedBox(0, 0, 0, w, h, Color(255, 102, 0, 50)) -- hovered category color
  33. surface.SetDrawColor(0,0,0,30)
  34. surface.SetTexture(grad_dw)
  35. surface.DrawTexturedRect( 0, 0, w, h/5 )
  36. surface.SetDrawColor(0,0,0,30)
  37. surface.SetTexture(grad_up)
  38. surface.DrawTexturedRect( 0, h-h/5, w, h/5 )
  39. else
  40. draw.RoundedBox(0, 0, 0, w, h, Color(27, 29, 30)) -- Category button color
  41. end
  42. surface.SetDrawColor(66,78,79,100) -- Category icon color
  43. surface.SetMaterial(Material('icon16/'..cat.Icon..'.png'))
  44. surface.DrawTexturedRect( 5, h/2-8, 16, 16 )
  45. draw.SimpleText(string.upper(cat.Name), 'PS_CatName', 29, h/2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  46. draw.RoundedBox(0, 0, 0, w, 1, Color(27, 29, 30)) -- lines between left panel categories
  47. draw.RoundedBox(0, 0, h-1, w, 1, Color(27, 29, 30)) -- Left panel, bottom line under categories
  48. end
  49. btn.DoClick = function()
  50. s.CurrentCat = _
  51. ILYA:SetShopTab( s )
  52. end
  53. i = i + 1
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement