class 'MGPanelBase' (Node)

function MGPanelBase:__init(panel, name, order)
	Node.__init(self, panel:getMainEntity(), name, order or 2)
	self.game_scene = panel.game_scene
	
	if self.CreateLoaderTable then
		local table_resource = self:CreateLoaderTable()
		LoadScene(self.main_entity, table_resource)
	end
end
-------------------------------------------------------------------------------

function MGPanelBase:__finalize()
end
-------------------------------------------------------------------------------

function MGPanelBase:addExitFromMG()        -- Метод для выхода из мини-игры
	local size = Vector2f(WSCR_W, 150)
	
	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 MGPanelBase:getAreaExit()
	return self.areaExit
end
-------------------------------------------------------------------------------

function MGPanelBase:onCloseClicked(target, screenFocus)
	self.game_scene:getPlayField():close()
end
-------------------------------------------------------------------------------

function MGPanelBase:updateTextMG()
	local text = ''

	if HasGameState(LAST_VISITED_SCENE) then
		text = GetGameState(LAST_VISITED_SCENE):get(0)
		text = 'HELP_'..string.upper(text)
		text = StringManager:getString(text)
	end

	self:getEntityNamed('text_mg'):setText( text )
end
-------------------------------------------------------------------------------

function MGPanelBase:setTextMG(text)
	self:getEntityNamed('text_mg'):setText( text )
end
-------------------------------------------------------------------------------
function MGPanelBase:getObjectTextMG()
	return self:getEntityNamed('text_mg')
end
-------------------------------------------------------------------------------

