dofile('Data/Scripts/Common/Screens/ComicsPanelBase.lua')

class 'ComicsPanel' (ComicsPanelBase)

function ComicsPanel:__init(panel)
	ComicsPanelBase.__init(self, panel)
	
	self.panel = panel

	self:getEntityNamed('area_click_skip_frame').onClickBegin:add(function()
			local playfield = self.game_scene:getPlayField()
			if playfield and playfield.active_comics then
				playfield.active_comics:updateComics()
			end
		end)
end

function ComicsPanel:moveIn(time)
    ComicsPanelBase.moveIn(self, time)
    
    self.panel:getControlsPanel():requestPlaceForButton('bttn_comics_skip', function(x) self:getEntityNamed('bttn_skip'):setScrX(x) end, 126, 63)
end

function ComicsPanel:moveOut(time)
    ComicsPanelBase.moveOut(self, time)
    
    self.panel:getControlsPanel():releasePlaceForButton('bttn_comics_skip')
end

function ComicsPanel:showContinueText(delay)
	self:entityHide('text_continue')
	self:getEntityNamed('area_click_skip_frame'):setRespondable(false)
	
	if (self.showTimer ~= nil) then
		self.showTimer:kill()
	end

	local playfield = self.game_scene:getPlayField()
	self.showTimer = playfield.timer:add(	function()
	    										self:getEntityNamed('text_continue'):setVisible(true)
	    										self:getEntityNamed('area_click_skip_frame'):setRespondable(true)
	    									end, delay )
end

--------------------------------------------------------------------------------
--                      GENERATED CONTENT. DO NOT EDIT.                       --
--------------------------------------------------------------------------------

function ComicsPanel:CreateLoaderTable()
	local objects =
	{
		{ name = 'area_click_skip_frame',  entityType = 'SpriteEntity',  x = 512,  y = 733,  order = 0,  isVisible = false,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  width = 1366,  height = 80,  },
		{ name = 'text_field_1',  entityType = 'TextEntity',  x = 512,  y = 728,  order = 5,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  text = 'text',  font = 'Data/Fonts/dialog.fnt',  height = 24,  boundsX = 910,  boundsY = 0,  },
		{ name = 'bttn_skip',  entityType = 'ButtonEntity',  x = 512,  y = 28,  order = 6,  editingLocked = false,  treeItemIsExpanded = true,  texturePath = 'Data/Textures/GUI/Comics/bttn_skip_dialogue.png',  text = '',  activeRectX = 143,  activeRectY = 36,  },
		{ name = 'text_continue',  entityType = 'TextEntity',  x = 1023,  y = 755,  order = 5,  isVisible = false,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  localizationKey = 'COMICS_CLICK_TO_CONTINUE',  font = 'Data/Fonts/Options.fnt',  height = 25,  boundsX = 310,  boundsY = 0,  alignment = TextEntity.ETextHorizontalAlignmentRight,  hotSpotType = TextEntity.ETextHotSpotTypeRight,  },
		{ name = 'text_field_2',  entityType = 'TextEntity',  x = 512,  y = 728,  order = 5,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  text = 'text',  font = 'Data/Fonts/dialog.fnt',  height = 24,  boundsX = 910,  boundsY = 0,  },
	}
	return objects
end
