本文整理汇总了C#中SteamID类的典型用法代码示例。如果您正苦于以下问题:C# SteamID类的具体用法?C# SteamID怎么用?C# SteamID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SteamID类属于命名空间,在下文中一共展示了SteamID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Invoke
public bool Invoke()
{
return Task.Run( async () => {
try {
SteamID targetUser = new SteamID( "76561198129947779" );
SteamClient client = new SteamClient();
client.Authenticator = UserAuthenticator.ForProtectedResource( AccessConstants.OAuthAccessToken );
chatClient.SteamChatConnectionChanged += chatClient_SteamChatConnected;
chatClient.SteamChatMessagesReceived += chatClient_SteamChatMessagesReceived;
chatClient.SteamChatUserStateChange += chatClient_SteamChatUserStateChange;
chatClient.LogOn( client ).Wait();
while( true ) {
switch( WriteConsole.Prompt( "Command (msg, status): " ) ) {
case "msg": await chatClient.SendMessage( targetUser, WriteConsole.Prompt( "Type New Message: " ) ); break;
case "dcn": await chatClient.Disconnect(); break;
}
}
} catch( Exception e ) {
WriteConsole.Error( e.Message + "\n" + e.ToString() );
return false;
}
} ).Result;
}
示例2: SteamIDEquals
public void SteamIDEquals()
{
SteamID one = new SteamID( "76561198129947779" );
SteamID two = new SteamID( "76561198129947779" );
Assert.IsTrue( ( one == two ) );
}
示例3: GetUserStatInt
public GameServerStatsGetUserStatIntResult GetUserStatInt(SteamID steamIDUser, string name)
{
GameServerStatsGetUserStatIntResult result = new GameServerStatsGetUserStatIntResult();
result.Result = GetUserStat(steamIDUser, name, out result.IntValue);
return result;
}
示例4: Update
public void Update()
{
Callback callback;
SteamCallHandle steamCall;
if ( Steamworks.Steam_BGetCallback( pipe, out callback, out steamCall ) )
{
if ( callback.CallbackNum == FriendChatMsg.Callback )
{
FriendChatMsg chatMsg = null;
try
{
chatMsg = ( FriendChatMsg )callback.CallbackObject;
}
catch
{
Steamworks.Steam_FreeLastCallback( pipe );
OnLogFailure( new LogFailureEventArgs( "Recieved callback was not in the correct format, call a programmer!" ) );
return;
}
string message = string.Empty;
FriendMsgType type;
SteamID reciever = new SteamID( chatMsg.Reciever );
steamFriends.GetChatMessage( reciever, ( int )chatMsg.ChatID, out message, 1024 * 4, out type );
LogMessage log = new LogMessage();
log.Sender = new SteamID( chatMsg.Sender );
log.SenderName = steamFriends.GetFriendPersonaName( log.Sender );
log.Reciever = reciever;
log.RecieverName = steamFriends.GetFriendPersonaName( log.Reciever );
log.Message = message;
log.MessageTime = DateTime.Now;
log.MessageType = type;
AddLog( log );
}
Steamworks.Steam_FreeLastCallback( pipe );
}
}
示例5: GetTextureFromSteamID
//Thanks to Karl @ Stunlock Studios for giving me their function as he implemented utils.GetImage(Size/RGBA) into our library
public Texture2D GetTextureFromSteamID(SteamID steamId)
{
IFriends friends = Steamworks.SteamInterface.Friends;
IUtils utils = Steamworks.SteamInterface.Utils;
ImageHandle avatarHandle = friends.GetLargeFriendAvatar(steamId);
if (avatarHandle.IsValid)
{
uint width, height;
if (utils.GetImageSize(avatarHandle, out width, out height))
{
Texture2D texture = new Texture2D((int)width, (int)height, TextureFormat.RGBA32, true);
Color32[] buffer = new Color32[width * height];
GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try
{
System.IntPtr bufferPtr = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
if (utils.GetImageRGBA(avatarHandle, bufferPtr, (int)width * (int)height * 4))
{
// Flip vertical
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height / 2; y++)
{
Color32 temp = buffer[x + (width * y)];
buffer[x + (width * y)] = buffer[x + (width * (height - 1 - y))];
buffer[x + (width * (height - 1 - y))] = temp;
}
}
texture.SetPixels32(buffer);
texture.Apply();
}
}
finally
{
bufferHandle.Free();
}
return texture;
}
}
return null;
}
示例6: DownloadLeaderboardEntriesForUsers
/// <summary>
/// Invokes LeaderboardScoresDownloaded
/// </summary>
/// <param name="handle"></param>
/// <param name="users"></param>
public void DownloadLeaderboardEntriesForUsers(LeaderboardHandle handle, SteamID[] users)
{
CheckIfUsable();
// We need to first convert the array of SteamID objects to a byte array
byte[] rawData = NativeBuffer.ToBytes(users);
using (NativeBuffer buffer = new NativeBuffer(rawData))
{
// Copies the list of user ID's to unmanaged memory
buffer.WriteToUnmanagedMemory();
NativeMethods.Stats_DownloadLeaderboardEntriesForUsers(handle.AsUInt64,
buffer.UnmanagedMemory, users.Length);
}
}
示例7: RequestUserStats
/// <summary>
/// Invokes UserStatsReceived
/// </summary>
/// <param name="steamID"></param>
public void RequestUserStats(SteamID steamID)
{
CheckIfUsable();
NativeMethods.Stats_RequestUserStats(steamID.AsUInt64);
}
示例8: HandleLogOnResponse
void HandleLogOnResponse( IPacketMsg packetMsg )
{
if ( !packetMsg.IsProto )
{
DebugLog.WriteLine( "CMClient", "Got non-proto logon response, this is indicative of no logon attempt after connecting." );
return;
}
var logonResp = new ClientMsgProtobuf<CMsgClientLogonResponse>( packetMsg );
if ( logonResp.Body.eresult == ( int )EResult.OK )
{
SessionID = logonResp.ProtoHeader.client_sessionid;
SteamID = logonResp.ProtoHeader.steamid;
int hbDelay = logonResp.Body.out_of_game_heartbeat_seconds;
// restart heartbeat
heartBeatFunc.Stop();
heartBeatFunc.Delay = TimeSpan.FromSeconds( hbDelay );
heartBeatFunc.Start();
}
}
示例9: SetLobbyJoinable
public bool SetLobbyJoinable(SteamID steamIDLobby, bool lobbyJoinable)
{
CheckIfUsable();
return NativeMethods.MatchMaking_SetLobbyJoinable(steamIDLobby.AsUInt64, lobbyJoinable);
}
示例10: UserHasLicenseForApp
public UserHasLicenseForAppResult UserHasLicenseForApp(SteamID steamID, AppID appID)
{
//CheckIfUsable();
int tempreturn = NativeMethods.GameServer_UserHasLicenseForApp(steamID.AsUInt64, appID.AsUInt32);
return (UserHasLicenseForAppResult)tempreturn;
}
示例11: AssociateWithClan
public void AssociateWithClan(SteamID steamIDClan)
{
//CheckIfUsable();
NativeMethods.GameServer_AssociateWithClan(steamIDClan.AsUInt64);
}
示例12: SendUserDisconnect
public void SendUserDisconnect(SteamID steamIDUser)
{
//CheckIfUsable();
NativeMethods.GameServer_SendUserDisconnect(steamIDUser.AsUInt64);
}
示例13: BeginAuthSession
public BeginAuthSessionResult BeginAuthSession(System.IntPtr authTicket, int cbAuthTicket, SteamID steamID)
{
//CheckIfUsable();
return (BeginAuthSessionResult)NativeMethods.GameServer_BeginAuthSession(authTicket, cbAuthTicket, steamID.AsUInt64);
}
示例14: GetUserConfig
public JKAConfig GetUserConfig(SteamID id)
{
if (configCache.ContainsKey(id))
{
return configCache[id];
}
return JKAConfig.FromSteamID(id, folderPrefix);
}
示例15: RequestLobbyData
public bool RequestLobbyData(SteamID steamIDLobby)
{
CheckIfUsable();
return NativeMethods.MatchMaking_RequestLobbyData(steamIDLobby.AsUInt64);
}