【内存优化】新内存内存优化修改

dev_chengFeng
gaoxin 2021-05-19 15:06:02 +08:00
parent d84db1977d
commit 6d551869be
30 changed files with 99 additions and 68 deletions

View File

@ -366,11 +366,11 @@ function this.SingleItemDataShow(_go, _itemData)
elseif _itemData.itemConfig.ItemType == ItemType.heroDogFood then elseif _itemData.itemConfig.ItemType == ItemType.heroDogFood then
num:SetActive(true) num:SetActive(true)
num:GetComponent("Text").text = _itemData.num num:GetComponent("Text").text = _itemData.num
frameMask:GetComponent("Image").sprite = Util.LoadSprite(GetHeroChipQuantityImageByquality(_itemData.itemConfig.Quantity)) frameMask:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetHeroChipQuantityImageByquality(_itemData.itemConfig.Quantity))
local propertyName = itemConfig[_itemData.itemConfig.Id].PropertyName local propertyName = itemConfig[_itemData.itemConfig.Id].PropertyName
if (propertyName ~= 0) then if (propertyName ~= 0) then
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):SetActive(true) Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):SetActive(true)
Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(propertyName))
end end
talismanStar:SetActive(true) talismanStar:SetActive(true)
SetHeroStars(talismanStar, _itemData.itemConfig.HeroStar[1],1,Vector2.New(32.5,32.5),-15) SetHeroStars(talismanStar, _itemData.itemConfig.HeroStar[1],1,Vector2.New(32.5,32.5),-15)

View File

@ -369,7 +369,7 @@ function this.InitPanelData()
boxList2[index].obj.transform.localPosition = Vector3.zero boxList2[index].obj.transform.localPosition = Vector3.zero
boxList2[index].moved = false boxList2[index].moved = false
boxList2[index].obj:SetActive(false) boxList2[index].obj:SetActive(false)
Util.GetGameObject(boxList2[index].obj,"iconRoot/icon"):GetComponent("Image").sprite = Util.LoadSprite(ArtResourcesConfig[boxs[i][2]].Name) Util.GetGameObject(boxList2[index].obj,"iconRoot/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(ArtResourcesConfig[boxs[i][2]].Name)
end end
if #boxList2 > 0 then if #boxList2 > 0 then
boxList2[1].obj:SetActive(true) boxList2[1].obj:SetActive(true)

View File

@ -25,9 +25,9 @@ function DailyRechargePanel:InitComponent()
self.items[i].go = Util.GetGameObject(self.grid,"item"..i) self.items[i].go = Util.GetGameObject(self.grid,"item"..i)
self.items[i].priceText = Util.GetGameObject(self.items[i].go,"Text"):GetComponent("Image") self.items[i].priceText = Util.GetGameObject(self.items[i].go,"Text"):GetComponent("Image")
if MoneyUtil.MT == MoneyType.RMB then if MoneyUtil.MT == MoneyType.RMB then
self.selectIma.sprite = Util.LoadSprite(missionIndex[i].defaultImaRMB) self.selectIma.sprite = self.spLoader:LoadSprite(missionIndex[i].defaultImaRMB)
else else
self.selectIma.sprite = Util.LoadSprite(missionIndex[i].defaultIma) self.selectIma.sprite = self.spLoader:LoadSprite(missionIndex[i].defaultIma)
end end
end end
@ -167,9 +167,9 @@ function DailyRechargePanel:SetSelectBtn()
self.select.transform:SetParent(self.items[index].go.transform) self.select.transform:SetParent(self.items[index].go.transform)
self.select.transform.localPosition = Vector3.zero self.select.transform.localPosition = Vector3.zero
if MoneyUtil.MT == MoneyType.RMB then if MoneyUtil.MT == MoneyType.RMB then
self.selectIma.sprite = Util.LoadSprite(missionIndex[index].selectImaRMB) self.selectIma.sprite = self.spLoader:LoadSprite(missionIndex[index].selectImaRMB)
else else
self.selectIma.sprite = Util.LoadSprite(missionIndex[index].selectIma) self.selectIma.sprite = self.spLoader:LoadSprite(missionIndex[index].selectIma)
end end
end end

View File

@ -80,8 +80,8 @@ function this.SingleChapterDataShow(go, data)
open:SetActive(curChapterId > data.chapterId) open:SetActive(curChapterId > data.chapterId)
lock:SetActive(curChapterId < data.chapterId) lock:SetActive(curChapterId < data.chapterId)
curIndexImage:SetActive(curChapterId >= data.chapterId) curIndexImage:SetActive(curChapterId >= data.chapterId)
curIndexImage:GetComponent("Image").sprite = Util.LoadSprite(data.config.BigNumber)--Util.LoadSprite(GetResourcePath(data.config.BigNumber)) curIndexImage:GetComponent("Image").sprite = this.spLoader:LoadSprite(data.config.BigNumber)--self.spLoader:LoadSprite(GetResourcePath(data.config.BigNumber))
Util.GetGameObject(go, "chapterImage"):GetComponent("Image").sprite = Util.LoadSprite(data.config.Map) Util.GetGameObject(go, "chapterImage"):GetComponent("Image").sprite = this.spLoader:LoadSprite(data.config.Map)
Util.GetGameObject(go, "star/starNum"):GetComponent("Text").text = data.stars.."/"..data.curMaxStarNum Util.GetGameObject(go, "star/starNum"):GetComponent("Text").text = data.stars.."/"..data.curMaxStarNum
Util.GetGameObject(go, "chapterName"):GetComponent("Text").text = data.config.Name Util.GetGameObject(go, "chapterName"):GetComponent("Text").text = data.config.Name
Util.SetGray(go, curChapterId < data.chapterId) Util.SetGray(go, curChapterId < data.chapterId)

View File

@ -34,9 +34,9 @@ function FightLevelOpenChapterPopup:OnShow()
end end
function this.OnShowPanel() function this.OnShowPanel()
local config = ConfigManager.GetConfigData(ConfigName.HardStageChapter,chapterDataId) local config = ConfigManager.GetConfigData(ConfigName.HardStageChapter,chapterDataId)
this.titleImage.sprite = Util.LoadSprite("j_jsxgq_biaoti") this.titleImage.sprite = this.spLoader:LoadSprite("j_jsxgq_biaoti")
this.chapterName.text = config.Name this.chapterName.text = config.Name
this.chapterImage.sprite = Util.LoadSprite(config.Map) this.chapterImage.sprite = this.spLoader:LoadSprite(config.Map)
end end
--界面关闭时调用(用于子类重写) --界面关闭时调用(用于子类重写)
function FightLevelOpenChapterPopup:OnClose() function FightLevelOpenChapterPopup:OnClose()

View File

@ -73,7 +73,7 @@ end
function this.OnShowPanel() function this.OnShowPanel()
chapterData = FightLevelManager.GetChapterData(chapterId) chapterData = FightLevelManager.GetChapterData(chapterId)
this.chapterNameText.text = chapterData.config.Name this.chapterNameText.text = chapterData.config.Name
this.chapterNameImage.sprite = Util.LoadSprite(chapterData.config.BigNumber) this.chapterNameImage.sprite = this.spLoader:LoadSprite(chapterData.config.BigNumber)
if chapterData.node and LengthOfTable(chapterData.node) > 0 then if chapterData.node and LengthOfTable(chapterData.node) > 0 then
local curchapterData = {} local curchapterData = {}
for key, value in pairs(chapterData.node) do for key, value in pairs(chapterData.node) do
@ -183,7 +183,7 @@ function this.SetlevelBox(_rewardBoxDatas)
for i, v in pairs(_rewardBoxDatas) do for i, v in pairs(_rewardBoxDatas) do
boxList[i]:SetActive(true) boxList[i]:SetActive(true)
local missionConfigData = _rewardBoxDatas[i].config local missionConfigData = _rewardBoxDatas[i].config
boxList[i]:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(missionConfigData.RewardIcon)) boxList[i]:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(missionConfigData.RewardIcon))
Util.GetGameObject(boxList[i], "num"):GetComponent("Text").text = missionConfigData.Star Util.GetGameObject(boxList[i], "num"):GetComponent("Text").text = missionConfigData.Star
Util.GetGameObject(boxList[i], "redPoint"):SetActive( _rewardBoxDatas[i].state == 0 and chapterData.stars > _rewardBoxDatas[i].config.Star) Util.GetGameObject(boxList[i], "redPoint"):SetActive( _rewardBoxDatas[i].state == 0 and chapterData.stars > _rewardBoxDatas[i].config.Star)
-- Util.GetGameObject(boxList[i], "UI_Effect_BaoXiang_KaiQi"):SetActive(v.state==SingleDailyMissionState.GetFinish) -- Util.GetGameObject(boxList[i], "UI_Effect_BaoXiang_KaiQi"):SetActive(v.state==SingleDailyMissionState.GetFinish)

View File

@ -16,6 +16,7 @@ local HardStageBuff = ConfigManager.GetConfig(ConfigName.HardStageBuff)
local RewardGroup = ConfigManager.GetConfig(ConfigName.RewardGroup) local RewardGroup = ConfigManager.GetConfig(ConfigName.RewardGroup)
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig) local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
function this:InitComponent(gameObject) function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.tip=Util.GetGameObject(gameObject,"tip"):GetComponent("Text") this.tip=Util.GetGameObject(gameObject,"tip"):GetComponent("Text")
this.conditionInfoText=Util.GetGameObject(gameObject,"conditionInfoText") this.conditionInfoText=Util.GetGameObject(gameObject,"conditionInfoText")
@ -155,7 +156,7 @@ end
--设置单个上阵英雄信息 --设置单个上阵英雄信息
function this.SetCardSingleData(o,monsterId, _pos) function this.SetCardSingleData(o,monsterId, _pos)
local curMonsterConfig = MonsterConfig[monsterId] local curMonsterConfig = MonsterConfig[monsterId]
o.transform.parent:GetComponent("Image").sprite=Util.LoadSprite("t_chengyuankuang_kuang") o.transform.parent:GetComponent("Image").sprite=this.spLoader:LoadSprite("t_chengyuankuang_kuang")
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, curMonsterConfig.MonsterId) local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, curMonsterConfig.MonsterId)
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image") local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image") local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
@ -187,16 +188,16 @@ function this.SetCardSingleData(o,monsterId, _pos)
zs:SetActive(false) zs:SetActive(false)
else else
zs:SetActive(true) zs:SetActive(true)
zs:GetComponent("Image").sprite = Util.LoadSprite(zsName) zs:GetComponent("Image").sprite = this.spLoader:LoadSprite(zsName)
end end
yuanImage:SetActive(false) yuanImage:SetActive(false)
lv.text=curMonsterConfig.level lv.text=curMonsterConfig.level
bg.sprite = Util.LoadSprite(GetHeroCardStarBg[curMonsterConfig.Star]) bg.sprite = this.spLoader:LoadSprite(GetHeroCardStarBg[curMonsterConfig.Star])
fg.sprite = Util.LoadSprite(GetHeroCardStarFg[curMonsterConfig.Star]) fg.sprite = this.spLoader:LoadSprite(GetHeroCardStarFg[curMonsterConfig.Star])
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName)) pro.sprite=this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
SetCardStars(starGrid,curMonsterConfig.Star) SetCardStars(starGrid,curMonsterConfig.Star)
if curMonsterConfig.Star > 9 then if curMonsterConfig.Star > 9 then
Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(true) Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(true)
@ -236,6 +237,7 @@ function this:OnClose()
end end
function this:OnDestroy() function this:OnDestroy()
this.spLoader:Destroy()
heroListGo = {} heroListGo = {}
end end

View File

@ -15,6 +15,7 @@ local HardStage = ConfigManager.GetConfig(ConfigName.HardStage)
local HardStageCondition = ConfigManager.GetConfig(ConfigName.HardStageCondition) local HardStageCondition = ConfigManager.GetConfig(ConfigName.HardStageCondition)
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig) local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
function this:InitComponent(gameObject) function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text") this.power = Util.GetGameObject(gameObject, "Power/Value"):GetComponent("Text")
this.sureBtn=Util.GetGameObject(gameObject,"sureBtn") this.sureBtn=Util.GetGameObject(gameObject,"sureBtn")
@ -141,7 +142,7 @@ end
--设置单个上阵英雄信息 --设置单个上阵英雄信息
function this.SetCardSingleData(o,monsterId, _pos) function this.SetCardSingleData(o,monsterId, _pos)
local curMonsterConfig = MonsterConfig[monsterId] local curMonsterConfig = MonsterConfig[monsterId]
o.transform.parent:GetComponent("Image").sprite=Util.LoadSprite("t_chengyuankuang_kuang") o.transform.parent:GetComponent("Image").sprite=this.spLoader:LoadSprite("t_chengyuankuang_kuang")
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, curMonsterConfig.MonsterId) local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, curMonsterConfig.MonsterId)
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image") local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image") local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
@ -168,16 +169,16 @@ function this.SetCardSingleData(o,monsterId, _pos)
zs:SetActive(false) zs:SetActive(false)
else else
zs:SetActive(true) zs:SetActive(true)
zs:GetComponent("Image").sprite = Util.LoadSprite(zsName) zs:GetComponent("Image").sprite = this.spLoader:LoadSprite(zsName)
end end
yuanImage:SetActive(false) yuanImage:SetActive(false)
lv.text=curMonsterConfig.Level lv.text=curMonsterConfig.Level
bg.sprite = Util.LoadSprite(GetHeroCardStarBg[curMonsterConfig.Star]) bg.sprite = this.spLoader:LoadSprite(GetHeroCardStarBg[curMonsterConfig.Star])
fg.sprite = Util.LoadSprite(GetHeroCardStarFg[curMonsterConfig.Star]) fg.sprite = this.spLoader:LoadSprite(GetHeroCardStarFg[curMonsterConfig.Star])
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName)) pro.sprite=this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
SetCardStars(starGrid,curMonsterConfig.Star) SetCardStars(starGrid,curMonsterConfig.Star)
if curMonsterConfig.Star > 9 then if curMonsterConfig.Star > 9 then
Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(true) Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(true)
@ -201,6 +202,7 @@ function this:OnClose()
end end
function this:OnDestroy() function this:OnDestroy()
this.spLoader:Destroy()
heroListGo = {} heroListGo = {}
end end

View File

@ -13,6 +13,7 @@ local fun
local RewardGroup = ConfigManager.GetConfig(ConfigName.RewardGroup) local RewardGroup = ConfigManager.GetConfig(ConfigName.RewardGroup)
local HardStageCondition = ConfigManager.GetConfig(ConfigName.HardStageCondition) local HardStageCondition = ConfigManager.GetConfig(ConfigName.HardStageCondition)
function this:InitComponent(gameObject) function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.tipText=Util.GetGameObject(gameObject,"tipText"):GetComponent("Text") this.tipText=Util.GetGameObject(gameObject,"tipText"):GetComponent("Text")
this.backBtn=Util.GetGameObject(gameObject,"BackBtn") this.backBtn=Util.GetGameObject(gameObject,"BackBtn")
@ -66,8 +67,8 @@ function this.SingleDataShow(_go,_rewardData,_index)
local reward = RewardGroup[_rewardData].ShowItem local reward = RewardGroup[_rewardData].ShowItem
Util.GetGameObject(_go, "titleImage/titleText"):GetComponent("Text").text = index == 0 and "首通奖励" or HardStageCondition[fightLevelData.config.ConditionValue[index]].Describe Util.GetGameObject(_go, "titleImage/titleText"):GetComponent("Text").text = index == 0 and "首通奖励" or HardStageCondition[fightLevelData.config.ConditionValue[index]].Describe
Util.GetGameObject(_go, "titleImage/Text"):GetComponent("Text").text = index Util.GetGameObject(_go, "titleImage/Text"):GetComponent("Text").text = index
Util.GetGameObject(_go, "okButton"):GetComponent("Image").sprite = Util.LoadSprite("g_ghhb_yidacheng_zh") Util.GetGameObject(_go, "okButton"):GetComponent("Image").sprite = this.spLoader:LoadSprite("g_ghhb_yidacheng_zh")
Util.GetGameObject(_go, "noButton"):GetComponent("Image").sprite = Util.LoadSprite("g_ghhb_weidacheng_zh") Util.GetGameObject(_go, "noButton"):GetComponent("Image").sprite = this.spLoader:LoadSprite("g_ghhb_weidacheng_zh")
local noStarImage = Util.GetGameObject(_go, "noStarImage") local noStarImage = Util.GetGameObject(_go, "noStarImage")
local getStarImage = Util.GetGameObject(_go, "getStarImage") local getStarImage = Util.GetGameObject(_go, "getStarImage")
noStarImage:SetActive(not FightLevelManager.GetCurLevelStarState(fightLevelData.state,index) and index ~= 0) noStarImage:SetActive(not FightLevelManager.GetCurLevelStarState(fightLevelData.state,index) and index ~= 0)
@ -122,6 +123,7 @@ function this:OnClose()
end end
function this:OnDestroy() function this:OnDestroy()
this.spLoader:Destroy()
end end
return this return this

View File

@ -15,7 +15,7 @@ function FuXingGaoZhao:InitComponent()
self.effect = Util.GetGameObject(self.gameObject,"Content/UI_effect_LuckyCatPanel_normal") self.effect = Util.GetGameObject(self.gameObject,"Content/UI_effect_LuckyCatPanel_normal")
self.time = Util.GetGameObject(self.gameObject,"Content/Time"):GetComponent("Text") self.time = Util.GetGameObject(self.gameObject,"Content/Time"):GetComponent("Text")
self.price = Util.GetGameObject(self.gameObject,"Content/bg/zi/price"):GetComponent("Image") self.price = Util.GetGameObject(self.gameObject,"Content/bg/zi/price"):GetComponent("Image")
self.price.sprite = Util.LoadSprite(ConfigManager.GetConfigData(ConfigName.SpecialConfig,114).Key) self.price.sprite = this.spLoader:LoadSprite(ConfigManager.GetConfigData(ConfigName.SpecialConfig,114).Key)
self.getBtn = Util.GetGameObject(self.gameObject,"Content/getBtn") self.getBtn = Util.GetGameObject(self.gameObject,"Content/getBtn")
FuXingGaoZhaoManager.InitRewardData() FuXingGaoZhaoManager.InitRewardData()
self.mid = Util.GetGameObject(self.gameObject,"Content/mid") self.mid = Util.GetGameObject(self.gameObject,"Content/mid")

View File

@ -8,6 +8,7 @@ function GuildMemberView.New(isSelf, curXY, name, gPos, sex, Ctrl)
setmetatable(instance, GuildMemberView) setmetatable(instance, GuildMemberView)
instance.isSelf = isSelf instance.isSelf = isSelf
instance.spLoader = SpriteLoader.New()
local u, v = GuildMap_Pos2UV(curXY) local u, v = GuildMap_Pos2UV(curXY)
instance.posData = TileMapView.GetMapData():GetMapData(u, v) instance.posData = TileMapView.GetMapData():GetMapData(u, v)
@ -119,6 +120,7 @@ function GuildMemberView:PlayerIdle()
end end
function GuildMemberView:Dispose() function GuildMemberView:Dispose()
self.spLoader:Destroy()
self:RemoveListener() self:RemoveListener()
if self.mapNpc then if self.mapNpc then
poolManager:UnLoadLive(self.mapNpc, self.NpcGO) poolManager:UnLoadLive(self.mapNpc, self.NpcGO)
@ -138,7 +140,7 @@ function GuildMemberView:SetGuildPos(gPos)
self.guildPosIcon.gameObject:SetActive(false) self.guildPosIcon.gameObject:SetActive(false)
else else
self.guildPosIcon.gameObject:SetActive(true) self.guildPosIcon.gameObject:SetActive(true)
self.guildPosIcon.sprite = Util.LoadSprite(GuildMemberView.GPosToSprite[gPos]) -- 无用的 self.guildPosIcon.sprite = self.spLoader:LoadSprite(GuildMemberView.GPosToSprite[gPos]) -- 无用的
end end
end end

View File

@ -574,7 +574,7 @@ function this.SetItemViewShow(data,func)
local tab={LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Reward[1],LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Reward[2]} local tab={LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Reward[1],LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Reward[2]}
this.itemViewList[i]:OnOpen(false, {tab[1],tab[2]},1, false, false, false, sortingOrder) this.itemViewList[i]:OnOpen(false, {tab[1],tab[2]},1, false, false, false, sortingOrder)
local qua= LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Rare local qua= LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Rare
this.itemQuality[i].sprite = Util.LoadSprite(quaImage[qua]) this.itemQuality[i].sprite = this.spLoader:LoadSprite(quaImage[qua])
this.itemQuality[i]:SetNativeSize() this.itemQuality[i]:SetNativeSize()
if qua > 0 then if qua > 0 then
this.itemQuality[i].gameObject:SetActive(true) this.itemQuality[i].gameObject:SetActive(true)

View File

@ -298,7 +298,7 @@ function this.SetBlockIcon(pos)
if not this.BlockPoint [pos] then if not this.BlockPoint [pos] then
local go = poolManager:LoadAsset("mapButtonPoint", PoolManager.AssetType.GameObject) local go = poolManager:LoadAsset("mapButtonPoint", PoolManager.AssetType.GameObject)
go.transform:SetParent(Util.GetTransform(this.Ctrl, "uiObj#")) go.transform:SetParent(Util.GetTransform(this.Ctrl, "uiObj#"))
go:GetComponent("Image").sprite = Util.LoadSprite("r_map_xiangzi") -- 无用的 go:GetComponent("Image").sprite = self.spLoader:LoadSprite("r_map_xiangzi") -- 无用的
go:GetComponent("Image"):SetNativeSize() go:GetComponent("Image"):SetNativeSize()
go.name = "blockPoint" go.name = "blockPoint"
go:SetActive(true) go:SetActive(true)

View File

@ -31,6 +31,7 @@ function CommonActPage:RemoveListener()
end end
function CommonActPage:InitComponent() function CommonActPage:InitComponent()
self.spLoader = SpriteLoader.New()
self.bg = Util.GetGameObject(self.gameObject, "Bg/banner") self.bg = Util.GetGameObject(self.gameObject, "Bg/banner")
self.titleBgIma = self.bg:GetComponent("Image") self.titleBgIma = self.bg:GetComponent("Image")
self.titleIma = Util.GetGameObject(self.bg,"titleIma"):GetComponent("Image") self.titleIma = Util.GetGameObject(self.bg,"titleIma"):GetComponent("Image")
@ -89,11 +90,11 @@ function CommonActPage:OnShow(_sortingOrder)
end end
end end
if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then
self.titleBgIma.sprite = Util.LoadSprite(self.actConfig.Icon[3]) self.titleBgIma.sprite = self.spLoader:LoadSprite(self.actConfig.Icon[3])
end end
if self.actConfig.Icon[4] and self.actConfig.Icon[4] ~= "" then if self.actConfig.Icon[4] and self.actConfig.Icon[4] ~= "" then
self.titleIma.gameObject:SetActive(true) self.titleIma.gameObject:SetActive(true)
self.titleIma.sprite = Util.LoadSprite(self.actConfig.Icon[4]) self.titleIma.sprite = self.spLoader:LoadSprite(self.actConfig.Icon[4])
self.titleIma:SetNativeSize() self.titleIma:SetNativeSize()
self.titleIma.transform.localPosition = Vector3.New(self.actConfig.TitleImapos[1],self.actConfig.TitleImapos[2],self.actConfig.TitleImapos[3]) self.titleIma.transform.localPosition = Vector3.New(self.actConfig.TitleImapos[1],self.actConfig.TitleImapos[2],self.actConfig.TitleImapos[3])
else else
@ -206,6 +207,7 @@ function CommonActPage:OnClose()
end end
function CommonActPage:OnDestroy() function CommonActPage:OnDestroy()
self.spLoader:Destroy()
if self.localTimer then if self.localTimer then
self.localTimer:Stop() self.localTimer:Stop()
self.localTimer = nil self.localTimer = nil

View File

@ -26,6 +26,7 @@ end
function ConRechargePage:InitComponent() function ConRechargePage:InitComponent()
self.spLoader = SpriteLoader.New()
self.sortingOrder = 0 self.sortingOrder = 0
self.Scroll = Util.GetGameObject(self.gameObject, "Content/Scroll") self.Scroll = Util.GetGameObject(self.gameObject, "Content/Scroll")
self.itemPre = Util.GetGameObject(self.gameObject, "itemPre") self.itemPre = Util.GetGameObject(self.gameObject, "itemPre")
@ -84,7 +85,7 @@ function ConRechargePage:OnShow(_sortingOrder)
end end
end end
if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then
self.bg.sprite = Util.LoadSprite(self.actConfig.Icon[3]) self.bg.sprite = self.spLoader:LoadSprite(self.actConfig.Icon[3])
end end
self.title1.text = _MoneyConfig[MoneyUtil.MT] self.title1.text = _MoneyConfig[MoneyUtil.MT]
@ -139,6 +140,7 @@ function ConRechargePage:OnClose()
end end
function ConRechargePage:OnDestroy() function ConRechargePage:OnDestroy()
self.spLoader:Destroy()
for k,v in pairs(self.ItemList) do for k,v in pairs(self.ItemList) do
SubUIManager.Close(v) SubUIManager.Close(v)
end end

View File

@ -11,6 +11,8 @@ end
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function ExChangePage:InitComponent() function ExChangePage:InitComponent()
self.spLoader = SpriteLoader.New()
self.exChangeInfoGrid = {}--限时兑换内容 self.exChangeInfoGrid = {}--限时兑换内容
self.heroConfig = {} self.heroConfig = {}
self.itemList = {} --itemView优化 self.itemList = {} --itemView优化
@ -163,6 +165,7 @@ function ExChangePage:OnClose()
end end
function ExChangePage:OnDestroy() function ExChangePage:OnDestroy()
self.spLoader:Destroy()
for k,v in pairs(self.itemList) do for k,v in pairs(self.itemList) do
SubUIManager.Close(v) SubUIManager.Close(v)
end end

View File

@ -20,6 +20,7 @@ end
function ExpertPage:InitComponent() function ExpertPage:InitComponent()
self.spLoader = SpriteLoader.New()
self.bg = Util.GetGameObject(self.gameObject, "Bg/titleBg"):GetComponent("Image") self.bg = Util.GetGameObject(self.gameObject, "Bg/titleBg"):GetComponent("Image")
self.titleIma = Util.GetGameObject(self.gameObject, "Bg/titleIma"):GetComponent("Image") self.titleIma = Util.GetGameObject(self.gameObject, "Bg/titleIma"):GetComponent("Image")
self.titleTip = Util.GetGameObject(self.gameObject, "Bg/titleTip"):GetComponent("Text") self.titleTip = Util.GetGameObject(self.gameObject, "Bg/titleTip"):GetComponent("Text")
@ -79,12 +80,12 @@ function ExpertPage:OnShow(_sortingOrder)
end end
end end
if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then
self.bg.sprite = Util.LoadSprite(self.actConfig.Icon[3]) self.bg.sprite = self.spLoader:LoadSprite(self.actConfig.Icon[3])
end end
if self.actConfig.Icon[4] and self.actConfig.Icon[4] ~= "" then if self.actConfig.Icon[4] and self.actConfig.Icon[4] ~= "" then
self.titleIma.gameObject:SetActive(true) self.titleIma.gameObject:SetActive(true)
self.titleIma.sprite = Util.LoadSprite(self.actConfig.Icon[4]) self.titleIma.sprite = self.spLoader:LoadSprite(self.actConfig.Icon[4])
self.titleIma:SetNativeSize() self.titleIma:SetNativeSize()
self.titleIma.transform.localPosition = Vector3.New(self.actConfig.TitleImapos[1],self.actConfig.TitleImapos[2],self.actConfig.TitleImapos[3]) self.titleIma.transform.localPosition = Vector3.New(self.actConfig.TitleImapos[1],self.actConfig.TitleImapos[2],self.actConfig.TitleImapos[3])
else else
@ -200,6 +201,7 @@ function ExpertPage:OnClose()
end end
function ExpertPage:OnDestroy() function ExpertPage:OnDestroy()
self.spLoader:Destroy()
if self.localTimer then if self.localTimer then
self.localTimer:Stop() self.localTimer:Stop()
self.localTimer = nil self.localTimer = nil

View File

@ -17,6 +17,7 @@ local BtnState = {
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function ExpertPre:InitComponent() function ExpertPre:InitComponent()
self.spLoader = SpriteLoader.New()
self.title = Util.GetGameObject(self.gameObject,"Content/title"):GetComponent("Text") self.title = Util.GetGameObject(self.gameObject,"Content/title"):GetComponent("Text")
self.info = Util.GetGameObject(self.gameObject,"Content/info"):GetComponent("Text") self.info = Util.GetGameObject(self.gameObject,"Content/info"):GetComponent("Text")
self.grid = Util.GetGameObject(self.gameObject,"Content/scrollView") self.grid = Util.GetGameObject(self.gameObject,"Content/scrollView")
@ -68,7 +69,7 @@ end
function ExpertPre:SetButton() function ExpertPre:SetButton()
local btnData = BtnState[self.data.otherData.state] local btnData = BtnState[self.data.otherData.state]
self.btnGet:GetComponent("Image").sprite = Util.LoadSprite(btnData.Img) self.btnGet:GetComponent("Image").sprite = self.spLoader:LoadSprite(btnData.Img)
Util.SetGray(self.btnGet,btnData.isGray) Util.SetGray(self.btnGet,btnData.isGray)
self.redPoint:SetActive(btnData.isRed) self.redPoint:SetActive(btnData.isRed)
self.btnText.text = btnData.Text self.btnText.text = btnData.Text
@ -98,6 +99,7 @@ function ExpertPre:SetButton()
end end
function ExpertPre:OnClose() function ExpertPre:OnClose()
self.spLoader:Destroy()
self.gridList = {} self.gridList = {}
for k,v in pairs(self.itemList) do for k,v in pairs(self.itemList) do
SubUIManager.Close(v) SubUIManager.Close(v)

View File

@ -178,7 +178,7 @@ local type={
} }
function MissionPre:SetIcon1(_itemdata) function MissionPre:SetIcon1(_itemdata)
Util.SetGray(self.btnGet,_itemdata.state == 2) Util.SetGray(self.btnGet,_itemdata.state == 2)
self.btnGet:GetComponent("Image").sprite = Util.LoadSprite(type[_itemdata.state].sprite) self.btnGet:GetComponent("Image").sprite = self.spLoader:LoadSprite(type[_itemdata.state].sprite)
self.redPoint.gameObject:SetActive(false) self.redPoint.gameObject:SetActive(false)
self.redPoint.gameObject:SetActive(_itemdata.state == 1) self.redPoint.gameObject:SetActive(_itemdata.state == 1)
Util.SetGray(self.redPoint,false) Util.SetGray(self.redPoint,false)

View File

@ -291,9 +291,9 @@ function this.TaSuiLingXiaoShow()
local b = curDmg > maxDmg or curDmg < maxDmg local b = curDmg > maxDmg or curDmg < maxDmg
this.tasuilingxiao_State.gameObject:SetActive(b) this.tasuilingxiao_State.gameObject:SetActive(b)
if curDmg > maxDmg then if curDmg > maxDmg then
this.tasuilingxiao_State.sprite=Util.LoadSprite("r_hero_zhanlishangsheng_png") this.tasuilingxiao_State.sprite=this.spLoader:LoadSprite("r_hero_zhanlishangsheng_png")
elseif curDmg < maxDmg then elseif curDmg < maxDmg then
this.tasuilingxiao_State.sprite=Util.LoadSprite("r_hero_zhanlixiajiang_png") this.tasuilingxiao_State.sprite=this.spLoader:LoadSprite("r_hero_zhanlixiajiang_png")
end end
end end
end end

View File

@ -311,7 +311,7 @@ function RewardItemSingleShowPopup:OnShow()
local propertyName=itemConfigData.PropertyName local propertyName=itemConfigData.PropertyName
if(propertyName~=0) then if(propertyName~=0) then
this.fragmentIcon:SetActive(true) this.fragmentIcon:SetActive(true)
this.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) this.fragmentIcon:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(propertyName))
end end
this.starGameobject:SetActive(true) this.starGameobject:SetActive(true)
local star = itemConfigData.HeroStar[1] local star = itemConfigData.HeroStar[1]

View File

@ -177,9 +177,9 @@ function this.SetScrollPre2(root,data)
end end
mask:SetActive(true) mask:SetActive(true)
if data.state==0 then if data.state==0 then
mask:GetComponent("Image").sprite = Util.LoadSprite("g_ghhb_weidacheng_zh") mask:GetComponent("Image").sprite = this.spLoader:LoadSprite("g_ghhb_weidacheng_zh")
elseif data.state==1 then elseif data.state==1 then
mask:GetComponent("Image").sprite = Util.LoadSprite("g_ghhb_yidacheng_zh") mask:GetComponent("Image").sprite = this.spLoader:LoadSprite("g_ghhb_yidacheng_zh")
end end
end end

View File

@ -8,6 +8,7 @@ local func
local data local data
function this:InitComponent(gameObject) function this:InitComponent(gameObject)
self.spLoader = SpriteLoader.New()
self.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text") self.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
self.tip=Util.GetGameObject(gameObject,"tip"):GetComponent("Text") self.tip=Util.GetGameObject(gameObject,"tip"):GetComponent("Text")
self.scroll = Util.GetGameObject(gameObject, "Scroll") self.scroll = Util.GetGameObject(gameObject, "Scroll")
@ -84,11 +85,11 @@ end
function this:ShowSingleData(go,heroData,index) function this:ShowSingleData(go,heroData,index)
self.itemList[index] = go self.itemList[index] = go
Util.GetGameObject(go, "frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star)) Util.GetGameObject(go, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star))
Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = Util.LoadSprite(heroData.icon) Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(heroData.icon)
Util.GetGameObject(go, "lv/Text"):GetComponent("Text").text = heroData.lv Util.GetGameObject(go, "lv/Text"):GetComponent("Text").text = heroData.lv
Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = Util.LoadSprite(heroData.icon) Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(heroData.icon)
Util.GetGameObject(go, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName)) Util.GetGameObject(go, "proIcon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
local starGrid = Util.GetGameObject(go, "star") local starGrid = Util.GetGameObject(go, "star")
local starPre = Util.GetGameObject(go, "starPre") local starPre = Util.GetGameObject(go, "starPre")
self.maskList[index] = Util.GetGameObject(go, "choosed") self.maskList[index] = Util.GetGameObject(go, "choosed")
@ -117,6 +118,7 @@ function this:OnClose()
end end
function this:OnDestroy() function this:OnDestroy()
self.spLoader:Destroy()
self.itemList = {} self.itemList = {}
end end

View File

@ -3,6 +3,7 @@ local orginLayer
local curImprintData={} local curImprintData={}
function PracticeImprint:InitComponent() function PracticeImprint:InitComponent()
self.spLoader = SpriteLoader.New()
self.backBtn = Util.GetGameObject(self.gameObject, "backBtn") self.backBtn = Util.GetGameObject(self.gameObject, "backBtn")
self.Scroll = Util.GetGameObject(self.gameObject, "Scroll") self.Scroll = Util.GetGameObject(self.gameObject, "Scroll")
self.ImprintPre = Util.GetGameObject(self.gameObject, "ImprintPre") self.ImprintPre = Util.GetGameObject(self.gameObject, "ImprintPre")
@ -88,7 +89,7 @@ function PracticeImprint:SetSingleImprint(_go,_imprintId)
if not serverData then--未解锁 if not serverData then--未解锁
stateImg.gameObject:SetActive(true) stateImg.gameObject:SetActive(true)
stateImg.sprite = Util.LoadSprite("r_Dungeon_lockon") stateImg.sprite = self.spLoader:LoadSprite("r_Dungeon_lockon")
heroImg.gameObject:SetActive(false) heroImg.gameObject:SetActive(false)
else--已解锁 else--已解锁
-- LogGreen(" _imprintId:"..tostring(_imprintId).." serverData.state:"..tostring(serverData.state)) -- LogGreen(" _imprintId:"..tostring(_imprintId).." serverData.state:"..tostring(serverData.state))
@ -97,16 +98,16 @@ function PracticeImprint:SetSingleImprint(_go,_imprintId)
-- heroImg.gameObject:SetActive(false) -- heroImg.gameObject:SetActive(false)
elseif serverData.state == 1 then--已使用 elseif serverData.state == 1 then--已使用
stateImg.gameObject:SetActive(true) stateImg.gameObject:SetActive(true)
stateImg.sprite = Util.LoadSprite("t_tianshumijuan_yijihuo_zh") stateImg.sprite = self.spLoader:LoadSprite("t_tianshumijuan_yijihuo_zh")
end end
heroImg.gameObject:SetActive(serverData.subId ~= nil and serverData.subId ~= "" and serverData.subId ~= "nil") heroImg.gameObject:SetActive(serverData.subId ~= nil and serverData.subId ~= "" and serverData.subId ~= "nil")
if serverData.subId ~= nil and serverData.subId ~= "" and serverData.subId ~= "nil" then if serverData.subId ~= nil and serverData.subId ~= "" and serverData.subId ~= "nil" then
-- LogRed("serverData.subId:"..tostring(serverData.subId)) -- LogRed("serverData.subId:"..tostring(serverData.subId))
-- LogGreen(HeroManager.GetSingleHeroData(tostring(serverData.subId)).id) -- LogGreen(HeroManager.GetSingleHeroData(tostring(serverData.subId)).id)
heroImg.sprite = Util.LoadSprite(GetSpriteNameByItemId(HeroManager.GetSingleHeroData(tostring(serverData.subId)).id)) heroImg.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(HeroManager.GetSingleHeroData(tostring(serverData.subId)).id))
end end
end end
icon.sprite = Util.LoadSprite(GetResourcePath(configData.Icon)) icon.sprite = self.spLoader:LoadSprite(GetResourcePath(configData.Icon))
Util.AddOnceClick(maskBtn,function () Util.AddOnceClick(maskBtn,function ()
@ -183,19 +184,19 @@ function PracticeImprint:ShowSingleImprintInfoLayout(_serverData,_configData)
self.Hero:SetActive(true) self.Hero:SetActive(true)
--英雄图标 --英雄图标
heroData = HeroManager.GetSingleHeroData(tostring(_serverData.subId)) heroData = HeroManager.GetSingleHeroData(tostring(_serverData.subId))
frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star)) frame.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star))
icon.sprite = Util.LoadSprite(heroData.icon) icon.sprite = self.spLoader:LoadSprite(heroData.icon)
lv.text = heroData.lv lv.text = heroData.lv
proIcon.sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName)) proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetHeroStars(starGrid, heroData.star) SetHeroStars(starGrid, heroData.star)
end end
Util.AddOnceClick(self.MaskBtn,function() Util.AddOnceClick(self.MaskBtn,function()
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.XiuXingSelectHero,_configData,function (_heroData) UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.XiuXingSelectHero,_configData,function (_heroData)
NetManager.PracticeImprintRequest(_configData.Id,_configData.Id,tostring(_heroData.dynamicId),function () NetManager.PracticeImprintRequest(_configData.Id,_configData.Id,tostring(_heroData.dynamicId),function ()
frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(_heroData.heroConfig.Quality,_heroData.star)) frame.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(_heroData.heroConfig.Quality,_heroData.star))
icon.sprite = Util.LoadSprite(_heroData.icon) icon.sprite = self.spLoader:LoadSprite(_heroData.icon)
lv.text = _heroData.lv lv.text = _heroData.lv
proIcon.sprite = Util.LoadSprite(GetProStrImageByProNum(_heroData.heroConfig.PropertyName)) proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(_heroData.heroConfig.PropertyName))
SetHeroStars(starGrid, _heroData.star) SetHeroStars(starGrid, _heroData.star)
--刷新 --刷新
self:Refresh(true,true,function () self:Refresh(true,true,function ()
@ -214,6 +215,7 @@ function PracticeImprint:OnClose()
end end
function PracticeImprint:OnDestroy() function PracticeImprint:OnDestroy()
self.spLoader:Destroy()
end end
return PracticeImprint return PracticeImprint

View File

@ -7,6 +7,7 @@ local newPower = 0
local oldBigLevel = 0 local oldBigLevel = 0
function Practice:InitComponent() function Practice:InitComponent()
self.spLoader = SpriteLoader.New()
orginLayer = 0 orginLayer = 0
if not self.playerInfoView then if not self.playerInfoView then
self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform) self.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, self.transform)
@ -159,7 +160,7 @@ function Practice:RefreshBtn()
end end
local icon = Util.GetGameObject(self.itemList[i],"icon"):GetComponent("Image") local icon = Util.GetGameObject(self.itemList[i],"icon"):GetComponent("Image")
local num = Util.GetGameObject(self.itemList[i],"num"):GetComponent("Text") local num = Util.GetGameObject(self.itemList[i],"num"):GetComponent("Text")
icon.sprite = Util.LoadSprite(GetSpriteNameByItemId(data[1])) icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data[1]))
num.text = data[2] num.text = data[2]
if BagManager.GetTotalItemNum(data[1]) < data[2] then if BagManager.GetTotalItemNum(data[1]) < data[2] then
num.text = string.format("<color=red>%s</color>",data[2]) num.text = string.format("<color=red>%s</color>",data[2])
@ -193,6 +194,7 @@ function Practice:OnClose()
end end
function Practice:OnDestroy() function Practice:OnDestroy()
self.spLoader:Destroy()
SubUIManager.Close(self.UpView) SubUIManager.Close(self.UpView)
SubUIManager.Close(self.BtView) SubUIManager.Close(self.BtView)
self.UpView = nil self.UpView = nil

View File

@ -165,7 +165,7 @@ function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择
end end
end end
end end
Util.GetGameObject(go.transform, "posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon) Util.GetGameObject(go.transform, "posIcon"):SetActive(false)
local frame = Util.GetGameObject(go.transform, "frame"):GetComponent("Image") local frame = Util.GetGameObject(go.transform, "frame"):GetComponent("Image")
local lvGo = Util.GetGameObject(go.transform, "lv") local lvGo = Util.GetGameObject(go.transform, "lv")
local icon = Util.GetGameObject(go.transform, "icon"):GetComponent("Image") local icon = Util.GetGameObject(go.transform, "icon"):GetComponent("Image")

View File

@ -19,6 +19,7 @@ local isSkip = false
local isFirstEnter = 1 local isFirstEnter = 1
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function StoryMapPanel:InitComponent() function StoryMapPanel:InitComponent()
this.spLoader = SpriteLoader.New()
this.map = Util.GetGameObject(self.gameObject,"bg/mapParent") this.map = Util.GetGameObject(self.gameObject,"bg/mapParent")
this.mapPre = Util.GetGameObject(self.gameObject,"bg/mapPre") this.mapPre = Util.GetGameObject(self.gameObject,"bg/mapPre")
this.TT = Util.GetGameObject(self.gameObject,"bg/TT") this.TT = Util.GetGameObject(self.gameObject,"bg/TT")
@ -130,7 +131,7 @@ function this.LoadMap()
if not this.Maps[i] then if not this.Maps[i] then
this.Maps[i] = newObjToParent(this.mapPre,this.map) this.Maps[i] = newObjToParent(this.mapPre,this.map)
end end
this.Maps[i]:GetComponent("Image").sprite = Util.LoadSprite(curGroupConfig.Map[i][1]) this.Maps[i]:GetComponent("Image").sprite = this.spLoader:LoadSprite(curGroupConfig.Map[i][1])
this.Maps[i]:GetComponent("Image"):SetNativeSize() this.Maps[i]:GetComponent("Image"):SetNativeSize()
this.Maps[i].gameObject:SetActive(true) this.Maps[i].gameObject:SetActive(true)
local vecs = string.split(curGroupConfig.Map[i][2],',') local vecs = string.split(curGroupConfig.Map[i][2],',')
@ -689,6 +690,7 @@ end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)
function StoryMapPanel:OnDestroy() function StoryMapPanel:OnDestroy()
this.spLoader:Destroy()
for k,v in pairs(this.PlayerGrouops) do for k,v in pairs(this.PlayerGrouops) do
SubUIManager.Close(v) SubUIManager.Close(v)
end end

View File

@ -5,6 +5,7 @@ local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig) local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
function TaSuiLingXiao:InitComponent() function TaSuiLingXiao:InitComponent()
self.spLoader = SpriteLoader.New()
self.time = Util.GetGameObject(self.gameObject, "time"):GetComponent("Text") self.time = Util.GetGameObject(self.gameObject, "time"):GetComponent("Text")
self.btnFight = Util.GetGameObject(self.gameObject, "btnFight") self.btnFight = Util.GetGameObject(self.gameObject, "btnFight")
self.btnTeam = Util.GetGameObject(self.gameObject, "btnTeam") self.btnTeam = Util.GetGameObject(self.gameObject, "btnTeam")
@ -124,7 +125,7 @@ function TaSuiLingXiao:ShowSkillList()
skillData = passiveSkillConfig[self.configData.Skill[i][2]] skillData = passiveSkillConfig[self.configData.Skill[i][2]]
end end
local icon = Util.GetGameObject(self.itemList[i],"Image"):GetComponent("Image") local icon = Util.GetGameObject(self.itemList[i],"Image"):GetComponent("Image")
icon.sprite = Util.LoadSprite(artConfig[skillData.Icon].Name) icon.sprite = self.spLoader:LoadSprite(artConfig[skillData.Icon].Name)
self.itemList[i]:SetActive(true) self.itemList[i]:SetActive(true)
ForceRebuildLayout(self.scrollItem.transform) ForceRebuildLayout(self.scrollItem.transform)
@ -172,7 +173,7 @@ function TaSuiLingXiao:ShowSlide()
break break
end end
end end
self.btnBox:GetComponent("Image").sprite = Util.LoadSprite(artConfig[boxId].Name) self.btnBox:GetComponent("Image").sprite = self.spLoader:LoadSprite(artConfig[boxId].Name)
self.progressNum.text = string.format("%s/%s",historyMax,curBoss) self.progressNum.text = string.format("%s/%s",historyMax,curBoss)
self.count.text = count self.count.text = count
self.slide.fillAmount = historyMax/curBoss self.slide.fillAmount = historyMax/curBoss
@ -186,6 +187,7 @@ end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)
function TaSuiLingXiao:OnDestroy() function TaSuiLingXiao:OnDestroy()
self.spLoader:Destroy()
if self.timer then if self.timer then
self.timer:Stop() self.timer:Stop()
self.timer = nil self.timer = nil

View File

@ -244,7 +244,7 @@ function ItemView:GetRewardShow(_itemData, effectLayer)
local propertyName=itemConfig[_itemData.backData.itemId].PropertyName local propertyName=itemConfig[_itemData.backData.itemId].PropertyName
if(propertyName~=0) then if(propertyName~=0) then
self.fragmentIcon:SetActive(true) self.fragmentIcon:SetActive(true)
self.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) self.fragmentIcon:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(propertyName))
end end
self.starGrid:SetActive(true) self.starGrid:SetActive(true)
local star = _itemData.configData.HeroStar[1] local star = _itemData.configData.HeroStar[1]
@ -586,12 +586,12 @@ function ItemView:NoGetRewardShow(_reward, effectLayer, isShowAddImage)
end) end)
elseif itemDataConFig.ItemType == ItemType.heroDogFood then elseif itemDataConFig.ItemType == ItemType.heroDogFood then
--狗粮 --狗粮
self.frame.sprite = Util.LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity)) self.frame.sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity))
self.icon.sprite = Util.LoadSprite(GetResourcePath(itemConfig[itemSId].ResourceID)) self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[itemSId].ResourceID))
local propertyName=itemConfig[itemSId].PropertyName local propertyName=itemConfig[itemSId].PropertyName
if(propertyName~=0) then if(propertyName~=0) then
self.fragmentIcon:SetActive(true) self.fragmentIcon:SetActive(true)
self.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) self.fragmentIcon:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(propertyName))
end end
self.starGrid:SetActive(true) self.starGrid:SetActive(true)
local star = _reward[4] or itemConfig[itemSId].HeroStar[1] local star = _reward[4] or itemConfig[itemSId].HeroStar[1]

View File

@ -13,6 +13,7 @@ function ShopViewNew:New(gameObject)
end end
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function ShopViewNew:InitComponent() function ShopViewNew:InitComponent()
self.spLoader = SpriteLoader.New()
self.live = Util.GetGameObject(self.gameObject, "live") self.live = Util.GetGameObject(self.gameObject, "live")
self.liveRoot = Util.GetGameObject(self.gameObject, "live/root") self.liveRoot = Util.GetGameObject(self.gameObject, "live/root")
self.liveImg = Util.GetGameObject(self.gameObject, "live/img") self.liveImg = Util.GetGameObject(self.gameObject, "live/img")
@ -291,7 +292,7 @@ function ShopViewNew:RefreshBase()
-- 商店标题 -- 商店标题
if self.ShopConfig.Title and self.ShopConfig.Title ~= "" then if self.ShopConfig.Title and self.ShopConfig.Title ~= "" then
self.titleImg:GetComponent("Image").sprite = Util.LoadSprite(self.ShopConfig.Title) self.titleImg:GetComponent("Image").sprite = self.spLoader:LoadSprite(self.ShopConfig.Title)
end end
self.contentBg:SetActive(false) self.contentBg:SetActive(false)
end end
@ -386,7 +387,7 @@ function ShopViewNew:RechargeShopItemAdapter(shopItem, itemData)
-- 计算数据 -- 计算数据
local itemInfo = ShopManager.GetRechargeItemInfo(itemData.goodsId) local itemInfo = ShopManager.GetRechargeItemInfo(itemData.goodsId)
icon.sprite = Util.LoadSprite(GetResourcePath(itemInfo.Resources)) icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemInfo.Resources))
num.text = itemInfo.Name num.text = itemInfo.Name
price.text = MoneyUtil.GetMoneyMark() .. MoneyUtil.GetMoney(itemInfo.Price) price.text = MoneyUtil.GetMoneyMark() .. MoneyUtil.GetMoney(itemInfo.Price)
@ -431,12 +432,12 @@ function ShopViewNew:ShopItemAdapter(shopItem, itemData)
-- 折扣 -- 折扣
if price == 0 then if price == 0 then
discountbg:SetActive(true) discountbg:SetActive(true)
discountbg:GetComponent("Image").sprite = Util.LoadSprite("s_shop_zhekou_00") discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_00")
else else
local isDiscount = itemInfo.IsDiscount == 1 local isDiscount = itemInfo.IsDiscount == 1
discountbg:SetActive(isDiscount) discountbg:SetActive(isDiscount)
if isDiscount then if isDiscount then
discountbg:GetComponent("Image").sprite = Util.LoadSprite("s_shop_zhekou_0" .. itemInfo.DiscountDegree) discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_0" .. itemInfo.DiscountDegree)
end end
end end
-- 消耗物品的信息 -- 消耗物品的信息
@ -532,6 +533,7 @@ end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)
function ShopViewNew:OnDestroy() function ShopViewNew:OnDestroy()
self.spLoader:Destroy()
-- 物品节点回收 -- 物品节点回收
if self._GoodsItemList then if self._GoodsItemList then
for _, item in pairs(self._GoodsItemList) do for _, item in pairs(self._GoodsItemList) do