function IconController.setGameTheme(z)IconController.gameTheme=z local p=IconController.getIcons()for p,R in pairs(p)do R:setTheme(z)end end function IconController.setDisplayOrder(z)z=tonumber(z)or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder=z end IconController.setDisplayOrder(10)function IconController.getIcons()local z={}for p,R in pairs(topbarIcons)do table.insert(z,p)end return z end function IconController.getIcon(z)for p,R in pairs(topbarIcons)do if p.name==z then return p end end return false end function IconController.disableHealthbar(z)local p=z==nil or z IconController.healthbarDisabled=p IconController.healthbarDisabledSignal:Fire(p)end function IconController.canShowIconOnTopbar(z)if(z.enabled==true or z.accountForWhenDisabled)and z.presentOnTopbar then return true end return false end function IconController.getMenuOffset(z)local p=z:get("\097\108\105\103\110\109\101\110\116")local R=IconController[p.."\071\097\112"]local W=z:get("\105\099\111\110\083\105\122\101")or UDim2.new(0,32,0,32)local s=W.X.Offset local k=s+R local m=0 local V=0 local Q=0 if z.menuOpen then local p=z:get("\109\101\110\117\083\105\122\101")local W=p.X.Offset local s=z:_getMenuDirection()if s=="\114\105\103\104\116"then V+=W+R/6 elseif s=="\108\101\102\116"then m=W+4 V+=R/3 Q=W end end return m,V,Q end
-- METHODS
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
