Advertisement
ChaosityYT

Part One Of Ivy Flood Escape GUI

Jan 6th, 2020
863
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 190.46 KB | None | 0 0
  1. --Veranium XI | Rewritten by Ivy#1000
  2. --[[Keywords:
  3. VIn: Veranium Instance.
  4. VEn: Veranium Enumerator.
  5. VCv: Veranium Color Variant.
  6. VCt: Veranium Custom TweenService .
  7. VCn: Veranium Constructor.
  8. VCf: Veranium Core Function.
  9. VLb: Veranium Library.
  10.  
  11. Veranium: Class Library | Works Similar To RLua's Instance.new()
  12. Vera: Automated UIL | Works Similar To Most UILs Out There
  13. ]]
  14.  
  15. local Veranium;
  16. --Getting Services
  17. local UserInputService = game:GetService("UserInputService");
  18. local TweenService = game:GetService("TweenService");
  19. local TextService = game:GetService("TextService");
  20. local RunService = game:GetService("RunService");
  21. local CoreGui = game:GetService("CoreGui");
  22. local Players = game:GetService("Players");
  23. local Debris = game:GetService("Debris");
  24. local Player = Players.LocalPlayer;
  25. local PlayerGui = Player.PlayerGui;
  26. local Mouse = Player:GetMouse();
  27.  
  28. local _PREFIX = "\226\128\139\226\128\139\226\128\139";
  29. local VeraniumSpace = Instance.new("ScreenGui");
  30.  
  31. VeraniumSpace.ResetOnSpawn = false
  32. VeraniumSpace.Name = "VeraniumSpace"
  33. VeraniumSpace.DisplayOrder = 9e5;
  34. VeraniumSpace.ZIndexBehavior = Enum.ZIndexBehavior.Sibling;
  35. pcall(function()
  36. VeraniumSpace.Parent = CoreGui;
  37. end);
  38. if VeraniumSpace.Parent == nil then
  39. VeraniumSpace.Parent = PlayerGui;
  40. end;
  41.  
  42. local VLb_CVMath;
  43. VLb_CVMath = {
  44. Map = function(Num, Start1, Stop1, Start2, Stop2)
  45. return ((Num-Start1)/(Stop1-Start1))*(Stop2-Start2)+Start2
  46. end,
  47. MapColor = function(StartColor, EndColor, StartFrame, EndFrame, Frame)
  48. local Map = VLb_CVMath.Map
  49. return Color3.new(
  50. Map(Frame, StartFrame, EndFrame, StartColor.r, EndColor.r),
  51. Map(Frame, StartFrame, EndFrame, StartColor.g, EndColor.g),
  52. Map(Frame, StartFrame, EndFrame, StartColor.b, EndColor.b)
  53. )
  54. end,
  55. Round = function(Num)
  56. local Low = math.floor(Num)
  57. local High = math.floor(Num) + 1
  58. local LV = -(Low - Num)
  59. local HV = High - Num
  60. if (HV > LV) then
  61. return Low
  62. else
  63. return High
  64. end
  65. end
  66. };
  67.  
  68. local VCf_IsA;
  69. local VCf_Destructor;
  70. local function VCf_SRO_NDX(Value)
  71. error("This Object is read-only.");
  72. end;
  73.  
  74. local function VCf_SetReadOnly(Value)
  75. if type(Value) == "table" then
  76. local Meta = getmetatable(Value);
  77. if type(Meta) == "table" then
  78. Meta.__newindex = VCf_SRO_NDX;
  79. elseif Meta == nil then
  80. setmetatable(Value, {
  81. __newindex = VCf_SRO_NDX,
  82. __index = rawget
  83. });
  84. else
  85. error("This table is Protected.");
  86. end;
  87. elseif type(Value) == "userdata" then
  88. local Meta = getmetatable(Value);
  89. if type(Meta) == "table" then
  90. Meta.__newindex = VCf_SRO_NDX;
  91. else
  92. error("This userdata is Protected.");
  93. end;
  94. else
  95. error("Value given must be a table/userdata.");
  96. end;
  97. end;
  98.  
  99. --Enum Library.
  100. local VEn_Data = {
  101. CornerType = {
  102. Sharp = "rbxassetid://3457842171",
  103. Smooth = "rbxassetid://3457843087",
  104. Edged = "rbxassetid://3457843868",
  105. None = "",
  106. [0] = "rbxassetid://3457842171",
  107. [1] = "rbxassetid://3457843087",
  108. [2] = "rbxassetid://3457843868",
  109. [3] = ""
  110. },
  111. CheckBoxType = {
  112. Sharp = 0,
  113. Smooth = 1,
  114. Circular = 2,
  115. Diamond = 3,
  116. None = 4,
  117. [0] = 0,
  118. [1] = 1,
  119. [2] = 2,
  120. [3] = 3,
  121. [4] = 4
  122. },
  123. FillBoxType = {
  124. Sharp = "rbxassetid://4049002850",
  125. Smooth = "rbxassetid://4049766910",
  126. Circular = "rbxassetid://4049877539",
  127. [0] = "rbxassetid://4049002850",
  128. [1] = "rbxassetid://4049766910",
  129. [2] = "rbxassetid://4049877539"
  130. },
  131. NotificationType = {
  132. Info = "rbxassetid://4057220511",
  133. Error = "rbxassetid://4057319805",
  134. None = "",
  135. [0] = "rbxassetid://4057220511",
  136. [1] = "rbxassetid://4057319805",
  137. [2] = ""
  138. },
  139. MetroLocation = {
  140. TopLeft = {
  141. AnchorPoint = Vector2.new(0, 0),
  142. Position = UDim2.new(0, 0, 0, 0),
  143. SizeConstraint = "X",
  144. ThicknessConstraint = "Y",
  145. BOffsetX = 1,
  146. BOffsetY = 1
  147. },
  148. TopCenter = {
  149. AnchorPoint = Vector2.new(0.5, 0),
  150. Position = UDim2.new(0.5, 0, 0, 0),
  151. SizeConstraint = "X",
  152. ThicknessConstraint = "Y",
  153. BOffsetX = 0,
  154. BOffsetY = 1
  155. },
  156. TopRight = {
  157. AnchorPoint = Vector2.new(1, 0),
  158. Position = UDim2.new(1, 0, 0, 0),
  159. SizeConstraint = "X",
  160. ThicknessConstraint = "Y",
  161. BOffsetX = -1,
  162. BOffsetY = 1
  163. },
  164. LeftTop = {
  165. AnchorPoint = Vector2.new(0, 0),
  166. Position = UDim2.new(0, 0, 0, 0),
  167. SizeConstraint = "Y",
  168. ThicknessConstraint = "X",
  169. BOffsetX = 1,
  170. BOffsetY = 1
  171. },
  172. LeftCenter = {
  173. AnchorPoint = Vector2.new(0, 0.5),
  174. Position = UDim2.new(0, 0, 0.5, 0),
  175. SizeConstraint = "Y",
  176. ThicknessConstraint = "X",
  177. BOffsetX = 1,
  178. BOffsetY = 0
  179. },
  180. LeftBottom = {
  181. AnchorPoint = Vector2.new(0, 1),
  182. Position = UDim2.new(0, 0, 1, 0),
  183. SizeConstraint = "Y",
  184. ThicknessConstraint = "X",
  185. BOffsetX = 1,
  186. BOffsetY = -1
  187. },
  188. RightTop = {
  189. AnchorPoint = Vector2.new(1, 0),
  190. Position = UDim2.new(1, 0, 0, 0),
  191. SizeConstraint = "Y",
  192. ThicknessConstraint = "X",
  193. BOffsetX = -1,
  194. BOffsetY = 1
  195. },
  196. RightCenter = {
  197. AnchorPoint = Vector2.new(1, 0.5),
  198. Position = UDim2.new(1, 0, 0.5, 0),
  199. SizeConstraint = "Y",
  200. ThicknessConstraint = "X",
  201. BOffsetX = -1,
  202. BOffsetY = 0
  203. },
  204. RightBottom = {
  205. AnchorPoint = Vector2.new(1, 1),
  206. Position = UDim2.new(1, 0, 1, 0),
  207. SizeConstraint = "Y",
  208. ThicknessConstraint = "X",
  209. BOffsetX = -1,
  210. BOffsetY = -1
  211. },
  212. BottomLeft = {
  213. AnchorPoint = Vector2.new(0, 1),
  214. Position = UDim2.new(0, 0, 1, 0),
  215. SizeConstraint = "X",
  216. ThicknessConstraint = "Y",
  217. BOffsetX = 1,
  218. BOffsetY = -1
  219. },
  220. BottomCenter = {
  221. AnchorPoint = Vector2.new(0.5, 1),
  222. Position = UDim2.new(0.5, 0, 1, 0),
  223. SizeConstraint = "X",
  224. ThicknessConstraint = "Y",
  225. BOffsetX = 0,
  226. BOffsetY = -1
  227. },
  228. BottomRight = {
  229. AnchorPoint = Vector2.new(1, 1),
  230. Position = UDim2.new(1, 0, 1, 0),
  231. SizeConstraint = "X",
  232. ThicknessConstraint = "Y",
  233. BOffsetX = -1,
  234. BOffsetY = -1
  235. };
  236. };
  237. };
  238.  
  239. local VEn_References = {};
  240. local VEn_Meta = {
  241. __tostring = function(Proxy)
  242. local Meta = VEn_References[Proxy];
  243. if typeof(Meta) == "table" then
  244. return Meta.___Path;
  245. else
  246. error("Unable to get the meta of VEnum.");
  247. end;
  248. end,
  249. __index = function(Proxy, Field)
  250. local Meta = VEn_References[Proxy];
  251. if typeof(Field) ~= "string" then
  252. error("Attempt to index VEnum with "..typeof(Field).." (string expected).");
  253. end;
  254. if typeof(Meta) == "table" then
  255. if Meta.___IsLib then
  256. return Meta.___Value[Field];
  257. else
  258. error("This is a VEnum. Not an EnumLibrary.");
  259. end;
  260. else
  261. error("Unable to get the meta of VEnum.");
  262. end;
  263. end,
  264. __newindex = function(Proxy, Field, Value)
  265. error("VEnums are read-only ;w;");
  266. end,
  267. __metatable = "S-Stay from my Metatable! P-Prevert!";--No context uwu
  268. }
  269. local function VEn_Create(VEn_Value, VEn_Path, VEn_IsLib, VEn_SubLib)
  270. local Proxy = newproxy(true);
  271. local Meta = getmetatable(Proxy);
  272. --Metadata Setup
  273. Meta.___Value = VEn_Value;
  274. Meta.___Path = VEn_Path;
  275. Meta.___IsLib = VEn_IsLib;
  276. Meta.___SubLib = VEn_SubLib;
  277. --Metamethod Setup
  278. Meta.__tostring = VEn_Meta.__tostring;
  279. Meta.__index = VEn_Meta.__index;
  280. Meta.__newindex = VEn_Meta.__newindex;
  281. Meta.__metatable = VEn_Meta.__metatable;
  282. --Linking Proxy To Meta
  283. VEn_References[Proxy] = Meta;
  284. return Proxy;
  285. end
  286.  
  287. --Initial Library
  288. local function VCf_GetEnumValue(Proxy)
  289. return VEn_References[Proxy].___Value;
  290. end
  291. local function VCf_IsEnum(Proxy)
  292. return (VEn_References[Proxy] ~= nil);
  293. end
  294. local function VCf_GetEnumMeta(Proxy)
  295. return VEn_References[Proxy];
  296. end
  297. local function VCf_GetEnumLValue(L, V)
  298. if VCf_IsEnum(V) then
  299. return VCf_GetEnumValue(V);
  300. end;
  301. return VEn_Data[L][V];
  302. end
  303. --This may look complicated but it's not.
  304. --This is just calling VEn_Create() to make the Proxy versions of VEnums.
  305.  
  306. --Setup
  307. --SliderType
  308. VEn_Data.SliderType = VEn_Data.CornerType;
  309.  
  310. local VLb_Enums = VEn_Create({
  311. CornerType = VEn_Create({
  312. Sharp = VEn_Create(VEn_Data.CornerType.Sharp, "VLb_Enums.CornerType.Sharp", false, "CornerType"),
  313. Smooth = VEn_Create(VEn_Data.CornerType.Smooth, "VLb_Enums.CornerType.Smooth", false, "CornerType"),
  314. Edged = VEn_Create(VEn_Data.CornerType.Edged, "VLb_Enums.CornerType.Edged", false, "CornerType")
  315. }, "VLb_Enums.CornerType", true, "VLb_Enums"),
  316. SliderType = VEn_Create({
  317. Box = VEn_Create(VEn_Data.SliderType.Sharp, "VLb_Enums.SliderType.Box", false, "SliderType"),
  318. Round = VEn_Create(VEn_Data.SliderType.Smooth, "VLb_Enums.SliderType.Round", false, "SliderType"),
  319. Diamond = VEn_Create(VEn_Data.SliderType.Edged, "VLb_Enums.SliderType.Diamond", false, "SliderType"),
  320. Custom = VEn_Create(VEn_Data.SliderType.None, "VLb_Enums.SliderType.Custom", false, "SliderType")
  321. }, "VLb_Enums.SliderType", true, "VLb_Enums"),
  322. MetroLocation = VEn_Create({
  323. TopLeft = VEn_Create(VEn_Data.MetroLocation.TopLeft, "VLb_Enums.MetroLocation.TopLeft", false, "MetroLocation"),
  324. TopCenter = VEn_Create(VEn_Data.MetroLocation.TopCenter, "VLb_Enums.MetroLocation.TopCenter", false, "MetroLocation"),
  325. TopRight = VEn_Create(VEn_Data.MetroLocation.TopRight, "VLb_Enums.MetroLocation.TopRight", false, "MetroLocation"),
  326. LeftTop = VEn_Create(VEn_Data.MetroLocation.LeftTop, "VLb_Enums.MetroLocation.LeftTop", false, "MetroLocation"),
  327. LeftCenter = VEn_Create(VEn_Data.MetroLocation.LeftCenter, "VLb_Enums.MetroLocation.LeftCenter", false, "MetroLocation"),
  328. LeftBottom = VEn_Create(VEn_Data.MetroLocation.LeftBottom, "VLb_Enums.MetroLocation.LeftBottom", false, "MetroLocation"),
  329. RightTop = VEn_Create(VEn_Data.MetroLocation.RightTop, "VLb_Enums.MetroLocation.RightTop", false, "MetroLocation"),
  330. RightCenter = VEn_Create(VEn_Data.MetroLocation.RightCenter, "VLb_Enums.MetroLocation.RightCenter", false, "MetroLocation"),
  331. RightBottom = VEn_Create(VEn_Data.MetroLocation.RightBottom, "VLb_Enums.MetroLocation.RightBottom", false, "MetroLocation"),
  332. BottomLeft = VEn_Create(VEn_Data.MetroLocation.BottomLeft, "VLb_Enums.MetroLocation.BottomLeft", false, "MetroLocation"),
  333. BottomCenter = VEn_Create(VEn_Data.MetroLocation.BottomCenter, "VLb_Enums.MetroLocation.BottomCenter", false, "MetroLocation"),
  334. BottomRight = VEn_Create(VEn_Data.MetroLocation.BottomRight, "VLb_Enums.MetroLocation.BottomRight", false, "MetroLocation")
  335. }, "VLb_Enums.MetroLocation", true, "VLb_Enums"),
  336. CheckBoxType = VEn_Create({
  337. Sharp = VEn_Create(VEn_Data.CheckBoxType.Sharp, "VLb_Enums.CheckBoxType.Sharp", false, "CheckBoxType"),
  338. Smooth = VEn_Create(VEn_Data.CheckBoxType.Smooth, "VLb_Enums.CheckBoxType.Smooth", false, "CheckBoxType"),
  339. Circular = VEn_Create(VEn_Data.CheckBoxType.Circular, "VLb_Enums.CheckBoxType.Circular", false, "CheckBoxType"),
  340. Diamond = VEn_Create(VEn_Data.CheckBoxType.Diamond, "VLb_Enums.CheckBoxType.Diamond", false, "CheckBoxType"),
  341. Custom = VEn_Create(VEn_Data.CheckBoxType.None, "VLb_Enums.CheckBoxType.Custom", false, "CheckBoxType")
  342. }, "VLb_Enums.CheckBoxType", true, "VLb_Enums"),
  343. FillBoxType = VEn_Create({
  344. Sharp = VEn_Create(VEn_Data.FillBoxType.Sharp, "VLb_Enums.FillBoxType.Sharp", false, "FillBoxType"),
  345. Smooth = VEn_Create(VEn_Data.FillBoxType.Smooth, "VLb_Enums.FillBoxType.Smooth", false, "FillBoxType"),
  346. Circular = VEn_Create(VEn_Data.FillBoxType.Circular, "VLb_Enums.FillBoxType.Circular", false, "FillBoxType")
  347. }, "VLb_Enums.FillBoxType", true, "VLb_Enums"),
  348. NotificationType = VEn_Create({
  349. Info = VEn_Create(VEn_Data.NotificationType.Info, "VLb_Enums.NotificationType.Info", false, "NotificationType"),
  350. Error = VEn_Create(VEn_Data.NotificationType.Error, "VLb_Enums.NotificationType.Error", false, "NotificationType"),
  351. None = VEn_Create(VEn_Data.NotificationType.None, "VLb_Enums.NotificationType.None", false, "NotificationType")
  352. }, "VLb_Enums.NotificationType", true, "VLb_Enums")
  353. }, "VLb_Enums", true);
  354.  
  355.  
  356. local VCv_Data = {};
  357. local VLb_ColorVariants = {
  358. LinkFunction = function(Proxy, Object, Field)
  359. if type(Object) ~= "userdata" and type(Object) ~= "table" then
  360. error("Arg#2 must be a userdata/table (Usually VeraniumInstances.)");
  361. end;
  362. if type(Field) ~= "string" then
  363. error("Arg#3 must be a string. (Resembles the varying field.)");
  364. end;
  365. local Meta = VCv_Data[Proxy];
  366. if type(Meta) == "table" and type(Meta.___Linked) == "table" then
  367. local Linked = Meta.___Linked;
  368. if type(Linked[Object]) == "table" then
  369. Object[Field] = Meta.___Value.Value;
  370. Linked[Object][Field] = true;
  371. else
  372. Object[Field] = Meta.___Value.Value;
  373. Linked[Object] = {
  374. [Field] = true
  375. };
  376. end;
  377. else
  378. error("Arg#1 is not a VCv. (This could be because you're using '.' instead of ':'.)");
  379. end;
  380. end,
  381. UnlinkFunction = function(Proxy, Object, Field, NoErrors)
  382. if type(Object) ~= "userdata" and type(Object) ~= "table" then
  383. error("Arg#2 must be a userdata/table (Usually VeraniumInstances.)");
  384. end;
  385. if type(Field) ~= "string" then
  386. error("Arg#3 must be a string. (Resembles the varying field.)");
  387. end;
  388. local Meta = VCv_Data[Proxy];
  389. if type(Meta) == "table" and type(Meta.___Linked) == "table" then
  390. local Linked = Meta.___Linked;
  391. if type(Linked[Object]) == "table" then
  392. Linked[Object][Field] = nil;
  393. elseif not NoErrors then
  394. error("This Object wasn't linked.");
  395. else return;
  396. end;
  397. else
  398. error("Arg#1 is not a VCv. (This could be because you're using '.' instead of ':'.)");
  399. end;
  400. end,
  401. RemoveVariant = function(Proxy)
  402. local Meta = VCv_Data[Proxy];
  403. if type(Meta) == "table" then
  404. VCv_Data[Proxy] = nil;
  405. Meta.___Connection:Disconnect();
  406. Meta.___Value:Remove();
  407. Meta.___Value:Destroy();
  408. Meta.___Tweens = nil;
  409. Meta.___Linked = nil;
  410. Meta.___On = false;
  411. Meta.___Removed = true;
  412. Meta.___ColorCycle = nil;
  413. else
  414. error("OwO what's this? (Incorrect Meta).");
  415. end;
  416. end
  417. };
  418. local VCv_Meta = {
  419. __tostring = function(Proxy)
  420. if type(VCv_Data[Proxy]) == "table" then
  421. return "VeraniumColorVariant";
  422. else
  423. error("OwO what's this? (Incorrect Meta).");
  424. end;
  425. end,
  426. __index = function(Proxy, Field)
  427. local Meta = VCv_Data[Proxy];
  428. if type(Meta) == "table" then
  429. local Value = Meta["___"..Field];
  430. if Value and Field ~= "Linked" and Field ~= "Tweens" then
  431. return Value;
  432. elseif Field == "Link" then
  433. return VLb_ColorVariants.LinkFunction;
  434. elseif Field == "Unlink" then
  435. return VLb_ColorVariants.UnlinkFunction;
  436. elseif Field == "Remove" or Field == "Destroy" then
  437. return VLb_ColorVariants.RemoveVariant;
  438. else
  439. return error("Attempt to index field '"..Field.."'.");
  440. end;
  441. else
  442. error("OwO what's this? (Incorrect Meta)");
  443. end;
  444. end,
  445. __newindex = function(Proxy, Field, Value)
  446. local Meta = VCv_Data[Proxy];
  447. if type(Meta) == "table" then
  448. if Field == "On" then
  449. if type(Value) ~= "boolean" then
  450. return error("Invalid property type. (Expected boolean, got "..typeof(Value)..")");
  451. end;
  452. Meta.___On = Value;
  453. return;
  454. end;
  455. error("ColorVariants cannot be modified after creation.");
  456. else
  457. error("OwO what's this? (Incorrect Meta.)");
  458. end;
  459. end,
  460. __metatable = "I-... I can't let you see that! >///<"--No Context x2 uwu
  461. }
  462.  
  463. local function VCv_Create(EasingStyle, EasingDirection, Interval, ...)
  464. local VCv_Cycle = {...};
  465. --Type Checks | EasingStyle
  466. if typeof(EasingStyle) == "EnumItem" then
  467. if not string.find(tostring(EasingStyle), "Enum.EasingStyle.") then
  468. error("Arg#1 Must Be A Color3 Or An EasingStyle.");
  469. end;
  470. elseif typeof(EasingStyle) == "Color3" then
  471. table.insert(VCv_Cycle, 1, EasingStyle);
  472. EasingStyle = Enum.EasingStyle.Sine;
  473. else
  474. error("Arg#1 Must Be A Color3 Or An EasingStyle.");
  475. end;
  476. --Type Checks | EasingDirection
  477. if typeof(EasingDirection) == "EnumItem" then
  478. if not string.find(tostring(EasingDirection), "Enum.EasingDirection.") then
  479. error("Arg#2 Must Be A Color3 Or An EasingDirection.");
  480. end;
  481. elseif typeof(EasingDirection) == "Color3" then
  482. table.insert(VCv_Cycle, 2, EasingDirection);
  483. EasingDirection = Enum.EasingDirection.Out;
  484. else
  485. error("Arg#2 Must Be A Color3 Or An EasingDirection.");
  486. end;
  487. --Type Checks | Interval
  488. if typeof(Interval) == "Color3" or Interval == nil then
  489. table.insert(VCv_Cycle, 3, Interval);
  490. Interval = 1;
  491. elseif type(Interval) ~= "number" then
  492. error("Arg#3 Must Be A Color3 Or A Number.");
  493. end;
  494. if #VCv_Cycle < 2 then
  495. error("There Must Be At Least 2 Colors In The Cycle.");
  496. end;
  497. VCf_SetReadOnly(VCv_Cycle);
  498. --Proxy Creation
  499. local Proxy = newproxy(true);
  500. local Meta = getmetatable(Proxy);
  501. local Tweens = {};
  502. local Linked = {};
  503. local Base = Instance.new("Color3Value");
  504. Base.Value = VCv_Cycle[1];
  505. Base.Name = _PREFIX.."VeraniumColorVariantBase";
  506. --Metatable Setup
  507. Meta.___EasingStyle = EasingStyle;
  508. Meta.___EasingDirection = EasingDirection;
  509. Meta.___Interval = Interval;
  510. Meta.___ColorCycle = VCv_Cycle;
  511. Meta.___On = true;
  512. Meta.___Value = Base;
  513. Meta.___Linked = Linked;
  514. Meta.___Tweens = Tweens;
  515. Meta.___Removed = false;
  516. Meta.___Connection = Base.Changed:Connect(function()
  517. local Color = Base.Value;
  518. if Meta.___On then
  519. for Object, Fields in pairs(Linked)do
  520. for Field, _ in pairs(Fields)do
  521. if _ then
  522. Object[Field] = Color;
  523. end;
  524. end;
  525. end;
  526. end;
  527. end);
  528. --Metamethod Setup
  529. Meta.__tostring = VCv_Meta.__tostring;
  530. Meta.__index = VCv_Meta.__index;
  531. Meta.__newindex = VCv_Meta.__newindex;
  532. Meta.__metatable = VCv_Meta.__metatable;
  533. --Linking Proxy To Meta
  534. VCv_Data[Proxy] = Meta;
  535. --Creating Tweens
  536. for _, Color in pairs(VCv_Cycle)do
  537. table.insert(Tweens, TweenService:Create(Base, TweenInfo.new(
  538. Interval,
  539. EasingStyle,
  540. EasingDirection,
  541. 0,
  542. false,
  543. 0
  544. ), {
  545. Value = Color,nil
  546. }));
  547. end;
  548. spawn(function()
  549. while not Meta.___Removed do
  550. if Meta.___On then
  551. for _, Tween in pairs(Tweens)do
  552. if Meta.___On then
  553. Tween:Play();
  554. wait(Interval);
  555. end;
  556. end;
  557. else
  558. wait(Interval);
  559. end;
  560. end;
  561. Linked = nil;
  562. Tweens = nil;
  563. VCv_Cycle = nil;
  564. end);
  565. return Proxy;
  566. end;
  567. VLb_ColorVariants.Create = VCv_Create;
  568. VCf_SetReadOnly(VLb_ColorVariants);
  569.  
  570. --Libraries | ModernColors | Source: https://flatuicolors.com/
  571. local VLb_ModernColors = {
  572. DimMidnightBlue = Color3.fromRGB(32, 34, 37),
  573. MidnightBlue = Color3.fromRGB(47, 49, 54),
  574. LightMidnightBlue = Color3.fromRGB(54, 57, 63),
  575. WetAsphalt = Color3.fromRGB(44, 62, 80),
  576. Asphalt = Color3.fromRGB(52, 73, 94),
  577. Midnight = Color3.fromRGB(47, 53, 66),
  578. ElectricBlue = Color3.fromRGB(52, 152, 219),
  579. Blurple = Color3.fromRGB(72, 52, 212),
  580. Exodus = Color3.fromRGB(104, 109, 224),
  581. Komaru = Color3.fromRGB(48, 51, 107),
  582. DimKomaru = Color3.fromRGB(19, 15, 64),
  583. LightExodus = Color3.fromRGB(126, 214, 223),
  584. Amythest = Color3.fromRGB(155, 89, 182),
  585. Wisteria = Color3.fromRGB(142, 68, 173),
  586. Emerald = Color3.fromRGB(46, 204, 113),
  587. Carrot = Color3.fromRGB(230, 126, 34),
  588. Orange = Color3.fromRGB(243, 156, 18),
  589. SunFlower = Color3.fromRGB(241, 196, 15),
  590. Ruby = Color3.fromRGB(231, 76, 60),
  591. Rose = Color3.fromRGB(192, 57, 43),
  592. LightPink = Color3.fromRGB(255, 121, 121),
  593. DimPink = Color3.fromRGB(235, 77, 75),
  594. Pink = Color3.fromRGB(224, 86, 253),
  595. SteelPink = Color3.fromRGB(224, 86, 253),
  596. Light = Color3.fromRGB(213, 217, 255),
  597. Cloud = Color3.fromRGB(236, 240, 241),
  598. Silver = Color3.fromRGB(189, 195, 199),
  599. Concrete = Color3.fromRGB(149, 165, 166),
  600. Abestos = Color3.fromRGB(127, 140, 141)
  601. };
  602.  
  603. --Veranium Defaults Library.
  604. --This is used to define defaults for VIn Objects.
  605. local VLb_Defaults = {
  606. --Background:Corners
  607. CornerSize = 6,
  608. CornerType = VLb_Enums.CornerType.Smooth,
  609. --Background:Self
  610. BackgroundColor = VLb_ModernColors.MidnightBlue,
  611. BackgroundTransparency = 0,
  612. --Background:Borders
  613. BorderSize = 0,
  614. BorderColor = Color3.new(0, 0, 0),
  615. BorderTransparency = 1,
  616. --Text Properties
  617. TextColor = VLb_ModernColors.Silver,
  618. TextTransparency = 0,
  619. Font = Enum.Font.Legacy,
  620. --Text:Stroke
  621. TextStrokeColor = VLb_ModernColors.Abestos,
  622. TextStrokeTransparency = 1,
  623. --Text:Alignment
  624. TextXAlignment = Enum.TextXAlignment.Center,
  625. TextYAlignment = Enum.TextYAlignment.Center,
  626. --Text:Placeholder
  627. PlaceholderColor = VLb_ModernColors.Silver,
  628. --Global
  629. ZIndex = 1,
  630. SecondaryColor = VLb_ModernColors.DimMidnightBlue,
  631. HighlightColor = VLb_ModernColors.ElectricBlue,
  632. MetroStyle = true
  633. };
  634.  
  635. local VIn_References = {};--Stores refrences by proxies as keys.
  636. local VIn_Data = {};--Contains data for different instances, such as their Propeties, TypeLocks, & so on.
  637. local VIn_ParseD = {};--Contains all proxies created by Veranium by MainInstances as keys.
  638. local VIn_Methods = {};--Contains most common methods for VeraniumInstances.
  639. local VIn_SReg = {};--Contains frequently used tables/proxies. Exists to stop the creation of new tables/proxies.(SReg = Secondary Registry).
  640. local VIn_Meta = {};--Main metatable for VeraniumInstances.
  641.  
  642. local function GetMeta(Proxy)--Gets the metatable of Veranium Proxies, ignoring __metatable.
  643. return VIn_References[Proxy];
  644. end;
  645.  
  646. local VCn_Main = function(Class, ...)--Main Constructor. Usef for Veranium.Create.
  647. local Constructor = VIn_Data[Class];
  648. if type(Constructor) == "table" then
  649. Constructor = Constructor.Constructor;
  650. if type(Constructor) == "function" then
  651. local Proxy = Constructor(...);
  652. local Meta = GetMeta(Proxy);
  653. VIn_ParseD[Proxy] = Meta.___Instance;
  654. return Proxy;
  655. else
  656. return error("Unable to create Instance of type "..tostring(Class));
  657. end;
  658. else
  659. return error("Unable to create Instance of type "..tostring(Class));
  660. end;
  661. end;
  662.  
  663. local function GetInstance(Object)
  664. if not Object then return nil end;
  665. if typeof(Object) == "Instance" then return Object end;
  666. local Meta = VIn_References[Object];
  667. if type(Meta) == "table" and typeof(Meta.___Instance) == "Instance" then
  668. return Meta.___Instance;
  669. end;
  670. return nil;
  671. end;
  672.  
  673. local function GetPInstance(Object)
  674. if not Object then return nil end;
  675. if typeof(Object) == "Instance" then return Object end;
  676. local Meta = VIn_References[Object];
  677. if type(Meta) == "table" and typeof(Meta.___Instance) == "Instance" then
  678. if Meta.___Children then
  679. return Meta.___Children;
  680. end;
  681. return Meta.___Instance;
  682. end;
  683. return nil;
  684. end;
  685.  
  686. local function VCf_ParseInstance(Object, RemoveJunk)
  687. if typeof(Object) ~= "Instance" then
  688. return error("Invalid type for Argument #1: Instance expected, got "..typeof(Object)..".");
  689. end
  690. if VIn_ParseD[Object] then
  691. if RemoveJunk then
  692. if not string.find(Object.Name, _PREFIX) then
  693. return VIn_ParseD[Object];
  694. end;
  695. else
  696. return VIn_ParseD[Object];
  697. end;
  698. end;
  699. return Object;
  700. end;
  701.  
  702. local function VCf_IsVera(Object)
  703. return (VIn_References[Object] ~= nil);
  704. end;
  705.  
  706. local function VCf_AssertIsVera(Object, ArgN)--Makes it easy for me to say: error if Proxy isn't Veranium. ArgN = Argument Number.
  707. if not VIn_References[Object] then
  708. error("Expected VeraniumInstance for arg#"..tostring(ArgN or 1)..". got "..typeof(Object).." (Object might be destroyed).");
  709. end;
  710. end;
  711.  
  712.  
  713. --metatable Setup.
  714. --__tostring
  715. VIn_Meta.__tostring = function(self)
  716. VCf_AssertIsVera(self);
  717. local Meta = GetMeta(self);
  718. local Fields = Meta.___Fields;
  719. local Object = GetInstance(self);
  720. --Instance Name tostring
  721. if typeof(Object) == "Instance" then
  722. if Object.Name:find(_PREFIX) then
  723. return Object.Name:sub(#_PREFIX+1, -1);
  724. else
  725. return Object.Name;
  726. end;
  727. end;
  728. --Field tostring
  729. if Fields and Fields.Name then
  730. return Fields.Name;
  731. elseif Fields and Fields.ClassName then--ClassName tostring
  732. return Fields.ClassName;
  733. end;
  734. --Exception tostring
  735. return "VeraniumInstance";
  736. end;
  737.  
  738. --__index
  739. VIn_Meta.__index = function(self, Field)
  740. local Meta = GetMeta(self);
  741. if (Field == "Destructor" or Field == "Destroy" or Field == "Remove") then
  742. return VCf_Destructor;
  743. elseif Field == "IsDestroyed" then
  744. return not VCf_IsVera(self);
  745. else
  746. VCf_AssertIsVera(self);
  747. end;
  748. local Fields = Meta.___Fields;
  749. local MetaData = Meta.___MetaData;
  750. if MetaData then
  751. --Changed Idx
  752. if Field == "Changed" then
  753. return Meta.___ChangeSignal.Event;
  754. end;
  755. --Method Idx
  756. if VIn_Methods[Field] then
  757. return VIn_Methods[Field];
  758. end;
  759. --Property Idx
  760. local Route = MetaData.Routing[Field];
  761. local IVRouting = VIn_SReg.IVRouting[Field];
  762. if MetaData.Fields[Field] then
  763. return Fields[Field];
  764. end;
  765. --Routing Idx
  766. if type(Route) == "string" then
  767. return self[Route];
  768. elseif type(Route) == "table" then
  769. return Meta[Route.RouteInstance][Route.RouteField];
  770. end;
  771. --IVRouting Idx
  772. if type(IVRouting) == "string" then
  773. IVRouting = Meta[IVRouting]
  774. if IVRouting then
  775. return IVRouting[Field];
  776. end;
  777. end;
  778. --Children Idx
  779. local Object = GetInstance(self);
  780. if typeof(Object) == "Instance" then
  781. local Child = Object:FindFirstChild(Field);
  782. if Child then
  783. return VCf_ParseInstance(Child);
  784. end;
  785. end;
  786. --Exception Error
  787. error("Unable to index VeraniumInstance with '"..tostring(Field).."'");
  788. else
  789. error("Unable to get MetaData. [001]");
  790. end;
  791. error("Unable to index VeraniumInstance with '"..tostring(Field).."'");
  792. end;
  793.  
  794. --__newindex
  795. VIn_Meta.__newindex = function(self, Field, Value)
  796. VCf_AssertIsVera(self);
  797. local Meta = GetMeta(self);
  798. local Fields = Meta.___Fields;
  799. local MetaData = Meta.___MetaData;
  800. if MetaData then
  801. local Route = MetaData.Routing[Field];
  802. local IVRouting = VIn_SReg.IVRouting[Field];
  803. local FieldData = MetaData.Fields[Field];
  804. local ReadOnly;
  805. if FieldData then
  806. ReadOnly = (FieldData:sub(3, 3) == "\1");
  807. end;
  808. --Direct Ndx
  809. if FieldData and not ReadOnly then
  810. if not VCf_IsA(Value, FieldData) then
  811. return error("Invalid type for "..Field..". ("..FieldData:sub(4, -1).." expected, got "..typeof(Value)..").");
  812. end;
  813. if Field == "Parent" then
  814. Meta.___Instance.Parent = GetPInstance(Value);
  815. end;
  816. Fields[Field] = Value;
  817. MetaData.Redraw(self, Field, Value);
  818. if Meta.___ChangeSignal then
  819. Meta.___ChangeSignal:Fire(Field, Value);
  820. end;
  821. return;
  822. elseif FieldData and ReadOnly then
  823. error(Field.." is read-only.");
  824. end;
  825. --Routing Ndx
  826. if type(Route) == "string" then
  827. self[Route] = Value
  828. if Meta.___ChangeSignal then
  829. Meta.___ChangeSignal:Fire(Field, Value);
  830. end;
  831. return
  832. elseif type(Route) == "table" then
  833. Meta[Route.RouteInstance][Route.RouteField] = Value
  834. if Meta.___ChangeSignal then
  835. Meta.___ChangeSignal:Fire(Field, Value);
  836. end;
  837. return;
  838. end;
  839. --IVRouting Ndx
  840. if typeof(IVRouting) == "string" then
  841. IVRouting = Meta[IVRouting]
  842. if IVRouting then
  843. IVRouting[Field] = Value
  844. if Meta.___ChangeSignal then
  845. Meta.___ChangeSignal:Fire(Field, Value);
  846. end;
  847. return;
  848. end;
  849. end;
  850. --Exceptional Error
  851. error("Unable to index VeraniumInstance with '"..tostring(Field).."'");
  852. end;
  853. end;
  854.  
  855. --metatable Protection
  856. VIn_Meta.__metatable = "Hewo, can you pwease not cwash Vewanium? uwu";
  857.  
  858.  
  859. --Inputs
  860. local function VIn_CreateClass(ClassName, Fields, Routing, Constructor, Redraw, Methods)
  861. local ClassData = {};
  862. VIn_Data[ClassName] = ClassData;
  863. --Fields
  864. ClassData.Fields = Fields;
  865. --Routing
  866. ClassData.Routing = Routing;
  867. --Constructor
  868. ClassData.Constructor = Constructor;
  869. --Redraw
  870. if type(Redraw) == "function" then
  871. ClassData.Redraw = Redraw;
  872. elseif type(Redraw) == "table" then
  873. ClassData.Redraw = function(self, Field, Value)
  874. if Field == nil then
  875. for Idx, Function in pairs(Redraw) do
  876. if Idx == "Main" then
  877. Function(self, Field, Value);
  878. else
  879. Function(self, Value);
  880. end;
  881. end;
  882. return;
  883. end;
  884. if type(Redraw[Field]) == "function" then
  885. return Redraw[Field](self, Value);
  886. elseif type(Redraw.Main) == "function" then
  887. return Redraw.Main(self, Field, Value);
  888. end;
  889. end;
  890. end;
  891. --Methods Implement
  892. if Methods then
  893. for MethodName, Method in pairs(Methods)do
  894. ClassData[MethodName] = Method;
  895. end;
  896. end;
  897.  
  898. return ClassData;
  899. end;
  900.  
  901. local function VIn_CreateInstance(MetaData)
  902. local Proxy = newproxy(true);
  903. local Meta = getmetatable(Proxy);
  904. local ChangeSignal = Instance.new("BindableEvent");
  905. local Fields = {};
  906. ChangeSignal.Name = "VeraniumChangeSignal";
  907. Meta.___MetaData = MetaData;
  908. Meta.__index = VIn_Meta.__index;
  909. Meta.__newindex = VIn_Meta.__newindex;
  910. Meta.__tostring = VIn_Meta.__tostring;
  911. Meta.__metatable = VIn_Meta.__metatable;
  912. VIn_References[Proxy] = Meta;
  913. Meta.___Fields = Fields;
  914. Meta.___ChangeSignal = ChangeSignal;
  915. return Proxy, Meta, Fields, ChangeSignal;
  916. end;
  917.  
  918. --VIn_SReg IVRouting Setup
  919. VIn_SReg.IVRouting = {
  920. --Properties
  921. --Base2D
  922. AbsolutePosition = "___Base2D",
  923. AbsoluteRotation = "___Base2D",
  924. AbsoluteSize = "___Base2D",
  925. Active = "___Base2D",
  926. AnchorPoint = "___Base2D",
  927. ClipsDescendants = "___Base2D",
  928. LayoutOrder = "___Base2D",
  929. Position = "___Base2D",
  930. Rotation = "___Base2D",
  931. Size = "___Base2D",
  932. SizeConstraint = "___Base2D",
  933. Visible = "___Base2D",
  934. ZIndex = "___Base2D",
  935. Parent = "___Base2D",
  936. Name = "___Base2D",
  937.  
  938. --TextRender
  939. Font = "___TextRender",
  940. LineHeight = "___TextRender",
  941. LocalizedText = "___TextRender",
  942. Text = "___TextRender",
  943. TextBounds = "___TextRender",
  944. TextColor3 = "___TextRender",
  945. TextFits = "___TextRender",
  946. TextScaled = "___TextRender",
  947. TextSize = "___TextRender",
  948. TextStrokeColor3 = "___TextRender",
  949. TextStrokeTransparency = "___TextRender",
  950. TextTransparency = "___TextRender",
  951. TextTruncate = "___TextRender",
  952. TextWrapped = "___TextRender",
  953. TextXAlignment = "___TextRender",
  954. TextYAlignment = "___TextRender",
  955.  
  956. --ImageRender
  957. HoverImage = "___ImageRender",
  958. Image = "___ImageRender",
  959. ImageColor3 = "___ImageRender",
  960. ImageRectOffset = "___ImageRender",
  961. ImageRectSize = "___ImageRender",
  962. ImageTransparency = "___ImageRender",
  963. IsLoaded = "___ImageRender",
  964. PressedImage = "___ImageRender",
  965. ScaleType = "___ImageRender",
  966. SliceCenter = "___ImageRender",
  967. SliceScale = "___ImageRender",
  968. TileSize = "___ImageRender",
  969.  
  970. --TextBox
  971. IsFocused = "___TextBox",
  972. PlaceholderColor3 = "___TextBox",
  973. PlaceholderText = "___TextBox",
  974. ClearTextOnFocus = "___TextBox",
  975. TextEditable = "___TextBox",
  976. CursorPosition = "___TextBox",
  977. SelectionStart = "___TextBox",
  978. Selectable = "___TextBox",
  979.  
  980. --Background
  981. Color = "___Background",
  982. BackgroundColor = "___Background",
  983. BackgroundColor3 = "___Background",
  984. BackgroundTransparency = "___Background",
  985. Transparency = "___Background",
  986. Type = "___Background",
  987. CornerType = "___Background",
  988. CornerSize = "___Background",
  989. TopLeft = "___Background",
  990. TopBorder = "___Background",
  991. TopRight = "___Background",
  992. LeftBorder = "___Background",
  993. RightBorder = "___Background",
  994. BottomLeft = "___Background",
  995. BottomBorder = "___Background",
  996. BottomRight = "___Background",
  997.  
  998. BorderSizePixel = "___Background",
  999. BorderSize = "___Background",
  1000. BorderColor3 = "___Background",
  1001. BorderColor = "___Background",
  1002. BorderTransparency = "___Background",
  1003.  
  1004. --Methods
  1005. --Background
  1006. CreateBorder = "___Background",
  1007. --Base2D
  1008. TweenPosition = "___Base2D",
  1009. TweennSize = "___Base2D",
  1010. TweenSizeAndPosition = "___Base2D",
  1011.  
  1012. --Hitbox
  1013. SetTextFromInput = "___CHitbox",
  1014.  
  1015. --TextBox
  1016. CaptureFocus = "___TextBox",
  1017. ReleaseFocus = "___TextBox",
  1018. --Signals
  1019. --Hitbox
  1020. MouseButton1Click = "___CHitbox",
  1021. MouseButton2Click = "___CHitbox",
  1022. MouseButton1Down = "___CHitbox",
  1023. MouseButton2Down = "___CHitbox",
  1024. MouseButton1Up = "___CHitbox",
  1025. MouseButton2Up = "___CHitbox",
  1026. MouseEnter = "___CHitbox",
  1027. MouseLeave = "___CHitbox",
  1028. MouseMoved = "___CHitbox",
  1029. MouseWheelBackward = "___Base2D",
  1030. MouseWheelForward = "___Base2D",
  1031. InputBegan = "___CHitbox",
  1032. InputEnded = "___CHitbox",
  1033. InputChanged = "___CHitbox",
  1034.  
  1035. --Textbox
  1036. Focused = "___TextBox",
  1037. FocusLost = "___TextBox"
  1038. };
  1039.  
  1040. --VIn_SReg OffsetMap Setup
  1041. VIn_SReg.OffsetMap = {
  1042. [0] = {
  1043. AnchorPoint = Vector2.new(1, 1),
  1044. Position = UDim2.new(0, 0, 0, 0),
  1045. SizeConstraint = Vector2.new(0, 0),
  1046. ImageRectSize = Vector2.new(400, 400),
  1047. ImageRectOffset = Vector2.new(0, 0),
  1048. Name = "TopLeft"
  1049. },
  1050. [1] = {
  1051. AnchorPoint = Vector2.new(0.5, 1),
  1052. Position = UDim2.new(0.5, 0, 0, 0),
  1053. SizeConstraint = Vector2.new(1, 0),
  1054. ImageRectSize = Vector2.new(1, 1),
  1055. ImageRectOffset = Vector2.new(399, 399),
  1056. Name = "TopCenter"
  1057. },
  1058. [2] = {
  1059. AnchorPoint = Vector2.new(0, 1),
  1060. Position = UDim2.new(1, 0, 0, 0),
  1061. SizeConstraint = Vector2.new(0, 0),
  1062. ImageRectSize = Vector2.new(400, 400),
  1063. ImageRectOffset = Vector2.new(400, 0),
  1064. Name = "TopRight"
  1065. },
  1066. [3] = {
  1067. AnchorPoint = Vector2.new(1, 0.5),
  1068. Position = UDim2.new(0, 0, 0.5, 0),
  1069. SizeConstraint = Vector2.new(0, 1),
  1070. ImageRectSize = Vector2.new(1, 1),
  1071. ImageRectOffset = Vector2.new(399, 399),
  1072. Name = "LeftCenter"
  1073. },
  1074. [4] = {
  1075. AnchorPoint = Vector2.new(0, 0.5),
  1076. Position = UDim2.new(1, 0, 0.5, 0),
  1077. SizeConstraint = Vector2.new(0, 1),
  1078. ImageRectSize = Vector2.new(1, 1),
  1079. ImageRectOffset = Vector2.new(399, 399),
  1080. Name = "RightCenter"
  1081. },
  1082. [5] = {
  1083. AnchorPoint = Vector2.new(1, 0),
  1084. Position = UDim2.new(0, 0, 1, 0),
  1085. SizeConstraint = Vector2.new(0, 0),
  1086. ImageRectSize = Vector2.new(400, 400),
  1087. ImageRectOffset = Vector2.new(0, 400),
  1088. Name = "BottomLeft"
  1089. },
  1090. [6] = {
  1091. AnchorPoint = Vector2.new(0.5, 0),
  1092. Position = UDim2.new(0.5, 0, 1, 0),
  1093. SizeConstraint = Vector2.new(1, 0),
  1094. ImageRectSize = Vector2.new(1, 1),
  1095. ImageRectOffset = Vector2.new(399, 399),
  1096. Name = "BottomCenter"
  1097. },
  1098. [7] = {
  1099. AnchorPoint = Vector2.new(0, 0),
  1100. Position = UDim2.new(1, 0, 1, 0),
  1101. SizeConstraint = Vector2.new(0, 0),
  1102. ImageRectSize = Vector2.new(400, 400),
  1103. ImageRectOffset = Vector2.new(400, 400),
  1104. Name = "BottomRight"
  1105. }
  1106. };
  1107.  
  1108. --[[Offset Map
  1109. ____________________
  1110. | |
  1111. |0 1 2|
  1112. | |
  1113. |3 4|
  1114. | |
  1115. |5 6 7|
  1116. |____________________|
  1117.  
  1118. Typelock Syntax
  1119.  
  1120. [Byte#]: Definer
  1121. [1]: VCf_IsA Instruction (Explained Below)
  1122. [2]: Nullable (Property can be NULL/NIL)
  1123. [3]: Read-Only (Property cannot be written to)
  1124. [4-#s]: Type DataString
  1125.  
  1126. VCf_IsA Instructions:
  1127. [0]: VEnum IsA (Checks if the value is a VEnum of the type provided in DataString)
  1128. [1]: VCv IsA (Checks if the value is a VeraniumColorVariant | Doesn't need a DataString)
  1129. [2]: BaseInstance IsA (BaseInstance = VeraniumProxy/RbxInstance | Doesn't need a DataString)
  1130. [3]: type() IsA (Checks the type() of the Value and compares it to DataString)
  1131. [4]: typeof() IsA (Check the typeof() of the Value and compares it to DataString)
  1132. [5]: Accepts all value types (No DataString needed)
  1133.  
  1134. All VCf_IsA Instructions could be altered by [Byte#2], Nullable.
  1135. No instruction uses [Byte#3]. It is only used by __newindex.
  1136. ]]
  1137.  
  1138. --VIn_SReg TransparencyLayer Setup
  1139. VIn_SReg.TransparencyLayer = {
  1140. VeraniumLabel = {"BackgroundTransparency", "TextTransparency"},
  1141. VeraniumButton = {"BackgroundTransparency", "TextTransparency"},
  1142. VeraniumTextBox = {"BackgroundTransparency", "TextTransparency"},
  1143.  
  1144. VeraniumSlider = {"BarTransparency", "MarkupTransparency"},
  1145. VeraniumCheckBox = {"StartBoxTransparency", "EndBoxTransparency", "StartCheckTransparency", "EndCheckTransparency"},
  1146. VeraniumFillBox = {"StartBoxTransparency", "EndBoxTransparency"},
  1147. VeraniumCounter = {"BackgroundTransparency", "SubtractTransparency", "AddTransparency"},
  1148. VeraniumDropdownBox = {"BackgroundTransparency", "TextTransparency"}
  1149. };
  1150.  
  1151. --ClassData Creations
  1152. --Boundary
  1153. VIn_CreateClass("Boundary",
  1154. {
  1155. BackgroundColor3 = "\4\0\0Color3",
  1156. BackgroundTransparency = "\3\0\0number",
  1157.  
  1158. Size = "\3\0\0number",
  1159. Offset = "\3\0\1number",
  1160.  
  1161. Background = "\2\1\1",
  1162. ClassName = "\3\0\1string",
  1163.  
  1164. Type = "\0\0\0CornerType",
  1165.  
  1166. --Border Properties
  1167. BorderColor3 = "\4\0\0Color3",
  1168. BorderTransparency = "\3\0\0number",
  1169. BorderSizePixel = "\3\0\0number",
  1170.  
  1171. --Methods
  1172. Redraw = "\3\0\1function",
  1173. Destructor = "\3\0\1function",
  1174. CreateBorder = "\3\0\1function"
  1175. },
  1176. {
  1177. BoundarySize = "Size",
  1178.  
  1179. BoundaryColor3 = "BackgroundColor3",
  1180. BoundaryColor = "BackgroundColor3",
  1181. Color = "BackgroundColor3",
  1182. --Color
  1183.  
  1184. BoundaryTransparency = "BackgroundTransparency",
  1185. Transparency = "BackgroundTransparency",
  1186. --Transparency
  1187.  
  1188. BorderColor = "BorderColor3",
  1189. BorderSize = "BorderSizePixel",
  1190. --Border
  1191. },
  1192. function(Background, Offset)
  1193. local BGMeta = GetMeta(Background);
  1194. if BGMeta and BGMeta.___Fields.ClassName == "VeraniumBoundary" then
  1195. Offset = Background.Offset;
  1196. end;
  1197. if type(Offset) ~= "number" then Offset = 0 end
  1198. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Boundary)
  1199. --Proxy Setup
  1200. Fields.BackgroundColor3 = VLb_Defaults.BackgroundColor;
  1201. Fields.BackgroundTransparency = VLb_Defaults.BackgroundTransparency;
  1202.  
  1203. Fields.Size = VLb_Defaults.CornerSize;
  1204. Fields.Offset = Offset or 0;
  1205.  
  1206. Fields.Background = Background;
  1207. Fields.ClassName = "VeraniumBoundary";
  1208.  
  1209. Fields.Type = VLb_Defaults.CornerType;
  1210.  
  1211. Fields.BorderColor3 = VLb_Defaults.BorderColor;
  1212. Fields.BorderTransparency = VLb_Defaults.BorderTransparency;
  1213. Fields.BorderSizePixel = VLb_Defaults.BorderSize;
  1214.  
  1215. --Methods Setup
  1216. Fields.CreateBorder = VIn_Data.Boundary.CreateBorder;
  1217. Fields.Redraw = VIn_Data.Boundary.Redraw;
  1218. --Defaults Setup
  1219. local Boundary = Instance.new("ImageLabel", GetInstance(Background));
  1220. local OffsetMap = VIn_SReg.OffsetMap[Offset or 0];
  1221. --Boundary Setup
  1222. Boundary.Name = _PREFIX..OffsetMap.Name.."Boundary";
  1223. Boundary.BackgroundTransparency = 1;
  1224. Boundary.AnchorPoint = OffsetMap.AnchorPoint;
  1225. Boundary.Position = OffsetMap.Position;
  1226. Boundary.BorderSizePixel = 0;
  1227. Boundary.ImageRectSize = OffsetMap.ImageRectSize;
  1228. Boundary.ImageRectOffset = OffsetMap.ImageRectOffset;
  1229. --ChangedSignal
  1230. Cs.Parent = Boundary;
  1231. --MetaData Setup
  1232. Meta.___Instance = Boundary;
  1233. Meta.___Base2D = Boundary;
  1234. --Border Linkage
  1235. if BGMeta and BGMeta.___Fields.ClassName == "VeraniumBoundary" then
  1236. Meta.IsBorder = true;
  1237. BGMeta.___Border = Boundary;
  1238. Boundary.Parent = Background.Background;
  1239. Boundary.Name = _PREFIX..OffsetMap.Name.."Border";
  1240. for Idx, Value in pairs(BGMeta.___Fields) do
  1241. Fields[Idx] = Value;
  1242. end;
  1243. Fields.CornerSize = Background.Size+Background.BorderSizePixel;
  1244. Fields.BackgroundColor3 = Background.BorderColor3;
  1245. Fields.BackgroundTransparency = Background.BorderTransparency;
  1246. Boundary.ZIndex = 0;
  1247.  
  1248. local function RefreshSize()
  1249. local OffsetMap = VIn_SReg.OffsetMap[Background.Offset];
  1250. local SizeConstraint = OffsetMap.SizeConstraint;
  1251. local BorderSizePixel = Background.BorderSizePixel + Background.Size;
  1252. Boundary.Size = UDim2.new(
  1253. SizeConstraint.X,
  1254. BorderSizePixel-(SizeConstraint.X*BorderSizePixel),
  1255. SizeConstraint.Y,
  1256. BorderSizePixel-(SizeConstraint.Y*BorderSizePixel)
  1257. );
  1258. end;
  1259.  
  1260. Background.Changed:Connect(function(Field)
  1261. if Field == "Size" or Field == "BorderSizePixel" then
  1262. RefreshSize();
  1263. elseif Field == "Type" then
  1264. Proxy.Type = Background.Type;
  1265. end;
  1266. end);
  1267.  
  1268. VIn_Data.Boundary.Redraw(Proxy);
  1269. Background:Redraw();
  1270. RefreshSize();
  1271. else
  1272. VIn_Data.Boundary.Redraw(Proxy);
  1273. end;
  1274.  
  1275. return Proxy;
  1276. end,
  1277. function(self, Field, Value)
  1278. --Setup
  1279. local Meta = GetMeta(self);
  1280. local Boundary = Meta.___Instance;
  1281. local Fields = Meta.___Fields;
  1282. local Border = Meta.___Border;
  1283. local IsBorder = Meta.IsBorder;
  1284. --Type
  1285. if Field == nil or Field == "Type" then
  1286. Boundary.Image = VCf_GetEnumLValue("CornerType", Fields.Type);
  1287. if Field then return; end;
  1288. end;
  1289. --BackgroundColor3
  1290. if Field == nil or Field == "BackgroundColor3" then
  1291. Boundary.ImageColor3 = Fields.BackgroundColor3;
  1292. if Field then return; end;
  1293. end;
  1294. --BackgroundTransparency
  1295. if Field == nil or Field == "BackgroundTransparency" then
  1296. Boundary.ImageTransparency = Fields.BackgroundTransparency;
  1297. if Field then return; end;
  1298. end;
  1299. --Size
  1300. if Field == nil or Field == "Size" and not IsBorder then
  1301. local OffsetMap = VIn_SReg.OffsetMap[Fields.Offset];
  1302. local SizeConstraint = OffsetMap.SizeConstraint;
  1303. Boundary.Size = UDim2.new(
  1304. SizeConstraint.X,
  1305. Fields.Size-(SizeConstraint.X*Fields.Size),
  1306. SizeConstraint.Y,
  1307. Fields.Size-(SizeConstraint.Y*Fields.Size)
  1308. );
  1309. if Field then return; end;
  1310. end;
  1311. --BorderColor3
  1312. if Field == nil or Field == "BorderColor3" then
  1313. if Border then
  1314. Border.ImageColor3 = Fields.BorderColor3;
  1315. if Field then return; end;
  1316. elseif Field then
  1317. return; --warn("This Boundary has no Border. Use CreateBorder() to make one.");
  1318. end;
  1319. end;
  1320. --BorderTransparency
  1321. if Field == nil or Field == "BorderTransparency" then
  1322. if Border then
  1323. Border.ImageTransparency = Fields.BorderTransparency;
  1324. if Field then return; end;
  1325. elseif Field then
  1326. return; --warn("This Boundary has no Border. Use CreateBorder() to make one.");
  1327. end;
  1328. end;
  1329. end,
  1330. {
  1331. CreateBorder = function(self, Core)
  1332. if Core then
  1333. return VIn_Data.Boundary.Constructor(self);
  1334. else
  1335. VIn_Data.Boundary.Constructor(self);
  1336. end;
  1337. end
  1338. }
  1339. );
  1340.  
  1341. VIn_CreateClass("Background",
  1342. {
  1343. BackgroundColor3 = "\4\0\0Color3";
  1344. BackgroundTransparency = "\3\0\0number",
  1345. CornerSize = "\3\0\0number",
  1346. Container = "\2\1\1",
  1347. ClassName = "\3\0\1string",
  1348. CornerType = "\0\0\0CornerType",
  1349.  
  1350. --Border Properties
  1351. BorderColor3 = "\4\0\0Color3",
  1352. BorderTransparency = "\3\0\0number",
  1353. BorderSizePixel = "\3\0\0number",
  1354.  
  1355. --Methods
  1356. Redraw = "\3\0\1function",
  1357. CreateBorder = "\3\0\1function",
  1358.  
  1359. TopLeft = "\2\1\1",
  1360. TopCenter = "\2\1\1",
  1361. TopRight = "\2\1\1",
  1362. LeftCenter = "\2\1\1",
  1363. RightCenter = "\2\1\1",
  1364. BottomLeft = "\2\1\1",
  1365. BottomCenter = "\2\1\1",
  1366. BottomRight = "\2\1\1"
  1367. --Boundaries
  1368. },
  1369. {
  1370. BoundarySize = "CornerSize",
  1371. BoundaryType = "CornerType",
  1372. Type = "CornerType",
  1373. --Boundary
  1374.  
  1375. BoundaryColor3 = "BackgroundColor3",
  1376. BoundaryColor = "BackgroundColor3",
  1377. Color = "BackgroundColor3",
  1378. --Color
  1379.  
  1380. BoundaryTransparency = "BackgroundTransparency",
  1381. Transparency = "BackgroundTransparency",
  1382. --Transparency
  1383.  
  1384. BorderColor = "BorderColor3",
  1385. BorderSize = "BorderSizePixel"
  1386. --Border
  1387. },
  1388. function(Container)
  1389. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Background);
  1390. --Proxy Setup
  1391. Fields.BackgroundColor3 = VLb_Defaults.BackgroundColor;
  1392. Fields.BackgroundTransparency = VLb_Defaults.BackgroundTransparency;
  1393. Fields.Container = Container;
  1394. Fields.ClassName = "VeraniumBackground";
  1395. Fields.CornerSize = VLb_Defaults.CornerSize;
  1396. Fields.CornerType = VLb_Defaults.CornerType;
  1397.  
  1398. Fields.BorderColor3 = VLb_Defaults.BorderColor;
  1399. Fields.BorderTransparency = VLb_Defaults.BorderTransparency;
  1400. Fields.BorderSizePixel = VLb_Defaults.BorderSize;
  1401.  
  1402. --Methods Setup
  1403. Fields.CreateBorder = VIn_Data.Background.CreateBorder;
  1404. Fields.Redraw = VIn_Data.Background.Redraw;
  1405. --Elements Creation
  1406. local Background = Instance.new("Frame", GetInstance(Container));
  1407. local TopLeft = VIn_Data.Boundary.Constructor(Background, 0);
  1408. local TopCenter = VIn_Data.Boundary.Constructor(Background, 1);
  1409. local TopRight = VIn_Data.Boundary.Constructor(Background, 2);
  1410. local LeftCenter = VIn_Data.Boundary.Constructor(Background, 3);
  1411. local RightCenter = VIn_Data.Boundary.Constructor(Background, 4);
  1412. local BottomLeft = VIn_Data.Boundary.Constructor(Background, 5);
  1413. local BottomCenter = VIn_Data.Boundary.Constructor(Background, 6);
  1414. local BottomRight = VIn_Data.Boundary.Constructor(Background, 7);
  1415. --Follow:Proxy Setup
  1416. Fields.TopLeft = TopLeft;
  1417. Fields.TopCenter = TopCenter;
  1418. Fields.TopRight = TopRight;
  1419. Fields.LeftCenter = LeftCenter;
  1420. Fields.RightCenter = RightCenter;
  1421. Fields.BottomLeft = BottomLeft;
  1422. Fields.BottomCenter = BottomCenter;
  1423. Fields.BottomRight = BottomRight;
  1424. --Background Setup
  1425. Background.Name = _PREFIX.."VeraniumBackground";
  1426. Background.BorderSizePixel = 0;
  1427. Background.AnchorPoint = Vector2.new(0.5, 0.5);
  1428. Background.Position = UDim2.new(0.5, 0, 0.5, 0);
  1429. --ChangedSignal
  1430. Cs.Parent = Background;
  1431. --MetaData Setup
  1432. Meta.___Instance = Background;
  1433. Meta.___Base2D = Background;
  1434. Meta.Boundaries = {
  1435. TopLeft = TopLeft,
  1436. TopCenter = TopCenter,
  1437. TopRight = TopRight,
  1438. LeftCenter = LeftCenter,
  1439. RightCenter = RightCenter,
  1440. BottomLeft = BottomLeft,
  1441. BottomCenter = BottomCenter,
  1442. BottomRight = BottomRight
  1443. };
  1444. --First Draw
  1445. VIn_Data.Background.Redraw(Proxy);
  1446.  
  1447. return Proxy;
  1448. end,
  1449. function(self, Field, Value)
  1450. --Setup
  1451. local Meta = GetMeta(self);
  1452. local Background = Meta.___Instance;
  1453. local Fields = Meta.___Fields;
  1454. local SetAll = VIn_Data.Background.SetAll;
  1455. --Type
  1456. if Field == nil or Field == "CornerType" then
  1457. SetAll(self, "Type", Fields.CornerType);
  1458. if Field then return; end;
  1459. end;
  1460. --Size
  1461. if Field == nil or Field == "CornerSize" then
  1462. Background.Size = UDim2.new(
  1463. 1,
  1464. -(Fields.CornerSize+Fields.BorderSizePixel)*2,
  1465. 1,
  1466. -(Fields.CornerSize+Fields.BorderSizePixel)*2
  1467. );
  1468. SetAll(self, "Size", Fields.CornerSize);
  1469. if Field then return; end;
  1470. end;
  1471. --BackgroundColor3
  1472. if Field == nil or Field == "BackgroundColor3" then
  1473. Background.BackgroundColor3 = Fields.BackgroundColor3;
  1474. SetAll(self, "BackgroundColor3", Fields.BackgroundColor3);
  1475. if Field then return; end;
  1476. end;
  1477. --BackgroundTransparency
  1478. if Field == nil or Field == "BackgroundTransparency" then
  1479. Background.BackgroundTransparency = Fields.BackgroundTransparency;
  1480. SetAll(self, "BackgroundTransparency", Fields.BackgroundTransparency);
  1481. if Field then return; end;
  1482. end;
  1483. --BorderColor3
  1484. if Field == nil or Field == "BorderColor3" then
  1485. SetAll(self, "BorderColor3", Fields.BorderColor3);
  1486. if Field then return; end;
  1487. end;
  1488. --BorderTransparency
  1489. if Field == nil or Field == "BorderTransparency" then
  1490. SetAll(self, "BorderTransparency", Fields.BorderTransparency);
  1491. if Field then return; end;
  1492. end;
  1493. --BorderSizePixel
  1494. if Field == nil or Field == "BorderSizePixel" then
  1495. Background.Size = UDim2.new(
  1496. 1,
  1497. -(Fields.CornerSize+Fields.BorderSizePixel)*2,
  1498. 1,
  1499. -(Fields.CornerSize+Fields.BorderSizePixel)*2
  1500. );
  1501. SetAll(self, "BorderSizePixel", Fields.BorderSizePixel);
  1502. if Field then return; end;
  1503. end;
  1504. end,
  1505. {
  1506. CreateBorder = function(self)
  1507. local Meta = GetMeta(self);
  1508. if Meta.___Background then
  1509. self = Meta.___Background;
  1510. Meta = GetMeta(self);
  1511. end;
  1512. if type(Meta) == "table" and type(Meta.Boundaries) == "table" then
  1513. for Idx, Boundary in pairs(Meta.Boundaries)do
  1514. Boundary:CreateBorder();
  1515. end;
  1516. end;
  1517. end,
  1518. SetAll = function(self, Field, Value)
  1519. local Meta = GetMeta(self);
  1520. if type(Meta) == "table" and type(Meta.Boundaries) == "table" then
  1521. for Idx, Boundary in pairs(Meta.Boundaries)do
  1522. Boundary[Field] = Value;
  1523. end;
  1524. end;
  1525. end
  1526. }
  1527. );
  1528.  
  1529. VIn_CreateClass("Label",
  1530. {
  1531. --Main
  1532. Parent = "\2\1\0",
  1533. ClassName = "\3\0\1string",
  1534. ZIndex = "\3\0\0number",
  1535.  
  1536. --Methods
  1537. Redraw = "\3\0\1function"
  1538. },
  1539. {
  1540.  
  1541. },
  1542. function(Parent)
  1543. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Label);
  1544. --Proxy Setup
  1545. Fields.ClassName = "VeraniumLabel";
  1546. Fields.Parent = Parent;
  1547. Fields.ZIndex = VLb_Defaults.ZIndex;
  1548. --Methods Setup
  1549. Fields.Redraw = VIn_Data.Label.Redraw;
  1550. --Elements Creation
  1551. local Main = Instance.new("Frame", GetPInstance(Parent));
  1552. local Background = VIn_Data.Background.Constructor(Main);
  1553. local ImageRender = Instance.new("ImageLabel", Main);
  1554. local TextRender = Instance.new("TextLabel", Main);
  1555. --Main Setup
  1556. Main.BackgroundTransparency = 1;
  1557. Main.BorderSizePixel = 0;
  1558. Main.Name = "VeraniumLabel";
  1559. Main.Size = UDim2.new(0, 105, 0, 25);
  1560. --TextRender Setup
  1561. TextRender.Name = _PREFIX.."TextRender";
  1562. TextRender.Text = "Veranium Label";
  1563. TextRender.BackgroundTransparency = 1;
  1564. TextRender.BorderSizePixel = 0;
  1565. TextRender.Size = UDim2.new(1, 0, 1, 0);
  1566. TextRender.Position = UDim2.new(0.5, 0, 0.5, 0);
  1567. TextRender.AnchorPoint = Vector2.new(0.5, 0.5);
  1568. --TextRender Defaults
  1569. TextRender.TextColor3 = VLb_Defaults.TextColor;
  1570. TextRender.TextTransparency = VLb_Defaults.TextTransparency;
  1571. TextRender.Font = VLb_Defaults.Font;
  1572.  
  1573. TextRender.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  1574. TextRender.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  1575.  
  1576. TextRender.TextXAlignment = VLb_Defaults.TextXAlignment;
  1577. TextRender.TextYAlignment = VLb_Defaults.TextYAlignment;
  1578. --ImageRender Setup
  1579. ImageRender.Name = _PREFIX.."ImageRender";
  1580. ImageRender.Image = "";
  1581. ImageRender.BackgroundTransparency = 1;
  1582. ImageRender.BorderSizePixel = 0;
  1583. ImageRender.Size = UDim2.new(1, 0, 1, 0);
  1584. ImageRender.Position = UDim2.new(0.5, 0, 0.5, 0);
  1585. ImageRender.AnchorPoint = Vector2.new(0.5, 0.5);
  1586. --ChangedSignal
  1587. Cs.Parent = Main;
  1588. --MetaData Setup
  1589. Meta.___Instance = Main;
  1590. Meta.___Base2D = Main;
  1591. Meta.___Background = Background;
  1592. Meta.___TextRender = TextRender;
  1593. Meta.___ImageRender = ImageRender;
  1594. --First Draw
  1595. VIn_Data.Label.Redraw(Proxy);
  1596.  
  1597. return Proxy;
  1598. end,
  1599. function(self, Field, Value)
  1600. --Setup
  1601. local Meta = GetMeta(self);
  1602. local Main = Meta.___Instance;
  1603. local Fields = Meta.___Fields;
  1604. --Shortest Redraw known to man!
  1605. Main.ZIndex = Fields.ZIndex;
  1606. end,
  1607. {
  1608.  
  1609. }
  1610. );
  1611.  
  1612. VIn_CreateClass("Button",
  1613. {
  1614. --Main
  1615. Parent = "\2\1\0",
  1616. ClassName = "\3\0\1string",
  1617. ZIndex = "\3\0\0number",
  1618. BackgroundColor3 = "\4\0\0Color3",
  1619. Image = "\3\0\0string",
  1620. ClipsDescendants = "\3\0\0boolean",
  1621.  
  1622. --Hovers
  1623. HoverColor3 = "\4\0\0Color3",
  1624. HoverImage = "\3\0\0string",
  1625. --MouseDown
  1626. MouseDownColor3 = "\4\0\0Color3",
  1627. MouseDownImage = "\3\0\0string",
  1628. --Metro Properties
  1629. MetroStyle = "\3\0\0boolean",
  1630. MetroStartColor3 = "\4\0\0Color3",
  1631. MetroEndColor3 = "\4\0\0Color3",
  1632. MetroStartTransparency = "\3\0\0number",
  1633. MetroEndTransparency = "\3\0\0number",
  1634. MetroTweenInfo = "\4\0\0TweenInfo",
  1635. AutoButtonColor = "\3\0\0boolean",
  1636. --Methods
  1637. Redraw = "\3\0\1function"
  1638. },
  1639. {
  1640. MetroStartColor = "MetroStartColor3",
  1641. MetroEndColor3 = "MetroEndColor",
  1642. HoverColor3 = "HoverColor",
  1643. MouseDownColor3 = "MouseDownColor",
  1644. BackgroundColor = "BackgroundColor3",
  1645. Color = "BackgroundColor3"
  1646. },
  1647. function(Parent)
  1648. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Button);
  1649. --Proxy Setup
  1650. Fields.ClassName = "VeraniumButton";
  1651. Fields.Parent = Parent;
  1652. Fields.ZIndex = VLb_Defaults.ZIndex;
  1653. Fields.BackgroundColor3 = VLb_Defaults.BackgroundColor;
  1654. Fields.Image = "";
  1655.  
  1656. Fields.MetroStyle = VLb_Defaults.MetroStyle;
  1657.  
  1658. Fields.MetroStartColor3 = VLb_Defaults.HighlightColor;
  1659. Fields.MetroEndColor = VLb_Defaults.HighlightColor;
  1660.  
  1661. Fields.MetroStartTransparency = 0.5;
  1662. Fields.MetroEndTransparency = 1;
  1663.  
  1664. Fields.MetroTweenInfo = TweenInfo.new(
  1665. 0.5,
  1666. Enum.EasingStyle.Sine,
  1667. Enum.EasingDirection.Out
  1668. );
  1669. Fields.AutoButtonColor = false;
  1670. Fields.ClipsDescendants = false;
  1671. Fields.HoverColor3 = VLb_Defaults.SecondaryColor;
  1672. Fields.MouseDownColor3 = VLb_Defaults.SecondaryColor;
  1673. Fields.HoverImage = "";
  1674. Fields.MouseDownImage = "";
  1675. --Methods Setup
  1676. Fields.Redraw = VIn_Data.Button.Redraw;
  1677. --Elements Creation
  1678. local Main = Instance.new("Frame", GetPInstance(Parent));
  1679. local Background = VIn_Data.Background.Constructor(Main);
  1680. local ImageRender = Instance.new("ImageLabel", Main);
  1681. local TextRender = Instance.new("TextButton", Main);
  1682. --Main Setup
  1683. Main.BackgroundTransparency = 1;
  1684. Main.BorderSizePixel = 0;
  1685. Main.Name = "VeraniumButton";
  1686. Main.Size = UDim2.new(0, 105, 0, 25);
  1687. --TextRender Setup
  1688. TextRender.Name = _PREFIX.."TextRender";
  1689. TextRender.Text = "Veranium Button";
  1690. TextRender.BackgroundTransparency = 1;
  1691. TextRender.BorderSizePixel = 0;
  1692. TextRender.Size = UDim2.new(1, 0, 1, 0);
  1693. TextRender.Position = UDim2.new(0.5, 0, 0.5, 0);
  1694. TextRender.AnchorPoint = Vector2.new(0.5, 0.5);
  1695. TextRender.AutoButtonColor = false;
  1696. --TextRender Defaults
  1697. TextRender.TextColor3 = VLb_Defaults.TextColor;
  1698. TextRender.TextTransparency = VLb_Defaults.TextTransparency;
  1699. TextRender.Font = VLb_Defaults.Font;
  1700.  
  1701. TextRender.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  1702. TextRender.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  1703.  
  1704. TextRender.TextXAlignment = VLb_Defaults.TextXAlignment;
  1705. TextRender.TextYAlignment = VLb_Defaults.TextYAlignment;
  1706. --ImageRender Setup
  1707. ImageRender.Name = _PREFIX.."ImageRender";
  1708. ImageRender.Image = "";
  1709. ImageRender.BackgroundTransparency = 1;
  1710. ImageRender.BorderSizePixel = 0;
  1711. ImageRender.Size = UDim2.new(1, 0, 1, 0);
  1712. ImageRender.Position = UDim2.new(0.5, 0, 0.5, 0);
  1713. ImageRender.AnchorPoint = Vector2.new(0.5, 0.5);
  1714. --ChangedSignal
  1715. Cs.Parent = Main;
  1716. --Connections
  1717. TextRender.MouseEnter:Connect(function()
  1718. if Fields.AutoButtonColor then
  1719. Background.BackgroundColor3 = Fields.HoverColor3;
  1720. ImageRender.Image = Fields.HoverImage;
  1721. end;
  1722. end);
  1723.  
  1724. TextRender.MouseLeave:Connect(function()
  1725. if Fields.AutoButtonColor then
  1726. Background.BackgroundColor3 = Fields.BackgroundColor3;
  1727. ImageRender.Image = Fields.Image;
  1728. end;
  1729. end);
  1730.  
  1731. local MetroCircle;
  1732.  
  1733. TextRender.MouseButton1Down:Connect(function()
  1734. if Fields.AutoButtonColor then
  1735. Background.BackgroundColor3 = Fields.MouseDownColor3;
  1736. ImageRender.Image = Fields.MouseDownImage;
  1737. end;
  1738. end);
  1739.  
  1740. TextRender.MouseButton1Up:Connect(function(X, Y)
  1741. if Fields.AutoButtonColor then
  1742. Background.BackgroundColor3 = Fields.HoverColor3;
  1743. ImageRender.Image = Fields.HoverImage;
  1744. end;
  1745. if Fields.MetroStyle then
  1746. Main.ClipsDescendants = true;
  1747. MetroCircle = Instance.new("ImageLabel", Main);
  1748. MetroCircle.Name = _PREFIX.."MetroCircle";
  1749. MetroCircle.ImageColor3 = Fields.MetroStartColor3;
  1750. MetroCircle.ImageTransparency = Fields.MetroStartTransparency;
  1751. MetroCircle.Image = "rbxassetid://3457843087";
  1752. MetroCircle.BackgroundTransparency = 1;
  1753. MetroCircle.BorderSizePixel = 0;
  1754. MetroCircle.AnchorPoint = Vector2.new(0.5, 0.5);
  1755. MetroCircle.Position = UDim2.new(
  1756. 0,
  1757. X-Main.AbsolutePosition.X,
  1758. 0,
  1759. Y-Main.AbsolutePosition.Y-36
  1760. );
  1761. MetroCircle.Size = UDim2.new(0, 5, 0, 5);
  1762. local TargetSize = math.floor(math.max(
  1763. Main.AbsoluteSize.X,
  1764. Main.AbsoluteSize.Y
  1765. )*1.5);
  1766. TweenService:Create(
  1767. MetroCircle,
  1768. Fields.MetroTweenInfo,
  1769. {
  1770. ImageTransparency = Fields.MetroEndTransparency,
  1771. ImageColor3 = Fields.MetroEndColor3,
  1772. Size = UDim2.new(
  1773. 0,
  1774. TargetSize,
  1775. 0,
  1776. TargetSize
  1777. )
  1778. }
  1779. ):Play();
  1780. Debris:AddItem(MetroCircle, Fields.MetroTweenInfo.Time+0.1);
  1781. local MetroLocation = MetroCircle;
  1782. wait(Fields.MetroTweenInfo.Time+0.1);
  1783. if MetroLocation == MetroCircle then
  1784. MetroLocation, MetroCircle = nil;
  1785. Main.ClipsDescendants = Fields.ClipsDescendants;
  1786. end;
  1787. end;
  1788. end);
  1789. --MetaData Setup
  1790. Meta.___Instance = Main;
  1791. Meta.___Base2D = Main;
  1792. Meta.___Background = Background;
  1793. Meta.___TextRender = TextRender;
  1794. Meta.___CHitbox = TextRender;
  1795. Meta.___ImageRender = ImageRender;
  1796. --First Draw
  1797. VIn_Data.Button.Redraw(Proxy);
  1798.  
  1799. return Proxy;
  1800. end,
  1801. function(self, Field, Value)
  1802. --Setup
  1803. local Meta = GetMeta(self);
  1804. local Main = Meta.___Instance;
  1805. local Fields = Meta.___Fields;
  1806. local Background = Meta.___Background;
  1807. local ImageRender = Meta.___ImageRender;
  1808. --ZIndex
  1809. if Field == nil or Field == "ZIndex" then
  1810. Main.ZIndex = Fields.ZIndex;
  1811. if Field then return; end;
  1812. end;
  1813. --BackgroundColor3
  1814. if Field == nil or Field == "BackgroundColor3" then
  1815. Background.BackgroundColor3 = Fields.BackgroundColor3;
  1816. if Field then return; end;
  1817. end;
  1818. --Image
  1819. if Field == nil or Field == "Image" then
  1820. ImageRender.Image = Fields.Image;
  1821. if Field then return; end;
  1822. end;
  1823. --ClipsDescendants
  1824. if Field == nil or Field == "ClipsDescendants" then
  1825. Main.ClipsDescendants = Fields.ClipsDescendants;
  1826. if Field then return; end;
  1827. end;
  1828. end,
  1829. {
  1830.  
  1831. }
  1832. );
  1833.  
  1834. --[[MetroDirection Instructions:
  1835. The value given is a UDim2.
  1836. X[0]: StartX Location
  1837. X[1]: StartY Location
  1838. Y[0]: EndX Location
  1839. Y[1]: EndY Location
  1840.  
  1841. Locations can be values from 0-1 (usually 1, 0.5 or 0)
  1842. 1 = Start
  1843. 0.5 = Center
  1844. 0 = End
  1845.  
  1846. 1 1 0 1
  1847. -1 0
  1848.  
  1849. Examples:
  1850. UDim2.new(0, 0, 1, 0)
  1851. This refers to a MetroLine that starts from TopLeft(0, 0) to TopRight(1, 0)
  1852. The default value is UDim2.new(0, 1, 1, 1)
  1853. ]]
  1854.  
  1855. VIn_CreateClass("TextBox",
  1856. {
  1857. --Main
  1858. Parent = "\2\1\0",
  1859. ClassName = "\3\0\1string",
  1860. BackgroundColor3 = "\4\0\0Color3",
  1861. AutoTextBoxColor = "\3\0\0boolean",
  1862. FocusedColor3 = "\4\0\0Color3",
  1863. PasswordChar = "\3\0\0string",
  1864. TextTransparency = "\3\0\0number",
  1865. --Metro Properties
  1866. MetroStyle = "\3\0\0boolean",
  1867. MetroDirection = "\4\0\0UDim2",
  1868. MetroStartColor3 = "\4\0\0Color3",
  1869. MetroEndColor3 = "\4\0\0Color3",
  1870. MetroStartTransparency = "\3\0\0number",
  1871. MetroEndTransparency = "\3\0\0number",
  1872. MetroStartSize = "\3\0\0number",
  1873. MetroEndSize = "\3\0\0number",
  1874. MetroTweenInfo = "\4\0\0TweenInfo",
  1875. --Methods
  1876. Redraw = "\3\0\1function"
  1877. },
  1878. {
  1879. MetroStartColor = "MetroStartColor3",
  1880. MetroEndColor = "MetroEndColor",
  1881. },
  1882. function(Parent)
  1883. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.TextBox);
  1884. --Proxy Setup
  1885. Fields.ClassName = "VeraniumTextBox";
  1886. Fields.Parent = Parent;
  1887. Fields.BackgroundColor3 = VLb_Defaults.BackgroundColor;
  1888. Fields.AutoTextBoxColor = true;
  1889. Fields.FocusedColor3 = VLb_Defaults.SecondaryColor;
  1890. Fields.PasswordChar = "";
  1891. Fields.TextTransparency = VLb_Defaults.TextTransparency or 0;
  1892.  
  1893. Fields.MetroStyle = true;
  1894.  
  1895. Fields.MetroStartColor3 = VLb_Defaults.HighlightColor;
  1896. Fields.MetroEndColor3 = VLb_Defaults.HighlightColor;
  1897.  
  1898. Fields.MetroStartTransparency = 0;
  1899. Fields.MetroEndTransparency = 0;
  1900.  
  1901. Fields.MetroStartSize = 3;
  1902. Fields.MetroEndSize = 3;
  1903. Fields.MetroDirection = UDim2.new(0, 1, 1, 1);
  1904.  
  1905. Fields.MetroTweenInfo = TweenInfo.new(
  1906. 0.5,
  1907. Enum.EasingStyle.Sine,
  1908. Enum.EasingDirection.Out
  1909. );
  1910. --Methods Setup
  1911. Fields.Redraw = VIn_Data.TextBox.Redraw;
  1912. --Elements Creation
  1913. local Main = Instance.new("Frame", GetPInstance(Parent));
  1914. local Background = VIn_Data.Background.Constructor(Main);
  1915. local MetroClip = Instance.new("Frame", Main);
  1916. local MetroCont = Instance.new("Frame", MetroClip)
  1917. local MetroBG = VIn_Data.Background.Constructor(MetroCont);
  1918. local TextRender = Instance.new("TextBox", Main);
  1919. local PasswordChar = Instance.new("TextLabel", Main);
  1920. --Main Setup
  1921. Main.BackgroundTransparency = 1;
  1922. Main.BorderSizePixel = 0;
  1923. Main.Name = "VeraniumTextBox";
  1924. Main.Size = UDim2.new(0, 105, 0, 25);
  1925. Main.ZIndex = VLb_Defaults.ZIndex;
  1926. --MetroClip Setup
  1927. MetroClip.BackgroundTransparency = 1;
  1928. MetroClip.BorderSizePixel = 0;
  1929. MetroClip.Name = _PREFIX.."MetroClip";
  1930. MetroClip.ClipsDescendants = true;
  1931. MetroClip.Changed:Connect(function()
  1932. MetroBG.BackgroundColor3 = MetroClip.BackgroundColor3;
  1933. MetroBG.BackgroundTransparency = MetroClip.BorderColor3.r;
  1934. end);
  1935. --MetroCont Setup
  1936. MetroCont.BackgroundTransparency = 1;
  1937. MetroCont.BorderSizePixel = 0;
  1938. MetroCont.Name = _PREFIX.."MetroCont";
  1939. --TextRender Setup
  1940. TextRender.Name = _PREFIX.."TextRender";
  1941. TextRender.Text = "Veranium TextBox";
  1942. TextRender.BackgroundTransparency = 1;
  1943. TextRender.BorderSizePixel = 0;
  1944. TextRender.Size = UDim2.new(1, 0, 1, 0);
  1945. TextRender.Position = UDim2.new(0.5, 0, 0.5, 0);
  1946. TextRender.AnchorPoint = Vector2.new(0.5, 0.5);
  1947. --TextRender Defaults
  1948. TextRender.TextColor3 = VLb_Defaults.TextColor;
  1949. TextRender.TextTransparency = VLb_Defaults.TextTransparency;
  1950. TextRender.Font = VLb_Defaults.Font;
  1951.  
  1952. TextRender.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  1953. TextRender.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  1954.  
  1955. TextRender.TextXAlignment = VLb_Defaults.TextXAlignment;
  1956. TextRender.TextYAlignment = VLb_Defaults.TextYAlignment;
  1957.  
  1958. TextRender.PlaceholderColor3 = VLb_Defaults.PlaceholderColor;
  1959. --PasswordChar Setup
  1960. PasswordChar.Name = _PREFIX.."PasswordChar";
  1961. PasswordChar.Text = "";
  1962. PasswordChar.BackgroundTransparency = 1;
  1963. PasswordChar.BorderSizePixel = 0;
  1964. PasswordChar.Size = UDim2.new(1, 0, 1, 0);
  1965. PasswordChar.Position = UDim2.new(0.5, 0, 0.5, 0);
  1966. PasswordChar.AnchorPoint = Vector2.new(0.5, 0.5);
  1967. --PasswordChar Defaults
  1968. PasswordChar.TextColor3 = VLb_Defaults.TextColor;
  1969. PasswordChar.TextTransparency = VLb_Defaults.TextTransparency;
  1970. PasswordChar.Font = VLb_Defaults.Font;
  1971.  
  1972. PasswordChar.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  1973. PasswordChar.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  1974.  
  1975. PasswordChar.TextXAlignment = VLb_Defaults.TextXAlignment;
  1976. PasswordChar.TextYAlignment = VLb_Defaults.TextYAlignment;
  1977. --ChangedSignal
  1978. Cs.Parent = Main;
  1979. --Connections
  1980. TextRender.Changed:Connect(function(Field)
  1981. if Field == "Text" then
  1982. if Fields.PasswordChar == "" then
  1983. return;
  1984. end;
  1985. local Lenght = #TextRender.Text;
  1986. local PChr0 = Fields.PasswordChar;
  1987. local PChr = "";
  1988. for Chars = 1, Lenght do
  1989. PChr = PChr..PChr0;
  1990. end;
  1991. if TextRender.Text == "" then
  1992. TextRender.TextTransparency = Fields.TextTransparency;
  1993. PasswordChar.TextTransparency = 1;
  1994. else
  1995. TextRender.TextTransparency = 1;
  1996. PasswordChar.TextTransparency = Fields.TextTransparency;
  1997. end;
  1998. PasswordChar.Text = PChr;
  1999. return;
  2000. elseif Field == "TextTransparency" then
  2001. if Fields.PasswordChar == "" then
  2002. PasswordChar.TextTransparency = 1;
  2003. return;
  2004. end;
  2005. end;
  2006. if VIn_SReg.IVRouting[Field] == "___TextRender" then
  2007. pcall(function()
  2008. PasswordChar[Field] = TextRender[Field];
  2009. end);
  2010. end;
  2011. end);
  2012. TextRender.FocusLost:Connect(function()
  2013. if Fields.AutoTextBoxColor then
  2014. Background.BackgroundColor3 = Fields.BackgroundColor3;
  2015. end;
  2016. if Fields.MetroStyle then
  2017. local Position, AnchorPoint, MetroDirection, Size, CornerSize;
  2018. MetroClip.BackgroundColor3 = Fields.MetroEndColor3;
  2019. MetroClip.BorderColor3 = Color3.new(Fields.MetroEndTransparency, 0, 0);
  2020. MetroBG.CornerSize = Background.CornerSize;
  2021. Size = Background.AbsoluteSize;
  2022. CornerSize = (Background.CornerSize + Background.BorderSizePixel)*2;
  2023. MetroCont.Size = UDim2.new(
  2024. 0, Size.X +CornerSize,
  2025. 0, Size.Y +CornerSize
  2026. );
  2027. Size = Background.BorderSizePixel;
  2028. MetroDirection = Fields.MetroDirection;
  2029. Position = UDim2.new(
  2030. MetroDirection.X.Scale,
  2031. 0,
  2032. MetroDirection.X.Offset,
  2033. 0
  2034. );
  2035. AnchorPoint = Vector2.new(
  2036. MetroDirection.X.Scale,
  2037. MetroDirection.X.Offset
  2038. );
  2039. MetroClip.Position = Position;
  2040. MetroClip.AnchorPoint = AnchorPoint;
  2041.  
  2042. Position = UDim2.new(
  2043. MetroDirection.X.Scale,
  2044. 0,
  2045. MetroDirection.X.Offset,
  2046. 0
  2047. );
  2048. MetroCont.Position = Position;
  2049. MetroCont.AnchorPoint = AnchorPoint;
  2050.  
  2051. local SizeConstraint, ThicknessConstraint;
  2052. local TX, TY, UT;
  2053. TX = MetroDirection.Y.Scale - MetroDirection.X.Scale;
  2054. TY = MetroDirection.Y.Offset - MetroDirection.X.Offset;
  2055. UT = {
  2056. X0 = 0, X1 = 0,
  2057. Y0 = 0, Y1 = 0
  2058. };
  2059.  
  2060. if math.abs(TX) >= math.abs(TY) then
  2061. SizeConstraint, ThicknessConstraint = "X", "Y";
  2062. else
  2063. SizeConstraint, ThicknessConstraint = "Y", "X";
  2064. end;
  2065.  
  2066. UT[SizeConstraint.."0"] = 1;
  2067. UT[ThicknessConstraint.."1"] = 1;
  2068.  
  2069. local MetroTween = TweenService:Create(
  2070. MetroClip,
  2071. Fields.MetroTweenInfo,
  2072. {
  2073. Size = UDim2.new(
  2074. 0,
  2075. UT.X1*Fields.MetroStartSize,
  2076. 0,
  2077. UT.Y1*Fields.MetroStartSize
  2078. ),
  2079. BackgroundColor3 = Fields.MetroStartColor3,
  2080. BorderColor3 = Color3.new(Fields.MetroStartTransparency)
  2081. }
  2082. );
  2083. MetroTween:Play();
  2084. CornerSize = nil;
  2085. end;
  2086. end);
  2087. TextRender.Focused:Connect(function()
  2088. if Fields.AutoTextBoxColor then
  2089. Background.BackgroundColor3 = Fields.FocusedColor3;
  2090. end;
  2091. if Fields.MetroStyle then
  2092. local Position, AnchorPoint, MetroDirection, Size, CornerSize;
  2093. MetroClip.BackgroundColor3 = Fields.MetroStartColor3;
  2094. MetroClip.BorderColor3 = Color3.new(Fields.MetroStartTransparency, 0, 0);
  2095. MetroBG.CornerSize = Background.CornerSize;
  2096. Size = Background.AbsoluteSize;
  2097. CornerSize = (Background.CornerSize --[[+ Background.BorderSizePixel]])*2;
  2098. MetroCont.Size = UDim2.new(
  2099. 0, Size.X +CornerSize,
  2100. 0, Size.Y +CornerSize
  2101. );
  2102. Size = Background.BorderSizePixel;
  2103. CornerSize = function(Offset)
  2104. if Offset == 1 then
  2105. return -1;
  2106. end;
  2107. return 1;
  2108. end;
  2109. MetroDirection = Fields.MetroDirection;
  2110. Position = UDim2.new(
  2111. MetroDirection.X.Scale,
  2112. CornerSize(MetroDirection.X.Scale)*Size,
  2113. MetroDirection.X.Offset,
  2114. CornerSize(MetroDirection.X.Offset)*Size
  2115. );
  2116. AnchorPoint = Vector2.new(
  2117. MetroDirection.X.Scale,
  2118. MetroDirection.X.Offset
  2119. );
  2120. MetroClip.Position = Position;
  2121. MetroClip.AnchorPoint = AnchorPoint;
  2122.  
  2123. Position = UDim2.new(
  2124. MetroDirection.X.Scale,
  2125. 0,
  2126. MetroDirection.X.Offset,
  2127. 0
  2128. );
  2129. MetroCont.Position = Position;
  2130. MetroCont.AnchorPoint = AnchorPoint;
  2131.  
  2132. local SizeConstraint, ThicknessConstraint;
  2133. local TX, TY, UT;
  2134. TX = MetroDirection.Y.Scale - MetroDirection.X.Scale;
  2135. TY = MetroDirection.Y.Offset - MetroDirection.X.Offset;
  2136. UT = {
  2137. X0 = 0, X1 = 0,
  2138. Y0 = 0, Y1 = 0
  2139. };
  2140.  
  2141. if math.abs(TX) >= math.abs(TY) then
  2142. SizeConstraint, ThicknessConstraint = "X", "Y";
  2143. else
  2144. SizeConstraint, ThicknessConstraint = "Y", "X";
  2145. end;
  2146.  
  2147. UT[SizeConstraint.."0"] = 1;
  2148. UT[ThicknessConstraint.."1"] = 1;
  2149.  
  2150. MetroClip.Size = UDim2.new(
  2151. 0,
  2152. UT.X1*Fields.MetroStartSize,
  2153. 0,
  2154. UT.Y1*Fields.MetroStartSize
  2155. );
  2156.  
  2157. local MetroTween = TweenService:Create(
  2158. MetroClip,
  2159. Fields.MetroTweenInfo,
  2160. {
  2161. Size = UDim2.new(
  2162. UT.X0,
  2163. UT.X1*Fields.MetroEndSize,
  2164. UT.Y0,
  2165. UT.Y1*Fields.MetroEndSize
  2166. ),
  2167. BackgroundColor3 = Fields.MetroEndColor3,
  2168. BorderColor3 = Color3.new(Fields.MetroEndTransparency)
  2169. }
  2170. );
  2171. MetroTween:Play();
  2172. CornerSize = nil;
  2173. end;
  2174. end);
  2175. --MetaData Setup
  2176. Meta.___Instance = Main;
  2177. Meta.___Base2D = Main;
  2178. Meta.___Background = Background;
  2179. Meta.___TextRender = TextRender;
  2180. Meta.___TextBox = TextRender;
  2181.  
  2182. Meta.PasswordChar = PasswordChar;
  2183. Meta.MetroClip = MetroClip;
  2184. Meta.MetroCont = MetroCont;
  2185. Meta.MetroBG = MetroBG;
  2186. --First Draw
  2187. VIn_Data.TextBox.Redraw(Proxy);
  2188.  
  2189. return Proxy;
  2190. end,
  2191. function(self, Field, Value)
  2192. --Setup
  2193. local Meta = GetMeta(self);
  2194. local Main = Meta.___Instance;
  2195. local Fields = Meta.___Fields;
  2196. local Background = Meta.___Background;
  2197. local TextBox = Meta.___TextBox;
  2198.  
  2199. local PasswordChar = Meta.PasswordChar;
  2200. local MetroClip = Meta.MetroClip;
  2201. local MetroCont = Meta.MetroCont;
  2202. local MetroBG = Meta.MetroBG;
  2203. --BackgroundColor3
  2204. if (Field == nil or Field == "BackgroundColor3") and (not Fields.AutoTextBoxColor or not TextBox:IsFocused()) then
  2205. Background.BackgroundColor3 = Fields.BackgroundColor3;
  2206. if Field then return; end;
  2207. end;
  2208. --TextTransparency | PasswordChar
  2209. if (Field == nil) or (Field == "TextTransparency" or Field == "PasswordChar") then
  2210. if Fields.PasswordChar == "" then
  2211. PasswordChar.TextTransparency = 1;
  2212. TextBox.TextTransparency = Fields.TextTransparency;
  2213. else
  2214. if TextBox.Text == "" then
  2215. TextBox.TextTransparency = Fields.TextTransparency;
  2216. PasswordChar.TextTransparency = 1;
  2217. if Field then return; end;
  2218. else
  2219. TextBox.TextTransparency = 1;
  2220. PasswordChar.TextTransparency = Fields.TextTransparency;
  2221. end;
  2222. local Lenght = #TextBox.Text;
  2223. local PChr0 = Fields.PasswordChar;
  2224. local PChr = "";
  2225. for Chars = 1, Lenght do
  2226. PChr = PChr..PChr0;
  2227. end;
  2228. PasswordChar.Text = PChr;
  2229. end;
  2230. if Field then return; end;
  2231. end;
  2232. --AutoTextBoxColor | FocusedColor3
  2233. if (Field == nil or Field == "AutoTextBoxColor" or Field == "FocusedColor3") and TextBox.IsFocused then
  2234. Background.BackgroundColor3 = Fields.FocusedColor3;
  2235. if Field then return; end;
  2236. end;
  2237. end,
  2238. {
  2239.  
  2240. }
  2241. );
  2242.  
  2243. --Standard Instances
  2244. VIn_CreateClass("Slider", {
  2245. --Main
  2246. Parent = "\2\1\0",
  2247. ClassName = "\3\0\1string",
  2248.  
  2249. --Functionality
  2250. MinValue = "\3\0\0number",
  2251. MaxValue = "\3\0\0number",
  2252. Value = "\3\0\0number",
  2253. Step = "\3\0\0number",
  2254. Size = "\4\0\0Vector2",
  2255.  
  2256. --Metro Properties
  2257. MetroStyle = "\3\0\0boolean",
  2258. MetroTweenInfo = "\4\0\0TweenInfo",
  2259.  
  2260. --MISC
  2261. SliderType = "\0\0\0SliderType",
  2262. SideSheet = "\3\0\0string",
  2263. MarkupImage = "\3\0\0string",
  2264.  
  2265. --Appearance
  2266. BarColor3 = "\4\0\0Color3",
  2267. BarTransparency = "\3\0\0number",
  2268. BarThickness = "\3\0\0number",
  2269.  
  2270. MarkupColor3 = "\4\0\0Color3",
  2271. MarkupTransparency = "\3\0\0number",
  2272. MarkupSize = "\3\0\0number",
  2273.  
  2274. --Eevents
  2275. DragEnd = "\4\0\1Instance",
  2276. DragStart = "\4\0\1Instance",
  2277. ValueChanged = "\4\0\1Instance",
  2278. --Methods
  2279. Redraw = "\3\0\1function",
  2280. RelocateMarkup = "\3\0\1function"
  2281. },
  2282. {
  2283.  
  2284. },
  2285. function(Parent)
  2286. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Slider);
  2287. local Connections = {};
  2288. --Proxy Setup
  2289. Fields.ClassName = "VeraniumSlider";
  2290. Fields.Parent = Parent;
  2291.  
  2292. Fields.MinValue = 0;
  2293. Fields.MaxValue = 1;
  2294. Fields.Value = 0.5;
  2295. Fields.Step = 0.01;
  2296. Fields.Size = Vector2.new(0, 100);
  2297.  
  2298. Fields.MetroStyle = true;
  2299. Fields.MetroTweenInfo = TweenInfo.new(
  2300. 0.25,
  2301. Enum.EasingStyle.Sine,
  2302. Enum.EasingDirection.Out
  2303. );
  2304.  
  2305. Fields.SliderType = VLb_Enums.SliderType.Round;
  2306. Fields.SideSheet = "";
  2307. Fields.MarkupImage = "";
  2308.  
  2309. Fields.BarColor3 = VLb_Defaults.SecondaryColor;
  2310. Fields.BarTransparency = 0;
  2311. Fields.BarThickness = 10;
  2312.  
  2313. Fields.MarkupColor3 = VLb_Defaults.HighlightColor;
  2314. Fields.MarkupTransparency = 0;
  2315. Fields.MarkupSize = 0.6;
  2316. --Methods Setup
  2317. Fields.Redraw = VIn_Data.Slider.Redraw;
  2318. Fields.RelocateMarkup = VIn_Data.Slider.RelocateMarkup;
  2319. --Elements Creation
  2320. local Main = Instance.new("Frame", GetPInstance(Parent));
  2321. local Bar = Instance.new("Frame", Main);
  2322. local LeftSide = Instance.new("ImageLabel", Bar);
  2323. local RightSide = Instance.new("ImageLabel", Bar);
  2324. local Markup = Instance.new("ImageLabel", Bar);
  2325. local Hitbox = Instance.new("TextButton", Main);
  2326.  
  2327. local DragEnd, DragStart, ValueChanged = Instance.new("BindableEvent", Main);
  2328. DragStart = DragEnd:Clone();
  2329. ValueChanged = DragEnd:Clone();
  2330. --Main Setup
  2331. Main.BackgroundTransparency = 1;
  2332. Main.BorderSizePixel = 0;
  2333. Main.Name = "VeraniumSlider";
  2334. Main.ZIndex = VLb_Defaults.ZIndex;
  2335. --Bar Setup
  2336. Bar.BorderSizePixel = 0;
  2337. Bar.AnchorPoint = Vector2.new(0.5, 0.5);
  2338. Bar.Position = UDim2.new(0.5, 0, 0.5, 0);
  2339. Bar.Name = _PREFIX.."Bar";
  2340. --LeftSide Setup
  2341. LeftSide.BackgroundTransparency = 1;
  2342. LeftSide.BorderSizePixel = 0;
  2343. LeftSide.AnchorPoint = Vector2.new(1, 0.5);
  2344. LeftSide.Position = UDim2.new(0, 0, 0.5, 0);
  2345. LeftSide.ImageRectSize = Vector2.new(400, 800);
  2346. LeftSide.ImageRectOffset = Vector2.new(0, 0);
  2347. LeftSide.Name = _PREFIX.."LeftSide";
  2348. --RightSide Setup
  2349. RightSide.BackgroundTransparency = 1;
  2350. RightSide.BorderSizePixel = 0;
  2351. RightSide.AnchorPoint = Vector2.new(0, 0.5);
  2352. RightSide.Position = UDim2.new(1, 0, 0.5, 0);
  2353. RightSide.ImageRectSize = Vector2.new(400, 800);
  2354. RightSide.ImageRectOffset = Vector2.new(400, 0);
  2355. RightSide.Name = _PREFIX.."RightSide";
  2356. --Markup Setup
  2357. Markup.BackgroundTransparency = 1;
  2358. Markup.BorderSizePixel = 0;
  2359. Markup.AnchorPoint = Vector2.new(0.5, 0.5);
  2360. Markup.Name = _PREFIX.."Markup";
  2361. --Hitbox Setup
  2362. Hitbox.Text = "";
  2363. Hitbox.TextTransparency = 1;
  2364. Hitbox.BackgroundTransparency = 1;
  2365. Hitbox.BorderSizePixel = 0;
  2366. Hitbox.AnchorPoint = Vector2.new(0.5, 0.5);
  2367. Hitbox.Position = UDim2.new(0.5, 0, 0.5, 0);
  2368. Hitbox.Size = UDim2.new(1, 5, 1, 5);
  2369. Hitbox.Name = _PREFIX.."Hitbox";
  2370. --Events
  2371. DragEnd.Name = _PREFIX.."DragEnd";
  2372. DragStart.Name = _PREFIX.."DragStart";
  2373. ValueChanged.Name = _PREFIX.."ValueChanged";
  2374.  
  2375. DragStart.Parent, ValueChanged.Parent = Main, Main;
  2376.  
  2377. Fields.DragEnd = DragEnd.Event;
  2378. Fields.DragStart = DragStart.Event;
  2379. Fields.ValueChanged = ValueChanged.Event;
  2380. --ChangedSignal
  2381. Cs.Parent = Main;
  2382. --Connections
  2383. local IsDown = false;
  2384. local function MoveMarkup()
  2385. if IsDown then
  2386. local X = Mouse.X - Bar.AbsolutePosition.X;
  2387. Fields.Value = VLb_CVMath.Map(X, 0, Bar.AbsoluteSize.X, Fields.MinValue, Fields.MaxValue);
  2388. if Fields.Value > Fields.MaxValue then
  2389. Fields.Value = Fields.MaxValue;
  2390. elseif Fields.Value < Fields.MinValue then
  2391. Fields.Value = Fields.MinValue;
  2392. end;
  2393. if Fields.Step ~= 0 then
  2394. Fields.Value = VLb_CVMath.Round(Fields.Value/Fields.Step)*Fields.Step
  2395. end
  2396. ValueChanged:Fire(Fields.Value);
  2397. end;
  2398.  
  2399. if Fields.MetroStyle then
  2400. TweenService:Create(
  2401. Markup,
  2402. Fields.MetroTweenInfo,
  2403. {
  2404. Position = UDim2.new(VLb_CVMath.Map(
  2405. Fields.Value,
  2406. Fields.MinValue,
  2407. Fields.MaxValue, 0, 1
  2408. ), 0, 0.5, 0)
  2409. }
  2410. ):Play();
  2411. else
  2412. Proxy:RelocateMarkup();
  2413. end;
  2414. end;
  2415. Hitbox.MouseButton1Down:Connect(function()
  2416. IsDown = true;
  2417. DragStart:Fire();
  2418. MoveMarkup();
  2419. end);
  2420. Connections[0] = UserInputService.InputEnded:Connect(function(Input)
  2421. if Input.UserInputType == Enum.UserInputType.MouseButton1 and IsDown then
  2422. IsDown = false;
  2423. DragEnd:Fire();
  2424. end;
  2425. end);
  2426. Connections[1] = Mouse.Move:Connect(MoveMarkup);
  2427. Hitbox.MouseMoved:Connect(function(X)
  2428.  
  2429. end);
  2430. --MetaData Setup
  2431. Meta.___Instance = Main;
  2432. Meta.___Base2D = Main;
  2433. Meta.___Connection = Connections;
  2434.  
  2435. Meta.Bar = Bar;
  2436. Meta.LeftSide = LeftSide;
  2437. Meta.RightSide = RightSide;
  2438. Meta.Markup = Markup;
  2439. Meta.Hitbox = Hitbox;
  2440. --First Draw
  2441. VIn_Data.Slider.Redraw(Proxy);
  2442.  
  2443. return Proxy;
  2444. end,
  2445. function(self, Field, Value)
  2446. --Setup
  2447. local Meta = GetMeta(self);
  2448. local Main = Meta.___Instance;
  2449. local Fields = Meta.___Fields;
  2450.  
  2451. local Bar = Meta.Bar;
  2452. local LeftSide = Meta.LeftSide;
  2453. local RightSide = Meta.RightSide;
  2454. local Markup = Meta.Markup;
  2455. local Hitbox = Meta.Hitbox;
  2456. --SliderType | SlideSheet | MarkupImage
  2457. if (Field == nil or Field == "SliderType" or Field == "SlideSheet" or Field == "MarkupImage") then
  2458. local SideSheet = VCf_GetEnumLValue("SliderType", Fields.SliderType);
  2459. if SideSheet == "" then
  2460. LeftSide.Image = Fields.SideSheet;
  2461. RightSide.Image = Fields.SideSheet;
  2462.  
  2463. Markup.Image = Fields.MarkupImage;
  2464. else
  2465. LeftSide.Image = SideSheet;
  2466. RightSide.Image = SideSheet;
  2467.  
  2468. Markup.Image = SideSheet;
  2469. end;
  2470. if Field then return; end;
  2471. end;
  2472. --BarColor3
  2473. if Field == nil or Field == "BarColor3" then
  2474. Bar.BackgroundColor3 = Fields.BarColor3;
  2475. LeftSide.ImageColor3 = Fields.BarColor3;
  2476. RightSide.ImageColor3 = Fields.BarColor3;
  2477. if Field then return; end;
  2478. end;
  2479. --BarTransparency
  2480. if Field == nil or Field == "BarTransparency" then
  2481. Bar.BackgroundTransparency = Fields.BarTransparency;
  2482. LeftSide.ImageTransparency = Fields.BarTransparency;
  2483. RightSide.ImageTransparency = Fields.BarTransparency;
  2484. if Field then return; end;
  2485. end;
  2486. --BarThickness | Size | MarkupSize
  2487. if Field == nil or Field == "BarThickness" or Field == "Size" then
  2488. Main.Size = UDim2.new(
  2489. Fields.Size.X,
  2490. Fields.Size.Y,
  2491. 0,
  2492. Fields.BarThickness
  2493. );
  2494.  
  2495. LeftSide.Size = UDim2.new(0, Fields.BarThickness/2, 1, 0);
  2496. RightSide.Size = UDim2.new(0, Fields.BarThickness/2, 1, 0);
  2497. Bar.Size = UDim2.new(
  2498. 1,
  2499. -Fields.BarThickness,
  2500. 1,
  2501. 0
  2502. );
  2503.  
  2504. local Size = math.min(Bar.AbsoluteSize.X, Bar.AbsoluteSize.Y)*Fields.MarkupSize;
  2505. Markup.Size = UDim2.new(0, Size, 0, Size);
  2506. if Field then return; end;
  2507. if Field then return; end;
  2508. end;
  2509. --MarkupColor3
  2510. if Field == nil or Field == "MarkupColor3" then
  2511. Markup.ImageColor3 = Fields.MarkupColor3;
  2512. if Field then return; end;
  2513. end;
  2514. --MarkupTransparency
  2515. if Field == nil or Field == "MarkupTransparency" then
  2516. Markup.ImageTransparency = Fields.MarkupTransparency;
  2517. if Field then return; end;
  2518. end;
  2519. self:RelocateMarkup();
  2520. end,
  2521. {
  2522. RelocateMarkup = function(Proxy)
  2523. local Meta = GetMeta(Proxy)
  2524. local Fields = Meta.___Fields
  2525. local Markup = Meta.Markup
  2526. if Fields.Step ~= 0 then
  2527. Fields.Value = VLb_CVMath.Round(Fields.Value/Fields.Step)*Fields.Step
  2528. end
  2529. if Fields.Value > Fields.MaxValue then
  2530. Fields.Value = Fields.MaxValue
  2531. end
  2532. if Fields.Value < Fields.MinValue then
  2533. Fields.Value = Fields.MinValue
  2534. end
  2535. Markup.Position = UDim2.new(VLb_CVMath.Map(
  2536. Fields.Value,
  2537. Fields.MinValue,
  2538. Fields.MaxValue, 0, 1
  2539. ), 0, 0.5, 0)
  2540. end
  2541. }
  2542. );
  2543.  
  2544. VIn_CreateClass("CheckBox",
  2545. {
  2546. --Main
  2547. Parent = "\2\1\0",
  2548. ClassName = "\3\0\1string",
  2549. Checked = "\3\0\0boolean",
  2550. Size = "\3\0\0number",
  2551. LeftLabel = "\3\0\0boolean",
  2552. LabelPadding = "\3\0\0number",
  2553.  
  2554. --Box Appearance
  2555. StartBoxColor3 = "\4\0\0Color3",
  2556. EndBoxColor3 = "\4\0\0Color3",
  2557. StartBoxTransparency = "\3\0\0number",
  2558. EndBoxTransparency = "\3\0\0number",
  2559. CheckBoxType = "\0\0\0CheckBoxType",
  2560. CheckBoxImage = "\3\0\0string",
  2561. CheckBoxFill = "\3\0\0boolean",
  2562.  
  2563. --Check Appearance
  2564. CheckImage = "\3\0\0string",
  2565. StartCheckColor3 = "\4\0\0Color3",
  2566. EndCheckColor3 = "\4\0\0Color3",
  2567. StartCheckTransparency = "\3\0\0number",
  2568. EndCheckTransparency = "\3\0\0number",
  2569. StartCheckSize = "\3\0\0number",
  2570. EndCheckSize = "\3\0\0number",
  2571.  
  2572. --Metro Style
  2573. MetroStyle = "\3\0\0boolean",
  2574. MetroTweenInfo = "\4\0\0TweenInfo",
  2575.  
  2576. --Events
  2577. CheckChanged = "\4\0\1Instance",
  2578.  
  2579. --Methods
  2580. Redraw = "\4\0\1function",
  2581. CreateLabel = "\4\0\1function",
  2582. Check = "\4\0\1function"
  2583. },
  2584. {
  2585.  
  2586. },
  2587. function(Parent)
  2588. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.CheckBox);
  2589. --Proxy Setup
  2590. Fields.ClassName = "VeraniumCheckBox";
  2591. Fields.Parent = Parent;
  2592. Fields.Checked = false;
  2593. Fields.Size = 17;
  2594. Fields.LeftLabel = false;
  2595. Fields.LabelPadding = 2;
  2596.  
  2597. Fields.StartBoxColor3 = VLb_Defaults.SecondaryColor;
  2598. Fields.EndBoxColor3 = VLb_Defaults.SecondaryColor;
  2599. Fields.StartBoxTransparency = 0;
  2600. Fields.EndBoxTransparency = 0;
  2601. Fields.CheckBoxType = VLb_Enums.CheckBoxType.Smooth;
  2602. Fields.CheckBoxImage = "";
  2603. Fields.CheckBoxFill = true;
  2604.  
  2605. Fields.CheckImage = "";
  2606. Fields.StartCheckColor3 = VLb_Defaults.HighlightColor;
  2607. Fields.EndCheckColor3 = VLb_Defaults.HighlightColor;
  2608. Fields.StartCheckTransparency = 1;
  2609. Fields.EndCheckTransparency = 0;
  2610. Fields.StartCheckSize = 0;
  2611. Fields.EndCheckSize = 0.5;
  2612.  
  2613. Fields.MetroStyle = true;
  2614. Fields.MetroTweenInfo = TweenInfo.new(
  2615. 0.15,
  2616. Enum.EasingStyle.Sine,
  2617. Enum.EasingDirection.Out
  2618. );
  2619. --Methods Setup
  2620. Fields.Redraw = VIn_Data.CheckBox.Redraw;
  2621. Fields.Check = VIn_Data.CheckBox.Check;
  2622. Fields.CreateLabel = VIn_Data.CheckBox.CreateLabel;
  2623. --Elements Creation
  2624. local Main = Instance.new("Frame", GetPInstance(Parent));
  2625. local Box = Instance.new("ImageLabel", Main);
  2626. local Check = Instance.new("ImageLabel", Box);
  2627. local Hitbox = Instance.new("TextButton", Main);
  2628.  
  2629. local CheckChanged = Instance.new("BindableEvent", Main);
  2630. --Main Setup
  2631. Main.BackgroundTransparency = 1;
  2632. Main.BorderSizePixel = 0;
  2633. Main.Name = "VeraniumCheckBox";
  2634. Main.ZIndex = VLb_Defaults.ZIndex;
  2635. Main.Size = UDim2.new(0, 17, 0, 17);
  2636. --Box Setup
  2637. Box.BackgroundTransparency = 1;
  2638. Box.BorderSizePixel = 0;
  2639. Box.Size = UDim2.new(1, 0, 1, 0);
  2640. Box.Position = UDim2.new(0.5, 0, 0.5, 0);
  2641. Box.AnchorPoint = Vector2.new(0.5, 0.5);
  2642. Box.Name = _PREFIX.."Box";
  2643. --Check Setup
  2644. Check.BackgroundTransparency = 1;
  2645. Check.BorderSizePixel = 0;
  2646. Check.Position = UDim2.new(0.5, 0, 0.5, 0);
  2647. Check.AnchorPoint = Vector2.new(0.5, 0.5);
  2648. Check.Name = _PREFIX.."CheckMark"
  2649. --Hitbox Setup
  2650. Hitbox.BackgroundTransparency = 1;
  2651. Hitbox.Text = "";
  2652. Hitbox.AnchorPoint = Vector2.new(0.5, 0.5);
  2653. Hitbox.Position = UDim2.new(0.5, 0, 0.5, 0);
  2654. Hitbox.Size = UDim2.new(1, 5, 1, 5);
  2655. Hitbox.Name = _PREFIX.."Hitbox";
  2656. --Events
  2657. CheckChanged.Name = _PREFIX.."CheckChanged";
  2658.  
  2659. Fields.CheckChanged = CheckChanged.Event;
  2660. --ChangedSignal
  2661. Cs.Parent = Main;
  2662. --Connections
  2663. Hitbox.MouseButton1Down:Connect(function()
  2664. Fields.Checked = not Fields.Checked;
  2665. CheckChanged:Fire(true);
  2666. Proxy:Check();
  2667. end);
  2668. --MetaData Setup
  2669. Meta.___Instance = Main;
  2670. Meta.___Base2D = Main;
  2671.  
  2672. Meta.Box = Box;
  2673. Meta.Check = Check;
  2674. Meta.Hitbox = Hitbox;
  2675.  
  2676. Meta.CheckChanged = CheckChanged;
  2677. --First Draw
  2678. Proxy:Check(false);
  2679. VIn_Data.CheckBox.Redraw(Proxy);
  2680.  
  2681. return Proxy;
  2682. end,
  2683. function(self, Field, Value)
  2684. --Setup
  2685. local Meta = GetMeta(self);
  2686. local Main = Meta.___Instance;
  2687. local Fields = Meta.___Fields;
  2688. local Label = Meta.___TextRender;
  2689.  
  2690. local Box = Meta.Box;
  2691. local Check = Meta.Check;
  2692. local Hitbox = Meta.Hitbox;
  2693.  
  2694. local CheckChanged = Meta.CheckChanged;
  2695.  
  2696. --Size
  2697. if Field == nil or Field == "Size" then
  2698. Main.Size = UDim2.new(0, Fields.Size, 0, Fields.Size);
  2699. end;
  2700.  
  2701. --Label | LeftLabel | LabelPadding
  2702. if (Field == nil or Field == "Label"
  2703. or Field == "LeftLabel" or Field == "LabelPadding") and Label then
  2704. if Fields.LeftLabel then
  2705. Label.AnchorPoint = Vector2.new(1, 0.5);
  2706. Label.Position = UDim2.new(0, -Fields.LabelPadding, 0.5, 0);
  2707. Label.TextXAlignment = enum.TextXAlignment.Right;
  2708. else
  2709. Label.AnchorPoint = Vector2.new(0, 0.5);
  2710. Label.Position = UDim2.new(1, Fields.LabelPadding, 0.5, 0);
  2711. Label.TextXAlignment = enum.TextXAlignment.Left;
  2712. end;
  2713. end;
  2714.  
  2715. --Uhh... A lot...?
  2716. if Field == nil or Field == "Checked"
  2717. or Field == "StartBoxColor3" or Field == "EndBoxColor3"
  2718. or Field == "StartBoxTransparency" or Field == "EndBoxTransparency"
  2719. or Field == "StartCheckColor3" or Field == "EndCheckColor3"
  2720. or Field == "StartCheckTransparency" or Field == "EndCheckTransparency"
  2721. or Field == "StartCheckSize" or Field == "EndCheckSize" then
  2722. if Field == "Checked" then
  2723. CheckChanged:Fire(false);
  2724. end;
  2725. self:Check(false);
  2726. if Field then return;end;
  2727. end;
  2728.  
  2729. --Once more, a lot.
  2730. if Field == nil or Field == "CheckBoxType" or Field == "CheckImage"
  2731. or Field == "CheckBoxImage" or Field == "CheckBoxFill" then
  2732. local Offset = VCf_GetEnumLValue("CheckBoxType", Fields.CheckBoxType);
  2733. if Offset == 4 then
  2734. Box.Image = Fields.CheckBoxImage;
  2735. Box.ImageRectSize = Vector2.new(0, 0);
  2736. Box.ImageRectOffset = Vector2.new(0, 0);
  2737. else
  2738. Box.Image = "rbxassetid://4018402187";
  2739. Box.ImageRectSize = Vector2.new(100, 100);
  2740. if Fields.CheckBoxFill then
  2741. Box.ImageRectOffset = Vector2.new(Offset*100, 100);
  2742. else
  2743. Box.ImageRectOffset = Vector2.new(Offset*100, 0);
  2744. end;
  2745. end;
  2746. if Fields.CheckImage == "" then
  2747. Check.Image = "rbxassetid://4018402187";
  2748. Check.ImageRectSize = Vector2.new(100, 100);
  2749. if Offset == 4 then
  2750. Check.ImageRectOffset = Vector2.new(0, 100);
  2751. else
  2752. Check.ImageRectOffset = Vector2.new(Offset*100, 100);
  2753. end
  2754. else
  2755. Check.Image = Fields.CheckImage;
  2756. Check.ImageRectSize = Vector2.new(0, 0);
  2757. Check.ImageRectOffset = Vector2.new(0, 0);
  2758. end;
  2759. end;
  2760. end,
  2761. {
  2762. CreateLabel = function(self, Text)
  2763. --Setup
  2764. local Meta = GetMeta(self);
  2765. local Main = Meta.___Instance;
  2766.  
  2767. local Label = Instance.new("TextLabel", Main);
  2768. Label.Text = Text;
  2769. Label.Name = _PREFIX.."Label";
  2770. Label.BackgroundTransparency = 1;
  2771. Label.BorderSizePixel = 0;
  2772. Label.Font = VLb_Defaults.Font;
  2773. Label.TextColor3 = VLb_Defaults.TextColor;
  2774. Label.TextTransparency = VLb_Defaults.TextTransparency;
  2775. Label.TextYAlignment = Enum.TextYAlignment.Center;
  2776. Label.Size = UDim2.new(0, 0, 1, 0);
  2777.  
  2778. Meta.___TextRender = Label;
  2779.  
  2780. self:Redraw("Label");
  2781. end,
  2782. Check = function(self, MetroStyle)
  2783. --Setup
  2784. local Meta = GetMeta(self);
  2785. local Main = Meta.___Instance;
  2786. local Fields = Meta.___Fields;
  2787.  
  2788. if MetroStyle == nil then
  2789. MetroStyle = Fields.MetroStyle;
  2790. end;
  2791.  
  2792. local Box = Meta.Box;
  2793. local Check = Meta.Check;
  2794. local BoxTarget, CheckTarget;
  2795.  
  2796. if not Fields.Checked then
  2797. BoxTarget = {
  2798. ImageColor3 = Fields.StartBoxColor3,
  2799. ImageTransparency = Fields.StartBoxTransparency
  2800. };
  2801. CheckTarget = {
  2802. ImageColor3 = Fields.StartCheckColor3,
  2803. ImageTransparency = Fields.StartCheckTransparency,
  2804. Size = UDim2.new(
  2805. Fields.StartCheckSize,
  2806. 0,
  2807. Fields.StartCheckSize,
  2808. 0
  2809. )
  2810. };
  2811. else
  2812. BoxTarget = {
  2813. ImageColor3 = Fields.EndBoxColor3,
  2814. ImageTransparency = Fields.EndBoxTransparency
  2815. };
  2816. CheckTarget = {
  2817. ImageColor3 = Fields.EndCheckColor3,
  2818. ImageTransparency = Fields.EndCheckTransparency,
  2819. Size = UDim2.new(
  2820. Fields.EndCheckSize,
  2821. 0,
  2822. Fields.EndCheckSize,
  2823. 0
  2824. )
  2825. };
  2826. end;
  2827.  
  2828. if MetroStyle then
  2829. TweenService:Create(
  2830. Box,
  2831. Fields.MetroTweenInfo,
  2832. {
  2833. ImageColor3 = BoxTarget.ImageColor3,
  2834. ImageTransparency = BoxTarget.ImageTransparency
  2835. }
  2836. ):Play();
  2837. TweenService:Create(
  2838. Check,
  2839. Fields.MetroTweenInfo,
  2840. {
  2841. ImageColor3 = CheckTarget.ImageColor3,
  2842. ImageTransparency = CheckTarget.ImageTransparency,
  2843. Size = CheckTarget.Size
  2844. }
  2845. ):Play();
  2846. else
  2847. Box.ImageColor3 = BoxTarget.ImageColor3;
  2848. Box.ImageTransparency = BoxTarget.ImageTransparency;
  2849.  
  2850. Check.ImageColor3 = CheckTarget.ImageColor3;
  2851. Check.ImageTransparency = CheckTarget.ImageTransparency;
  2852. Check.Size = CheckTarget.Size;
  2853. end;
  2854. end;
  2855. }
  2856. );
  2857.  
  2858. VIn_CreateClass("FillBox",
  2859. {
  2860. --Main
  2861. Parent = "\2\1\0",
  2862. ClassName = "\3\0\1string",
  2863. Checked = "\3\0\0boolean",
  2864. Size = "\3\0\0number",
  2865. LeftLabel = "\3\0\0boolean",
  2866. LabelPadding = "\3\0\0number",
  2867.  
  2868. --Appearance
  2869. StartBoxColor3 = "\4\0\0Color3",
  2870. EndBoxColor3 = "\4\0\0Color3",
  2871. StartBoxTransparency = "\3\0\0number",
  2872. EndBoxTransparency = "\3\0\0number",
  2873. FillBoxType = "\0\0\0FillBoxType",
  2874.  
  2875. --Events
  2876. CheckChanged = "\4\0\1Instance",
  2877.  
  2878. --Methods
  2879. Check = "\4\0\1function",
  2880. CreateLabel = "\4\0\1function",
  2881. Redraw = "\4\0\1function"
  2882. },
  2883. {
  2884.  
  2885. },
  2886. function(Parent)
  2887. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.FillBox);
  2888. --Proxy Setup
  2889. Fields.ClassName = "VeraniumFillBox";
  2890. Fields.Parent = Parent;
  2891. Fields.Checked = false;
  2892. Fields.Size = 20;
  2893. Fields.LeftLabel = false;
  2894. Fields.LabelPadding = 2;
  2895.  
  2896. Fields.StartBoxColor3 = VLb_Defaults.SecondaryColor;
  2897. Fields.EndBoxColor3 = VLb_Defaults.HighlightColor;
  2898. Fields.StartBoxTransparency = 0;
  2899. Fields.EndBoxTransparency = 0;
  2900. Fields.FillBoxType = VLb_Enums.FillBoxType.Smooth;
  2901. --Methods Setup
  2902. Fields.Redraw = VIn_Data.FillBox.Redraw;
  2903. Fields.Check = VIn_Data.FillBox.Check;
  2904. Fields.CreateLabel = VIn_Data.FillBox.CreateLabel;
  2905. --Elements Creation
  2906. local Main = Instance.new("Frame", GetPInstance(Parent));
  2907. local Box = Instance.new("ImageButton", Main);
  2908.  
  2909. local CheckChanged = Instance.new("BindableEvent", Main);
  2910. --Main Setup
  2911. Main.BackgroundTransparency = 1;
  2912. Main.BorderSizePixel = 0;
  2913. Main.Name = "VeraniumFillBox";
  2914. Main.ZIndex = VLb_Defaults.ZIndex;
  2915. Main.Size = UDim2.new(0, 17, 0, 17);
  2916. --Box Setup
  2917. Box.BackgroundTransparency = 1;
  2918. Box.BorderSizePixel = 0;
  2919. Box.Size = UDim2.new(1, 0, 1, 0);
  2920. Box.Position = UDim2.new(0.5, 0, 0.5, 0);
  2921. Box.AnchorPoint = Vector2.new(0.5, 0.5);
  2922. Box.ImageRectSize = Vector2.new(50, 50);
  2923. Box.Name = _PREFIX.."Box";
  2924. --Events
  2925. CheckChanged.Name = _PREFIX.."CheckChanged";
  2926. Fields.CheckChanged = CheckChanged.Event;
  2927. --Changed Signal
  2928. Cs.Parent = Main;
  2929. --Connections
  2930. Box.MouseButton1Up:Connect(function()
  2931. Fields.Checked = not Fields.Checked;
  2932. CheckChanged:Fire(true);
  2933. Proxy:Check(true, true);
  2934. end);
  2935. --MetaData Setup
  2936. Meta.___Instance = Main;
  2937. Meta.___Base2D = Main;
  2938.  
  2939. Meta.Box = Box;
  2940. Meta.CheckChanged = CheckChanged;
  2941. --First Draw
  2942. Proxy:Check(false, true);
  2943. VIn_Data.FillBox.Redraw(Proxy);
  2944.  
  2945. return Proxy;
  2946. end,
  2947. function(self, Field, Value)
  2948. --Setup
  2949. local Meta = GetMeta(self);
  2950. local Main = Meta.___Instance;
  2951. local Fields = Meta.___Fields;
  2952. local Label = Meta.___TextRender;
  2953. local Box = Meta.Box;
  2954. local CheckChanged = Meta.CheckChanged;
  2955.  
  2956. --Size
  2957. if Field == nil or Field == "Size" then
  2958. Main.Size = UDim2.new(0, Fields.Size, 0, Fields.Size);
  2959. if Field then return; end;
  2960. end;
  2961. --FillBoxType
  2962. if Field == nil or Field == "FillBoxType" then
  2963. local Texture = VCf_GetEnumLValue("FillBoxType", Fields.FillBoxType);
  2964. Box.Image = Texture;
  2965. if Field then return; end;
  2966. end;
  2967. --Label | LeftLabel | LabelPadding
  2968. if (Field == nil or Field == "Label"
  2969. or Field == "LeftLabel" or Field == "LabelPadding") and Label then
  2970. if Fields.LeftLabel then
  2971. Label.AnchorPoint = Vector2.new(1, 0.5);
  2972. Label.Position = UDim2.new(0, -Fields.LabelPadding, 0.5, 0);
  2973. Label.TextXAlignment = Enum.TextXAlignment.Right;
  2974. else
  2975. Label.AnchorPoint = Vector2.new(0, 0.5);
  2976. Label.Position = UDim2.new(1, Fields.LabelPadding, 0.5, 0);
  2977. Label.TextXAlignment = Enum.TextXAlignment.Left;
  2978. end;
  2979. end;
  2980. --Pretty much all appearance-related properties
  2981. if Field == nil or Field == "StartBoxColor3"
  2982. or Field == "EndBoxTransparency" or Field == "StartBoxTransparency"
  2983. or Field == "EndBoxTransparency" or Field == "Checked" then
  2984. if Field == "Checked" then
  2985. CheckChanged:Fire(false);
  2986. end;
  2987. self:Check(true, true);
  2988. if Field then return; end;
  2989. end;
  2990. end,
  2991. {
  2992. CreateLabel = function(self, Text)
  2993. --Setup
  2994. local Meta = GetMeta(self);
  2995. local Main = Meta.___Instance;
  2996.  
  2997. local Label = Instance.new("TextLabel", Main);
  2998. Label.Name = _PREFIX.."Label";
  2999. Label.Text = Text;
  3000. Label.BackgroundTransparency = 1;
  3001. Label.BorderSizePixel = 0;
  3002. Label.Font = VLb_Defaults.Font;
  3003. Label.TextColor3 = VLb_Defaults.TextColor;
  3004. Label.TextTransparency = VLb_Defaults.TextTransparency;
  3005. Label.TextYAlignment = Enum.TextYAlignment.Center;
  3006. Label.Size = UDim2.new(0, 0, 1, 0);
  3007.  
  3008. Meta.___TextRender = Label;
  3009.  
  3010. self:Redraw("Label");
  3011. end,
  3012. Check = function(self, Tween, Yield)
  3013. local Meta = GetMeta(self);
  3014. local Main = Meta.___Instance;
  3015. local Box = Meta.Box;
  3016. local Fields = Meta.___Fields;
  3017.  
  3018. if Tween == nil then
  3019. Tween = true;
  3020. end;
  3021. if Yield == nil then
  3022. Yield = true;
  3023. end;
  3024.  
  3025. local StartOffset, EndOffset, Step, SCol, ECol, St, Et =
  3026. 0, 700, 50, Fields.StartBoxColor3, Fields.EndBoxColor3,
  3027. Fields.StartBoxTransparency, Fields.EndBoxTransparency;
  3028. if not Fields.Checked then
  3029. StartOffset, EndOffset, Step, SCol, ECol, St, Et =
  3030. 650, -50, -50, Fields.EndBoxColor3, Fields.StartBoxColor3,
  3031. Fields.EndBoxTransparency, Fields.StartBoxTransparency;
  3032. end;
  3033. if math.floor(Box.ImageRectOffset.X) == math.floor(EndOffset-Step) and Tween then
  3034. Box.ImageColor3 = ECol;
  3035. Box.ImageTransparency = Et;
  3036. return;
  3037. end;
  3038. local CVal = StartOffset;
  3039.  
  3040. local function Animate()
  3041. repeat RunService.Heartbeat:Wait();
  3042. Box.ImageRectOffset = Vector2.new(CVal, 0);
  3043. Box.ImageColor3 = VLb_CVMath.MapColor(SCol, ECol, StartOffset, EndOffset, CVal);
  3044. Box.ImageTransparency = VLb_CVMath.Map(CVal, StartOffset, EndOffset, St, Et);
  3045. CVal = CVal + Step;
  3046. until math.floor(CVal) == math.floor(EndOffset); -- Because lua:tm: is very epic it switches integers to floats at random!
  3047. Box.ImageColor3 = ECol;
  3048. Box.ImageTransparency = Et;
  3049. end;
  3050. if Tween then
  3051. if Yield then
  3052. spawn(Animate);
  3053. else
  3054. Animate();
  3055. end;
  3056. else
  3057. Box.ImageRectOffset = Vector2.new(EndOffset-Step);
  3058. Box.ImageColor3 = ECol;
  3059. Box.ImageTransparency = Et;
  3060. end;
  3061. Animate = nil;
  3062. end;
  3063. }
  3064. );
  3065.  
  3066. VIn_CreateClass("Counter",
  3067. {
  3068. --Main
  3069. Parent = "\2\1\0",
  3070. ClassName = "\3\0\1string",
  3071. Padding = "\3\0\0number",
  3072.  
  3073. --Functionality
  3074. Value = "\3\0\0number",
  3075. MinValue = "\3\0\0number",
  3076. MaxValue = "\3\0\0number",
  3077. Step = "\3\0\0number",
  3078.  
  3079. --Appearance
  3080. SubtractColor3 = "\4\0\0Color3",
  3081. AddColor3 = "\4\0\0Color3",
  3082. SubtractTransparency = "\3\0\0number",
  3083. AddTransparency = "\3\0\0number",
  3084. SubtractImage = "\3\0\0string",
  3085. AddImage = "\3\0\0string",
  3086. ButtonSize = "\3\0\0number",
  3087. DisabledButtonColor3 = "\4\0\0Color3",
  3088.  
  3089. --Events
  3090. ValueChanged = "\4\0\1Instance",
  3091.  
  3092. --Methods
  3093. Redraw = "\3\0\1function"
  3094. },
  3095. {
  3096.  
  3097. },
  3098. function(Parent)
  3099. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Counter);
  3100. --Proxy Setup
  3101. Fields.ClassName = "VeraniumCounter";
  3102. Fields.Parent = Parent;
  3103. Fields.Padding = 3;
  3104.  
  3105. Fields.Value = 1;
  3106. Fields.MinValue = 0;
  3107. Fields.MaxValue = 10;
  3108. Fields.Step = 1;
  3109.  
  3110. Fields.SubtractColor3 = VLb_Defaults.HighlightColor;
  3111. Fields.AddColor3 = VLb_Defaults.HighlightColor;
  3112. Fields.SubtractTransparency = 0;
  3113. Fields.AddTransparency = 0;
  3114. Fields.SubtractImage = "";
  3115. Fields.AddImage = "";
  3116. Fields.ButtonSize = 15;
  3117. Fields.DisabledButtonColor3 = VLb_Defaults.SecondaryColor;
  3118. --Methods Setup
  3119. Fields.Redraw = VIn_Data.Counter.Redraw;
  3120. --Elements Creation
  3121. local Main = Instance.new("Frame", GetPInstance(Parent));
  3122. local Background = VIn_Data.Background.Constructor(Main);
  3123. local TextRender = Instance.new("TextLabel", Main);
  3124. local Subtract = Instance.new("ImageButton", Main);
  3125. local Add = Instance.new("ImageButton", Main);
  3126.  
  3127. local ValueChanged = Instance.new("BindableEvent", Main);
  3128. --Main Setup
  3129. Main.BackgroundTransparency = 1;
  3130. Main.BorderSizePixel = 0;
  3131. Main.Name = "VeraniumCounter";
  3132. Main.Size = UDim2.new(0, 60, 0, 20);
  3133. Main.ZIndex = VLb_Defaults.ZIndex
  3134. --TextRender Setup
  3135. TextRender.BackgroundTransparency = 1;
  3136. TextRender.BorderSizePixel = 0;
  3137. TextRender.AnchorPoint = Vector2.new(0.5, 0.5);
  3138. TextRender.Position = UDim2.new(0.5, 0, 0.5, 0);
  3139. TextRender.Name = _PREFIX.."TextRender";
  3140. --TextRender Defaults
  3141. TextRender.TextColor3 = VLb_Defaults.TextColor;
  3142. TextRender.TextTransparency = VLb_Defaults.TextTransparency;
  3143. TextRender.Font = VLb_Defaults.Font;
  3144. TextRender.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  3145. TextRender.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  3146. TextRender.TextXAlignment = VLb_Defaults.TextXAlignment;
  3147. TextRender.TextYAlignment = VLb_Defaults.TextYAlignment;
  3148. --Subtract Setup
  3149. Subtract.BackgroundTransparency = 1;
  3150. Subtract.BorderSizePixel = 0;
  3151. Subtract.Position = UDim2.new(0, 0, 0.5, 0);
  3152. Subtract.AnchorPoint = Vector2.new(0, 0.5);
  3153. Subtract.Name = _PREFIX.."Subtract";
  3154. --Add Setup
  3155. Add.BackgroundTransparency = 1;
  3156. Add.BorderSizePixel = 0;
  3157. Add.Position = UDim2.new(1, 0, 0.5, 0);
  3158. Add.AnchorPoint = Vector2.new(1, 0.5);
  3159. Add.Name = _PREFIX.."Add";
  3160. --Events
  3161. ValueChanged.Name = _PREFIX.."ValueChanged";
  3162. Fields.ValueChanged = ValueChanged.Event;
  3163. --Changed Signal
  3164. Cs.Parent = Main;
  3165. --Connections
  3166. Subtract.MouseButton1Up:Connect(function()
  3167. if Fields.Value - Fields.Step < Fields.MinValue then
  3168. Fields.Value = Fields.MinValue;
  3169. else
  3170. Fields.Value = Fields.Value - Fields.Step;
  3171. end;
  3172. TextRender.Text = tostring(Fields.Value);
  3173. Proxy:Redraw("Value");
  3174. end);
  3175. Add.MouseButton1Up:Connect(function()
  3176. if Fields.Value + Fields.Step > Fields.MaxValue then
  3177. Fields.Value = Fields.MaxValue;
  3178. else
  3179. Fields.Value = Fields.Value + Fields.Step;
  3180. end;
  3181. TextRender.Text = tostring(Fields.Value);
  3182. Proxy:Redraw("Value");
  3183. end);
  3184. --MetaData Setup
  3185. Meta.___Instance = Main;
  3186. Meta.___Base2D = Main;
  3187. Meta.___TextRender = TextRender;
  3188.  
  3189. Meta.Subtract = Subtract;
  3190. Meta.Add = Add;
  3191. Meta.ValueChanged = ValueChanged;
  3192. --First Draw
  3193. VIn_Data.Counter.Redraw(Proxy);
  3194.  
  3195. return Proxy;
  3196. end,
  3197. function(self, Field, Value)
  3198. --Setup
  3199. local Meta = GetMeta(self);
  3200. local Main = Meta.___Instance;
  3201. local Fields = Meta.___Fields;
  3202. local TextRender = Meta.___TextRender;
  3203. local Subtract = Meta.Subtract;
  3204. local Add = Meta.Add;
  3205. local ValueChanged = Meta.ValueChanged;
  3206.  
  3207. --Values
  3208. if Field == nil or Field == "Value" or Field == "MinValue"
  3209. or Field == "MaxValue" or Field == "Step"
  3210. or Field == "DisabledButtonColor3" then
  3211. if Fields.Value >= Fields.MaxValue then
  3212. Fields.Value = Fields.MaxValue;
  3213. Add.ImageColor3 = Fields.DisabledButtonColor3;
  3214. else
  3215. Add.ImageColor3 = Fields.AddColor3;
  3216. end;
  3217. if Fields.Value <= Fields.MinValue then
  3218. Fields.Value = Fields.MinValue;
  3219. Subtract.ImageColor3 = Fields.DisabledButtonColor3;
  3220. else
  3221. Subtract.ImageColor3 = Fields.SubtractColor3;
  3222. end;
  3223. TextRender.Text = tostring(Fields.Value);
  3224. if Field then return; end;
  3225. end;
  3226. --Subtract Appearance
  3227. if Field == nil or Field == "SubtractColor3"
  3228. or Field == "SubtractTransparency" or Field == "SubtractImage" then
  3229. Subtract.ImageColor3 = Fields.SubtractColor3
  3230. Subtract.ImageTransparency = Fields.SubtractTransparency
  3231. if Fields.SubtractImage == "" then
  3232. Subtract.Image = "rbxassetid://4486615470";
  3233. else
  3234. Subtract.Image = Fields.SubtractImage
  3235. end;
  3236. if Field then return; end;
  3237. end;
  3238. --Add Appearance
  3239. if Field == nil or Field == "AddColor3"
  3240. or Field == "AddTransparency" or Field == "AddImage" then
  3241. Add.ImageColor3 = Fields.AddColor3
  3242. Add.ImageTransparency = Fields.AddTransparency
  3243. if Fields.AddImage == "" then
  3244. Add.Image = "rbxassetid://4486614839";
  3245. else
  3246. Add.Image = Fields.AddImage
  3247. end;
  3248. if Field then return; end;
  3249. end;
  3250. --ButtonSize
  3251. if Field == nil or Field == "ButtonSize" or Field == "Padding" then
  3252. Subtract.Size = UDim2.new(0, Fields.ButtonSize, 0, Fields.ButtonSize);
  3253. Add.Size = Subtract.Size;
  3254. Subtract.Position = UDim2.new(0, Fields.Padding, 0.5, 0);
  3255. Add.Position = UDim2.new(1, -Fields.Padding, 0.5, 0);
  3256. TextRender.Size = UDim2.new(1, -Fields.ButtonSize*2, 1, 0);
  3257. if Field then return; end;
  3258. end;
  3259. end,
  3260. {
  3261.  
  3262. }
  3263. );
  3264.  
  3265. --DropdownBox is written by Uniqua, it should be a different style.
  3266. local function GetNdx(List, Idx)
  3267. for Ndx, Val in pairs(List)do
  3268. if Val.Idx == Idx then
  3269. return Ndx-1;
  3270. end;
  3271. end;
  3272. end;
  3273. VIn_CreateClass("DropdownBox",
  3274. {
  3275. --Main
  3276. Parent = "\2\1\0",
  3277. ClassName = "\3\0\1string",
  3278. Size = "\4\0\0Vector2",
  3279. Enabled = "\3\0\0boolean",
  3280. Padding = "\3\0\0Vector2",
  3281.  
  3282. --Text
  3283. Text = "\3\0\0string",
  3284. Font = "\4\0\0EnumItem",
  3285. TextSize = "\3\0\0number",
  3286. TextColor3 = "\4\0\0Color3",
  3287.  
  3288. --Utility
  3289. Scroll = "\3\0\0number",
  3290. IsOpen = "\3\0\1boolean",
  3291. CanUnselect = "\3\0\0boolean",
  3292. SelectedIndex = "\5\1\1", -- OwO I don't know if there is a VCf_IsA that accept
  3293. SelectedValue = "\5\1\1", -- every type of value passed, So \5 is my answer OwO !
  3294. MaxDrop = "\3\0\0number", -- You can customize the max drop of the open :3
  3295. ShowSelected = "\3\0\0boolean", -- If true and IsOpen true When you select an Item, the Button.Text will change to the index of the item selected
  3296. UseIndex = "\3\0\0boolean", -- If true all Items will be named with their index, else all items will be named with their values
  3297.  
  3298. --Appearance
  3299. BoxColor3 = "\4\0\0Color3",
  3300. BoxHoverColor3 = "\4\0\0Color3",
  3301. BoxOpenedColor3 = "\4\0\0Color3",
  3302. ArrowColor3 = "\4\0\0Color3",
  3303. ArrowSize = "\3\0\0number",
  3304.  
  3305. --Events
  3306. Opened = "\4\0\1Instance",
  3307. Closed = "\4\0\1Instance",
  3308. ListChanged = "\4\0\1Instance",
  3309. SelectionChanged = "\4\0\1Instance",
  3310.  
  3311. --TweenInfo
  3312. ExpandTweenInfo = "\4\0\0TweenInfo",
  3313. SlideTweenInfo = "\4\0\0TweenInfo",
  3314. ScrollTweenInfo = "\4\0\0TweenInfo",
  3315. ElasticyTweenInfo = "\4\0\0TweenInfo",
  3316.  
  3317. --ItemFields
  3318. ItemHoverColor3 = "\4\0\0Color3",
  3319. ItemHoverOffset = "\3\0\0number",
  3320. ItemSelectedColor3 = "\4\0\0Color3",
  3321. ItemSelectedOffset = "\3\0\0number",
  3322. --Title
  3323. TitleHoverColor3 = "\4\0\0Color3",
  3324.  
  3325. --End/Start Animation
  3326. BorderSizePixel = "\3\0\0number",
  3327. HoverBorderSizePixel = "\3\0\0number",
  3328. OpenBorderSizePixel = "\3\0\0number",
  3329. EndArrowColor3 = "\4\0\0Color3",
  3330.  
  3331. --Methods
  3332. Redraw = "\4\0\1function",
  3333. Reset = "\4\0\1function",
  3334. Open = "\4\0\1function",
  3335. Close = "\4\0\1function",
  3336. Select = "\4\0\1function",
  3337. Unselect = "\4\0\1function",
  3338. RemoveItem = "\4\0\1function",
  3339. AddItem = "\4\0\1function"
  3340. },
  3341. {
  3342. TextColor = "TextColor3",
  3343. ArrowColor = "ArrowColor3",
  3344. BoxColor = "BoxColor3",
  3345. TitleOverColor = "TitleOverColor3",
  3346. SelectedColor = "ItemSelectedColor3",
  3347. },
  3348. function(Parent, List)
  3349. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.DropdownBox);
  3350. List = List or {};
  3351.  
  3352. if typeof(List) ~= "table" then
  3353. Proxy, Meta, Fields = nil;
  3354. Cs:Remove();
  3355. Cs:Destroy();
  3356. return error("Expected a table or nil for List.");
  3357. else
  3358. local Items = {};
  3359. for Idx, Val in pairs(List)do
  3360. Items[Idx] = Val;
  3361. end;
  3362. List = Items;
  3363. Items = nil;
  3364. end;
  3365. --Fields Setup
  3366. Fields.ClassName = "VeraniumDropdownBox";
  3367. Fields.Parent = Parent;
  3368. Fields.Size = Vector2.new(115, 25);
  3369. Fields.Enabled = true;
  3370. Fields.Padding = Vector2.new(5, 0);
  3371.  
  3372. Fields.Text = "DropdownBox";
  3373. Fields.Font = VLb_Defaults.Font;
  3374. Fields.TextColor3 = VLb_Defaults.TextColor;
  3375. Fields.TextSize = 8;
  3376.  
  3377. Fields.Scroll = 0;
  3378. Fields.IsOpen = false;
  3379. Fields.SelectedIndex = 0;
  3380. Fields.SelectedValue = nil;
  3381. Fields.MaxDrop = 3;
  3382. Fields.ShowSelected = true;
  3383. Fields.UseIndex = false;
  3384. Fields.SelectedBox = nil;
  3385.  
  3386. Fields.BoxColor3 = VLb_Defaults.BackgroundColor;
  3387. Fields.BoxHoverColor3 = VLb_Defaults.BackgroundColor;
  3388. Fields.BoxOpenedColor3 = VLb_Defaults.SecondaryColor;
  3389. Fields.ArrowColor3 = VLb_ModernColors.Silver;
  3390. Fields.ArrowSize = 10;
  3391.  
  3392. Fields.ExpandTweenInfo = TweenInfo.new(
  3393. 0.5,
  3394. Enum.EasingStyle.Sine,
  3395. Enum.EasingDirection.Out
  3396. );
  3397. Fields.SlideTweenInfo = TweenInfo.new(
  3398. 0.25,
  3399. Enum.EasingStyle.Sine,
  3400. Enum.EasingDirection.Out
  3401. );
  3402. Fields.ScrollTweenInfo = TweenInfo.new(
  3403. 0.25,
  3404. Enum.EasingStyle.Quad,
  3405. Enum.EasingDirection.Out
  3406. );
  3407. Fields.ElasticyTweenInfo = TweenInfo.new(
  3408. 0.25,
  3409. Enum.EasingStyle.Sine,
  3410. Enum.EasingDirection.Out
  3411. );
  3412.  
  3413. Fields.ItemHoverColor3 = VLb_Defaults.HighlightColor;
  3414. Fields.ItemHoverOffset = 10;
  3415. Fields.ItemSelectedColor3 = VLb_Defaults.HighlightColor;
  3416. Fields.ItemSelectedOffset = 5;
  3417.  
  3418. Fields.TitleHoverColor3 = VLb_Defaults.TextColor;
  3419.  
  3420. Fields.BorderSizePixel = VLb_Defaults.BorderSize;
  3421. Fields.HoverBorderSizePixel = VLb_Defaults.BorderSize;
  3422. Fields.OpenBorderSizePixel = VLb_Defaults.BorderSize;
  3423. Fields.EndArrowColor3 = VLb_ModernColors.Silver;
  3424.  
  3425. --Methods Setup
  3426. Fields.AddItem = VIn_Data.DropdownBox.AddItem;
  3427. Fields.RemoveItem = VIn_Data.DropdownBox.RemoveItem;
  3428. Fields.Open = VIn_Data.DropdownBox.Open;
  3429. Fields.Close = VIn_Data.DropdownBox.Close;
  3430. Fields.Select = VIn_Data.DropdownBox.Select;
  3431. Fields.Unselect = VIn_Data.DropdownBox.Unselect;
  3432. Fields.Redraw = VIn_Data.DropdownBox.Redraw;
  3433.  
  3434. --Elements Creation
  3435. local Main = Instance.new("Frame", GetPInstance(Parent));
  3436. local Background = VIn_Data.Background.Constructor(Main);
  3437. Background:CreateBorder();
  3438. local Arrow = Instance.new("ImageLabel", Main);
  3439. local Title = Instance.new("TextButton", Main);
  3440. local ElementCanvas = Instance.new("Frame", Main);
  3441. local ElementContainer = Instance.new("Frame", ElementCanvas);
  3442.  
  3443. local SelectionChanged = Instance.new("BindableEvent", Main);
  3444. local Opened = Instance.new("BindableEvent", Main);
  3445. local Closed = Instance.new("BindableEvent", Main);
  3446. local ListChanged = Instance.new("BindableEvent", Main);
  3447.  
  3448. --Main Setup
  3449. Main.BackgroundTransparency = 1;
  3450. Main.BorderSizePixel = 0;
  3451. Main.Name = _PREFIX.."VeraniumDropdownBox";
  3452.  
  3453. --Arrow Setup
  3454. Arrow.Name = _PREFIX.."Arrow";
  3455. Arrow.BackgroundTransparency = 1;
  3456. Arrow.BorderSizePixel = 0;
  3457. Arrow.Image = "rbxassetid://3931363707";
  3458. Arrow.AnchorPoint = Vector2.new(1, 0.5);
  3459.  
  3460. --Title Setup
  3461. Title.Name = _PREFIX.."Title";
  3462. Title.BackgroundTransparency = 1;
  3463. Title.AnchorPoint = Vector2.new(0.5, 0);
  3464. Title.TextXAlignment = Enum.TextXAlignment.Left;
  3465.  
  3466. --ElementCanvas Setup
  3467. ElementCanvas.Name = _PREFIX.."ElementCanvas";
  3468. ElementCanvas.BackgroundTransparency = 1;
  3469. ElementCanvas.BorderSizePixel = 0;
  3470. ElementCanvas.AnchorPoint = Vector2.new(0.5, 1);
  3471. ElementCanvas.Position = UDim2.new(0.5, 0, 1, 0);
  3472. ElementCanvas.ClipsDescendants = true;
  3473.  
  3474. --ElementContainer Setup
  3475. ElementContainer.Name = _PREFIX.."ElementContainer";
  3476. ElementContainer.BackgroundTransparency = 1;
  3477. ElementContainer.BorderSizePixel = 0;
  3478. ElementContainer.AnchorPoint = Vector2.new(0.5, 0);
  3479. ElementContainer.Position = UDim2.new(0.5, 0, 0, 0);
  3480. ElementContainer.Size = UDim2.new(1, 0, 0, 0);
  3481. ElementContainer.ClipsDescendants = false;
  3482.  
  3483. --Signal Setups
  3484. ListChanged.Name = "ListChanged";
  3485. Opened.Name = "Opened";
  3486. Closed.Name = "Closed";
  3487. SelectionChanged.Name = "SelectionChanged";
  3488.  
  3489. Fields.SelectionChanged = SelectionChanged.Event;
  3490. Fields.Opened = Opened.Event;
  3491. Fields.Closed = Closed.Event;
  3492. Fields.ListChanged = ListChanged.Event;
  3493.  
  3494. --Connections
  3495. local Layer = 0;
  3496. Main.Changed:Connect(function(Field)
  3497. if Field == "BackgroundColor3" then
  3498. Background.BackgroundColor3 = Main.BackgroundColor3;
  3499. end;
  3500. end);
  3501. Main.MouseEnter:Connect(function()
  3502. if not Fields.IsOpen then
  3503. Main.BackgroundColor3 = Fields.BoxHoverColor3;
  3504. end;
  3505. end);
  3506. Main.MouseLeave:Connect(function()
  3507. if not Fields.IsOpen then
  3508. Main.BackgroundColor3 = Fields.BoxColor3;
  3509. end;
  3510. end);
  3511. Title.MouseEnter:Connect(function()
  3512. Title.TextColor3 = Fields.TitleHoverColor3;
  3513. end);
  3514. Title.MouseLeave:Connect(function()
  3515. Title.TextColor3 = Fields.TextColor3;
  3516. end);
  3517. Title.MouseButton1Down:Connect(function()
  3518. if not Fields.Enabled then return; end;
  3519. Fields.IsOpen = not Fields.IsOpen;
  3520. if Fields.IsOpen then
  3521. Proxy:Open();
  3522. Opened:Fire();
  3523. else
  3524. Proxy:Close();
  3525. Closed:Fire();
  3526. end;
  3527. end);
  3528. ElementCanvas.MouseWheelBackward:Connect(function()
  3529. local MaxDrop = math.min(Fields.MaxDrop-1, #List-1);
  3530. Fields.Scroll = Fields.Scroll + 1;
  3531. if Fields.Scroll > (#List - MaxDrop - 1) then
  3532. Fields.Scroll = #List - MaxDrop - 1;--Elasticy Effect
  3533. TweenService:Create(
  3534. ElementContainer,
  3535. Fields.ElasticyTweenInfo,
  3536. {
  3537. Position = UDim2.new(0.5, 0, 0,
  3538. (-Fields.Scroll - 0.25)*Fields.Size.Y)
  3539. }
  3540. ):Play();
  3541. Layer = Layer + 1;
  3542. local LayerBackup = Layer;
  3543. wait(Fields.ElasticyTweenInfo.Time);
  3544. if LayerBackup ~= Layer then
  3545. return;
  3546. else
  3547. Layer = 0;
  3548. end;
  3549. end;
  3550. TweenService:Create(
  3551. ElementContainer,
  3552. Fields.ScrollTweenInfo,
  3553. {
  3554. Position = UDim2.new(0.5, 0, 0,
  3555. (-Fields.Scroll)*Fields.Size.Y)
  3556. }
  3557. ):Play();
  3558. end);
  3559. ElementCanvas.MouseWheelForward:Connect(function()
  3560. Fields.Scroll = Fields.Scroll - 1;
  3561. if Fields.Scroll < 0 then
  3562. Fields.Scroll = 0;--Elasticy Effect
  3563. TweenService:Create(
  3564. ElementContainer,
  3565. Fields.ElasticyTweenInfo,
  3566. {
  3567. Position = UDim2.new(0.5, 0, 0,
  3568. Fields.Size.Y*0.25)
  3569. }
  3570. ):Play();
  3571. Layer = Layer + 1;
  3572. local LayerBackup = Layer;
  3573. wait(Fields.ElasticyTweenInfo.Time);
  3574. if LayerBackup ~= Layer then
  3575. return;
  3576. else
  3577. Layer = 0;
  3578. end;
  3579. end;
  3580. TweenService:Create(
  3581. ElementContainer,
  3582. Fields.ScrollTweenInfo,
  3583. {
  3584. Position = UDim2.new(0.5, 0, 0,
  3585. (-Fields.Scroll)*Fields.Size.Y)
  3586. }
  3587. ):Play();
  3588. end);
  3589. --ChangedSignal Setup
  3590. Cs.Parent = Main;
  3591. --Meta Setup
  3592. Meta.___Instance = Main;
  3593. Meta.___Base2D = Main;
  3594. Meta.___Background = Background;
  3595. Meta.___TextRender = Title;
  3596.  
  3597. Meta.ElementCanvas = ElementCanvas;
  3598. Meta.ElementContainer = ElementContainer;
  3599. Meta.Arrow = Arrow;
  3600. Meta.Title = Title;
  3601.  
  3602. Meta.List = {};
  3603. Meta.MouseHover = false;
  3604.  
  3605. Meta.ListChanged = ListChanged;
  3606. Meta.SelectionChanged = SelectionChanged;
  3607. Meta.Opened = Opened;
  3608. Meta.Closed = Closed;
  3609.  
  3610. --List Setup
  3611. for Idx, Val in pairs(List) do
  3612. Proxy:AddItem(Idx, Val);
  3613. end;
  3614. --First Draw
  3615. VIn_Data.DropdownBox.Redraw(Proxy);
  3616.  
  3617. return Proxy;
  3618. end,
  3619. function(self, Field, Value)
  3620. local Meta = GetMeta(self);
  3621. --Instances
  3622. local Main = Meta.___Instance;
  3623. local Background = Meta.___Background;
  3624. local Title = Meta.___TextRender;
  3625. local Arrow = Meta.Arrow;
  3626. local ElementCanvas = Meta.ElementCanvas;
  3627. --Utility
  3628. local Items = Meta.Items;
  3629. local List = Meta.List;
  3630. --Fields
  3631. local Fields = Meta.___Fields;
  3632.  
  3633. --Padding/Size
  3634. if Field == nil or Field == "Padding" or Field == "Size"
  3635. or Field == "ArrowSize" then
  3636. if not Fields.IsOpen then
  3637. Main.Size = UDim2.new(0, Fields.Size.X, 0, Fields.Size.Y);
  3638. else
  3639. Main.Size = UDim2.new(0, Fields.Size.X,
  3640. 0, Fields.Size.Y * (Fields.MaxDrop + 1));
  3641. end;
  3642. Title.Position = UDim2.new(0.5, Fields.Padding.X, 0, 0);
  3643. Title.Size = UDim2.new(1, -Fields.Padding.X, 0, Fields.Size.Y);
  3644. Arrow.Position = UDim2.new(1, -Fields.Padding.X, 0, math.floor(Fields.Size.Y/2));
  3645. Arrow.Size = UDim2.new(0, Fields.ArrowSize, 0, Fields.ArrowSize);
  3646. ElementCanvas.Size = UDim2.new(1, 0, 1, - Fields.Size.Y);
  3647. for Idx, Val in pairs(List)do
  3648. local Item = Val.Item;
  3649. Item.Position = UDim2.new(0, Fields.Padding.X, 0,
  3650. Fields.Size.Y * (Idx-1));
  3651. Item.Size = UDim2.new(1, 0, 0, Fields.Size.Y);
  3652. end;
  3653. if Field then return; end;
  3654. end;
  3655.  
  3656. --Text
  3657. if Field == nil or Field == "Text" or Field == "Font"
  3658. or Field == "TextSize" or Field == "TextColor3" then
  3659. if Fields.ShowSelected then
  3660. if Fields.UseIndex then
  3661. if Fields.SelectedIndex ~= nil then
  3662. Title.Text = tostring(Fields.SelectedIndex);
  3663. else
  3664. Title.Text = Fields.Text;
  3665. end;
  3666. else
  3667. if Fields.SelectedValue ~= nil then
  3668. Title.Text = tostring(Fields.SelectedValue);
  3669. else
  3670. Title.Text = Fields.Text;
  3671. end;
  3672. end;
  3673. else
  3674. Title.Text = Fields.Text;
  3675. end;
  3676. Title.Font = Fields.Font;
  3677. Title.TextSize = Fields.TextSize;
  3678. Title.TextColor3 = Fields.TextColor3;
  3679. for Idx, Val in pairs(List)do
  3680. local Item = Val.Item;
  3681. Item.Font = Fields.Font;
  3682. Item.TextSize = Fields.TextSize;
  3683. Item.TextColor3 = Fields.TextColor3;
  3684. end;
  3685. if Field then return; end;
  3686. end;
  3687.  
  3688. --MaxDrop Scroll
  3689. if (Field == nil or Field == "MaxDrop") and Fields.IsOpen or Field == "Scroll" then
  3690. Main.Size = UDim2.new(0, Fields.Size.X,
  3691. 0, Fields.Size.Y * (Fields.MaxDrop + 1));
  3692. if Fields.Scroll < 0 then
  3693. Fields.Scroll = 0;
  3694. end;
  3695. if Fields.Scroll > (#List - Fields.MaxDrop - 1) then
  3696. Fields.Scroll = #List - Fields.MaxDrop - 1;
  3697. end;
  3698. TweenService:Create(
  3699. ElementContainer,
  3700. Fields.ScrollTweenInfo,
  3701. {
  3702. Position = UDim2.new(0.5, 0, 0,
  3703. (-Fields.Scroll)*Fields.Size.Y)
  3704. }
  3705. ):Play();
  3706. if Field then return; end;
  3707. end;
  3708.  
  3709. --UseIndex
  3710. if Field == nil or Field == "UseIndex" then
  3711. for Idx, Val in pairs(List) do
  3712. local Item = Val.Item;
  3713. if Fields.UseIndex then
  3714. Item.Text = Val.Idx;
  3715. else
  3716. Item.Text = Val.Val;
  3717. end;
  3718. end;
  3719. if Field then return; end;
  3720. end;
  3721.  
  3722. --Box Appearance
  3723. if Field == nil or Field == "BoxColor3"
  3724. or Field == "BoxHoverColor3" or Field == "BoxOpenedColor3"
  3725. or Field == "BorderSizePixel" or Field == "HoverBorderSizePixel"
  3726. or Field == "OpenBorderSizePixel" then
  3727. if Fields.IsOpen then
  3728. Main.BackgroundColor3 = Fields.BoxOpenedColor3;
  3729. Background.BorderSizePixel = Fields.OpenBorderSizePixel;
  3730. elseif Meta.MouseHover then
  3731. Main.BackgroundColor3 = Fields.BoxHoverColor3;
  3732. Background.BorderSizePixel = Fields.HoverBorderSizePixel;
  3733. else
  3734. Main.BackgroundColor3 = Fields.BoxColor3;
  3735. Background.BorderSizePixel = Fields.BorderSizePixel;
  3736. end;
  3737. if Field then return; end;
  3738. end;
  3739.  
  3740. --Arrow Appearance
  3741. if Field == nil or Field == "ArrowColor3"
  3742. or Field == "EndArrowColor3" then
  3743. if Fields.IsOpen then
  3744. Arrow.ImageColor3 = Fields.EndArrowColor3;
  3745. else
  3746. Arrow.ImageColor3 = Fields.ArrowColor3;
  3747. end;
  3748. if Field then return; end;
  3749. end;
  3750. end,
  3751. {
  3752. AddItem = function(self, Idx, Val)
  3753. if Idx == nil or Val == nil then
  3754. return error("Idx/Val cannot be nil.");
  3755. end;
  3756. local Meta = GetMeta(self);
  3757. local ElementCanvas = Meta.ElementCanvas;
  3758. local ElementContainer = Meta.ElementContainer;
  3759. local List = Meta.List;
  3760. local Fields = Meta.___Fields;
  3761. local Padding = Fields.Padding;
  3762. local ListChanged = Meta.ListChanged;
  3763.  
  3764. local TextRender = Instance.new("TextButton", ElementContainer);
  3765. TextRender.Name = _PREFIX..tostring(Idx);
  3766. TextRender.BackgroundTransparency = 1;
  3767. TextRender.BorderSizePixel = 0;
  3768. TextRender.TextColor3 = Fields.TextColor3;
  3769. TextRender.Font = Fields.Font;
  3770. TextRender.TextSize = Fields.TextSize;
  3771. TextRender.TextColor3 = Fields.TextColor3;
  3772. TextRender.TextXAlignment = Enum.TextXAlignment.Left;
  3773. if Fields.UseIndex then
  3774. TextRender.Text = Idx;
  3775. else
  3776. TextRender.Text = Val;
  3777. end;
  3778. local Ndx = #List;
  3779. TextRender.Position = UDim2.new(0, Fields.Padding.X, 0,
  3780. Fields.Size.Y * (Ndx));
  3781. TextRender.Size = UDim2.new(1, 0, 0, Fields.Size.Y);
  3782. table.insert(List, {
  3783. Idx = Idx,
  3784. Val = Val,
  3785. Item = TextRender
  3786. });
  3787. TextRender.MouseEnter:Connect(function()
  3788. if Fields.SelectedIndex == Idx then return; end;
  3789. Ndx = GetNdx(List, Idx);
  3790. TweenService:Create(
  3791. TextRender,
  3792. Fields.SlideTweenInfo,
  3793. {
  3794. TextColor3 = Fields.ItemHoverColor3,
  3795. Position = UDim2.new(0, Fields.ItemHoverOffset, 0,
  3796. Fields.Size.Y * (Ndx));
  3797. }
  3798. ):Play();
  3799. end);
  3800. TextRender.MouseLeave:Connect(function()
  3801. if Fields.SelectedIndex == Idx then return; end;
  3802. Ndx = GetNdx(List, Idx);
  3803. TweenService:Create(
  3804. TextRender,
  3805. Fields.SlideTweenInfo,
  3806. {
  3807. TextColor3 = Fields.TextColor3,
  3808. Position = UDim2.new(0, Fields.Padding.X, 0,
  3809. Fields.Size.Y * (Ndx));
  3810. }
  3811. ):Play();
  3812. end);
  3813. TextRender.MouseButton1Up:Connect(function()
  3814. if Fields.SelectedIndex == Idx then
  3815. if Fields.CanUnselect then
  3816. self:Unselect();
  3817. end;
  3818. else
  3819. self:Select(Idx);
  3820. end;
  3821. end);
  3822. ListChanged:Fire(true, Idx);
  3823. return TextRender;
  3824. end,
  3825. RemoveItem = function(self, Idx)
  3826. local Meta = GetMeta(self);
  3827. local List = Meta.List;
  3828. local Fields = Meta.___Fields;
  3829. local Padding = Fields.Padding;
  3830. local ListChanged = Meta.ListChanged;
  3831.  
  3832. local Tdx;
  3833. for Ndx, Val in pairs(List) do
  3834. if Val.Idx == Idx then
  3835. Tdx = Ndx;
  3836. break;
  3837. end;
  3838. end;
  3839. for Ndx = Tdx+1, #List, 1 do
  3840. local Item = List[Ndx].Item;
  3841. Item.Position = UDim2.new(0, Fields.Padding.X, 0,
  3842. Fields.Size.Y * (Ndx-2));
  3843. end;
  3844. Tdx = table.remove(List, Tdx);
  3845. Tdx.Item:Remove();Tdx.Item:Destroy();
  3846. Tdx = nil;
  3847. ListChanged:Fire(false, Idx);
  3848. return;
  3849. end,
  3850. Open = function(self)
  3851. local Meta = GetMeta(self);
  3852. local List = Meta.List;
  3853. local Fields = Meta.___Fields;
  3854. local Main = Meta.___Instance;
  3855. local Arrow = Meta.Arrow;
  3856. local MaxDrop = math.min(Fields.MaxDrop+1, #List+1);
  3857. TweenService:Create(
  3858. Main,
  3859. Fields.ExpandTweenInfo,
  3860. {
  3861. Size = UDim2.new(0, Fields.Size.X,
  3862. 0, Fields.Size.Y*MaxDrop),
  3863. BackgroundColor3 = Fields.BoxOpenedColor3
  3864. }
  3865. ):Play();
  3866. TweenService:Create(
  3867. Arrow,
  3868. Fields.ExpandTweenInfo,
  3869. {
  3870. Rotation = 180
  3871. }
  3872. ):Play();
  3873. Meta.Opened:Fire();
  3874. end,
  3875. Close = function(self)
  3876. local Meta = GetMeta(self);
  3877. local List = Meta.List;
  3878. local Fields = Meta.___Fields;
  3879. local Main = Meta.___Instance;
  3880. local Arrow = Meta.Arrow;
  3881. TweenService:Create(
  3882. Main,
  3883. Fields.ExpandTweenInfo,
  3884. {
  3885. Size = UDim2.new(0, Fields.Size.X,
  3886. 0, Fields.Size.Y),
  3887. BackgroundColor3 = Fields.BoxColor3
  3888. }
  3889. ):Play();
  3890. TweenService:Create(
  3891. Arrow,
  3892. Fields.ExpandTweenInfo,
  3893. {
  3894. Rotation = 0
  3895. }
  3896. ):Play();
  3897. Meta.Closed:Fire();
  3898. end,
  3899. Select = function(self, Idx)
  3900. local Meta = GetMeta(self);
  3901. local Fields = Meta.___Fields;
  3902. local List = Meta.List;
  3903. local Item;
  3904. for Ndx, Val in pairs(List)do
  3905. if Val.Idx == Idx then
  3906. Item = Val;
  3907. break;
  3908. end;
  3909. end;
  3910. Fields.SelectedIndex = Idx;
  3911. Fields.SelectedValue = Item.Val;
  3912. self:Redraw("Text");
  3913.  
  3914. TweenService:Create(Item.Item,
  3915. Fields.SlideTweenInfo,
  3916. {
  3917. TextColor3 = Fields.ItemSelectedColor3,
  3918. Position = UDim2.new(0, Fields.ItemSelectedOffset, 0,
  3919. Item.Item.Position.Y.Offset)
  3920. }
  3921. ):Play();
  3922. Meta.SelectionChanged:Fire(Idx, Item.Val);
  3923. end,
  3924. Unselect = function(self)
  3925. local Meta = GetMeta(self);
  3926. local Fields = Meta.___Fields;
  3927. local List = Meta.List;
  3928. local Item;
  3929. for Ndx, Val in pairs(List)do
  3930. if Val.Idx == Fields.SelectedIndex then
  3931. Item = Val;
  3932. break;
  3933. end;
  3934. end;
  3935. Fields.SelectedIndex = nil;
  3936. Fields.SelectedValue = nil;
  3937. self:Redraw("Text");
  3938.  
  3939. TweenService:Create(Item.Item,
  3940. Fields.SlideTweenInfo,
  3941. {
  3942. TextColor3 = Fields.ItemSelectedColor3,
  3943. Position = UDim2.new(0, Fields.Padding.X, 0,
  3944. Item.Item.Position.Y.Offset)
  3945. }
  3946. ):Play();
  3947. Meta.SelectionChanged:Fire();
  3948. end
  3949. }
  3950. );
  3951.  
  3952. VIn_CreateClass("Expander",
  3953. {
  3954. --Main
  3955. Parent = "\2\1\0",
  3956. ClassName = "\3\0\1string",
  3957. MinSize = "\4\0\0Vector2",
  3958. MaxSize = "\4\0\0Vector2",
  3959. Enabled = "\3\0\0boolean",
  3960. Padding = "\3\0\0Vector2",
  3961.  
  3962. --Utility
  3963. IsOpen = "\3\0\1boolean",
  3964.  
  3965. --Appearane
  3966. ArrowColor3 = "\4\0\0Color3",
  3967. ArrowSize = "\3\0\0number",
  3968.  
  3969. --Events
  3970. ExpandChanged = "\4\0\1Instance",
  3971.  
  3972. --TweenInfo
  3973. ExpandTweenInfo = "\4\0\0TweenInfo",
  3974.  
  3975. --End/Start Animation
  3976. EndArrowColor3 = "\4\0\0Color3",
  3977.  
  3978. --Methods
  3979. Redraw = "\4\0\1function",
  3980. Expand = "\4\0\1function"
  3981. },
  3982. {
  3983. Title = "Text",
  3984. TitleColor = "TextColor3",
  3985. TitleColor3 = "TextColor3"
  3986. },
  3987. function(Parent, List)
  3988. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Expander);
  3989. --Fields Setup
  3990. Fields.ClassName = "VeraniumExpander";
  3991. Fields.Parent = Parent;
  3992. Fields.MinSize = Vector2.new(115, 25);
  3993. Fields.MaxSize = Vector2.new(115, 100);
  3994. Fields.Enabled = true;
  3995. Fields.Padding = Vector2.new(5, 0);
  3996.  
  3997. Fields.IsOpen = false;
  3998.  
  3999. Fields.ArrowColor3 = VLb_ModernColors.Silver;
  4000. Fields.ArrowSize = 10;
  4001.  
  4002. Fields.ExpandTweenInfo = TweenInfo.new(
  4003. 0.5,
  4004. Enum.EasingStyle.Sine,
  4005. Enum.EasingDirection.Out
  4006. );
  4007.  
  4008. Fields.EndArrowColor3 = VLb_ModernColors.Silver;
  4009.  
  4010. --Methods Setup
  4011. Fields.Expand = VIn_Data.Expander.Expand;
  4012. Fields.Redraw = VIn_Data.Expander.Redraw;
  4013.  
  4014. --Elements Creation
  4015. local Main = Instance.new("Frame", GetPInstance(Parent));
  4016. local Background = VIn_Data.Background.Constructor(Main);
  4017. local Arrow = Instance.new("ImageLabel", Main);
  4018. local Title = Instance.new("TextButton", Main);
  4019. local ElementCanvas = Instance.new("Frame", Main);
  4020.  
  4021. local ExpandChanged = Instance.new("BindableEvent", Main);
  4022.  
  4023. --Main Setup
  4024. Main.BackgroundTransparency = 1;
  4025. Main.BorderSizePixel = 0;
  4026. Main.Name = _PREFIX.."VeraniumExpander";
  4027.  
  4028. --Arrow Setup
  4029. Arrow.Name = _PREFIX.."Arrow";
  4030. Arrow.BackgroundTransparency = 1;
  4031. Arrow.BorderSizePixel = 0;
  4032. Arrow.Image = "rbxassetid://3931363707";
  4033. Arrow.AnchorPoint = Vector2.new(1, 0.5);
  4034.  
  4035. --Title Setup
  4036. Title.Name = _PREFIX.."Title";
  4037. Title.Text = "Expander"
  4038. Title.BackgroundTransparency = 1;
  4039. Title.AnchorPoint = Vector2.new(0.5, 0);
  4040. Title.TextXAlignment = Enum.TextXAlignment.Left;
  4041. --Title Defaults
  4042. Title.TextColor3 = VLb_Defaults.TextColor;
  4043. Title.TextTransparency = VLb_Defaults.TextTransparency;
  4044. Title.Font = VLb_Defaults.Font;
  4045.  
  4046. Title.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  4047. Title.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  4048.  
  4049. --ElementCanvas Setup
  4050. ElementCanvas.Name = _PREFIX.."ElementCanvas";
  4051. ElementCanvas.BackgroundTransparency = 1;
  4052. ElementCanvas.BorderSizePixel = 0;
  4053. ElementCanvas.AnchorPoint = Vector2.new(0.5, 1);
  4054. ElementCanvas.Position = UDim2.new(0.5, 0, 1, 0);
  4055. ElementCanvas.ClipsDescendants = true;
  4056.  
  4057. --Signal Setups
  4058. ExpandChanged.Name = "ExpandChanged";
  4059. Fields.ExpandChanged = ExpandChanged.Event;
  4060.  
  4061. --Connections
  4062. Title.MouseButton1Down:Connect(function()
  4063. if not Fields.Enabled then return; end;
  4064. Proxy:Expand();
  4065. end);
  4066. --ChangedSignal Setup
  4067. Cs.Parent = Main;
  4068. --Meta Setup
  4069. Meta.___Instance = Main;
  4070. Meta.___Base2D = Main;
  4071. Meta.___Background = Background;
  4072. Meta.___TextRender = Title;
  4073. Meta.___Children = ElementCanvas;
  4074.  
  4075. Meta.ElementCanvas = ElementCanvas;
  4076. Meta.Arrow = Arrow;
  4077. Meta.Title = Title;
  4078.  
  4079. Meta.ExpandChanged = ExpandChanged;
  4080. --First Draw
  4081. VIn_Data.Expander.Redraw(Proxy);
  4082.  
  4083. return Proxy;
  4084. end,
  4085. function(self, Field, Value)
  4086. local Meta = GetMeta(self);
  4087. --Instances
  4088. local Main = Meta.___Instance;
  4089. local Background = Meta.___Background;
  4090. local Title = Meta.___TextRender;
  4091. local Arrow = Meta.Arrow;
  4092. local ElementCanvas = Meta.___Children;
  4093. --Fields
  4094. local Fields = Meta.___Fields;
  4095.  
  4096. --Padding/Size
  4097. if Field == nil or Field == "Padding" or Field == "Size"
  4098. or Field == "ArrowSize" then
  4099. if not Fields.IsOpen then
  4100. Main.Size = UDim2.new(0, Fields.MinSize.X, 0, Fields.MinSize.Y);
  4101. else
  4102. Main.Size = UDim2.new(0, Fields.MaxSize.X, 0, Fields.MaxSize.Y);
  4103. end;
  4104. Title.Position = UDim2.new(0.5, Fields.Padding.X, 0, 0);
  4105. Title.Size = UDim2.new(1, -Fields.Padding.X, 0, Fields.MinSize.Y);
  4106. Arrow.Position = UDim2.new(1, -Fields.Padding.X, 0, math.floor(Fields.MinSize.Y/2));
  4107. Arrow.Size = UDim2.new(0, Fields.ArrowSize, 0, Fields.ArrowSize);
  4108. ElementCanvas.Size = UDim2.new(1, 0, 1, - Fields.MinSize.Y);
  4109. if Field then return; end;
  4110. end;
  4111. --Arrow Appearance
  4112. if Field == nil or Field == "ArrowColor3"
  4113. or Field == "EndArrowColor3" then
  4114. if Fields.IsOpen then
  4115. Arrow.ImageColor3 = Fields.EndArrowColor3;
  4116. else
  4117. Arrow.ImageColor3 = Fields.ArrowColor3;
  4118. end;
  4119. if Field then return; end;
  4120. end;
  4121. end,
  4122. {
  4123. Expand = function(self)
  4124. local Meta = GetMeta(self);
  4125. local Fields = Meta.___Fields;
  4126. local Main = Meta.___Instance;
  4127. local Arrow = Meta.Arrow;
  4128. Fields.IsOpen = not Fields.IsOpen;
  4129. if Fields.IsOpen then
  4130. TweenService:Create(
  4131. Main,
  4132. Fields.ExpandTweenInfo,
  4133. {
  4134. Size = UDim2.new(0, Fields.MaxSize.X, 0, Fields.MaxSize.Y)
  4135. }
  4136. ):Play();
  4137. TweenService:Create(
  4138. Arrow,
  4139. Fields.ExpandTweenInfo,
  4140. {
  4141. Rotation = 180
  4142. }
  4143. ):Play();
  4144. else
  4145. TweenService:Create(
  4146. Main,
  4147. Fields.ExpandTweenInfo,
  4148. {
  4149. Size = UDim2.new(0, Fields.MinSize.X, 0, Fields.MinSize.Y)
  4150. }
  4151. ):Play();
  4152. TweenService:Create(
  4153. Arrow,
  4154. Fields.ExpandTweenInfo,
  4155. {
  4156. Rotation = 0
  4157. }
  4158. ):Play();
  4159. end;
  4160. Meta.ExpandChanged:Fire();
  4161. end
  4162. }
  4163. );
  4164.  
  4165. VIn_CreateClass("Window",
  4166. {
  4167. --Main
  4168. Parent = "\2\1\0",
  4169. ClassName = "\3\0\1string",
  4170. CornerSize = "\3\0\0number",
  4171. CornerType = "\0\0\0CornerType",
  4172. Padding = "\4\0\0Vector2",
  4173.  
  4174. --Appearance:TopBar
  4175. TopBarColor3 = "\4\0\0Color3",
  4176. TopBarTransparency = "\3\0\0number",
  4177. TopBarSize = "\3\0\0number",
  4178. IconSize = "\3\0\0number",
  4179. TopBarDraggable = "\3\0\0boolean",
  4180.  
  4181. --Methods
  4182. Redraw = "\3\0\1",
  4183. PushButton = "\3\0\1",
  4184. RemoveButton = "\3\0\1"
  4185. },
  4186. {
  4187. TopBarColor = "TopBarColor3",
  4188. TitleText = "Text",
  4189. TitleColor3 = "TextColor3",
  4190. TitleTextColor3 = "TextColor3",
  4191. IconTexture = "Image",
  4192. IconColor3 = "ImageColor3",
  4193. WindowSize = "Size",
  4194. WindowTransparency = "BackgroundTransparency",
  4195. BoundarySize = "CornerSize",
  4196. Type = "CornerType",
  4197. BoundaryType = "CornerType",
  4198. },
  4199. function(Parent)
  4200. local Proxy, Meta, Fields, Cs = VIn_CreateInstance(VIn_Data.Window);
  4201. local Connections = {};
  4202. local Buttons = {};
  4203. --Fields Setup
  4204. Fields.Parent = Parent;
  4205. Fields.ClassName = "VeraniumWindow";
  4206. Fields.CornerSize = VLb_Defaults.CornerSize;
  4207. Fields.CornerType = VLb_Defaults.CornerType;
  4208. Fields.Padding = Vector2.new(2, 0);
  4209.  
  4210. Fields.TopBarColor3 = VLb_Defaults.SecondaryColor;
  4211. Fields.TopBarTransparency = 0;
  4212. Fields.TopBarSize = 16;
  4213. Fields.IconSize = 0;
  4214.  
  4215. Fields.TopBarDraggable = true;
  4216.  
  4217. --Methods Setup
  4218. Fields.Redraw = VIn_Data.Window.Redraw;
  4219. Fields.PushButton = VIn_Data.Window.PushButton;
  4220. Fields.RemoveButton = VIn_Data.Window.RemoveButton;
  4221.  
  4222. --Elements Creation
  4223. local Main = Instance.new("Frame", GetPInstance(Parent));
  4224. local Window = VIn_Data.Background.Constructor(Main);
  4225. local TopBar = Instance.new("Frame", Main);
  4226. local TopBarBG = VIn_Data.Button.Constructor(TopBar);
  4227. local Title = Instance.new("TextLabel", GetInstance(TopBar));
  4228. local Icon = Instance.new("ImageLabel", GetInstance(TopBar));
  4229. local ElementCanvas = Instance.new("Frame", Main);
  4230.  
  4231. --Main Setup
  4232. Main.BackgroundTransparency = 1;
  4233. Main.BorderSizePixel = 0;
  4234. Main.Name = "VeraniumWindow";
  4235. Main.Size = UDim2.new(0, 250, 0, 125);
  4236.  
  4237. --TopBar Setup
  4238. TopBar.BackgroundTransparency = 1;
  4239. TopBar.BorderSizePixel = 0;
  4240. TopBar.Size = UDim2.new(1, 0, 0, 20);
  4241. TopBar.Position = UDim2.new(0.5, 0, 0, 0);
  4242. TopBar.AnchorPoint = Vector2.new(0.5, 0);
  4243. TopBar.Name = _PREFIX.."TopBar";
  4244. --TopBarBG Setup
  4245. TopBarBG.BackgroundColor3 = VLb_Defaults.SecondaryColor;
  4246. TopBarBG.Text = "";
  4247. TopBarBG.Size = UDim2.new(1, 0, 1, 0);
  4248. TopBarBG.BottomLeft.Type = VLb_Enums.CornerType.Sharp;
  4249. TopBarBG.BottomRight.Type = VLb_Enums.CornerType.Sharp;
  4250. TopBarBG.MetroStyle = false;
  4251. TopBarBG.Name = _PREFIX.."TopBarBG";
  4252.  
  4253. --Title
  4254. Title.BackgroundTransparency = 1;
  4255. Title.Name = _PREFIX.."Title";
  4256. Title.BorderSizePixel = 0;
  4257. Title.Text = "Vera Window";
  4258. Title.AnchorPoint = Vector2.new(0, 0.5);
  4259. Title.Size = UDim2.new(0, 0, 1, 0);
  4260. Title.TextXAlignment = Enum.TextXAlignment.Left;
  4261. --Title Defaults
  4262. Title.TextColor3 = VLb_Defaults.TextColor;
  4263. Title.TextTransparency = VLb_Defaults.TextTransparency;
  4264. Title.Font = VLb_Defaults.Font;
  4265.  
  4266. Title.TextStrokeColor3 = VLb_Defaults.TextStrokeColor;
  4267. Title.TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency;
  4268.  
  4269. --Icon Setup
  4270. Icon.BackgroundTransparency = 1;
  4271. Icon.BorderSizePixel = 0;
  4272. Icon.Name = _PREFIX.."Icon";
  4273. Icon.AnchorPoint = Vector2.new(0, 0.5);
  4274. Icon.ImageColor3 = VLb_Defaults.HighlightColor;
  4275.  
  4276. --ElementCanvas Setup
  4277. ElementCanvas.Name = _PREFIX.."ElementCanvas";
  4278. ElementCanvas.BackgroundTransparency = 1;
  4279. ElementCanvas.BorderSizePixel = 0;
  4280. ElementCanvas.AnchorPoint = Vector2.new(0.5, 1);
  4281. ElementCanvas.Position = UDim2.new(0.5, 0, 1, 0);
  4282. ElementCanvas.ClipsDescendants = true;
  4283. --Draggability
  4284. local DownPos;
  4285. TopBarBG.MouseButton1Down:Connect(function()
  4286. DownPos = Vector2.new(
  4287. Mouse.X - Main.AbsolutePosition.X,
  4288. Mouse.Y - Main.AbsolutePosition.Y
  4289. );
  4290. end);
  4291. TopBarBG.MouseButton1Up:Connect(function()
  4292. DownPos = nil;
  4293. end);
  4294. Connections[0] = Mouse.Button1Up:Connect(function()
  4295. DownPos = nil;
  4296. end);
  4297. Connections[1] = Mouse.Move:Connect(function()
  4298. if DownPos and Fields.TopBarDraggable then
  4299. Main.AnchorPoint = Vector2.new(0, 0);
  4300. Main.Position = UDim2.new(
  4301. 0,
  4302. Mouse.X - DownPos.X,
  4303. 0,
  4304. Mouse.Y - DownPos.Y
  4305. );
  4306. end;
  4307. end);
  4308. --ChangedSignal Setup
  4309. Cs.Parent = Main;
  4310. --Meta Setup
  4311. Meta.___Instance = Main;
  4312. Meta.___Base2D = Main;
  4313. Meta.___Children = ElementCanvas;
  4314. Meta.___Background = Window;
  4315. Meta.___TextRender = Title;
  4316. Meta.___ImageRender = Icon;
  4317. Meta.___Connection = Connections;
  4318.  
  4319. Meta.TopBar = TopBar;
  4320. Meta.TopBarBG = TopBarBG;
  4321. Meta.Buttons = Buttons;
  4322. --First Draw
  4323. VIn_Data.Window.Redraw(Proxy);
  4324.  
  4325. return Proxy;
  4326. end,
  4327. function(self, Field, Value)
  4328. local Meta = GetMeta(self);
  4329. local Main = Meta.___Instance;
  4330. local ElementCanvas = Meta.___Children;
  4331. local Window = Meta.___Background;
  4332. local Title = Meta.___TextRender;
  4333. local Icon = Meta.___ImageRender;
  4334. local TopBar = Meta.TopBar;
  4335. local TopBarBG = Meta.TopBarBG;
  4336.  
  4337. local Fields = Meta.___Fields;
  4338. local Buttons = Meta.Buttons;
  4339. --Padding
  4340. if Field == nil or Field == "Padding" then
  4341. Icon.Position = UDim2.new(0, Fields.Padding.X, 0.5, 0);
  4342. Title.Position = UDim2.new(0, Fields.IconSize + (Fields.Padding.X*2), 0.5, 0);
  4343. local ButtonOffset = -Fields.Padding.X;
  4344. for Idx, Val in pairs(Buttons)do
  4345. local Button = Val.Button;
  4346. Button.Position = UDim2.new(1, ButtonOffset, 0.5, 0);
  4347. ButtonOffset = ButtonOffset - Btn.Button.AbsoluteSize.X - Fields.Padding.X;
  4348. end;
  4349. if Field then return; end;
  4350. end;
  4351. --CornerSize
  4352. if Field == nil or Field == "CornerSize" or Field == "CornerType" then
  4353. Window.CornerSize = Fields.CornerSize;
  4354. TopBarBG.CornerSize = Fields.CornerSize;
  4355.  
  4356. Window.CornerType = Fields.CornerType;
  4357. TopBarBG.TopLeft.Type = Fields.CornerType;
  4358. TopBarBG.TopRight.Type = Fields.CornerType;
  4359. if Field then return; end;
  4360. end;
  4361. --TopBar Appearance
  4362. if Field == nil or Field == "TopBarColor3" or Field == "TopBarTransparency" then
  4363. TopBarBG.BackgroundColor3 = Fields.TopBarColor3;
  4364. TopBarBG.BackgroundTransparency = Fields.TopBarTransparency;
  4365. if Field then return; end;
  4366. end;
  4367. --TopBarSize
  4368. if Field == nil or Field == "TopBarSize" then
  4369. TopBar.Size = UDim2.new(1, 0, 0, Fields.TopBarSize);
  4370. ElementCanvas.Size = UDim2.new(1, 0, 1, -Fields.TopBarSize);
  4371. if Field then return; end;
  4372. end;
  4373. --IconSize
  4374. if Field == nil or Field == "IconSize" then
  4375. Icon.Size = UDim2.new(0, Fields.IconSize, 0, Fields.IconSize);
  4376. Icon.Position = UDim2.new(0, Fields.Padding.X, 0.5, 0);
  4377. Title.Position = UDim2.new(0, Fields.IconSize + (Fields.Padding.X*2), 0.5, 0);
  4378. if Field then return; end;
  4379. end;
  4380. end,
  4381. {
  4382. PushButton = function(self, Bdx, ButtonSize, ButtonColor, ButtonTexture, ClickFunction)
  4383. local Meta = GetMeta(self);
  4384. local TopBar = Meta.TopBar;
  4385. local Fields = Meta.___Fields;
  4386. local Buttons = Meta.Buttons;
  4387.  
  4388. ButtonSize = ButtonSize or 18;
  4389. ButtonColor = ButtonColor or Color3.new(1, 1, 1);
  4390. ButtonTexture = ButtonTexture or "";
  4391. if type(Bdx) ~= "string" and type(Bdx) ~= "number" then
  4392. error("Arg#1 must be a string or a number.");
  4393. end;
  4394. if Buttons[Bdx] then
  4395. error("A button already exists with the index \""..tostring(Bdx).."\".");
  4396. end;
  4397.  
  4398. local Button = Instance.new("ImageButton", GetInstance(TopBar));
  4399. Button.Name = _PREFIX..tostring(Bdx);
  4400. local Connection = Button.AncestryChanged:Connect(function()
  4401. RunService.Heartbeat:Wait();
  4402. if not Button:IsDescendantOf(TopBar) and VCf_IsVera(self) then
  4403. self:RemoveButton(Bdx);
  4404. end;
  4405. end);
  4406. Button.BackgroundTransparency = 1;
  4407. Button.BorderSizePixel = 0;
  4408. Button.Size = UDim2.new(0, ButtonSize, 0, ButtonSize);
  4409. Button.Image = ButtonTexture;
  4410. Button.AnchorPoint = Vector2.new(1, 0.5);
  4411. local ButtonOffset = -Fields.Padding.X;
  4412. for Idx, Btn in pairs(Buttons) do
  4413. ButtonOffset = ButtonOffset - Btn.Button.AbsoluteSize.X - Fields.Padding.X;
  4414. end;
  4415. Button.Position = UDim2.new(1, ButtonOffset, 0.5, 0);
  4416. Button.ImageColor3 = ButtonColor;
  4417. if type(ClickFunction) == "function" then
  4418. Buttons[Bdx] = {
  4419. Button = Button,
  4420. ClickFunction = ClickFunction,
  4421. Connection = Button.MouseButton1Click:Connect(ClickFunction),
  4422. AncestryChanged = Connection
  4423. }
  4424. else
  4425. Buttons[Bdx] = {
  4426. Button = Button,
  4427. ClickFunction = ClickFunction
  4428. }
  4429. end;
  4430. return Button;
  4431. end,
  4432. RemoveButton = function(self, Bdx)
  4433. local Meta = GetMeta(self);
  4434. local TopBar = Meta.TopBar;
  4435. local Fields = Meta.___Fields;
  4436. local Buttons = Meta.Buttons;
  4437. local Target = Buttons[Bdx];
  4438. if Target and Target.Button then
  4439. Target.Button:Remove();
  4440. Target.Button:Destroy();
  4441. Target.AncestryChanged:Disconnect();
  4442. Target.Button = nil;
  4443. Target.ClickFunction = nil;
  4444. Buttons[Bdx] = nil;
  4445. else
  4446. return false;
  4447. end;
  4448. return true;
  4449. end
  4450. }
  4451. );
  4452.  
  4453. VIn_CreateClass("2DParticleEmmitter",
  4454. {
  4455. --Main
  4456. Parent = "\2\1\0",
  4457. Adornee = "\2\1\0",
  4458. ClassName = "\3\0\1string",
  4459.  
  4460. --Appearance
  4461. StartSize = "\3\0\0number",
  4462. EndSize = "\3\0\0number",
  4463. StartColor3 = "\4\0\0Color3",
  4464. EndColor3 = "\4\0\0Color3",
  4465. StartTransparency = "\3\0\0number",
  4466. EndTransparency = "\3\0\0number",
  4467. Texture = "\3\0\0string",
  4468.  
  4469. --Movement
  4470. DirectionRange = "\4\0\0Vector2",
  4471. Lifetime = "\4\0\0Vector2",
  4472. Speed = "\4\0\0Vector2",
  4473. RotationSpeed = "\3\0\0Vector2",
  4474. },
  4475. {
  4476.  
  4477. },
  4478. function(Parent)
  4479.  
  4480. end,
  4481. function()
  4482. end,
  4483. {
  4484.  
  4485. }
  4486. );
  4487.  
  4488. --[[Instance List: [12/18]
  4489. Core Instances: [2/2]
  4490. [1]: Boundary [Done]
  4491. [2]: Background [Done]
  4492.  
  4493. Basic Instances: [3/3]
  4494. [3]: Label [Done]
  4495. [4]: Button [Done]
  4496. [5]: TextBox [Done]
  4497. [6]: ScrollingFrame
  4498.  
  4499. Standard Instances: [5/7]
  4500. [6]: Slider [Done]
  4501. [7]: CheckBox [Done]
  4502. [8]: FillBox [Done]
  4503. [9]: Swicth
  4504. [10]: TabControl
  4505. [11]: Counter [Done]
  4506. [12]: DropdownBox [Done]
  4507.  
  4508. Complex Instances: [2/6]
  4509. [13]: Window [Done]
  4510. [14]: Expander [Done]
  4511. [15]: 2DParticleEmmitter
  4512. [16]: GifPlayer
  4513. [17]: DisplayList
  4514. [18]: StackDisplay
  4515.  
  4516. Note:
  4517. "Veranium" is a UIL that follows the same rules that RLua does.
  4518. "Vera" is a sub-library that follows the traditional UIL system.
  4519. Veranium can work alone. Vera however, needs Veranium to work.
  4520.  
  4521. Veranium: {Boundary, Background, Label, Button, ScrollBG, Slider, CheckBox
  4522. FillBox, TabControl, Counter, DropdownBox, Expander, 2DParticleEmmitter}
  4523. Vera: {Window, GifPlayer, DisplayList}
  4524. ]]
  4525.  
  4526. local VLb_CTweenService, VCt_BaseData, VCt_Methods, VCt_Meta;
  4527. VCt_BaseData = {};
  4528. VCt_Methods = {
  4529. Play = function(self, DisposeAfterPlay)
  4530. local Meta = VCt_BaseData[self];
  4531.  
  4532. if not Meta then return error("Unable to get tween meta, It might be destroyed."); end;
  4533. local VeraniumInstance = Meta.Instance;
  4534. local Tween = Meta[_PREFIX.."Tween"];
  4535. local Properties = Meta[_PREFIX.."Properties"];
  4536. local Base = Meta[_PREFIX.."Base"];
  4537. local MapValue = VLb_CTweenService.MapValue;
  4538. local StartProperties = {};
  4539. local VTweens = VCt_BaseData[Meta.Instance];
  4540. for Idx, Val in pairs(Properties) do
  4541. StartProperties[Idx] = VeraniumInstance[Idx];
  4542. end;
  4543. for Idx, Val in pairs(VTweens)do
  4544. if Val ~= self then
  4545. local VMeta = VCt_BaseData[Val];
  4546. for Property, Val0 in pairs(VMeta[_PREFIX.."Properties"]) do
  4547. for Property0, Val1 in pairs(Properties)do
  4548. if Property == Property0 then
  4549. VMeta[_PREFIX.."Properties"][Property] = nil;
  4550. break;
  4551. end;
  4552. end;
  4553. end;
  4554. end;
  4555. end;
  4556.  
  4557. local function Update()
  4558. local Markup = Base.Value;
  4559. for Idx, Val in pairs(Properties) do
  4560. if not VCf_IsVera(VeraniumInstance) then
  4561. return;
  4562. end;
  4563. VeraniumInstance[Idx] = MapValue(
  4564. StartProperties[Idx],
  4565. Properties[Idx],
  4566. Markup
  4567. );
  4568. end;
  4569. end;
  4570.  
  4571. local LValue = 0;
  4572. local Connection = RunService.Heartbeat:Connect(function()
  4573. if (Base.Value - LValue) < 0.001 then return; end;
  4574. LValue = Base.Value;
  4575. Update();
  4576. end);
  4577. Tween:Play();
  4578.  
  4579. spawn(function()
  4580. repeat RunService.Heartbeat:Wait();
  4581. until Tween.PlaybackState == Enum.PlaybackState.Completed
  4582. or Tween.PlaybackState == Enum.PlaybackState.Cancelled;
  4583. RunService.Heartbeat:Wait();
  4584. Connection:Disconnect();
  4585. Update();
  4586. Update = nil;
  4587. if Tween.PlaybackState == Enum.PlaybackState.Completed then
  4588. Base.Value = 0;
  4589. end;
  4590. if DisposeAfterPlay then
  4591. self:Remove();
  4592. end;
  4593. end);
  4594. return self;
  4595. end,
  4596. Pause = function(self)
  4597. local Meta = VCt_BaseData[self];
  4598. if not Meta then return error("Unable to get tween meta, It might be destroyed."); end;
  4599. local Tween = Meta[_PREFIX.."Tween"];
  4600. Tween:Pause();
  4601. return self;
  4602. end,
  4603. Cancel = function(self)
  4604. local Meta = VCt_BaseData[self];
  4605. if not Meta then return error("Unable to get tween meta, It might be destroyed."); end;
  4606. local Tween = Meta[_PREFIX.."Tween"];
  4607. Tween:Cancel();
  4608. return self;
  4609. end,
  4610. Destructor = function(self)
  4611. local Meta = VCt_BaseData[self];
  4612. if Meta then
  4613. if type(VCt_BaseData[Meta.Instance]) == "table" then
  4614. for Idx, Val in pairs(VCt_BaseData[Meta.Instance]) do
  4615. if Val == self then
  4616. table.remove(VCt_BaseData[Meta.Instance], Idx);
  4617. end;
  4618. end;
  4619. if #VCt_BaseData[Meta.Instance] == 0 then
  4620. VCt_BaseData[Meta.Instance] = nil;
  4621. end;
  4622. end;
  4623. VCt_BaseData[self] = nil;
  4624. Meta.Instance = nil;
  4625. Meta.TweenInfo = nil;
  4626. Meta.Cancel = nil;
  4627. Meta.Play = nil;
  4628. Meta.Pause = nil;
  4629. Meta[_PREFIX.."Properties"] = nil;
  4630. Meta[_PREFIX.."Base"]:Destroy();
  4631. Meta[_PREFIX.."Base"] = nil;
  4632. Meta[_PREFIX.."Tween"]:Destroy();
  4633. Meta[_PREFIX.."Tween"] = nil;
  4634. Meta[_PREFIX.."Meta"] = nil;
  4635. Meta = nil;
  4636.  
  4637. return true;
  4638. else
  4639. return false;
  4640. end;
  4641. end
  4642. };
  4643. VCt_Methods.Destroy = VCt_Methods.Destructor;
  4644. VCt_Methods.Remove = VCt_Methods.Destructor;
  4645.  
  4646. VCt_Meta = {
  4647. __tostring = function(self)
  4648. if VCt_BaseData[self] then
  4649. return "VeraniumTween";
  4650. else
  4651. return "";
  4652. end;
  4653. end,
  4654. __index = function(self, Field)
  4655. if Field == nil then
  4656. return error("Field can't be nil.");
  4657. end;
  4658. Field = tostring(Field);
  4659. local Meta = VCt_BaseData[self];
  4660. if not Meta then return error("Unable to get tween meta, It might be destroyed."); end;
  4661. if VCt_Methods[Field] then
  4662. return VCt_Methods[Field];
  4663. end;
  4664. if Meta[Field] ~= nil then
  4665. return Meta[Field]
  4666. else
  4667. return Meta[_PREFIX.."Tween"][Field];
  4668. end;
  4669. end,
  4670. __newindex = function(self, Field, Value)
  4671. if Field == nil then
  4672. return error("Field can't be nil.");
  4673. end;
  4674. Field = tostring(Field);
  4675. local Meta = VCt_BaseData[self];
  4676. if not Meta then return error("Unable to get tween meta, It might be destroyed."); end;
  4677. Meta[_PREFIX.."Tween"][Field] = Value;
  4678. end,
  4679. __metatable = "Ara Ara~ What are you doing, User-kun?"--No Context x3
  4680. };
  4681. VLb_CTweenService = {
  4682. Create = function(self, VeraniumInstance, TInfo, Properties)
  4683. local Base = Instance.new("NumberValue");
  4684. Base.Name = _PREFIX.."TweenBase";
  4685. Base.Value = 0;
  4686.  
  4687. local Tween = TweenService:Create(Base, TInfo, {Value = 1});
  4688. Base.Parent = Tween;
  4689.  
  4690. local Proxy = newproxy(true);
  4691. local Meta = getmetatable(Proxy);
  4692. Meta.__index = VCt_Meta.__index;
  4693. Meta.__newindex = VCt_Meta.__newindex;
  4694. Meta.__tostring = VCt_Meta.__tostring;
  4695. Meta.__metatable = VCt_Meta.__metatable;
  4696.  
  4697. local Fields = {};
  4698. for Idx, Val in pairs(Properties)do
  4699. if type(Idx) == "string" and typeof(VeraniumInstance[Idx]) == typeof(Val) then
  4700. Fields[Idx] = Val;
  4701. else
  4702. return error("Invalid setting for "..tostring(Idx)..".");
  4703. end;
  4704. end;
  4705. Properties = Fields;
  4706. Fields = nil;
  4707.  
  4708. VCt_BaseData[Proxy] = {
  4709. Instance = VeraniumInstance,
  4710. TweenInfo = TInfo,
  4711.  
  4712. Cancel = VCt_Methods.Cancel,
  4713. Play = VCt_Methods.Play,
  4714. Pause = VCt_Methods.Pause,
  4715.  
  4716. [_PREFIX.."Properties"] = Properties,
  4717. [_PREFIX.."Base"] = Base,
  4718. [_PREFIX.."Tween"] = Tween,
  4719. [_PREFIX.."Meta"] = Meta
  4720. };
  4721. if type(VCt_BaseData[VeraniumInstance]) == "table" then
  4722. table.insert(VCt_BaseData[VeraniumInstance], Proxy);
  4723. else
  4724. VCt_BaseData[VeraniumInstance] = {Proxy};
  4725. end;
  4726.  
  4727. Tween.Parent = GetMeta(VeraniumInstance).___Instance;
  4728.  
  4729. return Proxy;
  4730. end,
  4731. MapValue = function(StartValue, EndValue, Markup)
  4732. if typeof(StartValue) ~= typeof(EndValue) then
  4733. return;
  4734. end;
  4735. if type(StartValue) == "number" then
  4736. local Difference = EndValue - StartValue;
  4737. return StartValue + (Difference*Markup);
  4738. elseif type(StartValue) == "string" then
  4739. local TargetLenght = math.floor((#EndValue)*Markup);
  4740. if Markup == 1 then
  4741. return EndValue;
  4742. end;
  4743. return EndValue:sub(1, TargetLenght)..StartValue:sub(TargetLenght+1, -1);
  4744. elseif typeof(StartValue) == "Color3" then
  4745. local R, G, B;
  4746. R = EndValue.r - StartValue.r;
  4747. G = EndValue.g - StartValue.g;
  4748. B = EndValue.b - StartValue.b;
  4749.  
  4750. R = StartValue.r + (R*Markup);
  4751. G = StartValue.g + (G*Markup);
  4752. B = StartValue.b + (B*Markup);
  4753.  
  4754. return Color3.new(R, G, B);
  4755. elseif typeof(StartValue) == "Vector2" then
  4756. local X, Y;
  4757. X = EndValue.X - StartValue.X;
  4758. Y = EndValue.Y - StartValue.Y;
  4759.  
  4760. X = StartValue.X + (X*Markup);
  4761. Y = StartValue.Y + (Y*Markup);
  4762.  
  4763. return Vector2.new(X, Y);
  4764. elseif typeof(StartValue) == "UDim2" then
  4765. local X0, X1, Y0, Y1;
  4766.  
  4767. X0 = EndValue.X.Scale - StartValue.X.Scale;
  4768. X1 = EndValue.X.Offset - StartValue.X.Offset;
  4769. Y0 = EndValue.Y.Scale - StartValue.Y.Scale;
  4770. Y1 = EndValue.Y.Offset - StartValue.Y.Offset;
  4771.  
  4772. X0 = StartValue.X.Scale + (X0*Markup);
  4773. X1 = StartValue.X.Offset + (X1*Markup);
  4774. Y0 = StartValue.Y.Scale + (Y0*Markup);
  4775. Y1 = StartValue.Y.Offset + (Y1*Markup);
  4776.  
  4777. return UDim2.new(X0, X1, Y0, Y1);
  4778. else
  4779. if Markup >= 0.5 then
  4780. return EndValue;
  4781. else
  4782. return StartValue;
  4783. end;
  4784. end;
  4785. end
  4786. };
  4787. VIn_Methods.Tween = function(self, ...)
  4788. return VLb_CTweenService:Create(self, ...);
  4789. end;
  4790.  
  4791. VIn_Methods.Fade = function(self, Time, Transparency, EasingStyle, EasingDirection)
  4792. --Defaults
  4793. VCf_AssertIsVera(self);
  4794. Time = Time or 1;
  4795. Transparency = Transparency or 1;
  4796. EasingStyle = EasingStyle or Enum.EasingStyle.Sine;
  4797. EasingDirection = EasingDirection or Enum.EasingDirection.Out;
  4798.  
  4799. --Tween Create
  4800. local Layer = VIn_SReg.TransparencyLayer[self.ClassName];
  4801. if not Layer then
  4802. return warn("This Class doesn't have a fade method.");
  4803. end;
  4804. local Properties = {};
  4805. for Idx, Val in pairs(Layer)do
  4806. Properties[Val] = Transparency;
  4807. end;
  4808.  
  4809. local Tween = self:Tween(TweenInfo.new(
  4810. Time,
  4811. EasingStyle,
  4812. EasingDirection
  4813. ), Properties):Play();
  4814. Tween.Name = _PREFIX.."FadeTween";
  4815.  
  4816. spawn(function()
  4817. wait(Time);
  4818. Tween:Destroy();
  4819. end);
  4820.  
  4821. return;
  4822. end;
  4823.  
  4824. --Bridge Library
  4825. --NotificationService
  4826. local function VLb_NotificationService()
  4827. local NotificationDefaults;
  4828. local function UpdateDefaults()
  4829. NotificationDefaults = {
  4830. --Background:Corners
  4831. CornerSize = VLb_Defaults.CornerSize,
  4832. CornerType = VLb_Defaults.CornerType,
  4833. --Background:Border
  4834. BorderSize = VLb_Defaults.BorderSize,
  4835. BorderTransparency = VLb_Defaults.BorderTransparency,
  4836. BorderColor3 = VLb_Defaults.BorderColor,
  4837. --Backgroun:self
  4838. BackgroundColor3 = VLb_Defaults.BackgroundColor,
  4839. BackgroundTransparency = VLb_Defaults.BackgroundTransparency,
  4840. --Text Properties
  4841. TextColor3 = VLb_Defaults.TextColor,
  4842. TextTransparency = VLb_Defaults.TextTransparency,
  4843. Font = VLb_Defaults.Font,
  4844. --Text:Stroke
  4845. TextStrokeColor3 = VLb_Defaults.TextStrokeColor,
  4846. TextStrokeTransparency = VLb_Defaults.TextStrokeTransparency,
  4847.  
  4848. IconColor = VLb_Defaults.TextColor,
  4849. IconSize = 12,
  4850. Padding = 4
  4851. };
  4852. end;
  4853. UpdateDefaults();
  4854. local function ApplyNotificationProperties(Notification, Properties)
  4855. for Idx, Val in pairs(NotificationDefaults) do
  4856. Val = Properties[Idx] or Val;
  4857. if Idx ~= "IconColor" and Idx ~= "Padding" and Idx ~= "IconSize" then
  4858. Notification[Idx] = Val;
  4859. end;
  4860. end;
  4861. local Val = Properties.SideColor;
  4862. if Val then
  4863. Notification.TopLeft.BackgroundColor3 = Val;
  4864. Notification.LeftBorder.BackgroundColor3 = Val;
  4865. Notification.BottomLeft.BackgroundColor3 = Val;
  4866. end;
  4867. end;
  4868.  
  4869. local Notifications = {};
  4870. local NotificationFrame = Instance.new("Frame", VeraniumSpace);
  4871. NotificationFrame.Name = "NotificationFrame";
  4872. NotificationFrame.BackgroundTransparency = 1;
  4873. NotificationFrame.BorderSizePixel = 0;
  4874. NotificationFrame.Size = UDim2.new(1, 0, 0.3, 0);
  4875. NotificationFrame.Position = UDim2.new(0.5, 0, 1, 0);
  4876. NotificationFrame.AnchorPoint = Vector2.new(0.5, 1);
  4877.  
  4878. local function Pop(Ndx, Pixels)
  4879. for Idx, Notification in pairs(Notifications)do
  4880. local AbsolutePosition;
  4881. if VCf_IsVera(Notification) then
  4882. AbsolutePosition = Notification.Abs;
  4883. end;
  4884. if Notification and VCf_IsVera(Notification) and AbsolutePosition.Value < Ndx then
  4885. AbsolutePosition.Value = AbsolutePosition.Value + Pixels;
  4886. Notification:Tween(
  4887. TweenInfo.new(
  4888. 0.5,
  4889. Enum.EasingStyle.Sine,
  4890. Enum.EasingDirection.Out
  4891. ),
  4892. {
  4893. Position = UDim2.new(
  4894. 0.5,
  4895. Notification.Position.X.Offset,
  4896. 0.5,
  4897. AbsolutePosition.Value
  4898. )
  4899. }
  4900. ):Play(true);
  4901. end;
  4902. end;
  4903. end;
  4904.  
  4905. local function Push(Pixels)
  4906. for Idx, Notification in pairs(Notifications) do if VCf_IsVera(Notification) then
  4907. local AbsolutePosition = Notification.Abs;
  4908. AbsolutePosition.Value = AbsolutePosition.Value - Pixels;
  4909. Notification:Tween(
  4910. TweenInfo.new(
  4911. 0.5,
  4912. Enum.EasingStyle.Sine,
  4913. Enum.EasingDirection.Out
  4914. ),
  4915. {
  4916. Position = UDim2.new(
  4917. 0.5,
  4918. Notification.Position.X.Offset,
  4919. 0.5,
  4920. AbsolutePosition.Value
  4921. )
  4922. }
  4923. ):Play(true);
  4924. end; end;
  4925. end;
  4926.  
  4927. local function ToastNotification(Text, NotificationType, Properties, Duration, ClickFunction)
  4928. --Defaults
  4929. Text = Text or "Veranium ToastNotification";
  4930. if type(NotificationType) ~= "string" then
  4931. NotificationType = NotificationType or VLb_Enums.NotificationType.None;
  4932. NotificationType = VCf_GetEnumLValue("NotificationType", NotificationType);
  4933. end;
  4934. Properties = Properties or {};
  4935. Duration = Duration or (#Text/20);
  4936.  
  4937. local IconSize = Properties.IconSize or NotificationDefaults.IconSize;
  4938. local IconColor = Properties.IconColor or NotificationDefaults.IconColor;
  4939. local Padding = Properties.Padding or NotificationDefaults.Padding;
  4940. local CornerSize = Properties.CornerSize or NotificationDefaults.CornerSize;
  4941.  
  4942. local NotificationBg = VCn_Main("Label", NotificationFrame);
  4943. local Notification = VCn_Main("Button", NotificationBg);
  4944. local AbsolutePosition = Instance.new("NumberValue", NotificationBg:GetInstance());
  4945. AbsolutePosition.Name = "Abs";
  4946. AbsolutePosition.Value = 0;
  4947. NotificationBg.Name = "ToastNotification";
  4948. NotificationBg.Text = "";
  4949. Notification.Name = "Text";
  4950. Notification.Text = Text;
  4951. Notification.Size = UDim2.new(1, 0, 1, 0);
  4952. Notification.AnchorPoint = Vector2.new(0.5, 0.5);
  4953. Notification.Position = UDim2.new(0.5, 0, 0.5, 0);
  4954. Notification.TextXAlignment = Enum.TextXAlignment.Center;
  4955. Notification.TextYAlignment = Enum.TextYAlignment.Center;
  4956. local Icon = Instance.new("ImageLabel", Notification:GetInstance());
  4957. if NotificationType ~= "" then
  4958. Icon.Name = "Icon";
  4959. Icon.BackgroundTransparency = 1;
  4960. Icon.BorderSizePixel = 0;
  4961. Icon.Image = NotificationType;
  4962. Icon.Size = UDim2.new(0, IconSize, 0, IconSize);
  4963. Icon.Name = "Icon";
  4964. Icon.Position = UDim2.new(0, Padding, 0.5, 0);
  4965. Icon.AnchorPoint = Vector2.new(1, 0.5);
  4966. Icon.ImageColor3 = IconColor;
  4967. else
  4968. Icon:Remove();
  4969. Icon:Destroy();
  4970. end;
  4971. ApplyNotificationProperties(Notification, Properties);
  4972. Notification.BackgroundTransparency = 1;
  4973. Notification.BorderTransparency = 1;
  4974. ApplyNotificationProperties(NotificationBg, Properties);
  4975. if NotificationType == "" then
  4976. NotificationBg.Size = UDim2.new(
  4977. 0,
  4978. Notification.TextBounds.X+CornerSize+Padding,
  4979. 0,
  4980. Notification.TextBounds.Y+Padding
  4981. );
  4982. else
  4983. NotificationBg.Size = UDim2.new(
  4984. 0,
  4985. Notification.TextBounds.X+CornerSize+Padding+IconSize,
  4986. 0,
  4987. math.max(IconSize, Notification.TextBounds.Y)+Padding
  4988. );
  4989. Notification.Position = UDim2.new(
  4990. 0,
  4991. IconSize,
  4992. 0.5,
  4993. 0
  4994. );
  4995. Notification.Size = UDim2.new(
  4996. 1,
  4997. -IconSize,
  4998. 0.5,
  4999. 0
  5000. );
  5001. Notification.AnchorPoint = Vector2.new(0, 0.5);
  5002. end;
  5003. NotificationBg.Position = UDim2.new(0.5, 0, 1, 0);
  5004. NotificationBg.AnchorPoint = Vector2.new(0.5, 0);
  5005. if type(ClickFunction) == "function" then
  5006. Notification.MouseButton1Click:Connect(ClickFunction);
  5007. end;
  5008.  
  5009. Push(Notification.TextBounds.Y+Padding);
  5010. NotificationBg:Tween(
  5011. TweenInfo.new(
  5012. 0.5,
  5013. Enum.EasingStyle.Sine,
  5014. Enum.EasingDirection.Out
  5015. ),
  5016. {
  5017. Position = UDim2.new(0.5, 0, 0.5, 0),
  5018. AnchorPoint = Vector2.new(0.5, 0.5)
  5019. }
  5020. ):Play(true);
  5021. local Ndx = #Notifications;
  5022. spawn(function()
  5023. Notifications[Ndx+1] = NotificationBg;
  5024. wait(0.6);
  5025. wait(Duration);
  5026. NotificationBg:Fade(0.5);
  5027. Notification:Fade(0.5);
  5028. TweenService:Create(
  5029. Icon,
  5030. TweenInfo.new(
  5031. 0.5,
  5032. Enum.EasingStyle.Sine,
  5033. Enum.EasingDirection.Out
  5034. ),
  5035. {
  5036. ImageTransparency = 1
  5037. }
  5038. ):Play();
  5039. wait(0.5);
  5040. table.remove(Notifications, Ndx+1);
  5041. Pop(AbsolutePosition.Value, Notification.TextBounds.Y+(Padding*2));
  5042. wait(0.1);
  5043. NotificationBg:Remove();
  5044. Notification:Remove();
  5045. Icon:Remove();
  5046. Icon:Destroy();
  5047. NotificationBg = nil;
  5048. Notification = nil;
  5049. Icon = nil;
  5050. end);
  5051. return NotificationBg;
  5052. end;
  5053.  
  5054. return ToastNotification, NotificationDefaults, UpdateDefaults;
  5055. end;
  5056. --Tooltip
  5057. local function VLb_Tooltip()
  5058. local Tooltip = VCn_Main("Label", VeraniumSpace);
  5059. local TooltipConnections = {};
  5060. Tooltip.Name = "Tooltip";
  5061. Tooltip.ZIndex = 9e5;
  5062. Tooltip.Visible = false;
  5063. Tooltip:CreateBorder();
  5064. local Tooltip_Defaults = {
  5065. --Background:Corners
  5066. CornerSize = 8,
  5067. CornerType = VLb_Enums.CornerType.Smooth,
  5068. --Background:Self
  5069. BackgroundColor3 = VLb_ModernColors.DimMidnightBlue,
  5070. BackgroundTransparency = 0.5,
  5071. --Background:Borders
  5072. BorderSize = 0,
  5073. BorderColor3 = Color3.new(0, 0, 0),
  5074. BorderTransparency = 1,
  5075. --Text Properties
  5076. TextColor3 = VLb_ModernColors.Silver,
  5077. TextSize = 8,
  5078. TextTransparency = 0,
  5079. Font = Enum.Font.Legacy,
  5080. --Text:Stroke
  5081. TextStrokeColor3 = VLb_ModernColors.Abestos,
  5082. TextStrokeTransparency = 1,
  5083.  
  5084. Padding = 8;
  5085. };
  5086. local function ApplyTooltipProperties(Properties)
  5087. for Idx, Val in pairs(Tooltip_Defaults) do
  5088. if Properties[Idx] and Idx ~= "Padding" then
  5089. Tooltip[Idx] = Properties[Idx];
  5090. elseif Idx ~= "Padding" then
  5091. Tooltip[Idx] = Val;
  5092. end;
  5093. end;
  5094. end;
  5095.  
  5096. local HoveredElement;
  5097. --Update
  5098. RunService.Heartbeat:Connect(function()
  5099. local Object = GetInstance(HoveredElement);
  5100. local Connections = TooltipConnections[HoveredElement];
  5101. if typeof(Object) == "Instance" and type(Connections) == "table" then
  5102. Tooltip.Visible = true;
  5103. local APos, ASz, X, Y = Object.AbsolutePosition, Object.AbsoluteSize, Mouse.X, Mouse.Y;
  5104. local Range = APos + ASz;
  5105. if not (APos.X-10 < X and Range.X+10 > X and APos.Y-10 < Y and Range.Y+10 > Y) then
  5106. HoveredElement = nil;
  5107. return;
  5108. end;
  5109. ApplyTooltipProperties(Connections.Properties);
  5110. local Padding = Connections.Properties.Padding or Tooltip_Defaults.Padding;
  5111. Tooltip.Text = Connections.Text;
  5112. Tooltip.Size = UDim2.new(
  5113. 0,
  5114. Tooltip.TextBounds.X + Padding,
  5115. 0,
  5116. Tooltip.TextBounds.Y + Padding
  5117. );
  5118. local XPos, YPos = 1, 1;
  5119. APos, ASz = Vector2.new(X + 20, Y + 20), Tooltip.AbsoluteSize;
  5120. Range = APos + ASz;
  5121. --X Check
  5122. if (Range.X) > VeraniumSpace.AbsoluteSize.X then
  5123. XPos = 0;
  5124. end;
  5125. --Y Check
  5126. if (Range.Y) > VeraniumSpace.AbsoluteSize.Y then
  5127. YPos = 0;
  5128. end;
  5129.  
  5130. Tooltip.Position = UDim2.new(
  5131. 0,
  5132. X + (20*XPos),
  5133. 0,
  5134. Y + (20*YPos)
  5135. );
  5136. Tooltip.AnchorPoint = Vector2.new(math.abs(XPos-1), math.abs(YPos-1));
  5137. else
  5138. Tooltip.Visible = false;
  5139. end;
  5140. end);
  5141.  
  5142. local function LinkTooltip(self, Text, Properties)
  5143. VCf_AssertIsVera(self);
  5144. Text = Text or "";
  5145. Properties = Properties or {};
  5146.  
  5147. if Text == "" then
  5148. local Connections = TooltipConnections[self];
  5149. if Connections then
  5150. Connections.MouseEnter:Disconnect();
  5151. Connections.MouseLeave:Disconnect();
  5152. Connections.MouseLeave = nil;
  5153. Connections.MouseEnter = nil;
  5154. TooltipConnections[self] = nil;
  5155. Connections = nil;
  5156. return false;
  5157. else
  5158. return false;
  5159. end;
  5160. end;
  5161. local Connections = TooltipConnections[self];
  5162. if Connections then
  5163. local Fields = {};
  5164. for Idx, Field in pairs(Properties)do
  5165. Fields[Idx] = Field;
  5166. end;
  5167. Properties, Fields = Fields;
  5168.  
  5169. Connections.Text = Text;
  5170. Connections.Properties = Properties;
  5171.  
  5172. return false;
  5173. end;
  5174.  
  5175. local Object = self:GetInstance();
  5176. Connections = {};
  5177. local Fields = {};
  5178. for Idx, Field in pairs(Properties)do
  5179. Fields[Idx] = Field;
  5180. end;
  5181. Properties, Fields = Fields;
  5182. Connections.MouseEnter = Object.MouseEnter:Connect(function()
  5183. HoveredElement = self;
  5184. end);
  5185. Connections.Text = Text;
  5186. Connections.Properties = Properties;
  5187. TooltipConnections[self] = Connections;
  5188. return true;
  5189. end;
  5190.  
  5191. return TooltipConnections, Tooltip_Defaults, LinkTooltip, Tooltip;
  5192. end;
  5193.  
  5194. local TooltipConnections, Tooltip_Defaults, LinkTooltip;
  5195. local ToastNotification, NotificationDefaults, UpdateDefaults;
  5196.  
  5197. --VCf_Destructor Assignment
  5198. VCf_Destructor = function(self)
  5199. --Tooltip Removal
  5200. if TooltipConnections[self] then
  5201. LinkTooltip(self);
  5202. end;
  5203. --Setup
  5204. local Meta = GetMeta(self);
  5205. if type(Meta) ~= "table" then
  5206. return false;
  5207. end;
  5208. if Meta.___Instance then
  5209. VIn_ParseD[Meta.___Instance] = nil;
  5210. end;
  5211. local Connections = Meta.___Connection;
  5212.  
  5213. if type(Connections) == "table" then
  5214. for Idx, Val in pairs(Connections) do
  5215. Val:Disconnect();
  5216. Connections[Idx] = nil;
  5217. end;
  5218. end;
  5219.  
  5220. for Idx, Val in pairs(Meta) do
  5221. if typeof(Val) == "Instance" or VCf_IsA(Val, "\2\0\0") then
  5222. Val:Remove();
  5223. Val:Destroy();
  5224. Val = nil;
  5225. Meta[Idx] = nil;
  5226. end;
  5227. end;
  5228.  
  5229. Meta.___Fields = nil;
  5230. Meta.___MetaData = nil;
  5231. Meta.___Connection = nil;
  5232. VIn_References[self] = nil;
  5233. self, Meta, Connections = nil;
  5234.  
  5235. return true;
  5236. end;
  5237. --VCf_IsA Assignment
  5238. VCf_IsA = function(Value, ClassName)
  5239. local Instruction = ClassName:sub(1, 1);
  5240. local Nullable = ClassName:sub(2, 2);
  5241. ClassName = ClassName:sub(4, -1);
  5242. if Instruction == "\0" then--VEnum IsA
  5243. local EnumLibrary = VEn_Data[ClassName];
  5244. if EnumLibrary[Value] ~= nil then
  5245. return true;
  5246. elseif VEn_References[Value] ~= nil then
  5247. return VEn_References[Value].___SubLib == ClassName;
  5248. elseif Nullable == "\1" and Value == nil then
  5249. return true;
  5250. else
  5251. return false;
  5252. end;
  5253. elseif Instruction == "\1" then--VCv IsA
  5254. local VCv = (VCv_Data[Value] ~= nil);
  5255. if VCv then
  5256. return true;
  5257. elseif Nullable == "\1" then
  5258. return (Value == nil);
  5259. end;
  5260. elseif Instruction == "\2" then--BaseInstance IsA
  5261. local BaseInstance = (typeof(Value) == "Instance" or VIn_References[Value] ~= nil);
  5262. if BaseInstance then
  5263. return true;
  5264. elseif Nullable == "\1" then
  5265. return (Value == nil);
  5266. end;
  5267. elseif Instruction == "\3" then--type() IsA
  5268. if Nullable == "\0" then
  5269. return (type(Value) == ClassName);
  5270. else
  5271. return ((Value == nil) or (type(Value) == ClassName));
  5272. end;
  5273. elseif Instruction == "\4" then--typeof IsA
  5274. if Nullable == "\0" then
  5275. return (typeof(Value) == ClassName);
  5276. elseif Nullable == "\1" then
  5277. return ((Value == nil) or (typeof(Value) == ClassName));
  5278. end;
  5279. elseif Instruction == "\5" then
  5280. if Nullable == "\0" then
  5281. return (Value ~= nil);
  5282. else
  5283. return true;
  5284. end;
  5285. end;
  5286. end;
  5287.  
  5288. --Setting up Libraries that use Veranium's VIn.
  5289. TooltipConnections, Tooltip_Defaults, LinkTooltip = VLb_Tooltip();
  5290. VLb_Tooltip = {
  5291. Defaults = Tooltip_Defaults,
  5292. LinkTooltip = LinkTooltip
  5293. };
  5294.  
  5295. ToastNotification, NotificationDefaults, UpdateDefaults = VLb_NotificationService();
  5296. VLb_NotificationService = {
  5297. Defaults = NotificationDefaults,
  5298. ToastNotification = ToastNotification,
  5299. UpdateDefaults = UpdateDefaults
  5300. };
  5301.  
  5302. --VIn_Methods Setup
  5303. VIn_Methods.Destructor = VCf_Destructor;
  5304. VIn_Methods.Destroy = VCf_Destructor;
  5305. VIn_Methods.Remove = VCf_Destructor;
  5306. VIn_Methods.GetInstance = GetInstance;
  5307. VIn_Methods.LinkTooltip = LinkTooltip;
  5308.  
  5309. Veranium = {
  5310. Create = VCn_Main,
  5311. Enum = VLb_Enums,
  5312. ModernColors = VLb_ModernColors,
  5313. Defaults = VLb_Defaults,
  5314. CVMath = VLb_CVMath,
  5315. ColorVariant = VLb_ColorVariants,
  5316. TweenService = VLb_CTweenService,
  5317. TooltipService = VLb_Tooltip,
  5318. NotificationService = VLb_NotificationService,
  5319. Core = {
  5320. VeraniumSpace = VeraniumSpace
  5321. }
  5322. };
  5323. return Veranium;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement