【自选宝箱】还是修改

dev_chengFeng
ZhangBiao 2021-04-08 15:36:27 +08:00
parent a7328fdfaf
commit 89c8179840
2 changed files with 45 additions and 18 deletions

View File

@ -1129,6 +1129,7 @@ GameObject:
- component: {fileID: 5247935428401062656}
- component: {fileID: 4469237718377244165}
- component: {fileID: 8598351590046701246}
- component: {fileID: 5041373642146469403}
m_Layer: 5
m_Name: selectBtn
m_TagString: Untagged
@ -1150,9 +1151,9 @@ RectTransform:
m_Father: {fileID: 637834703727152052}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 135, y: -50}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -315, y: 0}
m_SizeDelta: {x: 130, y: 130}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4469237718377244165
@ -1192,6 +1193,26 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &5041373642146469403
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2749384115574582686}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &2790987625313459491
GameObject:
m_ObjectHideFlags: 0

View File

@ -47,11 +47,6 @@ function RewardBoxPanel:InitComponent()
this.ScrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 2
this.selectList ={}
for n = 1, this.selectBar.transform.childCount-1 do--设置当前页签
table.insert(this.selectList,this.selectBar.transform:GetChild(n).gameObject)
end
end
--绑定事件(用于子类重写)
function RewardBoxPanel:BindEvent()
@ -83,16 +78,6 @@ function RewardBoxPanel:BindEvent()
Util.AddClick(this.btnOk, function()
this:ClosePanel()
end)
for i = 1, #this.selectList do
Util.AddClick(this.selectList[i],function()
curId = 0
tagNum = i
RewardBoxPanel:SetGiftData()
this.selectBtn.transform:SetParent(this.selectList[i].transform)
this.selectBtn.transform.localPosition = Vector3.zero
this.selectBtn.transform.localScale = Vector3.one
end)
end
end
--添加事件监听(用于子类重写)
@ -117,6 +102,25 @@ function RewardBoxPanel:OnOpen(...)
this.scroll.gameObject:GetComponent("RectTransform").sizeDelta = #this.rewardGroup ~= 1 and Vector2.New(940, 836.8) or Vector2.New(940, 900)
this.scroll.gameObject:GetComponent("RectTransform").anchoredPosition = #this.rewardGroup ~= 1 and Vector2.New(0, 376) or Vector2.New(0, 444)
this.ScrollView.gameObject:GetComponent("RectTransform").sizeDelta = #this.rewardGroup ~= 1 and Vector2.New(940, 830) or Vector2.New(940, 900)
this.selectList ={}
for n = 1, this.selectBar.transform.childCount-1 do--设置当前页签
table.insert(this.selectList,this.selectBar.transform:GetChild(n).gameObject)
end
this.selectBtn.transform:SetParent(this.selectList[1].transform)
this.selectBtn.transform.localPosition = Vector3.zero
this.selectBtn.transform.localScale = Vector3.one
for i = 1, #this.selectList do
Util.AddOnceClick(this.selectList[i],function()
curId = 0
tagNum = i
RewardBoxPanel:SetGiftData()
this.selectBtn.transform:SetParent(this.selectList[i].transform)
this.selectBtn.transform.localPosition = Vector3.zero
this.selectBtn.transform.localScale = Vector3.one
end)
end
end
-- 打开,重新打开时回调
@ -238,6 +242,7 @@ end
--界面关闭时调用(用于子类重写)
function RewardBoxPanel:OnClose()
this.selectList ={}
curNum = 1
this.selectBtn.transform.parent = this.selectBar.transform:GetChild(0).transform
this.selectBtn.transform.localPosition = Vector3.zero
@ -246,6 +251,7 @@ end
--界面销毁时调用(用于子类重写)
function RewardBoxPanel:OnDestroy()
this.selectList ={}
itemIconList={}
goList = {}
end