function RadialMenuClass.SetRadialProps(k,a)for k,V in next,k.Frame.Radial:GetChildren()do for a,k in next,a do V[a]=k end end end function RadialMenuClass.SetDialProps(k,a)local V=k.Frame.RadialDial for a,k in next,a do V[a]=k end end function RadialMenuClass.GetTheta(k,a)local V=nil if MOUSE_GROUP[a]then local a=k.Frame local l=a.AbsoluteSize.y/2 local n=a.AbsolutePosition+a.AbsoluteSize/2 local C=UIS:GetMouseLocation()+Vector2.new(0,-36)V=(C-n)/l elseif GAMEPAD_GROUP[a]then local k=UIS:GetGamepadState(a)for a,V in next,k do k[V.KeyCode]=V end V=k[Enum.KeyCode.Thumbstick2].Position*Vector3.new(1,-1,1)end if V then local a=V.Magnitude if a>=k.DeadZoneIn and a<=k.DeadZoneOut then return math.atan2(V.y,-V.x)end end end function RadialMenuClass.PickIndex(k,a)local V=math.rad(k.Frame.Rotation)local l=math.deg((((a-k.Rotation)+V)+EX_OFFSET)+2*TAU)%360 local n=math.floor(l/(360/k.SubN))return n+1 end function RadialMenuClass.GetRotation(k,a)return-TAU*((a-1)/k.SubN)end function RadialMenuClass.GetRadial(k,a)return k.Frame.Radial[a]end function RadialMenuClass.GetAttachment(k,a)return k.Frame.Attach[a]end function RadialMenuClass.IsVisible(a)local k=a.Frame while k and(k:IsA("\071\117\105\079\098\106\101\099\116")and k.Visible)do k=k.Parent if k and(k:IsA("\083\099\114\101\101\110\071\117\105")and k.Enabled)then return true end end return false end function RadialMenuClass.Destroy(a)a._Maid:Sweep()a.Frame:Destroy()a.Clicked=nil a.Hover=nil a.Frame=nil end
-- Public Methods

function RadialMenuClass:SetRadialProps(props)
	for _, child in next, self.Frame.Radial:GetChildren() do
		for prop, value in next, props do
			child[prop] = value
		end
	end
end

function RadialMenuClass:SetDialProps(props)
	local dial = self.Frame.RadialDial
	for prop, value in next, props do
		dial[prop] = value
	end
end

function RadialMenuClass:GetTheta(userInputType)
	local delta = nil

	if MOUSE_GROUP[userInputType] then
		local frame = self.Frame
		local radius = frame.AbsoluteSize.y / 2
		local center = frame.AbsolutePosition + frame.AbsoluteSize / 2
		local mousePos = UIS:GetMouseLocation() + Vector2.new(0, -36)
		delta = (mousePos - center) / radius
	elseif GAMEPAD_GROUP[userInputType] then
		local states = UIS:GetGamepadState(userInputType)
		for _, state in next, states do
			states[state.KeyCode] = state
		end
		delta = states[Enum.KeyCode.Thumbstick2].Position * Vector3.new(1, -1, 1)
	end

	if delta then
		local m = delta.Magnitude
		if m >= self.DeadZoneIn and m <= self.DeadZoneOut then
			return math.atan2(delta.y, -delta.x)
		end
	end
end

function RadialMenuClass:PickIndex(theta)
	local frameRot = math.rad(self.Frame.Rotation)
	local toDeg = math.deg(theta - self.Rotation + frameRot + EX_OFFSET + 2 * TAU) % 360
	local closest = math.floor(toDeg / (360 / self.SubN))
	return closest + 1
end

function RadialMenuClass:GetRotation(index)
	return -TAU * ((index - 1) / self.SubN)
end

function RadialMenuClass:GetRadial(index)
	return self.Frame.Radial[index]
end

function RadialMenuClass:GetAttachment(index)
	return self.Frame.Attach[index]
end

function RadialMenuClass:IsVisible()
	local frame = self.Frame
	while frame and frame:IsA("GuiObject") and frame.Visible do
		frame = frame.Parent
		if frame and frame:IsA("ScreenGui") and frame.Enabled then
			return true
		end
	end
	return false
end

function RadialMenuClass:Destroy()
	self._Maid:Sweep()
	self.Frame:Destroy()
	self.Clicked = nil
	self.Hover = nil
	self.Frame = nil
end
