|
|
- ChildNiceRecordView = ChildNiceRecordView or BaseClass(BaseView)
- local ChildNiceRecordView = ChildNiceRecordView
-
- function ChildNiceRecordView:__init()
- self.base_file = "child"
- self.layout_file = "ChildNiceRecordView"
- self.layer_name = "UI"
- --self.destroy_imm = true
- self.use_background = true
- self.change_scene_close = true --是否切换场景时关闭(弹出界面使用)
- --self.append_to_ctl_queue = true --是否要添加进界面堆栈
- self.hide_maincancas = true --全屏界面需要放开隐藏主UI
- self.blur_activity_bg = true
-
- self.model = ChildModel:GetInstance()
- self.task_record_list = {}
- self.load_callback = function ()
- self:LoadSuccess()
- self:AddEvent()
- end
- self.open_callback = function ( )
- self:OpenSuccess()
- end
- self.destroy_callback = function ( )
- self:DestroySuccess()
- end
- end
-
- function ChildNiceRecordView:Open(data,callBack)
- self.data = data
- self.callBack = callBack
- BaseView.Open(self)
- end
-
- function ChildNiceRecordView:LoadSuccess()
- local nodes = {
- "none/empty/girl:raw", "none/empty/talkBg:raw",
- "none/empty/btn_go_main:obj",
- }
- self:GetChildren(nodes)
- self.Content = self:GetChild("ScrollView/Viewport/Content")
- self.Window_img = self:GetChild("Window"):GetComponent("Image")
- self.none_obj = self:GetChild("none").gameObject
-
- -- lua_resM:setOutsideImageSprite(self, self.Window_img, GameResPath.GetViewBigBg("child_nice_record_bg"), false)
-
- local closeWin_callback = function()
- self:Close()
- end
- self.tabWindowComponent = UITabWindow.New(self.transform, {}, select_callback, closeWin_callback,self.background_wnd, nil, UITabWindow.SizeSmallNoTab, false,nil,true)
- self.tabWindowComponent:SetBackgroundRes("chat_dress_bg2")
- self.tabWindowComponent:SetTitleText("点赞记录")
-
- lua_resM:setOutsideRawImage(self, self.girl_raw, GameResPath.GetRoleBg("team_empty_bg_267_589"))
- lua_resM:setOutsideRawImage(self, self.talkBg_raw, GameResPath.GetViewBigBg("com_empty_bg1"))
- end
-
- function ChildNiceRecordView:AddEvent()
-
- self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16508) -- 宝宝点赞记录
-
- local function updata_child_record_info_fun(vo)
- self:UpdateView(vo)
- end
- self.updata_child_record_info = self.model:Bind(ChildConst.UPDATA_CHILD_NICE_RECORD_INFO, updata_child_record_info_fun) --
-
- local function clickHandler(target)
- if target == self.btn_go_main_obj then
- self:Close()
- self.model:Fire(ChildConst.OPEN_CHILD_TRAIN_VIEW)
- self.model:Fire(ChildConst.PLAY_SHOW_BABY_EFFECT)
- end
- end
- AddClickEvent(self.btn_go_main_obj, clickHandler, 1)
- end
-
- function ChildNiceRecordView:OpenSuccess()
- --self:UpdateView()
- end
-
- function ChildNiceRecordView:UpdateView(vo)
- if vo and TableSize(vo) > 0 then
- self.none_obj:SetActive(false)
- for k,v in pairs(vo) do
- local item = self.task_record_list[k]
- if item == nil then
- item = ChildNiceRecordItem.New(self.Content)
- self.task_record_list[k] = item
- end
- self.task_record_list[k]:SetData(v,k)
- --ChildMainTaskItem
- end
- else
- self.none_obj:SetActive(true)
- end
- end
-
- function ChildNiceRecordView:DestroySuccess( )
- if self.tabWindowComponent then
- self.tabWindowComponent:DeleteMe()
- self.tabWindowComponent = nil
- end
-
- if self.updata_child_record_info then
- self.model:UnBind(self.updata_child_record_info)
- self.updata_child_record_info = nil
- end
-
- for i, v in ipairs(self.task_record_list) do
- v:DeleteMe()
- v = nil
- end
- self.task_record_list = {}
-
- end
- function ChildNiceRecordView:SetCallBack(callBack)
- self.callBack = callBack
- end
|