皮肤修改

dev_chengFeng
jiaoyangna 2020-11-10 10:23:55 +08:00
parent 495ea6e24e
commit 3f7ae45011
1 changed files with 13 additions and 7 deletions

View File

@ -6,8 +6,9 @@ local artResConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local skinPres = {}
local porpertys = {}
local curHeroData = {}
local curSkinId = 0
local parent = {}
local skins = {}
function RoleSkinPanel:InitComponent(gameObject)
this.gameObject = gameObject
this.skinPre = Util.GetGameObject(gameObject,"skinPre")
@ -32,13 +33,14 @@ function RoleSkinPanel:RemoveListener()
end
this.UpdateShow = this:OnShow(0,parent,curHeroData)
this.UpdateShow = this:OnShow()
--界面打开时调用
function RoleSkinPanel:OnShow(_sortinglayer,_parent,_curHerodata)
this.gameObject:SetActive(true)
curHeroData = _curHerodata
parent = _parent
curSkinId = curHeroData.skinId
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",curHeroData.id)
local tempskins = {}
for i = 1 ,#configs do
@ -47,7 +49,7 @@ function RoleSkinPanel:OnShow(_sortinglayer,_parent,_curHerodata)
tempskins[configs[i].Type] = configs[i]
end
end
local skins = {}
skins = {}
for i,v in pairs(tempskins) do
table.insert(skins,v)
end
@ -58,6 +60,11 @@ function RoleSkinPanel:OnShow(_sortinglayer,_parent,_curHerodata)
return a.Type < b.Type
end
end)
this:UpdateView()
this:ShowTime()
end
function RoleSkinPanel:UpdateView()
for k,v in pairs(skinPres) do
v.obj.gameObject:SetActive(false)
v.data = nil
@ -76,8 +83,6 @@ function RoleSkinPanel:OnShow(_sortinglayer,_parent,_curHerodata)
self:SetSingleData(skinPres[index].obj,v)
index = index + 1
end
this:ShowTime()
end
function RoleSkinPanel:SetSingleData(go,data)
@ -138,16 +143,17 @@ function RoleSkinPanel:SetSingleData(go,data)
end
function RoleSkinPanel:BtnAction(skinId,data)
if skinId == curHeroData.skinId then
if skinId == curSkinId then
return
end
curSkinId = skinId
if HeroSkinManager.IsExist(skinId) or skinId == 0 then
NetManager.ChangeHeroSkin(curHeroData.dynamicId,skinId,function()
HeroManager.ChangeSkinId(curHeroData.dynamicId,skinId)
local tempdata = HeroManager.GetSingleHeroData(curHeroData.dynamicId)
parent:ChangeCurentHeroSkinLive()
PopupTipPanel.ShowTip("已更换皮肤!")
this:OnShow(0,parent,tempdata)
this:UpdateView()
end)
else
parent:ChangeCurentHeroSkinLive(data)