Advertisement
Meliodas0_0

ProtoSmasher Dragon Ball Z Final Stand Gui

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