class 'InGameMenuBase' (BaseScreen)

function InGameMenuBase:__init(name)
	BaseScreen.__init(self, name)
	
	self:getEntityNamed('bttn_continue').onPress:add(bind(self.onContinueButtonClick, self))
	self:getEntityNamed('bttn_options').onPress:add(bind(self.onOptionsButtonClick, self))
	self:getEntityNamed('bttn_help').onPress:add(bind(self.onHelpButtonClick, self))
	self:getEntityNamed('bttn_exit').onPress:add(bind(self.onExitButtonClick, self))

	self.timer:add( function()
						self:addHotKey(ERSK_ESCAPE, bind(self.onContinueButtonClick, self))
					end, 0.5)

	-- add sfx-sound on click
	do
		self:getEntityNamed('bttn_continue'):setSFXTrackOnPress( getCommonSoundEntity('ButtonClick') )
		self:getEntityNamed('bttn_options'):setSFXTrackOnPress( getCommonSoundEntity('ButtonClick') )
		self:getEntityNamed('bttn_help'):setSFXTrackOnPress( getCommonSoundEntity('ButtonClick') )
		self:getEntityNamed('bttn_exit'):setSFXTrackOnPress( getCommonSoundEntity('ButtonClick') )
	end

	AudioManager:inGamePause()
	
	if Application:getApplicationDescriptor().optionsMenuButtonEnabled == false then
	    self:entityHide('bttn_options')
    end
end

function InGameMenuBase:__finalize()
end

function InGameMenuBase:onUpdate(dt)
end

function InGameMenuBase:onContinueButtonClick()
	if not self.is_already_destroying then
		self:onScreenDestroy()
		self.is_already_destroying = true
	end
end

function InGameMenuBase:onOptionsButtonClick()
	createOptionsScreen(true)
end

function InGameMenuBase:onHelpButtonClick()
	createHelpScreen()
end

function InGameMenuBase:onExitButtonClick()
	createYesNoScreen('REALLY_QUIT_TO_MENU', bind(self.onExitToMainMenu, self), nil, true)
end

function InGameMenuBase:onExitToMainMenu()
	exitToMainMenu()
end

function InGameMenuBase:onScreenDestroy()
	self:removeAllHanderInHotKey(ERSK_ESCAPE)
	PopUpScreensMgr:pop()

	AudioManager:inGameResume()
end