C# 클래스 Steamworks.SteamUser

파일 보기 프로젝트 열기: rlabrecque/Steamworks.NET 1 사용 예제들

공개 메소드들

메소드 설명
AdvertiseGame ( CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer ) : void

set data to be replicated to friends so that they can join your game

CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client

uint32 unIPServer, uint16 usPortServer - the IP address of the game server

BIsBehindNAT ( ) : bool

returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam

(i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.

BIsPhoneIdentifying ( ) : bool

gets whether the users phone number is identifying

BIsPhoneRequiringVerification ( ) : bool

gets whether the users phone number is awaiting (re)verification

BIsPhoneVerified ( ) : bool

gets whether the users phone number is verified

BIsTwoFactorEnabled ( ) : bool

gets whether the user has two factor enabled on their account

BLoggedOn ( ) : bool

returns true if the Steam client current has a live connection to the Steam servers.

If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.

The Steam client will automatically be trying to recreate the connection as often as possible.

BeginAuthSession ( byte pAuthTicket, int cbAuthTicket, CSteamID steamID ) : EBeginAuthSessionResult

Authenticate ticket from entity steamID to be sure it is valid and isnt reused

Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )

CancelAuthTicket ( HAuthTicket hAuthTicket ) : void

Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to

DecompressVoice ( byte pCompressed, uint cbCompressed, byte pDestBuffer, uint cbDestBufferSize, uint &nBytesWritten, uint nDesiredSampleRate ) : EVoiceResult

Decompresses a chunk of compressed data produced by GetVoice().

nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall.

In that case, nBytesWritten is set to the size of the buffer required to decompress the given

data. The suggested buffer size for the destination buffer is 22 kilobytes.

The output format of the data is 16-bit signed at the requested samples per second.

If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate

EndAuthSession ( CSteamID steamID ) : void

Stop tracking started by BeginAuthSession - called when no longer playing game with this entity

GetAuthSessionTicket ( byte pTicket, int cbMaxTicket, uint &pcbTicket ) : HAuthTicket

Retrieve ticket to be sent to the entity who wishes to authenticate you.

pcbTicket retrieves the length of the actual ticket.

GetAvailableVoice ( uint &pcbCompressed, uint &pcbUncompressed, uint nUncompressedVoiceDesiredSampleRate ) : EVoiceResult

Determine the amount of captured audio data that is available in bytes.

This provides both the compressed and uncompressed data. Please note that the uncompressed

data is not the raw feed from the microphone: data may only be available if audible

levels of speech are detected.

nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case)

If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate

GetEncryptedAppTicket ( byte pTicket, int cbMaxTicket, uint &pcbTicket ) : bool

retrieve a finished ticket

GetGameBadgeLevel ( int nSeries, bool bFoil ) : int

Trading Card badges data access

if you only have one set of cards, the series will be 1

the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)

GetHSteamUser ( ) : HSteamUser

returns the HSteamUser this interface represents

this is only used internally by the API, and by a few select interfaces that support multi-user

GetPlayerSteamLevel ( ) : int

gets the Steam Level of the user, as shown on their profile

GetSteamID ( ) : CSteamID

returns the CSteamID of the account currently logged into the Steam client

a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API

GetUserDataFolder ( string &pchBuffer, int cubBuffer ) : bool

get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.

this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"

GetVoice ( bool bWantCompressed, byte pDestBuffer, uint cbDestBufferSize, uint &nBytesWritten, bool bWantUncompressed, byte pUncompressedDestBuffer, uint cbUncompressedDestBufferSize, uint &nUncompressBytesWritten, uint nUncompressedVoiceDesiredSampleRate ) : EVoiceResult

Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to

DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format.

Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible

levels of speech are detected, and may have passed through denoising filters, etc.

This function should be called as often as possible once recording has started; once per frame at least.

nBytesWritten is set to the number of bytes written to pDestBuffer.

nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer.

You must grab both compressed and uncompressed here at the same time, if you want both.

Matching data that is not read during this call will be thrown away.

GetAvailableVoice() can be used to determine how much data is actually available.

If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate

GetVoiceOptimalSampleRate ( ) : uint

This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results

InitiateGameConnection ( byte pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer, bool bSecure ) : int

Multiplayer Authentication functions

InitiateGameConnection() starts the state machine for authenticating the game client with the game server

It is the client portion of a three-way handshake between the client, the game server, and the steam servers

Parameters:

void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token.

int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.

CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client

CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( <appID> )

uint32 unIPServer, uint16 usPortServer - the IP address of the game server

bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running)

return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed

The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.

RequestEncryptedAppTicket ( byte pDataToInclude, int cbDataToInclude ) : SteamAPICall_t

Requests a ticket encrypted with an app specific shared key

pDataToInclude, cbDataToInclude will be encrypted into the ticket

( This is asynchronous, you must wait for the ticket to be completed by the server )

RequestStoreAuthURL ( string pchRedirectURL ) : SteamAPICall_t

Requests a URL which authenticates an in-game browser for store check-out,

and then redirects to the specified URL. As long as the in-game browser

accepts and handles session cookies, Steam microtransaction checkout pages

will automatically recognize the user instead of presenting a login page.

The result of this API call will be a StoreAuthURLResponse_t callback.

NOTE: The URL has a very short lifetime to prevent history-snooping attacks,

so you should only call this API when you are about to launch the browser,

or else immediately navigate to the result URL using a hidden browser window.

NOTE 2: The resulting authorization cookie has an expiration time of one day,

so it would be a good idea to request and visit a new auth URL every 12 hours.

StartVoiceRecording ( ) : void

Starts voice recording. Once started, use GetVoice() to get the data

StopVoiceRecording ( ) : void

Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for

a little bit after this function is called. GetVoice() should continue to be called until it returns

k_eVoiceResultNotRecording

TerminateGameConnection ( uint unIPServer, ushort usPortServer ) : void

notify of disconnect

needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call

TrackAppUsageEvent ( CGameID gameID, int eAppUsageEvent, string pchExtraInfo = "" ) : void

Legacy functions

used by only a few games to track usage events

UserHasLicenseForApp ( CSteamID steamID, AppId_t appID ) : EUserHasLicenseForAppResult

After receiving a user's authentication data, and passing it to BeginAuthSession, use this function

to determine if the user owns downloadable content specified by the provided AppID.

메소드 상세

AdvertiseGame() 공개 정적인 메소드

set data to be replicated to friends so that they can join your game

CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client

uint32 unIPServer, uint16 usPortServer - the IP address of the game server

public static AdvertiseGame ( CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer ) : void
steamIDGameServer CSteamID
unIPServer uint
usPortServer ushort
리턴 void

BIsBehindNAT() 공개 정적인 메소드

returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam

(i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.

public static BIsBehindNAT ( ) : bool
리턴 bool

BIsPhoneIdentifying() 공개 정적인 메소드

gets whether the users phone number is identifying

public static BIsPhoneIdentifying ( ) : bool
리턴 bool

BIsPhoneRequiringVerification() 공개 정적인 메소드

gets whether the users phone number is awaiting (re)verification

public static BIsPhoneRequiringVerification ( ) : bool
리턴 bool

BIsPhoneVerified() 공개 정적인 메소드

gets whether the users phone number is verified

public static BIsPhoneVerified ( ) : bool
리턴 bool

BIsTwoFactorEnabled() 공개 정적인 메소드

gets whether the user has two factor enabled on their account

public static BIsTwoFactorEnabled ( ) : bool
리턴 bool

BLoggedOn() 공개 정적인 메소드

returns true if the Steam client current has a live connection to the Steam servers.

If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.

The Steam client will automatically be trying to recreate the connection as often as possible.

public static BLoggedOn ( ) : bool
리턴 bool

BeginAuthSession() 공개 정적인 메소드

Authenticate ticket from entity steamID to be sure it is valid and isnt reused

Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )

public static BeginAuthSession ( byte pAuthTicket, int cbAuthTicket, CSteamID steamID ) : EBeginAuthSessionResult
pAuthTicket byte
cbAuthTicket int
steamID CSteamID
리턴 EBeginAuthSessionResult

CancelAuthTicket() 공개 정적인 메소드

Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to

public static CancelAuthTicket ( HAuthTicket hAuthTicket ) : void
hAuthTicket HAuthTicket
리턴 void

DecompressVoice() 공개 정적인 메소드

Decompresses a chunk of compressed data produced by GetVoice().

nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall.

In that case, nBytesWritten is set to the size of the buffer required to decompress the given

data. The suggested buffer size for the destination buffer is 22 kilobytes.

The output format of the data is 16-bit signed at the requested samples per second.

If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate

public static DecompressVoice ( byte pCompressed, uint cbCompressed, byte pDestBuffer, uint cbDestBufferSize, uint &nBytesWritten, uint nDesiredSampleRate ) : EVoiceResult
pCompressed byte
cbCompressed uint
pDestBuffer byte
cbDestBufferSize uint
nBytesWritten uint
nDesiredSampleRate uint
리턴 EVoiceResult

EndAuthSession() 공개 정적인 메소드

Stop tracking started by BeginAuthSession - called when no longer playing game with this entity

public static EndAuthSession ( CSteamID steamID ) : void
steamID CSteamID
리턴 void

GetAuthSessionTicket() 공개 정적인 메소드

Retrieve ticket to be sent to the entity who wishes to authenticate you.

pcbTicket retrieves the length of the actual ticket.

public static GetAuthSessionTicket ( byte pTicket, int cbMaxTicket, uint &pcbTicket ) : HAuthTicket
pTicket byte
cbMaxTicket int
pcbTicket uint
리턴 HAuthTicket

GetAvailableVoice() 공개 정적인 메소드

Determine the amount of captured audio data that is available in bytes.

This provides both the compressed and uncompressed data. Please note that the uncompressed

data is not the raw feed from the microphone: data may only be available if audible

levels of speech are detected.

nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case)

If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate

public static GetAvailableVoice ( uint &pcbCompressed, uint &pcbUncompressed, uint nUncompressedVoiceDesiredSampleRate ) : EVoiceResult
pcbCompressed uint
pcbUncompressed uint
nUncompressedVoiceDesiredSampleRate uint
리턴 EVoiceResult

GetEncryptedAppTicket() 공개 정적인 메소드

retrieve a finished ticket

public static GetEncryptedAppTicket ( byte pTicket, int cbMaxTicket, uint &pcbTicket ) : bool
pTicket byte
cbMaxTicket int
pcbTicket uint
리턴 bool

GetGameBadgeLevel() 공개 정적인 메소드

Trading Card badges data access

if you only have one set of cards, the series will be 1

the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)

public static GetGameBadgeLevel ( int nSeries, bool bFoil ) : int
nSeries int
bFoil bool
리턴 int

GetHSteamUser() 공개 정적인 메소드

returns the HSteamUser this interface represents

this is only used internally by the API, and by a few select interfaces that support multi-user

public static GetHSteamUser ( ) : HSteamUser
리턴 HSteamUser

GetPlayerSteamLevel() 공개 정적인 메소드

gets the Steam Level of the user, as shown on their profile

public static GetPlayerSteamLevel ( ) : int
리턴 int

GetSteamID() 공개 정적인 메소드

returns the CSteamID of the account currently logged into the Steam client

a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API

public static GetSteamID ( ) : CSteamID
리턴 CSteamID

GetUserDataFolder() 공개 정적인 메소드

get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.

this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"

public static GetUserDataFolder ( string &pchBuffer, int cubBuffer ) : bool
pchBuffer string
cubBuffer int
리턴 bool

GetVoice() 공개 정적인 메소드

Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to

DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format.

Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible

levels of speech are detected, and may have passed through denoising filters, etc.

This function should be called as often as possible once recording has started; once per frame at least.

nBytesWritten is set to the number of bytes written to pDestBuffer.

nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer.

You must grab both compressed and uncompressed here at the same time, if you want both.

Matching data that is not read during this call will be thrown away.

GetAvailableVoice() can be used to determine how much data is actually available.

If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate

public static GetVoice ( bool bWantCompressed, byte pDestBuffer, uint cbDestBufferSize, uint &nBytesWritten, bool bWantUncompressed, byte pUncompressedDestBuffer, uint cbUncompressedDestBufferSize, uint &nUncompressBytesWritten, uint nUncompressedVoiceDesiredSampleRate ) : EVoiceResult
bWantCompressed bool
pDestBuffer byte
cbDestBufferSize uint
nBytesWritten uint
bWantUncompressed bool
pUncompressedDestBuffer byte
cbUncompressedDestBufferSize uint
nUncompressBytesWritten uint
nUncompressedVoiceDesiredSampleRate uint
리턴 EVoiceResult

GetVoiceOptimalSampleRate() 공개 정적인 메소드

This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results

public static GetVoiceOptimalSampleRate ( ) : uint
리턴 uint

InitiateGameConnection() 공개 정적인 메소드

Multiplayer Authentication functions

InitiateGameConnection() starts the state machine for authenticating the game client with the game server

It is the client portion of a three-way handshake between the client, the game server, and the steam servers

Parameters:

void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token.

int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.

CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client

CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( <appID> )

uint32 unIPServer, uint16 usPortServer - the IP address of the game server

bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running)

return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed

The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.

public static InitiateGameConnection ( byte pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer, bool bSecure ) : int
pAuthBlob byte
cbMaxAuthBlob int
steamIDGameServer CSteamID
unIPServer uint
usPortServer ushort
bSecure bool
리턴 int

RequestEncryptedAppTicket() 공개 정적인 메소드

Requests a ticket encrypted with an app specific shared key

pDataToInclude, cbDataToInclude will be encrypted into the ticket

( This is asynchronous, you must wait for the ticket to be completed by the server )

public static RequestEncryptedAppTicket ( byte pDataToInclude, int cbDataToInclude ) : SteamAPICall_t
pDataToInclude byte
cbDataToInclude int
리턴 SteamAPICall_t

RequestStoreAuthURL() 공개 정적인 메소드

Requests a URL which authenticates an in-game browser for store check-out,

and then redirects to the specified URL. As long as the in-game browser

accepts and handles session cookies, Steam microtransaction checkout pages

will automatically recognize the user instead of presenting a login page.

The result of this API call will be a StoreAuthURLResponse_t callback.

NOTE: The URL has a very short lifetime to prevent history-snooping attacks,

so you should only call this API when you are about to launch the browser,

or else immediately navigate to the result URL using a hidden browser window.

NOTE 2: The resulting authorization cookie has an expiration time of one day,

so it would be a good idea to request and visit a new auth URL every 12 hours.

public static RequestStoreAuthURL ( string pchRedirectURL ) : SteamAPICall_t
pchRedirectURL string
리턴 SteamAPICall_t

StartVoiceRecording() 공개 정적인 메소드

Starts voice recording. Once started, use GetVoice() to get the data

public static StartVoiceRecording ( ) : void
리턴 void

StopVoiceRecording() 공개 정적인 메소드

Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for

a little bit after this function is called. GetVoice() should continue to be called until it returns

k_eVoiceResultNotRecording

public static StopVoiceRecording ( ) : void
리턴 void

TerminateGameConnection() 공개 정적인 메소드

notify of disconnect

needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call

public static TerminateGameConnection ( uint unIPServer, ushort usPortServer ) : void
unIPServer uint
usPortServer ushort
리턴 void

TrackAppUsageEvent() 공개 정적인 메소드

Legacy functions

used by only a few games to track usage events

public static TrackAppUsageEvent ( CGameID gameID, int eAppUsageEvent, string pchExtraInfo = "" ) : void
gameID CGameID
eAppUsageEvent int
pchExtraInfo string
리턴 void

UserHasLicenseForApp() 공개 정적인 메소드

After receiving a user's authentication data, and passing it to BeginAuthSession, use this function

to determine if the user owns downloadable content specified by the provided AppID.

public static UserHasLicenseForApp ( CSteamID steamID, AppId_t appID ) : EUserHasLicenseForAppResult
steamID CSteamID
appID AppId_t
리턴 EUserHasLicenseForAppResult