local _,ns = ...
ns.ADDUIEVENT("PLAYER_LOGIN", function()
ns.tips("让暴雪的一些框体可以移动")
--按住alt移动--if (IsAltKeyDown()) then


--LoadAddOn('Blizzard_ProfessionsTemplates')
--LoadAddOn('Blizzard_Professions')
--LoadAddOn('Blizzard_Communities')
--LoadAddOn('Blizzard_ClassTalentUI')
local frametable = {
"CharacterFrame",	--角色
--"PlayerSpellsFrame",--法术书
"FriendsFrame",		--好友
"PVEFrame",			--地下城与PVP
--"CommunitiesFrame",	--公会
--"ClassTalentFrame",	--天赋
"ContainerFrameCombinedBags",	--背包
--"ProfessionsFrame",	--专业

"WorldMapFrame",	--大地图
"GameMenuFrame",	--菜单
"SettingsPanel",	--esc菜单界面
"MerchantFrame",	--售卖

}
for i, v in ipairs(frametable) do
	_G[v]:SetMovable(true)
	_G[v]:SetScript("OnMouseDown", function()
		_G[v]:StartMoving()
	end)
	_G[v]:SetScript('OnMouseUp', function(self, button)
		_G[v]:StopMovingOrSizing()
	end)
end

local function SetBagsPoint()
	ContainerFrameCombinedBags:SetAlpha(0)
	ContainerFrame6:SetAlpha(0)
	C_Timer.After(0.001,function()
		ContainerFrameCombinedBags:SetPoint("RIGHT",UIParent,"RIGHT",-80,0)
		ContainerFrameCombinedBags:SetAlpha(1)
		ContainerFrame6:SetAlpha(1)
	end)
end
ContainerFrameCombinedBags:HookScript("OnShow",SetBagsPoint)
ContainerFrame6:HookScript("OnShow",SetBagsPoint)
ContainerFrame6:HookScript("OnHide",SetBagsPoint)

--插件加载后再进行某些框体的移动
local T=CreateFrame("frame")
T:RegisterEvent('ADDON_LOADED')
T:SetScript("OnEvent",function(_,_,msg)
	if msg == 'Blizzard_Professions' then	--制造业
		ProfessionsFrame:SetMovable(true)
		ProfessionsFrame:SetScript("OnMouseDown", function()
			ProfessionsFrame:StartMoving()
		end)
		ProfessionsFrame:SetScript('OnMouseUp', function(self, button)
			ProfessionsFrame:StopMovingOrSizing()
		end)
	end
	
	if msg == 'Blizzard_Communities' then	--公会
		CommunitiesFrame:SetMovable(true)
		CommunitiesFrame:SetScript("OnMouseDown", function()
			CommunitiesFrame:StartMoving()
		end)
		CommunitiesFrame:SetScript('OnMouseUp', function(self, button)
			CommunitiesFrame:StopMovingOrSizing()
		end)
	end
	
	if msg == 'Blizzard_ClassTalentUI' then
		ClassTalentFrame:SetMovable(true)
		ClassTalentFrame:SetScript("OnMouseDown", function()
			ClassTalentFrame:StartMoving()
		end)
		ClassTalentFrame:SetScript('OnMouseUp', function(self, button)
			ClassTalentFrame:StopMovingOrSizing()
		end)
	end
	if msg == 'Blizzard_PlayerSpells' then	--天赋
		local PlayerSpellsFrameScale = 0.5
		local PlayerSpellsCheck = CreateFrame("CheckButton", "PlayerSpellsCheck", PlayerSpellsFrame.TitleContainer,"InterfaceOptionsCheckButtonTemplate")
		PlayerSpellsCheck:SetPoint("TOPRIGHT", -220, 1)
		PlayerSpellsCheck:SetChecked(AddUIDB.OpenTalentScale)
		PlayerSpellsCheck.text:SetText("小窗开启")
		PlayerSpellsCheck:SetScale(0.9)
		PlayerSpellsCheck:SetScript("OnClick", function (self)
			AddUIDB.OpenTalentScale = self:GetChecked()
		end)
		local PlayerSpellsButtom = CreateFrame("Button", "PlayerSpellsButtom", PlayerSpellsFrame.TitleContainer, "UIPanelButtonTemplate")
		PlayerSpellsButtom:SetText("放大")
		PlayerSpellsButtom:SetSize(70,22)
		PlayerSpellsButtom:SetPoint("TOPRIGHT", -30, 1)
		PlayerSpellsButtom:SetScript("OnClick", function()
			if PlayerSpellsFrameScale == 1 then 
				PlayerSpellsButtom:SetText("放大")
				PlayerSpellsFrame:SetScale(0.5)
				PlayerSpellsFrameScale = 0.5
			else
				PlayerSpellsButtom:SetText("缩小")
				PlayerSpellsFrame:SetScale(1)
				PlayerSpellsFrameScale = 1
			end
		end)
		PlayerSpellsFrame:SetMovable(true)
		PlayerSpellsFrame:SetScript("OnMouseDown", function()
			PlayerSpellsFrame:StartMoving()
		end)
		PlayerSpellsFrame:SetScript('OnMouseUp', function(self, button)
			PlayerSpellsFrame:StopMovingOrSizing()
		end)
		PlayerSpellsFrame:SetScript("OnShow", function()
			if PlayerSpellsFrame.TalentsFrame:IsShown() and AddUIDB.OpenTalentScale then
				PlayerSpellsFrame:SetScale(PlayerSpellsFrameScale)
			else
				PlayerSpellsFrame:SetScale(1)
			end
			PlayerSpellsFrame:ClearAllPoints()
			PlayerSpellsFrame:SetPoint("LEFT",UIParent,"LEFT",160,50)
			
		end)
	end


end)
end)
