|
|
- CommonInstructionView = CommonInstructionView or BaseClass(BaseView)
- local CommonInstructionView = CommonInstructionView
-
- function CommonInstructionView:__init()
- self.base_file = "common"
- self.layout_file = "CommonInstructionView"
- self.layer_name = "Activity"
- self.use_background = true
- self.click_bg_toClose = true
- self.is_set_zdepth = true
- self:AddPreLoadList("common",{"CommonInstructionItem"})
- self.item_list = {}
- self.load_callback = function()
- self:LoadSuccess()
- self:SetData()
- end
- self.close_callback = function ()
- self:Clear()
- end
- end
-
- function CommonInstructionView:Clear()
- for i,item in ipairs(self.item_list) do
- item:DeleteMe()
- end
- self.item_list = {}
- end
-
- function CommonInstructionView:LoadSuccess()
- self.window_img = self:GetChildImages({"Window"})
- self.title_text = self:GetChildTexts({"Window/windowTitleText"})
- self.scroll_content = self:GetChild("ScrollView/Viewport/Content")
- lua_resM:setOutsideImageSprite(self,self.window_img,GameResPath.GetCommonImage("ui_smbg"))
- end
-
- function CommonInstructionView:Open(index)
- self.index = index
- BaseView.Open(self)
- end
-
- function CommonInstructionView:SetData()
- local cfg = Config.ConfigInstruction[self.index]
- if cfg then
- self.title_text.text = cfg.ViewTitle
- local height = 0
- if cfg.info_list then
- local item = nil
- for i,vo in ipairs(cfg.info_list) do
- item = CommonInstructionItem.New(self.scroll_content)
- item:SetData(vo)
- item:SetAnchoredPosition(0,-height)
- height = height + item:GetHeight()
-
- table.insert(self.item_list,item)
- end
- end
- SetSizeDelta(self.scroll_content, 774,height)
- end
- end
|