|
|
- AttrDetailView = AttrDetailView or BaseClass(BaseView)
- local AttrDetailView = AttrDetailView
-
- function AttrDetailView:__init()
- self.base_file = "newMainRole"
- self.layout_file = "AttrDetailView"
- self.layer_name = "Activity"
- self.destroy_imm = true
- self.use_background = true
-
- self.blur_activity_bg = true
- self.is_set_zdepth = true
- self.index = 1 -- 页签index 1为普通属性 2为特殊属性
- --self.change_scene_close = true --是否切换场景时关闭(弹出界面使用)
- --self.append_to_ctl_queue = false --是否要添加进界面堆栈
- --self.need_show_money = false --是否要显示顶部的金钱栏
-
- self.model = NewMainRoleModel:getInstance()
-
- 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 AttrDetailView:Open(index)
- self.index = index or 1
- BaseView.Open(self)
- end
-
- function AttrDetailView:LoadSuccess()
- local nodes = {
- "window:raw","window/CloseBtn:obj","attr_scroll","attr_scroll/Viewport/attr_con",
- "tab_con/tab_2:obj:tmp","tab_con/tab_1:obj:tmp",
- "tab_con/selectedBg",
- }
- self:GetChildren(nodes)
- lua_resM:setOutsideRawImage(self, self.window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"))
- end
-
- function AttrDetailView:AddEvent()
- local function click_event(target)
- if target == self.CloseBtn_obj then
- self:Close()
- elseif target == self.tab_1_obj then
- self:SwitchTabIndex(1)
- elseif target == self.tab_2_obj then
- self:SwitchTabIndex(2)
- end
- end
- AddClickEvent(self.CloseBtn_obj, click_event, LuaSoundManager.SOUND_UI.NONE)
- AddClickEvent(self.tab_1_obj, click_event, LuaSoundManager.SOUND_UI.SWITCH)
- AddClickEvent(self.tab_2_obj, click_event, LuaSoundManager.SOUND_UI.SWITCH)
- end
-
- function AttrDetailView:OpenSuccess()
- self:SwitchTabIndex(self.index)
- end
-
- function AttrDetailView:UpdateView()
- self.attritem_list_creator = self.attritem_list_creator or self:AddUIComponent(UI.ItemListCreator)
- local attr_list = self.index == 1 and Config.ConfigAttrInfo.NormalAttr or Config.ConfigAttrInfo.SpecialAttr
- SetAnchoredPosition(self.attr_con, 0, 0)
- local info = {
- data_list = attr_list,
- item_con = self.attr_con,
- scroll_view = self.attr_scroll,
- prefab_ab_name = "newMainRole",
- prefab_res_name = "AttrDetailItem",
- item_height = 49.75,
- start_y = -5,
- start_x = 4,
- space_y = 1,
- child_names = {"bg:img","desc:tmp","attr_icon:img",},
- on_update_item = function(item, i, v)
- lua_resM:setImageSprite(self, item.bg_img, "newMainRole_asset", self.index == 1 and "newMainRole_di_13" or "newMainRole_di_14",true)
- SetAttrIconByColorType(item, item.attr_icon_img, v.attr_id, false, self.index == 1 and 1 or 2)
- local attr_name = HtmlColorTxt( (v.name or "") .. ":", self.index == 1 and '#a9c1e1' or '#fdffc2')
- local attr_desc = Config.ConfigRoleAttrDes[v.attr_id] or ""
- item.desc_tmp.text = attr_name .. HtmlColorTxt( attr_desc , self.index == 1 and '#f3fcff' or '#fdffc2')
- end,
- }
- self.attritem_list_creator:UpdateItems(info)
- end
-
- function AttrDetailView:SwitchTabIndex( index )
- self.index = index
- SetAnchoredPosition(self.selectedBg, 2, index == 1 and 86 or 25)
- self.tab_1_tmp.text = HtmlColorTxt( "基础属性" , index == 1 and '#ffffff' or '#7d91ac')
- self.tab_2_tmp.text = HtmlColorTxt( "特殊属性" , index == 2 and '#ffffff' or '#7d91ac')
- SetTMPSharedMaterial(self.tab_1_tmp, index == 1 and ShaderTools.TMPSharedMaterialType.FZZZOutlineBlueTab or ShaderTools.TMPSharedMaterialType.FZZZDefault)
- SetTMPSharedMaterial(self.tab_2_tmp, index == 2 and ShaderTools.TMPSharedMaterialType.FZZZOutlineBlueTab or ShaderTools.TMPSharedMaterialType.FZZZDefault)
- self:UpdateView()
- end
-
- function AttrDetailView:DestroySuccess( )
-
- end
|