function IconController.setGameTheme(S)IconController.gameTheme=S local b=IconController.getIcons()for b,l in pairs(b)do l:setTheme(S)end end function IconController.setDisplayOrder(S)S=tonumber(S)or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder=S end IconController.setDisplayOrder(10)function IconController.getIcons()local S={}for b,l in pairs(topbarIcons)do table.insert(S,b)end return S end function IconController.getIcon(S)for b,l in pairs(topbarIcons)do if b.name==S then return b end end return false end function IconController.disableHealthbar(S)local b=S==nil or S IconController.healthbarDisabled=b IconController.healthbarDisabledSignal:Fire(b)end function IconController.canShowIconOnTopbar(S)if(S.enabled==true or S.accountForWhenDisabled)and S.presentOnTopbar then return true end return false end function IconController.getMenuOffset(S)local b=S:get("\097\108\105\103\110\109\101\110\116")local l=IconController[b.."\071\097\112"]local B=S:get("\105\099\111\110\083\105\122\101")or UDim2.new(0,32,0,32)local J=B.X.Offset local t=J+l local d=0 local G=0 local a=0 if S.menuOpen then local b=S:get("\109\101\110\117\083\105\122\101")local B=b.X.Offset local J=S:_getMenuDirection()if J=="\114\105\103\104\116"then G+=B+l/6 elseif J=="\108\101\102\116"then d=B+4 G+=l/3 a=B end end return d,G,a end

function IconController.setGameTheme(theme)
	IconController.gameTheme = theme
	local icons = IconController.getIcons()
	for _, icon in pairs(icons) do
		icon:setTheme(theme)
	end
end

function IconController.setDisplayOrder(value)
	value = tonumber(value) or TopbarPlusGui.DisplayOrder
	TopbarPlusGui.DisplayOrder = value
end
IconController.setDisplayOrder(10)

function IconController.getIcons()
	local allIcons = {}
	for otherIcon, _ in pairs(topbarIcons) do
		table.insert(allIcons, otherIcon)
	end
	return allIcons
end

function IconController.getIcon(name)
	for otherIcon, _ in pairs(topbarIcons) do
		if otherIcon.name == name then
			return otherIcon
		end
	end
	return false
end

function IconController.disableHealthbar(bool)
	local finalBool = (bool == nil or bool)
	IconController.healthbarDisabled = finalBool
	IconController.healthbarDisabledSignal:Fire(finalBool)
end

function IconController.canShowIconOnTopbar(icon)
	if (icon.enabled == true or icon.accountForWhenDisabled) and icon.presentOnTopbar then
		return true
	end
	return false
end

function IconController.getMenuOffset(icon)
	local alignment = icon:get("alignment")
	local alignmentGap = IconController[alignment.."Gap"]
	local iconSize = icon:get("iconSize") or UDim2.new(0, 32, 0, 32)
	local sizeX = iconSize.X.Offset
	local iconWidthAndGap = (sizeX + alignmentGap)
	local extendLeft = 0
	local extendRight = 0
	local additionalRight = 0
	if icon.menuOpen then
		local menuSize = icon:get("menuSize")
		local menuSizeXOffset = menuSize.X.Offset
		local direction = icon:_getMenuDirection()
		if direction == "right" then
			extendRight += menuSizeXOffset + alignmentGap/6--2
		elseif direction == "left" then
			extendLeft = menuSizeXOffset + 4
			extendRight += alignmentGap/3--4
			additionalRight = menuSizeXOffset
		end
	end
	return extendLeft, extendRight, additionalRight
end
