mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Steamuser
This commit is contained in:
parent
19385ed951
commit
ee502cce8b
@ -12,6 +12,7 @@ public partial class Client : IDisposable
|
||||
|
||||
internal Valve.Steamworks.ISteamClient _client;
|
||||
internal Valve.Steamworks.ISteamUser _user;
|
||||
internal Valve.Steamworks.ISteamApps _apps;
|
||||
internal Valve.Steamworks.ISteamFriends _friends;
|
||||
internal Valve.Steamworks.ISteamMatchmakingServers _servers;
|
||||
internal Valve.Steamworks.ISteamInventory _inventory;
|
||||
@ -32,6 +33,17 @@ public partial class Client : IDisposable
|
||||
/// </summary>
|
||||
public ulong SteamId;
|
||||
|
||||
public enum MessageType : int
|
||||
{
|
||||
Message = 0,
|
||||
Warning = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called with a message from Steam
|
||||
/// </summary>
|
||||
public Action<MessageType, string> OnMessage;
|
||||
|
||||
public Client( uint appId )
|
||||
{
|
||||
Valve.Steamworks.SteamAPI.Init( appId );
|
||||
@ -46,7 +58,7 @@ public Client( uint appId )
|
||||
//
|
||||
// Set up warning hook callback
|
||||
//
|
||||
SteamAPIWarningMessageHook ptr = OnWarning;
|
||||
SteamAPIWarningMessageHook ptr = InternalOnWarning;
|
||||
_client.SetWarningMessageHook( Marshal.GetFunctionPointerForDelegate( ptr ) );
|
||||
|
||||
//
|
||||
@ -64,6 +76,7 @@ public Client( uint appId )
|
||||
_servers = _client.GetISteamMatchmakingServers( _huser, _hpipe, "SteamMatchMakingServers002" );
|
||||
_inventory = _client.GetISteamInventory( _huser, _hpipe, "STEAMINVENTORY_INTERFACE_V001" );
|
||||
_networking = _client.GetISteamNetworking( _huser, _hpipe, "SteamNetworking005" );
|
||||
_apps = _client.GetISteamApps( _huser, _hpipe, "STEAMAPPS_INTERFACE_VERSION008" );
|
||||
|
||||
AppId = appId;
|
||||
Username = _friends.GetPersonaName();
|
||||
@ -95,9 +108,12 @@ public void Dispose()
|
||||
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
|
||||
public delegate void SteamAPIWarningMessageHook( int nSeverity, System.Text.StringBuilder pchDebugText );
|
||||
|
||||
private void OnWarning( int nSeverity, System.Text.StringBuilder text )
|
||||
private void InternalOnWarning( int nSeverity, System.Text.StringBuilder text )
|
||||
{
|
||||
Console.Write( text.ToString() );
|
||||
if ( OnMessage != null )
|
||||
{
|
||||
OnMessage( ( MessageType)nSeverity, text.ToString() );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
40
Facepunch.Steamworks/Client/App.cs
Normal file
40
Facepunch.Steamworks/Client/App.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Client : IDisposable
|
||||
{
|
||||
App _app;
|
||||
|
||||
public App App
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _app == null )
|
||||
_app = new App( this );
|
||||
|
||||
return _app;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class App
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
internal App( Client c )
|
||||
{
|
||||
client = c;
|
||||
}
|
||||
|
||||
public void MarkContentCorrupt( bool missingFilesOnly = false )
|
||||
{
|
||||
client._apps.MarkContentCorrupt( missingFilesOnly );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -120,6 +120,7 @@
|
||||
<Compile Include="Client.Voice.cs" />
|
||||
<Compile Include="Client.Auth.cs" />
|
||||
<Compile Include="Client.cs" />
|
||||
<Compile Include="Client\App.cs" />
|
||||
<Compile Include="Client\Inventory.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="steam_api_interop.cs" />
|
||||
|
@ -2469,7 +2469,7 @@ internal override ISteamApps GetISteamApps( uint hSteamUser, uint hSteamPipe, st
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamApps(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamApps)Marshal.PtrToStructure( result, typeof( ISteamApps ) );
|
||||
return new CSteamApps( result );
|
||||
}
|
||||
internal override ISteamNetworking GetISteamNetworking( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user