function ToolsSquareMinimap_OptionInit()
	ToolsSquareMinimap_OptChildSelect = 1
	local db = ToolsSquareMinimapDB
	local addon = ToolsSquareMinimap
	local child = {radio = {}}
	local v = {}
	local drop = {}
	local iconname = {
		MiniMapBattlefieldFrame = "전장아이콘",
		MiniMapTrackingFrame = "추적아이콘",
		MiniMapMailFrame = "우편아이콘",
		MiniMapMeetingStoneFrame = "파티찾기아이콘",
		MiniMapWorldMapButton = "월드맵아이콘",
	}
	local drag, stopfunc = ToolsOptionCore.DragFrame:Create(addon.border, UIParent)
	local dragframe = drag
	dragframe:SetScript("OnDragStop", function()
		stopfunc(db.point[1])
		db.point[2] = ToolsOptionCore.DragFrame.x 
		db.point[3] = ToolsOptionCore.DragFrame.y
		ToolsOptionCore:Refresh()
	end)
	local i = 1
	local function positionxy(v)
		if v < -100 then return -100 end
		if v > 100 then return 100 end
		return v
	end
	for k in pairs(db.child) do
		local d1, f1 = ToolsOptionCore.DragFrame:Create(getglobal(k), Minimap)
		d1.select = i
		d1:SetScript("OnEnter", function()
			GameTooltip:SetOwner(this, "ANCHOR_LEFT")
			GameTooltip:AddLine(iconname[k])
			GameTooltip:Show()
		end)
		d1:SetScript("OnLeave", function()
			GameTooltip:Hide()
		end)
		d1:SetScript("OnMouseDown", function()
			ToolsSquareMinimap_OptChildSelect = d1.select
			ToolsOptionCore:Refresh()
		end)
		d1:SetScript("OnDragStop", function()
			f1(db.child[k][1])
			db.child[k][2] = positionxy(ToolsOptionCore.DragFrame.x)
			db.child[k][3] = positionxy(ToolsOptionCore.DragFrame.y)
			addon:SetChildPoint()
			ToolsOptionCore:Refresh()
		end)
		child[i] = {string = k, drag = d1}
		child.radio[i] = iconname[k]
		i = i + 1
	end
	v.Header = {	text = "사각미니맵",
			tooltip = "사각미니맵 설정",
			onshow = function()
				dragframe:Show()
				for i = 1, #child do
					getglobal(child[i].string).showcheck = getglobal(child[i].string):IsShown()
					getglobal(child[i].string):Show()
					getglobal(child[i].string):SetMovable(1)
					child[i].drag:Show()
				end
			end,
			onhide = function()
				dragframe:Hide()
				for i = 1, #child do
					if not getglobal(child[i].string).showcheck then
						getglobal(child[i].string):Hide()
					end
					getglobal(child[i].string):SetMovable(0)
					child[i].drag:Hide()
				end
			end
		}
	v.option = {
		{	type = "Slider",
			text = "크기",
			get = function() return db.scale end,
			set = function(v) db.scale = v;addon:SetScale() end,
			minmax = {0.6,1.5},
			step = 0.01,
			tooltip = "크기를 설정합니다",
		},
		{	type = "Slider",
			text = "플레이어 화살표 크기",
			get = function() return db.arrow end,
			set = function(v) db.arrow = v;addon:SetPlayerArrowScale() end,
			minmax = {0.8,1.8},
			step = 0.01,
			tooltip = "플레이어 화살표의 크기를 설정합니다\n미니맵 우측상단 메뉴버튼에서 마우스휠로도 가능",
		},
		ToolsOptionCore.Get:Point({
			get = function() return db.point[1] end,
			set = function(v)
				db.point = {v, 0, 0}
				addon:SetPoint()
				ToolsOptionCore:Refresh()
			end,
		}),
		{	type = "EditBox",
			text = "X 위치 직접입력",
			get = function() return tonumber(format("%0.0f",db.point[2])) end,
			set = function(v) db.point[2] = v;addon:SetPoint()end,
			tooltip = "X위치를 직접 설정합니다",
		},
		{	type = "EditBox",
			text = "Y 위치 직접입력",
			get = function() return tonumber(format("%0.0f",db.point[3])) end,
			set = function(v) db.point[3] = v;addon:SetPoint()end,
			tooltip = "Y위치를 직접 설정합니다",
		},
	}
	for i = 1, 2 do
		local t = i == 1 and "main" or "toggle"
		local n = i == 1 and "메인" or "지역이름"
		tinsert(v.option,{
				type = "ColorPicker",
				text = n.."의 테두리 색상설정",
				default = {1,1,1,1},
				hasOpacity = true,
				get = function() return db.color[t].border end,
				set = function(c)
					db.color[t].border ={c.r,c.g,c.b,c.a}
					addon:SetBackdrop(t)
				end,
				tooltip = n.."의 테두리색상을 설정합니다"
		})
		if i == 2 then
				tinsert(v.option,{
					type = "ColorPicker",
					text = n.."의 배경 색상설정",
					default = {0,0,0,0.8},
					hasOpacity = true,
					get = function() return db.color[t].backdrop end,
					set = function(c)
						db.color[t].backdrop ={c.r,c.g,c.b,c.a}
						addon:SetBackdrop(t)
					end,
					tooltip = n.."의 배경 색상을 설정합니다"
			})
		end
		tinsert(v.option,{
				type = "Slider",
				text = n.."의 테두리의 두께",
				get = function() return db.border[t] end,
				set = function(v)
					db.border[t] = v
					addon:SetBackdrop(t)
				end,
				minmax = {16,25},
				step = 1,
				tooltip = "테두리의 두께를 설정합니다",
		})
	end
	v.option[#v.option + 1] = {
			type = "Title",
			text = "아이콘 설정",
		}
	v.option[#v.option + 1] = {
			type = "CheckButton",
			text = "우편 아이콘 변경",
			get = function() return db.mailreform end,
			set = function(v)
				db.mailreform = v
				addon:SetMailButton()
			end,
		}
	v.option[#v.option + 1] = {
			type = "CheckButton",
			text = "전체지도 아이콘 표시",
			get = function() return db.worldmapshow end,
			set = function(v)
				MiniMapWorldMapButton.showcheck = v
				db.worldmapshow = v
				addon:SetWorldMapIcon()
			end,
		}
	v.option[#v.option + 1] = {
			type = "RadioButton",
			col = 4,
			text = "아이콘 선택",
			get = function() return ToolsSquareMinimap_OptChildSelect end,
			set = function(v)
				ToolsSquareMinimap_OptChildSelect = v
				ToolsOptionCore:Refresh()
			end,
			values = child.radio,
		}
	v.option[#v.option + 1] = ToolsOptionCore.Get:Point({
			get = function() return db.child[child[ToolsSquareMinimap_OptChildSelect].string][1] end,
			set = function(v)
				db.child[child[ToolsSquareMinimap_OptChildSelect].string] = {v, 0, 0}
				addon:SetChildPoint()
				ToolsOptionCore:Refresh()
			end,
		})
	v.option[#v.option + 1] = {
			type = "Slider",
			text = "X 위치",
			get = function() return db.child[child[ToolsSquareMinimap_OptChildSelect].string][2] end,
			set = function(v)
				db.child[child[ToolsSquareMinimap_OptChildSelect].string][2] = v
				addon:SetChildPoint()
			end,
			minmax = {-100,100},
			step = 1,
			tooltip = "가로 위치를 설정합니다",
		}
	v.option[#v.option + 1] = {
			type = "Slider",
			text = "Y 위치",
			get = function() return db.child[child[ToolsSquareMinimap_OptChildSelect].string][3] end,
			set = function(v)
				db.child[child[ToolsSquareMinimap_OptChildSelect].string][3] = v
				addon:SetChildPoint()
			end,
			minmax = {-100,100},
			step = 1,
			tooltip = "세로 위치를 설정합니다",
		}
	
		
	ToolsOptionCore:RegesterOption(v)
end
ToolsOptionCore:Insert("ToolsSquareMinimap")