Advertisement
Guest User

Liam <3

a guest
Apr 29th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.95 KB | None | 0 0
  1. local SKIN = {}
  2. SKIN.Name = "PS2FlatUI"
  3.  
  4. local function loadSkin( )
  5.  
  6. SKIN.Colours = table.Copy( derma.GetDefaultSkin( ).Colours )
  7.  
  8. SKIN.tex = table.Copy( derma.GetDefaultSkin( ).tex )
  9.  
  10. SKIN.tex.RadioButton_Checked = GWEN.CreateTextureNormal( 448, 64, 15, 15 )
  11. SKIN.tex.RadioButton = GWEN.CreateTextureNormal( 464, 64, 15, 15 )
  12.  
  13. SKIN.tex.RadioButtonD_Checked = GWEN.CreateTextureNormal( 448, 80, 15, 15 )
  14. SKIN.tex.RadioButtonD = GWEN.CreateTextureNormal( 464, 80, 15, 15 )
  15.  
  16. SKIN.HeaderBG = Color( 23, 23, 23 )
  17. SKIN.MainBG = Color( 102, 102, 102 )
  18. SKIN.InnerPanel = Color( 49, 49, 49 )
  19. SKIN.Footer = Color( 59, 59, 59 )
  20. SKIN.ButtonColor = Color( 65, 65, 65 )
  21. SKIN.BrightPanel = Color( 102, 102, 102 )
  22. SKIN.Highlight = Color( 255, 198, 0 )
  23. SKIN.NormalBtn = color_white
  24. SKIN.IconBackground = Color( 102, 102, 102 )
  25.  
  26. SKIN.Colours.Label = {}
  27. SKIN.Colours.Label.Default = Color( 180, 180, 180 )
  28. SKIN.Colours.Label.Dark = Color( 100, 100, 100 )
  29. SKIN.Colours.Label.Bright = color_white
  30. SKIN.Colours.Label.Highlight = SKIN.Highlight
  31.  
  32. SKIN.Colours.Button = {}
  33. SKIN.Colours.Button.Normal = color_white
  34. SKIN.Colours.Button.Hover = color_black
  35. SKIN.Colours.Button.Down = color_black
  36. SKIN.Colours.Button.Disabled = Color( 180, 180, 180 )
  37.  
  38.  
  39. SKIN.Colours.Tree.Normal = color_white
  40. SKIN.Colours.Tree.Hover = SKIN.Highlight
  41. SKIN.Colours.Tree.Selected = SKIN.Highlight
  42.  
  43. SKIN.Colours.Tab = {}
  44. SKIN.Colours.Tab.Normal = SKIN.Colours.Label.Default
  45. SKIN.Colours.Tab.Hover = SKIN.Highlight
  46. SKIN.Colours.Tab.Down = SKIN.Highlight
  47. SKIN.Colours.Tab.Disabled = Color( 180, 180, 180 )
  48.  
  49. --SKIN.Colours.Category = {}
  50. SKIN.Colours.Category.Header = SKIN.Highlight
  51. SKIN.Colours.Category.Header_Closed = SKIN.Colours.Label.Default
  52. --SKIN.Colours.Category.LineAlt = {}
  53. SKIN.Colours.Category.LineAlt.Text_Selected = SKIN.Highlight
  54. SKIN.Colours.Category.LineAlt.Text_Hover = SKIN.Highlight
  55. --SKIN.Colours.Category.Line = {}
  56. SKIN.Colours.Category.Line.Text = SKIN.Colours.Label.Default
  57. SKIN.Colours.Category.Line.Text_Selected = SKIN.Highlight
  58. SKIN.Colours.Category.Line.Text_Hover = SKIN.Highlight
  59.  
  60. SKIN.Colours.Tab.Active = {
  61. Normal = color_white,
  62. Hover = SKIN.Highlight,
  63. Down = SKIN.Highlight,
  64. Disabled = Color( 180, 180, 180 ),
  65. }
  66. SKIN.Colours.Tab.Inactive = SKIN.Colours.Tab
  67.  
  68.  
  69. surface.CreateFont( "PS2_LargeHeading", {
  70. font = "Segoe UI 8",
  71. size = 46,
  72. } )
  73.  
  74. surface.CreateFont( "PS2_MediumLarge", {
  75. font = "Segoe UI 8",
  76. size = 28,
  77. } )
  78.  
  79. surface.CreateFont( "PS2_SmallHeading", {
  80. font = "Segoe UI 8",
  81. size = 24,
  82. } )
  83.  
  84. surface.CreateFont( "PS2_Normal", {
  85. font = "Segoe UI Semilight 8",
  86. size = 20,
  87. } )
  88.  
  89. surface.CreateFont( "PS2_Text", {
  90. font = "Segoe UI Semilight 8",
  91. size = 14,
  92. } )
  93.  
  94. SKIN.fontName = "PS2_Normal"
  95. SKIN.BigTitleFont = "PS2_LargeHeading"
  96. SKIN.SmallTitleFont = "PS2_SmallHeading"
  97. SKIN.TabFont = "PS2_MediumLarge"
  98. SKIN.ButtonFont = "PS2_MediumLarge"
  99. SKIN.TextFont = "PS2_Text"
  100.  
  101. local old = SKIN.PaintComboBox
  102. function SKIN:PaintComboBox( panel, w, h )
  103. derma.GetDefaultSkin( ).PaintComboBox( self, panel, w, h )
  104. panel:SetColor( self.Colours.Label.Dark )
  105. end
  106.  
  107. function SKIN:LayoutCategoryPanelLevel0( panel )
  108. panel.title:SetVisible( false )
  109. panel.layout:DockMargin( 8, 8, 8, 8 )
  110. end
  111.  
  112. function SKIN:LayoutCategoryPanelLevel1( panel )
  113. panel.title:SetFont( self.BigTitleFont )
  114. panel.title:SizeToContents( )
  115. panel.title:SetColor( color_white )
  116. panel.title:DockMargin( 0, 0, 0, 5 )
  117. end
  118. function SKIN:PaintCategoryPanelLevel1( panel, w, h )
  119. end
  120.  
  121. function SKIN:LayoutCategoryPanelLevel2( panel )
  122. panel.title:SetFont( self.TabFont )
  123. panel.title:SetColor( color_white )
  124. panel.title:SizeToContents( )
  125. panel.title:DockMargin( 8, 5, 0, 0 )
  126. panel.layout:DockMargin( 10, 8, 0, 8 )
  127. end
  128. function SKIN:PaintCategoryPanelLevel2( panel, w, h )
  129. surface.SetDrawColor( self.ButtonColor )
  130. surface.DrawRect( 0, 0, w, h )
  131. end
  132.  
  133. function SKIN:LayoutCategoryPanelLevel3( panel )
  134. panel.title:SetFont( self.fontName )
  135. panel.title:SizeToContents( )
  136. panel.title:SetColor( color_white )
  137. panel.title:DockMargin( 5, 5, 0, 10 )
  138. end
  139. function SKIN:PaintCategoryPanelLevel3( panel, w, h )
  140. end
  141.  
  142. function SKIN:LayoutPointshopFrame( panel )
  143. function panel.contentsPanel:PerformLayout( )
  144. local ActiveTab = self:GetActiveTab()
  145. local Padding = self:GetPadding()
  146. if not ActiveTab then
  147. return
  148. end
  149.  
  150. ActiveTab:InvalidateLayout( true )
  151. local ActivePanel = ActiveTab:GetPanel()
  152.  
  153. for k, v in pairs( self.Items ) do
  154. if v.Tab:GetPanel( ) == ActivePanel then
  155. v.Tab:GetPanel( ):SetVisible( true )
  156. v.Tab:SetZPos( 100 )
  157. else
  158. v.Tab:GetPanel( ):SetVisible( false )
  159. v.Tab:SetZPos( 1 )
  160. end
  161.  
  162. v.Tab:ApplySchemeSettings( )
  163. end
  164.  
  165. ActivePanel:InvalidateLayout( )
  166. ActivePanel:SetTall( self:GetTall( ) )
  167.  
  168.  
  169. -- Give the animation a chance
  170. self.animFade:Run( )
  171. end
  172. function panel.contentsPanel:Paint( w, h )
  173. end
  174. end
  175.  
  176. function SKIN:LayoutPointshopMenuButton( panel )
  177. panel:SetContentAlignment( 4 )
  178. end
  179.  
  180. function SKIN:PaintInventoryTab( panel, w, h )
  181. panel:SetContentAlignment( 2 )
  182. self:PaintTab( panel, w, h )
  183. end
  184.  
  185. function SKIN:PaintItemsContainer( panel, w, h )
  186. self:PaintInnerPanel( panel, w, h )
  187. end
  188.  
  189. function SKIN:PaintPointshopMenuButton( panel, w, h )
  190. surface.SetDrawColor( self.ButtonColor )
  191. surface.DrawRect( 0, 0, w, h )
  192. end
  193.  
  194. function SKIN:PaintInnerPanel( panel, w, h )
  195. surface.SetDrawColor( self.InnerPanel )
  196. surface.DrawRect( 0, 0, w, h )
  197. end
  198.  
  199. function SKIN:PaintFooter( panel, w, h )
  200. surface.SetDrawColor( self.Footer )
  201. surface.DrawRect( 0, 0, w, h )
  202. end
  203.  
  204. function SKIN:PaintInnerPanelBright( panel, w, h )
  205. surface.SetDrawColor( self.BrightPanel )
  206. surface.DrawRect( 0, 0, w, h )
  207. end
  208.  
  209. function SKIN:PaintPointshopFrame( panel, w, h )
  210. surface.SetDrawColor( self.MainBG )
  211. surface.DrawRect( 0, 0, w, h )
  212. end
  213.  
  214. function SKIN:PaintTopBar( panel, w, h )
  215. surface.SetDrawColor( self.HeaderBG )
  216. surface.DrawRect( 0, 0, w, h )
  217. end
  218.  
  219. function SKIN:PaintPointshopItemIcon( panel, w, h )
  220. if panel.Selected or panel.Hovered or panel:IsChildHovered( 2 ) then
  221. draw.RoundedBox( 6, 0, 0, w, h, self.Highlight )
  222. draw.RoundedBox( 6, 2, 2, w - 4, h - 4, Color( 47, 47, 47 ) )
  223. else
  224. draw.RoundedBox( 6, 0, 0, w, h, Color( 47, 47, 47 ) )
  225. end
  226. end
  227.  
  228. function SKIN:PaintButton( panel, w, h )
  229. surface.SetDrawColor( self.ButtonColor )
  230. surface.DrawRect( 0, 0, w, h )
  231. panel:SetTextColor( self.Colours.Label.Default )
  232. if IsValid( panel.m_Image ) then
  233. panel.m_Image:SetImageColor( color_white )
  234. end
  235.  
  236.  
  237. if panel.Hovered or panel.Highlight or panel.Selected then
  238. surface.SetDrawColor( self.Highlight )
  239. surface.DrawRect( 0, 0, w, h )
  240. if IsValid( panel.m_Image ) then
  241. panel.m_Image:SetImageColor( self.Colours.Label.Dark )
  242. end
  243. panel:SetTextStyleColor( Color( 0, 0, 0 ) )
  244. panel:SetColor( Color( 0, 0, 0 ) )
  245. end
  246.  
  247. if panel:GetDisabled( ) then
  248. surface.SetDrawColor( Color( self.ButtonColor.r - 20, self.ButtonColor.g - 20, self.ButtonColor.b - 20 ) )
  249. surface.DrawRect( 0, 0, w, h )
  250. surface.SetDrawColor( Color( 200, 200, 200 ) )
  251. --surface.DrawOutlinedRect( 0, 0, w, h )
  252. if IsValid( panel.m_Image ) then
  253. panel.m_Image:SetImageColor( Color( 100, 100, 100 ) )
  254. end
  255. panel:SetTextColor( self.Colours.Label.Dark )
  256. end
  257. panel:ApplySchemeSettings( )
  258. end
  259.  
  260. function SKIN:PaintBigButton( panel, w, h )
  261. if panel.Hovered then
  262. surface.SetDrawColor( self.Highlight )
  263. else
  264. surface.SetDrawColor( self.ButtonColor )
  265. end
  266. surface.DrawRect( 0, 0, w, h )
  267. end
  268.  
  269. function SKIN:PaintBigButtonLabel( panel, w, h )
  270. surface.SetDrawColor( panel:GetSkin( ).ButtonColor )
  271. surface.DrawRect( 0, 0, w, h )
  272. end
  273.  
  274. local function compareColors( c1, c2 )
  275. return c1.r == c2.r and c2.g == c1.g and c1.b == c2.b and c1.a == c2.a
  276. end
  277.  
  278. function SKIN:PaintSelection( panel, w, h )
  279. surface.SetDrawColor( self.Highlight )
  280. --surface.DrawOutlinedRect( 0, 0, w, h )
  281. end
  282.  
  283. function SKIN:PaintMenuOption( panel, w, h )
  284. surface.SetDrawColor( self.ButtonColor )
  285. surface.DrawRect( 0, 0, w, h )
  286. if panel.m_Image then panel.m_Image:SetImageColor( color_white ) end
  287. panel:SetTextColor( self.Colours.Label.Default )
  288. if panel.Hovered or panel.Highlight then
  289. surface.SetDrawColor( self.Highlight )
  290. surface.DrawOutlinedRect( 0, 0, w, h )
  291. if panel.m_Image then
  292. panel.m_Image:SetImageColor( self.Highlight )
  293. end
  294. panel:SetTextColor( self.Highlight )
  295. end
  296. end
  297.  
  298. function SKIN:LayoutPropertySheetSheet( panel, sheet )
  299. function sheet.Tab:ApplySchemeSettings( )
  300. local active = self:GetPropertySheet( ):GetActiveTab( ) == self
  301. local w, h = self:GetContentSize()
  302. self:SetTextInset( 10, -0 )
  303. self:SetSize( w + 10, self:GetParent( ):GetTall( ) )
  304.  
  305.  
  306. self:SetContentAlignment( 5 )
  307.  
  308. DLabel.ApplySchemeSettings( self )
  309. end
  310. sheet.Tab:SetFont( SKIN.TabFont )
  311. sheet.Tab:SetTooltip( false )
  312. sheet.Panel:Dock( FILL )
  313. end
  314.  
  315. function SKIN:LayoutInlineSheetSheet( panel, sheet )
  316. function sheet.Tab:ApplySchemeSettings( )
  317. local active = self:GetPropertySheet( ):GetActiveTab( ) == self
  318. local w, h = self:GetContentSize()
  319. self:SetTextInset( 10, -0 )
  320. self:SetSize( w + 10, self:GetParent( ):GetTall( ) )
  321.  
  322.  
  323. self:SetContentAlignment( 5 )
  324.  
  325. DLabel.ApplySchemeSettings( self )
  326. end
  327. sheet.Tab:SetFont( SKIN.fontName )
  328. sheet.Panel:Dock( FILL )
  329. end
  330.  
  331.  
  332. function SKIN:PaintTab( panel, w, h )
  333. if panel:IsActive( ) or panel.Hovered then
  334. surface.SetDrawColor( self.Highlight )
  335. surface.DrawRect( 0, 0, w, 5 )
  336. end
  337. end
  338.  
  339. function SKIN:PaintTree( panel, w, h )
  340. surface.SetDrawColor( self.ButtonColor )
  341. surface.DrawRect( 0, 0, w, h )
  342. end
  343.  
  344. function SKIN:PaintFrame( panel, w, h )
  345. if not panel.startTime then
  346. panel.startTime = SysTime( )
  347.  
  348.  
  349. panel.btnMaxim:SetVisible( false )
  350. panel.btnMinim:SetVisible( false )
  351.  
  352. panel.lblTitle:SetFont( "PS2_Normal" )
  353. end
  354.  
  355. local c
  356. for k, v in pairs( panel:GetChildren( ) ) do
  357. if v:HasFocus( ) then
  358. c = true
  359. end
  360. end
  361. if panel:HasHierarchicalFocus() then Derma_DrawBackgroundBlur( panel, panel.startTime ) end
  362. draw.RoundedBox( 0, 0, 0, w, h, self.MainBG )
  363. draw.RoundedBoxEx( 0, 0, 0, w, 27, self.HeaderBG, true, true )
  364. end
  365.  
  366. function SKIN:PaintCollapsibleCategory( panel, w, h )
  367. panel.Header:SetFont( "PS2_Normal" )
  368. panel.Header:SetTall( 25 )
  369.  
  370. surface.SetDrawColor( self.ButtonColor )
  371. surface.DrawRect( 0, 0, panel.Header:GetWide( ), panel.Header:GetTall( ) )
  372.  
  373. surface.SetDrawColor( self.InnerPanel )
  374. surface.DrawRect( 0, panel.Header:GetTall( ), w, h - panel.Header:GetTall( ) )
  375. end
  376.  
  377. function SKIN:PaintCategoryList( panel, w, h )
  378. surface.SetDrawColor( self.InnerPanel )
  379. surface.DrawRect( 0, 0, w, h )
  380. end
  381.  
  382. function SKIN:PaintRadioButton( panel, w, h )
  383. if panel:GetChecked( ) then
  384. if panel:GetDisabled( ) then
  385. self.tex.RadioButtonD_Checked( 0, 0, w, h )
  386. else
  387. self.tex.RadioButton_Checked( 0, 0, w, h )
  388. end
  389. else
  390. if panel:GetDisabled( ) then
  391. self.tex.RadioButtonD( 0, 0, w, h )
  392. else
  393. self.tex.RadioButton( 0, 0, w, h )
  394. end
  395. end
  396. end
  397.  
  398. function SKIN:PaintScrollBarGrip( panel, w, h )
  399. if panel.Depressed then
  400. surface.SetDrawColor( self.Highlight )
  401. else
  402. surface.SetDrawColor( self.ButtonColor )
  403. end
  404. surface.DrawRect( 0, 0, w, h )
  405. end
  406.  
  407. function SKIN:PaintVScrollBar( panel, w, h )
  408. surface.SetDrawColor( self.InnerPanel )
  409. surface.DrawRect( 0, 0, w, h )
  410. end
  411.  
  412. function SKIN:PaintButtonDown( panel, w, h )
  413. self:PaintButton( panel, w, h )
  414. if not panel.m_Image then
  415. panel:SetImage( "pointshop2/little9.png" )
  416. panel.m_Image:SetSize( 8, 8 )
  417. end
  418. end
  419.  
  420. function SKIN:PaintButtonUp( panel, w, h )
  421. self:PaintButton( panel, w, h )
  422. if not panel.m_Image then
  423. panel:SetImage( "pointshop2/little16.png" )
  424. panel.m_Image:SetSize( 8, 8 )
  425. end
  426. end
  427.  
  428.  
  429.  
  430. derma.DefineSkin( SKIN.Name, "Poinsthop2 Default", SKIN )
  431.  
  432. KLogf( 4, "Loaded " .. SKIN.Name )
  433.  
  434. end --function loadSkin
  435.  
  436. hook.Add( "Initialize", SKIN.Name .. "init", loadSkin, 100 )
  437. hook.Add( "OnReloaded", SKIN.Name .. "reload", loadSkin, 100 )
  438. if GAMEMODE then
  439. loadSkin( )
  440. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement