物品收藏模型框架脱掉所有装备
This commit is contained in:
parent
01676c66fb
commit
519fa03edb
@ -679,29 +679,29 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
end
|
||||
end
|
||||
|
||||
if model.TransmogStateTexture then model.TransmogStateTexture:Hide() end
|
||||
table.insert(modelFrames, model)
|
||||
model:Show()
|
||||
model:EnableMouse(true)
|
||||
model:SetScript("OnEnter", function(self)
|
||||
if model.TransmogStateTexture then model.TransmogStateTexture:Hide() end --隐藏模型状态纹理
|
||||
table.insert(modelFrames, model) --将模型添加到模型帧数组中
|
||||
model:Show() --显示模型
|
||||
model:EnableMouse(true) --启用鼠标
|
||||
model:SetScript("OnEnter", function(self) --鼠标进入事件
|
||||
-- 处理NEW图标
|
||||
if self.newTexture and self.newTexture:IsShown() then
|
||||
self.newTexture:Hide()
|
||||
self.newTexture:Hide() --隐藏NEW图标
|
||||
-- 从NewItems表中移除
|
||||
if SM_Collections and SM_Collections.NewItems and SM_Collections.NewItems.item then
|
||||
SM_Collections.NewItems.item[tonumber(itemID)] = nil
|
||||
if SM_Collections and SM_Collections.NewItems and SM_Collections.NewItems.item then --如果NewItems表存在且NewItems.item存在
|
||||
SM_Collections.NewItems.item[tonumber(itemID)] = nil --从NewItems表中移除
|
||||
end
|
||||
end
|
||||
|
||||
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetHyperlink("item:" .. itemID)
|
||||
GameTooltip:SetOwner(self, "ANCHOR_RIGHT") --设置物品提示框位置
|
||||
GameTooltip:SetHyperlink("item:" .. itemID) --设置物品链接
|
||||
GameTooltip:Show()
|
||||
end)
|
||||
model:SetScript("OnLeave", function() GameTooltip:Hide() end)
|
||||
local currentItemID = itemID
|
||||
local currentModel = model
|
||||
model:SetScript("OnMouseDown", function(self)
|
||||
SM_ItemCollectionUI:SelectModel(currentModel)
|
||||
model:SetScript("OnMouseDown", function(self) --鼠标按下事件
|
||||
SM_ItemCollectionUI:SelectModel(currentModel) --选中模型
|
||||
if SM_Collections.MainFrame and SM_Collections.MainFrame.RightSidePanel then
|
||||
local itemName = GetItemInfo(currentItemID)
|
||||
if SM_Collections.MainFrame.RightSidePanel.MountNama then
|
||||
@ -715,11 +715,11 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if #modelFrames > 0 and slot.items[startIdx] then
|
||||
local firstModel = modelFrames[1]
|
||||
self:SelectModel(firstModel)
|
||||
local itemID = slot.items[startIdx]
|
||||
local itemName = GetItemInfo(itemID)
|
||||
if #modelFrames > 0 and slot.items[startIdx] then --如果模型帧数大于0且物品ID大于0
|
||||
local firstModel = modelFrames[1] --获取第一个模型
|
||||
self:SelectModel(firstModel) --选中第一个模型
|
||||
local itemID = slot.items[startIdx] --获取物品ID
|
||||
local itemName = GetItemInfo(itemID) --获取物品名称
|
||||
|
||||
|
||||
|
||||
@ -802,7 +802,7 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
table.insert(modelFrames, model)
|
||||
model:Show()
|
||||
model:EnableMouse(true)
|
||||
model:SetScript("OnEnter", function(self)
|
||||
model:SetScript("OnEnter", function(self) --鼠标进入事件
|
||||
-- 处理NEW图标
|
||||
if self.newTexture and self.newTexture:IsShown() then
|
||||
self.newTexture:Hide()
|
||||
@ -819,7 +819,7 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
model:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
|
||||
local currentItemID = itemID
|
||||
local currentModel = model
|
||||
model:SetScript("OnMouseDown", function(self)
|
||||
model:SetScript("OnMouseDown", function(self) --鼠标按下事件
|
||||
SM_ItemCollectionUI:SelectModel(currentModel)
|
||||
if SM_Collections.MainFrame and SM_Collections.MainFrame.RightSidePanel then
|
||||
local itemName = GetItemInfo(currentItemID)
|
||||
@ -854,17 +854,19 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
SM_ItemCollectionUI:UpdateAttributes(currentItemID, slot.invType)
|
||||
end
|
||||
end)
|
||||
if slot.invType == "INVTYPE_WEAPONMAINHAND" or slot.invType == "INVTYPE_WEAPONOFFHAND" then
|
||||
if slot.invType == "INVTYPE_WEAPONMAINHAND" or slot.invType == "INVTYPE_WEAPONOFFHAND" then --主副手武器
|
||||
model:ClearModel()
|
||||
if slot.invType == "INVTYPE_WEAPONOFFHAND" then
|
||||
model.originalType = "off"
|
||||
self:SetModelType(model, "off")
|
||||
self:SetModelType(model, "off") --设置模型类型 副手
|
||||
else
|
||||
model.originalType = "main"
|
||||
self:SetModelType(model, "main")
|
||||
self:SetModelType(model, "main") --设置模型类型 主手
|
||||
end
|
||||
model:Undress()
|
||||
local success, error = pcall(function() model:TryOn(itemID) end)
|
||||
model:Undress() --脱下装备
|
||||
local success, error = pcall(function()
|
||||
model:TryOn(itemID) --穿上装备
|
||||
end)
|
||||
local weaponCameraID
|
||||
if slot.invType == "INVTYPE_WEAPONOFFHAND" then
|
||||
weaponCameraID = SM_CollectionData:GetWeaponCameraID("INVTYPE_WEAPONOFFHAND")
|
||||
@ -872,12 +874,14 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
weaponCameraID = SM_CollectionData:GetWeaponCameraID("INVTYPE_WEAPONMAINHAND")
|
||||
end
|
||||
self:ApplyCamera(model, weaponCameraID)
|
||||
elseif slot.invType == "INVTYPE_RANGED" then
|
||||
elseif slot.invType == "INVTYPE_RANGED" then --远程武器
|
||||
model:ClearModel()
|
||||
model:SetUnit("player")
|
||||
model.animID = ANIMATION_RANGED_PREVIEW
|
||||
model:Undress()
|
||||
local success, error = pcall(function() model:TryOn(itemID) end)
|
||||
model:Undress() --脱下装备
|
||||
local success, error = pcall(function()
|
||||
model:TryOn(itemID) --穿上装备
|
||||
end)
|
||||
local cameraID = SM_CollectionData:GetCharacterCameraID(slot.invType)
|
||||
self:ApplyCamera(model, cameraID)
|
||||
model:EnableMouse(true)
|
||||
@ -928,9 +932,12 @@ function SM_ItemCollectionUI:ShowItemPreview(slot, panel)
|
||||
end
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
else
|
||||
self:SetModelType(model, "player")
|
||||
local success, error = pcall(function() model:TryOn(itemID) end)
|
||||
else --其他装备
|
||||
self:SetModelType(model, "player") --设置模型类型
|
||||
model:Undress() --脱下装备
|
||||
local success, error = pcall(function()
|
||||
model:TryOn(itemID) --穿上装备
|
||||
end)
|
||||
local cameraID = SM_CollectionData:GetCharacterCameraID(slot.invType)
|
||||
self:ApplyCamera(model, cameraID)
|
||||
end
|
||||
|
||||
@ -5,15 +5,9 @@
|
||||
本地数据提供者 - 封装现有硬编码数据
|
||||
服务端数据提供者 - 预留服务端通信接口
|
||||
数据管理器 - 统一管理数据获取逻辑
|
||||
|
||||
当您准备好与 AzerothCore 服务端通信时,只需要:
|
||||
|
||||
SM_Collections.Config.UseServerData 默认 true 读取服务端数据
|
||||
如需切换回本地数据,将 UseServerData 设为 false
|
||||
在 ServerDataProvider:SendServerRequest 中实现实际的服务端通信逻辑
|
||||
|
||||
所有UI代码无需修改,插件可以正常测试UI功能,同时为未来的服务端集成做好了准备
|
||||
|
||||
--]]
|
||||
|
||||
-- 这里将拆分为多个文件,主入口只保留加载和初始化逻辑
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user