移除CreateAttribute,只在点击时更新属性
This commit is contained in:
parent
bd2a655a6e
commit
49e1df3164
@ -472,10 +472,10 @@ function SM_Collections:CreateMainFrame()
|
||||
-- 坐骑召唤、小伙伴召唤、卡牌召唤按钮
|
||||
rightSidePanel.CallButon = CreateFrame("Button", "SM_CollectionsRightSidePanelCallButon", rightSidePanel)
|
||||
rightSidePanel.CallButon:SetSize(30, 30)
|
||||
rightSidePanel.CallButon:SetPoint("TOPRIGHT", closeBtn,-20, -45)
|
||||
rightSidePanel.CallButon:SetPoint("TOPRIGHT", closeBtn, -20, -45)
|
||||
rightSidePanel.CallButon:SetNormalTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
rightSidePanel.CallButon:SetHighlightTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
rightSidePanel.CallButon:SetPushedTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
rightSidePanel.CallButon:SetPushedTexture("Interface\\ICONS\\Ability_Mount_RidingHorse.blp")
|
||||
rightSidePanel.CallButon:SetScript("OnClick", function() print("召唤") end)
|
||||
|
||||
-- 坐骑名称文本 - 使用自定义字体
|
||||
@ -486,7 +486,7 @@ function SM_Collections:CreateMainFrame()
|
||||
MountNama:SetJustifyH("LEFT")
|
||||
MountNama:SetJustifyV("TOP")
|
||||
MountNama:SetTextColor(230 / 255, 150 / 255, 0 / 255)
|
||||
rightSidePanel.MountNama = MountNama -- 保存引用
|
||||
rightSidePanel.MountNama = MountNama -- 保存引用
|
||||
|
||||
-- 右上角介绍文本的框体
|
||||
local introFrame = CreateFrame("Frame", nil, rightSidePanel)
|
||||
@ -506,7 +506,7 @@ function SM_Collections:CreateMainFrame()
|
||||
"|cFFe59700成就:|r领导骑兵|r\r|cFFe59700类别:|r将军即使是龙族原住民协会的测试也证明,在确定白化公鸭是否与已知的蜻蜓有关方面没有定论。\r\r |cFFe59700--布雷安尼|r"
|
||||
introText:SetText("")
|
||||
introFrame:SetHeight(introText:GetStringHeight() + 20)
|
||||
rightSidePanel.introText = introText -- 保存引用
|
||||
rightSidePanel.introText = introText -- 保存引用
|
||||
|
||||
-- 属性加成标题
|
||||
local AttributeBonusFrame = CreateFrame("Frame", "AttributeBonusFrame", introFrame)
|
||||
@ -518,11 +518,9 @@ function SM_Collections:CreateMainFrame()
|
||||
AttributeBonusFrameText:SetFontObject(titleFont)
|
||||
AttributeBonusFrameText:SetText("属性加成")
|
||||
AttributeBonusFrameText:SetFont("Fonts\\ZYKai_T.ttf", 16, "MONOCHROME")
|
||||
-- 属性加成框架初始隐藏
|
||||
-- 属性加成框架初始隐藏
|
||||
AttributeBonusFrame:Hide()
|
||||
rightSidePanel.AttributeBonusFrame = AttributeBonusFrame -- 保存引用
|
||||
|
||||
self:CreateAttribute(AttributeBonusFrame) --数据管理器
|
||||
rightSidePanel.AttributeBonusFrame = AttributeBonusFrame -- 保存引用
|
||||
|
||||
-- 拖拽功能
|
||||
SM_Collections_Frame:SetScript("OnMouseDown", function(self, button)
|
||||
@ -549,57 +547,6 @@ function SM_Collections:CreateMainFrame()
|
||||
return SM_Collections_Frame
|
||||
end
|
||||
|
||||
-- 修改后的 CreateAttribute 函数 - 使用数据管理器
|
||||
function SM_Collections:CreateAttribute(parent)
|
||||
SM_Collections.DataManager:GetAttributes(function(attributes)
|
||||
local buttonH = 150
|
||||
local buttonW = 20
|
||||
|
||||
for i, companion in ipairs(attributes) do
|
||||
local AttributeName = companion.Name
|
||||
local AttributeValue = companion.value
|
||||
local isPositive = companion.isPositive
|
||||
|
||||
local button = CreateFrame("Button", "SM_CollectionsAttributeutton" .. i, parent)
|
||||
button:SetSize(buttonH, buttonW)
|
||||
button:SetNormalTexture("Interface\\AddOns\\SM_CollectionSystem\\Textures\\AttributeuttonTexture")
|
||||
|
||||
button:SetPoint("TOPLEFT", -15, -30 - (i - 1) * (buttonW))
|
||||
|
||||
-- 创建左侧文本框 - 属性名称
|
||||
local nameText = button:CreateFontString(nil, "OVERLAY")
|
||||
nameText:SetPoint("LEFT", 5, 0)
|
||||
nameText:SetFontObject(titleFont)
|
||||
nameText:SetFont("Fonts\\ZYKai_T.ttf", 10, "MONOCHROME")
|
||||
nameText:SetText(AttributeName)
|
||||
nameText:SetJustifyH("LEFT")
|
||||
nameText:SetJustifyV("CENTER")
|
||||
nameText:SetTextColor(1, 1, 1)
|
||||
|
||||
-- 创建右侧文本框 - 格式化的属性值
|
||||
local valueText = button:CreateFontString(nil, "OVERLAY")
|
||||
valueText:SetPoint("RIGHT", -5, 0)
|
||||
valueText:SetFontObject(titleFont)
|
||||
valueText:SetFont("Fonts\\ZYKai_T.ttf", 10, "MONOCHROME")
|
||||
|
||||
-- 格式化属性值显示
|
||||
local formattedValue = isPositive and ("+ " .. AttributeValue) or ("- " .. AttributeValue)
|
||||
valueText:SetText(formattedValue)
|
||||
valueText:SetJustifyH("RIGHT")
|
||||
valueText:SetJustifyV("CENTER")
|
||||
|
||||
-- 根据正负设置颜色
|
||||
if isPositive then
|
||||
valueText:SetTextColor(0, 1, 0) -- 绿色表示正面效果
|
||||
else
|
||||
valueText:SetTextColor(1, 0, 0) -- 红色表示负面效果
|
||||
end
|
||||
|
||||
button:Show()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- 创建标签页
|
||||
function SM_Collections:CreateTabs(parent)
|
||||
local tabs = {}
|
||||
@ -875,11 +822,11 @@ function SM_Collections:UpdateRightPanel(selectedItem, itemType)
|
||||
end
|
||||
|
||||
-- 获取特定项目的属性加成
|
||||
function SM_Collections:GetAttributesForItem(item, callback, itemType)
|
||||
-- 使用新的特定项目属性获取方法
|
||||
SM_Collections.DataManager:GetAttributesForSpecificItem(item.id, itemType, function(attributes)
|
||||
callback(attributes)
|
||||
end)
|
||||
function SM_Collections:GetAttributesForItem(item, callback, itemType)
|
||||
-- 使用新的特定项目属性获取方法
|
||||
SM_Collections.DataManager:GetAttributesForSpecificItem(item.id, itemType, function(attributes)
|
||||
callback(attributes)
|
||||
end)
|
||||
end
|
||||
|
||||
-- 更新特定项目的属性显示
|
||||
|
||||
BIN
效果图/效果图1.psd
BIN
效果图/效果图1.psd
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user