Пример #1
0
void asw_credits_f()
{
	C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if (pPlayer)
	{
		pPlayer->LaunchCredits();
	}
}
Пример #2
0
void MissionCompletePanel::OnCommand(const char* command)
{
	C_ASW_Player* pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer || !ASWGameRules() )
		return;

	C_ASW_Game_Resource *pGameResource = ASWGameResource();
	if ( !pGameResource )
		return;

	bool bLeader = ( pPlayer == pGameResource->GetLeader() );

	if ( !Q_stricmp( command, "XPTab" ) )
	{
		m_PropertySheet->SetActivePage( m_PropertySheet->GetPage( 0 ) );
		if ( !ASWGameRules()->GetMissionSuccess() )
		{
			m_pHeaderFooter->SetTitle("#asw_mission_failed");
		}
		else
		{
			m_pHeaderFooter->SetTitle( "#asw_summary" );
		}
	}
	else if ( !Q_stricmp( command, "StatsTab" ) )
	{
		m_PropertySheet->SetActivePage( m_PropertySheet->GetPage( 1 ) );
		m_pHeaderFooter->SetTitle( "#asw_stats_tab" );
		m_bViewedStatsPage = true;
	}
	else if ( !Q_stricmp( command, "Restart" ) )
	{
		if ( !bLeader )
			return;

		bool bAllReady = pGameResource->AreAllOtherPlayersReady( pPlayer->entindex() );
		if ( bAllReady )
		{
			pPlayer->RequestMissionRestart();
		}
		else
		{
			// ForceReadyPanel* pForceReady = 
			engine->ClientCmd("cl_wants_restart"); // notify other players that we're waiting on them
			new ForceReadyPanel(GetParent(), "ForceReady", "#asw_force_restartm", ASW_FR_RESTART);
		}
	}
	else if ( !Q_stricmp( command, "Ready" ) )
	{
		// just make us ready
		pPlayer->StartReady();
	}
	else if ( !Q_stricmp( command, "Continue" ) )
	{
		if ( ASWGameRules()->GetMissionSuccess() && ASWGameRules()->IsCampaignGame() && ASWGameRules()->CampaignMissionsLeft() <= 1 )
		{
			if ( !m_bCreditsSeen )
			{
				C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer();
				if ( pPlayer )
				{
					m_pStatsPanel->m_pDebrief->m_pPara[0]->SetVisible( false );
					m_pStatsPanel->m_pDebrief->m_pPara[1]->SetVisible( false );
					m_pStatsPanel->m_pDebrief->m_pPara[2]->SetVisible( false );
					pPlayer->LaunchCredits( m_pStatsPanel->m_pDebrief->m_pBackground->m_pBackgroundInner );
					m_bCreditsSeen = true;
					UpdateVisibleButtons();
				}
			}
			else
			{
				// Vote on a new mission
				engine->ClientCmd("asw_vote_chooser 0 notrans");
			}
		}
		else if ( bLeader )
		{
			bool bAllReady = pGameResource->AreAllOtherPlayersReady( pPlayer->entindex() );
			if ( bAllReady )
			{
				if ( ASWGameRules()->IsCampaignGame() && ASWGameRules()->GetMissionSuccess() )   // completed a campaign map
				{
					pPlayer->CampaignSaveAndShow();
				}
				else
				{
					// TODO: Proceed to the next mission, pop up a mission selection dialog, etc?
					// just do a restart for now
					pPlayer->RequestMissionRestart();
				}
			}
			else
			{
				if ( ASWGameRules()->GetMissionSuccess() && ASWGameRules()->IsCampaignGame() )
				{
					// ForceReadyPanel* pForceReady = 
					engine->ClientCmd("cl_wants_continue");	// notify other players that we're waiting on them
					new ForceReadyPanel(GetParent(), "ForceReady", "#asw_force_continuem", ASW_FR_CONTINUE);
				}
				else
				{
					// TODO: Proceed to the next mission, pop up a mission selection dialog, etc?
					// just do a restart for now
					// ForceReadyPanel* pForceReady = 
					engine->ClientCmd("cl_wants_restart"); // notify other players that we're waiting on them
					new ForceReadyPanel(GetParent(), "ForceReady", "#asw_force_restartm", ASW_FR_RESTART);
				}
			}
		}

		return;
	}

	BaseClass::OnCommand(command);
}