【内存优化】Util.Loadsprite 替换为 spLoader
parent
9cce82f017
commit
1e36398a50
|
|
@ -77,7 +77,7 @@ function this.InitView(redId,id)
|
||||||
if index>3 then
|
if index>3 then
|
||||||
index=4
|
index=4
|
||||||
end
|
end
|
||||||
this.title.sprite=Util.LoadSprite(RedPacketName[index])
|
this.title.sprite = this.spLoader:LoadSprite(RedPacketName[index])
|
||||||
LogError("BaseType=="..config.BaseType)
|
LogError("BaseType=="..config.BaseType)
|
||||||
if config.BaseType==1 then
|
if config.BaseType==1 then
|
||||||
this.titleTip.text=GetLanguageStrById(config.SendWord)
|
this.titleTip.text=GetLanguageStrById(config.SendWord)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
----- 公会红包-抢红包 -----
|
----- 公会红包-抢红包 -----
|
||||||
this={}
|
local this={}
|
||||||
local sortingOrder=0
|
local sortingOrder=0
|
||||||
--红包资源名
|
--红包资源名
|
||||||
local RedPacketName={"g_ghhb_ming_01_zh","g_ghhb_ming_02_zh","g_ghhb_ming_03_zh","g_ghhb_ming_04_zh"}
|
local RedPacketName={"g_ghhb_ming_01_zh","g_ghhb_ming_02_zh","g_ghhb_ming_03_zh","g_ghhb_ming_04_zh"}
|
||||||
|
|
@ -141,7 +141,8 @@ function this:SetView(root,data)
|
||||||
getInfo.gameObject:SetActive(true)
|
getInfo.gameObject:SetActive(true)
|
||||||
getInfo.text=config.RuleDes
|
getInfo.text=config.RuleDes
|
||||||
end
|
end
|
||||||
nameImage.sprite=Util.LoadSprite(RedPacketName[redType])
|
|
||||||
|
nameImage.sprite = this.spLoader:LoadSprite(RedPacketName[redType])
|
||||||
fromPlayer.text=Language[11042]..data.userName.."</color>"
|
fromPlayer.text=Language[11042]..data.userName.."</color>"
|
||||||
|
|
||||||
getBtn:GetComponent("Button").interactable=(config.Num-data.getCount)~=0 and data.isGet==0 --抢红包按钮开关
|
getBtn:GetComponent("Button").interactable=(config.Num-data.getCount)~=0 and data.isGet==0 --抢红包按钮开关
|
||||||
|
|
|
||||||
|
|
@ -404,9 +404,9 @@ function EndLessMapView:ShowHeroData()
|
||||||
this.heroList[i].go.gameObject:SetActive(true)
|
this.heroList[i].go.gameObject:SetActive(true)
|
||||||
this.heroList[i].heroId = v.heroId
|
this.heroList[i].heroId = v.heroId
|
||||||
local heroData = HeroManager.GetSingleHeroData(v.heroId)
|
local heroData = HeroManager.GetSingleHeroData(v.heroId)
|
||||||
this.heroList[i].frame.sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality, heroData.star))
|
this.heroList[i].frame.sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality, heroData.star))
|
||||||
SetHeroIcon(this.spLoader,heroData,this.heroList[i].icon,heroData.heroConfig)
|
SetHeroIcon(this.spLoader,heroData,this.heroList[i].icon,heroData.heroConfig)
|
||||||
this.heroList[i].pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
|
this.heroList[i].pro.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
|
||||||
this.heroList[i].lv.text=heroData.lv
|
this.heroList[i].lv.text=heroData.lv
|
||||||
--spLoader, starGrid, star, type,_starSize,_scale,_pivot,rotation
|
--spLoader, starGrid, star, type,_starSize,_scale,_pivot,rotation
|
||||||
SetHeroStars(this.spLoader,this.heroList[i].star, heroData.star)
|
SetHeroStars(this.spLoader,this.heroList[i].star, heroData.star)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ local redTrailType = {
|
||||||
}
|
}
|
||||||
--初始化组件(用于子类重写)
|
--初始化组件(用于子类重写)
|
||||||
function FourElementMonsterCampPanel:InitComponent()
|
function FourElementMonsterCampPanel:InitComponent()
|
||||||
|
this.spLoader = SpriteLoader.New()
|
||||||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
||||||
|
|
||||||
this.btnBack = Util.GetGameObject(self.gameObject, "InfoRoot/btnBack")
|
this.btnBack = Util.GetGameObject(self.gameObject, "InfoRoot/btnBack")
|
||||||
|
|
@ -45,7 +46,7 @@ function FourElementMonsterCampPanel:InitComponent()
|
||||||
this.addBtn = Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/addBtn")
|
this.addBtn = Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/addBtn")
|
||||||
this.btnRank = Util.GetGameObject(self.gameObject, "InfoRoot/btnRank")
|
this.btnRank = Util.GetGameObject(self.gameObject, "InfoRoot/btnRank")
|
||||||
this.btnHelpFight = Util.GetGameObject(self.gameObject, "InfoRoot/btnHelpFight")
|
this.btnHelpFight = Util.GetGameObject(self.gameObject, "InfoRoot/btnHelpFight")
|
||||||
this.btnHelpFight:GetComponent("Image").sprite = Util.LoadSprite("s_silingshilian_zhuzhananniu_zh")
|
this.btnHelpFight:GetComponent("Image").sprite = this.spLoader:LoadSprite("s_silingshilian_zhuzhananniu_zh")
|
||||||
end
|
end
|
||||||
|
|
||||||
--绑定事件(用于子类重写)
|
--绑定事件(用于子类重写)
|
||||||
|
|
@ -182,6 +183,7 @@ end
|
||||||
|
|
||||||
--界面销毁时调用(用于子类重写)
|
--界面销毁时调用(用于子类重写)
|
||||||
function FourElementMonsterCampPanel:OnDestroy()
|
function FourElementMonsterCampPanel:OnDestroy()
|
||||||
|
this.spLoader:Destroy()
|
||||||
for k,v in pairs(this.singledataList) do
|
for k,v in pairs(this.singledataList) do
|
||||||
v:OnDestroy()
|
v:OnDestroy()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ local redTrailType = {
|
||||||
--初始化组件(用于子类重写)
|
--初始化组件(用于子类重写)
|
||||||
function MonsterCampMainPanel:InitComponent()
|
function MonsterCampMainPanel:InitComponent()
|
||||||
orginLayer = 0
|
orginLayer = 0
|
||||||
|
this.spLoader = SpriteLoader.New()
|
||||||
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
||||||
this.waveNum = Util.GetGameObject(self.gameObject, "Bg/waveImg/wave"):GetComponent("Text")
|
this.waveNum = Util.GetGameObject(self.gameObject, "Bg/waveImg/wave"):GetComponent("Text")
|
||||||
this.nextWave = Util.GetGameObject(self.gameObject, "Bg/btnWave")
|
this.nextWave = Util.GetGameObject(self.gameObject, "Bg/btnWave")
|
||||||
|
|
@ -25,7 +26,7 @@ function MonsterCampMainPanel:InitComponent()
|
||||||
table.insert(trails,Util.GetGameObject(self.gameObject, "Bg/SiLingDi/trail"..i))
|
table.insert(trails,Util.GetGameObject(self.gameObject, "Bg/SiLingDi/trail"..i))
|
||||||
end
|
end
|
||||||
this.btnShenYing = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/shenyingPro")
|
this.btnShenYing = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/shenyingPro")
|
||||||
this.btnShenYing:GetComponent("Image").sprite = Util.LoadSprite("j_jianmushenshu_anniu_02_zh")
|
this.btnShenYing:GetComponent("Image").sprite = this.spLoader:LoadSprite("j_jianmushenshu_anniu_02_zh")
|
||||||
this.btnShenYingText = Util.GetGameObject(this.btnShenYing, "Text"):GetComponent("Text")
|
this.btnShenYingText = Util.GetGameObject(this.btnShenYing, "Text"):GetComponent("Text")
|
||||||
this.shenYingProgressText = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/progress/Text"):GetComponent("Text")
|
this.shenYingProgressText = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/progress/Text"):GetComponent("Text")
|
||||||
this.shenYingProgressIma = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/progress/Image"):GetComponent("Image")
|
this.shenYingProgressIma = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/progress/Image"):GetComponent("Image")
|
||||||
|
|
@ -128,7 +129,7 @@ function MonsterCampMainPanel:SetSingleTrailData(go,data)
|
||||||
local curwave = Util.GetGameObject(go, "curwave"):GetComponent("Text")
|
local curwave = Util.GetGameObject(go, "curwave"):GetComponent("Text")
|
||||||
local canFightWave = Util.GetGameObject(go, "canFightWave"):GetComponent("Text")
|
local canFightWave = Util.GetGameObject(go, "canFightWave"):GetComponent("Text")
|
||||||
local openTime = Util.GetGameObject(go, "openTime"):GetComponent("Text")
|
local openTime = Util.GetGameObject(go, "openTime"):GetComponent("Text")
|
||||||
title.sprite = Util.LoadSprite(FourElementNameImage[data.fourElementType])
|
title.sprite = this.spLoader:LoadSprite(FourElementNameImage[data.fourElementType])
|
||||||
curwave.text = (data.monsterWave + 1).."层"
|
curwave.text = (data.monsterWave + 1).."层"
|
||||||
if data.canFightTime >= campTowerSetting.TimesStoreMax then
|
if data.canFightTime >= campTowerSetting.TimesStoreMax then
|
||||||
canFightWave.text = string.format("可挑战层数:<color=#%s>%s</color>","FE9C00",data.canFightTime)
|
canFightWave.text = string.format("可挑战层数:<color=#%s>%s</color>","FE9C00",data.canFightTime)
|
||||||
|
|
@ -158,6 +159,7 @@ end
|
||||||
|
|
||||||
--界面销毁时调用(用于子类重写)
|
--界面销毁时调用(用于子类重写)
|
||||||
function MonsterCampMainPanel:OnDestroy()
|
function MonsterCampMainPanel:OnDestroy()
|
||||||
|
this.spLoader:Destroy()
|
||||||
SubUIManager.Close(this.UpView)
|
SubUIManager.Close(this.UpView)
|
||||||
trails = {}
|
trails = {}
|
||||||
for i = 1 ,#trails do
|
for i = 1 ,#trails do
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ function this:OnShow(_parent,...)
|
||||||
local _args = {...}
|
local _args = {...}
|
||||||
local data = _args[1]
|
local data = _args[1]
|
||||||
fun = _args[2]
|
fun = _args[2]
|
||||||
this.shengxingIma = Util.LoadSprite(data.title)
|
this.shengxingIma = this.spLoader:LoadSprite(data.title)
|
||||||
--itemList
|
--itemList
|
||||||
if data then
|
if data then
|
||||||
for i = 1, math.max(#itemList, #data.itemList) do
|
for i = 1, math.max(#itemList, #data.itemList) do
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ end
|
||||||
|
|
||||||
--设置每条英雄数据
|
--设置每条英雄数据
|
||||||
function MonsterCampSingleWave:SingleHeroDataShow(monConfig,heroData)
|
function MonsterCampSingleWave:SingleHeroDataShow(monConfig,heroData)
|
||||||
self.frame.sprite=Util.LoadSprite(GetHeroCardStarBg[monConfig.Star])
|
self.frame.sprite=self.spLoader:LoadSprite(GetHeroCardStarBg[monConfig.Star])
|
||||||
local liveName = GetResourcePath(heroData.Live)
|
local liveName = GetResourcePath(heroData.Live)
|
||||||
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroData.Id)
|
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroData.Id)
|
||||||
local scale = roleConfig.play_liveScale
|
local scale = roleConfig.play_liveScale
|
||||||
|
|
@ -193,7 +193,7 @@ function MonsterCampSingleWave:SingleHeroDataShow(monConfig,heroData)
|
||||||
self.icon.transform.localPosition = Vector3.zero
|
self.icon.transform.localPosition = Vector3.zero
|
||||||
self.lv.text = monConfig.Level
|
self.lv.text = monConfig.Level
|
||||||
self.pro.sprite= self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.PropertyName))
|
self.pro.sprite= self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.PropertyName))
|
||||||
--self.icon.sprite = Util.LoadSprite(heroData.painting)
|
--self.icon.sprite = self.spLoader:LoadSprite(heroData.painting)
|
||||||
SetCardStars(self.starGrid,monConfig.Star)
|
SetCardStars(self.starGrid,monConfig.Star)
|
||||||
self.fg.sprite = self.spLoader:LoadSprite(GetHeroCardStarFg[monConfig.Star])
|
self.fg.sprite = self.spLoader:LoadSprite(GetHeroCardStarFg[monConfig.Star])
|
||||||
self.name.text = heroData.ReadingName
|
self.name.text = heroData.ReadingName
|
||||||
|
|
@ -226,7 +226,7 @@ function MonsterCampSingleWave:SetIcon()
|
||||||
local color = BagManager.GetItemCountById(self.itemId) < self.costNum and "E71515" or "17232A"
|
local color = BagManager.GetItemCountById(self.itemId) < self.costNum and "E71515" or "17232A"
|
||||||
self.fightBtnNum.text =string.format("<color=#%s>%s</color>",color,self.costNum)
|
self.fightBtnNum.text =string.format("<color=#%s>%s</color>",color,self.costNum)
|
||||||
self.fightBtnText.text = string.format("<color=#%s>%s</color>",color,"扫荡")
|
self.fightBtnText.text = string.format("<color=#%s>%s</color>",color,"扫荡")
|
||||||
self.fightBtnIcon.sprite = Util.LoadSprite(GetResourcePath(itemConfig[self.itemId].ResourceID))
|
self.fightBtnIcon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[self.itemId].ResourceID))
|
||||||
if self.buyTimes < 1 then
|
if self.buyTimes < 1 then
|
||||||
Util.SetGray(self.fight,true)
|
Util.SetGray(self.fight,true)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue