local BattleChapterBgComp = class("BattleChapterBgComp", LuaComponent)

function BattleChapterBgComp:init()
	local uiMap = self.baseObject:genAllChildren()
	local buildNode = uiMap["chapter.build_node"]
	self.allObj = {}
	for i = 1, 3 do
		local bg = uiMap["chapter.bg_" .. i]
		local bg1 = uiMap["chapter.prospect_" .. i]
		local bg2 = uiMap["chapter.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