class DeathMenuUserData extends IScriptable
{
	var m_playInitAnimation : Bool;
}

class MenuScenario_DeathMenu extends MenuScenario_BaseMenu
{

	protected event OnEnterScenario( prevScenario : CName, userData : IScriptable )
	{
		var deathUserData : DeathMenuUserData;
		deathUserData = new DeathMenuUserData;
		deathUserData.m_playInitAnimation = true;
		GetMenusState().OpenMenu( 'pause_menu_background' );
		SwitchMenu( 'death_menu', deathUserData );
	}

	protected event OnSwitchToLoadGame()
	{
		SwitchMenu( 'load_game' );
	}

	protected event OnSwitchToSettings()
	{
		SwitchMenu( 'settings_main' );
	}

	protected event OnCloseDeathMenu()
	{
		SwitchToScenario( 'MenuScenario_Idle' );
	}

	protected event OnMainMenuBack()
	{
		SwitchMenu( 'death_menu' );
	}

	protected event OnCloseSettingsScreen()
	{
		GoBack( true );
	}

	protected event OnBack()
	{
		GoBack( false );
	}

	protected event OnSwitchToBrightnessSettings()
	{
		m_prevMenuName = m_currMenuName;
		SwitchMenu( 'brightness_settings' );
	}

	protected event OnSwitchToHDRSettings()
	{
		m_prevMenuName = m_currMenuName;
		SwitchMenu( 'hdr_settings' );
	}

	protected event OnSwitchToControllerPanel()
	{
		var menuState : weak< inkMenusState >;
		menuState = GetMenusState();
		m_prevMenuName = m_currMenuName;
		SwitchMenu( menuState.GetControllerMenuName() );
	}

	private function GoBack( forceCloseSettings : Bool )
	{
		var menuState : weak< inkMenusState >;
		menuState = GetMenusState();
		if( m_currMenuName == 'death_menu' )
		{
			return;
		}
		if( m_prevMenuName != '' )
		{
			SwitchMenu( m_prevMenuName );
			m_prevMenuName = '';
		}
		else if( ( m_currMenuName == 'settings_main' || m_currMenuName == menuState.GetControllerMenuName() ) && !( forceCloseSettings ) )
		{
			menuState.DispatchEvent( m_currMenuName, 'OnBack' );
		}
		else
		{
			GotoIdleState();
		}
	}

	protected override function GotoIdleState()
	{
		SwitchMenu( 'death_menu' );
	}

}

