mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-16 10:19:18 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
namespace Sandbox;
|
|
|
|
[Expose]
|
|
internal struct UserInfo
|
|
{
|
|
public SteamId SteamId { get; set; }
|
|
public string DisplayName { get; set; }
|
|
public DateTimeOffset ConnectionTime { get; set; }
|
|
public Dictionary<string, string> UserData { get; set; }
|
|
public int EngineVersion { get; internal set; }
|
|
public SteamId PartyId { get; internal set; }
|
|
public byte[] AuthTicket { get; set; }
|
|
public Guid HandshakeId { get; set; }
|
|
public bool IsVr { get; set; }
|
|
|
|
/// <summary>
|
|
/// Build info for the local user, which will then get sent to the server and possibly shared between all clients
|
|
/// </summary>
|
|
internal static UserInfo Local
|
|
{
|
|
get
|
|
{
|
|
var ui = new UserInfo
|
|
{
|
|
ConnectionTime = DateTime.UtcNow,
|
|
SteamId = Utility.Steam.SteamId,
|
|
DisplayName = Utility.Steam.PersonaName,
|
|
EngineVersion = Engine.Protocol.Network,
|
|
UserData = new(),
|
|
PartyId = PartyRoom.Current?.Id ?? new( 0 ),
|
|
IsVr = VR.VRSystem.IsActive
|
|
};
|
|
|
|
//
|
|
// Put all the userinfo vars in
|
|
//
|
|
foreach ( var convar in ConVarSystem.Members.Values.Where( x => x.IsUserInfo ) )
|
|
{
|
|
ui.UserData[convar.Name] = convar.Value;
|
|
}
|
|
|
|
return ui;
|
|
}
|
|
}
|
|
}
|