【皮肤】提交

dev_chengFeng
jiaoyangna 2020-11-05 16:02:49 +08:00
parent 3bc2b74ce5
commit 5026bdd0c3
4 changed files with 87 additions and 36 deletions

View File

@ -297,6 +297,43 @@ function this.GetHeroDataByHeroSIdAndMinSortId(_heroSId)
end
return heroData
end
--获取该静态id 没有穿皮肤的 sortid最小的英雄信息
function this.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(_heroSId,_skinId)
local heroData = {}
local formationList = FormationManager.GetAllFormationHeroId()
for i, v in pairs(formationList) do
if heroDatas[i] then
local curData = heroDatas[i]
if curData.id == _heroSId and curData.skinId ~= _skinId then
if heroData and heroData.id then
if curData.sortId < heroData.sortId then
heroData = curData
end
else
heroData = curData
end
end
end
end
if heroData and heroData.id then
return heroData
end
for i, v in pairs(heroDatas) do
if v.id == _heroSId and v.skinId ~= _skinId then
if heroData and heroData.id then
if v.sortId < heroData.sortId then
heroData = v
end
else
heroData = v
end
end
end
LogPink("heroData.dynamicId:"..heroData.dynamicId)
return heroData
end
--获取所有英雄信息(分解 回溯用
function this.GetAllHeroDataMsinusUpWar(_sortTypeId,type) --0全部 1-6属性 7-9 3、4、5星
local heros = {}
@ -3301,6 +3338,7 @@ end
function this.ChangeDownSkinId(heroSId,skinId)
for k,v in pairs(heroDatas) do
if v.id == heroSId and v.skinId == skinId then
NetManager.ChangeHeroSkin(v.dynamicId,0,function() end)
v.skinId = 0
v.skinConfig = heroConfig[v.id]
v.live = GetResourcePath(v.skinConfig.Live)

View File

@ -94,15 +94,21 @@ function RewardItemSingleShowPopup:BindEvent()
end)
Util.AddClick(this.btnJump, function()
if itemConfigData.ItemType == ItemType.Skin then
local skinId = ConfigManager.GetConfigData(ConfigName.HeroSkin,itemSid).Type
if HeroSkinManager.IsExist(skinId) then
local skinConfig = ConfigManager.GetConfigData(ConfigName.HeroSkin,itemSid)
if HeroSkinManager.IsExist(skinConfig.Type) then
PopupTipPanel.ShowTip("已解锁该皮肤,请在皮肤有效期之后再解锁")
else
local curResolveAllItemList = {}
table.insert(curResolveAllItemList,{itemId = itemSid,itemNum = 1})
NetManager.UseAndPriceItemRequest(0,curResolveAllItemList,function (drop)
PopupTipPanel.ShowTip("已成功解锁该皮肤,请去神将界面穿戴")
self:ClosePanel()
if HeroManager.GetCurHeroIsHaveBySid(skinConfig.HeroId) then
MsgPanel.ShowTwo(string.format("成功解锁皮肤%s是否前往更换",skinConfig.ReadingName),function() end,function()
local herodata = HeroManager.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(skinConfig.HeroId,skinConfig.Type)
LogGreen("herodata.dynamicId:"..tostring(herodata.dynamicId))
UIManager.OpenPanel(UIName.RoleInfoPanel,herodata, HeroManager.GetAllHeroDatas(),true,4)
end,"取消","确定","",false,"")
end
end)
end
elseif itemConfigData then
@ -227,13 +233,13 @@ function RewardItemSingleShowPopup:OnShow()
for i = 1, #jumpSortData do
if jumpSortData[i].id > 0 then
if not RECHARGEABLE then--(是否开启充值)
if this.isRewardItemPop == true or itemConfigData.Id == 61 or itemConfigData.Id == 19 then
if this.isRewardItemPop == true or itemConfigData.Id == 61 or itemConfigData.Id == 19 or itemConfigData.ItemType == 17 then
SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,false)
else
SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,true)
end
else
if this.isRewardItemPop == true then
if this.isRewardItemPop == true or itemConfigData.ItemType == 17 then
SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,false)
else
SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,true)

View File

@ -208,8 +208,13 @@ function RoleInfoPanel:RemoveListener()
end
--界面打开时调用(用于子类重写)
function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen)
function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen,_index)
curHeroData, heroDatas,isUpZhen = _curHeroData, _heroDatas,_isUpZhen
if _index and _index > 0 then
_CurPageIndex = _index
else
_CurPageIndex = 1
end
end
-- 打开,重新打开时回调
@ -219,7 +224,7 @@ function RoleInfoPanel:OnShow()
isClickLeftOrRightBtn = true
this.upLvEffect:SetActive(false)
for i = 1, #heroDatas do
if curHeroData == heroDatas[i] then
if curHeroData.dynamicId == heroDatas[i].dynamicId then
index = i
end
end

View File

@ -89,44 +89,46 @@ function RoleSkinPanel:SetSingleData(go,data)
porpertys[go][1].gameObject:SetActive(true)
Util.GetGameObject(porpertys[go][1],"info"):GetComponent("Text").text = "获取途径"
Util.AddOnceClick(porpertys[go][1].gameObject,function()
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, data.Id,function() end)
end)
lock.gameObject:SetActive(true)
end
if data.Type == curHeroData.skinId or (curHeroData.skinId == 0 and data.IsDefault == 1) then
self.Select.transform:SetParent(Util.GetGameObject(go,"skinState").transform)
self.Select:GetComponent("RectTransform").localPosition = Vector3.zero
elseif HeroSkinManager.IsExist(data.Type) or data.IsDefault == 1 then
local changeSkinId = data.IsDefault == 1 and 0 or data.Type
Util.AddOnceClick(go.gameObject,function()
NetManager.ChangeHeroSkin(curHeroData.dynamicId,changeSkinId,function()
poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj)
HeroManager.ChangeSkinId(curHeroData.dynamicId,changeSkinId)
curHeroData = HeroManager.GetSingleHeroData(curHeroData.dynamicId)
curLiveName = curHeroData.Live
parent.curLiveObj = HeroManager.LoadHerolive(curHeroData,parent.curObj)
PopupTipPanel.ShowTip("已更换皮肤!")
isUnLoadLive = false
this:OnShow(0,parent,curHeroData)
end)
end)
else
Util.AddOnceClick(go.gameObject,function()
poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj)
curLiveName = GetResourcePath(data.Live)
parent.curLiveObj = poolManager:LoadLive(GetResourcePath(data.Live), parent.curObj.transform,
Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0))
PopupTipPanel.ShowTip("未获得此皮肤!")
isUnLoadLive = true
end)
end
Util.AddOnceClick(go.gameObject,function()
local skinId = data.IsDefault == 1 and 0 or data.Type
this:BtnAction(skinId,data)
end)
end
function RoleSkinPanel:BtnAction(skinId,data)
if skinId == curHeroData.skinId then
return
end
if HeroSkinManager.IsExist(skinId) or skinId == 0 then
NetManager.ChangeHeroSkin(curHeroData.dynamicId,skinId,function()
poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj)
HeroManager.ChangeSkinId(curHeroData.dynamicId,skinId)
local tempdata = HeroManager.GetSingleHeroData(curHeroData.dynamicId)
curLiveName = tempdata.Live
parent.curLiveObj = HeroManager.LoadHerolive(tempdata,parent.curObj)
PopupTipPanel.ShowTip("已更换皮肤!")
this:OnShow(0,parent,tempdata)
end)
else
poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj)
curLiveName = GetResourcePath(data.Live)
parent.curLiveObj = poolManager:LoadLive(GetResourcePath(data.Live), parent.curObj.transform,
Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0))
PopupTipPanel.ShowTip("未获得此皮肤!")
end
end
function RoleSkinPanel:OnHide()
this.gameObject:SetActive(false)
-- if isUnLoadLive then
-- poolManager:UnLoadLive(curLiveName, parent.curLiveObj)
-- parent.curLiveObj = HeroManager.LoadHerolive(curHeroData,parent.curObj)
-- isUnLoadLive = false
-- end
this.gameObject:SetActive(false)
end
function RoleSkinPanel:OnClose()