Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  1. local dialogGUI = Dialog.GUI
  2.  
  3. function dialogGUI:onInit()
  4.     GUI.addFont("Assets/Dialog/config/FogSans.otf")
  5.     GUI.addFont("Assets/Dialog/config/BKANT.TTF")
  6.     --GUI.addTexture("Assets/Dialogs/config/background.png")
  7.     GUI.addTexture("Assets/Dialog/config/button.png")
  8.     GUI.addTexture("Assets/Dialog/config/icons.png")
  9.  
  10.     self.interface = GUI.addInterface()
  11.     self.dialogText = self.interface:addTextArea()
  12.     self.list = self.interface:addList()
  13. end
  14.  
  15. function dialogGUI:reset()
  16.     --.interface:setPropPadding(0.1, 0.03)
  17.     local dT = self.dialogText
  18.     dT:setPadding(0, 35)
  19.     dT:setPropPosition(0.5, 1)
  20.     dT:setFont(GUI.getFont("Assets/Dialog/config/FogSans.otf"))
  21.     dT:setCharacterPropSize(0.035)
  22.     dT:setToCenterAlign()
  23.     dT:setPropSize(1, 0.0)
  24.     dT:setOutlinePropThickness(0.1)
  25.     dT:setOutlineColor(5, 5, 15, 255)
  26.     dT:setColor(79, 64, 131, 255)
  27.    
  28.     local list = self.list
  29.     list:setPropBetweenPad(0.025)
  30.     list:setPropPosition(0.1, 0.60)
  31.     list:makeStaticPropPositing()
  32.     list:setPropOrigin(0.0, 1.0)
  33. end
  34.  
  35. function dialogGUI:clearButtons()
  36.     self.list:clear()
  37. end
  38.  
  39. function dialogGUI:getButton(caption, r, g, b, a, iconId)
  40.     local button = self.list:addImage()
  41.     button:setTexture(GUI.getTexture("Assets/Dialog/config/button.png"))
  42.     button:setColor(50, 50, 50, 0)
  43.  
  44.     button:setPropSize(0.4, 0.05)
  45.     button:setPropPadding(0.17, 0.0)
  46.  
  47.     button:makeChildrenUnresizable()
  48.     button:makeChildrenPenetrable()
  49.     button:makeChildrenUncolorable()
  50.     button:setFullSizeFilling()
  51.    
  52.    
  53.     local text = button:addText()
  54.     text:setFont(GUI.getFont("Assets/Dialog/config/BKANT.TTF"))
  55.     text:setCharacterPropSize(0.035)
  56.     text:setPropPosition(0.0, 0.5)
  57.     text:setColor(r, g, b, a)
  58.     text:setString(caption)
  59.     text:setOutlinePropThickness(0.03)
  60.     text:setOutlineColor(
  61.         ((r+50 < 255) and r+50 or 255),
  62.         ((g+50 < 255) and g+50 or 255),
  63.         ((b+50 < 255) and b+50 or 255),
  64.         255
  65.     )
  66.    
  67.     function button:onHoverOut()
  68.         self:setColor(255, 255, 255, 0)
  69.         text:setColor(r, g, b, a)
  70.     end
  71.    
  72.     function button:onHoverIn()
  73.         self:setColor(255, 255, 255, 255)
  74.         text:setColor(
  75.             ((r+50 < 255) and r+50 or 255),
  76.             ((g+50 < 255) and g+50 or 255),
  77.             ((b+50 < 255) and b+50 or 255),
  78.             255
  79.         )
  80.     end
  81.     return text;
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement