Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local i = 0
- for _, cat in pairs(PS.Categories)do
- if inv then
- if not ShopGetCategoryOwnedCount( cat ) then continue end
- end
- if cat.AllowedUserGroups and #cat.AllowedUserGroups > 0 then
- if not table.HasValue(cat.AllowedUserGroups, LocalPlayer():PS_GetUsergroup()) then
- continue
- end
- end
- if cat.CanPlayerSee then
- if not cat:CanPlayerSee(LocalPlayer()) then
- continue
- end
- end
- local btn = vgui.Create( 'DButton', s.SideScroll)
- btn:SetPos( 0, i*49 )
- btn:SetSize( 250, 50 )
- btn:SetText("")
- btn.OnCursorEntered = function(ss) ss.s = true end
- btn.OnCursorExited = function(ss) ss.s = false end
- btn.Paint = function( ss, w, h )
- if _ == s.CurrentCat then
- draw.RoundedBox(0, 0, 0, w, h, Color(255, 102, 0, 50)) -- selected category color
- surface.SetDrawColor(0,0,0,70)
- surface.SetTexture(grad_dw)
- surface.DrawTexturedRect( 0, 0, w, h/5 )
- surface.SetDrawColor(0,0,0,70)
- surface.SetTexture(grad_up)
- surface.DrawTexturedRect( 0, h-h/5, w, h/5 )
- elseif ss.s then
- draw.RoundedBox(0, 0, 0, w, h, Color(255, 102, 0, 50)) -- hovered category color
- surface.SetDrawColor(0,0,0,30)
- surface.SetTexture(grad_dw)
- surface.DrawTexturedRect( 0, 0, w, h/5 )
- surface.SetDrawColor(0,0,0,30)
- surface.SetTexture(grad_up)
- surface.DrawTexturedRect( 0, h-h/5, w, h/5 )
- else
- draw.RoundedBox(0, 0, 0, w, h, Color(27, 29, 30)) -- Category button color
- end
- surface.SetDrawColor(66,78,79,100) -- Category icon color
- surface.SetMaterial(Material('icon16/'..cat.Icon..'.png'))
- surface.DrawTexturedRect( 5, h/2-8, 16, 16 )
- draw.SimpleText(string.upper(cat.Name), 'PS_CatName', 29, h/2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
- draw.RoundedBox(0, 0, 0, w, 1, Color(27, 29, 30)) -- lines between left panel categories
- draw.RoundedBox(0, 0, h-1, w, 1, Color(27, 29, 30)) -- Left panel, bottom line under categories
- end
- btn.DoClick = function()
- s.CurrentCat = _
- ILYA:SetShopTab( s )
- end
- i = i + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement