源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1414 lines
68 KiB

  1. GoodsTooltips = GoodsTooltips or BaseClass(BaseView)
  2. function GoodsTooltips:__init()
  3. self.base_file = "common"
  4. self.layout_file = "goodsTooltips"
  5. self.layer_name = "Top"
  6. self.is_set_zdepth = true
  7. self.use_background = true
  8. self.click_bg_toClose = true
  9. self.hide_maincancas = false
  10. self.hide_clear_role_model = false
  11. self.blur_activity_bg = true
  12. self.use_show_anim = true
  13. self.use_hide_anim = true
  14. self.base_height = 497
  15. self.pos_x = 0
  16. self.pos_y = 0
  17. self.goods_vo = nil
  18. self.is_show_btn = nil
  19. self.show_get_way = false
  20. -- self.close_fog = true
  21. self.get_way_item_list = {}
  22. self.attr_item_list = {}
  23. self.text_item_list = {}
  24. self.model = GoodsModel:getInstance()
  25. self.mainVo = RoleManager.Instance.mainRoleInfo
  26. self.shop_model = ShopModel:getInstance()
  27. self.market_model = MarketModel:getInstance()
  28. self.open_guide_close = true
  29. self.sound_id = false
  30. --self.use_local_view = true
  31. self.load_callback = function ()
  32. self:LoadSuccess()
  33. end
  34. self.open_callback = function ()
  35. self.layout.gameObject:SetActive(false)
  36. if self:IsNeedDynamic() then
  37. local callback = function (dynamic)
  38. self.goods_vo.expire_time = dynamic.expire_time
  39. self:SetData()
  40. end
  41. GoodsModel:getInstance():GetDynamic(self.goods_vo.goods_id, callback)
  42. else
  43. self:SetData()
  44. end
  45. end
  46. self.close_callback = function ()
  47. GlobalEventSystem:Fire(EventName.EQUIP_TOOL_TIP_CLOSE)
  48. end
  49. self.destroy_callback = function ()
  50. self:Remove()
  51. end
  52. end
  53. function GoodsTooltips:LoadSuccess()
  54. self.layout = self:GetChild("layout")
  55. self.icon_con = self:GetChild("layout/base_con/icon_con")
  56. self.nameText = self:GetChild("layout/base_con/nameText"):GetComponent("TextMeshProUGUI")
  57. self.countTextObj = self:GetChild("layout/base_con/countText").gameObject
  58. self.countText = self:GetChild("layout/base_con/countText"):GetComponent("TextMeshProUGUI")
  59. self.levelText = self:GetChild("layout/base_con/levelText"):GetComponent("TextMeshProUGUI")
  60. self.overdueText = self:GetChild("layout/base_con/overdueText"):GetComponent("TextMeshProUGUI")
  61. self.overdue = self:GetChild("layout/base_con/overdueText").gameObject
  62. self.overdue_bg = self:GetChild("layout/base_con/overdue_bg"):GetComponent("Image")
  63. self.overdue_bg_obj = self:GetChild("layout/base_con/overdue_bg").gameObject
  64. self.getwayUrlText = self:GetChild("layout/base_con/getwayUrlText"):GetComponent("TextMeshProUGUI")
  65. self.getwayUrlText_obj = self:GetChild("layout/base_con/getwayUrlText").gameObject
  66. self.base_con_obj = self:GetChild("layout/base_con").gameObject
  67. self.get_way_btn = self:GetChild("layout/base_con/get_way_btn").gameObject
  68. self.getWayConObj = self:GetChild("layout/get_way_con").gameObject
  69. self.conversionTimeText = self:GetChild("layout/base_con/conversionTimeText"):GetComponent("TextMeshProUGUI")
  70. self.getWayScroll,self.getWayScrollContent,self.getWayCon = GetChildTransforms(self.transform,
  71. {
  72. "layout/get_way_con/ScrollView","layout/get_way_con/ScrollView/Viewport/Content","layout/get_way_con/ScrollView/Viewport/Content"
  73. })
  74. self.btns_con = self:GetChild("layout/btns_con")
  75. self.shiyongBtn = self:GetChild("layout/btns_con/shiyongBtn").gameObject
  76. self.hechengBtn = self:GetChild("layout/btns_con/hechengBtn").gameObject
  77. self.chushouBtn = self:GetChild("layout/btns_con/chushouBtn").gameObject
  78. self.yulanBtn = self:GetChild("layout/btns_con/yulanBtn").gameObject
  79. self.storeBtn = self:GetChild("layout/btns_con/storeBtn").gameObject
  80. self.takeBtn = self:GetChild("layout/btns_con/takeBtn").gameObject
  81. self.splitBtn = self:GetChild("layout/btns_con/splitBtn").gameObject
  82. self.shelvesUpBtn = self:GetChild("layout/btns_con/shelvesUpBtn").gameObject
  83. self.shelvesDownBtn = self:GetChild("layout/btns_con/shelvesDownBtn").gameObject
  84. self.decomposeBtn = self:GetChild("layout/btns_con/decomposeBtn").gameObject
  85. self.oneKeyBuyBtn = self:GetChild("layout/btns_con/oneKeyBuyBtn").gameObject
  86. self.replaceBtn = self:GetChild("layout/btns_con/replaceBtn").gameObject
  87. self.dropBtn = self:GetChild("layout/btns_con/dropBtn").gameObject
  88. self.marketBuyBtn = self:GetChild("layout/btns_con/market_buy_btn").gameObject
  89. self.marketActionBtn = self:GetChild("layout/btns_con/market_auction_btn").gameObject
  90. self.capsuleEggTakeBtn = self:GetChild("layout/btns_con/capsuleEggTakeBtn").gameObject
  91. self.tmBatchUseBtn = self:GetChild("layout/btns_con/tm_batch_use").gameObject -- 藏宝图批量使用按钮
  92. self.attrCon_trf = self:GetChild("layout/base_con/attrCon")
  93. self.attrCon_obj = self:GetChild("layout/base_con/attrCon").gameObject
  94. self.normalDecomposeBtn = self:GetChild("layout/btns_con/normalDecomposeBtn").gameObject
  95. ---新加的
  96. local nodes = {
  97. "layout/market_con:obj",
  98. "layout/shop_con:obj",
  99. "layout/base_con/bg:img",
  100. "layout/get_way_con/get_way_bg:img",
  101. "layout/base_con/content_scrollview:obj",
  102. "layout/base_con/content_scrollview/Viewport/content_con",
  103. "layout/left_extra_con:obj",
  104. --外观类
  105. "layout/nice_con/nice_designation_con/nice_designation_text:tmp",
  106. "layout/nice_con/nice_roleCon:obj",
  107. "layout/nice_con/nice_childCon:obj",
  108. "layout/nice_con/nice_name_text:tmp",
  109. "layout/nice_con/nice_designation_con:obj",
  110. "layout/nice_con/nice_power_text:txt",
  111. "layout/nice_con:obj",
  112. "layout/nice_con/nice_designation_con/nice_designation_effect:obj",
  113. "layout/nice_con/nice_designation_con/nice_designation_image:img:obj",
  114. "layout/nice_con/nice_designation_con/nice_designation_raw:raw:obj",
  115. "layout/nice_con/nice_bg:raw:obj",
  116. "layout/nice_con/nice_headCon:obj",
  117. "layout/nice_con/nice_figureBubbleCon:obj:img",
  118. "layout/nice_con/nice_figureBubbleCon_desc:obj:tmp",
  119. "layout/nice_con/nice_figureHeadCon:obj:img",
  120. "layout/nice_con/wardrobe_text:tmp",
  121. --幻光模型
  122. "layout/base_con/daily_skill_con/daily_skill_bg:raw",
  123. "layout/base_con/daily_skill_con:obj",
  124. "layout/base_con/daily_skill_con/daily_skill_level:tmp",
  125. "layout/base_con/daily_skill_con/daily_skill_desc:tmp",
  126. "layout/base_con/daily_skill_con/daily_skill_name:tmp",
  127. "layout/base_con/daily_skill_con/daily_skill_icon:img",
  128. "layout/nice_con/daily_switch_btn:obj",
  129. }
  130. self:GetChildren(nodes)
  131. self.btns_list = {self.shiyongBtn, self.hechengBtn, self.chushouBtn,
  132. self.yulanBtn, self.storeBtn, self.takeBtn, self.splitBtn,
  133. self.shelvesUpBtn, self.shelvesDownBtn,
  134. self.oneKeyBuyBtn, self.decomposeBtn, self.replaceBtn,
  135. self.dropBtn,self.marketBuyBtn, self.marketActionBtn,
  136. self.capsuleEggTakeBtn, self.tmBatchUseBtn, self.normalDecomposeBtn}
  137. lua_resM:setOutsideImageSprite(self,self.bg_img,GameResPath.GetViewBigBg("goods_tool_tip_bg"),false)
  138. lua_resM:setOutsideImageSprite(self,self.get_way_bg_img,GameResPath.GetViewBigBg("goods_tool_tip_bg"),false)
  139. self.icon_item = AwardItem.New(self.icon_con, false, self.layer_name)
  140. self.icon_item:SetItemSize(62,62)
  141. self.icon_item:ChangeCountVisible(false)
  142. self:InitEvent()
  143. end
  144. function GoodsTooltips:InitEvent()
  145. local function onClickBtnHandler(target)
  146. if target == self.get_way_btn then
  147. self.show_get_way = not self.show_get_way
  148. self.getWayConObj:SetActive(self.show_get_way)
  149. self:ShowShopItem()
  150. return
  151. elseif (self.goods_vo and (self.is_show_btn or CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn() or self:ForeceTriggerEvt())) then
  152. if target == self.shiyongBtn then
  153. local callback = function(case)
  154. if case == GoodsController.TryToUseGoodsResult.Case1 or GoodsController.TryToUseGoodsResult.Case2 then
  155. self:Close()
  156. end
  157. end
  158. GoodsModel:getInstance():Fire(GoodsModel.TRY_TO_USE_GOODS, self.goods_vo, callback)
  159. elseif target == self.hechengBtn then
  160. self:JumpComposeFunc()
  161. elseif target == self.chushouBtn then
  162. GlobalEventSystem:Fire(EventName.OPEN_SEll_VIEW, self.goods_vo)
  163. elseif target == self.storeBtn then
  164. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT, 15003, self.goods_vo.goods_id, GoodsModel.GOODS_POS_TYPE.bag, GoodsModel.GOODS_POS_TYPE.warehouse)
  165. elseif target == self.takeBtn then
  166. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT, 15003, self.goods_vo.goods_id, GoodsModel.GOODS_POS_TYPE.warehouse, GoodsModel.GOODS_POS_TYPE.bag)
  167. elseif target == self.splitBtn then
  168. BagModel:getInstance():Fire(BagModel.OPEN_BATHANDLE_VIEW, self.goods_vo, SplitView.TYPE.SPLIT)
  169. elseif target == self.yulanBtn then
  170. if self.goods_vo.type == GoodsModel.TYPE.FASHION then --时装
  171. GlobalEventSystem:Fire(EventName.OPEN_FASHION_VIEW, self.goods_vo.subtype, self.goods_vo.type_id)
  172. elseif self.goods_vo.type == 32 or self.goods_vo.type == 34 then --礼包
  173. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT, 15087,self.goods_vo.type_id)
  174. end
  175. elseif target == self.shelvesUpBtn then
  176. if not GetModuleIsOpen(155) then
  177. Message.show(string.format("%d级开启市场", GetModuleOpenLevel(155)))
  178. else
  179. GlobalEventSystem:Fire(EventName.OPEN_MARKET_VIEW, MarketConst.TabId.SalesHall, nil, self.goods_vo)
  180. end
  181. elseif target == self.shelvesDownBtn then
  182. MarketModel:GetInstance():Fire(MarketModel.REQUEST_CCMD_EVENT,15508,self.goods_vo.id)
  183. elseif target == self.oneKeyBuyBtn then
  184. elseif target == self.decomposeBtn then
  185. BagModel:getInstance():Fire(BagModel.OPEN_EQUIP_DECOMPOSE_VIEW, self.goods_vo)
  186. elseif target == self.dropBtn then
  187. if self.goods_vo.goods_num == 1 then
  188. local function ok()
  189. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT,15051, 0 , {[1] ={ goods_id = self.goods_vo.goods_id, type_id = self.goods_vo.type_id, num = self.goods_vo.goods_num} })
  190. end
  191. Alert.show("是否丢弃 <color=" .. ColorUtil.RED_DARK .. ">" .. self.goods_vo.goods_name .. "</color> ?", Alert.Type.Two,ok)
  192. else
  193. BagModel:getInstance():Fire(BagModel.OPEN_BATHANDLE_VIEW, self.goods_vo, SplitView.TYPE.BAT_DROP)
  194. end
  195. elseif target == self.replaceBtn then
  196. if self.goods_vo then
  197. local has_vo, main, sub = HorseModel:getInstance():CheckVoIsOnMaterialTab(self.goods_vo)
  198. if has_vo then
  199. local typ = (self.parm_list and self.parm_list.material_type and self.parm_list.material_type ~= 0) and self.parm_list.material_type or main
  200. local pos = (self.parm_list and self.parm_list.material_pos and self.parm_list.material_pos ~= 0) and self.parm_list.material_pos or sub
  201. HorseModel:getInstance():Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, typ, true, pos)
  202. self:Close()
  203. return
  204. end
  205. end
  206. elseif target == self.market_buy_btn_obj then
  207. MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.ONE_PRICE_TYPE)
  208. elseif target == self.market_auction_btn_obj then
  209. MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.AUCTION_PRICE_TYPE)
  210. elseif target == self.guild_btn_obj then--上架到社团
  211. if self.up_market_range == 1 then
  212. Message.show("该商品只能上架到世界拍卖哦~")
  213. self.no_close = true
  214. else
  215. local data = self.goods_vo
  216. local is_to_world = self.market_toggle_tog.isOn and 1 or 0
  217. MarketModel:GetInstance():Fire(MarketModel.REQUEST_CCMD_EVENT,15506,data.goods_id,data.type_id, self.market_count,MarketModel.AUCTION_GUILD_TYPE, is_to_world)
  218. end
  219. elseif target == self.world_btn_obj then--上架到世界
  220. if self.up_market_range == 2 then
  221. Message.show("该商品只能上架到社团拍卖哦~")
  222. self.no_close = true
  223. else
  224. local data = self.goods_vo
  225. MarketModel:GetInstance():Fire(MarketModel.REQUEST_CCMD_EVENT,15506,data.goods_id,data.type_id, self.market_count,MarketModel.AUCTION_WORLD_TYPE, 1)
  226. end
  227. elseif target == self.marketBuyBtn then
  228. MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.ONE_PRICE_TYPE)
  229. elseif target == self.marketActionBtn then
  230. MarketModel:GetInstance():Fire(MarketModel.OPEN_MARKET_BUY_VIEW, self.goods_vo, MarketModel.AUCTION_PRICE_TYPE)
  231. elseif target == self.capsuleEggTakeBtn then --龙神宝库临时仓库取出按钮
  232. local now_warehouse_selected_goods_id = CapsuleEggModel:getInstance():GetWarehouseNowSelectedGoodsId()
  233. CapsuleEggModel:getInstance():Fire(CapsuleEggConst.REQUEST_CCMD_EVENT,17008,now_warehouse_selected_goods_id)
  234. CapsuleEggModel:getInstance():ResetWarehouseNowSelectedGoodsId()
  235. elseif target == self.tmBatchUseBtn then -- 藏宝图批量使用
  236. GlobalEventSystem:Fire(EventName.OPEN_TREASUREMAP_BATCH_USE_VIEW, true)
  237. elseif target == self.daily_switch_btn_obj then -- 幻光模型切换状态
  238. elseif target == self.normalDecomposeBtn then --批量分解按钮
  239. if self.goods_vo.goods_num == 1 then
  240. local function ok()
  241. local decompose_goods_list = {}
  242. decompose_goods_list[1] = {
  243. goods_id = self.goods_vo.goods_id,
  244. type_id = self.goods_vo.type_id,
  245. goods_num = 1,
  246. }
  247. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_CCMD_EVENT,15019,decompose_goods_list)
  248. end
  249. local goods_name = GoodsModel:getInstance():getGoodsName(self.goods_vo.type_id,true)
  250. Alert.show("是否分解 <color=" .. ColorUtil.RED_DARK .. ">" .. goods_name .. "</color> ?", Alert.Type.Two,ok)
  251. else
  252. BagModel:getInstance():Fire(BagModel.OPEN_BATHANDLE_VIEW, self.goods_vo, SplitView.TYPE.BAT_DECOMPOSE)
  253. end
  254. end
  255. if self.no_close then--不要点了就关
  256. self.no_close = false
  257. else
  258. self:Close()
  259. end
  260. end
  261. end
  262. AddClickEvent(self.shiyongBtn, onClickBtnHandler)
  263. AddClickEvent(self.hechengBtn, onClickBtnHandler)
  264. AddClickEvent(self.chushouBtn, onClickBtnHandler)
  265. AddClickEvent(self.storeBtn, onClickBtnHandler)
  266. AddClickEvent(self.takeBtn, onClickBtnHandler)
  267. AddClickEvent(self.splitBtn, onClickBtnHandler)
  268. AddClickEvent(self.yulanBtn, onClickBtnHandler)
  269. AddClickEvent(self.shelvesUpBtn, onClickBtnHandler)
  270. AddClickEvent(self.shelvesDownBtn, onClickBtnHandler)
  271. AddClickEvent(self.oneKeyBuyBtn, onClickBtnHandler)
  272. AddClickEvent(self.decomposeBtn, onClickBtnHandler)
  273. AddClickEvent(self.replaceBtn, onClickBtnHandler)
  274. AddClickEvent(self.dropBtn, onClickBtnHandler)
  275. -- AddClickEvent(self.world_btn_obj, onClickBtnHandler)
  276. -- AddClickEvent(self.guild_btn_obj, onClickBtnHandler)
  277. AddClickEvent(self.marketBuyBtn, onClickBtnHandler)
  278. AddClickEvent(self.marketActionBtn, onClickBtnHandler)
  279. AddClickEvent(self.capsuleEggTakeBtn,onClickBtnHandler)
  280. AddClickEvent(self.tmBatchUseBtn,onClickBtnHandler)
  281. AddClickEvent(self.get_way_btn,onClickBtnHandler)
  282. AddClickEvent(self.normalDecomposeBtn,onClickBtnHandler)
  283. AddClickEvent(self.daily_switch_btn_obj,onClickBtnHandler)
  284. local function update_func()
  285. self:SetData()
  286. end
  287. self.update_event = GlobalEventSystem:Bind(EventName.UPDATE_GOODS_TIPS, update_func)
  288. self.event_odc = GlobalEventSystem:Bind(EventName.ORIENTATION_DID_CHANGE, function ()
  289. self:AdjustLayoutPos()
  290. end)
  291. local function on_close( )
  292. self:Close()
  293. end
  294. self:BindEvent(self.shop_model,ShopModel.CLOSE_SHOP_BUY_VIEW, on_close)
  295. self:BindEvent(self.market_model,MarketModel.CLOSE_MARKET_UP_SHELVES_VIEW, on_close)
  296. local onUpdate = function (id)
  297. if id == KfActivityModel.TabID.LimitShop then
  298. if self.show_left_extra_view then
  299. self:UpdateLimitShop()
  300. end
  301. end
  302. end
  303. self:BindEvent(KfActivityModel:getInstance(), KfActivityModel.ANS_UPDATE_VIEW, onUpdate)
  304. end
  305. function GoodsTooltips:GetEnlargNum(num)
  306. local info = GoodsModel:getInstance().slot_info_pos_2
  307. local slot_num = info.slot_num or 0 --开放格子
  308. local def_num = info.def_cell or 0 --默认开放格子数
  309. local all_slot = info.all_slot or 0 --总共格子
  310. local left_num = all_slot - slot_num
  311. local isOpenedNum = slot_num - def_num + 1
  312. local isOpenNum = isOpenedNum
  313. local own_num = num
  314. while(own_num > 0) do
  315. own_num = own_num - self:GetEnlargeCost(isOpenNum)
  316. if own_num >= 0 then
  317. isOpenNum = isOpenNum + 1
  318. end
  319. if isOpenNum > left_num then
  320. break
  321. end
  322. end
  323. isOpenNum = isOpenNum - isOpenedNum
  324. return isOpenNum
  325. end
  326. function GoodsTooltips:GetEnlargeCost(open_index)
  327. local num = 0
  328. for k, v in pairs(Config.Expandbagcosts) do
  329. if GoodsModel.GOODS_POS_TYPE.bag == v.bag_type and v.min_cell <= open_index and v.max_cell >= open_index then
  330. local list = ErlangParser:GetInstance():Parse(v.cost_goods_list)
  331. if list then
  332. num = list[1][3]
  333. break
  334. end
  335. end
  336. end
  337. return num
  338. end
  339. --合成按钮跳转
  340. function GoodsTooltips:JumpComposeFunc()
  341. ComposeModel.Instance:TryComposeJump(self.goods_vo.type_id)
  342. end
  343. --goods_vo通过这个vo来判断是否是背包中存在的物品,
  344. -- parm_list 有什么其他参数 可以添加进这个table中 自己定义想要的字段
  345. --not_show_getway 获得途径的按钮以及内容是否显示
  346. --open_show_get_way 有些需求需要开界面就显示获得途径
  347. --force_open_show_get_way 强制必须打开获取途径界面
  348. function GoodsTooltips:Open(type_id, x, y, goods_vo, show_btn_list, parm_list, not_show_getway,open_show_get_way,force_open_show_get_way)
  349. print('---- GoodsTooltips.lua 659-- type_id=',type_id)
  350. self.type_id = type_id
  351. self.is_show_btn = goods_vo ~= nil
  352. self.show_btn_list = show_btn_list
  353. self.parm_list = parm_list
  354. self.not_show_getway = not_show_getway
  355. self.open_show_get_way = open_show_get_way
  356. self.force_open_show_get_way = force_open_show_get_way
  357. self.shop_data = parm_list and parm_list.shop_data or nil
  358. self.market_data = parm_list and parm_list.market_data or nil
  359. self.show_limit_shop = parm_list and parm_list.show_limit_shop or nil
  360. self.foster_recharge_show = parm_list and parm_list.foster_recharge_show or nil
  361. self.goods_vo = goods_vo or GoodsModel:getInstance():GetGoodsBasicByTypeId(type_id)
  362. self.pos_x = x
  363. self.pos_y = y
  364. BaseView.Open(self)
  365. end
  366. function GoodsTooltips:SetData()
  367. if self.goods_vo == nil then return end
  368. self.layout.gameObject:SetActive(true)
  369. if self.shop_data and self.shop_data.is_empower_shop then
  370. self.icon_item:ChangeCountVisible(true)
  371. self.icon_item:SetData(self.goods_vo.type_id, self.shop_data.num)
  372. else
  373. self.icon_item:ChangeCountVisible(false)
  374. self.icon_item:SetData(self.goods_vo.type_id)
  375. end
  376. --双属性宝石
  377. if self.goods_vo.type == 14 and (self.goods_vo.subtype == 9 or self.goods_vo.subtype == 10) then
  378. self.icon_item:SetDataDoubleStone(self.goods_vo.goods_id)
  379. end
  380. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.goods_vo.type_id)
  381. self.basic = basic
  382. local goods_name = self.basic.goods_name
  383. print(">>物品信息 name =", basic.goods_name, " goods_id=", self.goods_vo.goods_id, " type_id=", self.goods_vo.type_id, " type=", basic.type," subtype=", basic.subtype)
  384. if self.goods_vo.type == 11 then
  385. if self.goods_vo.subtype == 11 then --装备鉴定物碎片
  386. local type_id, name, icon = EquipModel:getInstance():GetIdentifyGoodsNameAndIcon(self.goods_vo.type_id, self.mainVo.career, self.goods_vo.color)
  387. goods_name = name
  388. end
  389. end
  390. self.is_facion_goods = self.model:IsShowFashionTypeGoodsTip(self.basic)
  391. self:UpdateFactionCon()
  392. if self.goods_vo.type == 51 then
  393. if ClientConfig.vip_gift_data then
  394. local table = StrToTable(ClientConfig.vip_gift_data)
  395. if table then
  396. for _,v in pairs(table) do
  397. if tonumber(v.goods_id) == self.goods_vo.type_id then
  398. goods_name = v.goods_name
  399. break
  400. end
  401. end
  402. end
  403. end
  404. end
  405. self.countText.text = "类型:" .. HtmlColorTxt( WordManager:GetGoodsTypeStr(self.basic.type, self.basic.subtype) , "#ffffff")
  406. self.levelText.text = "等级:".. (basic.level == 0 and "不限" or basic.level)
  407. self.nameText.text = Language.substitute("<color={0}>{1}</color>", WordManager.GetGoodsColor(self.goods_vo.color or basic.color), Trim(goods_name))
  408. self:UpdateLimitTime()
  409. self:UpdateConvertTime()--运营活动道具过期自动转化
  410. self.attrCon_obj:SetActive(false)
  411. self.getwayUrlText.text = basic.getway
  412. for i,v in ipairs(self.get_way_item_list) do
  413. v:SetVisible(false)
  414. end
  415. if self.show_limit_shop then
  416. self:UpdateLimitShop()
  417. end
  418. if self.market_data then
  419. self.market_con_obj:SetActive(true)
  420. -- self.btn_con_obj:SetActive(false)
  421. self:UpdateMarketView()
  422. else
  423. self.market_con_obj:SetActive(false)
  424. end
  425. if self.foster_recharge_show then
  426. self:UpdateFosterRechargeShow()
  427. end
  428. local function callback()
  429. --某些界面跳转时要关掉界面,比如改名界面
  430. GlobalEventSystem:Fire(EventName.OPEN_RENAME_VIEW,false,true) --强制关闭改名界面
  431. NewMainRoleModel:getInstance():Fire(NewMainRoleModel.OPEN_HATRED_VIEW,true) --强制关闭罪恶值界面
  432. FosterModel:GetInstance():Fire(FosterConst.CloseSkillTips) --强制关闭进阶技能培养界面
  433. GlobalEventSystem:Fire(EventName.CLICK_GET_WAY_ITEM)--加个通用的的
  434. self:Close()
  435. end
  436. -------------------------
  437. self.show_get_way = self.open_show_get_way and true or false
  438. self.getWayConObj:SetActive(self.show_get_way)
  439. if self.parm_list and self.parm_list.not_show_goods then
  440. self.base_con_obj:SetActive(false)
  441. self.getWayConObj:SetActive(true)
  442. end
  443. -------------------------
  444. -- basic.getway_url = [[ [{153,1},{153,3},{157,0}] ]]
  445. if self.open_show_get_way or (basic.getway_url and Trim(basic.getway_url) ~= "[]" and not self.not_show_getway or (self.parm_list and self.parm_list.get_way)) then
  446. self.get_way_btn:SetActive(true)
  447. local getway = {}
  448. if self.parm_list and self.parm_list.get_way then
  449. getway = self.parm_list.get_way
  450. else
  451. getway = ErlangParser:GetInstance():Parse( basic.getway_url)
  452. end
  453. for i,v in ipairs(getway) do
  454. local item = self.get_way_item_list[i]
  455. if not item then
  456. item = GetGoodsItem.New(self.getWayCon)
  457. self.get_way_item_list[i] = item
  458. item:SetPosition(0, -91 * (i - 1))
  459. end
  460. item:SetVisible(true)
  461. item:SetData(v, basic.type_id, callback)
  462. end
  463. SetSizeDeltaY(self.getWayCon, #getway * 100)
  464. if #getway == 0 then
  465. self.getWayConObj:SetActive(false)
  466. self.get_way_btn:SetActive(false)
  467. self.show_get_way = false
  468. --如果只有1个,并且显示为 [{}] 说明是显示 运营活动 就默认不展开了
  469. elseif #getway == 1 and Trim(basic.getway_url) == "[{}]" and not self.force_open_show_get_way then
  470. self.getWayConObj:SetActive(false)
  471. self.show_get_way = false
  472. end
  473. else
  474. self.get_way_btn:SetActive(false)
  475. self.getWayConObj:SetActive(false)
  476. end
  477. -------------------------
  478. if self.shop_data then
  479. self:ShowShopItem()--用到了self.show_get_way 参数,代码位置请不要随意移动
  480. self:UpdateShopView()
  481. else
  482. self.shop_con_obj:SetActive(false)
  483. end
  484. for i, v in pairs(self.btns_list) do
  485. v:SetActive(false)
  486. end
  487. local btns_list = {}
  488. if self.model:IsShowPreviewBtn(self.type_id) then
  489. table.insert(btns_list, self.yulanBtn)
  490. self.yulanBtn:SetActive(true)
  491. else
  492. self.yulanBtn:SetActive(false)
  493. end
  494. if self.is_show_btn then
  495. if self.basic and self.basic.drop == 1 then
  496. table.insert(btns_list, self.dropBtn)
  497. end
  498. if self.basic.jump > 0 then--and self.mainVo.level >= self.basic.level then
  499. table.insert(btns_list, self.jumpBtn)
  500. end
  501. if self.basic.compose > 0 then
  502. table.insert(btns_list, self.hechengBtn)
  503. end
  504. if self.goods_vo.goods_num > 1 then
  505. table.insert(btns_list, self.splitBtn)
  506. end
  507. if self.basic.sell > 0 then
  508. table.insert(btns_list, self.chushouBtn)
  509. end
  510. if MarketModel:GetInstance():IsGoodsCanUpShelves(self.goods_vo) then--在背包中的 如果可以上架要显示上架按钮
  511. table.insert(btns_list, self.shelvesUpBtn)
  512. end
  513. if (self.basic.use > 0 or Trim(self.basic.use_way) ~= "") and self.mainVo.level >= self.basic.level then
  514. local limit_state = BagModel:getInstance():GetGoodsLimitState(self.goods_vo)--过期了就不要有使用按钮了
  515. if limit_state ~= BagModel.GoodsLimitState.TimeOut then
  516. table.insert(btns_list, self.shiyongBtn)
  517. end
  518. end
  519. if self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.clothing_factory_bag then
  520. table.insert(btns_list, self.normalDecomposeBtn)
  521. end
  522. end
  523. local hide_yulan_btn = false
  524. if GoodsModel:getInstance().show_warehouse == true and self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.bag then
  525. hide_yulan_btn = true
  526. btns_list = {self.storeBtn}
  527. -- table.insert(btns_list,self.storeBtn)
  528. elseif self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.warehouse then
  529. hide_yulan_btn = true
  530. btns_list = {self.takeBtn}
  531. elseif self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.hunt_store then
  532. hide_yulan_btn = true
  533. btns_list = {self.takeBtn}
  534. -- elseif self.goods_vo.pos == GoodsModel.GOODS_POS_TYPE.clothing_factory_bag then
  535. -- hide_yulan_btn = true
  536. -- btns_list = {self.normalDecomposeBtn}
  537. end
  538. if hide_yulan_btn then
  539. self.yulanBtn:SetActive(false)
  540. end
  541. if CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn() then--龙神宝库扭蛋临时仓库显示取出按钮
  542. btns_list = {self.capsuleEggTakeBtn}
  543. end
  544. if self.goods_vo.type_id == TreasureMapConst.GoodId[1] then -- 普通藏宝图批量使用按钮
  545. if TreasureMapModel:getInstance():CanBatchUseNormalTreasureMap() then
  546. table.insert(btns_list, self.tmBatchUseBtn)
  547. end
  548. end
  549. --自定义显示的按钮
  550. local force_show_btn_con = false
  551. if self.show_btn_list then
  552. btns_list, force_show_btn_con = self:ShowCustomBtns()
  553. end
  554. local btns_len = #btns_list
  555. self.btns_con.gameObject:SetActive((btns_len>0 or force_show_btn_con) and not self.market_data and not self.shop_data)
  556. local local_index = 0
  557. local local_offset_h = 41
  558. for k, v in ipairs(btns_list) do
  559. local b = self.is_show_btn
  560. or CapsuleEggModel:getInstance():IsShowCapsuleEggTakeOutBtn()--龙神宝库仓库需要显示按钮
  561. v:SetActive(b)
  562. if b then
  563. print(v)
  564. SetAnchoredPosition(v.transform, 2, local_index * local_offset_h - 406)
  565. local_index = local_index + 1
  566. end
  567. end
  568. if not hide_yulan_btn then
  569. if self.goods_vo.type == 32 or self.goods_vo.type == 34 then
  570. self.yulanBtn:SetActive(true)
  571. end
  572. end
  573. self:SetTextData()
  574. self:AdjustLayoutPos()
  575. end
  576. function GoodsTooltips:AdjustLayoutPos()
  577. -- if self.pos_x and self.pos_y then
  578. --自定义显示的按钮
  579. -- local buy_pos_x, buy_pos_y = 0, 0
  580. -- if self.show_btn_list then
  581. -- -- btns_list = self:ShowCustomBtns()
  582. -- if TableContains(self.show_btn_list, "buyCon") then
  583. -- buy_pos_x = 100
  584. -- buy_pos_y = 100
  585. -- end
  586. -- end
  587. -- local layout_width = self.bg.sizeDelta.x + self.btns_con.sizeDelta.x
  588. -- local layout_height = self.bg.sizeDelta.y
  589. -- local x, y = ScreenToViewportPoint(self.pos_x, self.pos_y)
  590. -- local iphone_x_offset = math.max(ClientConfig.iphone_x_offset_left, ClientConfig.iphone_x_offset_right)
  591. -- if x + layout_width + 50 + iphone_x_offset * 2 > SrcScreenWidth then
  592. -- x = SrcScreenWidth - layout_width - 90 - iphone_x_offset * 2
  593. -- end
  594. -- if y < layout_height + 50 then
  595. -- y = layout_height + 50
  596. -- end
  597. -- self.layout.anchoredPosition = Vector2(x, y)
  598. -- end
  599. end
  600. function GoodsTooltips:ShowCustomBtns()
  601. local temp_list = {}
  602. local force_show_btn_con = false
  603. for _, v in pairs(self.btns_list) do
  604. v:SetActive(false)
  605. end
  606. for _, v in pairs(self.show_btn_list) do
  607. if self[v] then
  608. table.insert(temp_list, self[v])
  609. end
  610. end
  611. return temp_list,force_show_btn_con
  612. end
  613. function GoodsTooltips:ChangeBuyNum(num)
  614. self.buyNum = num
  615. end
  616. -- 一些特殊物品需要请求动态信息
  617. function GoodsTooltips:IsNeedDynamic()
  618. if not self.is_show_btn then return false end
  619. return self.type_id == 1011000006
  620. end
  621. function GoodsTooltips:ForeceTriggerEvt()
  622. if not self.goods_vo then
  623. return false
  624. end
  625. if self.goods_vo.type == 32 or self.goods_vo.type == 34 then
  626. return true
  627. end
  628. end
  629. -- 属性信息
  630. function GoodsTooltips:SetTextData()
  631. if not self.text_item_list[1] then
  632. self.text_item_list[1] = GoodsTooltipsTextItem.New(self.content_con)
  633. self.text_item_list[1]:SetColor("F3FCFF" )
  634. end
  635. if not self.text_item_list[2] then
  636. self.text_item_list[2] = GoodsTooltipsTextItem.New(self.content_con)
  637. self.text_item_list[2]:SetColor("9EB3CF")
  638. end
  639. local is_paid_gift = self.model:IsPaidGift(self.type_id)
  640. local goods_list = nil
  641. local intro = ChuanWenManager:getInstance():FormatColorTag(Trim(self.basic.intro))
  642. local attr_intor = ChuanWenManager:getInstance():FormatColorTag(Trim(self.basic.attr_intor))
  643. local str = intro
  644. if is_paid_gift then
  645. local reward_list = GiftModel:getInstance():getRewardConfig(self.type_id)
  646. goods_list = reward_list.fixed_list
  647. for i,v in ipairs(goods_list) do
  648. local goods_name = GoodsModel:getInstance():getGoodsName(v.goods_id, true)
  649. str = str.."\n"..goods_name.." x"..v.goods_count
  650. end
  651. end
  652. self.text_item_list[1]:SetData("基础信息", str, goods_list, is_paid_gift)
  653. self.text_item_list[2]:SetData("物品说明", attr_intor,nil, is_paid_gift)
  654. end
  655. function GoodsTooltips:UpdateMarketView( )
  656. if not self.market_view then
  657. self.market_view = MarketUpShelvesView.New(self.market_con)
  658. end
  659. self.market_view:SetData(self.market_data)
  660. self.market_view:SetPosition(2,-69)
  661. end
  662. function GoodsTooltips:UpdateShopView( )
  663. if not self.shop_view then
  664. self.shop_view = ShopBuySubView.New(self.shop_con,nil,self.layer_name)
  665. end
  666. self.shop_view:SetData(self.shop_data)
  667. self.shop_view:SetPosition(2,-69)
  668. end
  669. function GoodsTooltips:Remove()
  670. if self.icon_item then
  671. self.icon_item:DeleteMe()
  672. self.icon_item = nil
  673. end
  674. if self.addNumComponent then
  675. if self.change_count_id then
  676. self.addNumComponent:UnBind(self.change_count_id)
  677. self.change_count_id = nil
  678. end
  679. self.addNumComponent:DeleteMe()
  680. self.addNumComponent = nil
  681. end
  682. for i, v in pairs(self.get_way_item_list) do
  683. v:DeleteMe()
  684. v = nil
  685. end
  686. self.get_way_item_list = {}
  687. if self.update_event then
  688. GlobalEventSystem:UnBind(self.update_event)
  689. self.update_event = nil
  690. end
  691. if self.event_odc then
  692. GlobalEventSystem:UnBind(self.event_odc)
  693. self.event_odc = nil
  694. end
  695. if #self.attr_item_list > 0 then
  696. for k, v in pairs(self.attr_item_list) do
  697. v:DeleteMe()
  698. v = nil
  699. end
  700. self.attr_item_list = {}
  701. end
  702. if #self.text_item_list > 0 then
  703. for k, v in pairs(self.text_item_list) do
  704. v:DeleteMe()
  705. v = nil
  706. end
  707. self.text_item_list = {}
  708. end
  709. if self.change_jin_id then
  710. self.mainVo:UnBind(self.change_jin_id)
  711. self.change_jin_id = nil
  712. end
  713. if self.change_lockJin_id then
  714. self.mainVo:UnBind(self.change_lockJin_id)
  715. self.change_lockJin_id = nil
  716. end
  717. if self.change_silver_id then
  718. self.mainVo:UnBind(self.change_silver_id)
  719. self.change_silver_id = nil
  720. end
  721. if self.score_change_event_id then
  722. GoodsModel:getInstance():UnBind(self.score_change_event_id)
  723. self.score_change_event_id = nil
  724. end
  725. if self.market_view then
  726. self.market_view:DeleteMe()
  727. self.market_view = nil
  728. end
  729. if self.shop_view then
  730. self.shop_view:DeleteMe()
  731. self.shop_view = nil
  732. end
  733. lua_resM:clearRoleMode(self)
  734. self:StopLimitTimer()
  735. if self.sound_id then
  736. lua_soundM:StopEffect(self, LuaSoundManager.SOUND_TYPE.GUIDE, self.sound_id)
  737. self.sound_id = nil
  738. end
  739. end
  740. function GoodsTooltips:UpdateLimitTime()
  741. self:StopLimitTimer()
  742. self.getwayUrlText_obj:SetActive(true)
  743. if (not self.goods_vo.expire_time or self.goods_vo.expire_time == 0) and (not self.parm_list or not self.parm_list.expire_time) and (not self.parm_list or not self.parm_list.force_show_limit) then
  744. self.overdueText.text = ""
  745. self.overdue:SetActive(false)
  746. self.icon_item:ShowLimitIcon(false)
  747. self.overdue_bg_obj:SetActive(false)
  748. self.getwayUrlText_obj:SetActive(true)
  749. else
  750. --强制显示限时状态
  751. if self.parm_list and self.parm_list.force_show_limit then
  752. self.icon_item:ShowLimitIcon(true,1)
  753. self.overdue_bg_obj:SetActive(true)
  754. self.getwayUrlText_obj:SetActive(false)
  755. lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_1", true)
  756. self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">物品会在一段时间后过期</color>")
  757. return
  758. end
  759. --没有获得的道具,特殊处理
  760. if (self.goods_vo.goods_id == 0 or self.goods_vo.goods_id == nil) and not (self.parm_list and self.parm_list.expire_time) then
  761. self.icon_item:ShowLimitIcon(true,1)
  762. self.overdue_bg_obj:SetActive(true)
  763. self.getwayUrlText_obj:SetActive(false)
  764. if self.basic.expire_type == 1 or self.basic.expire_type == 5 then
  765. local time = self.basic.expire_time
  766. lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_1", true)
  767. self:SetLimitText("<color=" .. ColorUtil.GREEN_DARK .. ">领取后 ".. TimeUtil:timeConvert15(time) .. " 后过期</color>")
  768. else
  769. local time = 0
  770. --开服多少天后过期
  771. if self.basic.expire_type == 3 then
  772. time = ServerTimeModel:getInstance():GetOpenServerTime() + 3600 *24 * self.basic.expire_time
  773. --合服多少天数后过期
  774. elseif self.basic.expire_type == 4 then
  775. time = ServerTimeModel:getInstance():GetMergeServerTime() + 3600 *24 * self.basic.expire_time
  776. --特定时间到期
  777. -- self.basic.expire_type == 2
  778. else
  779. time = self.basic.expire_time
  780. end
  781. lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_2", true)
  782. if time == 0 then
  783. self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">已过期</color>")
  784. else
  785. self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">"..TimeUtil:timeConversion(time, "yyyy年mm月dd日 hh") .. " 过期</color>")
  786. end
  787. end
  788. return
  789. end
  790. local expire_time = (self.parm_list and self.parm_list.expire_time) or (self.goods_vo and self.goods_vo.expire_time)
  791. if expire_time then
  792. local function timer_func()
  793. self.overdue_bg_obj:SetActive(true)
  794. self.getwayUrlText_obj:SetActive(false)
  795. SetAnchoredPositionX( self.overdue_bg.transform, -28)
  796. if self.basic.expire_type == 1 or self.basic.expire_type == 5 or (self.parm_list and self.parm_list.expire_type == "expire_type") then
  797. local time = expire_time - TimeUtil:getServerTime()
  798. if time <= 0 then
  799. self.icon_item:ShowLimitIcon(true,2)
  800. self.overdue_bg_obj:SetActive(false)
  801. self.getwayUrlText_obj:SetActive(true)
  802. self.overdueText.text = ""
  803. self:StopLimitTimer()
  804. GlobalEventSystem:Fire(EventName.UPDATE_BAG_TIMEOUT_GOODS, self.goods_vo.goods_id)
  805. else
  806. self.icon_item:ShowLimitIcon(true,1)
  807. SetSizeDeltaY(self.content_scrollview, 254)
  808. lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_1", true)
  809. if self.basic.expire_type == 1 then
  810. self:SetLimitText("<color=" .. ColorUtil.GREEN_DARK .. ">".. TimeUtil:timeConvert15(time) .. " 后过期</color>")
  811. else
  812. self:SetLimitText("<color=" .. ColorUtil.GREEN_DARK .. ">".. TimeUtil:timeConvert15(time) .. " 过期</color>")
  813. end
  814. end
  815. else
  816. if TimeUtil:getServerTime() > expire_time then
  817. self.icon_item:ShowLimitIcon(true,2)
  818. self.overdue_bg_obj:SetActive(false)
  819. self.getwayUrlText_obj:SetActive(true)
  820. self.overdueText.text = ""
  821. self:StopLimitTimer()
  822. GlobalEventSystem:Fire(EventName.UPDATE_BAG_TIMEOUT_GOODS, self.goods_vo.goods_id)
  823. else
  824. lua_resM:setImageSprite(self, self.overdue_bg, "uiComponent_asset", "ui_com_time_2", true)
  825. self.icon_item:ShowLimitIcon(true,1)
  826. SetSizeDeltaY(self.content_scrollview, 254)
  827. self:SetLimitText("<color=" .. ColorUtil.GOLD_DARK .. ">"..TimeUtil:timeConversion(expire_time, "yyyy年mm月dd日 hh") .. " 过期</color>")
  828. end
  829. end
  830. end
  831. if not self.limit_timer then
  832. self.limit_timer = GlobalTimerQuest:AddPeriodQuest(timer_func, 1)
  833. end
  834. timer_func()
  835. else
  836. self.icon_item:ShowLimitIcon(false)
  837. self.overdue:SetActive(false)
  838. self.overdue_bg_obj:SetActive(false)
  839. self.getwayUrlText_obj:SetActive(true)
  840. self.overdueText.text = ""
  841. end
  842. end
  843. end
  844. --运营活动道具过期自动转化时间戳
  845. function GoodsTooltips:UpdateConvertTime( )
  846. if self.goods_vo.convert_time and self.goods_vo.convert_time ~= 0 then--没有转化时间
  847. self.conversionTimeText.text = string.format("该物品将在以下期限后自动转化\n<size=16><%s>%s</color></size>",ColorUtil.GREEN_TIPS,TimeUtil:timeConversion(self.goods_vo.convert_time, "yyyy年mm月dd日 hh-MM"))
  848. else
  849. self.conversionTimeText.text = ""
  850. end
  851. end
  852. function GoodsTooltips:StopLimitTimer()
  853. if self.limit_timer then
  854. GlobalTimerQuest:CancelQuest(self.limit_timer)
  855. self.limit_timer = nil
  856. end
  857. end
  858. function GoodsTooltips:SetLimitText(text)
  859. self.overdueText.text = text
  860. local width = self.overdueText.preferredWidth
  861. SetAnchoredPositionX(self.overdue_bg.transform, -width/2 - 20)
  862. end
  863. --更新外观显示类部分
  864. function GoodsTooltips:UpdateFactionCon()
  865. self.power_show_num = false
  866. local show_model_cfg = self.model:IsShowModelGoods(self.type_id)
  867. if self.is_facion_goods or show_model_cfg then
  868. self.attr_list = {}
  869. self.nice_bg_obj:SetActive(true)
  870. self.nice_con_obj:SetActive(true)
  871. local basic = self.basic
  872. self.nice_designation_con_obj:SetActive(false)
  873. self.nice_roleCon_obj:SetActive(false)
  874. self.nice_childCon_obj:SetActive(false)
  875. self.nice_headCon_obj:SetActive(false)
  876. self.nice_figureBubbleCon_obj:SetActive(false)
  877. self.nice_figureBubbleCon_desc_obj:SetActive(false)
  878. self.nice_figureHeadCon_obj:SetActive(false)
  879. self.nice_designation_raw_obj:SetActive(false)
  880. self.daily_skill_con_obj:SetActive(false)
  881. self.daily_switch_btn_obj:SetActive(false)
  882. lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("goods_tool_tip_fashion_bg"))
  883. local show_type = show_model_cfg and show_model_cfg.show_type or basic.type
  884. print('Cat:GoodsTooltips.lua[873] basic.type', show_type)
  885. local wardrobe_value = WardrobeModel:getInstance():GetWardrobeAppearanceValue(show_type, basic.subtype, basic.color)
  886. if not wardrobe_value or wardrobe_value == 0 then
  887. self.wardrobe_text_tmp.text = ""
  888. else
  889. self.wardrobe_text_tmp.text = string.format("风采值:%s", HtmlColorTxt(wardrobe_value, "#fafaf6"))
  890. end
  891. if self.dynamic_image_obj then
  892. self.dynamic_image_obj:SetActive(false)
  893. end
  894. if show_type == GoodsModel.TYPE.DESIGNATION then
  895. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  896. local cfg = Config.Dsgt
  897. local designation_id = DesignationModel:GetInstance():GetDesignationIdByGoodsId(self.type_id)
  898. self.attr_list = stringtotable(cfg[designation_id].attr_list)
  899. self.nice_designation_image_obj:SetActive(false)
  900. self.nice_designation_effect_obj:SetActive(false)
  901. self.nice_name_text_tmp.text = ""
  902. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.nice_designation_image)
  903. if cfg[designation_id].type == 1 then--文字称号(文字称号也用图片了)
  904. self.nice_designation_image_obj:SetActive(true)
  905. local function callback( )
  906. SetLocalScale(self.nice_designation_image, 1.5, 1.5, 1.5)
  907. end
  908. lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetDesignImage(cfg[designation_id].id), true,callback)
  909. self.nice_designation_text_tmp.text = ""
  910. elseif cfg[designation_id].type == 2 then--图片称号
  911. self.nice_designation_image_obj:SetActive(true)
  912. local function callback( )
  913. SetLocalScale(self.nice_designation_image, 1.5, 1.5, 1.5)
  914. end
  915. lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetDesignImage(cfg[designation_id].id), true,callback)
  916. self.nice_designation_text_tmp.text = ""
  917. elseif cfg[designation_id].type == 3 then--特效称号
  918. if not self.dynamic_image_obj then
  919. self.dynamic_image_obj = UiFactory.createChild(self.nice_designation_image, UIType.Image, "dynamic_image")
  920. self.dynamic_image_img = self.dynamic_image_obj:GetComponent("Image")
  921. self.dynamic_image = self.dynamic_image_obj.transform
  922. SetAnchoredPosition(self.dynamic_image,0,0)
  923. else
  924. self.dynamic_image_obj:SetActive(true)
  925. end
  926. self.nice_designation_image_obj:SetActive(true)
  927. local data = DesignationModel:GetInstance():GetDynamicDesignationCFG(designation_id)
  928. local res = Split(data[1].res,"_")--分割出来配置 然后取文字
  929. local font_res = res[1] or ""
  930. lua_resM:setImageSprite(self, self.dynamic_image_img, data[1].ab, font_res.."_font", true)
  931. self.nice_designation_text_tmp.text = ""
  932. self.nice_designation_image_obj:SetActive(true)
  933. local action = cc.Animation.New(data,0.15)
  934. cc.ActionManager:getInstance():addAction(cc.RepeatForever.New(action),self.nice_designation_image.transform)
  935. end
  936. self.nice_designation_con_obj:SetActive(true)
  937. elseif show_type == GoodsModel.TYPE.CHILDTOY then
  938. local child_type = ChildConst.GOODS_TPYE
  939. if basic.subtype == child_type.TOY then -- 玩具 显示原画
  940. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,
  941. -- GameResPath.GetViewBigBg("designation_tip_bg"))
  942. self.nice_designation_con_obj:SetActive(true)
  943. self.nice_designation_image_obj:SetActive(true)
  944. local cfg = Config.Childtoynew[basic.type_id]
  945. if cfg then
  946. self.attr_list = stringtotable(cfg.attr_list)
  947. end
  948. lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetChildHandbookIcon(basic.type_id), true)
  949. elseif basic.subtype == child_type.DRESS then -- 时装 显示模型
  950. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("fashion_tip_bg"))
  951. self.nice_childCon_obj:SetActive(true)
  952. local chat_model = ChildModel:getInstance()
  953. local fashion_id = chat_model:GetFashionIdByGoodsId(self.type_id)
  954. local show_figure_id = chat_model:GetFashionModelID(fashion_id)
  955. local res_data = {
  956. father_node = self,
  957. transform = self.nice_childCon,
  958. fashion_type = FuncOpenModel.TypeId.Child,
  959. figure_id = show_figure_id,
  960. ui_model_type = UIModelCommon.ModelType.Model,
  961. action_name_list = action_name_list,
  962. position = Vector3(0, -15, 0),
  963. }
  964. FuncOpenModel:getInstance():SetModelRes(res_data)
  965. -- 显示1级的战力
  966. local cfg = Config.Childfashion[fashion_id .. "@1"]
  967. if cfg then
  968. self.attr_list = stringtotable(cfg.attr_list)
  969. end
  970. elseif basic.subtype == child_type.VEHICLE then -- 载具 显示模型
  971. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("fashion_tip_bg"))
  972. self.nice_childCon_obj:SetActive(true)
  973. local child_model = ChildModel:getInstance()
  974. local vehicle_id = child_model:GetVehicleIdByGoodsId(self.type_id)
  975. local can_on_age = Config.Childvehicle[vehicle_id .. "@" .. 1].can_on_age
  976. local cur_state = child_model:GetChildCurState()
  977. local clothe_res_id = false
  978. if can_on_age == ChildConst.BABY_STATE.YOUNG then
  979. if cur_state < ChildConst.BABY_STATE.YOUNG then -- 还没会走路
  980. clothe_res_id = child_model:GetBaseChildModelID( ChildConst.BABY_STATE.YOUNG,
  981. child_model.childInfo.child_sex )
  982. else -- 会走路就拿当前形象
  983. clothe_res_id = child_model:GetChildCloth()
  984. end
  985. else -- 是爬或襁褓 则用默认形象
  986. clothe_res_id = child_model:GetBaseChildModelID( can_on_age,
  987. child_model.childInfo.child_sex or 1 )
  988. end
  989. local figure_id = child_model:GetVehicleModelID(vehicle_id)
  990. local res_data = {
  991. father_node = self,
  992. transform = self.nice_childCon,
  993. fashion_type = FuncOpenModel.TypeId.ChildInVehicle,
  994. figure_id = figure_id,
  995. ui_model_type = UIModelCommon.ModelType.Model,
  996. action_name_list = {"idle"},
  997. clothe_res_id = clothe_res_id,
  998. position = {0,0,0}
  999. }
  1000. FuncOpenModel:getInstance():SetModelRes(res_data)
  1001. -- 显示1级的战力
  1002. local cfg = Config.Childvehicle[vehicle_id .. "@1"]
  1003. if cfg then
  1004. self.attr_list = stringtotable(cfg.add_attr)
  1005. end
  1006. end
  1007. elseif show_type == GoodsModel.TYPE.FASHION or (show_type == GoodsModel.TYPE.FASHIONCHIP and basic.subtype == 1) then
  1008. --类型是FASHIONCHIP的话 需要额外判断子类型为1的才是时装 其他碎片不要配成子类型1
  1009. local fashion_id,color_id = FashionModel:getInstance():GetFashionIdByGoodsId(self.type_id)
  1010. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("fashion_tip_bg"))
  1011. local is_limit = FashionModel:GetInstance():IsFashionLimitTime(fashion_id,color_id)
  1012. self.nice_roleCon_obj:SetActive(true)
  1013. local cur_cfg = Config.Fashionstarup[fashion_id.."@"..color_id.."@0"]
  1014. if cur_cfg then
  1015. self.attr_list = stringtotable(cur_cfg.attr_list)
  1016. end
  1017. local career = RoleManager.Instance.mainRoleInfo.career
  1018. local fashion_type = FuncOpenModel.TypeId.Clothes
  1019. local figure_id = nil
  1020. if fashion_id then
  1021. if cur_cfg.pos_id == FashionModel.FashionType.HAT then--头饰
  1022. career = 0 --目前头饰 是通用的
  1023. figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
  1024. fashion_type = FuncOpenModel.TypeId.Hat
  1025. elseif cur_cfg.pos_id == FashionModel.FashionType.CLOTHES then--服饰
  1026. figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
  1027. if figure_id < 1000 then
  1028. figure_id = figure_id + career * 1000
  1029. end
  1030. if color_id > 1 then
  1031. figure_id = figure_id .. color_id
  1032. end
  1033. elseif cur_cfg.pos_id == FashionModel.FashionType.WING then--背饰
  1034. figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
  1035. fashion_type = FuncOpenModel.TypeId.wing
  1036. elseif cur_cfg.pos_id == FashionModel.FashionType.WEAPON then--武器
  1037. fashion_type = FuncOpenModel.TypeId.Weapon
  1038. figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
  1039. if figure_id < 1000 then
  1040. figure_id = figure_id + career * 1000
  1041. end
  1042. elseif cur_cfg.pos_id == FashionModel.FashionType.HEAD then--头发
  1043. fashion_type = FuncOpenModel.TypeId.Head
  1044. figure_id = FashionModel:GetInstance():GetFashionModelId(fashion_id, career, color_id)
  1045. if figure_id < 1000 then
  1046. figure_id = figure_id + career * 1000
  1047. end
  1048. if color_id > 1 then
  1049. figure_id = figure_id .. color_id
  1050. end
  1051. end
  1052. end
  1053. local res_data = {
  1054. father_node = self,
  1055. transform = self.nice_roleCon,
  1056. fashion_type = fashion_type,
  1057. layer_name = self.layer_name,
  1058. size = Vector2(720,720),
  1059. scale = 150,
  1060. figure_id = figure_id,
  1061. ui_model_type = UIModelCommon.ModelType.Model,
  1062. position = Vector3(0,0,0)
  1063. }
  1064. FuncOpenModel:getInstance():SetModelRes(res_data)
  1065. elseif show_type == GoodsModel.TYPE.ROLEHEAD then
  1066. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1067. self.nice_headCon_obj:SetActive(true)
  1068. self.head_item = self.head_item or self:CreateItem(HeadRoleItem, self.nice_headCon, self.layer_name)
  1069. self.head_item:SetCareerIconVisible(false)
  1070. self.head_item:SetItemSize(165,165)
  1071. local head_data = {
  1072. vo = {id=0,level=nil,sex=nil,turn=nil,do_not_click = true,use_bg = 3,
  1073. board = nil,picture_ver = nil,picture = nil,
  1074. profile_photo_id = self.type_id},
  1075. }
  1076. self.head_item:SetData(head_data)
  1077. -------------------------
  1078. local conf_head = NewMainRoleModel:getInstance():GetRoleHeadInfoByPhotoId(self.type_id)
  1079. if conf_head and conf_head.attr_list then
  1080. self.attr_list = stringtotable(conf_head.attr_list)
  1081. end
  1082. elseif show_type == GoodsModel.TYPE.CHATBUBBLE then -- 气泡
  1083. self.nice_figureBubbleCon_obj:SetActive(true)
  1084. self.nice_figureBubbleCon_desc_obj:SetActive(true)
  1085. Obj_img = self.nice_figureBubbleCon_img
  1086. for k,v in pairs(ChatDressModel:getInstance():GetChatDressFigure(ChatDressSubType.BUBBLE)) do
  1087. if v.dress_id == self.type_id then
  1088. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1089. -- self.nice_figureBubbleCon_desc_tmp.text = HtmlColorTxt(v.dress_desc, ColorUtil.BLUE_DARK)
  1090. -- self.nice_figureBubbleCon.sizeDelta = Vector2(self.nice_figureBubbleCon_desc_tmp.preferredWidth + 50, self.nice_figureBubbleCon_desc_tmp.preferredHeight + 30)
  1091. -- ---不同框的偏移
  1092. -- local addTable = Config.ConfigChatDress.Pos[tostring(self.type_id)]
  1093. -- SetSizeDeltaX(self.nice_figureBubbleCon, GetSizeDeltaX(self.nice_figureBubbleCon) + addTable.size_x )
  1094. -- SetSizeDeltaY(self.nice_figureBubbleCon, GetSizeDeltaY(self.nice_figureBubbleCon) + addTable.size_y )
  1095. self.nice_figureBubbleCon_desc_tmp.text = ""
  1096. SetSizeDelta(self.nice_figureBubbleCon, 200, 50)
  1097. lua_resM:setOutsideImageSprite(self, Obj_img, GameResPath.GetChatDressIcon(self.type_id), false)
  1098. self.attr_list = stringtotable(v.dress_attr)
  1099. break
  1100. end
  1101. end
  1102. elseif show_type == GoodsModel.TYPE.ROLEWINDOW then -- 头像框
  1103. self.nice_figureHeadCon_obj:SetActive(true)
  1104. --lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1105. -- 拿属性
  1106. for k,v in pairs(ChatDressModel:getInstance():GetChatDressFigure(ChatDressSubType.HEAD)) do
  1107. if v.dress_id == self.type_id then
  1108. self.attr_list = stringtotable(v.dress_attr)
  1109. break
  1110. end
  1111. end
  1112. lua_resM:setOutsideImageSprite(self, self.nice_figureHeadCon_img, GameResPath.GetChatDressIcon(self.type_id), false)
  1113. elseif show_type == GoodsModel.TYPE.GALAXY then -- 星辰
  1114. -- lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1115. self.nice_designation_con_obj:SetActive(true)
  1116. local model_id = GalaxyModel:getInstance():GetGalaxySkinModelId(self.basic.type_id)
  1117. if model_id then
  1118. local data = {
  1119. clothe_res_id = model_id,
  1120. type = SceneBaseType.Galaxy,
  1121. layer_name = self.layer_name,
  1122. on_name_list = {"show"},
  1123. scale = 500,
  1124. position = Vector3(0,-50,-100),
  1125. }
  1126. lua_resM:SetRoleModel(self,self.nice_designation_raw,data)
  1127. self.nice_designation_raw_obj:SetActive(true)
  1128. else
  1129. self.nice_designation_raw_obj:SetActive(false)
  1130. end
  1131. elseif show_type == GoodsModel.TYPE.DailyLight then
  1132. --幻光
  1133. --lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1134. self.daily_skill_con_obj:SetActive(true)
  1135. local show_conf = false
  1136. if show_model_cfg then
  1137. show_conf = {type = show_model_cfg.model_type, model = show_model_cfg.model_id, power = show_model_cfg.power}
  1138. end
  1139. local scale = 2
  1140. local possition = Vector3(0, 0,0)
  1141. local res_data = {
  1142. father_node = self,
  1143. transform = self.nice_roleCon,
  1144. fashion_type = show_conf.type,
  1145. layer_name = self.layer_name,
  1146. size = Vector2(720,720),
  1147. scale = scale,
  1148. figure_id = show_conf.model,
  1149. ui_model_type = UIModelCommon.ModelType.Model,
  1150. position = possition,
  1151. }
  1152. local pos_x, pos_y, pos_z = GetLocalPosition(self.nice_roleCon)
  1153. SetLocalPosition(self.nice_roleCon, pos_x, pos_y,pos_z - 300)
  1154. self.nice_roleCon_obj:SetActive(true)
  1155. FuncOpenModel:getInstance():SetModelRes(res_data)
  1156. self.power_show_num = show_conf.power
  1157. self.wardrobe_text_tmp.text = ""
  1158. local daily_skill_cfg = Config.Visus[show_model_cfg.dialy_skill_id]
  1159. if not daily_skill_cfg then
  1160. print('Ych:GoodsTooltips.lua[1227] error can not find daily skill item ', show_model_cfg.dialy_skill_id)
  1161. return
  1162. end
  1163. local skill_table = stringtotable(daily_skill_cfg.skill)
  1164. local daily_skill_vo = SkillVo.New(tonumber(skill_table[1]) )
  1165. daily_skill_vo.level = tonumber(skill_table[2])
  1166. local name_color = ColorUtil.BLUE_DARK
  1167. if daily_skill_vo.level == 2 then
  1168. name_color = ColorUtil.PURPLE_DARK
  1169. elseif daily_skill_vo.level == 3 then
  1170. name_color = ColorUtil.ORANGE_DARK
  1171. end
  1172. self.daily_skill_name_tmp.text = HtmlColorTxt(daily_skill_vo:getName(), name_color)
  1173. if show_model_cfg.up_level_tips == 1 then
  1174. self.daily_skill_level_tmp.text = "等级:" .. HtmlColorTxt(tostring(daily_skill_vo.level), "#fdffc2" ) .. HtmlColorTxt("(激活高阶圣光可升级)", "#cb8336")
  1175. else
  1176. self.daily_skill_level_tmp.text = "等级:" .. HtmlColorTxt(tostring(daily_skill_vo.level), "#fdffc2" ) .. HtmlColorTxt("(已升至最高级)", ColorUtil.RED_DARK)
  1177. end
  1178. self.daily_skill_desc_tmp.text = daily_skill_vo:GetDesc()
  1179. lua_resM:setOutsideRawImage(self,self.daily_skill_bg_raw,GameResPath.GetViewBigBg("goods_tool_tip_daily_skill_bg"))
  1180. lua_resM:setOutsideImageSprite(self,self.daily_skill_icon_img,GameResPath.GetSkillIcon(daily_skill_vo.id), false)
  1181. elseif show_type == GoodsModel.TYPE.FosterSkin or show_type == GoodsModel.TYPE.Foster then
  1182. --珍宝
  1183. --lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1184. local show_conf = false
  1185. if show_model_cfg then
  1186. show_conf = {type = show_model_cfg.model_type, model_size = Vector2(720, 720),
  1187. model = show_model_cfg.model_id, career = show_model_cfg.career,power = show_model_cfg.power}
  1188. SetLocalScale(self.nice_roleCon.transform, 0.6,0.6,0.6)
  1189. local node1 = self.nice_roleCon
  1190. local change_x,change_y = 0,30
  1191. local x,y = GetAnchoredPosition( node1.transform )
  1192. SetAnchoredPosition( node1.transform, x+change_x, y+change_y )
  1193. elseif basic.subtype == 6 then --AI娘皮肤
  1194. local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FJarvis, basic.type_id)
  1195. if not conf then return end
  1196. show_conf = {type = FuncOpenModel.TypeId.FJarvis - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
  1197. position = Vector3(0, -35, -700),
  1198. scale = 200,
  1199. power = GetFighting(stringtotable(conf.attr_list, true))}
  1200. elseif basic.subtype == 7 then --磁炮皮肤
  1201. local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FGun, basic.type_id)
  1202. show_conf = {type = FuncOpenModel.TypeId.FGun - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
  1203. position = Vector3(0, 0,-700),
  1204. power = GetFighting(stringtotable(conf.attr_list, true))}
  1205. elseif basic.subtype == 8 then --星翼皮肤
  1206. local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FCloud, basic.type_id)
  1207. show_conf = {type = FuncOpenModel.TypeId.FCloud - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
  1208. position = Vector3(0, 0, -700),
  1209. power = GetFighting(stringtotable(conf.attr_list, true))}
  1210. elseif basic.subtype == 9 then --幻甲皮肤
  1211. local conf = FosterModel:GetFosterSubSkinConfByMat(FosterConst.ModuleId.FArmour, basic.type_id)
  1212. show_conf = {type = FuncOpenModel.TypeId.FArmour - 1000, model = conf.skin_id, model_size = Vector2(720, 720),
  1213. position = Vector3(-15, 0, -700),
  1214. power = GetFighting(stringtotable(conf.attr_list, true))}
  1215. else
  1216. show_conf = ShapeModel:GetInstance():GetConfByGoodsId( self.basic.type_id )
  1217. show_conf.model_size = Vector2(720,720)
  1218. SetLocalScale(self.nice_roleCon.transform, 0.6,0.6,0.6)
  1219. local node1 = self.nice_roleCon
  1220. local change_x,change_y = 0,30
  1221. local x,y = GetAnchoredPosition( node1.transform )
  1222. SetAnchoredPosition( node1.transform, x+change_x, y+change_y )
  1223. end
  1224. self.nice_roleCon_obj:SetActive(true)
  1225. local res_data = {
  1226. father_node = self,
  1227. transform = self.nice_roleCon,
  1228. fashion_type = show_conf.type + 1000,
  1229. layer_name = self.layer_name,
  1230. size = show_conf.model_size,
  1231. position = show_conf.position,
  1232. figure_id = show_conf.model,
  1233. scale = show_conf.scale,
  1234. ui_model_type = UIModelCommon.ModelType.Model,
  1235. career = show_conf.career,
  1236. }
  1237. FuncOpenModel:getInstance():SetModelRes(res_data)
  1238. -------------------------
  1239. -------------------------
  1240. self.power_show_num = show_conf.power and show_conf.power or ShapeModel:GetInstance():GetPowerById( show_conf.type, show_conf.id )
  1241. else
  1242. --其他类道具显示
  1243. --lua_resM:setOutsideRawImage(self,self.nice_bg_raw,GameResPath.GetViewBigBg("designation_tip_bg"))
  1244. self.nice_designation_con_obj:SetActive(true)
  1245. self.nice_designation_image_obj:SetActive(true)
  1246. --lua_resM:setOutsideImageSprite(self, self.nice_designation_image_img, GameResPath.GetChildHandbookIcon(basic.type_id), true)
  1247. end
  1248. self:UpdateAttrCon()
  1249. self.nice_name_text_tmp.text = basic.goods_name
  1250. else
  1251. self.nice_con_obj:SetActive(false)
  1252. end
  1253. end
  1254. function GoodsTooltips:UpdateAttrCon()
  1255. if self.power_show_num then
  1256. self.nice_power_text_txt.text = self.power_show_num
  1257. return
  1258. end
  1259. local attr_list = self.attr_list
  1260. self.nice_power_text_txt.text = GetFighting(attr_list)
  1261. end
  1262. --限时抢购用
  1263. function GoodsTooltips:UpdateLimitShop( )
  1264. self.show_left_extra_view = false--保存一个参数,存在的时候 商城con和获取途径 互斥存在
  1265. if not self.type_id then return end
  1266. local data = KfActivityModel:getInstance():GetRushQuickBuy( self.type_id )
  1267. if data then
  1268. self.left_extra_con_obj:SetActive(true)
  1269. if not self.limit_shop_view then
  1270. self.limit_shop_view = self:CreateItem(KfActivityLimitShopTip, self.left_extra_con, self.layer_name)
  1271. end
  1272. self.limit_shop_view:SetData(self.type_id)
  1273. self.limit_shop_view:SetPosition(4,-4)
  1274. self.show_left_extra_view = true
  1275. else
  1276. self.left_extra_con_obj:SetActive(false)
  1277. end
  1278. end
  1279. function GoodsTooltips:ShowShopItem( )
  1280. local need_show = false
  1281. if self.shop_data then
  1282. if self.show_left_extra_view and self.show_get_way then
  1283. need_show = false
  1284. else
  1285. need_show = true
  1286. end
  1287. end
  1288. self.shop_con_obj:SetActive(need_show)
  1289. end
  1290. -- 进阶首充弹窗
  1291. function GoodsTooltips:UpdateFosterRechargeShow( )
  1292. if KfActivityModel:getInstance():CheckFosterRechargeAdsShow( self.parm_list.foster_data.type, self.parm_list.foster_data.grade) then
  1293. self.left_extra_con_obj:SetActive(true)
  1294. if not self.foster_recharge_view then
  1295. self.foster_recharge_view = self:CreateItem(FosterRechargeItem, self.left_extra_con, self.layer_name)
  1296. end
  1297. local click_cb = function( )
  1298. self:Close()
  1299. end
  1300. if not RechargeActivityModel:getInstance():IsRecharge() then
  1301. self.sound_id = lua_soundM:PlayEffect(self, "guide_10", false, LuaSoundManager.SOUND_TYPE.GUIDE)
  1302. end
  1303. self.foster_recharge_view:SetData( self.parm_list.foster_data.type, click_cb)
  1304. else
  1305. self.left_extra_con_obj:SetActive(false)
  1306. end
  1307. end
  1308. function GoodsTooltips:Close( )
  1309. --完成引导
  1310. local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_HORSE,4)
  1311. if helpVo then
  1312. GlobalEventSystem:Fire(EventName.FINISH_CURRENT_HELP_STEP,helpVo)
  1313. end
  1314. BaseView.Close(self)
  1315. end