Esempio n. 1
0
void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
{
	if( SM == SM_RefreshSelector )
	{
		m_Selector.RefreshAll();
		RefreshNumStepsLoadedFromProfile();
	}
	else if( SM == SM_Success && m_Selector.GetSelectedAction() == EditMenuAction_Delete )
	{
		LOG->Trace( "Delete successful; deleting steps from memory" );

		Song* pSong = GAMESTATE->m_pCurSong;
		Steps* pStepsToDelete = GAMESTATE->m_pCurSteps[PLAYER_1];
		FOREACH_PlayerNumber(pn)
		{
			GAMESTATE->m_pCurSteps[pn].Set(NULL);
		}
		bool bSaveSong = !pStepsToDelete->WasLoadedFromProfile();
		pSong->DeleteSteps( pStepsToDelete );
		SONGMAN->Invalidate( pSong );

		/* Only save to the main .SM file if the steps we're deleting
		 * were loaded from it. */
		if( bSaveSong )
		{
			pSong->Save();
			SCREENMAN->ZeroNextUpdate();
		}
		SCREENMAN->SendMessageToTopScreen( SM_RefreshSelector );
	}
void ScreenEditMenu::Init()
{
	// HACK: Disable any style set by the editor.
	GAMESTATE->SetCurrentStyle( NULL, PLAYER_INVALID );

	// Enable all players.
	FOREACH_PlayerNumber( pn )
		GAMESTATE->JoinPlayer( pn );

	// Edit mode DOES NOT WORK if the master player is not player 1.  The same
	// is true of various parts of this poorly designed screen. -Kyz
	if(GAMESTATE->GetMasterPlayerNumber() != PLAYER_1)
	{
		LOG->Warn("Master player number was not player 1, forcing it to player 1 so that edit mode will work.  If playing in edit mode doesn't work, this might be related.");
		GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
	}

	ScreenWithMenuElements::Init();

	m_Selector.SetName( "EditMenu" );
	m_Selector.Load( EDIT_MENU_TYPE );
	m_Selector.SetXY( 0, 0 );
	this->AddChild( &m_Selector );

	m_textExplanation.SetName( "Explanation" );
	m_textExplanation.LoadFromFont( THEME->GetPathF(m_sName,"explanation") );
	LOAD_ALL_COMMANDS_AND_SET_XY( m_textExplanation );
	RefreshExplanationText();
	this->AddChild( &m_textExplanation );

	m_textNumStepsLoadedFromProfile.SetName( "NumStepsLoadedFromProfile" );
	m_textNumStepsLoadedFromProfile.LoadFromFont( THEME->GetPathF(m_sName,"NumStepsLoadedFromProfile") );
	LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_textNumStepsLoadedFromProfile );
	RefreshNumStepsLoadedFromProfile();
	this->AddChild( &m_textNumStepsLoadedFromProfile );
	if(!m_Selector.SafeToUse())
	{
		m_NoSongsMessage.SetName("NoSongsMessage");
		m_NoSongsMessage.LoadFromFont(THEME->GetPathF(m_sName, "NoSongsMessage"));
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND(m_NoSongsMessage);
		AddChild(&m_NoSongsMessage);
		m_Selector.SetVisible(false);
		m_textExplanation.SetVisible(false);
		m_textNumStepsLoadedFromProfile.SetVisible(false);
	}
}
Esempio n. 3
0
void ScreenEditMenu::Init()
{
	// HACK: Disable any style set by the editor.
	GAMESTATE->SetCurrentStyle( NULL, PLAYER_INVALID );

	// Enable all players.
	FOREACH_PlayerNumber( pn )
		GAMESTATE->JoinPlayer( pn );

	ScreenWithMenuElements::Init();

	m_Selector.SetName( "EditMenu" );
	m_Selector.Load( EDIT_MENU_TYPE );
	m_Selector.SetXY( 0, 0 );
	this->AddChild( &m_Selector );

	m_textExplanation.SetName( "Explanation" );
	m_textExplanation.LoadFromFont( THEME->GetPathF(m_sName,"explanation") );
	LOAD_ALL_COMMANDS_AND_SET_XY( m_textExplanation );
	RefreshExplanationText();
	this->AddChild( &m_textExplanation );

	m_textNumStepsLoadedFromProfile.SetName( "NumStepsLoadedFromProfile" );
	m_textNumStepsLoadedFromProfile.LoadFromFont( THEME->GetPathF(m_sName,"NumStepsLoadedFromProfile") );
	LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_textNumStepsLoadedFromProfile );
	RefreshNumStepsLoadedFromProfile();
	this->AddChild( &m_textNumStepsLoadedFromProfile );
	if(!m_Selector.SafeToUse())
	{
		m_NoSongsMessage.SetName("NoSongsMessage");
		m_NoSongsMessage.LoadFromFont(THEME->GetPathF(m_sName, "NoSongsMessage"));
		LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND(m_NoSongsMessage);
		AddChild(&m_NoSongsMessage);
		m_Selector.SetVisible(false);
		m_textExplanation.SetVisible(false);
		m_textNumStepsLoadedFromProfile.SetVisible(false);
	}
}