源战役客户端
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.

91 lines
3.1 KiB

  1. FlyShoeBuyTip = FlyShoeBuyTip or BaseClass(BaseView)
  2. local FlyShoeBuyTip = FlyShoeBuyTip
  3. function FlyShoeBuyTip:__init()
  4. self.base_file = "task"
  5. self.layout_file = "FlyShoeBuyTip"
  6. self.layer_name = "Activity"
  7. self.destroy_imm = true
  8. self.change_scene_close = true
  9. self.append_to_ctl_queue = false --是否要添加进界面堆栈
  10. self.need_show_money = false --是否要显示顶部的金钱栏
  11. self.is_set_zdepth = true
  12. self.click_bg_toClose = false
  13. ------------------------
  14. -- 一级全屏界面:
  15. self.hide_maincancas = false --隐藏主界面
  16. self.use_background = true --不一定显示遮罩
  17. ------------------------
  18. self.model = TaskModel:getInstance()
  19. self.load_callback = function ()
  20. self:LoadSuccess()
  21. self:AddEvent()
  22. end
  23. self.open_callback = function ( )
  24. self:OpenSuccess()
  25. end
  26. self.close_win_callback = function ( )
  27. self:Close()
  28. end
  29. self.destroy_callback = function ( )
  30. self:DestroySuccess()
  31. end
  32. end
  33. function FlyShoeBuyTip:Open( buy_call )
  34. self.buy_call = buy_call
  35. BaseView.Open(self)
  36. end
  37. function FlyShoeBuyTip:LoadSuccess()
  38. local nodes = {
  39. "cancelBtn:obj", "Window:raw", "windowCloseBtn:obj", "confirmBtn:obj", "contenText:tmp", "descText:tmp:obj",
  40. }
  41. self:GetChildren(nodes)
  42. lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"), false)
  43. self.descText_tmp.text = string.format("( %s 可免费全图飞行 <color=%s><u>提升VIP</u></color> )",HtmlColorTxt( " VIP" .. VipModel:getInstance():GetFreeShoeVip( ) , ColorUtil.PURPLE_DARK),ColorUtil.GREEN_DARK)
  44. end
  45. function FlyShoeBuyTip:AddEvent()
  46. local function onBtnClickHandler(target)
  47. if target == self.confirmBtn_obj then
  48. local data = ShopModel:getInstance():GetShopTypeIdBuyCFG( AutoFightManager.FlyGoodsID )
  49. if data and data[ShopType.BindGold] then
  50. ShopModel:getInstance():Fire(ShopModel.BUY_GOODS, data[ShopType.BindGold].key_id, 1)
  51. end
  52. elseif target == self.cancelBtn_obj then
  53. self:Close()
  54. elseif target == self.windowCloseBtn_obj then
  55. self:Close()
  56. elseif target == self.descText_obj then
  57. GlobalEventSystem:Fire(EventName.OPEN_VIP_VIEW, VipModel.TabType.Recharge)
  58. self:Close()
  59. end
  60. end
  61. AddClickEvent(self.windowCloseBtn_obj,onBtnClickHandler )
  62. AddClickEvent(self.cancelBtn_obj,onBtnClickHandler,LuaSoundManager.SOUND_UI.SWITCH)
  63. AddClickEvent(self.confirmBtn_obj,onBtnClickHandler,LuaSoundManager.SOUND_UI.SWITCH)
  64. AddClickEvent(self.descText_obj,onBtnClickHandler,LuaSoundManager.SOUND_UI.SWITCH)
  65. local function BUY_SHOE_TO_FLY_SUCCESS( )
  66. if self.buy_call then
  67. self.buy_call()
  68. end
  69. self:Close()
  70. end
  71. self:BindEvent(GlobalEventSystem, EventName.BUY_SHOE_TO_FLY_SUCCESS, BUY_SHOE_TO_FLY_SUCCESS)
  72. end
  73. function FlyShoeBuyTip:OpenSuccess()
  74. self:UpdateView()
  75. end
  76. function FlyShoeBuyTip:UpdateView()
  77. local goods_price_data = Config.Goodsprice[AutoFightManager.FlyGoodsID]
  78. if not goods_price_data then return end
  79. self.contenText_tmp.text = string.format("小飞鞋不足,是否花费 <size=120%%><sprite=1></size>%s 购买<color=%s>小飞鞋</color>*1 ?",HtmlColorTxt(goods_price_data.price , ColorUtil.GREEN_DARK),'#10aaf1')
  80. end
  81. function FlyShoeBuyTip:DestroySuccess( )
  82. end