当前位置: 首页>>代码示例>>C++>>正文


C++ Course::Save方法代码示例

本文整理汇总了C++中Course::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ Course::Save方法的具体用法?C++ Course::Save怎么用?C++ Course::Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Course的用法示例。


在下文中一共展示了Course::Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Start

void EditCoursesMenu::Start()
{
	if( m_bInSongMenu )
	{
		m_SongMenu.SaveToCourseEntry( GetSelectedEntry() );
		m_bInSongMenu = false;
		OnRowValueChanged( ROW_ENTRY );
		return;
	}

	Course* pCourse = GetSelectedCourse();
	CourseEntry* pEntry = GetSelectedEntry();

	switch( m_SelectedRow )
	{
	case ROW_COURSE_OPTIONS:
		g_CourseOptionsMenu.rows[repeat].defaultChoice = pCourse->m_bRepeat ? 1 : 0;
		g_CourseOptionsMenu.rows[randomize].defaultChoice = pCourse->m_bRandomize ? 1 : 0;
		g_CourseOptionsMenu.rows[lives].defaultChoice = pCourse->m_iLives;
		if( g_CourseOptionsMenu.rows[lives].defaultChoice == -1 )
			g_CourseOptionsMenu.rows[lives].defaultChoice = 0;
		SCREENMAN->MiniMenu( &g_CourseOptionsMenu, SM_BackFromCourseOptionsMenu );
		break;
	case ROW_ACTION:
		switch( GetSelectedAction() )
		{
		case save:
			m_soundSave.Play();
			pCourse->Save();
			SCREENMAN->SystemMessage( "Course saved." );
			break;
		case add_entry:
			SCREENMAN->PlayStartSound();
			pCourse->m_entries.insert( pCourse->m_entries.begin()+m_iSelection[ROW_ENTRY], pCourse->m_entries[m_iSelection[ROW_ENTRY]] );
			OnRowValueChanged( ROW_ENTRY );
			break;
		case delete_selected_entry:
			if( pCourse->m_entries.size() == 1 )
			{
				SCREENMAN->PlayInvalidSound();
				SCREENMAN->SystemMessage( "Cannot delete the last entry from a course" );
				break;
			}

			SCREENMAN->PlayStartSound();
			pCourse->m_entries.erase( pCourse->m_entries.begin()+m_iSelection[ROW_ENTRY] );
			CLAMP( m_iSelection[ROW_ENTRY], 0, (int) pCourse->m_entries.size()-1 );
			OnRowValueChanged( ROW_ENTRY );
			break;
		default:
			ASSERT(0);
		}

		OnRowValueChanged( ROW_ENTRY );		
		break;
	case ROW_ENTRY_OPTIONS:	
		m_SongMenu.LoadFromCourseEntry( GetSelectedEntry() );
		m_bInSongMenu = true;
		break;
	case ROW_ENTRY_PLAYER_OPTIONS:
		SCREENMAN->PlayStartSound();
			
		GAMESTATE->m_PlayerOptions[PLAYER_1] = PlayerOptions();
		GAMESTATE->m_PlayerOptions[PLAYER_1].FromString( pEntry->modifiers );

		SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions );
		break;
	case ROW_ENTRY_SONG_OPTIONS:	
		SCREENMAN->PlayStartSound();

		GAMESTATE->m_SongOptions = SongOptions();
		GAMESTATE->m_SongOptions.FromString( pEntry->modifiers );

		SCREENMAN->AddNewScreenToTop( "ScreenSongOptions", SM_BackFromSongOptions );
		break;
	default:
		SCREENMAN->PlayInvalidSound();
		return;
	}
}
开发者ID:Fighter19,项目名称:PSPMania,代码行数:80,代码来源:EditCoursesMenu.cpp


注:本文中的Course::Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。