diff --git a/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua b/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua index 5113e63d7f..168dba2135 100644 --- a/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua @@ -219,7 +219,11 @@ function this.OnPageTabChange(index, lastIndex) -- 默认打开第一个商店 if this.ShopTabCtrl then this._CurShopIndex = nil - this.ShopTabCtrl:ChangeTab(this._ChooseShopIndex or 1) + if this._ChooseShopIndex then + this.ShopTabCtrl:ChangeTab(this._ChooseShopIndex or 1) + else + this.ShopTabCtrl:ChangeTab(this.GetAvailableChildShopIndex() or 1) + end end -- 二级页签只有一个的时候不显示 @@ -230,6 +234,16 @@ function this.OnPageTabChange(index, lastIndex) this.tabbox2Content.transform.localPosition = Vector3.New(contentWidth/2, curPos.y, curPos.z) end +-- 获取当前大页签下可用的小页签的序号 +function this.GetAvailableChildShopIndex() + for index, shopType in ipairs(this._MainShopTypeList) do + local isActive, errorTip = ShopManager.IsActive(shopType) + if isActive then + return index + end + end +end + ----==========================二级页签相关=========================================== -- tab按钮自定义显示设置 function this.ShopTabAdapter(tab, index, status)