本文整理汇总了C#中SteamID.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SteamID.ToString方法的具体用法?C# SteamID.ToString怎么用?C# SteamID.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SteamID
的用法示例。
在下文中一共展示了SteamID.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessage
/// <summary>
/// Sends a message, with text, to the target user.
/// </summary>
/// <param name="destinationUser">Targeted receipient for the message.</param>
/// <param name="text">Message to send.</param>
/// <returns>Asynchronous task to be used for tracking request completion.</returns>
public async Task SendMessage( SteamID destinationUser, string text ) {
SteamRequest request = new SteamRequest( "ISteamWebUserPresenceOAuth", "Message", "v0001", HttpMethod.Post );
request.AddParameter( "umqid", ChatSession.ChatSessionID, ParameterType.GetOrPost );
request.AddParameter( "type", ( ( text == null ) ? "typing" : "saytext" ), ParameterType.GetOrPost );
request.AddParameter( "steamid_dst", destinationUser.ToString(), ParameterType.GetOrPost );
if( text != null )
request.AddParameter( "text", text, ParameterType.GetOrPost );
SteamInterface.VerifyAndDeserialize<SteamChatSendMessageResponse>( ( await ExecuteAsync( request ) ) );
}
示例2: GetFriendsListAsync
/// <summary>
/// (Async) (Requires <see cref="SteamSharp.Authenticators.APIKeyAuthenticator"/> or <see cref="SteamSharp.Authenticators.UserAuthenticator"/>)
/// Returns the friend list of any Steam user, provided the user's Steam Community profile visibility is set to "Public."
/// Throws <see cref="SteamRequestException"/> on failure.
/// </summary>
/// <param name="client"><see cref="SteamClient"/> instance to use.</param>
/// <param name="steamID">SteamID to return friend's list for.</param>
/// <returns><see cref="SteamFriendsList"/> object containing a list of <see cref="SteamFriend"/> objects mapping to the Friend's list of the target user.</returns>
public async static Task<SteamFriendsList> GetFriendsListAsync( SteamClient client, SteamID steamID ) {
client.IsAuthorizedCall( new Type[] {
typeof( Authenticators.UserAuthenticator ),
typeof( Authenticators.APIKeyAuthenticator )
} );
SteamRequest request;
List<SteamFriend> response;
if( client.Authenticator is Authenticators.UserAuthenticator ) {
// ISteamUserOAuth provides a higher level of access (with User Authentication), assuming a personal relationship with the target user
request = new SteamRequest( "ISteamUserOAuth", "GetFriendList", "v0001" );
request.AddParameter( "steamID", steamID.ToString() );
response = VerifyAndDeserialize<SteamFriendsListResponse>( ( await client.ExecuteAsync( request ) ) ).Friends;
} else {
request = new SteamRequest( "ISteamUser", "GetFriendList", "v0001" );
request.AddParameter( "steamID", steamID.ToString() );
response = VerifyAndDeserialize<GetFriendsListResponse>( ( await client.ExecuteAsync( request ) ) ).FriendsList.Friends;
}
Dictionary<SteamID, SteamUser> users = new Dictionary<SteamID, SteamUser>();
foreach( var friend in response ) {
users.Add( friend.SteamID, new SteamUser {
SteamID = friend.SteamID,
FriendSince = friend.FriendSince,
} );
}
return new SteamFriendsList {
Friends = await GetBulkProfileDataAsync( client, users )
};
}