コード例 #1
0
//=============================================================================
void SteamCloudConfirmation::OnCommand(const char *command)
{
	if ( Q_stricmp( command, "OK" ) == 0 )
	{
		static CGameUIConVarRef cl_cloud_settings( "cl_cloud_settings" );

		CBaseModPanel::GetSingleton().PlayUISound( UISOUND_ACCEPT );

		if ( m_pSteamCloudCheckBox )
		{
			if ( m_pSteamCloudCheckBox->IsSelected() )
			{
				cl_cloud_settings.SetValue( STEAMREMOTESTORAGE_CLOUD_ALL );
				// Re-read the configuration
				engine->ReadConfiguration( -1, false );
			}
			else
			{
				cl_cloud_settings.SetValue( 0 );
			}
		}

		Close();
	}
	else
	{
		BaseClass::OnCommand( command );
	}
}
コード例 #2
0
void SliderControl::UpdateConVar()
{
	CGameUIConVarRef* conVar = GetConVarRef();
	if( conVar && conVar->IsValid() )
	{
		conVar->SetValue( GetCurrentValue() );
	}
}
コード例 #3
0
const wchar_t *QuickJoinPanelItem::GetName() const
{
	static CGameUIConVarRef cl_names_debug( "cl_names_debug" );
	if ( cl_names_debug.GetInt() )
		return PLAYER_DEBUG_NAME_UNICODE;

	return m_name;
}
コード例 #4
0
void SliderControl::Reset()
{
	CGameUIConVarRef* conVar = GetConVarRef();
	if( conVar && conVar->IsValid() )
	{
		SetCurrentValue( conVar->GetFloat(), true );
	}

	ResetSliderPosAndDefaultMarkers();
}
コード例 #5
0
//=============================================================================
void MainMenu::OnOpen()
{
	if ( IsPC() && connect_lobby.GetString()[0] )
	{
		// if we were launched with "+connect_lobby <lobbyid>" on the command line, join that lobby immediately
		uint64 nLobbyID = _atoi64( connect_lobby.GetString() );
		if ( nLobbyID != 0 )
		{
			KeyValues *pSettings = KeyValues::FromString(
				"settings",
				" system { "
					" network LIVE "
				" } "
				" options { "
					" action joinsession "
				" } "
				);
			pSettings->SetUint64( "options/sessionid", nLobbyID );
			KeyValues::AutoDelete autodelete( pSettings );

			g_pMatchFramework->MatchSession( pSettings );
		}
		// clear the convar so we don't try to join that lobby every time we return to the main menu
		connect_lobby.SetValue( "" );
	}

	BaseClass::OnOpen();

	SetFooterState();

#ifndef _X360
	bool bSteamCloudVisible = false;

	{
		static CGameUIConVarRef cl_cloud_settings( "cl_cloud_settings" );
		if ( cl_cloud_settings.GetInt() == -1 )
		{
			CBaseModPanel::GetSingleton().OpenWindow( WT_STEAMCLOUDCONFIRM, this, false );
			bSteamCloudVisible = true;
		}
	}

	if ( !bSteamCloudVisible )
	{
		if ( AddonAssociation::CheckAndSeeIfShouldShow() )
		{
			CBaseModPanel::GetSingleton().OpenWindow( WT_ADDONASSOCIATION, this, false );
		}
	}
#endif
}
コード例 #6
0
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
COptionsSubKeyboard::COptionsSubKeyboard(vgui::Panel *parent) : EditablePanel(parent, "OptionsSubKeyboard" )
{
	vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/GameUIScheme.res", "GameUIScheme");
	SetScheme(scheme);

	Q_memset( m_Bindings, 0, sizeof( m_Bindings ));

	m_nSplitScreenUser = 0;

	// For joystick buttons, controls which user are binding/unbinding
	if ( !IsX360() )
	{
		//HACK HACK:  Probably the entire gameui needs to have a splitscrene context for which player the settings apply to, but this is only
		// on the PC...
		static CGameUIConVarRef in_forceuser( "in_forceuser" );

		if ( in_forceuser.IsValid() )
		{
			m_nSplitScreenUser = clamp( in_forceuser.GetInt(), 0, 1 );
		}
		else
		{
			m_nSplitScreenUser = MAX( 0, engine->GetActiveSplitScreenPlayerSlot() );
		}
	}

	// Copy active config
	Q_strncpy( m_strActiveConfig, cl_active_config.GetString(), MAX_PATH );

	m_drpConfig = NULL;

	// create the key bindings list
	CreateKeyBindingList();
	// Store all current key bindings
	SaveCurrentBindings();
	// Parse default descriptions
	ParseActionDescriptions();
	
	m_pSetBindingButton = new Button(this, "ChangeKeyButton", "");
	m_pClearBindingButton = new Button(this, "ClearKeyButton", "");

	LoadControlSettings("Resource/OptionsSubKeyboard.res");

	m_pSetBindingButton->SetEnabled(false);
	m_pClearBindingButton->SetEnabled(false);
	SetPaintBackgroundEnabled( false );
}
コード例 #7
0
//=============================================================================
void ControllerOptions::ResetControlValues( void )
{
    // labels for button config and stick config
    CGameUIConVarRef joy_cfg_preset( "joy_cfg_preset" );
    int iButtonSetting = clamp( joy_cfg_preset.GetInt(), 0, 3 );
    if ( m_pEditButtons )
    {
        m_pEditButtons->SetDropdownSelection( pszButtonSettingsDisplayName[iButtonSetting] );
    }

    CGameUIConVarRef joy_movement_stick("joy_movement_stick");
    int iStickSetting = ( joy_movement_stick.GetInt() > 0 ) ? 1 : 0;
    if ( m_pEditSticks )
    {
        static CGameUIConVarRef s_joy_legacy( "joy_legacy" );
        if ( s_joy_legacy.IsValid() && s_joy_legacy.GetBool() )
        {
            iStickSetting += 2; // Go to the legacy version of the default/southpaw string.
        }

        m_pEditSticks->SetDropdownSelection( pszStickSettingsDisplayName[iStickSetting] );
    }

    if( m_pVerticalSensitivity )
    {
        m_pVerticalSensitivity->Reset();
    }

    if( m_pHorizontalSensitivity )
    {
        m_pHorizontalSensitivity->Reset();
    }

    if( m_pLookType )
    {
        m_pLookType->SetFlyout( "FlmLookType" );

        CGameUIConVarRef joy_inverty("joy_inverty");

        int iInvert = ( joy_inverty.GetInt() > 0 ) ? CONTROLLER_LOOK_TYPE_INVERTED : CONTROLLER_LOOK_TYPE_NORMAL;
        m_pLookType->SetCurrentSelection( pszLookTypes[iInvert] );

        FlyoutMenu *pFlyout = m_pLookType->GetCurrentFlyout();
        if ( pFlyout )
        {
            pFlyout->SetListener( this );
        }
    }

    if( m_pDuckMode )
    {
        m_pDuckMode->SetFlyout( "FlmDuckMode" );

        CGameUIConVarRef option_duck_method("option_duck_method");

        int iDuckMode = ( option_duck_method.GetInt() > 0 ) ? DUCK_MODE_TOGGLE : DUCK_MODE_HOLD;
        m_pDuckMode->SetCurrentSelection( pszDuckModes[iDuckMode] );

        FlyoutMenu *pFlyout = m_pDuckMode->GetCurrentFlyout();
        if ( pFlyout )
        {
            pFlyout->SetListener( this );
        }
    }
}