Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Property.Categories = {}
- local function GenerateCategory(name)
- for k, v in pairs(Property.Categories) do
- if v.Title == name then return v end
- end
- local AriviaCategory = vgui.Create("AriviaCategory", Property.Scroll)
- AriviaCategory:Dock(TOP)
- AriviaCategory:DockMargin(0, 5, 0, 0)
- AriviaCategory:HeaderTitle(name)
- table.insert(Property.Categories, AriviaCategory)
- AriviaCategory.List = vgui.Create("DIconLayout", AriviaCategory)
- AriviaCategory.List:SetLayoutDir(TOP)
- AriviaCategory.List:Dock(LEFT)
- AriviaCategory.List:DockMargin( 6, 5, 0, 0 )
- AriviaCategory.List:SetSize(Property:GetParent():GetWide() - Property:GetParent():GetWide() / 3 + 9, 65)
- AriviaCategory.List.Paint = function(panel, w, h) end
- AriviaCategory.List:SetSpaceY(5)
- AriviaCategory.List:SetSpaceX(5)
- return AriviaCategory
- end
- for i = 0, 0 do
- for k, v in ipairs(RPExtraTeams) do
- if v.name == team.GetName(Arivia.Panel.CurJob) then continue end
- if !Arivia.TabJobs.showUnavailableJobs and !AriviaAllowJobSelection(v) then continue end
- if !Property.Value then
- Property.Value = v
- end
- if v.category then
- AriviaCategory = GenerateCategory( v.category )
- else
- AriviaCategory = GenerateCategory( Arivia.Language.CategoryOther )
- end
- local ListItem = vgui.Create("DButton")
- ListItem:SetSize((Property:GetParent():GetWide() / 3) - 4, 60)
- ListItem:SetText("")
- ListItem.oldpaint = ListItem.Paint
- ListItem.DoClick = function()
- Property.Value = v
- Property.Value.Key = 1
- if istable(Property.Value.model) then
- Property.PanelPreview.ModelObject:SetModel(Property.Value.model[Property.Value.Key])
- else
- Property.PanelPreview.ModelObject:SetModel(Property.Value.model)
- end
- Property.PanelPreview.ModelObject:InvalidateLayout()
- Property.PanelPreview.ButtonAction:InvalidateLayout()
- Property.PanelPreview.Skins = istable(Property.Value.model) and table.Count(Property.Value.model) or 0
- end
- function ListItem:Paint( w, h )
- local jobUnavailable = false
- local color = Arivia.TabJobs.buttonColor
- local txtColor = textNormal
- if ListItem:IsHovered() or ListItem:IsDown() then
- color = Arivia.TabJobs.buttonHoverColor
- txtColor = textHover
- end
- local objectName = v.name
- if Arivia.TruncateEnabled then
- local maxW = Arivia.TruncateLength or 170
- surface.SetFont("AriviaFontObjectListName")
- local fw,fh = surface.GetTextSize(objectName)
- if fw > maxW then
- objectName = string.sub(objectName, 1, objectName:len()-3).."..."
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement