-- 解码十六进制字符串
local function hex_to_str (hex)
if not hex then return "" end
return (hex:gsub ( return string.char (tonumber (cc, 16))
end))
end
-- 全局函数,由插件暴露给游戏
WR_CreateConfigFrame = function ()
-- 创建一个名为 "WR_Config" 的主框架
local frame = CreateFrame ("Frame", "WR_Config", UIParent)
frame:SetWidth (500)
frame:SetHeight (400)
frame:SetPoint ("CENTER", 0, 0)
frame:SetBackdrop ({
bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
edgeFile = "Interface/DialogFrame/UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
})
frame:SetBackdropColor (0, 0, 0, 0.8)
frame:SetMovable (true)
frame:EnableMouse (true)
frame:RegisterForDrag ("LeftButton")
frame:SetScript ("OnDragStart", frame.StartMoving)
frame:SetScript ("OnDragStop", frame.StopMovingOrSizing)
-- 添加标题
local title = frame:CreateFontString (nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint ("TOP", 0, -12)
title:SetText ("My Addon Configuration")
-- 添加一个关闭按钮
local closeButton = CreateFrame ("Button", nil, frame, "UIPanelCloseButton")
closeButton:SetPoint ("TOPRIGHT", -6, -6)
print ("功能完整的配置窗口已创建。")
end
WR_CreateTalentFrame = function ()
-- 创建一个名为 "WR_Talent" 的主框架
local frame = CreateFrame ("Frame", "WR_Talent", UIParent)
frame:SetWidth (300)
frame:SetHeight (500)
frame:SetPoint ("CENTER", 100, 0)
frame:SetBackdrop ({
bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
edgeFile = "Interface/DialogFrame/UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
})
frame:SetBackdropColor (0, 0, 0, 0.8)
-- 添加标题
local title = frame:CreateFontString (nil, "ARTWORK", "GameFontNormalLarge")
title:SetPoint ("TOP", 0, -12)
title:SetText ("Talent Frame")
print ("功能完整的天赋框架已创建。")
end
-- 脚本的入口点将主函数分配给全局表 (_G),
-- 使得WoW游戏客户Duan可以通过斜杠命令或其他插件访问它们。
_G["WR_CreateConfigFrame"] = WR_CreateConfigFrame
_G["WR_CreateTalentFrame"] = WR_CreateTalentFrame
print ("插件脚本已加载")