diff --git a/Assets/ManagedResources/Prefabs/UI/RoleInfo/RoleListPanel.prefab b/Assets/ManagedResources/Prefabs/UI/RoleInfo/RoleListPanel.prefab index 1e3af46c12..8e4157b38a 100644 --- a/Assets/ManagedResources/Prefabs/UI/RoleInfo/RoleListPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/RoleInfo/RoleListPanel.prefab @@ -8594,6 +8594,11 @@ PrefabInstance: propertyPath: m_Pivot.y value: 0.5 objectReference: {fileID: 0} + - target: {fileID: 3461041183831773760, guid: 5499cdbed3f400441b21a8becb5b5e84, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3461869958402333818, guid: 5499cdbed3f400441b21a8becb5b5e84, type: 3} propertyPath: m_AnchoredPosition.y @@ -8649,6 +8654,26 @@ PrefabInstance: propertyPath: m_TargetGraphic value: objectReference: {fileID: 3290334893541118100} + - target: {fileID: 3395823834833100134, guid: 5499cdbed3f400441b21a8becb5b5e84, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3395823834833100134, guid: 5499cdbed3f400441b21a8becb5b5e84, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3395823834833100134, guid: 5499cdbed3f400441b21a8becb5b5e84, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3395823834833100134, guid: 5499cdbed3f400441b21a8becb5b5e84, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 381753831834081747, guid: 5499cdbed3f400441b21a8becb5b5e84, type: 3} propertyPath: m_SizeDelta.x diff --git a/Assets/ManagedResources/Prefabs/UI/Shop/MainShopPanel.prefab b/Assets/ManagedResources/Prefabs/UI/Shop/MainShopPanel.prefab index 462fe1234c..2053b174e4 100644 --- a/Assets/ManagedResources/Prefabs/UI/Shop/MainShopPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Shop/MainShopPanel.prefab @@ -853,7 +853,7 @@ MonoBehaviour: m_Top: 0 m_Bottom: 0 m_ChildAlignment: 0 - m_Spacing: 0 + m_Spacing: -40 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 0 diff --git a/Assets/ManagedResources/Prefabs/UI/cardView/card.prefab b/Assets/ManagedResources/Prefabs/UI/cardView/card.prefab index 9575ab4139..c37a850f50 100644 --- a/Assets/ManagedResources/Prefabs/UI/cardView/card.prefab +++ b/Assets/ManagedResources/Prefabs/UI/cardView/card.prefab @@ -17,7 +17,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &309311515 RectTransform: m_ObjectHideFlags: 0 @@ -754,7 +754,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 51.71, y: 2.600006} + m_AnchoredPosition: {x: 30, y: 2.600006} m_SizeDelta: {x: 291.48, y: 30} m_Pivot: {x: 0, y: 0} --- !u!222 &3458859693125887700 @@ -1063,7 +1063,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3461425765958726042 RectTransform: m_ObjectHideFlags: 0 diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua index 1a0e4df3b3..c140b62d8f 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleListPanel.lua @@ -2,14 +2,15 @@ RoleListPanel = Inherit(BasePanel) local this = RoleListPanel local sortType = 1 -- 1:品阶 2:等级 -local proId=0--0 全部 1 火 2风 3 水 4 地 5 光 6 暗 +local proId = 0 --0 全部 1 火 2风 3 水 4 地 5 光 6 暗 local tarHero = {} local teamHero = {} -local roleDatas={} -this.isFirstOpen=true +local roleDatas = {} +this.isFirstOpen = true local tabs = {} -local tabsImg = {"z_icon_01_zh","r_hero_huo 1_zh", "r_hero_feng 1_zh", "r_hero_shui 1_zh", "r_hero_dadi 1_zh","z_icon_qingjinbao"} -local soulPrintData={} +local tabsImg = { "z_icon_01_zh", "r_hero_huo 1_zh", "r_hero_feng 1_zh", "r_hero_shui 1_zh", "r_hero_dadi 1_zh", + "z_icon_qingjinbao" } +local soulPrintData = {} local orginLayer = 0 local orginLayer2 = 0 local isFristOpenTime = Timer.New() @@ -18,50 +19,53 @@ function RoleListPanel:InitComponent() this.BtnBack = Util.GetGameObject(self.transform, "rightUp/btnBack") this.cardPre = poolManager:LoadAsset("card", PoolManager.AssetType.GameObject) - UIManager.DoLanguageCheck(this.spLoader, this.cardPre) - this.cardPre.transform:SetParent(self.transform) - this.cardPre:GetComponent("RectTransform").localScale = Vector3.New(1,1,1) + UIManager.DoLanguageCheck(this.spLoader, this.cardPre) + this.cardPre.transform:SetParent(self.transform) + this.cardPre:GetComponent("RectTransform").localScale = Vector3.New(1, 1, 1) local starPre = poolManager:LoadAsset("starGrid", PoolManager.AssetType.GameObject) starPre.transform:SetParent(Util.GetGameObject(self.transform, "card(Clone)/card/star").transform) - local particles1=starPre:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem)) - for key, value in pairs(particles1:ToTable()) do - local mat=value:GetComponent(typeof(UnityEngine.Renderer)) - if mat.material.shader.name=="CGwell FX/Additive Lv1" then - mat.material.shader=poolManager:LoadAsset("Add Lv1_1",poolManager.AssetType.Other) - elseif mat.material.shader.name=="UI Particles/Additive" then - mat.material.shader=poolManager:LoadAsset("UI-Particle-Add_1",poolManager.AssetType.Other) - end + starPre.transform.localScale = Vector3.one + starPre.transform.localPosition = Vector3.zero + local particles1 = starPre:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem)) + for key, value in pairs(particles1:ToTable()) do + local mat = value:GetComponent(typeof(UnityEngine.Renderer)) + if mat.material.shader.name == "CGwell FX/Additive Lv1" then + mat.material.shader = poolManager:LoadAsset("Add Lv1_1", poolManager.AssetType.Other) + elseif mat.material.shader.name == "UI Particles/Additive" then + mat.material.shader = poolManager:LoadAsset("UI-Particle-Add_1", poolManager.AssetType.Other) end - local particles=this.cardPre:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem)) - for key, value in pairs(particles:ToTable()) do - local mat=value:GetComponent(typeof(UnityEngine.Renderer)) - if mat.material.shader.name=="CGwell FX/Additive Lv1" then - mat.material.shader=poolManager:LoadAsset("Add Lv1_1",poolManager.AssetType.Other) - elseif mat.material.shader.name=="UI Particles/Additive" then - mat.material.shader=poolManager:LoadAsset("UI-Particle-Add_1",poolManager.AssetType.Other) - elseif mat.material.shader.name=="YXZ/Effect/Mix Masking(Without Moving)_alphablend" then - mat.material.shader=poolManager:LoadAsset("YXZ_MixMaskingWithoutMoving_alphablend_1",poolManager.AssetType.Other) - end + end + local particles = this.cardPre:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem)) + for key, value in pairs(particles:ToTable()) do + local mat = value:GetComponent(typeof(UnityEngine.Renderer)) + if mat.material.shader.name == "CGwell FX/Additive Lv1" then + mat.material.shader = poolManager:LoadAsset("Add Lv1_1", poolManager.AssetType.Other) + elseif mat.material.shader.name == "UI Particles/Additive" then + mat.material.shader = poolManager:LoadAsset("UI-Particle-Add_1", poolManager.AssetType.Other) + elseif mat.material.shader.name == "YXZ/Effect/Mix Masking(Without Moving)_alphablend" then + mat.material.shader = poolManager:LoadAsset("YXZ_MixMaskingWithoutMoving_alphablend_1", + poolManager.AssetType.Other) end - local meshs=this.cardPre:GetComponentsInChildren(typeof(UnityEngine.MeshRenderer)) - for key, value in pairs(meshs:ToTable()) do - if value.material.shader.name=="Custom/S_03_UV_alpha_add" then - value.material.shader=poolManager:LoadAsset("S_03_uv_alpha_add_1",poolManager.AssetType.Other) - end - end - local meshs2=this.cardPre:GetComponentsInChildren(typeof(UnityEngine.SkinnedMeshRenderer)) - for key, value in pairs(meshs2:ToTable()) do - if value.material.shader.name=="YXZ/Effect/TransparentRim" then - value.material.shader=poolManager:LoadAsset("YXZ_Effect_TransparentRim_1",poolManager.AssetType.Other) - end - end + end + local meshs = this.cardPre:GetComponentsInChildren(typeof(UnityEngine.MeshRenderer)) + for key, value in pairs(meshs:ToTable()) do + if value.material.shader.name == "Custom/S_03_UV_alpha_add" then + value.material.shader = poolManager:LoadAsset("S_03_uv_alpha_add_1", poolManager.AssetType.Other) + end + end + local meshs2 = this.cardPre:GetComponentsInChildren(typeof(UnityEngine.SkinnedMeshRenderer)) + for key, value in pairs(meshs2:ToTable()) do + if value.material.shader.name == "YXZ/Effect/TransparentRim" then + value.material.shader = poolManager:LoadAsset("YXZ_Effect_TransparentRim_1", poolManager.AssetType.Other) + end + end this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs") for i = 0, 6 do - tabs[i] = Util.GetGameObject(self.transform, "Tabs/grid/box/Btn" .. i) - local nameTxt=Util.GetGameObject(self.transform, "Tabs/grid/box/Btn" .. i.."/Text"):GetComponent("Text") - nameTxt.text=PropertyType[i] - if tabsImg[i+1] then - Util.GetGameObject(tabs[i], "Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(tabsImg[i+1]) + tabs[i] = Util.GetGameObject(self.transform, "Tabs/grid/box/Btn" .. i) + local nameTxt = Util.GetGameObject(self.transform, "Tabs/grid/box/Btn" .. i .. "/Text"):GetComponent("Text") + nameTxt.text = PropertyType[i] + if tabsImg[i + 1] then + Util.GetGameObject(tabs[i], "Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(tabsImg[i + 1]) end end this.ShaiXuanBtn = Util.GetGameObject(self.gameObject, "ShaiXuanBtn") @@ -82,42 +86,40 @@ function RoleListPanel:InitComponent() if not this.playerInfoView then this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform) - -- this.playerInfoView.gameObject:AddComponent(typeof(UnityEngine.Canvas)).overrideSorting=true - --this.playerInfoView.overrideSorting=true + -- this.playerInfoView.gameObject:AddComponent(typeof(UnityEngine.Canvas)).overrideSorting=true + --this.playerInfoView.overrideSorting=true end - this.BtView =SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform) + this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform) --this.UpView.gameObject:AddComponent(typeof(UnityEngine.Canvas)).overrideSorting=true --this.UpView.overrideSorting=true local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect - this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "scroll").transform, - this.cardPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2+20), 1, 5, Vector2.New(25,8)) + this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, + Util.GetGameObject(self.transform, "scroll").transform, + this.cardPre, this.ScrollBar, Vector2.New(-v2.x * 2, -v2.y * 2 + 20), 1, 5, Vector2.New(25, 8)) this.ScrollView.moveTween.MomentumAmount = 1 this.ScrollView.moveTween.Strength = 1 this.maxk = Util.GetGameObject(self.gameObject, "maxk") - - end --绑定事件(用于子类重写) function RoleListPanel:BindEvent() - Util.AddClick(this.BtnBack, function() PlaySoundWithoutClick(SoundConfig.Sound_UICancel) - HeroManager.heroListPanelSortID=SortTypeConst.Natural - HeroManager.heroListPanelProID=ProIdConst.All + HeroManager.heroListPanelSortID = SortTypeConst.Natural + HeroManager.heroListPanelProID = ProIdConst.All UIManager.OpenPanel(UIName.MainPanel) end) for i = 0, 6 do Util.AddClick(tabs[i], function() if this.isFirstOpen == false then if i == proId then - proId=ProIdConst.All - HeroManager.heroListPanelProID=ProIdConst.All + proId = ProIdConst.All + HeroManager.heroListPanelProID = ProIdConst.All else - proId=i - HeroManager.heroListPanelProID=proId + proId = i + HeroManager.heroListPanelProID = proId end this:GetCurSortHeroListData() end @@ -127,17 +129,17 @@ function RoleListPanel:BindEvent() Util.AddClick(this.ShaiXuanBtn, function() if sortType == SortTypeConst.Lv then sortType = SortTypeConst.Natural - HeroManager.heroListPanelSortID=SortTypeConst.Natural + HeroManager.heroListPanelSortID = SortTypeConst.Natural else sortType = SortTypeConst.Lv - HeroManager.heroListPanelSortID=SortTypeConst.Lv + HeroManager.heroListPanelSortID = SortTypeConst.Lv end this.ShaiXuanBtnLv:SetActive(sortType ~= SortTypeConst.Lv) this.ShaiXuanBtnQu:SetActive(sortType ~= SortTypeConst.Natural) this:GetCurSortHeroListData() end) Util.AddClick(this.fenJieBtn, function() - UIManager.OpenPanel(UIName.HandBookHeroAndEquipListPanel,1) + UIManager.OpenPanel(UIName.HandBookHeroAndEquipListPanel, 1) -- if ActTimeCtrlManager.SingleFuncState(24) then -- UIManager.OpenPanel(UIName.HeroAndEquipResolvePanel,1) -- else @@ -162,7 +164,7 @@ function RoleListPanel:BindEvent() end end) CheckRedPointStatus(RedPointType.LikeabilityRed) - BindRedPointObject(RedPointType.LikeabilityRed,this.haoganduRed) + BindRedPointObject(RedPointType.LikeabilityRed, this.haoganduRed) end --添加事件监听(用于子类重写) @@ -176,14 +178,14 @@ function RoleListPanel:RemoveListener() end function this:OnSortingOrderChange() - if this.ScrollView then - this.ScrollView:ForeachItemGO(function (index, go) - Util.SetParticleSortLayer(go, self.sortingOrder) - end) + if this.ScrollView then + this.ScrollView:ForeachItemGO(function(index, go) + Util.SetParticleSortLayer(go, self.sortingOrder) + end) end orginLayer = self.sortingOrder if this.BtView then - this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder }) + this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder }) end -- -- 头像层级 if this.playerInfoView then @@ -193,22 +195,20 @@ function this:OnSortingOrderChange() -- if this.UpView then -- SetParticleSortLayer(this.UpView,self.sortingOrder+2) -- end - end --界面打开时调用(用于子类重写) function RoleListPanel:OnShow() - --检测成员红点 CheckRedPointStatus(RedPointType.Role) - tarHero=HeroManager.GetAllHeroDatas() - teamHero=FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL) - this.isFirstOpen=true + tarHero = HeroManager.GetAllHeroDatas() + teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL) + this.isFirstOpen = true this.maxk:SetActive(true) - this.heroNumText:GetComponent("Text").text=string.format(Language[11821],#tarHero) + this.heroNumText:GetComponent("Text").text = string.format(Language[11821], #tarHero) this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.RoleInfo }) - this.BtView:OnOpen(self, {sortOrder = self.sortingOrder,panelType = PanelTypeView.MemberPanel}) + this.BtView:OnOpen(self, { sortOrder = self.sortingOrder, panelType = PanelTypeView.MemberPanel }) SoundManager.PlayMusic(SoundConfig.BGM_Main) sortType = HeroManager.heroListPanelSortID proId = HeroManager.heroListPanelProID @@ -229,14 +229,14 @@ function RoleListPanel:OnShow() -- 刷新一次编队战斗力 FormationManager.RefreshMainFormationPower() this.haogandu.gameObject:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.LikeAbility)) - local totalCurNum,totalLv,totalNum = LikabilityManager.GetTotalHeroLikeLv(-1) + local totalCurNum, totalLv, totalNum = LikabilityManager.GetTotalHeroLikeLv(-1) this.haoganduLv.text = totalLv --this.haogandu.gameObject:SetActive(true)--ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.LikeAbility)) end --组合当前选项数据 function this:GetCurSortHeroListData() - local heros = {} + local heros = {} if proId ~= ProIdConst.All then heros = HeroManager.GetHeroDataByProperty(proId) else @@ -247,17 +247,17 @@ function this:GetCurSortHeroListData() end function this:ChangeProId(id) - proId=id + proId = id end --设置英雄列表数据 function this:SetRoleList(_roleDatas) - roleDatas=_roleDatas + roleDatas = _roleDatas this:SortHeroDatas(_roleDatas) HeroManager.heroSortedDatas = roleDatas - this.heroNumText:GetComponent("Text").text=string.format(Language[11821],#_roleDatas) - this.ScrollView:SetData(_roleDatas, function (index, go) - this.SingleHeroDataShow(go, roleDatas[index]) + this.heroNumText:GetComponent("Text").text = string.format(Language[11821], #_roleDatas) + this.ScrollView:SetData(_roleDatas, function(index, go) + this.SingleHeroDataShow(go, roleDatas[index]) end) if this.isFirstOpen then @@ -270,66 +270,76 @@ function this:SetRoleList(_roleDatas) this.maxk:SetActive(false) end, 0.8):Start() end - orginLayer2 =self.sortingOrder + orginLayer2 = self.sortingOrder orginLayer = self.sortingOrder end -function this.SingleHeroDataShow(_go,_heroData) + +function this.SingleHeroDataShow(_go, _heroData) local heroData = _heroData - SetHeroBg(this.spLoader, Util.GetGameObject(_go.transform, "card"),Util.GetGameObject(_go.transform, "card/bg"),_heroData.star,heroData.heroConfig.Quality,this.sortingOrder + 1) + SetHeroBg(this.spLoader, Util.GetGameObject(_go.transform, "card"), Util.GetGameObject(_go.transform, "card/bg"), + _heroData.star, heroData.heroConfig.Quality, this.sortingOrder + 1) if HarmonyManager.IsChangeColor(heroData.dynamicId) then - Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" + Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = "" .. + heroData.lv .. "" elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) then - local temp= HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) - if temp.heroTid == 0 and temp.value > 0 then - Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" + local temp = HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) + if temp.heroTid == 0 and temp.value > 0 then + Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = "" .. + heroData.lv .. "" else Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = heroData.lv end else Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = heroData.lv end - - Util.GetGameObject(_go.transform, "card/name"):GetComponent("Text").text = GetLanguageStrById(heroData.heroConfig.ReadingName) - Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(heroData.heroConfig.ShowLive)) - - SetHEeroLiveToward(Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image"),heroData.heroConfig.Toward) - Util.GetGameObject(_go.transform, "card/pos/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(heroData.professionIcon) - local imageCom=Util.GetGameObject(_go.transform, "card/pro/Image"):GetComponent("RectTransform") + + Util.GetGameObject(_go.transform, "card/name"):GetComponent("Text").text = GetLanguageStrById(heroData.heroConfig + .ReadingName) + Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite( + GetResourcePath(heroData.heroConfig.ShowLive)) + + SetHEeroLiveToward(Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image"), heroData.heroConfig.Toward) + Util.GetGameObject(_go.transform, "card/pos/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(heroData + .professionIcon) + local imageCom = Util.GetGameObject(_go.transform, "card/pro/Image"):GetComponent("RectTransform") --if heroData.changeProId == 1 or heroData.changeProId == 2 or heroData.changeProId == 3 or heroData.changeProId == 4 then - imageCom.sizeDelta=Vector2.New(30,30) - --else - -- imageCom.sizeDelta=Vector2.New(60,30) + imageCom.sizeDelta = Vector2.New(30, 30) + --else + -- imageCom.sizeDelta=Vector2.New(60,30) --end - imageCom.gameObject:GetComponent("Image").sprite= this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.changeProId)) - Util.GetGameObject(_go.transform, "card/heroStage"):GetComponent("Image").sprite = this.spLoader:LoadSprite(HeroStageSprite[heroData.heroConfig.HeroStage]) + imageCom.gameObject:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroData + .changeProId)) + Util.GetGameObject(_go.transform, "card/heroStage"):GetComponent("Image").sprite = this.spLoader:LoadSprite( + HeroStageSprite[heroData.heroConfig.HeroStage]) Util.GetGameObject(_go.transform, "card/redAndLock"):SetActive(true) local redPoint = Util.GetGameObject(_go.transform, "card/redAndLock/redPoint") Util.GetGameObject(_go.transform, "card/redAndLock/lockImage"):SetActive(heroData.lockState == 1) Util.GetGameObject(_go.transform, "card/core"):SetActive(heroData.heroConfig.Main == 1) - Util.GetGameObject(_go.transform, "card/starnum"):GetComponent("Text").text=_heroData.star.."/".._heroData.maxStar + Util.GetGameObject(_go.transform, "card/starnum"):GetComponent("Text").text = _heroData.star .. + "/" .. _heroData.maxStar _go.transform.localScale = Vector3.one * 0.95 local starGrid = Util.GetGameObject(_go.transform, "star") local starPre = Util.GetGameObject(_go.transform, "starPre") --Util.ClearChild(starGrid.transform) - local star,starType = heroData.GetStar(1) - local starSize = Vector2.New(32.5,32.5) + local star, starType = heroData.GetStar(1) + local starSize = Vector2.New(32.5, 32.5) local starScale = -10 if starType == 3 then - starSize = Vector2.New(1,-16.12) + starSize = Vector2.New(1, -16.12) starScale = -13.2 elseif starType == 2 then - starSize = Vector2.New(60,57) + starSize = Vector2.New(60, 57) end - -- SetHeroStars(this.spLoader, starGrid, star,starType,starSize,starScale) + SetHeroStars(this.spLoader, starGrid, star, starType, starSize, starScale) Util.SetParticleSortLayer(starGrid, this.sortingOrder + 1) --local cardBtn = Util.GetGameObject(_go.transform, "card(Clone)") SoulPrintManager.UnLockSoulPrintPos(heroData) - local soulPrintIsOpen = table.nums(SoulPrintManager.hasUnlockPos)>=1 - if teamHero[heroData.dynamicId]~=nil then + local soulPrintIsOpen = table.nums(SoulPrintManager.hasUnlockPos) >= 1 + if teamHero[heroData.dynamicId] ~= nil then Util.GetGameObject(_go.transform, "card/choosed"):SetActive(true) local isCanShowSoulPrintPoint = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. heroData.dynamicId) soulPrintData = SoulPrintManager.GetSoulPrintAndSort(SoulPrintManager.soulPrintData) - redPoint:SetActive(HeroManager.GetCurHeroIsShowRedPoint(heroData)) + redPoint:SetActive(HeroManager.GetCurHeroIsShowRedPoint(heroData)) else redPoint:SetActive(false) Util.GetGameObject(_go.transform, "card/choosed"):SetActive(false) @@ -337,14 +347,15 @@ function this.SingleHeroDataShow(_go,_heroData) --Util.GetGameObject(_go.transform, "card/choosed"):SetActive(teamHero[heroData -- .dynamicId]~=nil) Util.AddOnceClick(Util.GetGameObject(_go.transform, "card"), function() - this.OnClickEnterHeroInfo(heroData, HeroManager.heroSortedDatas,teamHero[heroData.dynamicId]~=nil) + this.OnClickEnterHeroInfo(heroData, HeroManager.heroSortedDatas, teamHero[heroData.dynamicId] ~= nil) end) end + function this:SetSelectBtn() this.selectBtn.transform:SetParent(tabs[proId].transform) this.selectBtn:GetComponent("RectTransform").localPosition = Vector3.zero this.selectBtn.transform:SetAsFirstSibling() - -- Util.GetGameObject( this.selectBtn.transform, "Text"):GetComponent("Text").text=Util.GetGameObject( t abs[proId].transform, "Text"):GetComponent("Text").text + -- Util.GetGameObject( this.selectBtn.transform, "Text"):GetComponent("Text").text=Util.GetGameObject( t abs[proId].transform, "Text"):GetComponent("Text").text end function this:SortHeroDatas(_heroDatas) @@ -368,16 +379,16 @@ function this:SortHeroDatas(_heroDatas) return a.star > b.star end else - return aGodLv >bGodLv - end + return aGodLv > bGodLv + end else return a.warPower > b.warPower end else return a.lv > b.lv end - --根据品阶排列 - elseif sortType==SortTypeConst.Natural then + --根据品阶排列 + elseif sortType == SortTypeConst.Natural then local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId) local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId) if aGodLv == bGodLv then @@ -399,23 +410,23 @@ function this:SortHeroDatas(_heroDatas) return a.star > b.star end else - return aGodLv >bGodLv - end + return aGodLv > bGodLv + end end else - --一个在一个不在先返回在的+不在的 + --一个在一个不在先返回在的+不在的 return teamHero[a.dynamicId] and not teamHero[b.dynamicId] end end) end -function this.OnClickEnterHeroInfo(_curhero, _heros,isUpZhen) - UIManager.OpenPanel(UIName.RoleInfoPanel, _curhero, _heros,isUpZhen) +function this.OnClickEnterHeroInfo(_curhero, _heros, isUpZhen) + UIManager.OpenPanel(UIName.RoleInfoPanel, _curhero, _heros, isUpZhen) end function this.GetRoleItemByName(name) local targetItem - this.ScrollView:ForeachItemGO(function (index, go) + this.ScrollView:ForeachItemGO(function(index, go) local itemName = Util.GetGameObject(go.transform, "card/name"):GetComponent("Text").text if Util.GetGameObject(go.transform, "card/choosed").activeInHierarchy then if not targetItem and name == itemName then @@ -432,12 +443,11 @@ end --界面关闭时调用(用于子类重写) function RoleListPanel:OnClose() - proId=0--面板关闭时 重置筛选按钮为全部 + proId = 0 --面板关闭时 重置筛选按钮为全部 if isFristOpenTime then isFristOpenTime:Stop() isFristOpenTime = nil end - end --界面销毁时调用(用于子类重写) @@ -452,9 +462,7 @@ function RoleListPanel:OnDestroy() SubUIManager.Close(this.playerInfoView) this.playerInfoView = nil end - ClearRedPointObject(RedPointType.LikeabilityRed,this.haoganduRed) - + ClearRedPointObject(RedPointType.LikeabilityRed, this.haoganduRed) end return RoleListPanel - diff --git a/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua b/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua index 34e3ab9b7e..4b9a63e157 100644 --- a/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Shop/MainShopPanel.lua @@ -3,38 +3,60 @@ local MainShopPanel = Inherit(BasePanel) local this = MainShopPanel -- Tab管理器 local TabBox = require("Modules/Common/TabBox") -local _Tab2Sprite = {default = "x1_haoyou_biaoqian_weixuanzhong", select = "x1_haoyou_biaoqian_xuanzhong", lock = "s_shop_qieye_1"} -local _Tab2FontColor = { default = Color.New(255 / 255, 255 / 255, 255 / 255, 1), - lock = Color.New(255 / 255, 255 / 255, 255 / 255, 1), - select = Color.New(255 / 255, 255 / 255, 255 / 255, 1) } +local _Tab2Sprite = { + default = "x1_haoyou_biaoqian_weixuanzhong_quekou", + select = "x1_haoyou_biaoqian_xuanzhong", + lock = + "s_shop_qieye_1" +} +local _Tab2FontColor = { + default = Color.New(255 / 255, 255 / 255, 255 / 255, 1), + lock = Color.New(255 / 255, 255 / 255, 255 / 255, 1), + select = Color.New(255 / 255, 255 / 255, 255 / 255, 1) +} local _ShopTypeConfig = ConfigManager.GetConfig(ConfigName.StoreTypeConfig) local _ShopPage = { - [SHOP_PAGE.RECHARGE] = { -- 充值 - default = "UI_hz_gonghui_31", lock = "UI_hz_gonghui_31", select = "UI_hz_gonghui_31", - rpType = RedPointType.Shop_Page_Recharge,name="充值商店" + [SHOP_PAGE.RECHARGE] = { -- 充值 + default = "UI_hz_gonghui_31", + lock = "UI_hz_gonghui_31", + select = "UI_hz_gonghui_31", + rpType = RedPointType.Shop_Page_Recharge, + name = "充值商店" }, - [SHOP_PAGE.GENERAL] = { -- 杂货 - default = "UI_hz_gonghui_32", lock = "UI_hz_gonghui_32", select = "UI_hz_gonghui_32", - rpType = RedPointType.Shop_Page_General,name="杂货商店" + [SHOP_PAGE.GENERAL] = { -- 杂货 + default = "UI_hz_gonghui_32", + lock = "UI_hz_gonghui_32", + select = "UI_hz_gonghui_32", + rpType = RedPointType.Shop_Page_General, + name = "杂货商店" }, - [SHOP_PAGE.COIN] ={ -- 代币 - default = "UI_hz_gonghui_33", lock = "UI_hz_gonghui_33", select = "UI_hz_gonghui_33", - rpType = RedPointType.Shop_Page_Coin,name="代币商店" + [SHOP_PAGE.COIN] = { -- 代币 + default = "UI_hz_gonghui_33", + lock = "UI_hz_gonghui_33", + select = "UI_hz_gonghui_33", + rpType = RedPointType.Shop_Page_Coin, + name = "代币商店" }, - [SHOP_PAGE.PLAY] = { -- 玩法 - default = "UI_hz_gonghui_34", lock = "UI_hz_gonghui_34", select = "UI_hz_gonghui_34", - rpType = RedPointType.Shop_Page_Play,name="玩法商店" + [SHOP_PAGE.PLAY] = { -- 玩法 + default = "UI_hz_gonghui_34", + lock = "UI_hz_gonghui_34", + select = "UI_hz_gonghui_34", + rpType = RedPointType.Shop_Page_Play, + name = "玩法商店" }, - [SHOP_PAGE.EXCHANGE] = { -- 兑换 - default = "UI_hz_gonghui_31", lock = "UI_hz_gonghui_31", select = "UI_hz_gonghui_31",name="兑换商店" + [SHOP_PAGE.EXCHANGE] = { -- 兑换 + default = "UI_hz_gonghui_31", lock = "UI_hz_gonghui_31", select = "UI_hz_gonghui_31", name = "兑换商店" }, - [SHOP_PAGE.JUMPSERVER] = { -- 云游 - default = "UI_hz_gonghui_32", lock = "UI_hz_gonghui_32", select = "UI_hz_gonghui_32", - rpType = RedPointType.Shop_Page_Roam,name="宇宙生存挑战" + [SHOP_PAGE.JUMPSERVER] = { -- 云游 + default = "UI_hz_gonghui_32", + lock = "UI_hz_gonghui_32", + select = "UI_hz_gonghui_32", + rpType = RedPointType.Shop_Page_Roam, + name = "宇宙生存挑战" }, - [SHOP_PAGE.YUANSHEN] = { -- 元神 - default = "UI_hz_gonghui_33", lock = "UI_hz_gonghui_33", select = "UI_hz_gonghui_33",name="元神商店" + [SHOP_PAGE.YUANSHEN] = { -- 元神 + default = "UI_hz_gonghui_33", lock = "UI_hz_gonghui_33", select = "UI_hz_gonghui_33", name = "元神商店" }, } @@ -70,8 +92,9 @@ function MainShopPanel:InitComponent() BindRedPointObject(RedPointType.VIP_SHOP_DETAIL, this.vipRedPoint) -- 上部货币显示 - this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform, { showType = UpViewOpenType.ShowLeft}) + this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform, { showType = UpViewOpenType.ShowLeft }) end + --绑定事件(用于子类重写) function MainShopPanel:BindEvent() -- 初始化Tab管理器 @@ -87,24 +110,23 @@ function MainShopPanel:BindEvent() -- 关闭界面打开主城 Util.AddClick(this.btnBack, function() - ShopManager.SetSelectIndex(0,{}) + ShopManager.SetSelectIndex(0, {}) PlaySoundWithoutClick(SoundConfig.Sound_UICancel) --UIManager.OpenPanel(UIName.MainPanel) this:ClosePanel() end) -- 打开特权详情 - Util.AddClick(this.vipDetailBtn, function () + Util.AddClick(this.vipDetailBtn, function() UIManager.OpenPanel(UIName.VipPanelV2) end) - - end --添加事件监听(用于子类重写) function MainShopPanel:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.SetVipPartInfo) end + --移除事件监听(用于子类重写) function MainShopPanel:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.SetVipPartInfo) @@ -128,7 +150,7 @@ function MainShopPanel:OnOpen(chooseShopType) chooseShopType = chooseShopType or SHOP_TYPE.SOUL_STONE_SHOP -- 默认打开魂晶商店 if not ShopManager.IsActive(chooseShopType) then PopupTipPanel.ShowTip(Language[11886]) - chooseShopType = SHOP_TYPE.SOUL_STONE_SHOP --商店未激活,打开充值商店 + chooseShopType = SHOP_TYPE.SOUL_STONE_SHOP --商店未激活,打开充值商店 end -- 获取默认页index local shopPage = ShopManager.GetShopPageByShopType(chooseShopType) @@ -147,7 +169,6 @@ function MainShopPanel:OnOpen(chooseShopType) end end assert(this._ChoosePageIndex and this._ChooseShopIndex, Language[11887]) - end -- 打开,重新打开时回调 @@ -167,7 +188,7 @@ function MainShopPanel:OnShow() this._ChooseShopIndex = nil else local shopType = this._MainShopTypeList[this._CurShopIndex] - this.shopView:ShowShop(shopType,this.sortingOrder) + this.shopView:ShowShop(shopType, this.sortingOrder) end end @@ -184,12 +205,12 @@ function this.PageTabAdapter(tab, index, status) local img = Util.GetGameObject(tab, "img"):GetComponent("Image") local lock = Util.GetGameObject(tab, "lock") local redpot = Util.GetGameObject(tab, "redpot") - local select = Util.GetGameObject(tab, "select") - local Text=Util.GetGameObject(tab,"Text"):GetComponent("Text") + local select = Util.GetGameObject(tab, "select") + local Text = Util.GetGameObject(tab, "Text"):GetComponent("Text") local page = this._MainShopPageList[index] img.sprite = this.spLoader:LoadSprite(_ShopPage[page][status]) local islock = status == "lock" - select:SetActive(status=="select") + select:SetActive(status == "select") Util.SetGray(img.gameObject, islock) lock:SetActive(islock) Text.text = GetLanguageStrById(_ShopPage[page]["name"]) @@ -216,6 +237,7 @@ function this.PageTabIsLockCheck(index) end return false end + -- tab改变事件 function this.OnPageTabChange(index, lastIndex) this._CurPageIndex = index @@ -238,9 +260,9 @@ function this.OnPageTabChange(index, lastIndex) -- 二级页签只有一个的时候不显示 this.tabbox2:SetActive(#this._MainShopTypeList > 1) -- 初始化位置 - local contentWidth = GetPreferredWidth(this.tabbox2Content.transform)--LayoutUtility.GetPreferredWidth(this.tabbox2Content.transform) + local contentWidth = GetPreferredWidth(this.tabbox2Content.transform) --LayoutUtility.GetPreferredWidth(this.tabbox2Content.transform) local curPos = this.tabbox2Content.transform.localPosition - this.tabbox2Content.transform.localPosition = Vector3.New(contentWidth/2, curPos.y, curPos.z) + this.tabbox2Content.transform.localPosition = Vector3.New(contentWidth / 2, curPos.y, curPos.z) end -- 获取当前大页签下可用的小页签的序号 @@ -259,12 +281,12 @@ function this.ShopTabAdapter(tab, index, status) local img = Util.GetGameObject(tab, "Img"):GetComponent("Image") local name = Util.GetGameObject(tab, "Text"):GetComponent("Text") local redpot = Util.GetGameObject(tab, "redpot") - + img.sprite = this.spLoader:LoadSprite(_Tab2Sprite[status]) local shopType = this._MainShopTypeList[index] local shopInfo = ShopManager.GetShopInfoByType(shopType) name.text = GetLanguageStrById(shopInfo.Name) - + name.color = _Tab2FontColor[status] local islock = status == "lock" @@ -277,6 +299,7 @@ function this.ShopTabAdapter(tab, index, status) this.BindTabRedpot(shopType, redpot) end end + -- tab可用性检测 function this.ShopTabIsLockCheck(index) local shopType = this._MainShopTypeList[index] @@ -290,6 +313,7 @@ function this.ShopTabIsLockCheck(index) end return false end + -- tab改变事件 function this.OnShopTabChange(index, lastIndex) if this._CurShopIndex == index then return end @@ -300,7 +324,7 @@ function this.OnShopTabChange(index, lastIndex) -- 修改商品栏的位置 this.shopView:SetItemContentPosition(Vector3.New(0, 710, 0)) end - this.shopView:ShowShop(shopType,this.sortingOrder) + this.shopView:ShowShop(shopType, this.sortingOrder) -- 获取配置 local shopId = ShopManager.GetShopDataByType(shopType).id -- LogRed(shopId) @@ -325,7 +349,6 @@ function this.OnShopTabChange(index, lastIndex) this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = config.ResourcesBar }) end - -- 绑定数据 local _PageBindData = {} local _TabBindData = {} @@ -335,14 +358,15 @@ function this.BindPageRedpot(page, redpot) BindRedPointObject(rpType, redpot) _PageBindData[rpType] = redpot end + function this.ClearPageRedpot(page) -- 清除红点绑定 - if page then -- 清除某个 + if page then -- 清除某个 local rpType = _ShopPage[page].rpType if not rpType then return end ClearRedPointObject(rpType, _PageBindData[rpType]) _PageBindData[rpType] = nil - else -- 全部清除 + else -- 全部清除 for rpt, redpot in pairs(_PageBindData) do ClearRedPointObject(rpt, redpot) end @@ -370,6 +394,7 @@ function this.GetTabRPType(shopType) end return rpType end + --- 绑定红点 function this.BindTabRedpot(shopType, redpot) local rpType = this.GetTabRPType(shopType) @@ -377,15 +402,16 @@ function this.BindTabRedpot(shopType, redpot) BindRedPointObject(rpType, redpot) _TabBindData[rpType] = redpot end + --- 清除红点 function this.ClearTabRedpot(shopType) -- 清除红点绑定 - if shopType then -- 清除某个 + if shopType then -- 清除某个 local rpType = this.GetTabRPType(shopType) if not rpType then return end ClearRedPointObject(rpType, _TabBindData[rpType]) _TabBindData[rpType] = nil - else -- 全部清除 + else -- 全部清除 for rpt, redpot in pairs(_TabBindData) do ClearRedPointObject(rpt, redpot) end @@ -396,6 +422,7 @@ end --界面关闭时调用(用于子类重写) function MainShopPanel:OnClose() end + --界面销毁时调用(用于子类重写) function MainShopPanel:OnDestroy() this.spLoader:Destroy() @@ -434,8 +461,7 @@ function this.SetVipPartInfo() this.vipIconLevel.text = VipManager.GetVipLevel() this.vipHeroStar.sprite = this.spLoader:LoadSprite(VIP_LEVEL_REWARD[nextLevel]) this.vipProgress.fillAmount = VipManager.GetChargedNum() / nextLevelNeed - this.progressText.text = VipManager.GetChargedNum() .. "/" .. nextLevelNeed + this.progressText.text = VipManager.GetChargedNum() .. "/" .. nextLevelNeed end return MainShopPanel - diff --git a/Assets/ManagedResources/~Lua/View/ShopView.lua b/Assets/ManagedResources/~Lua/View/ShopView.lua index 5ae7523029..508527973f 100644 --- a/Assets/ManagedResources/~Lua/View/ShopView.lua +++ b/Assets/ManagedResources/~Lua/View/ShopView.lua @@ -1,4 +1,3 @@ - local _ShopTypeConfig = ConfigManager.GetConfig(ConfigName.StoreTypeConfig) -- 通用得商店逻辑 local ShopView = {} @@ -14,6 +13,7 @@ function this:New(gameObject) o.transform = gameObject.transform return o end + --初始化组件(用于子类重写) function this:InitComponent() self.spLoader = SpriteLoader.New() @@ -55,12 +55,12 @@ function this:InitComponent() self.titleBg = Util.GetGameObject(self.gameObject, "scrollbg/titlebg") self.titleImg = Util.GetGameObject(self.gameObject, "scrollbg/titlebg/title") self.titleText = Util.GetGameObject(self.gameObject, "scrollbg/titlebg/title/titleText") - self.helpBtn = Util.GetGameObject(self.gameObject, "scrollbg/titlebg/helpBtn")--scrollbg/titlebg/ + self.helpBtn = Util.GetGameObject(self.gameObject, "scrollbg/titlebg/helpBtn") --scrollbg/titlebg/ self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition -- 创建循环列表 if not self.ScrollView then self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollRoot.transform, - self.shopItem, nil, Vector2.New(1060, 1000), 1, 2, Vector2.New(25, 20)) + self.shopItem, nil, Vector2.New(1060, 1000), 1, 2, Vector2.New(25, 20)) self.ScrollView.moveTween.MomentumAmount = 1 self.ScrollView.moveTween.Strength = 2 end @@ -69,7 +69,7 @@ function this:InitComponent() -- 创建循环列表 if not self.RechargeScrollView then self.RechargeScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollRoot.transform, - self.rechargeShopItem, nil, Vector2.New(1000, 1024), 1, 3, Vector2.New(40, 10)) + self.rechargeShopItem, nil, Vector2.New(1000, 1024), 1, 3, Vector2.New(40, 10)) self.RechargeScrollView.moveTween.MomentumAmount = 1 self.RechargeScrollView.moveTween.Strength = 2 self.RechargeScrollView.gameObject.transform.localPosition = Vector3.New(0, -20, 0) @@ -77,7 +77,7 @@ function this:InitComponent() end end -local RefreshShop = function(isPopUp,currentTime,isAutoRecover,shopType) +local RefreshShop = function(isPopUp, currentTime, isAutoRecover, shopType) if (isPopUp ~= currentTime) and not isAutoRecover then local shopInfo = ShopManager.GetShopInfoByType(shopType) local costId, abcd = shopInfo.RefreshItem[1][1], shopInfo.RefreshItem[2] @@ -93,7 +93,7 @@ local RefreshShop = function(isPopUp,currentTime,isAutoRecover,shopType) RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. shopType, currentTime) end ShopManager.RequestRefreshShop(shopType, false) - end, Language[10731], Language[10732],nil,true) + end, Language[10731], Language[10732], nil, true) else ShopManager.RequestRefreshShop(shopType, false) end @@ -112,29 +112,29 @@ function this:BindEvent() if leftCount == -2 then PopupTipPanel.ShowTip(Language[11896]) elseif leftCount == 0 then - PopupTipPanel.ShowTip(Language[11897]) + PopupTipPanel.ShowTip(Language[11897]) else if shopType == SHOP_TYPE.SOUL_PRINT_SHOP then local itemlist = ShopManager.CheckShopItemList(self.ShopData.storeItem) local isShow = false - for k,v in pairs(itemlist) do + for k, v in pairs(itemlist) do local goods = ShopManager.GetShopItemGoodsInfo(v.id) local maxLimitCount = ShopManager.GetShopItemLimitBuyCount(v.id) - local con = ConfigManager.GetConfigData(ConfigName.ItemConfig,goods[1][1]) + local con = ConfigManager.GetConfigData(ConfigName.ItemConfig, goods[1][1]) if con.Quantity >= 6 and v.buyNum < maxLimitCount then isShow = true end - end + end if isShow then MsgPanel.ShowTwo("当前商店存在红色界神技,刷新后将会消失,是否确认刷新?", function() end, function() - RefreshShop(isPopUp,currentTime,isAutoRecover,shopType) - end, Language[10731], Language[10732],nil,false) + RefreshShop(isPopUp, currentTime, isAutoRecover, shopType) + end, Language[10731], Language[10732], nil, false) else - RefreshShop(isPopUp,currentTime,isAutoRecover,shopType) + RefreshShop(isPopUp, currentTime, isAutoRecover, shopType) end else - RefreshShop(isPopUp,currentTime,isAutoRecover,shopType) + RefreshShop(isPopUp, currentTime, isAutoRecover, shopType) end end -- 重置商店刷新按钮点击状态 @@ -142,24 +142,28 @@ function this:BindEvent() end) --帮助按钮 Util.AddOnceClick(self.helpBtn, function() - if self.ShopConfig.HelpId==0 then + if self.ShopConfig.HelpId == 0 then return end - UIManager.OpenPanel(UIName.HelpPopup, self.ShopConfig.HelpId , self.helpPosition.x,self.helpPosition.y+372)--因层级锚点原因,需手动调整高度 + UIManager.OpenPanel(UIName.HelpPopup, self.ShopConfig.HelpId, self.helpPosition.x, self.helpPosition.y + 372) --因层级锚点原因,需手动调整高度 end) end + --添加事件监听(用于子类重写) function this:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self) end + --移除事件监听(用于子类重写) function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self) end + --界面打开时调用(用于子类重写) function this:OnOpen(...) - + end + --界面关闭时调用(用于子类重写) function this:OnClose() self.spLoader:Destroy() @@ -169,11 +173,11 @@ function this:OnClose() self._TimeCounter = nil end - + -- 物品节点回收 if self._GoodsItemList then for _, item in pairs(self._GoodsItemList) do - Util.SetColor(item.gameObject, Color.New(1,1,1,1)) + Util.SetColor(item.gameObject, Color.New(1, 1, 1, 1)) Util.SetGray(item.gameObject, false) SubUIManager.Close(item) end @@ -214,7 +218,7 @@ end ---===================================内部函数======================================== -- 刷新商店内容显示 -function this:RefreshShopInfo(isRefresh, isTop,isAni) +function this:RefreshShopInfo(isRefresh, isTop, isAni) if self.ShopType == SHOP_TYPE.SOUL_STONE_SHOP then self.RechargeShopData = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DemonCrystal) else @@ -223,7 +227,7 @@ function this:RefreshShopInfo(isRefresh, isTop,isAni) self:RefreshLive() self:RefreshBase() - self:RefreshItemList(isRefresh,isTop,isAni) + self:RefreshItemList(isRefresh, isTop, isAni) -- 刷新商店的查看时间 ShopManager.RefreshShopCheckTime(self.ShopType) @@ -231,9 +235,9 @@ function this:RefreshShopInfo(isRefresh, isTop,isAni) if isRefresh then -- 物品节点播放特效 if self._GoodsItemList then - Timer.New(function () - PlaySoundWithoutClick("UI_refresh") - end,0.5):Start() + Timer.New(function() + PlaySoundWithoutClick("UI_refresh") + end, 0.5):Start() for _, item in pairs(self._GoodsItemList) do item:OnShowUIeffectItemViewSaoguang() end @@ -259,26 +263,24 @@ function this:RefreshLive() end local scale = self.ShopConfig.LiveScale scale = Vector3.New(scale[1], scale[2], scale[3]) - + local livePos = Vector3.zero if self.ShopConfig.LivePos then livePos.x = self.ShopConfig.LivePos[1] livePos.y = self.ShopConfig.LivePos[2] end - self.LiveName = self.ShopConfig.LiveName - self.liveNode = poolManager:LoadLive(self.ShopConfig.LiveName, self.liveRoot.transform, scale, livePos) - local SkeletonGraphic = self.liveNode:GetComponent("SkeletonGraphic") - local idle = function() - SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) - end - SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) - SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle - poolManager:SetLiveClearCall(self.ShopConfig.LiveName, self.liveNode, function() - SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle - end) - - + self.LiveName = self.ShopConfig.LiveName + self.liveNode = poolManager:LoadLive(self.ShopConfig.LiveName, self.liveRoot.transform, scale, livePos) + local SkeletonGraphic = self.liveNode:GetComponent("SkeletonGraphic") + local idle = function() + SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) + end + SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) + SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle + poolManager:SetLiveClearCall(self.ShopConfig.LiveName, self.liveNode, function() + SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle + end) end -- 开始倒计时 @@ -306,7 +308,7 @@ function this:StartTimeCount() -- if localSelf.ShopType == SHOP_TYPE.ACTIVITY_SHOP then -- timeStr = TimeToDHMS(closeTime) -- else - timeStr = TimeToHMS(closeTime) + timeStr = TimeToHMS(closeTime) -- end localSelf.closeTime:GetComponent("Text").text = timeStr end @@ -408,7 +410,7 @@ function this:RefreshBase() -- 商店标题 if self.ShopConfig.Title and self.ShopConfig.Title ~= "" then self.titleImg:GetComponent("Image").sprite = self.spLoader:LoadSprite(self.ShopConfig.Title) - self.titleText:GetComponent("Text").text = self.ShopConfig.Name.."商店" + self.titleText:GetComponent("Text").text = self.ShopConfig.Name .. "商店" end -- 对话显示 @@ -417,13 +419,12 @@ function this:RefreshBase() -- self.content:GetComponent("Text").text = self.ShopConfig.content -- self.contentBg.transform.localPosition = Vector3(self.ShopConfig.contentPos[1], self.ShopConfig.contentPos[2], 0) -- else - self.contentBg:SetActive(false) + self.contentBg:SetActive(false) -- end - end -- 刷新物品列表 -function this:RefreshItemList(isRefresh,isTop,isAni) +function this:RefreshItemList(isRefresh, isTop, isAni) if self.ShopType == SHOP_TYPE.SOUL_STONE_SHOP then self.ScrollView.gameObject:SetActive(false) self.RechargeScrollView.gameObject:SetActive(true) @@ -434,7 +435,7 @@ function this:RefreshItemList(isRefresh,isTop,isAni) -- if isPlayShow then -- shopItem.gameObject:SetActive(false) -- end - end, not isTop,not isAni) + end, not isTop, not isAni) -- if isPlayShow then -- SecTorPlayAnimByScroll(self.RechargeScrollView,0.03) -- isPlayShow = false @@ -450,13 +451,13 @@ function this:RefreshItemList(isRefresh,isTop,isAni) if isPlayShow then shopItem.gameObject:SetActive(true) end - end, not isTop,not isAni) + end, not isTop, not isAni) local curindex = 0 - for i = 1 ,#itemlist do + for i = 1, #itemlist do if self.ShopType == ShopManager.selectIndex.shopType then - for j = 1 , #ShopManager.selectIndex.storeId do + for j = 1, #ShopManager.selectIndex.storeId do if itemlist[i].id == ShopManager.selectIndex.storeId[j] then - ShopManager.SetSelectIndex(0,{},1) + ShopManager.SetSelectIndex(0, {}, 1) curindex = i break end @@ -468,7 +469,7 @@ function this:RefreshItemList(isRefresh,isTop,isAni) end if curindex ~= 0 then self.ScrollView:SetIndex(curindex) - end + end end end @@ -495,29 +496,31 @@ function this:ShopItemAdapter(shopItem, itemData) local new = Util.GetGameObject(shopItem, "GameObject/new") -- 计算数据 local itemInfo = ShopManager.GetShopItemInfo(itemData.id) - + local curBuyCount = itemData.buyNum local maxLimitCount = ShopManager.GetShopItemLimitBuyCount(itemData.id) local costId, price = ShopManager.calculateBuyCost(self.ShopType, itemData.id, 1) local goods = ShopManager.GetShopItemGoodsInfo(itemData.id) - local con = ConfigManager.GetConfigData(ConfigName.ItemConfig,goods[1][1]) - itemName.text = SubString2(GetLanguageStrById(con.Name),8) + local con = ConfigManager.GetConfigData(ConfigName.ItemConfig, goods[1][1]) + itemName.text = SubString2(GetLanguageStrById(con.Name), 8) if con.ItemType == ItemType.LingShouChip then local haveCount = BagManager.GetTotalItemNum(con.Id) - itemName.text = itemName.text.."\n"..string.format("%s(%s/%s)",UIColorStr.BLACK, "25", "拥有:", haveCount, con.UsePerCount) + itemName.text = itemName.text .. + "\n" .. + string.format("%s(%s/%s)", UIColorStr.BLACK, "25", "拥有:", haveCount, + con.UsePerCount) end if con.ItemType == ItemType.Talisman then itemDes.gameObject:SetActive(true) if con.ItemDescribe then - local str=string.split(con.ItemDescribe,',') - if str[1] then - itemDes.text=str[1] - end + local str = string.split(con.ItemDescribe, ',') + if str[1] then + itemDes.text = str[1] + end else itemDes.gameObject:SetActive(false) end - else itemDes.gameObject:SetActive(false) end @@ -530,11 +533,12 @@ function this:ShopItemAdapter(shopItem, itemData) local isDiscount = itemInfo.IsDiscount == 1 discountbg:SetActive(isDiscount) if isDiscount then - discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_0" .. itemInfo.DiscountDegree.."_zh") + discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_0" .. + itemInfo.DiscountDegree .. "_zh") end end -- 消耗物品的信息 - itemPrice.text = PrintWanNum2(tonumber(price))--tostring(price) + itemPrice.text = PrintWanNum2(tonumber(price)) --tostring(price) costIcon.sprite = SetIcon(self.spLoader, costId) -- 判断商品栏位是否解锁 @@ -552,8 +556,8 @@ function this:ShopItemAdapter(shopItem, itemData) -- -- 限购 limitBg:SetActive(maxLimitCount ~= -1) - limitTip.text =Language[12037].." "..maxLimitCount - SetTextVerTial(limitTip,Vector3.New(12.65,-4.2,0),"MiddleLeft") + limitTip.text = Language[12037] .. " " .. maxLimitCount + SetTextVerTial(limitTip, Vector3.New(12.65, -4.2, 0), "MiddleLeft") -- 售空 限购次数为-1 表示不限购 local isEmpty = maxLimitCount ~= -1 and curBuyCount >= maxLimitCount if curBuyCount >= maxLimitCount then @@ -571,26 +575,31 @@ function this:ShopItemAdapter(shopItem, itemData) self._GoodsItemList[shopItem] = SubUIManager.Open(SubUIConfig.ItemView, item.transform) end Util.SetGray(self._GoodsItemList[shopItem].gameObject, not _IsUnLock) - if isEmpty or not _IsUnLock then -- 物品空或者未解锁不现实物品特效 - self._GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false) + if isEmpty or not _IsUnLock then -- 物品空或者未解锁不现实物品特效 + self._GoodsItemList[shopItem]:OnOpen(false, goods[1], 1, false, false, false) else - self._GoodsItemList[shopItem]:OnOpen(false, goods[1],1,false,false,false,this.sortingOrder) + self._GoodsItemList[shopItem]:OnOpen(false, goods[1], 1, false, false, false, this.sortingOrder) end -- 商品颜色显示 local imgColor = isEmpty and Color.New(0.5, 0.5, 0.5, 1) or Color.New(1, 1, 1, 1) local textA = isEmpty and 0.7 or 1 Util.SetColor(bg, imgColor) + local bgImage = Util.GetGameObject(bg, "Image") + imgColor = isEmpty and Color.New(0.5, 0.5, 0.5, 1) or Color.New(0.54, 0.38, 0.81, 1) + local pricebg = Util.GetGameObject(bg, "pricebg"):GetComponent("Image") + pricebg.color =isEmpty and Color.New(0.1, 0.1, 0.1, 1) or Color.New(0.15, 0.15, 0.15, 1) + Util.SetColor(bgImage, imgColor) SetAlpha(itemName, textA) --SetAlpha(limitTip, textA) SetAlpha(itemPrice, textA) local isshow = false - if self.ShopType == ShopManager.selectIndex2.shopType then - for j = 1 , #ShopManager.selectIndex2.storeId do + if self.ShopType == ShopManager.selectIndex2.shopType then + for j = 1, #ShopManager.selectIndex2.storeId do if itemData.id == ShopManager.selectIndex2.storeId[j] then isshow = true break - end + end end end if isshow then @@ -614,7 +623,7 @@ function this:ShopItemAdapter(shopItem, itemData) -- Util.SetColor(bg, Color.New(0.5, 0.5, 0.5, 1)) -- end -- end - + -- 购买事件 Util.AddOnceClick(lock, function() @@ -625,9 +634,9 @@ function this:ShopItemAdapter(shopItem, itemData) end) Util.AddOnceClick(bg, function() -- if con.ItemType == ItemType.Incarnation then - -- local num = BagManager.GetItemCountById(con.Id) + -- local num = BagManager.GetItemCountById(con.Id) -- if num > 0 or IncarnationManager.GetStatusByItemId(con.Id) >= 0 then - -- PopupTipPanel.ShowTip("无法选择已获取过的奥义卡!") + -- PopupTipPanel.ShowTip("无法选择已获取过的奥义卡!") -- return -- end -- end @@ -665,36 +674,34 @@ function this:RechargeShopItemAdapter(shopItem, itemData) local curBuyCount = itemData.buyTimes first:SetActive(curBuyCount < 1) firstNum.text = itemInfo.FirstMultiple[1][2] - if itemInfo.ContinuedMultiple and tonumber(itemInfo.ContinuedMultiple[1])~=nil then - xuChong:SetActive(curBuyCount>=1) - xuNum.text=itemInfo.ContinuedMultiple[2] + if itemInfo.ContinuedMultiple and tonumber(itemInfo.ContinuedMultiple[1]) ~= nil then + xuChong:SetActive(curBuyCount >= 1) + xuNum.text = itemInfo.ContinuedMultiple[2] else xuChong:SetActive(false) end - + -- 购买事件 Util.AddOnceClick(shopItem, function() PayManager.Pay(itemData.goodsId, function(id) self:RechargeSuccessFunc(itemData.goodsId) end) end) - - end -- 充值成功回调 function this:RechargeSuccessFunc(id) FirstRechargeManager.RefreshAccumRechargeValue(id) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id) - self:RefreshShopInfo(false, false,true) + self:RefreshShopInfo(false, false, true) --PopupTipPanel.ShowTip("购买成功,请到邮箱中领取!") - CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包红点检测 + CheckRedPointStatus(RedPointType.GrowthPackage) --成长礼包红点检测 end ---=====================================对外接口=============================---- -- 设置要显示的商店类型 -function this:ShowShop(shopType,_sortingOrder) - self.ScrollView:ForeachItemGO(function (index, go) +function this:ShowShop(shopType, _sortingOrder) + self.ScrollView:ForeachItemGO(function(index, go) go.gameObject:SetActive(false) end) -- self.titleBg:GetComponent("Canvas").sortingOrder = _sortingOrder + 1 @@ -724,7 +731,7 @@ function this:ShowShop(shopType,_sortingOrder) self.ShopConfig = _ShopTypeConfig[self.ShopId] -- 显示帮助按钮 self.helpBtn:SetActive(self.ShopConfig.HelpId ~= 0) - self:RefreshShopInfo(false, true,true) + self:RefreshShopInfo(false, true, true) -- 设置tip显隐 local isSSSHop = self.ShopType == SHOP_TYPE.SOUL_STONE_SHOP --self.scrollBg1:SetActive(false) @@ -767,16 +774,16 @@ function this:SetSortLayer(sortLayer) if not self._GoodsItemList then self._GoodsItemList = {} end - -- + -- -- Log("sortLayer _GoodsItemList "..sortLayer.." "..LengthOfTable(self._GoodsItemList)) for _, item in pairs(self._GoodsItemList) do - item:SetEffectLayer(sortLayer)--this.sortingOrder) + item:SetEffectLayer(sortLayer) --this.sortingOrder) end - + -- self.titleBg:GetComponent("Canvas").sortingOrder = sortLayer + 1 - + -- 保存层级 this.sortingOrder = sortLayer end -return this \ No newline at end of file +return this