Exemplo n.º 1
0
//-----------------------------------------------------------------------------
// Purpose: Returns prev settings
//-----------------------------------------------------------------------------
bool CGameUI::SetShowProgressText( bool show )
{
	if (!g_hLoadingDialog.Get())
		return false;

	return g_hLoadingDialog->SetShowProgressText( show );
}
Exemplo n.º 2
0
void ShowMedalCollection()
{
	using namespace vgui;

	vgui::Panel *pMedalPanel = GetClientMode()->GetViewport()->FindChildByName("MedalCollectionPanel", true);
	if (pMedalPanel)	
	{
		pMedalPanel->SetVisible(false);
		pMedalPanel->MarkForDeletion();
		pMedalPanel = NULL;
		return;
	}

	vgui::Frame* pFrame = NULL;
	// create the basic frame which holds our briefing panels
	//Msg("Assigning player list frame\n");
	if (g_hBriefingFrame.Get())	// todo: handle if they bring it up during debrief or campaign map too
		pMedalPanel = new vgui::Panel( g_hBriefingFrame.Get(), "MedalCollectionPanel" );
	else
	{
		pFrame = new vgui::Frame( GetClientMode()->GetViewport(), "MedalCollectionPanel" );
		pMedalPanel = pFrame;
	}
	HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew");
	pMedalPanel->SetScheme(scheme);
	pMedalPanel->SetBounds(0, 0, GetClientMode()->GetViewport()->GetWide(), GetClientMode()->GetViewport()->GetTall());
	//pMedalPanel->SetPos(GetClientMode()->GetViewport()->GetWide() * 0.15f, GetClientMode()->GetViewport()->GetTall() * 0.15f);
	//pMedalPanel->SetSize( GetClientMode()->GetViewport()->GetWide() * 0.7f, GetClientMode()->GetViewport()->GetTall() * 0.7f );

	if (pFrame)
	{		
		pFrame->SetMoveable(false);
		pFrame->SetSizeable(false);
		pFrame->SetMenuButtonVisible(false);
		pFrame->SetMaximizeButtonVisible(false);
		pFrame->SetMinimizeToSysTrayButtonVisible(false);
		pFrame->SetCloseButtonVisible(true);
		pFrame->SetTitleBarVisible(false);
	}
	pMedalPanel->SetPaintBackgroundEnabled(false);
	pMedalPanel->SetBgColor(Color(0,0,0, 192));

	// the panel to show the info
	MedalCollectionPanel *collection = new MedalCollectionPanel( pMedalPanel, "Collection" );
	collection->SetVisible( true );
	collection->SetBounds(0, 0, pMedalPanel->GetWide(),pMedalPanel->GetTall());

	if (!pMedalPanel)
	{
		Msg("Error: pMedalPanel frame was closed immediately on opening\n");
	}
	else
	{
		pMedalPanel->RequestFocus();
		pMedalPanel->SetVisible(true);
		pMedalPanel->SetEnabled(true);
		pMedalPanel->SetKeyBoardInputEnabled(false);
		pMedalPanel->SetZPos(200);		
	}
}
Exemplo n.º 3
0
//-----------------------------------------------------------------------------
// Purpose: gets the font from the scheme
//-----------------------------------------------------------------------------
void Tooltip::ApplySchemeSettings(IScheme *pScheme)
{
	if ( s_TooltipWindow.Get() )
	{
		s_TooltipWindow->SetFont(pScheme->GetFont("DefaultSmall", s_TooltipWindow->IsProportional()));
	}
}
Exemplo n.º 4
0
vgui::HFont ASW_GetSmallFont(bool bGlow)
{
    vgui::IScheme *pScheme = vgui::scheme()->GetIScheme( vgui::scheme()->GetScheme( "SwarmSchemeNew" ) );
    if ( !pScheme )
        return vgui::INVALID_FONT;

    return pScheme->GetFont( "DefaultSmall", true );

    if (!g_hObjectivesHUD.Get())
    {
        g_hObjectivesHUD = GET_HUDELEMENT( CASWHudObjective );
    }

    if (!g_hObjectivesHUD.Get())
    {
        return vgui::INVALID_FONT;
    }

    if (g_hObjectivesHUD->m_iLastHeight != ScreenHeight())
        g_hObjectivesHUD->SetDefaultHUDFonts();

    if (bGlow)
        return g_hObjectivesHUD->m_hSmallGlowFont;

    return g_hObjectivesHUD->m_hSmallFont;
}
Exemplo n.º 5
0
//-----------------------------------------------------------------------------
// Purpose: Set the tooltip text
//-----------------------------------------------------------------------------
void Tooltip::SetText(const char *text)
{
	_isDirty = true;

	if (!text)
	{
		text = "";
	}

	if (m_Text.Count() > 0)
	{
		m_Text.RemoveAll();
	}

	for (unsigned int i = 0; i < strlen(text); i++)
	{
		m_Text.AddToTail(text[i]);
	}
	m_Text.AddToTail('\0');
	
	if (s_TooltipWindow.Get())
	{
		s_TooltipWindow->SetText(m_Text.Base());
	}
}
//-----------------------------------------------------------------------------
// main application
//-----------------------------------------------------------------------------
void CVsVGuiWindow::Detach()
{
	if ( m_hTimerCallbackId != 0 )
	{
		MTimerMessage::removeCallback( m_hTimerCallbackId );
		m_hTimerCallbackId = 0;
	}

	if ( m_hMainPanel.Get() )
	{
		m_hMainPanel->MarkForDeletion();
		m_hMainPanel = NULL;
	}

	if ( m_hVGuiContext != vgui::DEFAULT_VGUI_CONTEXT )
	{
		vgui::ivgui()->DestroyContext( m_hVGuiContext );
		m_hVGuiContext = vgui::DEFAULT_VGUI_CONTEXT;
	}

	// detach
	if ( m_hWnd )
	{
		// kill the timer if any
		g_pMaterialSystem->RemoveView( m_hWnd );
		RemoveWindowSubclass( m_hWnd, SubclassCallback, s_subclassId );
		m_hWnd = NULL;
	}

	if ( m_hKeyFocusWnd )
	{
		RemoveWindowSubclass( m_hKeyFocusWnd, KeyFocusSubclassCallback, s_subclassId );
		m_hKeyFocusWnd = NULL;
	}
}
Exemplo n.º 7
0
//-----------------------------------------------------------------------------
// Purpose: Called when the game disconnects from a server
//-----------------------------------------------------------------------------
void CGameUI::OnDisconnectFromServer( uint8 eSteamLoginFailure )
{
	m_iGameIP = 0;
	m_iGameConnectionPort = 0;
	m_iGameQueryPort = 0;

	if ( g_hLoadingBackgroundDialog )
	{
		vgui::ivgui()->PostMessage( g_hLoadingBackgroundDialog, new KeyValues("DisconnectedFromGame"), NULL );
	}

	g_VModuleLoader.PostMessageToAllModules(new KeyValues("DisconnectedFromGame"));

	if ( eSteamLoginFailure == STEAMLOGINFAILURE_NOSTEAMLOGIN )
	{
		if ( g_hLoadingDialog )
		{
			g_hLoadingDialog->DisplayNoSteamConnectionError();
		}
	}
	else if ( eSteamLoginFailure == STEAMLOGINFAILURE_VACBANNED )
	{
		if ( g_hLoadingDialog )
		{
			g_hLoadingDialog->DisplayVACBannedError();
		}
	}
	else if ( eSteamLoginFailure == STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE )
	{
		if ( g_hLoadingDialog )
		{
			g_hLoadingDialog->DisplayLoggedInElsewhereError();
		}
	}
}
void BriefingImagePanel::CloseBriefingFrame()
{
	if (g_hBriefingFrame.Get())
	{
		if (GetClientModeASW())
			GetClientModeASW()->StopBriefingMusic();
		g_hBriefingFrame->SetDeleteSelfOnClose(true);
		g_hBriefingFrame->Close();

		FadeInPanel *pFadeIn = dynamic_cast<FadeInPanel*>(GetClientMode()->GetViewport()->FindChildByName("FadeIn", true));
		if (pFadeIn)
		{
			pFadeIn->AllowFastRemove();
		}

		// clear the currently visible part of the chat
		CHudChat *pChat = GET_HUDELEMENT( CHudChat );
		if (pChat && pChat->GetChatHistory())
			pChat->GetChatHistory()->ResetAllFades( false, false, 0 );
// 		if (m_pChatEcho)
// 		{
// 			m_pChatEcho->SetVisible(false);
// 		}
	}

	g_hBriefingFrame = NULL;
}
Exemplo n.º 9
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CGameUI::SetSecondaryProgressBar(float progress /* range [0..1] */)
{
	if (!g_hLoadingDialog.Get())
		return;

	g_hLoadingDialog->SetSecondaryProgress(progress);
}
Exemplo n.º 10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CGameUI::SetSecondaryProgressBarText(const char *statusText)
{
	if (!g_hLoadingDialog.Get())
		return;

	g_hLoadingDialog->SetSecondaryProgressText(statusText);
}
//-----------------------------------------------------------------------------
// Purpose: stops progress bar, displays error if necessary
//-----------------------------------------------------------------------------
void CGameUI::StopProgressBar(bool bError, const char *failureReason, const char *extendedReason)
{
	if (!g_hLoadingDialog.Get() && bError)
	{
		g_hLoadingDialog = new CLoadingDialog(staticPanel);
	}

	if (!g_hLoadingDialog.Get())
		return;

	if (bError)
	{
		// turn the dialog to error display mode
		g_hLoadingDialog->DisplayError(failureReason,extendedReason);
	}
	else
	{
		// close loading dialog
		g_hLoadingDialog->Close();
		g_hLoadingDialog = NULL;
	}

	// stop drawing loading screen
	staticPanel->SetBackgroundRenderState(CBasePanel::BACKGROUND_DESKTOPIMAGE);
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CGameUI::ContinueProgressBar(int progressPoint, float progressFraction)
{
	if (!g_hLoadingDialog.Get())
		return 0;

	g_hLoadingDialog->SetProgressPoint(progressPoint);
	return 1;
}
Exemplo n.º 13
0
	void Shutdown()
	{
		DestroySDKLoadingPanel();
		if (g_hLogoPanel.Get())
		{
			delete g_hLogoPanel.Get();
		}
	}
//-----------------------------------------------------------------------------
// Purpose: sets loading info text
//-----------------------------------------------------------------------------
int CGameUI::SetProgressBarStatusText(const char *statusText)
{
	if (!g_hLoadingDialog.Get())
		return 0;

	g_hLoadingDialog->SetStatusText(statusText);
	return 1;
}
Exemplo n.º 15
0
//-----------------------------------------------------------------------------
// Purpose: Display the tooltip
//-----------------------------------------------------------------------------
void Tooltip::HideTooltip()
{
	if ( s_TooltipWindow.Get() )
	{
		s_TooltipWindow->SetVisible(false);
	}
	_makeVisible = false;
}
Exemplo n.º 16
0
//-----------------------------------------------------------------------------
// Purpose: returns true if the screen should be updated
//-----------------------------------------------------------------------------
bool CGameUI::ContinueProgressBar( float progressFraction )
{
	if (!g_hLoadingDialog.Get())
		return false;

	g_hLoadingDialog->Activate();
	return g_hLoadingDialog->SetProgressPoint(progressFraction);
}
Exemplo n.º 17
0
//-----------------------------------------------------------------------------
// Purpose: Set the tooltip text
//-----------------------------------------------------------------------------
void TextTooltip::SetText(const char *text)
{
	BaseTooltip::SetText( text );
	
	if (s_TooltipWindow.Get())
	{
		s_TooltipWindow->SetText(m_Text.Base());
	}
}
Exemplo n.º 18
0
//-----------------------------------------------------------------------------
// Purpose: Display the tooltip
//-----------------------------------------------------------------------------
void TextTooltip::HideTooltip()
{
	if ( s_TooltipWindow.Get() )
	{
		s_TooltipWindow->SetVisible(false);
	}

	BaseTooltip::HideTooltip();
}
void asw_pick_stim_music_f()
{
	if (g_hSelectStimMusicDialog.Get() == NULL)
	{
		g_hSelectStimMusicDialog = new StimMusicSelectDialog(NULL, "#asw_pick_stim_music", vgui::FOD_OPEN, NULL);
		g_hSelectStimMusicDialog->AddFilter("*.mp3,*.wav", "#asw_stim_music_types", true);
	}
	g_hSelectStimMusicDialog->DoModal(false);
	g_hSelectStimMusicDialog->Activate();
}
Exemplo n.º 20
0
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
Tooltip::~Tooltip()
{
	if (--s_iTooltipWindowCount < 1)
	{
		if ( s_TooltipWindow.Get() )
		{
			s_TooltipWindow->MarkForDeletion();
		}
		s_TooltipWindow = NULL;
	}
}
Exemplo n.º 21
0
//-----------------------------------------------------------------------------
// Purpose: Display the tooltip
//-----------------------------------------------------------------------------
void Tooltip::ShowTooltip(Panel *currentPanel)
{
	if ( s_TooltipWindow.Get() )
	{
		s_TooltipWindow->SetText(m_Text.Base());
		s_TooltipWindow->SetParent(currentPanel);
	}
	_makeVisible = true;

	PerformLayout();
}
Exemplo n.º 22
0
void ClientModeSDK::Shutdown()
{
    if ( ASWBackgroundMovie() )
    {
        ASWBackgroundMovie()->ClearCurrentMovie();
    }
    DestroySDKLoadingPanel();
    if (g_hLogoPanel.Get())
    {
        delete g_hLogoPanel.Get();
    }
}
Exemplo n.º 23
0
//-----------------------------------------------------------------------------
// main application
//-----------------------------------------------------------------------------
void CVsVGuiWindow::PaintWindow()
{
	if ( m_nCurrentTick == m_nLastRenderedTick || !g_pVGui->IsRunning() )
	{
		ValidateRect( m_hWnd, NULL );
		return;
	}

	m_nCurrentTick = m_nLastRenderedTick;

	vgui::VPANEL root = g_pVGuiSurface->GetEmbeddedPanel();
	g_pVGuiSurface->Invalidate( root );

	RECT windowRect;
	CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
	::GetClientRect( m_hWnd, &windowRect );
	g_pMaterialSystem->SetView( m_hWnd );
	pRenderContext->Viewport( 0, 0, windowRect.right, windowRect.bottom );

	float flStartTime = Plat_FloatTime();

	pRenderContext->ClearColor4ub( 76, 88, 68, 255 ); 
	pRenderContext->ClearBuffers( true, true );

	g_pMaterialSystem->BeginFrame( 0 );

	// draw from the main panel down
	if ( m_hMainPanel.Get() )
	{
		int w, h;
		m_hMainPanel->GetSize( w, h );

		if ( w != windowRect.right || h != windowRect.bottom )
		{
			m_hMainPanel->SetBounds( 0, 0, windowRect.right, windowRect.bottom );
			m_hMainPanel->Repaint();
		}

		g_pVGuiSurface->RestrictPaintToSinglePanel( m_hMainPanel->GetVPanel() );
		g_pVGuiSurface->PaintTraverseEx( root, true );
		g_pVGuiSurface->RestrictPaintToSinglePanel( 0 );
	}

	g_pMaterialSystem->EndFrame();
	g_pMaterialSystem->SwapBuffers();
	g_pMaterialSystem->SetView( NULL );
	ValidateRect( m_hWnd, NULL );

	m_flRenderDelayTime = Plat_FloatTime() - flStartTime;
	m_flRenderDelayTime = max( m_flRenderDelayTime, 0.015f );
}
Exemplo n.º 24
0
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
Tooltip::Tooltip(Panel *parent, const char *text) 
{
	if (!s_TooltipWindow.Get())
	{
		s_TooltipWindow = new TextEntry(NULL, "tooltip");
	}
	s_iTooltipWindowCount++;

	// this line prevents the main window from losing focus
	// when a tooltip pops up
	s_TooltipWindow->MakePopup(false, true);
	s_TooltipWindow->SetKeyBoardInputEnabled( false );
	s_TooltipWindow->SetMouseInputEnabled( false );
	
	SetText(text);
	s_TooltipWindow->SetText(m_Text.Base());
	s_TooltipWindow->SetEditable(false);
	s_TooltipWindow->SetMultiline(true);
	s_TooltipWindow->SetVisible(false);

	_displayOnOneLine = false;
	_makeVisible = false;
	_isDirty = false;

	_tooltipDelay = 500; // default delay for opening tooltips
	_delay = 0;
}
Exemplo n.º 25
0
//-----------------------------------------------------------------------------
// Purpose: sets loading info text
//-----------------------------------------------------------------------------
bool CGameUI::SetProgressBarStatusText(const char *statusText)
{
	if (!g_hLoadingDialog.Get())
		return false;

	if (!statusText)
		return false;

	if (!stricmp(statusText, m_szPreviousStatusText))
		return false;

	g_hLoadingDialog->SetStatusText(statusText);
	Q_strncpy(m_szPreviousStatusText, statusText, sizeof(m_szPreviousStatusText));
	return true;
}
Exemplo n.º 26
0
void ClientModeSDK::Shutdown()
{
	// Clear cursor overrider
	g_pVGuiSurface = s_SurfacePassThru.GetRealSurface();

	if ( SDKBackgroundMovie() )
	{
		SDKBackgroundMovie()->ClearCurrentMovie();
	}
	DestroySDKLoadingPanel();
	if (g_hLogoPanel.Get())
	{
		delete g_hLogoPanel.Get();
	}
}
Exemplo n.º 27
0
//-----------------------------------------------------------------------------
// Purpose: stops progress bar, displays error if necessary
//-----------------------------------------------------------------------------
void CGameUI::StopProgressBar(bool bError, const char *failureReason, const char *extendedReason)
{
	if (!g_hLoadingDialog.Get())
		return;

	if ( !IsX360() && bError )
	{
		// turn the dialog to error display mode
		g_hLoadingDialog->DisplayGenericError(failureReason, extendedReason);
	}
	else
	{
		// close loading dialog
		g_hLoadingDialog->Close();
		g_hLoadingDialog = NULL;
	}
	// should update the background to be in a transition here
}
Exemplo n.º 28
0
//-----------------------------------------------------------------------------
// Sets a panel to be the main panel
//-----------------------------------------------------------------------------
void CVsVGuiWindow::SetMainPanel( vgui::EditablePanel * pPanel )
{
	Assert( m_hMainPanel.Get() == NULL );
	Assert( m_hVGuiContext == vgui::DEFAULT_VGUI_CONTEXT );

	m_hMainPanel = pPanel;

	m_hMainPanel->SetParent( vgui::surface()->GetEmbeddedPanel() );
	m_hMainPanel->SetVisible( true );
	m_hMainPanel->SetCursor( vgui::dc_arrow );

	m_hVGuiContext = vgui::ivgui()->CreateContext();
	vgui::ivgui()->AssociatePanelWithContext( m_hVGuiContext, m_hMainPanel->GetVPanel() );

	pPanel->InvalidateLayout();

	EnableWindow( m_hWnd, true );
	SetFocus( m_hWnd );
}
void CBaseActionPlaySoundStartDialog::OnCommand( char const *command )
{
	if ( !Q_strcasecmp( command, "choosesound" ) )
	{
		if ( !m_hFileOpenDialog.Get() )
		{
			m_hFileOpenDialog = new vgui::FileOpenDialog( this, "Choose .wav file", true );
		}
		if ( m_hFileOpenDialog )
		{
			char startPath[ MAX_PATH ];
			Q_strncpy( startPath, com_gamedir, sizeof( startPath ) );
			COM_FixSlashes( startPath );
			m_hFileOpenDialog->SetStartDirectory( va( "%s/sound", startPath ) );
			m_hFileOpenDialog->DoModal( false );
		}
		return;
	}
	
	BaseClass::OnCommand( command );
}
Exemplo n.º 30
0
//-----------------------------------------------------------------------------
// Purpose: Display the tooltip
//-----------------------------------------------------------------------------
void TextTooltip::PerformLayout()
{
	if ( !ShouldLayout() )
		return;
	// we're ready, just make us visible
	if ( !s_TooltipWindow.Get() )
		return;

	_isDirty = false;

	s_TooltipWindow->SetVisible(true);
	s_TooltipWindow->MakePopup( false, true );
	s_TooltipWindow->SetKeyBoardInputEnabled( false );
	s_TooltipWindow->SetMouseInputEnabled( false );

	// relayout the textwindow immediately so that we know it's size
	//m_pTextEntry->InvalidateLayout(true);

	SizeTextWindow();
	PositionWindow( s_TooltipWindow );
}