Anthr4x292

MindBlast Server Client Code: Derma (Derpma)

Feb 11th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.28 KB | None | 0 0
  1. SKIN                             = {}
  2. SKIN.CustomColor1                = Color(40, 40, 40, 255)
  3.  
  4. SKIN.PrintName                   =  "lolrpomg fuck off Skin"
  5. SKIN.Author                      =  "Maurits yar yar har har"
  6. SKIN.DermaVersion                =  1
  7.  
  8. SKIN.bg_color                    =  Color(50, 50, 50, 200)//Color(100, 100, 100, 186)
  9. SKIN.bg_color_sleep              =  Color(70, 70, 70, 200)//Color(80, 80, 80, 186)
  10. SKIN.bg_color_dark               =  Color(40, 40, 40, 200)//Color(60, 60, 60, 186)
  11. SKIN.bg_color_bright             =  Color(80, 80, 80, 200)//Color(120, 120, 120, 186)
  12.  
  13. SKIN.fontFrame                   =  "Default"
  14.  
  15. SKIN.control_color               =  Color(50, 50, 50, 200)
  16. SKIN.control_color_highlight     =  Color(80, 80, 80, 200)
  17. SKIN.control_color_active        =  Color(70, 70, 70, 200)
  18. SKIN.control_color_bright        =  Color(100, 100, 100, 200)
  19. SKIN.control_color_dark          =  Color(30, 30, 30, 200)
  20.  
  21. SKIN.bg_alt1                     =  Color(50, 50, 50, 200)
  22. SKIN.bg_alt2                     =  Color(55, 55, 55, 200)
  23.  
  24. SKIN.listview_hover              =  Color(40, 40, 40, 200)
  25. SKIN.listview_selected           =  Color(70, 70, 100, 200)
  26.  
  27. SKIN.text_bright                 =  Color(255, 255, 255, 200) //Color(255, 255, 255, 200)
  28. SKIN.text_normal                 =  Color(220, 220, 220, 200) //Color(200, 200, 200, 200)
  29. SKIN.text_dark                   =  Color(200, 200, 200, 200) //Color(80, 80, 80, 200)
  30. SKIN.text_highlight              =  Color(255, 255, 255, 200) //Color(255, 20, 20, 200)
  31.  
  32. SKIN.texGradientUp               =  Material("gui/gradient_up")
  33. SKIN.texGradientDown             =  Material("gui/gradient_down")
  34.  
  35. SKIN.combobox_selected           =  SKIN.listview_selected
  36.  
  37. SKIN.panel_transback             =  Color(255, 255, 255, 50)
  38. SKIN.tooltip                     =  Color(200, 200, 200, 225)
  39.  
  40. SKIN.colPropertySheet            =  Color(50, 50, 50, 255)//Color(230, 230, 230, 200)
  41. SKIN.colTab                      =  Color(50, 50, 50, 255) //Color(255, 255, 255, 255)
  42. SKIN.colTabInactive              =  Color(40, 40, 40, 200)
  43. SKIN.colTabShadow                =  Color(20, 20, 20, 255)
  44. SKIN.colTabText                  =  Color(255, 255, 255, 225)
  45. SKIN.colTabTextInactive          =  Color(150, 150, 150, 155)
  46. SKIN.fontTab                     =  "Default"
  47.  
  48. SKIN.colCollapsibleCategory      =  Color(100, 100, 100, 100)
  49.  
  50. SKIN.colCategoryText             =  Color(200, 200, 186, 225)
  51. SKIN.colCategoryTextInactive     =  Color(100, 100, 120, 155)
  52. SKIN.fontCategoryHeader          =  "TabLarge"
  53.  
  54. SKIN.colNumberWangBG             =  Color(255, 186, 150, 200)
  55. SKIN.colTextEntryBG              =  Color(255, 255, 255, 200)
  56. SKIN.colTextEntryBorder          =  Color(127, 157, 185, 200)
  57. SKIN.colTextEntryText            =  Color(0, 0, 0, 200)
  58. SKIN.colTextEntryTextHighlight   =  Color(100, 100, 100, 200)
  59.  
  60. SKIN.colMenuBG                   =  Color(150, 150, 150, 250)
  61. SKIN.colMenuBorder               =  Color(55, 55, 55, 255)
  62.  
  63. SKIN.colButtonText               =  Color(255, 255, 255, 255)
  64. SKIN.colButtonTextDisabled       =  Color(170, 170, 170, 200)
  65. SKIN.colButtonBorder             =  Color(40, 40, 40, 255)
  66. SKIN.colButtonBorderHighlight    =  Color(60, 60, 60, 255)
  67. SKIN.colButtonBorderShadow       =  Color(0, 0, 0, 0)
  68. SKIN.fontButton                  =  "Default"
  69.  
  70. local iNewHUD = surface.GetTextureID("perp2/inventory/mb_background")
  71. local iTexGradient = surface.GetTextureID("gui/gradient_up")
  72.  
  73. local surface = surface
  74. local draw = draw
  75. local math = math
  76.  
  77. //
  78.  
  79. /*---------------------------------------------------------
  80.    DrawGenericBackground
  81. --------------------------------------------------------- */
  82. function SKIN:DrawGenericBackground(x, y, w, h, color)
  83.  
  84.     draw.RoundedBox(4, x, y, w, h, color)
  85.  
  86. end
  87.  
  88. /*---------------------------------------------------------
  89.    DrawButtonBorder
  90. --------------------------------------------------------- */
  91. function SKIN:DrawButtonBorder(x, y, w, h, depressed)
  92.  
  93.     if(!depressed) then
  94.    
  95.         //Highlight
  96.         surface.SetDrawColor(self.colButtonBorderHighlight)
  97.         surface.DrawRect(x + 1, y + 1, w - 2, 1)
  98.         surface.DrawRect(x + 1, y + 1, 1, h - 2)
  99.        
  100.         //Corner
  101.         surface.DrawRect(x + 2, y + 2, 1, 1)
  102.    
  103.         //Shadow
  104.         surface.SetDrawColor(self.colButtonBorderShadow)
  105.         surface.DrawRect(w - 2, y + 2, 1, h - 2)
  106.         surface.DrawRect(x + 2, h - 2, w - 2, 1)
  107.        
  108.     else
  109.    
  110.         local col = self.colButtonBorderShadow
  111.    
  112.         for i = 1, 5 do
  113.        
  114.             surface.SetDrawColor(col.r, col.g, col.b, (255 - i * (255/5)))
  115.             surface.DrawOutlinedRect(i, i, w - i, h - i)
  116.        
  117.         end
  118.        
  119.     end
  120.  
  121.     surface.SetDrawColor(self.colButtonBorder)
  122.     surface.DrawOutlinedRect(x, y, w, h)
  123.  
  124. end
  125.  
  126. /*---------------------------------------------------------
  127.    DrawDisabledButtonBorder
  128. --------------------------------------------------------- */
  129. function SKIN:DrawDisabledButtonBorder(x, y, w, h, depressed)
  130.  
  131.     surface.SetDrawColor(0, 0, 0, 150)
  132.     surface.DrawOutlinedRect(x, y, w, h)
  133.    
  134. end
  135.  
  136.  
  137. /*---------------------------------------------------------
  138.     Frame
  139. --------------------------------------------------------- */
  140. function SKIN:PaintFrame(panel)
  141.     draw.RoundedBox(8, 0, 0, panel:GetWide(), panel:GetTall(), Color(5, 5, 5, 180))
  142.     surface.SetTexture(iNewHUD)
  143.     surface.SetDrawColor(Color(240, 240, 240, 255))
  144.     surface.DrawTexturedRectUV(2, 2, panel:GetWide() - 4, panel:GetTall() - 4, 128, 128)
  145.    
  146.     surface.SetTexture(iTexGradient)
  147.     surface.SetDrawColor(0, 0, 0, 220)
  148.     surface.DrawTexturedRect(0, -panel:GetTall() * 0.3, panel:GetWide(), panel:GetTall() * 1.3, 90)
  149. end
  150.  
  151. function SKIN:LayoutFrame(panel)
  152.  
  153.     panel.lblTitle:SetFont(self.fontFrame)
  154.    
  155.     panel.btnClose:SetPos(panel:GetWide() - 22, 4)
  156.     panel.btnClose:SetSize(18, 18)
  157.    
  158.     panel.lblTitle:SetPos(8, 2)
  159.     panel.lblTitle:SetSize(panel:GetWide() - 25, 20)
  160.  
  161. end
  162.  
  163.  
  164. /*---------------------------------------------------------
  165.     Button
  166. --------------------------------------------------------- */
  167. function SKIN:PaintButton(panel)
  168.  
  169.     local w, h = panel:GetSize()
  170.  
  171.     if(panel.m_bBackground) then
  172.    
  173.         local col = self.control_color
  174.        
  175.         if(panel:GetDisabled()) then
  176.             col = self.control_color_dark
  177.         elseif(panel.Depressed or panel:GetSelected()) then
  178.             col = self.control_color_active
  179.         elseif(panel.Hovered) then
  180.             col = self.control_color_highlight
  181.         end
  182.        
  183.         surface.SetDrawColor(col.r, col.g, col.b, col.a)
  184.         panel:DrawFilledRect()
  185.    
  186.     end
  187.  
  188. end
  189. function SKIN:PaintOverButton(panel)
  190.  
  191.     local w, h = panel:GetSize()
  192.    
  193.     if(panel.m_bBorder) then
  194.         if(panel:GetDisabled()) then
  195.             self:DrawDisabledButtonBorder(0, 0, w, h)
  196.         else
  197.             self:DrawButtonBorder(0, 0, w, h, panel.Depressed or panel:GetSelected())
  198.         end
  199.     end
  200.  
  201. end
  202.  
  203.  
  204. function SKIN:SchemeButton(panel)
  205.  
  206.     panel:SetFont(self.fontButton)
  207.    
  208.     if(panel:GetDisabled()) then
  209.         panel:SetTextColor(self.colButtonTextDisabled)
  210.     else
  211.         panel:SetTextColor(self.colButtonText)
  212.     end
  213.    
  214.     DLabel.ApplySchemeSettings(panel)
  215.  
  216. end
  217.  
  218. /*---------------------------------------------------------
  219.     SysButton
  220. --------------------------------------------------------- */
  221. function SKIN:PaintPanel(panel)
  222.  
  223.     if(panel.m_bPaintBackground) then
  224.    
  225.         local w, h = panel:GetSize()
  226.         self:DrawGenericBackground(0, 0, w, h, self.panel_transback)
  227.        
  228.     end
  229.  
  230. end
  231.  
  232. /*---------------------------------------------------------
  233.     SysButton
  234. --------------------------------------------------------- */
  235. function SKIN:PaintSysButton(panel)
  236.  
  237.     self:PaintButton(panel)
  238.     self:PaintOverButton(panel) //Border
  239.  
  240. end
  241.  
  242. function SKIN:SchemeSysButton(panel)
  243.  
  244.     panel:SetFont("Marlett")
  245.     DLabel.ApplySchemeSettings(panel)
  246.    
  247. end
  248.  
  249.  
  250. /*---------------------------------------------------------
  251.     ImageButton
  252. --------------------------------------------------------- */
  253. function SKIN:PaintImageButton(panel)
  254.  
  255.     self:PaintButton(panel)
  256.  
  257. end
  258.  
  259. /*---------------------------------------------------------
  260.     ImageButton
  261. --------------------------------------------------------- */
  262. function SKIN:PaintOverImageButton(panel)
  263.  
  264.     self:PaintOverButton(panel)
  265.  
  266. end
  267. function SKIN:LayoutImageButton(panel)
  268.  
  269.     if(panel.m_bBorder) then
  270.         panel.m_Image:SetPos(1, 1)
  271.         panel.m_Image:SetSize(panel:GetWide() - 2, panel:GetTall() - 2)
  272.     else
  273.         panel.m_Image:SetPos(0, 0)
  274.         panel.m_Image:SetSize(panel:GetWide(), panel:GetTall())
  275.     end
  276.  
  277. end
  278.  
  279. /*---------------------------------------------------------
  280.     PanelList
  281. --------------------------------------------------------- */
  282. function SKIN:PaintPanelList(panel)
  283.     local color = self.bg_color_dark
  284.     if(panel.m_bBackground) then
  285.         draw.RoundedBox(4, 0, 0, panel:GetWide(), panel:GetTall(), SKIN.CustomColor1)
  286.     end
  287.  
  288. end
  289.  
  290. /*---------------------------------------------------------
  291.     ScrollBar
  292. --------------------------------------------------------- */
  293. function SKIN:PaintVScrollBar(panel)
  294.     local color = self.bg_color
  295.     surface.SetDrawColor(Color(100, 100, 100, 255))
  296.     surface.DrawRect(0, 0, panel:GetWide(), panel:GetTall())
  297.  
  298. end
  299. function SKIN:LayoutVScrollBar(panel)
  300.  
  301.     local Wide = panel:GetWide()
  302.     local Scroll = panel:GetScroll() / panel.CanvasSize
  303.     local BarSize = panel:BarScale() * (panel:GetTall() - (Wide * 2))
  304.     local Track = panel:GetTall() - (Wide * 2) - BarSize
  305.     Track = Track + 1
  306.    
  307.     Scroll = Scroll * Track
  308.    
  309.     panel.btnGrip:SetPos(0, Wide + Scroll)
  310.     panel.btnGrip:SetSize(Wide, BarSize)
  311.    
  312.     panel.btnUp:SetPos(0, 0, Wide, Wide)
  313.     panel.btnUp:SetSize(Wide, Wide)
  314.    
  315.     panel.btnDown:SetPos(0, panel:GetTall() - Wide, Wide, Wide)
  316.     panel.btnDown:SetSize(Wide, Wide)
  317.  
  318. end
  319.  
  320. /*---------------------------------------------------------
  321.     ScrollBarGrip
  322. --------------------------------------------------------- */
  323. function SKIN:PaintScrollBarGrip(panel)
  324.  
  325.     surface.SetDrawColor(self.control_color.r, self.control_color.g, self.control_color.b, self.control_color.a)
  326.     surface.DrawRect(0, 0, panel:GetWide(), panel:GetTall())
  327.  
  328.     self:DrawButtonBorder(0, 0, panel:GetWide(), panel:GetTall())
  329.  
  330. end
  331.  
  332.  
  333. /*---------------------------------------------------------
  334.     ScrollBar
  335. --------------------------------------------------------- */
  336. function SKIN:PaintMenu(panel)
  337.  
  338.     surface.SetDrawColor(self.colMenuBG)
  339.     panel:DrawFilledRect(0, 0, w, h)
  340.  
  341. end
  342. function SKIN:PaintOverMenu(panel)
  343.  
  344.     surface.SetDrawColor(self.colMenuBorder)
  345.     panel:DrawOutlinedRect(0, 0, w, h)
  346.  
  347. end
  348. function SKIN:LayoutMenu(panel)
  349.  
  350. end
  351.  
  352. /*---------------------------------------------------------
  353.     ScrollBar
  354. --------------------------------------------------------- */
  355. function SKIN:PaintMenuOption(panel)
  356.  
  357.     if(panel.m_bBackground and panel.Hovered) then
  358.    
  359.         local col = nil
  360.        
  361.         if(panel.Depressed) then
  362.             col = self.control_color_bright
  363.         else
  364.             col = self.control_color_active
  365.         end
  366.        
  367.         surface.SetDrawColor(col.r, col.g, col.b, col.a)
  368.         surface.DrawRect(0, 0, panel:GetWide(), panel:GetTall())
  369.    
  370.     end
  371.    
  372. end
  373. function SKIN:LayoutMenuOption(panel)
  374.  
  375.     //This is totally messy. :/
  376.  
  377.     panel:SizeToContents()
  378.  
  379.     panel:SetWide(panel:GetWide() + 30)
  380.    
  381.     local w = math.max(panel:GetParent():GetWide(), panel:GetWide())
  382.  
  383.     panel:SetSize(w, 18)
  384.    
  385.     if(panel.SubMenuArrow) then
  386.    
  387.         panel.SubMenuArrow:SetSize(panel:GetTall(), panel:GetTall())
  388.         panel.SubMenuArrow:CenterVertical()
  389.         panel.SubMenuArrow:AlignRight()
  390.        
  391.     end
  392.    
  393. end
  394. function SKIN:SchemeMenuOption(panel)
  395.  
  396.     panel:SetFGColor(40, 40, 40, 255)
  397.    
  398. end
  399.  
  400. /*---------------------------------------------------------
  401.     TextEntry
  402. --------------------------------------------------------- */
  403. function SKIN:PaintTextEntry(panel)
  404.  
  405.     if(panel.m_bBackground) then
  406.    
  407.         surface.SetDrawColor(self.colTextEntryBG)
  408.         surface.DrawRect(0, 0, panel:GetWide(), panel:GetTall())
  409.    
  410.     end
  411.    
  412.     panel:DrawTextEntryText(panel.m_colText, panel.m_colHighlight, panel.m_colCursor)
  413.    
  414.     if(panel.m_bBorder) then
  415.    
  416.         surface.SetDrawColor(self.colTextEntryBorder)
  417.         surface.DrawOutlinedRect(0, 0, panel:GetWide(), panel:GetTall())
  418.    
  419.     end
  420.  
  421.    
  422. end
  423. function SKIN:SchemeTextEntry(panel)
  424.  
  425.     panel:SetTextColor(self.colTextEntryText)
  426.     panel:SetHighlightColor(self.colTextEntryTextHighlight)
  427.     panel:SetCursorColor(Color(0, 0, 100, 255))
  428.  
  429. end
  430.  
  431. /*---------------------------------------------------------
  432.     Label
  433. --------------------------------------------------------- */
  434. function SKIN:PaintLabel(panel)
  435.     return false
  436. end
  437.  
  438. function SKIN:SchemeLabel(panel)
  439.  
  440.     local col = nil
  441.  
  442.     if(panel.Hovered and panel:GetTextColorHovered()) then
  443.         col = panel:GetTextColorHovered()
  444.     else
  445.         col = panel:GetTextColor()
  446.     end
  447.    
  448.     if(col) then
  449.         panel:SetFGColor(col.r, col.g, col.b, col.a)
  450.     else
  451.         panel:SetFGColor(200, 200, 200, 255)
  452.     end
  453.  
  454. end
  455.  
  456. function SKIN:LayoutLabel(panel)
  457.  
  458.     panel:ApplySchemeSettings()
  459.    
  460.     if(panel.m_bAutoStretchVertical) then
  461.         panel:SizeToContentsY()
  462.     end
  463.    
  464. end
  465.  
  466. /*---------------------------------------------------------
  467.     CategoryHeader
  468. --------------------------------------------------------- */
  469. function SKIN:PaintCategoryHeader(panel)
  470.        
  471. end
  472.  
  473. function SKIN:SchemeCategoryHeader(panel)
  474.    
  475.     panel:SetTextInset(5)
  476.     panel:SetFont(self.fontCategoryHeader)
  477.    
  478.     if(panel:GetParent():GetExpanded()) then
  479.         panel:SetTextColor(self.colCategoryText)
  480.     else
  481.         panel:SetTextColor(self.colCategoryTextInactive)
  482.     end
  483.    
  484. end
  485.  
  486. /*---------------------------------------------------------
  487.     CategoryHeader
  488. --------------------------------------------------------- */
  489. function SKIN:PaintCollapsibleCategory(panel)
  490.    
  491.     draw.RoundedBox(4, 0, 0, panel:GetWide(), panel:GetTall(), self.colCollapsibleCategory)
  492.    
  493. end
  494.  
  495. /*---------------------------------------------------------
  496.     Tab
  497. --------------------------------------------------------- */
  498. function SKIN:PaintTab(panel)
  499.  
  500.     //This adds a little shadow to the right which helps define the tab shape ..
  501.     draw.RoundedBox(4, 0, 0, panel:GetWide(), panel:GetTall() + 8, self.colTabShadow)
  502.    
  503.     if(panel:GetPropertySheet():GetActiveTab() == panel) then
  504.         draw.RoundedBox(4, 1, 0, panel:GetWide() - 2, panel:GetTall() + 8, self.colTab)
  505.     else
  506.         draw.RoundedBox(4, 0, 0, panel:GetWide() - 1, panel:GetTall() + 8, self.colTabInactive)
  507.     end
  508.    
  509. end
  510. function SKIN:SchemeTab(panel)
  511.  
  512.     panel:SetFont(self.fontTab)
  513.  
  514.     local ExtraInset = 10
  515.  
  516.     if(panel.Image) then
  517.         ExtraInset = ExtraInset + panel.Image:GetWide()
  518.     end
  519.    
  520.     panel:SetTextInset(ExtraInset)
  521.     panel:SizeToContents()
  522.     panel:SetSize(panel:GetWide() + 10, panel:GetTall() + 8)
  523.    
  524.     local Active = panel:GetPropertySheet():GetActiveTab() == panel
  525.    
  526.     if(Active) then
  527.         panel:SetTextColor(self.colTabText)
  528.     else
  529.         panel:SetTextColor(self.colTabTextInactive)
  530.     end
  531.    
  532.     panel.BaseClass.ApplySchemeSettings(panel)
  533.        
  534. end
  535.  
  536. function SKIN:LayoutTab(panel)
  537.  
  538.     panel:SetTall(22)
  539.  
  540.     if(panel.Image) then
  541.    
  542.         local Active = panel:GetPropertySheet():GetActiveTab() == panel
  543.        
  544.         local Diff = panel:GetTall() - panel.Image:GetTall()
  545.         panel.Image:SetPos(7, Diff * 0.6)
  546.        
  547.         if(!Active) then
  548.             panel.Image:SetImageColor(Color(170, 170, 170, 155))
  549.         else
  550.             panel.Image:SetImageColor(Color(255, 255, 255, 255))
  551.         end
  552.    
  553.     end
  554.    
  555. end
  556.  
  557.  
  558.  
  559. /*---------------------------------------------------------
  560.     PropertySheet
  561. --------------------------------------------------------- */
  562. function SKIN:PaintPropertySheet(panel)
  563.  
  564.     local ActiveTab = panel:GetActiveTab()
  565.     local Offset = 0
  566.     if(ActiveTab) then Offset = ActiveTab:GetTall() end
  567.    
  568.     //This adds a little shadow to the right which helps define the tab shape ..
  569.     draw.RoundedBox(4, 0, Offset, panel:GetWide(), panel:GetTall() - Offset, self.colPropertySheet)
  570.    
  571. end
  572.  
  573.  
  574. /*---------------------------------------------------------
  575.     ListViewLine
  576. --------------------------------------------------------- */
  577. function SKIN:PaintListViewLine(panel)
  578.  
  579.     local Col = nil
  580.    
  581.     if(panel:IsSelected()) then
  582.    
  583.         Col = self.listview_selected
  584.        
  585.     elseif(panel.Hovered) then
  586.    
  587.         Col = self.listview_hover
  588.        
  589.     elseif(panel.m_bAlt) then
  590.    
  591.         Col = self.bg_alt2
  592.        
  593.     else
  594.    
  595.         return
  596.                
  597.     end
  598.        
  599.     surface.SetDrawColor(Col.r, Col.g, Col.b, Col.a)
  600.     surface.DrawRect(0, 0, panel:GetWide(), panel:GetTall())
  601.    
  602. end
  603.  
  604. /*---------------------------------------------------------
  605.     Form
  606. --------------------------------------------------------- */
  607. function SKIN:PaintForm(panel)
  608.  
  609.     local color = self.bg_color_sleep
  610.     self:DrawGenericBackground(0, 9, panel:GetWide(), panel:GetTall() - 9, SKIN.CustomColor1)
  611.  
  612. end
  613. function SKIN:SchemeForm(panel)
  614.  
  615.     panel.Label:SetFont("TabLarge")
  616.     panel.Label:SetTextColor(Color(255, 255, 255, 255))
  617.  
  618. end
  619. function SKIN:LayoutForm(panel)
  620.  
  621. end
  622.  
  623.  
  624. /*---------------------------------------------------------
  625.     MultiChoice
  626. --------------------------------------------------------- */
  627. function SKIN:LayoutMultiChoice(panel)
  628.  
  629.     panel.TextEntry:SetSize(panel:GetWide(), panel:GetTall())
  630.    
  631.     panel.DropButton:SetSize(panel:GetTall(), panel:GetTall())
  632.     panel.DropButton:SetPos(panel:GetWide() - panel:GetTall(), 0)
  633.    
  634.     panel.DropButton:SetZPos(1)
  635.     panel.DropButton:SetDrawBackground(false)
  636.     panel.DropButton:SetDrawBorder(false)
  637.    
  638.     panel.DropButton:SetTextColor(Color(30, 100, 200, 255))
  639.     panel.DropButton:SetTextColorHovered(Color(50, 150, 255, 255))
  640.    
  641. end
  642.  
  643.  
  644. /*
  645. NumberWangIndicator
  646. */
  647.  
  648. function SKIN:DrawNumberWangIndicatorText(panel, wang, x, y, number, alpha)
  649.  
  650.     local alpha = math.Clamp(alpha ^ 0.5, 0, 1) * 255
  651.     local col = self.text_dark
  652.    
  653.     //Highlight round numbers
  654.     local dec = (wang:GetDecimals() + 1) * 10
  655.     if(number / dec == math.ceil(number / dec)) then
  656.         col = self.text_highlight
  657.     end
  658.  
  659.     draw.SimpleText(number, "Default", x, y, Color(col.r, col.g, col.b, alpha))
  660.    
  661. end
  662.  
  663.  
  664.  
  665. function SKIN:PaintNumberWangIndicator(panel)
  666.    
  667.     /*
  668.    
  669.         Please excuse the crudeness of this code.
  670.    
  671.     */
  672.  
  673.     if(panel.m_bTop) then
  674.         surface.SetMaterial(self.texGradientUp)
  675.     else
  676.         surface.SetMaterial(self.texGradientDown)
  677.     end
  678.    
  679.     surface.SetDrawColor(self.colNumberWangBG)
  680.     surface.DrawTexturedRect(0, 0, panel:GetWide(), panel:GetTall())
  681.    
  682.     local wang = panel:GetWang()
  683.     local CurNum = math.floor(wang:GetFloatValue())
  684.     local Diff = CurNum - wang:GetFloatValue()
  685.        
  686.     local InsetX = 3
  687.     local InsetY = 5
  688.     local Increment = wang:GetTall()
  689.     local Offset = Diff * Increment
  690.     local EndPoint = panel:GetTall()
  691.     local Num = CurNum
  692.     local NumInc = 1
  693.    
  694.     if(panel.m_bTop) then
  695.    
  696.         local Min = wang:GetMin()
  697.         local Start = panel:GetTall() + Offset
  698.         local End = Increment * - 1
  699.        
  700.         CurNum = CurNum + NumInc
  701.         for y = Start, Increment * - 1, End do
  702.    
  703.             CurNum = CurNum - NumInc
  704.             if(CurNum < Min) then break end
  705.                    
  706.             self:DrawNumberWangIndicatorText(panel, wang, InsetX, y + InsetY, CurNum, y / panel:GetTall())
  707.        
  708.         end
  709.    
  710.     else
  711.    
  712.         local Max = wang:GetMax()
  713.        
  714.         for y = Offset - Increment, panel:GetTall(), Increment do
  715.            
  716.             self:DrawNumberWangIndicatorText(panel, wang, InsetX, y + InsetY, CurNum, 1 - ((y + Increment) / panel:GetTall()))
  717.            
  718.             CurNum = CurNum + NumInc
  719.             if(CurNum > Max) then break end
  720.        
  721.         end
  722.    
  723.     end
  724.    
  725.  
  726. end
  727.  
  728. function SKIN:LayoutNumberWangIndicator(panel)
  729.  
  730.     panel.Height = 200
  731.  
  732.     local wang = panel:GetWang()
  733.     local x, y = wang:LocalToScreen(0, wang:GetTall())
  734.    
  735.     if(panel.m_bTop) then
  736.         y = y - panel.Height - wang:GetTall()
  737.     end
  738.    
  739.     panel:SetPos(x, y)
  740.     panel:SetSize(wang:GetWide() - wang.Wanger:GetWide(), panel.Height)
  741.  
  742. end
  743.  
  744. /*---------------------------------------------------------
  745.     CheckBox
  746. --------------------------------------------------------- */
  747. function SKIN:PaintCheckBox(panel)
  748.  
  749.     local w, h = panel:GetSize()
  750.  
  751.     surface.SetDrawColor(255, 255, 255, 255)
  752.     surface.DrawRect(1, 1, w - 2, h - 2)
  753.  
  754.     surface.SetDrawColor(30, 30, 30, 255)
  755.     //=
  756.     surface.DrawRect(1, 0, w - 2, 1)
  757.     surface.DrawRect(1, h - 1, w - 2, 1)
  758.     //or
  759.     surface.DrawRect(0, 1, 1, h - 2)
  760.     surface.DrawRect(w - 1, 1, 1, h - 2)
  761.    
  762.     surface.DrawRect(1, 1, 1, 1)
  763.     surface.DrawRect(w - 2, 1, 1, 1)
  764.    
  765.     surface.DrawRect(1, h - 2, 1, 1)
  766.     surface.DrawRect(w - 2, h - 2, 1, 1)
  767.  
  768. end
  769.  
  770. function SKIN:SchemeCheckBox(panel)
  771.  
  772.     panel:SetTextColor(Color(0, 0, 0, 255))
  773.     --DSysButton.ApplySchemeSettings(panel)
  774.    
  775. end
  776.  
  777.  
  778.  
  779. /*---------------------------------------------------------
  780.     Slider
  781. --------------------------------------------------------- */
  782. function SKIN:PaintSlider(panel)
  783.  
  784. end
  785.  
  786.  
  787. /*---------------------------------------------------------
  788.     NumSlider
  789. --------------------------------------------------------- */
  790. function SKIN:PaintNumSlider(panel)
  791.  
  792.     local w, h = panel:GetSize()
  793.    
  794.     self:DrawGenericBackground(0, 0, w, h, Color(255, 255, 255, 20))
  795.    
  796.     surface.SetDrawColor(0, 0, 0, 200)
  797.     surface.DrawRect(3, h/2, w - 6, 1)
  798.    
  799. end
  800.  
  801.  
  802. /*---------------------------------------------------------
  803.     NumSlider
  804. --------------------------------------------------------- */
  805. function SKIN:PaintComboBoxItem(panel)
  806.  
  807.     if(panel:GetSelected()) then
  808.         local col = self.combobox_selected
  809.         surface.SetDrawColor(col.r, col.g, col.b, col.a)
  810.         panel:DrawFilledRect()
  811.     end
  812.  
  813. end
  814.  
  815. function SKIN:SchemeComboBoxItem(panel)
  816.     panel:SetTextColor(Color(0, 0, 0, 255))
  817. end
  818.  
  819. /*---------------------------------------------------------
  820.     ComboBox
  821. --------------------------------------------------------- */
  822. function SKIN:PaintComboBox(panel)
  823.    
  824.     surface.SetDrawColor(255, 255, 255, 255)
  825.     panel:DrawFilledRect()
  826.        
  827.     surface.SetDrawColor(0, 0, 0, 255)
  828.     panel:DrawOutlinedRect()
  829.    
  830. end
  831.  
  832. /*---------------------------------------------------------
  833.     ScrollBar
  834. --------------------------------------------------------- */
  835. function SKIN:PaintBevel(panel)
  836.  
  837.     local w, h = panel:GetSize()
  838.  
  839.     surface.SetDrawColor(255, 255, 255, 255)
  840.     surface.DrawOutlinedRect(0, 0, w - 1, h - 1)
  841.    
  842.     surface.SetDrawColor(0, 0, 0, 255)
  843.     surface.DrawOutlinedRect(1, 1, w - 1, h - 1)
  844.  
  845. end
  846.  
  847.  
  848. /*---------------------------------------------------------
  849.     Tree
  850. --------------------------------------------------------- */
  851. function SKIN:PaintTree(panel)
  852.     local color = self.bg_color_bright
  853.     if(panel.m_bBackground) then
  854.         surface.SetDrawColor(SKIN.CustomColor1)
  855.         panel:DrawFilledRect()
  856.     end
  857.  
  858. end
  859.  
  860.  
  861.  
  862. /*---------------------------------------------------------
  863.     TinyButton
  864. --------------------------------------------------------- */
  865. function SKIN:PaintTinyButton(panel)
  866.  
  867.     if(panel.m_bBackground) then
  868.    
  869.         surface.SetDrawColor(255, 255, 255, 255)
  870.         panel:DrawFilledRect()
  871.    
  872.     end
  873.    
  874.     if(panel.m_bBorder) then
  875.  
  876.         surface.SetDrawColor(0, 0, 0, 255)
  877.         panel:DrawOutlinedRect()
  878.    
  879.     end
  880.  
  881. end
  882.  
  883. function SKIN:SchemeTinyButton(panel)
  884.  
  885.     panel:SetFont("Default")
  886.    
  887.     if(panel:GetDisabled()) then
  888.         panel:SetTextColor(Color(0, 0, 0, 50))
  889.     else
  890.         panel:SetTextColor(Color(0, 0, 0, 255))
  891.     end
  892.    
  893.     DLabel.ApplySchemeSettings(panel)
  894.    
  895.     panel:SetFont("DefaultSmall")
  896.  
  897. end
  898.  
  899. /*---------------------------------------------------------
  900.     TinyButton
  901. --------------------------------------------------------- */
  902. function SKIN:PaintTreeNodeButton(panel)
  903.  
  904.     if(panel.m_bSelected) then
  905.  
  906.         surface.SetDrawColor(50, 200, 255, 150)
  907.         panel:DrawFilledRect()
  908.    
  909.     elseif(panel.Hovered) then
  910.  
  911.         surface.SetDrawColor(255, 255, 255, 100)
  912.         panel:DrawFilledRect()
  913.    
  914.     end
  915.    
  916.    
  917.  
  918. end
  919.  
  920. function SKIN:SchemeTreeNodeButton(panel)
  921.  
  922.     DLabel.ApplySchemeSettings(panel)
  923.  
  924. end
  925.  
  926. /*---------------------------------------------------------
  927.     Tooltip
  928. --------------------------------------------------------- */
  929. function SKIN:PaintTooltip(panel)
  930.  
  931.     local w, h = panel:GetSize()
  932.    
  933.     DisableClipping(true)
  934.    
  935.     //This isn't great, but it's not like we're drawing 1000's of tooltips all the time
  936.     for i = 1, 4 do
  937.    
  938.         local BorderSize = i*2
  939.         local BGColor = Color(0, 0, 0, (255 / i) * 0.3)
  940.        
  941.         self:DrawGenericBackground(BorderSize, BorderSize, w, h, BGColor)
  942.         panel:DrawArrow(BorderSize, BorderSize)
  943.         self:DrawGenericBackground(-BorderSize, BorderSize, w, h, BGColor)
  944.         panel:DrawArrow(-BorderSize, BorderSize)
  945.         self:DrawGenericBackground(BorderSize, -BorderSize, w, h, BGColor)
  946.         panel:DrawArrow(BorderSize, -BorderSize)
  947.         self:DrawGenericBackground(-BorderSize, -BorderSize, w, h, BGColor)
  948.         panel:DrawArrow(-BorderSize, -BorderSize)
  949.        
  950.     end
  951.  
  952.  
  953.     self:DrawGenericBackground(0, 0, w, h, self.tooltip)
  954.     panel:DrawArrow(0, 0)
  955.  
  956.     DisableClipping(false)
  957. end
  958. derma.DefineSkin("perp2", "PERP", SKIN)
  959.  
  960. SKIN.fontLabel = "Default"
  961. SKIN.fontLargeLabel = "DefaultLarge"
  962.  
  963. function cutLength ( str, pW, font )
  964.     surface.SetFont(font)
  965.    
  966.     local sW = pW - 40
  967.    
  968.     for i = 1, string.len(str) do
  969.         local sStr = string.sub(str, 1, i)
  970.         local w, h = surface.GetTextSize(sStr)
  971.        
  972.         if(w > pW or (w > sW and string.sub(str, i, i) == " ")) then
  973.             local cutRet = cutLength(string.sub(str, i + 1), pW, font)
  974.            
  975.             local returnTable = {sStr}
  976.            
  977.             for k, v in pairs(cutRet) do
  978.                 returnTable[#returnTable+1] = v
  979.             end
  980.            
  981.             return returnTable
  982.         end
  983.     end
  984.    
  985.     return {str}
  986. end
  987.  
  988. SKIN.fontLabel                  = "DefaultSmall"
  989. SKIN.fontLargeLabel             = "DefaultLarge"
  990.  
  991. derma.RefreshSkins()
  992.  
  993. PERP2_SKIN = SKIN
Advertisement
Add Comment
Please, Sign In to add comment