Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communications Centre & Notifications update. #573

Merged
merged 8 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MainModule/Client/Core/Variables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ return function()
savedUI = {};
localSounds = {};
ESPObjects = {};
CommunicationsHistory = {};
LightingSettings = {
Ambient = service.Lighting.Ambient;
Brightness = service.Lighting.Brightness;
Expand Down
150 changes: 150 additions & 0 deletions MainModule/Client/UI/Default/CommsCentre.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@

client = nil
service = nil

return function(data)
local gTable, window, commslog, layout;
local messageObjs = {};

local function newMessage(Type, Title, Message, Icon, Time, Function)
print(Icon)

local newMsg = commslog:Add("Frame", {
Size = UDim2.new(1, 0, 0, 50);
BackgroundTransparency = 1;
AutomaticSize = "Y";
Children = {
{ClassName = "Frame";
Name = "LoggedItem";
Size = UDim2.new(1, -10, 1, -10);
Position = UDim2.new(0, 5, 0, 5);
BackgroundTransparency = 0.5;
AutomaticSize = "Y";
Children = {
{ClassName = "ImageButton";
Name = "Icon";
Size = UDim2.new(0, 48, 0, 48);
Position = UDim2.new(0, 1, 0, 1);
Image = Icon;
OnClick = Function;
BackgroundTransparency = 1;
};

{ClassName = "TextButton";
Name = "Title";
Size = UDim2.new(1, -55, 0, 15);
Position = UDim2.new(0, 55, 0, 0);
Text = Title;
TextSize = "14";
TextXAlignment = "Left";
BackgroundTransparency = 1;
OnClick = Function;
};

{ClassName = "TextButton";
Name = "Type";
Size = UDim2.new(1, -55, 0, 15);
Position = UDim2.new(0, 55, 0, 0);
Text = Type;
TextSize = "14";
TextXAlignment = "Right";
BackgroundTransparency = 1;
OnClick = Function;
};

{ClassName = "TextButton";
Name = "Time";
Size = UDim2.new(1, -55, 0, 15);
Position = UDim2.new(0, 55, 0, 15);
Text = Time;
TextSize = "14";
TextXAlignment = "Right";
BackgroundTransparency = 1;
OnClick = Function;
};

{ClassName = "TextButton";
Name = "Function";
Size = UDim2.new(1, -55, 0, 15);
Position = UDim2.new(0, 55, 0, 30);
Text = Function and "Clickable" or "Not clickable";
TextSize = "14";
TextXAlignment = "Right";
BackgroundTransparency = 1;
OnClick = Function;
};

{ClassName = "TextButton";
Name = "Message";
Size = UDim2.new(1, -55, 0, 10);
Position = UDim2.new(0, 55, 0, 15);
Text = Message;
TextXAlignment = "Left";
TextYAlignment = "Top";
AutomaticSize = "Y";
TextWrapped = true;
TextScaled = false;
RichText = true;
BackgroundTransparency = 1;
OnClick = Function;
};
}
}
}
})

table.insert(messageObjs, newMsg);

if #messageObjs > 200 then
messageObjs[1]:Destroy();
table.remove(messageObjs, 1);
end
end

local result, code = pcall(function()
service.LocalizationService:GetCountryRegionForPlayerAsync(game.Players.LocalPlayer)
end)

window = client.UI.Make("Window",{
Name = "CommunicationsCentre";
Title = (result and code == "US") and "Communications Center" or "Communications Centre";
Icon = client.MatIcons.Forum;
Size = {500,300};
OnClose = function()
client.Variables.CommsCentreBindableEvent = nil;
end;
})

commslog = window:Add("ScrollingFrame",{
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
CanvasSize = UDim2.new(0, 0, 0, 0);
BackgroundTransparency = 0.9;
})

layout = service.New("UIListLayout", {
Parent = commslog;
FillDirection = "Vertical";
HorizontalAlignment = "Left";
VerticalAlignment = "Bottom";
SortOrder = "LayoutOrder";
})

layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
commslog.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y)
commslog.CanvasPosition = Vector2.new(0, layout.AbsoluteContentSize.Y)
end)

if client.Variables.CommunicationsHistory then
for i,v in ipairs(client.Variables.CommunicationsHistory) do
newMessage(v.Type, v.Title, v.Message, v.Icon, v.Time, v.Function);
end
end

service.HookEvent('CommsCentre', function(v)
newMessage(v.Type, v.Title, v.Message, v.Icon, v.Time, v.Function)
end)

gTable = window.gTable
window:Ready();
end
14 changes: 13 additions & 1 deletion MainModule/Client/UI/Default/Hint.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ return function(data)
local str = data.Message
local time = data.Time or 15

local log = {
Type = "Hint";
Title = "Hint";
Message = str;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}

table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsCentre:fire(log)

--client.UI.Make("HintHolder")
local container = client.UI.Get("HintHolder",nil,true)
if not container then
Expand Down Expand Up @@ -321,4 +333,4 @@ end]]></ProtectedString>
</Item>
</Item>
</Item>
</roblox>
</roblox>
12 changes: 12 additions & 0 deletions MainModule/Client/UI/Default/Message.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@ return function(data)
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1

local log = {
Type = "Full Screen Message";
Title = title;
Message = message;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}

table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsCentre:fire(log)


local blur = service.New("BlurEffect")
blur.Enabled = false
Expand Down
15 changes: 14 additions & 1 deletion MainModule/Client/UI/Default/Notif.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ return function(data)

client.UI.Remove("Notif",script.Parent.Parent)

local log = {
Type = "Notif";
Title = "Notif";
Message = str;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}

table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsCentre:fire(log)


if str and type(str)=="string" then
label.Text = str
label.Position = UDim2.new(0, 0, 0, ((topbar and 40) or 0) - 35)
Expand Down Expand Up @@ -156,4 +169,4 @@ end]]></ProtectedString>
</Properties>
</Item>
</Item>
</roblox>
</roblox>
Loading