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

90 lines
3.2 KiB

  1. CurrencyWishCriticalView = CurrencyWishCriticalView or BaseClass(BaseView)
  2. local CurrencyWishCriticalView = CurrencyWishCriticalView
  3. function CurrencyWishCriticalView:__init()
  4. self.base_file = "currencyWish"
  5. self.layout_file = "CurrencyWishCriticalView"
  6. self.layer_name = "Top"
  7. self.destroy_imm = true
  8. self.use_background = true
  9. self.is_set_zdepth = true
  10. self.hide_maincancas = true --全屏界面需要隐藏主UI
  11. --self.change_scene_close = true --是否切换场景时关闭(弹出界面使用)
  12. self.append_to_ctl_queue = false --是否要添加进界面堆栈
  13. self.model = CurrencyWishModel:getInstance()
  14. self.load_callback = function()
  15. self:LoadSuccess()
  16. self:AddEvent()
  17. end
  18. self.open_callback = function( )
  19. self:UpdateView()
  20. end
  21. self.destroy_callback = function ( )
  22. self:DestroySuccess()
  23. end
  24. end
  25. function CurrencyWishCriticalView:Open( )
  26. --self.data = data
  27. BaseView.Open(self)
  28. end
  29. function CurrencyWishCriticalView:LoadSuccess()
  30. local nodes = {
  31. "close_btn:obj", "reward_num:tmp", "confirm_btn:obj", "desc_text:tmp", "bg:img",
  32. "reward_num/reward_icon:img",
  33. }
  34. self:GetChildren(nodes)
  35. lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetViewBigBg("currency_wish_critical_bg"), false)
  36. self:UpdateView()
  37. end
  38. function CurrencyWishCriticalView:AddEvent()
  39. local function click_event(target)
  40. if target == self.close_btn_obj then
  41. self:Close()
  42. elseif target == self.confirm_btn_obj then
  43. self:Close()
  44. end
  45. end
  46. AddClickEvent(self.close_btn_obj, click_event)
  47. AddClickEvent(self.confirm_btn_obj, click_event)
  48. end
  49. function CurrencyWishCriticalView:SetData(data)
  50. self.data = data
  51. self:UpdateView()
  52. -- if self.need_refresh_data then
  53. -- self.need_refresh_data = false
  54. -- self:UpdateView()
  55. -- end
  56. end
  57. function CurrencyWishCriticalView:UpdateView()
  58. if not self.is_loaded or not self.data then
  59. self.need_refresh_view = true
  60. return
  61. end
  62. local money_str
  63. if self.data.wishtype == CurrencyWishConst.CURRENCY_WISH_TYPE.SPECIAL then
  64. -- money_str = WordManager:GetMoneyFaceStr(3)
  65. lua_resM:setImageSprite(self, self.reward_icon_img, "uiComponent_asset", "ui_momey_icon_3", true)
  66. -- SetLocalScale(self.reward_icon, 1, 1, 1)
  67. elseif self.data.wishtype == CurrencyWishConst.CURRENCY_WISH_TYPE.EXP then
  68. -- money_str = WordManager:GetMoneyFaceStr(5)
  69. lua_resM:setImageSprite(self, self.reward_icon_img, "currencyWish_asset", "currency_wish_exp_word_icon", true)
  70. SetLocalScale(self.reward_icon, 1.2, 1.2, 1)
  71. local pos_x = GetAnchoredPosition(self.reward_icon)
  72. SetAnchoredPositionX(self.reward_icon, pos_x + 10)
  73. end
  74. self.reward_num_tmp.text = string.format("<size=20><color=#ffffff>获得</color></size> %s", self.data.award_num)
  75. self.desc_text_tmp.text = string.format("本次祈愿获得 <color=#fdffc2><size=30>%s倍</size></color> 暴击!!!\n奖励直翻 <color=#fdffc2><size=30>%s倍</size></color>!",
  76. self.data.crit_rate, self.data.crit_rate)
  77. end
  78. function CurrencyWishCriticalView:DestroySuccess()
  79. end