local _, ns = ...
local B, C, L, DB = unpack(ns)
local module = B:RegisterModule("Settings")
local pairs, wipe = pairs, table.wipe
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded

-- Addon Info
print("<<<--|cFFFFFF00 2|r|cFFFF0000 UI|r v"..C_AddOns.GetAddOnMetadata("OrzUI", "Version").."["..C_AddOns.GetAddOnMetadata("OrzUI", "X-StatsVersion").."]" .." For "..C_AddOns.GetAddOnMetadata("OrzUI", "X-Support").." --")
print("  ---|cffC495DD 特别感谢|r|cff3399ffSiweia|r|cffC495DD,向他学到了好多.|r---  ")
print("----------------- 有你们的魔兽,才是世界 -->>>")

-- Tuitorial
local function DefaultSettings()
	SetCVar("scriptErrors", 0)     --0是屏蔽错误1是不屏蔽错误
	SetCVar("autoQuestWatch", 1)  
	SetCVar("synchronizeSettings", 1)
	SetCVar("synchronizeMacros", 1)
	SetCVar("screenshotQuality", 10)
	SetCVar("showTutorials", 0)
	SetCVar("overrideArchive", 0)
	SetCVar("showQuestTrackingTooltips", 1)
	--SetCVar("fstack_preferParentKeys", 0)
	SetCVar("missingTransmogSourceInItemTooltips", 1)
	SetCVar("autoSelfCast", 1) -- disable auto self casting
	--setglobal("MAX_EQUIPMENT_SETS_PER_PLAYER",100)
	SetGuildNewsFilter(1, 0)
	SetGuildNewsFilter(2, 0)
	SetGuildNewsFilter(3, 0)
	SetGuildNewsFilter(4, 0)
	SetGuildNewsFilter(5, 0)
	SetGuildNewsFilter(6, 0)
	SetGuildNewsFilter(7, 0)
	SetGuildNewsFilter(8, 0)
	SetGuildNewsFilter(9, 0)
end

local function ForceDefaultSettings()
  --/console cvar_defaul
  SetCVar("nameplateSelectedScale", 1.25)
  SetCVar("nameplateLargerScale", 1.25)
	SetCVar("autoLootDefault", 1) --自动拾取
	SetCVar("showTargetOfTarget",1) --目标的目标
	SetCVar("alwaysCompareItems", 1)
	SetCVar("lootUnderMouse", 1)
	SetCVar("nameplateShowSelf", 0)
	--SetCVar("guildMemberNotify", 0)--公会成员提示
  --SetCVar("showToastBroadcast", 0)--通告更新
  --SetCVar("showToastWindow", 0)--显示浮窗
	SetCVar("nameplateShowFriendlyNPCs", 0)
	--SetCVar("showTimestamps", "none")--聊天时间戳
	SetCVar("ActionButtonUseKeyDown", 1)
	SetCVar("lockActionBars", 1)
	--SetActionBarToggles(1, 1, 0, 0)
	--SHOW_MULTI_ACTIONBAR_1="1" --左下方动作条 
  --SHOW_MULTI_ACTIONBAR_2="1" --右下方动作条 
  --SHOW_MULTI_ACTIONBAR_3 = "0" --右动作条1
  --SHOW_MULTI_ACTIONBAR_4 = "0" --右动作条2
  --InterfaceOptions_UpdateMultiActionBars() --刷新动作条
	SetCVar("enableFloatingCombatText", 0)
	SetCVar("floatingCombatTextCombatState", 0)
	SetCVar("ShowClassColorInNameplate", 1)
	--SetCVar("floatingCombatTextCombatDamage", 0)
	--SetCVar("floatingCombatTextCombatHealing", 0)
	SetCVar("floatingCombatTextCombatDamageDirectionalScale", 1)
	SetCVar("floatingCombatTextCombatDamageDirectionalOffset", 10)
	SetCVar("floatingCombatTextFloatMode", 3) 
  --SetCVar("floatingCombatTextPetMeleeDamage", 0)   	 --寵物對目標傷害
  --SetCVar("floatingCombatTextPetSpellDamage", 0)   	 --寵物對目標傷害
  SetCVar("floatingCombatTextCombatHealingAbsorbTarget", 0)    --目標盾提示 
  SetCVar("floatingCombatTextCombatHealingAbsorbSelf", 0)    --自身得盾/護甲提示 
  SetCVar("floatingCombatTextDodgeParryMiss", 0)    --閃招 
  SetCVar("floatingCombatTextDamageReduction", 0)    --傷害減免 
  SetCVar("floatingCombatTextCombatLogPeriodicSpells", 0)    --周期性傷害 
  SetCVar("floatingCombatTextReactives", 0)    --法術警示
  SetCVar("floatingCombatTextSpellMechanics", 0)    --他人的糾纏效果(例如 誘補(xxxx-xxxx)) 
  SetCVar("floatingCombatTextRepChanges", 1)    --聲望變化 
  SetCVar("floatingCombatTextFriendlyHealers", 0)    --友方治療者名稱 
  SetCVar("floatingCombatTextCombatState", 1)    --進入/離開戰鬥文字提示 
  SetCVar("floatingCombatTextLowManaHealth", 1)      --低MP/低HP文字提示 
  SetCVar("floatingCombatTextComboPoints", 0)    --連擊點 
  SetCVar("floatingCombatTextEnergyGains", 0)    --能量獲得
  SetCVar("floatingCombatTextPeriodicEnergyGains", 0)    --周期性能量   
  SetCVar("floatingCombatTextHonorGains", 0)    --榮譽擊殺 
  SetCVar("floatingCombatTextAuras", 0)   --光環 
	SetCVar("doNotFlashLowHealthWarning", 0) --生命值过低时不闪烁屏幕
	SetCVar("Sound_EnableErrorSpeech", 0)								--错误提示音
	SetCVar("statusText",1) --状态文字
	SetCVar("statusTextDisplay","BOTH")--头像状态文字形式："NUMERIC"数值"PERCENT"百分比"BOTH"同时显示
	SetCVar("worldPreloadNonCritical", 0) --0是加快蓝条，读完蓝条再载入游戏模组
	--RegisterCVar("addonProfilerEnabled", 1)
	--SetCVar("addonProfilerEnabled", 0)
	if not InCombatLockdown() then
		SetCVar("nameplateMotion", 1)
		SetCVar("nameplateShowAll", 1)
		SetCVar("nameplateShowEnemies", 1)
		SetCVar("alwaysShowActionBars", 1)
	end
	--if DB.isDeveloper then
		--SetCVar("ffxGlow", 0)
		--SetCVar("SpellQueueWindow", 100)
	--end
end

local function ForceRaidFrame()
	if InCombatLockdown() then return end
	if not CompactUnitFrameProfiles then return end
	SetCVar("useCompactPartyFrames", 1)
	--CompactRaidFrameContainer:SetScale(0.85)
	--SetRaidProfileOption(GetActiveRaidProfile(), "healthText", "none")
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "useClassColors", true) --显示职业颜色
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayPowerBar", true) --显示能量条 
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayBorder", false) --显示边框
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "frameWidth", 160) --设置宽度
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "frameHeight", 21) --设置高度
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate2Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate3Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate5Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate10Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate15Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate25Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "autoActivate40Players", true)
	--SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "keepGroupsTogether", true) --保持小队相连 
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayHealPrediction", true) --显示预计治疗 
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayAggroHighlight", true) --高亮显示仇恨目标 
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayPets", false) --显示宠物 
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayMainTankAndAssist", false) --显示主坦克和主助理 
	SetRaidProfileOption(CompactUnitFrameProfiles.selectedProfile, "displayOnlyDispellableDebuffs", true) --只显示可供驱散的负面
	--SetRaidProfileSavedPosition(GetActiveRaidProfile(), false, "TOP", 440, "BOTTOM", 320, "LEFT", 0)	--团队框体位置 
	CompactUnitFrameProfiles_ApplyCurrentSettings()
	CompactUnitFrameProfiles_UpdateCurrentPanel()
end

-- DBM bars
local function ForceDBMOptions()
	if not IsAddOnLoaded("DBM-Core") then return end
	if DBT_AllPersistentOptions then wipe(DBT_AllPersistentOptions) end
	DBT_AllPersistentOptions = {
		["Default"] = {
			["DBM"] = {
				["Scale"] = 0.9,
				["HugeScale"] = 1.2,
				["ExpandUpwards"] = true,
				["ExpandUpwardsLarge"] = true,
				["BarXOffset"] = 0,
				["BarYOffset"] = 1,
				["TimerPoint"] = "BOTTOMLEFT",
				["TimerX"] = 100,
				["TimerY"] = 210,
				["Width"] = 200,
				["Heigh"] = 14,
				["HugeWidth"] = 280,
				["HugeBarXOffset"] = 0,
				["HugeBarYOffset"] = 3,
				["HugeTimerPoint"] = "CENTER",
				["HugeTimerX"] = -12,
				["HugeTimerY"] = -143,
				["FontSize"] = 15,
				["StartColorR"] = 1,
				["StartColorG"] = .7,
				["StartColorB"] = 0,
				["EndColorR"] = 1,
				["EndColorG"] = 0,
				["EndColorB"] = 0,
				["Texture"] = DB.normTex,
				["MinimapIcon"] = "hide",
			},
		},
	}
	DBM_MinimapIcon["hide"] = true
	if not DBM_AllSavedOptions["Default"] then DBM_AllSavedOptions["Default"] = {} end
	DBM_AllSavedOptions["Default"]["MinimapIcon"] = "hide"
	DBM_AllSavedOptions["Default"]["ChosenVoicePack"] = "Yike"
	DBM_AllSavedOptions["Default"]["RangeFrameRadarPoint"] = "RIGHT"
	DBM_AllSavedOptions["Default"]["RangeFrameRadarX"] = -90
	DBM_AllSavedOptions["Default"]["RangeFrameRadarY"] = -180
	DBM_AllSavedOptions["Default"]["InfoFrameX"] = 300
	DBM_AllSavedOptions["Default"]["InfoFrameY"] = 210
	DBM_AllSavedOptions["Default"]["HPFramePoint"] = "RIGHT"
	DBM_AllSavedOptions["Default"]["HPFrameX"] = -160
	DBM_AllSavedOptions["Default"]["WarningY"] = 260
	DBM_AllSavedOptions["Default"]["WarningX"] = 0
	DBM_AllSavedOptions["Default"]["WarningFontStyle"] = "OUTLINE"
	DBM_AllSavedOptions["Default"]["SpecialWarningPoint"] = "TOP"
	DBM_AllSavedOptions["Default"]["SpecialWarningFontCol"] = {1.0, 0.3, 0.0}
	DBM_AllSavedOptions["Default"]["SpecialWarningX"] = 0
	DBM_AllSavedOptions["Default"]["SpecialWarningY"] = -195
	DBM_AllSavedOptions["Default"]["SpecialWarningFontStyle"] = "OUTLINE"
	DBM_AllSavedOptions["Default"]["HideQuestTooltips"] = false
	DBM_AllSavedOptions["Default"]["HideObjectivesFrame"] = false
	DBM_AllSavedOptions["Default"]["WarningFontSize"] = 20
	DBM_AllSavedOptions["Default"]["SpecialWarningFontSize2"] = 36
	OrzUISetDB["DBMRequest"] = false
end

-- Skada
local function ForceSkadaOptions()
	if not IsAddOnLoaded("Skada") then return end
	if SkadaDB then wipe(SkadaDB) end
	SkadaDB = {
		["hasUpgraded"] = true,
		["profiles"] = {
			["Default"] = {
["modules"] = {
["dungeonSummary"] = true,
},
["modeclicks"] = {
["Damage"] = 2,
["伤害"] = 14,
},
["windows"] = {
{
["set"] = "total",
["y"] = 88,
["barbgcolor"] = {
["a"] = 0.6,
["r"] = 0.3,
["g"] = 0.3,
["b"] = 0.3,
},
["buttons"] = {
["stop"] = true,
},
["barwidth"] = 285,
["background"] = {
["height"] = 88,
},
},
{
["titleset"] = true,
["barheight"] = 16,
["color"] = {
["a"] = 0.6,
["b"] = 0.3,
["g"] = 0.3,
["r"] = 0.3,
},
["issolidbackdrop"] = false,
["classicons"] = false,
["barslocked"] = true,
["useframe"] = true,
["clickthrough"] = false,
["wipemode"] = "",
["set"] = "current",
["hidden"] = false,
["y"] = 0,
["x"] = 0,
["name"] = "总体",
["display"] = "bar",
["height"] = 23,
["barfontflags"] = "OUTLINE",
["isusingelvuiskin"] = true,
["barbgcolor"] = {
["a"] = 0.12,
["b"] = 0.21,
["g"] = 0.21,
["r"] = 0.21,
},
["strata"] = "LOW",
["classcolortext"] = false,
["spellschoolcolors"] = true,
["showself"] = true,
["barcolor"] = {
["a"] = 1,
["b"] = 0.21,
["g"] = 0.43,
["r"] = 0.43,
},
["barfontsize"] = 11,
["returnaftercombat"] = false,
["scale"] = 1,
["title"] = {
["textcolor"] = {
["a"] = 1,
["b"] = 0.9,
["g"] = 0.9,
["r"] = 0.9,
},
["color"] = {
["a"] = 0.8,
["b"] = 0.3,
["g"] = 0.1,
["r"] = 0.1,
},
["bordercolor"] = {
["a"] = 1,
["b"] = 0,
["g"] = 0,
["r"] = 0,
},
["font"] = "ChatFontNormal",
["fontsize"] = 11,
["fontflags"] = "",
["height"] = 15,
["borderthickness"] = 2,
["bordertexture"] = "None",
["texture"] = "None",
},
["version"] = 1,
["roleicons"] = false,
["barorientation"] = 1,
["mode"] = "伤害",
["snapto"] = true,
["enabletitle"] = false,
["fixedbarwidth"] = false,
["textcolor"] = {
["b"] = 0.9,
["g"] = 0.9,
["r"] = 0.9,
},
["bartexture"] = "HalfStyle",
["buttons"] = {
["segment"] = true,
["menu"] = true,
["mode"] = true,
["report"] = true,
["reset"] = true,
},
["barwidth"] = 285,
["specicons"] = true,
["barspacing"] = 0,
["smoothing"] = true,
["modeincombat"] = "",
["reversegrowth"] = true,
["background"] = {
["color"] = {
["a"] = 0.2,
["b"] = 0.5,
["g"] = 0,
["r"] = 0,
},
["bordertexture"] = "None",
["borderthickness"] = 0,
["tile"] = false,
["height"] = 88,
["bordercolor"] = {
["a"] = 1,
["b"] = 0,
["g"] = 0,
["r"] = 0,
},
["tilesize"] = 0,
["texture"] = "None",
},
["classcolorbars"] = true,
["isusingclasscolors"] = true,
["isonnewline"] = true,
["point"] = "BOTTOMRIGHT",
["barfont"] = "ChatFontNormal",
},
},
["report"] = {
["channel"] = "say",
["mode"] = "伤害",
["set"] = "total",
},
["showranks"] = false,
["versions"] = {
["1.10.5"] = true,
},
["tentativecombatstart"] = true,
["reset"] = {
["instance"] = 2,
},
},
},
}
	OrzUISetDB["SkadaRequest"] = false
end

-- BigWigs
local function ForceBigwigs()
	if not IsAddOnLoaded("BigWigs") then return end
	if BigWigs3DB then wipe(BigWigs3DB) end
	BigWigs3DB = {
		["namespaces"] = {
			["BigWigs_Plugins_Bars"] = {
				["profiles"] = {
					["Default"] = {
						["outline"] = DB.Font[3],
						["fontSize"] = 12,
						["BigWigsAnchor_y"] = 336,
						["BigWigsAnchor_x"] = 16,
						["BigWigsAnchor_width"] = 175,
						["growup"] = true,
						["interceptMouse"] = false,
						["barStyle"] = "NDui",
						["LeftButton"] = {
							["emphasize"] = false,
						},
						["font"] = DB.Font[1],
						["onlyInterceptOnKeypress"] = true,
						["emphasizeMultiplier"] = 1,
						["BigWigsEmphasizeAnchor_x"] = 810,
						["BigWigsEmphasizeAnchor_y"] = 350,
						["BigWigsEmphasizeAnchor_width"] = 220,
						["emphasizeGrowup"] = true,
					},
				},
			},
			["BigWigs_Plugins_Super Emphasize"] = {
				["profiles"] = {
					["Default"] = {
						["fontSize"] = 28,
						["font"] = DB.Font[1],
					},
				},
			},
			["BigWigs_Plugins_Messages"] = {
				["profiles"] = {
					["Default"] = {
						["fontSize"] = 18,
						["font"] = DB.Font[1],
						["BWEmphasizeCountdownMessageAnchor_x"] = 665,
						["BWMessageAnchor_x"] = 616,
						["BWEmphasizeCountdownMessageAnchor_y"] = 530,
						["BWMessageAnchor_y"] = 305,
					},
				},
			},
			["BigWigs_Plugins_Proximity"] = {
				["profiles"] = {
					["Default"] = {
						["fontSize"] = 18,
						["font"] = DB.Font[1],
						["posy"] = 346,
						["width"] = 140,
						["posx"] = 1024,
						["height"] = 120,
					},
				},
			},
			["BigWigs_Plugins_Alt Power"] = {
				["profiles"] = {
					["Default"] = {
						["posx"] = 1002,
						["fontSize"] = 14,
						["font"] = DB.Font[1],
						["fontOutline"] = DB.Font[3],
						["posy"] = 490,
					},
				},
			},
		},
		["profiles"] = {
			["Default"] = {
				["fakeDBMVersion"] = true,
			},
		},
	}
	OrzUISetDB["BWRequest"] = false
end

local function ForceAddonSkins()
	if OrzUISetDB["DBMRequest"] then ForceDBMOptions() end
	if OrzUISetDB["SkadaRequest"] then ForceSkadaOptions() end
	if OrzUISetDB["BWRequest"] then ForceBigwigs() end
end

-- Tutorial
local function YesTutor()
	ForceRaidFrame()
	OrzUISetDB["DBMRequest"] = true
	OrzUISetDB["SkadaRequest"] = true
	OrzUISetDB["BWRequest"] = true
	ForceAddonSkins()
	UIErrorsFrame:AddMessage(DB.InfoColor..L["Tutorial Complete"])
	OrzUISetDB["YesTutor"] = false
end

local welcome
local function HelloWorld()
	if welcome then welcome:Show() return end
	local BackDropFile = "Interface\\Addons\\OrzUI\\Media\\Modules\\Raid\\Solid"
	welcome = CreateFrame("Frame", "UI_Tutorial", UIParent, "BackdropTemplate")
	welcome:SetPoint("TOPLEFT",0,-410)
	welcome:SetPoint("BOTTOMRIGHT",0,410)
	welcome:SetFrameStrata("HIGH")
	welcome:SetFrameLevel(0)
	welcome:SetBackdrop({ 
   bgFile = BackDropFile, 
   edgeFile = BackDropFile, 
	})
	welcome:SetBackdropColor(0.2, 0.2, 0.2, 1) 
	welcome:SetBackdropBorderColor(0,0,0,0)
	
	local BottomBlack = CreateFrame("Frame", nil, welcome) 
	BottomBlack:SetPoint("TOPLEFT",welcome,"BOTTOMLEFT",0,43)
	BottomBlack:SetPoint("BOTTOMRIGHT",0,0)
	--B.CreateBD(BottomBlack, 1)
	B.CreateBDFrame(BottomBlack, .2)
	BottomBlackText = B:CreatStyleText(BottomBlack, STANDARD_TEXT_FONT, 16, "OUTLINE", "-----  开袋即食零设置 上手即用懒人包  -----", "BOTTOM",BottomBlack,"BOTTOM",0,16, 0.97,0.75,0) 
	
	local WelcomeTitle1 = B:CreatStyleButton(nil, welcome, 60, 60, "BOTTOM", welcome, "CENTER", 0, 12, 1, 1)
	WelcomeTitle1:SetScript("OnClick", function(self,Button)
		welcome:Hide()
		if OrzUIDB["YesTutor"] then YesTutor() end
		--ShiGuangPerDB["BHT"] = true
		C.db["Tutorial"]["Complete"] = true
		ForceDefaultSettings()
		ReloadUI()
	end) 
	WelcomeTitle1Text = B:CreatStyleText(WelcomeTitle1, "Interface\\addons\\OrzUI\\Media\\Fonts\\RedCircl.TTF", 120, "OUTLINE", "|cFFFFFF00 2 |r", "CENTER", WelcomeTitle1, "CENTER",0, 3, 1, 0, 0) 

	local WelcomeTitle2 = B:CreatStyleButton(nil, welcome, 43, 43, "BOTTOMRIGHT", WelcomeTitle1, "BOTTOMRIGHT", 21, -8, 1, 1) 
	WelcomeTitle2Text = B:CreatStyleText(WelcomeTitle2, "Interface\\addons\\OrzUI\\Media\\Fonts\\RedCircl.TTF", 23, "OUTLINE", "|cFFFF0000 UI|r", "CENTER", WelcomeTitle2, "CENTER", 0, 3, 1, 1, 0) 

	local MadeBy = B:CreatStyleButton(nil, welcome, 210, 21, "BOTTOMRIGHT", BottomBlack, "BOTTOMRIGHT", -8, 31, 10, 1) 
	MadeBy:SetScript("OnClick", function(self,Button) welcome:Hide() end)
	--MadeByText = B:CreatStyleText(MadeBy, "Interface\\addons\\OrzUI\\Media\\Fonts\\Pixel.TTF", 12, "OUTLINE", "- www.maorui.net -", "CENTER", MadeBy, 0, 0, 0.66,0.66,0.66) --■ ■
	--MadeByText1 = B:CreatStyleText(MadeBy, "Interface\\addons\\OrzUI\\Media\\Fonts\\Edo.TTF", 52, "OUTLINE", "Breathe deep and accept that you have caused your end.", "TOP",Welcome,"TOP",0,-21, 1, 1, 1)
	MadeByText2 = B:CreatStyleText(MadeBy, "Interface\\addons\\OrzUI\\Media\\Fonts\\Edo.TTF", 43, "OUTLINE", "Your world is dying!", "TOP",Welcome,"TOP",0,-55, 1, 1, 1)

	local LeftPic = B:CreatStyleButton(nil, welcome, 512, 210, "BOTTOMRIGHT", welcome, "BOTTOM", 1, 43, 2, 1)
	--[[LeftPic:SetNormalTexture("Interface\\AddOns\\OrzUI\\Media\\Modules\\BlinkHealthText\\LeftPic")
  local function Sc(alpha) LeftPic:SetAlpha(alpha) end  --按钮特效--
	LeftPic:EnableMouse(true)
	LeftPic:SetScript("OnEnter", function(self) Sc(0.8) end)
	LeftPic:SetScript("OnLeave", function(self) Sc(1) end)
	LeftPic:SetScript("OnMouseUp", function(self) Sc(1) end)
	LeftPic:SetScript("OnMouseDown", function(self) Sc(0.6) end)
	LeftPic:SetScript("OnClick", function()
		welcome:Hide()
		if OrzUIDB["YesTutor"] then YesTutor() end
		--ShiGuangPerDB["BHT"] = true
		C.db["Tutorial"]["Complete"] = true
		ForceDefaultSettings()
		ReloadUI()
	end)]]
	SmallText1 = B:CreatStyleText(welcome, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ 微美化界面 ]", "RIGHT",welcome,"CENTER",26,60, DB.r, DB.g, DB.b)
	SmallText2 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ 全职业适用无障碍 ]", "RIGHT",LeftPic,"LEFT",26,20, DB.r, DB.g, DB.b)
	SmallText3 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ 开袋即食 轻优化 无繁琐设置 ]", "RIGHT",LeftPic,"LEFT",26,-20, DB.r, DB.g, DB.b)
	SmallText4 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ 适配主流更新器 更加便捷及时和高效 ]", "RIGHT",LeftPic,"LEFT",26,-60, DB.r, DB.g, DB.b)

  local RightPic = B:CreatStyleButton(nil, welcome, 512, 210, "BOTTOMLEFT", welcome, "BOTTOM", -1, 43, 2, 1)
  --[[RightPic:SetNormalTexture("Interface\\AddOns\\OrzUI\\Media\\Modules\\BlinkHealthText\\RightPic")
  local function Sc(alpha) RightPic:SetAlpha(alpha) end  --按钮特效--
	RightPic:EnableMouse(true)
	RightPic:SetScript("OnEnter", function(self) Sc(0.8) end)
	RightPic:SetScript("OnLeave", function(self) Sc(1) end)
	RightPic:SetScript("OnMouseUp", function(self) Sc(1) end)
	RightPic:SetScript("OnMouseDown", function(self) Sc(0.6) end)
	RightPic:SetScript("OnClick", function()
		welcome:Hide()
		if OrzUIDB["YesTutor"] then YesTutor() end
		--ShiGuangPerDB["BHT"] = false
		C.db["Tutorial"]["Complete"] = true
		ForceDefaultSettings()
		ReloadUI()
  end)]]
	SmallText1 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ MidNight " ..C_AddOns.GetAddOnMetadata("OrzUI", "X-Support").. " v"..C_AddOns.GetAddOnMetadata("OrzUI", "Version").." ]", "LEFT",RightPic,"RIGHT",-26,60, DB.r, DB.g, DB.b)
	SmallText2 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ https://www.maorui.net ]", "LEFT",RightPic,"RIGHT",-26,20, DB.r, DB.g, DB.b)
	SmallText3 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ 使用 ESC - 2ui 更多便捷插件设置 ]", "LEFT",RightPic,"RIGHT",-26,-20, DB.r, DB.g, DB.b)
	SmallText4 = B:CreatStyleText(LeftPic, STANDARD_TEXT_FONT, 16, "OUTLINE", "[ 系统自带功能，插件有针对性增强或者删减 ]", "LEFT",RightPic,"RIGHT",-26,-60, DB.r, DB.g, DB.b)

	--[[local ModulesBack = CreateFrame("Frame", nil, welcome, "BackdropTemplate") 
	ModulesBack:SetPoint("TOPLEFT",welcome,"TOPLEFT",0,0)
	ModulesBack:SetPoint("BOTTOMRIGHT",welcome,"TOPRIGHT",0,0)
	ModulesBack:SetBackdrop({ 
   bgFile = BackDropFile, 
   edgeFile = BackDropFile, 
	})
	ModulesBack:SetBackdropColor(0, 0, 0, 0.3) 
	ModulesBack:SetBackdropBorderColor(0,0,0,0)
	
	local LeftBlue = CreateFrame("Frame", nil, welcome, "BackdropTemplate") 
	LeftBlue:SetPoint("TOPLEFT",welcome,"TOPLEFT",0,0)
	LeftBlue:SetPoint("BOTTOMRIGHT",LeftPic,"TOPRIGHT",0,0)
	LeftBlue:SetBackdrop({ 
   bgFile = BackDropFile, 
   edgeFile = BackDropFile, 
	})
	LeftBlue:SetBackdropColor(0, 0, 0, 0.3) 
	LeftBlue:SetBackdropBorderColor(0,0,0,0)

	local RightRed = CreateFrame("Frame", nil, welcome, "BackdropTemplate") 
	RightRed:SetPoint("TOPRIGHT",welcome,"TOPRIGHT",0,0)
	RightRed:SetPoint("BOTTOMLEFT",RightPic,"TOPLEFT",0,0)
	RightRed:SetBackdrop({ 
   bgFile = BackDropFile, 
   edgeFile = BackDropFile, 
	})
	RightRed:SetBackdropColor(0, 0, 0, 0.3) 
	RightRed:SetBackdropBorderColor(0,0,0,0)

	local NPCModeRight = CreateFrame("PlayerModel", "NPCModeRight", ModulesBack)
	NPCModeRight:SetSize(UIParent:GetWidth()*0.6, UIParent:GetHeight())
	NPCModeRight:SetPoint("BOTTOM",RightPic,"TOPRIGHT",0,0) --"CENTER",0,210
	NPCModeRight:SetDisplayInfo(118072)  --ShiGuangDB.DisplayInfo 28213
	NPCModeRight:SetParent(ModulesBack) 
	--NPCModeRight:SetCamDistanceScale(1)
	NPCModeRight:SetPosition(1,0.05,-0.32)
	NPCModeRight:SetRotation(-0.4)
	--NPCModeRight.rotation = 0.21

	local NPCModeLeft = CreateFrame("PlayerModel", "NPCModeLeft", ModulesBack)
	NPCModeLeft:SetSize(UIParent:GetWidth()*0.6, UIParent:GetHeight())
	NPCModeLeft:SetPoint("BOTTOM",LeftPic,"TOPLEFT",0,0) --"CENTER",0,210
	NPCModeLeft:SetDisplayInfo(121956)  --54860  --74504   --71057 	--68323   --35908   --65636   --82047
	NPCModeLeft:SetParent(ModulesBack) 
	--NPCModeLeft:SetCamDistanceScale(1)
	NPCModeLeft:SetPosition(1,-0.18,-0.2)
	NPCModeLeft:SetRotation(0.3)
	--NPCModeLeft.rotation = 0.21]]

	local PlayerModel = CreateFrame("PlayerModel", "PlayerModel", welcome)
	PlayerModel:SetSize(256, 256)
	PlayerModel:SetPoint("BOTTOM",LeftPic,"TOPRIGHT",12,-60) --"BOTTOM",MadeBy,"TOP",0,120
	PlayerModel:SetUnit("player")
	PlayerModel:SetParent(welcome)
	PlayerModel:SetCamDistanceScale(1)
	PlayerModel:SetPosition(-1.6,0,0)
	PlayerModel:SetRotation(0)
	PlayerModel.rotation = 0
end
--SlashCmdList["ORZUI"] = HelloWorld
--SLASH_ORZUI1 = "/loadui"

-----------------------------------------
function module:OnLogin()
	-- Tutorial and settings
	DefaultSettings()
	ForceAddonSkins()
	if not C.db["Tutorial"]["Complete"] then if OrzUIDB["YesTutor"] then YesTutor() end
		--ShiGuangPerDB["BHT"] = true
		C.db["Tutorial"]["Complete"] = true
		ForceDefaultSettings()
		--ReloadUI()
	 end
	--if (ShiGuangPerDB["BHT"] == true) then SenduiCmd("/bht on") else SenduiCmd("/bht off") end
end