示例#1
0
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CMOMSpectatorGUI::CMOMSpectatorGUI(IViewPort *pViewPort) : EditablePanel(nullptr, PANEL_SPECGUI)
{
    // 	m_bHelpShown = false;
    //	m_bInsetVisible = false;
    //	m_iDuckKey = KEY_NONE;
    SetSize(10, 10); // Quiet "parent not sized yet" spew
    m_bSpecScoreboard = false;

    m_pViewPort = pViewPort;
    g_pMOMSpectatorGUI = this;

    ListenForGameEvent("spec_target_updated");

    surface()->CreatePopup(GetVPanel(), false, false, false, false, false);

    m_flNextUpdateTime = -1.0f;

    // initialize dialog
    SetVisible(false);
    SetProportional(true);

    // load the new scheme early!!
    SetScheme("ClientScheme");
    SetMouseInputEnabled(false);
    SetKeyBoardInputEnabled(false);

    LoadControlSettings(GetResFile());

    m_pTopBar = FindControl<Panel>("topbar");
    m_pBottomBarBlank = FindControl<Panel>("bottombarblank");

    m_pPlayerLabel = FindControl<Label>("playerlabel");
    m_pPlayerLabel->SetVisible(false);

    m_pReplayLabel = FindControl<Label>("replaylabel");
    m_pTimeLabel = FindControl<Label>("timelabel");

    m_pCloseButton = FindControl<ImagePanel>("Close_Panel");
    m_pCloseButton->SetMouseInputEnabled(true);
    m_pCloseButton->InstallMouseHandler(this);

    TextImage *image = m_pPlayerLabel->GetTextImage();
    if (image)
    {
        HFont hFallbackFont = scheme()->GetIScheme(GetScheme())->GetFont("DefaultVerySmallFallBack", false);
        if (INVALID_FONT != hFallbackFont)
        {
            image->SetUseFallbackFont(true, hFallbackFont);
        }
    }

    SetPaintBorderEnabled(false);
    SetPaintBackgroundEnabled(false);

    InvalidateLayout();
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CSpectatorGUI::CSpectatorGUI(IViewPort *pViewPort) : EditablePanel( NULL, PANEL_SPECGUI )
{
// 	m_bHelpShown = false;
//	m_bInsetVisible = false;
//	m_iDuckKey = KEY_NONE;
	SetSize( 10, 10 ); // Quiet "parent not sized yet" spew
	m_bSpecScoreboard = false;

	m_pViewPort = pViewPort;
	g_pSpectatorGUI = this;

	// initialize dialog
	SetVisible(false);
	SetProportional(true);

	// load the new scheme early!!
	SetScheme("ClientScheme");
	SetMouseInputEnabled( false );
	SetKeyBoardInputEnabled( false );

	m_pTopBar = new Panel( this, "topbar" );
 	m_pBottomBarBlank = new Panel( this, "bottombarblank" );

	// m_pBannerImage = new ImagePanel( m_pTopBar, NULL );
	m_pPlayerLabel = new Label( this, "playerlabel", "" );
	m_pPlayerLabel->SetVisible( false );
	TextImage *image = m_pPlayerLabel->GetTextImage();
	if ( image )
	{
		HFont hFallbackFont = scheme()->GetIScheme( GetScheme() )->GetFont( "DefaultVerySmallFallBack", false );
		if ( INVALID_FONT != hFallbackFont )
		{
			image->SetUseFallbackFont( true, hFallbackFont );
		}
	}

	SetPaintBorderEnabled(false);
	SetPaintBackgroundEnabled(false);

	// m_pBannerImage->SetVisible(false);
	InvalidateLayout();
}