源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

103 行
3.3 KiB

  1. WarmPromptView = WarmPromptView or BaseClass(BaseView)
  2. function WarmPromptView:__init()
  3. self.base_file = "warmPrompt"
  4. self.layout_file = "WarmPromptView"
  5. self.layer_name = "UI"
  6. self.destroy_imm = true
  7. self.hide_maincancas = false
  8. self.use_background = true
  9. self.is_set_zdepth = true
  10. self.model = WarmPromptModel:GetInstance()
  11. self.tips_type = 0
  12. self.callback = nil
  13. self.next_time_show = true
  14. self.args_list = {}
  15. --self.use_local_view = true
  16. self.load_callback = function()
  17. self:LoadSuccess()
  18. self:InitEvent()
  19. end
  20. self.open_callback = function()
  21. self:SetViewInfo()
  22. end
  23. self.destroy_callback = function()
  24. self:Remove()
  25. end
  26. end
  27. function WarmPromptView:Remove()
  28. self.callback = nil
  29. end
  30. function WarmPromptView:Open(tips_type,cb,...)
  31. self.tips_type = tips_type
  32. self.callback = cb
  33. self.args_list = {...}
  34. BaseView.Open(self)
  35. end
  36. function WarmPromptView:LoadSuccess()
  37. self.confirm = self:GetChild("btnConfirm").gameObject
  38. self.tip = self:GetChild("border/tip"):GetComponent("Text")
  39. self.toggleCheck = self:GetChild("border/toggleCheck").gameObject
  40. end
  41. function WarmPromptView:InitEvent()
  42. local function onBtnClickHandler(target)
  43. if target == self.confirm then
  44. self.callback()
  45. self:Close()
  46. elseif target == self.toggleCheck then
  47. self.next_time_show = not self.next_time_show
  48. self.model.next_show_state_list[self.tips_type] = self.next_time_show
  49. end
  50. end
  51. AddClickEvent(self.confirm,onBtnClickHandler)
  52. AddClickEvent(self.toggleCheck,onBtnClickHandler)
  53. end
  54. function WarmPromptView:SetViewInfo()
  55. self.next_time_show = self.model.next_show_state_list[self.tips_type] or true
  56. self:SetTipsContent()
  57. end
  58. function WarmPromptView:SetTipsContent()
  59. local str = ""
  60. if self.tips_type == WarmPromptModel.Tips_Type.Escort then
  61. local double_str = ""
  62. local str1 = ""
  63. local str2 = ""
  64. local cfg = DailyModel:getInstance():GetAcConfig(500, 1, 1)
  65. if cfg then
  66. local time = ErlangParser:GetInstance():Parse(cfg.time_region)
  67. for i=1,2 do
  68. for j=1,2 do
  69. for k=1,2 do
  70. if tonumber(time[i][j][k]) < 10 then
  71. time[i][j][k] = "0"..time[i][j][k]
  72. end
  73. end
  74. end
  75. end
  76. str1 = string.format("%s:%s-%s:%s", time[1][1][1], time[1][1][2],
  77. time[1][2][1], time[1][2][2])
  78. str2 = string.format("%s:%s-%s:%s", time[2][1][1], time[2][1][2],
  79. time[2][2][1], time[2][2][2])
  80. end
  81. str = string.format("护送双倍时间:\n<color=#4eae1a>%s,%s</color>\n现在护送无法获得双倍奖励,是否继续?", str1, str2)
  82. elseif self.tips_type == WarmPromptModel.Tips_Type.Daily then
  83. str = "是否消耗<color=#31ee4a>3彩钻</color>快速完成任务\n<color=#31ee4a>特权3</color>完成返还绑定彩钻:<color=#31ee4a>3</color>"
  84. elseif self.tips_type == WarmPromptModel.Tips_Type.GuildTask then
  85. str = "是否消耗<color=#31ee4a>3彩钻</color>快速完成任务\n<color=#31ee4a>特权3</color>完成返还绑定彩钻:<color=#31ee4a>3</color>"
  86. elseif self.tips_type == WarmPromptModel.Tips_Type.XuanShang then
  87. str = "是否消耗<color=#31ee4a>3彩钻</color>快速完成任务\n<color=#31ee4a>特权3</color>完成返还绑定彩钻:<color=#31ee4a>3</color>"
  88. elseif self.tips_type == WarmPromptModel.Tips_Type.FinishTask then
  89. str = "快速完成需消耗<color=#31ee4a>10彩钻</color>,是否继续?\n<color=#31ee4a>(优先使用红钻)</color>"
  90. end
  91. self.tip.text = str
  92. end