require("game.proto.182.Require182")
|
|
require("game.taskAnnounce.TaskAnnounceModel")
|
|
require("game.taskAnnounce.TaskAnnounceView")
|
|
require("game.taskAnnounce.TaskAnnounceItem")
|
|
TaskAnnounceController = TaskAnnounceController or BaseClass(BaseController)
|
|
local TaskAnnounceController = TaskAnnounceController
|
|
function TaskAnnounceController:__init()
|
|
TaskAnnounceController.Instance = self
|
|
self.model = TaskAnnounceModel:getInstance()
|
|
|
|
self:RegisterProtocals()
|
|
self.last_refresh_time = 0
|
|
self:InitEvent()
|
|
end
|
|
|
|
function TaskAnnounceController:RegisterProtocals()
|
|
self:RegisterProtocal(18200, "handler18200")
|
|
self:RegisterProtocal(18201, "handler18201")
|
|
end
|
|
|
|
function TaskAnnounceController:InitEvent()
|
|
local function onRequestHandler(...)
|
|
local args = {...}
|
|
if args[1] == 18201 then
|
|
self:SendFmtToGame(args[1], "h", args[2], args[3])
|
|
else
|
|
self:SendFmtToGame(args[1])
|
|
end
|
|
end
|
|
self.model:Bind(TaskAnnounceModel.REQUEST_CCMD_EVENT, onRequestHandler)
|
|
|
|
local function ANS_FINISHED_TASK_LIST( task_id )
|
|
--登陆等任务列表返回,要去请求数据
|
|
if not task_id then
|
|
self.model:Fire(TaskAnnounceModel.REQUEST_CCMD_EVENT, 18200)
|
|
end
|
|
end
|
|
GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST,ANS_FINISHED_TASK_LIST)
|
|
|
|
local function onOpenAnnounceView(open_id)
|
|
if self.announce_view == nil then
|
|
self.announce_view = TaskAnnounceView.New()
|
|
end
|
|
self.announce_view:Open(open_id)
|
|
end
|
|
self.model:Bind(TaskAnnounceModel.OPEN_ANNOUNCE_VIEW, onOpenAnnounceView)
|
|
end
|
|
|
|
-- 奖励状态
|
|
function TaskAnnounceController:handler18200()
|
|
local scmd = SCMD18200.New(true)
|
|
-- PrintTable(scmd)
|
|
|
|
if scmd then
|
|
self.model:SetRewardInfo(scmd.func_list)
|
|
else
|
|
self.model:SetRewardInfo()
|
|
end
|
|
end
|
|
|
|
-- 领取奖励
|
|
function TaskAnnounceController:handler18201()
|
|
local scmd = SCMD18201.New(true)
|
|
if scmd then
|
|
if scmd.state == 2 then
|
|
Message.show("领取成功")
|
|
end
|
|
self.model:SetRewardData(scmd)
|
|
end
|
|
end
|