131 lines
5.6 KiB
Lua
131 lines
5.6 KiB
Lua
|
------------------------------------------------
|
|||
|
--作者: HJ
|
|||
|
--日期: 2021-02-22
|
|||
|
--文件: ItemTipsMgr.lua
|
|||
|
--模块: ItemTipsMgr
|
|||
|
--描述: Tips管理器
|
|||
|
------------------------------------------------
|
|||
|
local ItemTipsMgr = {
|
|||
|
--需要显示的道具信息
|
|||
|
TipsModel = nil,
|
|||
|
}
|
|||
|
|
|||
|
-- 显示道具tips
|
|||
|
-- <param name="goods">需要显示的物品信息</param>
|
|||
|
-- <param name="obj">点击的游戏物体</param>
|
|||
|
-- <param name="location">所在位置</param>
|
|||
|
function ItemTipsMgr:ShowTips(goods, obj, location, isShowGetBtn, cost, isResetPosion, ExtData, washDic, gemInlayList, jadeInlayList, gemRefinLv, suitData)
|
|||
|
self:Close()
|
|||
|
if (goods == nil) then
|
|||
|
return
|
|||
|
end
|
|||
|
local _goodsType = goods.Type
|
|||
|
if _goodsType == -1 then
|
|||
|
--C#端解析错误,使用lua重新解析
|
|||
|
goods = LuaItemBase.CreateItemBase(goods.CfgID)
|
|||
|
end
|
|||
|
local _goodsClassType = type(goods)
|
|||
|
if _goodsClassType == "userdata" then
|
|||
|
--C#端创建的对象,需要转为lua对象
|
|||
|
if _goodsType == ItemType.PetEquip or
|
|||
|
_goodsType == ItemType.SoulPearl or
|
|||
|
_goodsType == ItemType.HorseEquip or
|
|||
|
_goodsType == ItemType.DevilSoulEquip or
|
|||
|
_goodsType == ItemType.UnrealEquip then
|
|||
|
goods = LuaItemBase.CreateItemBase(goods.CfgID)
|
|||
|
end
|
|||
|
end
|
|||
|
if location == nil then
|
|||
|
location = ItemTipsLocation.Defult
|
|||
|
end
|
|||
|
if isShowGetBtn == nil then
|
|||
|
isShowGetBtn = true
|
|||
|
end
|
|||
|
if isResetPosion == nil then
|
|||
|
isResetPosion = true
|
|||
|
end
|
|||
|
local select = {};
|
|||
|
select.ShowGoods = goods;
|
|||
|
select.SelectObj = obj;
|
|||
|
select.Locatioin = location;
|
|||
|
select.costEquip = cost;
|
|||
|
select.isShowGetBtn = isShowGetBtn;
|
|||
|
select.ExtData = ExtData;
|
|||
|
--洗练属性字典 eg:{1, {Value=1, Percent = 99.9}}
|
|||
|
select.WashDic = washDic
|
|||
|
--宝石镶嵌列表 放入镶嵌的石头ID,未镶嵌的发0 eg:{13001, 0, 0, 0, 0, 0}
|
|||
|
select.GemInlayList = gemInlayList
|
|||
|
--仙玉镶嵌列表 放入镶嵌的石头ID,未镶嵌的发0 eg:{13001, 0, 0, 0, 0, 0}
|
|||
|
select.JadeInlayList = jadeInlayList
|
|||
|
--宝石精练等级
|
|||
|
select.GemRefinLv = gemRefinLv
|
|||
|
--套装数据
|
|||
|
select.SuitData = suitData
|
|||
|
self.TipsModel = goods;
|
|||
|
select.isResetPosion = isResetPosion;
|
|||
|
|
|||
|
if (_goodsType == ItemType.Equip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIEQUIPTIPSFORM_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.MonsterSoulEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIMonsterEquipTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.HolyEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIHolyEquipTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.ImmortalEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIImmortalEquipTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.LingPo) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UILingPoTipsForm_Open, select);
|
|||
|
elseif (_goodsType == ItemType.PetEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIPetEquipTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.HorseEquip) then
|
|||
|
GameCenter.PushFixEvent(UILuaEventDefine.UIMountEquipTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.DevilSoulEquip) then
|
|||
|
GameCenter.PushFixEvent(UILuaEventDefine.UIDevilSoulEquipTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.SoulPearl) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UISoulPearlTipsForm_OPEN, select);
|
|||
|
elseif (_goodsType == ItemType.UnrealEquip) then
|
|||
|
GameCenter.PushFixEvent(UILuaEventDefine.UIUnrealEquipTipsForm_OPEN, select);
|
|||
|
else
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIITEMTIPS_OPEN, select);
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
-- 显示道具tips
|
|||
|
-- <param name="id">物品的配置表id</param>
|
|||
|
-- <param name="obj">点击的游戏物体</param>
|
|||
|
-- <param name="isShowGetBtn">是否显示获得按钮</param>
|
|||
|
-- <param name="location">位置</param>
|
|||
|
function ItemTipsMgr:ShowTipsByCfgid(id, obj, isShowGetBtn, location)
|
|||
|
local itemBase = LuaItemBase.CreateItemBase(id);
|
|||
|
self:ShowTips(itemBase, obj, location, isShowGetBtn);
|
|||
|
end
|
|||
|
|
|||
|
-- 关闭道具tips
|
|||
|
function ItemTipsMgr:Close()
|
|||
|
if self.TipsModel == nil then
|
|||
|
return
|
|||
|
end
|
|||
|
if (self.TipsModel.Type == ItemType.Equip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIEQUIPTIPSFORM_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.MonsterSoulEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIMonsterEquipTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.HolyEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIHolyEquipTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.ImmortalEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIImmortalEquipTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.LingPo) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UILingPoTipsForm_Close);
|
|||
|
elseif (self.TipsModel.Type == ItemType.PetEquip) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIPetEquipTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.HorseEquip) then
|
|||
|
GameCenter.PushFixEvent(UILuaEventDefine.UIMountEquipTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.DevilSoulEquip) then
|
|||
|
GameCenter.PushFixEvent(UILuaEventDefine.UIDevilSoulEquipTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.SoulPearl) then
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UISoulPearlTipsForm_CLOSE);
|
|||
|
elseif (self.TipsModel.Type == ItemType.UnrealEquip) then
|
|||
|
GameCenter.PushFixEvent(UILuaEventDefine.UIUnrealEquipTipsForm_CLOSE);
|
|||
|
else
|
|||
|
GameCenter.PushFixEvent(UIEventDefine.UIITEMTIPS_CLOSE);
|
|||
|
end
|
|||
|
end
|
|||
|
return ItemTipsMgr
|