コード例 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionWithStopTimeDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char stoptype[ 512 ];
	m_pStopType->GetText( stoptype, sizeof( stoptype ) );

	char stop[ 512 ];
	m_pStop->GetText( stop, sizeof( stop ) );

	float fstop = (float)atof( stop );
	int	 istop = (int)atoi( stop );

	if ( !Q_strcasecmp( stoptype, "TimeUseFrame" ) )
	{
		if ( GetAction()->m_nStopFrame != istop )
		{
			bret = true;
			GetAction()->SetStopFrame( istop );
			GetAction()->SetStopTime( -1.0f );
		}
	}
	else
	{
		if ( GetAction()->m_flStopTime != fstop )
		{
			bret = true;
			GetAction()->SetStopTime( fstop );
			GetAction()->SetStopFrame( -1 );
		}
	}

	return bret;
}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true if changes were effected
//-----------------------------------------------------------------------------
bool CBaseActionSkipAheadDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	char skiptype[ 512 ];
	m_pSkipType->GetText( skiptype, sizeof( skiptype ) );

	char skipto[ 512 ];
	m_pSkip->GetText( skipto, sizeof( skipto ) );

	float fskip = (float)atof( skipto );
	int	 iskip = (int)atoi( skipto );

	if ( !Q_strcasecmp( skiptype, "TimeUseTick" ) )
	{
		if ( GetAction()->m_nSkipToTick != iskip )
		{
			bret = true;
			GetAction()->SetSkipToTick( iskip );
			GetAction()->SetSkipToTime( -1.0f );
		}
	}
	else
	{
		if ( GetAction()->m_flSkipToTime != fskip )
		{
			bret = true;
			GetAction()->SetSkipToTime( fskip );
			GetAction()->SetSkipToTick( -1 );
		}
	}

	return bret;
}
コード例 #3
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBaseActionTextMessageStartDialog::OnSaveChanges( void )
{
	bool bret = BaseClass::OnSaveChanges();

	client_textmessage_t *tm = GetAction()->GetTextMessage();
	bret |= SaveDifferingFloat( m_pFadeInTime, &tm->fadein );
	bret |= SaveDifferingFloat( m_pFadeOutTime, &tm->fadeout );
	bret |= SaveDifferingFloat( m_pHoldTime, &tm->holdtime );
	bret |= SaveDifferingFloat( m_pFXTime, &tm->fxtime );

	bret |= SaveDifferingFloat( m_pX, &tm->x );
	bret |= SaveDifferingFloat( m_pY, &tm->y );

	bret |= SaveDifferingColor( m_pColor1, &tm->r1, &tm->g1, &tm->b1, &tm->a1 );
	bret |= SaveDifferingColor( m_pColor2, &tm->r2, &tm->g2, &tm->b2, &tm->a2 );

	char sz[ 1024 ];
	m_pEffectType->GetText( sz, sizeof( sz ) );
	int iEffect = EffectTypeForName( sz );
	if ( iEffect != tm->effect )
	{
		tm->effect = iEffect;
		bret = true;
	}

	m_pMessageText->GetText( sz, sizeof( sz ) );
	if ( Q_strcasecmp( sz, GetAction()->GetMessageText() ) )
	{
		GetAction()->SetMessageText( sz );
		bret = true;
	}

	m_pFontName->GetText( sz, sizeof( sz ) );
	if ( Q_strcasecmp( sz, GetAction()->GetFontName() ) )
	{
		GetAction()->SetFontName( sz );
		bret = true;
	}
	return bret;
}
コード例 #4
0
//-----------------------------------------------------------------------------
// command handler
//-----------------------------------------------------------------------------
void CAddPresetDialog::OnCommand( const char *command )
{
	if ( !Q_stricmp( command, "OK" ) )
	{
		int nTextLength = m_pInput->GetTextLength() + 1;
		char* txt = (char*)_alloca( nTextLength * sizeof(char) );
		m_pInput->GetText( txt, nTextLength );

		nTextLength = m_pPresetGroup->GetTextLength() + 1;
		char* pPresetGroupName = (char*)_alloca( nTextLength * sizeof(char) );
		m_pPresetGroup->GetText( pPresetGroupName, nTextLength );

		KeyValues *pCurrentGroup = m_pPresetGroup->GetActiveItemUserData();
		CDmePresetGroup *pPresetGroup = pCurrentGroup ? GetElementKeyValue<CDmePresetGroup>( pCurrentGroup, "presetGroup" ) : NULL;
		if ( pPresetGroup && Q_stricmp( pPresetGroup->GetName(), pPresetGroupName ) )
		{
			pPresetGroup = NULL;
		}
		KeyValues *kv = new KeyValues( "PresetNameSelected", "text", txt );
		kv->SetString( "presetGroupName", pPresetGroupName );
		SetElementKeyValue( kv, "presetGroup", pPresetGroup );

		if ( m_pContextKeyValues )
		{
			kv->AddSubKey( m_pContextKeyValues );
			m_pContextKeyValues = NULL;
		}
		PostActionSignal( kv );
		CloseModal();
		return;
	}

	if ( !Q_stricmp( command, "Cancel") )
	{
		CloseModal();
		return;
	}

	BaseClass::OnCommand( command );
}