根据你的代码结构,我建议在`createItemShow`函数中添加额外的物品框创建。以下是修改后的代码:
```lua
function zhuanpanOBJ:createItemShow()
-- 先清理已存在的红点
for i = 1, 9 do
local item = self.ui["item_" .. i]
if item and not GUI:Win_IsNull(item) then
local oldRedDot = GUI:getChildByName(item, "Image_bg_" .. i)
if oldRedDot and not GUI:Win_IsNull(oldRedDot) then
GUI:removeFromParent(oldRedDot)
end
end
end
-- 创建额外的物品框(itemid: 10380, count: 1)
local extraItem = GUI:ItemShow_Create(self._parent, "extra_item", 0, 200,
{ index = 10380, look = true, count = 1 })
GUI:setAnchorPoint(extraItem, 0.5, 0.5)
-- 重新创建红点,使用当前转盘对应的cfg表格
local currentCfg = self.cfg[self.currentTable]
for i = 1, 9 do
local cfgData = currentCfg[i]
if cfgData then
local item = GUI:ItemShow_Create(self.ui["item_" .. i], "item", 0, 0,
{ index = cfgData.showReward[1][1], look = true, count = cfgData.showReward[1][2] })
GUI:setAnchorPoint(item, 0.5, 0.5)
-- 检查数据有效性,使用当前转盘的数据
if self.Data and self.Data[tostring(self.currentTable)] and
self.Data[tostring(self.currentTable)].reward and
self.Data[tostring(self.currentTable)].reward[tostring(i)] == 1 then
-- 添加红点标记已获取
local imgPath = "res/custom/common/zt/zaixian1.png"
local Image_bg = GUI:Image_Create(item, "Image_bg_" .. i, -25, -15, imgPath)
end
end
end
end
```
主要修改:
1. 在函数开头添加了创建额外物品框的代码
2. 使用`GUI:ItemShow_Create`创建物品框,参数为:
- `parent`: `self._parent`(主界面)
- `ID`: `"extra_item"`(唯一标识)
- `x`: `0`(横坐标)
- `y`: `200`(纵坐标)
- `setData`: `{ index = 10380, look = true, count = 1 }`(物品配置)
这样会在转盘界面的(0, 200)位置显示一个物品框,展示itemid为10380、数量为1的物品。你可以根据需要调整坐标位置。