c1_lua/lua/app/ui/battle/battle_chapter_bg_comp.lua
2025-08-08 11:41:36 +08:00

36 lines
952 B
Lua

local BattleChapterBgComp = class("BattleChapterBgComp", LuaComponent)
function BattleChapterBgComp:init()
local uiMap = self.baseObject:genAllChildren()
local buildNode = uiMap["chapter_1_1.build_node"]
self.allObj = {}
for i = 1, 3 do
local bg = uiMap["chapter_1_1.bg_" .. i]
local bg1 = uiMap["chapter_1_1.prospect_" .. i]
local bg2 = uiMap["chapter_1_1.middle_" .. i]
if bg then
table.insert(self.allObj, bg)
end
if bg1 then
table.insert(self.allObj, bg1)
end
if bg2 then
table.insert(self.allObj, bg2)
end
end
table.insert(self.allObj, buildNode)
end
function BattleChapterBgComp:pause()
for i,v in ipairs(self.allObj) do
v:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_BATTLE_CONTROL_BG).canMove = false
end
end
function BattleChapterBgComp:doMove()
for i,v in ipairs(self.allObj) do
v:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_BATTLE_CONTROL_BG):SetPositionByTime(0.02)
end
end
return BattleChapterBgComp