Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.
Closed
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
16 changes: 14 additions & 2 deletions CoreScriptsRoot/CoreScripts/Topbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ local newNotificationPath = getNewNotificationPathSuccess and newNotificationPat
local newChatVisiblePropSuccess, newChatVisiblePropValue = pcall(function() return settings():GetFFlag("ChatVisiblePropertyEnabled") end)
local newChatVisibleProp = (newChatVisiblePropSuccess and newChatVisiblePropValue)

--[[ END OF FFLAG VALUES ]]
local resetButtonFlagSuccess, resetButtonFlagValue = pcall(function() return settings():GetFFlag("AllowResetButtonCustomization") end)
local resetButtonCustomizationAllowed = (resetButtonFlagSuccess and resetButtonFlagValue == true)

--[[ END OF FFLAG VALUES ]]

--[[ SERVICES ]]

Expand All @@ -34,6 +36,12 @@ local TextService = game:GetService('TextService')

--[[ END OF SERVICES ]]

-- Register SetCore functions early
local earlyResetCallbackValue = nil
if resetButtonCustomizationAllowed then
StarterGui:RegisterSetCore("ResetButtonCallback", function(value) earlyResetCallbackValue = value end)
end

--[[ MODULES ]]--
local GuiRoot = CoreGuiService:WaitForChild('RobloxGui')
local TopbarConstants = require(GuiRoot.Modules.TopbarConstants)
Expand All @@ -53,8 +61,8 @@ if defeatableTopbar then
end
end)
end
local lookMenuEnabled = true

local lookMenuEnabled = true
local settingsActive = false

local GameSettings = UserSettings().GameSettings
Expand Down Expand Up @@ -939,6 +947,10 @@ end
local function CreateSettingsIcon(topBarInstance)
local MenuModule = require(GuiRoot.Modules.Settings.SettingsHub)

if earlyResetCallbackValue ~= nil then
MenuModule:SetResetButtonCallback(earlyResetCallbackValue)
end

local settingsIconButton = Util.Create'ImageButton'
{
Name = "Settings";
Expand Down
41 changes: 26 additions & 15 deletions CoreScriptsRoot/Modules/Settings/SettingsHub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,30 @@ local function CreateSettingsHub()
end
end

local function resetCustomizationFunc(callback)
local isBindableSuccess, isBindableValue = pcall(function() return type(callback) == "userdata" and callback:IsA("BindableEvent") end)
local isBindable = (isBindableSuccess and isBindableValue)
if isBindable or type(callback) == "boolean" then
this.ResetCharacterPage:SetResetCallback(callback)
else
warn("ResetButtonCallback must be set to a BindableEvent or a boolean")
end

if callback == false then
setResetEnabled(false)
elseif not resetEnabled and (isBindable or callback == true) then
setResetEnabled(true)
end
end

function this:SetResetButtonCallback(value)
resetCustomizationFunc(value)
end

if resetButtonCustomizationAllowed then
StarterGui:RegisterSetCore("ResetButtonCallback", function(callback)
local isBindableSuccess, isBindableValue = pcall(function() return type(callback) == "userdata" and callback:IsA("BindableEvent") end)
local isBindable = (isBindableSuccess and isBindableValue)
if isBindable or type(callback) == "boolean" then
this.ResetCharacterPage:SetResetCallback(callback)
else
warn("ResetButtonCallback must be set to a BindableEvent or a boolean")
end
if callback == false then
setResetEnabled(false)
elseif not resetEnabled and (isBindable or callback == true) then
setResetEnabled(true)
end
end)
StarterGui:RegisterSetCore("ResetButtonCallback", resetCustomizationFunc)
end

-- Xbox Only
local inviteToGameFunc = function()
local platformService = game:GetService('PlatformService')
Expand Down Expand Up @@ -1246,6 +1253,10 @@ function moduleApiTable:HideShield()
SettingsHubInstance:HideShield()
end

function moduleApiTable:SetResetButtonCallback(value)
SettingsHubInstance:SetResetButtonCallback(value)
end

moduleApiTable.SettingsShowSignal = SettingsHubInstance.SettingsShowSignal

moduleApiTable.Instance = SettingsHubInstance
Expand Down