源战役客户端
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

649 рядки
20 KiB

1 місяць тому
  1. ItemUseModel = ItemUseModel or BaseClass(BaseModel)
  2. ItemUseModel.IgnoreProduceType =
  3. {
  4. [274] = "GoodsShelvesDwon", --市场下架
  5. [350] = "GoodsTransfer", -- 背包移动
  6. }
  7. function ItemUseModel:__init()
  8. ItemUseModel.Instance = self
  9. self.goods_dic = {} --获得的物品
  10. self.hide_item_view = false
  11. self.login_use_handle = false
  12. self.is_delay_show = false
  13. end
  14. function ItemUseModel:getInstance()
  15. if ItemUseModel.Instance == nil then
  16. ItemUseModel.New()
  17. end
  18. return ItemUseModel.Instance
  19. end
  20. --清除缓存数据
  21. function ItemUseModel:ClearData()
  22. self.goods_dic = {} --获得的物品
  23. self.fashion_add_goods = {} --时装类道具增加数组
  24. self.hide_item_view = false
  25. self.login_use_handle = false
  26. end
  27. --针对 15017 协议
  28. function ItemUseModel:UpdateBagGoodsDic(vo, produce_type,add_wear_horse)
  29. --某些产出类型,就不处理便捷弹窗
  30. if self:IsIgnoreItemUseTip(produce_type) then return end
  31. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(vo.type_id)
  32. local lv = RoleManager.Instance.mainRoleInfo.level
  33. if not basic then
  34. return
  35. end
  36. --装备,没有激活的时装,配置为可使用的物品,都弹使用框
  37. local bag_goods_dic = GoodsModel:getInstance():GetBagGoodsDic()
  38. local goodsVo = bag_goods_dic[vo.goods_id]
  39. local copy_vo = goodsVo
  40. if not copy_vo then
  41. copy_vo = DeepCopy(vo)
  42. GoodsModel:getInstance():SetBaseInfo(copy_vo)
  43. end
  44. if GoodsModel:getInstance():IsGoodsNeedShowUseTipOnGainGoods(basic,copy_vo, vo) then
  45. if goodsVo then
  46. local exist_num = goodsVo.goods_num
  47. local last_num = vo.goods_num
  48. local curr_vo = self.goods_dic[vo.goods_id]
  49. if add_wear_horse then --放入仓库
  50. if curr_vo then
  51. curr_vo.goods_num = curr_vo.goods_num - last_num
  52. if curr_vo.goods_num <= 0 then
  53. self.goods_dic[vo.goods_id] = nil
  54. end
  55. end
  56. elseif exist_num > last_num then --说明是减少
  57. if curr_vo then
  58. curr_vo.goods_num = curr_vo.goods_num - (exist_num - last_num)
  59. if curr_vo.goods_num <= 0 then
  60. self.goods_dic[vo.goods_id] = nil
  61. end
  62. end
  63. elseif exist_num < last_num then --说明是增加
  64. if curr_vo then
  65. curr_vo.goods_num = curr_vo.goods_num + (last_num - exist_num)
  66. else
  67. self.goods_dic[vo.goods_id] = copy_vo
  68. end
  69. else
  70. --道具变更,并且原来没出现在便捷使用里
  71. if vo.goods_num > 0 and not self.goods_dic[vo.goods_id] then
  72. self.goods_dic[vo.goods_id] = copy_vo
  73. end
  74. end
  75. else
  76. --道具使用完
  77. if vo.goods_num == 0 then
  78. self.goods_dic[vo.goods_id] = nil
  79. --道具添加的时候
  80. elseif vo.goods_num > 0 and not self.goods_dic[vo.goods_id] then
  81. self.goods_dic[vo.goods_id] = copy_vo
  82. end
  83. end
  84. if basic.type == GoodsModel.TYPE.EQUIP then
  85. if vo.goods_num > 0 then
  86. self.goods_dic[vo.goods_id] = copy_vo
  87. else
  88. --穿了某个装备的时候,判断下,便捷使用的其他装备,是否能够满足继续穿戴的情况
  89. GlobalEventSystem:DelayFire(EventName.CHECK_ITEM_USE_EQUIP_CAN_SHOW)
  90. end
  91. end
  92. else
  93. if basic.type == GoodsModel.TYPE.EQUIP then
  94. if vo.goods_num == 0 then
  95. --穿了某个装备的时候,判断下,便捷使用的其他装备,是否能够满足继续穿戴的情况
  96. GlobalEventSystem:DelayFire(EventName.CHECK_ITEM_USE_EQUIP_CAN_SHOW)
  97. end
  98. end
  99. end
  100. if basic.type == 17 and basic.subtype == 3 then --神格装备
  101. -- if not DeityModel:getInstance():EquipFightCompare(vo.type_id) then
  102. -- self.goods_dic[vo.goods_id] = nil
  103. -- end
  104. elseif basic.type == 36 and basic.subtype == 4 then
  105. local vip_type = RoleManager.Instance.mainRoleInfo.vip_type
  106. if vip_type and vip_type <= 1 then
  107. self.goods_dic[vo.goods_id] = nil
  108. end
  109. end
  110. end
  111. --添加提示
  112. function ItemUseModel:AddUseTip( vo )
  113. local copy_vo = DeepCopy(vo)
  114. GoodsModel:getInstance():SetBaseInfo(copy_vo)
  115. self.goods_dic[vo.goods_id] = copy_vo
  116. end
  117. --强制添加提示
  118. function ItemUseModel:AddForceUseTip( vo )
  119. local copy_vo = DeepCopy(vo)
  120. GoodsModel:getInstance():SetBaseInfo(copy_vo)
  121. copy_vo.force = true
  122. self.goods_dic[vo.goods_id] = copy_vo
  123. end
  124. --尝试去添加提示
  125. function ItemUseModel:TryAddUseTip( vo )
  126. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(vo.type_id)
  127. if not basic then
  128. return
  129. end
  130. local bool = false
  131. if basic.type == GoodsModel.TYPE.EQUIP then
  132. -- if basic.career_id == 0 or basic.career_id == RoleManager.Instance.mainRoleInfo.career then
  133. -- bool = true
  134. -- end
  135. bool = false
  136. elseif basic.type == 17 and basic.subtype == 3 then
  137. if DeityModel:getInstance():EquipFightCompare(basic.type_id) then
  138. bool = true
  139. end
  140. end
  141. local cfg = Config.ConfigItemUse.Reward[vo.type_id] or Config.ConfigItemUse.TypeUse[basic.type.."@"..basic.subtype]
  142. if cfg then
  143. local lv = RoleManager.Instance.mainRoleInfo.level
  144. local career = RoleManager.Instance.mainRoleInfo.career
  145. if (cfg.limit_lv == -1 or (cfg.limit_lv ~= -1 and lv >= cfg.limit_lv)) and (not cfg.career or (cfg.career and cfg.career == career)) then
  146. bool = true
  147. else
  148. bool = false
  149. end
  150. end
  151. if bool then
  152. local copy_vo = DeepCopy(vo)
  153. GoodsModel:getInstance():SetBaseInfo(copy_vo)
  154. self.goods_dic[vo.goods_id] = copy_vo
  155. end
  156. end
  157. --针对 15010协议
  158. function ItemUseModel:HandleLoginUseTips(goods_list)
  159. if not self.login_use_handle and goods_list then
  160. print("ItemUseModel:HandleLoginUseTips()")
  161. for i, vo in ipairs(goods_list) do
  162. ItemUseModel:getInstance():TryAddUseTip(vo)
  163. end
  164. self.login_use_handle = true
  165. end
  166. end
  167. --针对 15018 协议 当出售的时候
  168. function ItemUseModel:UpdateBagGoodsDicWhenSell(vo)
  169. local bag_goods_dic = GoodsModel:getInstance():GetBagGoodsDic()
  170. local goodsVo = bag_goods_dic[vo.goods_id]
  171. if goodsVo then
  172. local exist_num = goodsVo.goods_num
  173. local last_num = vo.goods_num
  174. --说明是减少
  175. local curr_vo = self.goods_dic[vo.goods_id]
  176. if exist_num > last_num then
  177. if curr_vo then
  178. curr_vo.goods_num = curr_vo.goods_num - (exist_num - last_num)
  179. if curr_vo.goods_num <= 0 then
  180. self.goods_dic[vo.goods_id] = nil
  181. end
  182. end
  183. end
  184. end
  185. end
  186. function ItemUseModel:UpdateStarShadowBagGoods( vo )
  187. local bag_goods_dic = GoodsModel:getInstance().starShadow_bag_list
  188. local goodsVo = bag_goods_dic[vo.goods_id]
  189. if goodsVo then
  190. local exist_num = goodsVo.goods_num
  191. local last_num = vo.goods_num
  192. --说明是减少
  193. local curr_vo = self.goods_dic[vo.goods_id]
  194. if exist_num > last_num then
  195. if curr_vo then
  196. curr_vo.goods_num = curr_vo.goods_num - (exist_num - last_num)
  197. if curr_vo.goods_num <= 0 then
  198. self.goods_dic[vo.goods_id] = nil
  199. end
  200. end
  201. end
  202. end
  203. end
  204. --获取主界面道具使用界面Vo
  205. function ItemUseModel:MatchPopCondition()
  206. local scene_mgr = SceneManager.Instance
  207. if scene_mgr:IsNoonQuizScene() then
  208. return false
  209. end
  210. if GuideModel:getInstance():IsHideSmallUI() then
  211. return false
  212. end
  213. if self.is_delay_show then
  214. return false
  215. end
  216. return true
  217. end
  218. --获取主界面道具使用界面Vo
  219. function ItemUseModel:GetItemShowVo()
  220. if self.goods_dic then
  221. for i,vo in pairs(self.goods_dic) do
  222. if vo.force==true and (vo.expire_time == 0 or (vo.expire_time ~= 0 and vo.expire_time - TimeUtil:getServerTime() > 0))then --强制提示
  223. return vo
  224. else
  225. if vo.type == GoodsModel.TYPE.EQUIP then --如果是装备,则判断是否有更好的 才显示
  226. local is_can_wear = EquipModel:getInstance():EquipCanShowGoodsTip(vo)
  227. if is_can_wear then
  228. return vo, true
  229. end
  230. local is_auction = GoodsModel:getInstance():IsEquipCanAuctionButNoUse(vo)
  231. if is_auction then
  232. return vo
  233. end
  234. else
  235. if vo.expire_time == 0 or (vo.expire_time ~= 0 and vo.expire_time - TimeUtil:getServerTime() > 0) then
  236. return vo
  237. end
  238. end
  239. end
  240. end
  241. end
  242. return nil
  243. end
  244. function ItemUseModel:SetIgnore_Better( bool )
  245. self.ignore_better = bool
  246. if bool then
  247. setTimeout(function()
  248. self.ignore_better = false
  249. end,3)
  250. end
  251. end
  252. --根据物品类型获取数量
  253. function ItemUseModel:GetTypeGoodsNum(typeId)
  254. local id = tonumber(typeId)
  255. local theNum = 0
  256. if id < 1 then
  257. return 0
  258. end
  259. for i,vo in pairs(self.goods_dic) do
  260. if vo.type_id == typeId then
  261. theNum = theNum + vo.goods_num
  262. end
  263. end
  264. return theNum
  265. end
  266. --根据物品id获取数量
  267. function ItemUseModel:GetGoodsNumById(goods_id)
  268. return self.goods_dic[goods_id] and self.goods_dic[goods_id].goods_num or 0
  269. end
  270. --当当前物品被使用的时候 。查看剩下的相同type_id,有的话优先取这个Vo
  271. function ItemUseModel:GetVoByTypeId(typeId)
  272. if self.goods_dic then
  273. for i,vo in pairs(self.goods_dic) do
  274. if vo.type_id == typeId then
  275. return vo
  276. end
  277. end
  278. end
  279. return nil
  280. end
  281. --当当前物品被使用的时候 。查看剩下的相同type_id,有的话优先取这个Vo
  282. function ItemUseModel:ContainGoodsId(goods_id)
  283. return self.goods_dic[goods_id]
  284. end
  285. --根据类型id清除Vo信息
  286. function ItemUseModel:ClearTypeIdData(typeId)
  287. if self.goods_dic then
  288. for i,vo in pairs(self.goods_dic) do
  289. if vo.type_id == typeId then
  290. self.goods_dic[vo.goods_id] = nil
  291. end
  292. end
  293. end
  294. end
  295. --根据物品唯一id清除Vo信息
  296. function ItemUseModel:ClearIdData(goods_id)
  297. if self.goods_dic then
  298. print(">>>>>>>>>>> ClearIdData ", goods_id)
  299. for i,vo in pairs(self.goods_dic) do
  300. if vo.goods_id == goods_id then
  301. self.goods_dic[vo.goods_id] = nil
  302. end
  303. end
  304. -- PrintTable(self.goods_dic)
  305. end
  306. end
  307. --删除评分更低的装备
  308. function ItemUseModel:DelLowerEquip(goods_id)
  309. if self.goods_dic then
  310. local goods_vo = GoodsModel:getInstance():GetBagGoodsInfoById(goods_id)
  311. if goods_vo then
  312. for i,vo in pairs(self.goods_dic) do
  313. if vo.type_id == goods_vo.type_id and vo.rating<=goods_vo.rating then
  314. self.goods_dic[vo.goods_id] = nil
  315. end
  316. end
  317. end
  318. end
  319. end
  320. --是否小天使小恶魔
  321. function ItemUseModel:IsEquipSpecialType(type_id)
  322. local goods_basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
  323. if goods_basic then
  324. return goods_basic.type == GoodsModel.TYPE.EQUIP and goods_basic.subtype == GoodsModel.SHOUHU_EQUIP_TYPE
  325. end
  326. return false
  327. end
  328. --是否佩戴了或者拥有小恶魔
  329. function ItemUseModel:HasWearXiaoEMoOrHas( )
  330. local vo = GoodsModel:getInstance().wear_equip_list[GoodsModel.SHOUHU_EQUIP_TYPE]
  331. if not vo then --装备栏上没有装备小恶魔
  332. local bool = self:CheckXiaoEMo(1011000003)
  333. if bool then
  334. return
  335. end
  336. local list = GoodsModel:getInstance():GetTypeGoods(1011000001)
  337. if TableSize(list) ~= 0 then --背包里有小恶魔
  338. table.sort(list,function (a,b)
  339. return a.expire_time > b.expire_time
  340. end)
  341. for i,v in ipairs(list) do
  342. if TimeUtil:getServerTime() < v.expire_time then
  343. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,v, 5)
  344. -- BaseDungeonModel:getInstance():Fire(BaseDungeonModel.SHOW_UES_EXP_EVIL_BTN,true,v.goods_id)
  345. return
  346. end
  347. end
  348. --这里就是续费
  349. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,list[1], 5)
  350. BaseDungeonModel:getInstance():Fire(BaseDungeonModel.SHOW_UES_EXP_EVIL_BTN,true,list[1].goods_id)
  351. end
  352. else
  353. --local vo = GoodsModel:getInstance().wear_equip_list[11]
  354. -- if vo and (vo.type_id==1011000001 or vo.type_id==1011000005) and TimeUtil:getServerTime() > vo.expire_time then
  355. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,vo, 5)
  356. -- end
  357. if vo.type_id == 1011000003 or vo.type_id == 1011000001 or vo.type_id == 1011000005 then
  358. if TimeUtil:getServerTime() > vo.expire_time then --物品过期了
  359. if vo.type_id == 1011000003 then --如果身上大的过期,就看看背包里面有没有小的没有过期的
  360. local bool = self:CheckXiaoEMo(1011000001)
  361. if not bool then --如果没有,就提醒续费
  362. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,vo, 5)
  363. BaseDungeonModel:getInstance():Fire(BaseDungeonModel.SHOW_UES_EXP_EVIL_BTN,true,vo.goods_id)
  364. end
  365. elseif vo.type_id == 1011000001 then --如果身上是小的过期了,就看看背包里面有没有大的,没有就提醒续费
  366. local bool = self:CheckXiaoEMo(1011000003)
  367. if not bool then --如果没有,就提醒续费
  368. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,vo, 5)
  369. BaseDungeonModel:getInstance():Fire(BaseDungeonModel.SHOW_UES_EXP_EVIL_BTN,true,vo.goods_id)
  370. end
  371. elseif vo.type_id == 1011000005 then
  372. local bool = self:CheckXiaoEMo(1011000003)
  373. if not bool then --如果没有,就提醒续费
  374. bool = self:CheckXiaoEMo(1011000001)
  375. if not bool then --如果没有,就提醒续费
  376. -- GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,vo, 5)
  377. BaseDungeonModel:getInstance():Fire(BaseDungeonModel.SHOW_UES_EXP_EVIL_BTN,true,vo.goods_id)
  378. end
  379. end
  380. end
  381. else --如果没有过期,并且身上是小的,就看看背包里有没有大的,如果是大的没有过期,就什么都不敢
  382. if vo.type_id == 1011000001 or vo.type_id == 1011000003 or vo.type_id == 1011000005 then
  383. self:CheckXiaoEMo(1011000003)
  384. end
  385. end
  386. else
  387. local bool = self:CheckXiaoEMo(1011000003)
  388. if not bool then
  389. self:CheckXiaoEMo(1011000001,true)
  390. end
  391. end
  392. end
  393. end
  394. function ItemUseModel:CheckXiaoEMo(id,show_tip)
  395. local list = GoodsModel:getInstance():GetTypeGoods(id)
  396. if TableSize(list) ~= 0 then --背包里有小恶魔
  397. table.sort(list,function (a,b)
  398. return a.expire_time > b.expire_time
  399. end)
  400. for i,v in ipairs(list) do
  401. if TimeUtil:getServerTime() < v.expire_time then
  402. GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,v, 5)
  403. return true
  404. end
  405. end
  406. --这里就是续费
  407. if show_tip then
  408. GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,list[1], 5)
  409. end
  410. end
  411. end
  412. --是否穿戴了守护
  413. function ItemUseModel:HasWearEvil( )
  414. local evil_id = EquipModel:getInstance():GetFollowGuardId()
  415. return evil_id ~= 0
  416. end
  417. --是否佩戴了未过期小恶魔
  418. function ItemUseModel:HasWearXiaoEMo( )
  419. local vo = GoodsModel:getInstance().wear_equip_list[11]
  420. if vo and (vo.type_id==1011000001 or vo.type_id==1011000005 or vo.type_id==1011000003 ) and TimeUtil:getServerTime() < vo.expire_time then
  421. return true
  422. end
  423. end
  424. --是否佩戴了未过期小天使
  425. function ItemUseModel:HasWearXiaoTianShi( )
  426. local vo = GoodsModel:getInstance().wear_equip_list[11]
  427. if vo and (vo.type_id==1011000002 or vo.type_id==1011000004 )and TimeUtil:getServerTime() < vo.expire_time then
  428. return true
  429. end
  430. end
  431. function ItemUseModel:HideItemUseView( )
  432. self.hide_item_view = true
  433. GlobalEventSystem:Fire(EventName.CLOSE_ITEM_USE_VIEW)
  434. end
  435. function ItemUseModel:GetHideState( )
  436. return self.hide_item_view
  437. end
  438. function ItemUseModel:SetHideState(bool)
  439. self.hide_item_view = bool
  440. end
  441. function ItemUseModel:ShowItemUseView( )
  442. if not GoodsModel:getInstance():CheckCanFlyGood() then--检查飞道具图标的条件
  443. return
  444. end
  445. local vo = ItemUseModel:getInstance():GetItemShowVo()
  446. if vo then
  447. self.hide_item_view = false
  448. GlobalEventSystem:Fire(EventName.REOPEN_ITEM_USE_VIEW)
  449. else
  450. self.hide_item_view = false
  451. end
  452. end
  453. -- 因为骑宠幻形激活道具填了use又无法再背包使用jump属性比较蛋疼,所以在这里特殊处理
  454. function ItemUseModel:IsHorsePetSpecial(vo)
  455. if vo == nil then return false end
  456. if vo.type == 18 and vo.subtype == 4 then -- 宠物幻形激活道具
  457. return PetModel:getInstance():IlluCanAvtivateByGoodsId(vo.type_id)
  458. elseif vo.type == 16 and vo.subtype == 3 then -- 坐骑幻形激活道具
  459. return HorseModel:getInstance():IlluCanAvtivateByGoodsId(vo.type_id)
  460. end
  461. return false
  462. end
  463. --未激活的时装弹出使用框
  464. function ItemUseModel:IsUnActiveFashion(vo)
  465. if vo then
  466. if vo.type == 12 and vo.subtype >= 1 and vo.subtype <= 4 then
  467. return FashionModel:getInstance():GetFashionByConsumable(vo.type_id)
  468. end
  469. end
  470. return false
  471. end
  472. --未激活的幻形宝宝弹出使用框
  473. function ItemUseModel:IsUnActiveBaby(vo)
  474. return false
  475. end
  476. function ItemUseModel:SetDelayFlag(bool,time)
  477. self.is_delay_show = bool
  478. if self.is_delay_show then
  479. setTimeout(function()
  480. self.is_delay_show = false
  481. self:ShowItemUseView()
  482. end, time)
  483. end
  484. end
  485. --是否显示使用提示界面(登录游戏时)
  486. function ItemUseModel:InitBagGoodsDicOnStarGame( goods_list )
  487. if self.is_first_init_goods_dic_on_start_game and self.is_first_init_goods_dic_on_start_game>=2 then return end
  488. self.is_first_init_goods_dic_on_start_game = self.is_first_init_goods_dic_on_start_game or 0
  489. self.is_first_init_goods_dic_on_start_game = self.is_first_init_goods_dic_on_start_game + 1
  490. for i,v in ipairs(goods_list) do
  491. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(v.type_id)
  492. local is_need_show_tip_view = GoodsModel:getInstance():IsGoodsNeedShowUseTipOnStartGame(basic,v)
  493. if is_need_show_tip_view then
  494. local copy_vo = DeepCopy(v)
  495. GoodsModel:getInstance():SetBaseInfo(copy_vo)
  496. self.goods_dic[v.goods_id] = copy_vo
  497. end
  498. end
  499. end
  500. --玩家整理道具触发便捷使用
  501. function ItemUseModel:InitBagGoodsDicOnSort( goods_list )
  502. self.goods_dic = {}
  503. for i,v in ipairs(goods_list) do
  504. if v.goods_num ~= 0 then
  505. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(v.type_id)
  506. local is_need_show_tip_view = GoodsModel:getInstance():IsGoodsNeedShowUseTipOnGainGoods(basic,v,v)
  507. if not is_need_show_tip_view then
  508. is_need_show_tip_view = GoodsModel:getInstance():IsGoodsNeedShowUseTipOnStartGame(basic,v)
  509. end
  510. if is_need_show_tip_view then
  511. local copy_vo = DeepCopy(v)
  512. self.goods_dic[v.goods_id] = copy_vo
  513. end
  514. end
  515. end
  516. local vo = self:GetItemShowVo()
  517. if vo then
  518. GlobalEventSystem:Fire(EventName.OPEN_ITEM_USE_VIEW,vo)
  519. end
  520. end
  521. --是否在便捷使用忽略列表
  522. function ItemUseModel:IsIgnoreItemUseTip(produce_type)
  523. produce_type = produce_type or 0
  524. return ItemUseModel.IgnoreProduceType[produce_type]
  525. end
  526. --重新检测下,便捷使用列表中的其他装备还是否满足可以穿戴
  527. function ItemUseModel:CheckItemUseListOtherEquipCanWear()
  528. local remove_goods_id_list = {}
  529. local is_reopen = false
  530. for k,v in pairs(self.goods_dic) do
  531. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(v.type_id)
  532. if basic and basic.type == GoodsModel.TYPE.EQUIP then
  533. local is_need_show = GoodsModel.getInstance():IsEquipNeedShowUseTipGoods(v)
  534. if not is_need_show then
  535. table.insert(remove_goods_id_list, v.goods_id)
  536. is_reopen = true
  537. end
  538. end
  539. end
  540. if is_reopen then
  541. for k,v in pairs(remove_goods_id_list) do
  542. self.goods_dic[v] = nil
  543. end
  544. GlobalEventSystem:Fire(EventName.REOPEN_ITEM_USE_VIEW)
  545. end
  546. end
  547. --是否数时装和称号道具增加了
  548. function ItemUseModel:IsAddFashionOrFashionchip(goods_vo)
  549. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_vo.type_id)
  550. if basic.type == GoodsModel.TYPE.FASHION or (basic.type == GoodsModel.TYPE.FASHIONCHIP and basic.subtype == 1) then
  551. local bag_goods_dic = GoodsModel:getInstance():GetBagGoodsDic()
  552. local bag_good_vo = bag_goods_dic[goods_vo.goods_id]
  553. self.fashion_add_goods = self.fashion_add_goods or {}
  554. --背包本来没有
  555. if not bag_good_vo then
  556. --道具增加
  557. if goods_vo.goods_num > 0 then
  558. local copy_new_vo = DeepCopy(goods_vo)
  559. table.insert(self.fashion_add_goods, copy_new_vo)
  560. end
  561. else
  562. --道具变更,并且增加
  563. if goods_vo.goods_num > bag_good_vo.goods_num then
  564. local copy_new_vo = DeepCopy(goods_vo)
  565. table.insert(self.fashion_add_goods, copy_new_vo)
  566. end
  567. end
  568. end
  569. end
  570. --检测一些特殊类型的道具的便捷使用
  571. function ItemUseModel:CheckReShowGood()
  572. if self.fashion_add_goods and #self.fashion_add_goods > 0 then
  573. for i,vo in ipairs(self.fashion_add_goods) do
  574. self:UpdateBagGoodsDic(vo, nil,nil)
  575. end
  576. GoodsModel.getInstance():DelayFire(GoodsModel.CHANGE_BAGLIST)
  577. end
  578. self.fashion_add_goods = {}
  579. end