StrengthBaseView = StrengthBaseView or BaseClass(BaseView) StrengthBaseView.Index2Name = { [1] = {name = "我要变强", light_res = "icon_strong_wybq_h", dark_res = "icon_strong_wybq_n"}, [2] = {name = "我要装备", light_res = "icon_strong_wyzb_h", dark_res = "icon_strong_wyzb_n"}, [3] = {name = "我要经验", light_res = "icon_strong_exp_h", dark_res = "icon_strong_exp_n"}, [4] = {name = "我要金币", light_res = "icon_strong_wyjb_h", dark_res = "icon_strong_wyjb_n"}, [5] = {name = "我要红钻", light_res = "icon_strong_wyzs_h", dark_res = "icon_strong_wyzs_n"}, } function StrengthBaseView:__init() self.base_file = "strength" self.layout_file = "StrengthBaseView" self.layer_name = "UI" self.use_background = true self.close_mode = CloseMode.CloseDestroy self.destroy_imm = true self.append_to_ctl_queue = true -- self.use_local_view = true self.model = StrengthModel:getInstance() self.mainRoleVo = RoleManager.Instance.mainRoleInfo self.load_callback = function () --GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK) self:LoadSuccess() self:InitEvent() end self.open_callback = function () self:SeletedTabbar(self.index) end self.close_callback = function () -- GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK) end self.destroy_callback = function () self:Remove() end end function StrengthBaseView:Open(index) self.index = index or 1 BaseView.Open(self) end function StrengthBaseView:Close() BaseView.Close(self) end function StrengthBaseView:LoadSuccess() self.contanier = GetChildTransforms(self.transform, {"contanier",}) local select_callback = function (index) self:SeletedTabbar(index) end local close_callback = function() self:Close() end local menu_list = {} for k,v in ipairs(StrengthBaseView.Index2Name) do table.insert(menu_list, StrengthBaseView.Index2Name[k]) end self.tabWindowComponent = TabWindowComponent.New(self.transform, "变 强", menu_list, 1264, 632, 306, 52, select_callback, close_callback, Vector3(0,0,0), self.background_wnd, "strength_asset") end function StrengthBaseView:InitEvent() -- body end function StrengthBaseView:SeletedTabbar(index) local current_index = self.tabWindowComponent:GetCurrentSelectIndex() if current_index == index then return end if self.tabWindowComponent then self.tabWindowComponent:SetTabBarIndex(index) end if self.main_view == nil then self.main_view = StrengthMainView.New(self.contanier) end self.main_view:SetData(index) self.index = index end function StrengthBaseView:Remove() if self.tabWindowComponent then self.tabWindowComponent:DeleteMe() self.tabWindowComponent = nil end if self.main_view then self.main_view:DeleteMe() self.main_view = nil end end