ID1010436】

【优化】好感度增加通用礼物 及界面优化
dev_chengFeng
jiaoyangna 2021-10-11 15:15:34 +08:00
parent 4ff2e1dc8d
commit 750f4afaef
1 changed files with 28 additions and 4 deletions

View File

@ -75,9 +75,15 @@ function HeroLikeAbilityPanel:InitComponent()
FixedUpdateBeat:Add(self.OnUpdate, self)--长按方法注册
self.itemList = {}
self.itemListNum = {}
self.proGrid2Pos = self.grid:GetComponent("RectTransform").anchoredPosition
end
function HeroLikeAbilityPanel:OnPointerDown1(go, data)
if self.isGiving then
PopupTipPanel.ShowTip("正在赠送中")
return
end
self.effect.gameObject:SetActive(false)
self.num = 0
self.numCount = 0
@ -314,8 +320,8 @@ function HeroLikeAbilityPanel:UpdateItemList(isChange)
self.itemList[i].pre.name = "itemPre"..i
self.itemList[i].go = SubUIManager.Open(SubUIConfig.ItemView,self.itemList[i].pre.transform)
self.itemList[i].go.frameBtn:GetComponent("Button").enabled = false
self.itemList[i].data = items[i]
end
self.itemList[i].data = items[i]
self.itemList[i].pre.gameObject:SetActive(true)
self.itemList[i].go:OnOpen(false,{items[i].id,items[i].num},1,false,false,false,self.sortingOrder)
if items[i].num < 1 then
@ -342,20 +348,36 @@ function HeroLikeAbilityPanel:UpdateItemList(isChange)
end
if newid < 1 then
self.select.gameObject:SetActive(false)
if curselectId == 0 then
self.grid:GetComponent("RectTransform").anchoredPosition = self.proGrid2Pos
end
elseif curselectId ~= newid and (not self.itemListNum[curselectId] or self.itemListNum[curselectId] < 1) and not isChange then
curselectId = newid
self:SetSelectKuang(par)
local curIndx = 0
for i = 1,#self.itemList do
if self.itemList[i] and self.itemList[i].data and self.itemList[i].data.id == curselectId then
curIndx = i
break
end
end
self:SetSelectKuang(par,true,curIndx)
elseif self.itemListNum[curselectId] and self.itemListNum[curselectId] > 0 then
for i = 1,#self.itemList do
if self.itemList[i] and self.itemList[i].data and self.itemList[i].data.id == curselectId then
self:SetSelectKuang(self.itemList[i].pre)
self:SetSelectKuang(self.itemList[i].pre,true,i)
break
end
end
end
end
function HeroLikeAbilityPanel:SetSelectKuang(par)
function HeroLikeAbilityPanel:SetSelectKuang(par,isMove,index)
if isMove then
local pos = self.grid:GetComponent("RectTransform").anchoredPosition
pos.y = self.proGrid2Pos.y + (math.ceil(index/4) - 1) * (150 + 2.36)
self.grid:GetComponent("RectTransform").anchoredPosition = pos
end
Util.SetGray(self.select,false)
self.select.gameObject:SetActive(true)
self.select.transform:SetParent(par.transform)
self.select.transform.localPosition = Vector3.New(-7.5,3.5)
@ -518,6 +540,8 @@ function HeroLikeAbilityPanel:OnDestroy()
FixedUpdateBeat:Remove(self.OnUpdate, self)
self.itemListNum = {}
self.itemList = {}
self.grid:GetComponent("RectTransform").anchoredPosition = self.proGrid2Pos
end
return HeroLikeAbilityPanel