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

class 'MGPanel' (MGPanelBase)

function MGPanel:__init(panel)
    MGPanelBase.__init(self, panel, 'MGPanel', 3)
end
-------------------------------------------------------------------------------
function MGPanel:addExitFromMG()        -- Метод для выхода из мини-игры
	--if self.areaExit then	
		local size = Vector2f(672, 70)

		self.areaExit = CreateSpriteEntity('')
		self.areaExit:setName			( 'area_link_exitFromMG' )
		self.areaExit:attachTo			( self.game_scene:getPanel():getMGPanel():getMainEntity() )
		self.areaExit:setAnimationSize	( size )
		self.areaExit:setXY				( WORK_W/2,  WORK_H - size.y/2 )
		self.areaExit:setColor			( Colorf(1, 1, 1, 0.01) )
		self.areaExit:setOrder			( 1500 )
		self.areaExit:setCursorOverName	( 'CursorDown' )
		self.areaExit.onClickBegin:add	( bind(self.onCloseClicked, self) )
--	end

	--if not self.areaExit_2 then
		size = Vector2f(WSCR_W, 120)
	
		self.areaExit_2 = CreateSpriteEntity('')
		self.areaExit_2:setName			( 'area_link_exitFromMG_2' )
		self.areaExit_2:attachTo			( self.game_scene:getPlayField():getMainEntity() )
		self.areaExit_2:setAnimationSize	( size )
		self.areaExit_2:setXY				( WORK_W/2,  WORK_H - size.y/2 )
		self.areaExit_2:setColor			( Colorf(1, 1, 1, 0.01) )
		self.areaExit_2:setOrder			( 1500 )
		self.areaExit_2:setCursorOverName	( 'CursorDown' )
		self.areaExit_2.onClickBegin:add	( bind(self.onCloseClicked, self) )
	--end
end
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
-- function MGPanel:addExitFromQuest()        -- Метод для выхода из мини-игры
-- 	local size = Vector2f(WSCR_W, 100)

-- 	if self.areaExit then
-- 		self.areaExit:destroy()
-- 	end
	
-- 	self.areaExit = CreateSpriteEntity('')
-- 	self.areaExit:setName			( 'area_link_exitFromMG' )
-- 	self.areaExit:attachTo			( self.game_scene:getPlayField():getMainEntity() )
-- 	self.areaExit:setAnimationSize	( size )
-- 	self.areaExit:setXY				( WORK_W/2,  WORK_H - size.y/2 )
-- 	self.areaExit:setColor			( Colorf(1, 1, 1, 0.01) )
-- 	self.areaExit:setOrder			( 1500 )
-- 	self.areaExit:setCursorOverName	( 'CursorDown' )
-- 	self.areaExit.onClickBegin:add	( bind(self.onCloseClicked, self) )
-- end
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
function MGPanel:onCloseClicked(target, screenFocus)
	if self.areaExit then
		self.areaExit:destroy()
		self.areaExit = nil
	end	

	if self.areaExit_2 then
		self.areaExit_2:destroy()
		self.areaExit_2 = nil
	end	
	
	self.game_scene:getPlayField():close()
end
-------------------------------------------------------------------------------

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

function MGPanel:CreateLoaderTable()
	local objects =
	{
		{ name = 'text_mg',  entityType = 'TextEntity',  x = 512,  y = 734,  order = 0,  isRespondable = false,  editingLocked = false,  treeItemIsExpanded = true,  text = 'new text',  font = 'Data/Fonts/Options.fnt',  height = 26,  boundsX = 630,  boundsY = 87,  },
	}
	return objects
end
