KananGamer

[TFM-LUA] Menu + Button (UI Design)

Jul 15th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.66 KB | None | 0 0
  1. --[[
  2.     { DESIGN API } Created By: Nettoork#0000
  3.     - Menu
  4.         - Create
  5.             id, text, username, x, y, w, h
  6.         - Remove
  7.             - id, username
  8.     - Button
  9.         - Create
  10.             id, text, reference, username, x, y, w, h, clicked
  11.         - Remove
  12.             - id, username
  13.     { EXAMPLES }
  14.         design.menu:create(1, 'Batata', 'Nettoork#0000', 15, 38, 670, 276)
  15.         design.menu:remove(1, 'Nettoork#0000')
  16.         design.button:create(1, 'Batata', 'id_4', 'Nettoork#0000', 559, 48, 100, 18, false)
  17.         design.button:remove(1, 'Nettoork#0000')
  18. ]]--
  19.  
  20. do
  21.     local idGlobal = 543212345
  22.     design = {
  23.         menu = function()
  24.             local self = {}
  25.             self.create = function(self, ...)
  26.                 local arg = {...}
  27.                 if arg[6] < 0 or arg[7] and arg[7] < 0 then return end if not arg[7] then arg[7] = arg[6]/2 end -- Protection
  28.                 local id = idGlobal+arg[1]*8
  29.                 ui.addTextArea(id, '', arg[3], arg[4], arg[5], arg[6]+100, arg[7]+70, 0x78462b, 0x78462b, 1, true)
  30.                 ui.addTextArea(id+1, '', arg[3], arg[4], arg[5]+(arg[7]+140)/4, arg[6]+100, arg[7]/2, 0x9d7043, 0x9d7043, 1, true)
  31.                 ui.addTextArea(id+2, '', arg[3], arg[4]+(arg[6]+180)/4, arg[5], (arg[6]+10)/2, arg[7]+70, 0x9d7043, 0x9d7043, 1, true)
  32.                 ui.addTextArea(id+3, '', arg[3], arg[4], arg[5], 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  33.                 ui.addTextArea(id+4, '', arg[3], arg[4]+arg[6]+80, arg[5], 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  34.                 ui.addTextArea(id+5, '', arg[3], arg[4], arg[5]+arg[7]+50, 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  35.                 ui.addTextArea(id+6, '', arg[3], arg[4]+arg[6]+80, arg[5]+arg[7]+50, 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  36.                 ui.addTextArea(id+7, arg[2], arg[3], arg[4]+3, arg[5]+3, arg[6]+94, arg[7]+64, 0x1c3a3e, 0x232a35, 1, true)
  37.             end
  38.             self.remove = function(self, id, name)
  39.                 for i = 0, 7 do
  40.                     ui.removeTextArea(idGlobal+id*8+i, name)
  41.                 end
  42.             end
  43.             return self
  44.         end,
  45.         button = function()
  46.             local self = {}
  47.             self.create = function(self, ...)
  48.                 local arg = {...}
  49.                 local id = -idGlobal+arg[1]*3
  50.                 local color = arg[9] and '0x2A424B' or '0x314e57'
  51.                 ui.addTextArea(id, '', arg[4], arg[5]-1, arg[6]-1, arg[7], arg[8], 0x7a8d93, 0x7a8d93, 1, true)
  52.                 ui.addTextArea(id-1, '', arg[4], arg[5]+1, arg[6]+1, arg[7], arg[8], 0x0e1619, 0x0e1619, 1, true)
  53.                 ui.addTextArea(id-2, '<p align="center"><a href="event:'..arg[3]..'">'..arg[2]..'</a></p>', arg[4], arg[5], arg[6] , arg[7], arg[8], color, color, 1, true)
  54.             end
  55.             self.remove = function(self, id, name)
  56.                 for i = 0, 2 do
  57.                     ui.removeTextArea(-idGlobal+id*3-i, name)
  58.                 end
  59.             end
  60.             return self
  61.         end
  62.     }
  63.     design.menu = design.menu()
  64.     design.button = design.button()
  65. end
Add Comment
Please, Sign In to add comment