Exemple #1
0
void BangToggle(HWND hwndOwner, LPCTSTR args)
{
    TCHAR name[MAX_LINE_LENGTH];
    
    if (GetToken(args, name, &args, FALSE))
    {
        // Find the label
        Label *label = gLabelManager->FindLabel(name);
        
        if (label)
        {
            // Toggle it's visibility
            label->SetVisible(!label->IsVisible());
        }
    }
}
//-----------------------------------------------------------------------------
// Purpose: Event handler
//-----------------------------------------------------------------------------
void CTFStatsSummaryPanel::FireGameEvent( IGameEvent *event )
{
	const char *pEventName = event->GetName();

	// when we are changing levels and 
	if ( 0 == Q_strcmp( pEventName, "server_spawn" ) )
	{
		if ( !m_bInteractive )
		{
			const char *pMapName = event->GetString( "mapname" );
			if ( pMapName )
			{
				// If we're loading a background map, don't display anything
				// HACK: Client doesn't get gpGlobals->eLoadType, so just do string compare for now.
				if ( Q_stristr( pMapName, "background" ) )
				{
					ClearMapLabel();
				}
				else
				{
					// set the map name in the UI
					wchar_t wzMapName[255] = L"";
					g_pVGuiLocalize->ConvertANSIToUnicode( GetMapDisplayName( pMapName ), wzMapName, sizeof( wzMapName ) );

					SetDialogVariable( "maplabel", wzMapName );

					// set the map type in the UI
					const char *szMapType = GetMapType( pMapName );
					SetDialogVariable( "maptype", g_pVGuiLocalize->Find( szMapType ) );

					// set the map author name in the UI
					const char *szMapAuthor = GetMapAuthor( pMapName );
					if ( szMapAuthor[0] != '\0' )
					{
						SetDialogVariable( "mapauthor", szMapAuthor );

						Label *pMapAuthorLabel = dynamic_cast<Label *>( FindChildByName( "MapAuthorLabel" ) );
						if ( pMapAuthorLabel && !pMapAuthorLabel->IsVisible() )
							pMapAuthorLabel->SetVisible( true );
					}
				}
			}
		}
	}
}