--[[
	Hides all ScreenGuis and CoreGuis shown. If the callback `hideOtherGuis`
	is defined then that function is called instead.
]]

function GuiController:hideGuis()
	if self.hideOtherGuis and self.hideOtherGuis.isCallbackSet() then
		self.hideOtherGuis.fireCallback()
		return
	end

	-- hideGuis has already been called, no need to hide again until
	-- showGuis is called
	if #Cryo.Dictionary.keys(self.disabledGuis) ~= 0 then
		return
	end

	-- Hide ScreenGuis
	self.disabledGuis = self:_getOtherScreenGuis()
	for _, gui in ipairs(self.disabledGuis) do
		gui.Enabled = false
	end

	-- Hide CoreGuis
	self.disabledCoreGuis = self:_getShownCoreGuis()
	for _, gui in ipairs(self.disabledCoreGuis) do
		self.StarterGui:SetCoreGuiEnabled(gui, false)
	end

	-- Hide mobile controls
	self.modalEnabled = self.UserInputService.ModalEnabled
	self.UserInputService.ModalEnabled = true
end
