From 2e31e176cc2abaf083c1106010253aa9b81d71ef Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Tue, 23 Mar 2021 15:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E7=82=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Prefabs/UI/View/FetterItem.prefab | 75 +++++++++++++++++++ .../TianShuMiJuan/TianShuMiJuanMainPanel.lua | 2 +- .../TianShuMiJuan/TianShuMiJuanManger.lua | 9 ++- .../ManagedResources/~Lua/View/FetterItem.lua | 13 ++-- 4 files changed, 89 insertions(+), 10 deletions(-) diff --git a/Assets/ManagedResources/Prefabs/UI/View/FetterItem.prefab b/Assets/ManagedResources/Prefabs/UI/View/FetterItem.prefab index ef1bd97ace..3cfa48ebcb 100644 --- a/Assets/ManagedResources/Prefabs/UI/View/FetterItem.prefab +++ b/Assets/ManagedResources/Prefabs/UI/View/FetterItem.prefab @@ -697,6 +697,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 7185264973662528582} + - {fileID: 8498858578554701288} m_Father: {fileID: 5391102142789844470} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -930,3 +931,77 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8847800419531988836} m_CullTransparentMesh: 0 +--- !u!1 &9126236200265870736 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8498858578554701288} + - component: {fileID: 7123703772357779440} + - component: {fileID: 7061610597073641278} + m_Layer: 5 + m_Name: redpot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8498858578554701288 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9126236200265870736} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4101560413708203383} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 99.2, y: 24.99} + m_SizeDelta: {x: 25, y: 25} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7123703772357779440 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9126236200265870736} + m_CullTransparentMesh: 0 +--- !u!114 &7061610597073641278 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9126236200265870736} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 21300000, guid: f9ea4c4aff328ff4abcc21aae0a4fa10, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 diff --git a/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanMainPanel.lua index 35ee822e05..97bb8f8c21 100644 --- a/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanMainPanel.lua @@ -196,7 +196,7 @@ function TianShuMiJuanMainPanel:SetSingleData(go,item,index) return end go.gameObject:SetActive(true) - self.itemPreList[go]:SetData(item,self:SortData) + self.itemPreList[go]:SetData(item,self) end --界面关闭时调用(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanManger.lua b/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanManger.lua index ff251afcaf..9353db68b3 100644 --- a/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanManger.lua +++ b/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanManger.lua @@ -27,11 +27,11 @@ end function this.CheckRedPointType(redType) if redType == RedPointType.Hero_Fetter then - this.CheckRedPoint(1) + return this.CheckRedPoint(1) elseif redType == RedPointType.SoulPrint_Fetter then - this.CheckRedPoint(2) + return this.CheckRedPoint(2) elseif redType == RedPointType.TianShuPokemon_Fetter then - this.CheckRedPoint(3) + return this.CheckRedPoint(3) end end @@ -63,6 +63,9 @@ function this.UpdateFetterId(ids) this.fetterData[ids[i]].enabled = 1 end end + this.CheckFetterStatus(1) + this.CheckFetterStatus(2) + this.CheckFetterStatus(3) end --检测条件变化,判断羁绊是否可激活 diff --git a/Assets/ManagedResources/~Lua/View/FetterItem.lua b/Assets/ManagedResources/~Lua/View/FetterItem.lua index c42fa5929b..3973b7d752 100644 --- a/Assets/ManagedResources/~Lua/View/FetterItem.lua +++ b/Assets/ManagedResources/~Lua/View/FetterItem.lua @@ -1,6 +1,6 @@ FetterItem = {} local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) -local func +local parent function FetterItem:New(gameObject) local b = {} b.gameObject = gameObject @@ -14,6 +14,7 @@ function FetterItem:InitComponent() self.grid = Util.GetGameObject(self.gameObject,"scroll") self.tipText = Util.GetGameObject(self.gameObject,"tipText"):GetComponent("Text") self.activeBtn = Util.GetGameObject(self.gameObject,"activeBtn") + self.activeBtnRed = Util.GetGameObject(self.gameObject,"redpot") self.reward = Util.GetGameObject(self.gameObject,"reward") self.rewardIcon = Util.GetGameObject(self.reward,"icon"):GetComponent("Image") self.rewardNum = Util.GetGameObject(self.reward,"num"):GetComponent("Text") @@ -35,9 +36,7 @@ function FetterItem:BindEvent() local newWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = newWarPower}) --self:SetIcon(1) - if func then - func() - end + parent:RefreshData() end) end) end @@ -52,8 +51,8 @@ function FetterItem:RemoveListener() end function FetterItem:OnOpen() end -function FetterItem:SetData(data,_func) - func = _func +function FetterItem:SetData(data,_parent) + parent = _parent self.itemData = data self.name.text = self.itemData.name if self.itemData.enabled < 1 then @@ -94,9 +93,11 @@ function FetterItem:SetIcon(status) self.active.gameObject:SetActive(false) if status == 0 then Util.SetGray(self.activeBtn,false) + self.activeBtnRed.gameObject:SetActive(true) self.activeBtn:GetComponent("Button").enabled = true else Util.SetGray(self.activeBtn,true) + self.activeBtnRed.gameObject:SetActive(false) self.activeBtn:GetComponent("Button").enabled = false end end