|
WarmPromptView = WarmPromptView or BaseClass(BaseView)
|
|
function WarmPromptView:__init()
|
|
self.base_file = "warmPrompt"
|
|
self.layout_file = "WarmPromptView"
|
|
self.layer_name = "UI"
|
|
self.destroy_imm = true
|
|
self.hide_maincancas = false
|
|
self.use_background = true
|
|
|
|
self.is_set_zdepth = true
|
|
self.model = WarmPromptModel:GetInstance()
|
|
|
|
self.tips_type = 0
|
|
self.callback = nil
|
|
self.next_time_show = true
|
|
self.args_list = {}
|
|
--self.use_local_view = true
|
|
self.load_callback = function()
|
|
self:LoadSuccess()
|
|
self:InitEvent()
|
|
end
|
|
|
|
self.open_callback = function()
|
|
self:SetViewInfo()
|
|
end
|
|
|
|
self.destroy_callback = function()
|
|
self:Remove()
|
|
end
|
|
end
|
|
|
|
function WarmPromptView:Remove()
|
|
self.callback = nil
|
|
end
|
|
|
|
function WarmPromptView:Open(tips_type,cb,...)
|
|
self.tips_type = tips_type
|
|
self.callback = cb
|
|
self.args_list = {...}
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function WarmPromptView:LoadSuccess()
|
|
self.confirm = self:GetChild("btnConfirm").gameObject
|
|
|
|
self.tip = self:GetChild("border/tip"):GetComponent("Text")
|
|
self.toggleCheck = self:GetChild("border/toggleCheck").gameObject
|
|
end
|
|
|
|
function WarmPromptView:InitEvent()
|
|
local function onBtnClickHandler(target)
|
|
if target == self.confirm then
|
|
self.callback()
|
|
self:Close()
|
|
elseif target == self.toggleCheck then
|
|
self.next_time_show = not self.next_time_show
|
|
self.model.next_show_state_list[self.tips_type] = self.next_time_show
|
|
end
|
|
end
|
|
AddClickEvent(self.confirm,onBtnClickHandler)
|
|
AddClickEvent(self.toggleCheck,onBtnClickHandler)
|
|
end
|
|
|
|
function WarmPromptView:SetViewInfo()
|
|
self.next_time_show = self.model.next_show_state_list[self.tips_type] or true
|
|
self:SetTipsContent()
|
|
end
|
|
|
|
function WarmPromptView:SetTipsContent()
|
|
local str = ""
|
|
if self.tips_type == WarmPromptModel.Tips_Type.Escort then
|
|
local double_str = ""
|
|
local str1 = ""
|
|
local str2 = ""
|
|
local cfg = DailyModel:getInstance():GetAcConfig(500, 1, 1)
|
|
if cfg then
|
|
local time = ErlangParser:GetInstance():Parse(cfg.time_region)
|
|
for i=1,2 do
|
|
for j=1,2 do
|
|
for k=1,2 do
|
|
if tonumber(time[i][j][k]) < 10 then
|
|
time[i][j][k] = "0"..time[i][j][k]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
str1 = string.format("%s:%s-%s:%s", time[1][1][1], time[1][1][2],
|
|
time[1][2][1], time[1][2][2])
|
|
str2 = string.format("%s:%s-%s:%s", time[2][1][1], time[2][1][2],
|
|
time[2][2][1], time[2][2][2])
|
|
end
|
|
str = string.format("护送双倍时间:\n<color=#4eae1a>%s,%s</color>\n现在护送无法获得双倍奖励,是否继续?", str1, str2)
|
|
elseif self.tips_type == WarmPromptModel.Tips_Type.Daily then
|
|
str = "是否消耗<color=#31ee4a>3彩钻</color>快速完成任务\n<color=#31ee4a>特权3</color>完成返还绑定彩钻:<color=#31ee4a>3</color>"
|
|
elseif self.tips_type == WarmPromptModel.Tips_Type.GuildTask then
|
|
str = "是否消耗<color=#31ee4a>3彩钻</color>快速完成任务\n<color=#31ee4a>特权3</color>完成返还绑定彩钻:<color=#31ee4a>3</color>"
|
|
elseif self.tips_type == WarmPromptModel.Tips_Type.XuanShang then
|
|
str = "是否消耗<color=#31ee4a>3彩钻</color>快速完成任务\n<color=#31ee4a>特权3</color>完成返还绑定彩钻:<color=#31ee4a>3</color>"
|
|
elseif self.tips_type == WarmPromptModel.Tips_Type.FinishTask then
|
|
str = "快速完成需消耗<color=#31ee4a>10彩钻</color>,是否继续?\n<color=#31ee4a>(优先使用红钻)</color>"
|
|
end
|
|
|
|
self.tip.text = str
|
|
end
|