【内存优化】修复资源卸载时会错误卸载其他界面的问题
parent
dd667ae26a
commit
e277760221
|
@ -3,10 +3,10 @@ local SpriteLoader = {}
|
|||
|
||||
-- 调用此方法创建一个管理器
|
||||
function SpriteLoader.New()
|
||||
-- 判断对象池里有没有
|
||||
if #SpriteLoaderPool > 0 then
|
||||
return table.remove(SpriteLoaderPool, 1)
|
||||
end
|
||||
-- -- 判断对象池里有没有
|
||||
-- if #SpriteLoaderPool > 0 then
|
||||
-- return table.remove(SpriteLoaderPool, 1)
|
||||
-- end
|
||||
-- 没有新建
|
||||
local o = {}
|
||||
o.SpriteList = {}
|
||||
|
|
|
@ -144,7 +144,7 @@ function this.SetSpriteBG(sprite)
|
|||
end
|
||||
|
||||
function this.Exit()
|
||||
-- this.spLoader:Destroy()
|
||||
this.spLoader:Destroy()
|
||||
_tileLivePool = nil
|
||||
_tileClearPool = nil
|
||||
ViewCamera = nil
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
----- 元素共鸣 -----
|
||||
ElementalResonanceView = {}
|
||||
local this = ElementalResonanceView
|
||||
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||||
local monsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
||||
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||||
|
@ -16,56 +15,56 @@ function ElementalResonanceView:New(gameObject)
|
|||
return b
|
||||
end
|
||||
|
||||
function this:InitComponent()
|
||||
this.spLoader = SpriteLoader.New()
|
||||
function ElementalResonanceView:InitComponent()
|
||||
self.spLoader = SpriteLoader.New()
|
||||
self.elementalResonanceBtn = Util.GetGameObject(self.gameObject, "elementalResonanceBtn")
|
||||
this.orginLayer = 0
|
||||
this.effect = Util.GetGameObject(self.elementalResonanceBtn, "effect")
|
||||
self.orginLayer = 0
|
||||
self.effect = Util.GetGameObject(self.elementalResonanceBtn, "effect")
|
||||
self.elementalResonanceImage = Util.GetGameObject(self.gameObject, "elementalResonanceBtn/bgImage/Image"):GetComponent("Image")
|
||||
end
|
||||
|
||||
function this:BindEvent()
|
||||
function ElementalResonanceView:BindEvent()
|
||||
-- 功能开启列表
|
||||
Util.AddClick(self.elementalResonanceBtn, function()
|
||||
UIManager.OpenPanel(UIName.ElementPopup, self.dataTable,this.thisPanelOrder)
|
||||
UIManager.OpenPanel(UIName.ElementPopup, self.dataTable,self.thisPanelOrder)
|
||||
end)
|
||||
end
|
||||
|
||||
function this:AddListener()
|
||||
function ElementalResonanceView:AddListener()
|
||||
end
|
||||
|
||||
function this:RemoveListener()
|
||||
function ElementalResonanceView:RemoveListener()
|
||||
end
|
||||
|
||||
|
||||
function this:OnOpen(context)
|
||||
function ElementalResonanceView:OnOpen(context)
|
||||
if context then
|
||||
this.SetOrderStatus(context)
|
||||
self:SetOrderStatus(context)
|
||||
end
|
||||
end
|
||||
|
||||
function this:OnClose()
|
||||
function ElementalResonanceView:OnClose()
|
||||
UIManager.ClosePanel(UIName.ElementPopup)
|
||||
this.spLoader:Destroy()
|
||||
self.spLoader:Destroy()
|
||||
end
|
||||
|
||||
--设定层级
|
||||
function this.SetOrderStatus(context)
|
||||
function ElementalResonanceView:SetOrderStatus(context)
|
||||
if not context then
|
||||
return
|
||||
end
|
||||
|
||||
local sortingOrder = context.sortOrder + 90
|
||||
-- Log("<color=yellow>"..sortOrder.."</color>")
|
||||
this.thisPanelOrder = context.sortOrder
|
||||
self.thisPanelOrder = context.sortOrder
|
||||
--self.transform:GetComponent("Canvas").sortingOrder = sortingOrder
|
||||
Util.AddParticleSortLayer(this.effect, sortingOrder - this.orginLayer)
|
||||
this.orginLayer = sortingOrder
|
||||
Util.AddParticleSortLayer(self.effect, sortingOrder - self.orginLayer)
|
||||
self.orginLayer = sortingOrder
|
||||
end
|
||||
|
||||
--得到元素共鸣类型
|
||||
-- 1.火 2.风 3.水 4.大地
|
||||
function this:GetElementalType(curFormation, type)
|
||||
function ElementalResonanceView:GetElementalType(curFormation, type)
|
||||
elementPropertyList = {}
|
||||
local fireElementNum = 0
|
||||
local windyElementNum = 0
|
||||
|
@ -150,16 +149,16 @@ function this:GetElementalType(curFormation, type)
|
|||
local isShow = false
|
||||
isShow = indexChoose > 0
|
||||
if (isShow == false) then
|
||||
self.elementalResonanceImage.sprite = this.spLoader:LoadSprite("r_zhandou_yuansu_01")
|
||||
self.elementalResonanceImage.sprite = self.spLoader:LoadSprite("r_zhandou_yuansu_01")
|
||||
else
|
||||
if indexChoose > 0 then
|
||||
self.elementalResonanceImage.sprite = this.spLoader:LoadSprite(ImageList[indexChoose])
|
||||
self.elementalResonanceImage.sprite = self.spLoader:LoadSprite(ImageList[indexChoose])
|
||||
end
|
||||
end
|
||||
this.effect:SetActive(isShow)
|
||||
self.effect:SetActive(isShow)
|
||||
end
|
||||
|
||||
function this:SetPosition(type)
|
||||
function ElementalResonanceView:SetPosition(type)
|
||||
if (type == 1) then
|
||||
-- self.elementalResonanceBtn.transform.localPosition = Vector3.New(455, 783, 0)
|
||||
self.elementalResonanceBtn.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(1, 1)
|
||||
|
@ -181,6 +180,6 @@ function this:SetPosition(type)
|
|||
end
|
||||
end
|
||||
|
||||
function this:SetElementalPropertyTextColor()
|
||||
function ElementalResonanceView:SetElementalPropertyTextColor()
|
||||
end
|
||||
return ElementalResonanceView
|
Loading…
Reference in New Issue