Update main.lua
This commit is contained in:
parent
e23becef56
commit
ff09148d2d
137
rpui/main.lua
137
rpui/main.lua
|
|
@ -1,11 +1,11 @@
|
||||||
--[[
|
--[[
|
||||||
The following legacy code is created by blocco.
|
The following legacy code is created by blocco.
|
||||||
|
|
||||||
It contains many comments for documentation purposes.
|
It contains many comments for documentation purposes.
|
||||||
It is to be used for educational purposes.
|
It is to be used for educational purposes.
|
||||||
|
|
||||||
This code is from RBXPri (Blocco Edition).
|
This code is from RBXPri (Blocco Edition).
|
||||||
This file is "main.lua".
|
This file is "main.lua".
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- in case I want people to know what they're using
|
-- in case I want people to know what they're using
|
||||||
|
|
@ -13,14 +13,14 @@ local showVersion, versionString=false, "RBXPri Server/Client (Blocco Edition) v
|
||||||
|
|
||||||
-- robloxLock recursively RobloxLocks objects, no biggie
|
-- robloxLock recursively RobloxLocks objects, no biggie
|
||||||
function robloxLock(obj)
|
function robloxLock(obj)
|
||||||
local function lock(nobj)
|
local function lock(nobj)
|
||||||
for i, v in pairs(nobj:children()) do
|
for i, v in pairs(nobj:children()) do
|
||||||
v.RobloxLocked=true;
|
v.RobloxLocked=true;
|
||||||
lock(v);
|
lock(v);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
obj.RobloxLocked=true;
|
obj.RobloxLocked=true;
|
||||||
lock(obj);
|
lock(obj);
|
||||||
end
|
end
|
||||||
|
|
||||||
-- This is a sort of Locally Persistent Data set-up.
|
-- This is a sort of Locally Persistent Data set-up.
|
||||||
|
|
@ -30,38 +30,38 @@ RbxData={};
|
||||||
|
|
||||||
-- nam = name of value, cs = type of value, val = value of value; this creates or overrides data, it returns nothing
|
-- nam = name of value, cs = type of value, val = value of value; this creates or overrides data, it returns nothing
|
||||||
RbxData.SetValue=function(nam, cs, val)
|
RbxData.SetValue=function(nam, cs, val)
|
||||||
local defVals={String=""; Int=0; Number=0; Bool=false; Object=nil}
|
local defVals={String=""; Int=0; Number=0; Bool=false; Object=nil}
|
||||||
if cs == nil or defVals[cs] == val then
|
if cs == nil or defVals[cs] == val then
|
||||||
if RbxData.GetValue(nam) ~= nil then
|
if RbxData.GetValue(nam) ~= nil then
|
||||||
UserSettings()[nam].Parent = nil
|
UserSettings()[nam].Parent = nil
|
||||||
for i, v in pairs(rd_clbcks) do v(nam) end
|
for i, v in pairs(rd_clbcks) do v(nam) end
|
||||||
return
|
return
|
||||||
elseif RbxData.GetValue(nam) == nil then
|
elseif RbxData.GetValue(nam) == nil then
|
||||||
for i, v in pairs(rd_clbcks) do v(nam) end
|
for i, v in pairs(rd_clbcks) do v(nam) end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
local valo;
|
local valo;
|
||||||
if RbxData.GetValue(nam) == nil then
|
if RbxData.GetValue(nam) == nil then
|
||||||
valo=Instance.new(cs .. "Value", UserSettings());
|
valo=Instance.new(cs .. "Value", UserSettings());
|
||||||
valo.Name = nam;
|
valo.Name = nam;
|
||||||
else
|
else
|
||||||
valo=UserSettings()[nam];
|
valo=UserSettings()[nam];
|
||||||
end
|
end
|
||||||
valo.Value = val;
|
valo.Value = val;
|
||||||
for i, v in pairs(rd_clbcks) do v(nam) end
|
for i, v in pairs(rd_clbcks) do v(nam) end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
-- this finds the data and returns it
|
-- this finds the data and returns it
|
||||||
RbxData.GetValue=function(nam)
|
RbxData.GetValue=function(nam)
|
||||||
return UserSettings():FindFirstChild(nam) and UserSettings()[nam].Value or nil;
|
return UserSettings():FindFirstChild(nam) and UserSettings()[nam].Value or nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
-- in case you want to know when your data changes
|
-- in case you want to know when your data changes
|
||||||
RbxData.AddChangeCallback=function(fn)
|
RbxData.AddChangeCallback=function(fn)
|
||||||
if type(fn) ~= "function" then return end;
|
if type(fn) ~= "function" then return end;
|
||||||
getfenv(fn).disconnect = function() for i, v in pairs(rb_clbcks) do if v == fn then table.remove(rb_clbcks, i) end end end;
|
getfenv(fn).disconnect = function() for i, v in pairs(rb_clbcks) do if v == fn then table.remove(rb_clbcks, i) end end end;
|
||||||
rd_clbcks[#rd_clbcks+1]=fn;
|
rd_clbcks[#rd_clbcks+1]=fn;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set up the UI base so that stuff can be put in it
|
-- set up the UI base so that stuff can be put in it
|
||||||
|
|
@ -96,33 +96,34 @@ uiBase.DescendantRemoving:connect(function()robloxLock(uiBase)end)
|
||||||
|
|
||||||
-- It was neat for me to have showVersion at the top so I didn't have to waste energy scrolling all the way down here
|
-- It was neat for me to have showVersion at the top so I didn't have to waste energy scrolling all the way down here
|
||||||
if showVersion then
|
if showVersion then
|
||||||
local versionLabel = Instance.new("TextLabel");
|
local versionLabel = Instance.new("TextLabel");
|
||||||
versionLabel.Text = versionString;
|
versionLabel.Text = versionString;
|
||||||
versionLabel.Name = "VersionLabel";
|
versionLabel.Name = "VersionLabel";
|
||||||
versionLabel.Size = UDim2.new(0, 420, 0, 20);
|
versionLabel.Size = UDim2.new(0, 420, 0, 20);
|
||||||
versionLabel.Position = UDim2.new(0, 15, 1, -35);
|
versionLabel.Position = UDim2.new(0, 15, 1, -35);
|
||||||
versionLabel.BackgroundTransparency = 1;
|
versionLabel.BackgroundTransparency = 1;
|
||||||
versionLabel.Font = "Arial";
|
versionLabel.Font = "Arial";
|
||||||
versionLabel.FontSize = "Size24";
|
versionLabel.FontSize = "Size24";
|
||||||
versionLabel.TextXAlignment = "Left";
|
versionLabel.TextXAlignment = "Left";
|
||||||
versionLabel.TextTransparency = 0.5;
|
versionLabel.TextTransparency = 0.5;
|
||||||
versionLabel.TextColor3 = Color3.new(0.85, 0.85, 0.85)
|
versionLabel.TextColor3 = Color3.new(0.85, 0.85, 0.85)
|
||||||
versionLabel.ZIndex = 10;
|
versionLabel.ZIndex = 10;
|
||||||
local versionLabelShadow = versionLabel:Clone();
|
local versionLabelShadow = versionLabel:Clone();
|
||||||
versionLabelShadow.Name = "VersionLabelShadow";
|
versionLabelShadow.Name = "VersionLabelShadow";
|
||||||
versionLabelShadow.TextColor3 = Color3.new(0, 0, 0);
|
versionLabelShadow.TextColor3 = Color3.new(0, 0, 0);
|
||||||
versionLabelShadow.TextTransparency = 0.9;
|
versionLabelShadow.TextTransparency = 0.9;
|
||||||
versionLabelShadow.Position = UDim2.new(0, 2, 0, 2);
|
versionLabelShadow.Position = UDim2.new(0, 2, 0, 2);
|
||||||
versionLabelShadow.Parent = versionLabel;
|
versionLabelShadow.Parent = versionLabel;
|
||||||
versionLabel.Parent = uiBase;
|
versionLabel.Parent = uiBase;
|
||||||
versionLabelShadow.ZIndex = 9;
|
versionLabelShadow.ZIndex = 9;
|
||||||
|
|
||||||
versionLabel.MouseEnter:connect(function()
|
-- aesthetics were always important to me
|
||||||
versionLabel.TextTransparency = 0.1;
|
versionLabel.MouseEnter:connect(function()
|
||||||
versionLabelShadow.TextTransparency = 0.6;
|
versionLabel.TextTransparency = 0.1;
|
||||||
end)
|
versionLabelShadow.TextTransparency = 0.6;
|
||||||
versionLabel.MouseLeave:connect(function()
|
end)
|
||||||
versionLabel.TextTransparency = 0.5;
|
versionLabel.MouseLeave:connect(function()
|
||||||
versionLabelShadow.TextTransparency = 0.9;
|
versionLabel.TextTransparency = 0.5;
|
||||||
end)
|
versionLabelShadow.TextTransparency = 0.9;
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue