mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-24 20:48:03 +03:00
Steamworks.Data
This commit is contained in:
parent
51b2b7dee2
commit
8e97489def
@ -22,7 +22,7 @@ namespace Steamworks
|
||||
//
|
||||
// Init Server
|
||||
//
|
||||
var serverInit = new ServerInit( "gmod", "Garry Mode" )
|
||||
var serverInit = new SteamServerInit( "gmod", "Garry Mode" )
|
||||
{
|
||||
GamePort = 28015,
|
||||
Secure = true,
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamApps : BaseSteamInterface
|
||||
internal class ISteamApps : BaseSteamInterface
|
||||
{
|
||||
public ISteamApps( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamFriends : BaseSteamInterface
|
||||
internal class ISteamFriends : BaseSteamInterface
|
||||
{
|
||||
public ISteamFriends( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamGameServer : BaseSteamInterface
|
||||
internal class ISteamGameServer : BaseSteamInterface
|
||||
{
|
||||
public ISteamGameServer( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamMatchmakingServers : BaseSteamInterface
|
||||
internal class ISteamMatchmakingServers : BaseSteamInterface
|
||||
{
|
||||
public ISteamMatchmakingServers( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamMusic : BaseSteamInterface
|
||||
internal class ISteamMusic : BaseSteamInterface
|
||||
{
|
||||
public ISteamMusic( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamParentalSettings : BaseSteamInterface
|
||||
internal class ISteamParentalSettings : BaseSteamInterface
|
||||
{
|
||||
public ISteamParentalSettings( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamUser : BaseSteamInterface
|
||||
internal class ISteamUser : BaseSteamInterface
|
||||
{
|
||||
public ISteamUser( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamUtils : BaseSteamInterface
|
||||
internal class ISteamUtils : BaseSteamInterface
|
||||
{
|
||||
public ISteamUtils( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -2,11 +2,12 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public class ISteamVideo : BaseSteamInterface
|
||||
internal class ISteamVideo : BaseSteamInterface
|
||||
{
|
||||
public ISteamVideo( bool server = false ) : base( server )
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
@ -14,13 +15,13 @@ namespace Steamworks
|
||||
|
||||
#region ISteamMatchmakingServers
|
||||
|
||||
static Internal.ISteamMatchmakingServers _internal;
|
||||
internal static Internal.ISteamMatchmakingServers Internal
|
||||
static ISteamMatchmakingServers _internal;
|
||||
internal static ISteamMatchmakingServers Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamMatchmakingServers();
|
||||
_internal = new ISteamMatchmakingServers();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
@ -12,13 +13,13 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamApps
|
||||
{
|
||||
static Internal.ISteamApps _internal;
|
||||
internal static Internal.ISteamApps Internal
|
||||
static ISteamApps _internal;
|
||||
internal static ISteamApps Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamApps();
|
||||
_internal = new ISteamApps();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamFriends
|
||||
{
|
||||
static Internal.ISteamFriends _internal;
|
||||
internal static Internal.ISteamFriends Internal
|
||||
static ISteamFriends _internal;
|
||||
internal static ISteamFriends Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new Internal.ISteamFriends();
|
||||
_internal = new ISteamFriends();
|
||||
|
||||
richPresence = new Dictionary<string, string>();
|
||||
}
|
||||
@ -193,19 +193,19 @@ namespace Steamworks
|
||||
await Task.Delay( 500 );
|
||||
}
|
||||
|
||||
public static async Task<Image?> GetSmallAvatarAsync( SteamId steamid )
|
||||
public static async Task<Data.Image?> GetSmallAvatarAsync( SteamId steamid )
|
||||
{
|
||||
await CacheUserInformationAsync( steamid, false );
|
||||
return SteamUtils.GetImage( Internal.GetSmallFriendAvatar( steamid ) );
|
||||
}
|
||||
|
||||
public static async Task<Image?> GetMediumAvatarAsync( SteamId steamid )
|
||||
public static async Task<Data.Image?> GetMediumAvatarAsync( SteamId steamid )
|
||||
{
|
||||
await CacheUserInformationAsync( steamid, false );
|
||||
return SteamUtils.GetImage( Internal.GetMediumFriendAvatar( steamid ) );
|
||||
}
|
||||
|
||||
public static async Task<Image?> GetLargeAvatarAsync( SteamId steamid )
|
||||
public static async Task<Data.Image?> GetLargeAvatarAsync( SteamId steamid )
|
||||
{
|
||||
await CacheUserInformationAsync( steamid, false );
|
||||
|
||||
|
@ -11,13 +11,13 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamMusic
|
||||
{
|
||||
static Internal.ISteamMusic _internal;
|
||||
internal static Internal.ISteamMusic Internal
|
||||
static ISteamMusic _internal;
|
||||
internal static ISteamMusic Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamMusic();
|
||||
_internal = new ISteamMusic();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamParental
|
||||
{
|
||||
static Internal.ISteamParentalSettings _internal;
|
||||
internal static Internal.ISteamParentalSettings Internal
|
||||
static ISteamParentalSettings _internal;
|
||||
internal static ISteamParentalSettings Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamParentalSettings();
|
||||
_internal = new ISteamParentalSettings();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Steamworks.Data;
|
||||
|
||||
namespace Steamworks
|
||||
{
|
||||
@ -13,13 +14,13 @@ namespace Steamworks
|
||||
{
|
||||
static bool initialized;
|
||||
|
||||
static Internal.ISteamGameServer _internal;
|
||||
internal static Internal.ISteamGameServer Internal
|
||||
static ISteamGameServer _internal;
|
||||
internal static ISteamGameServer Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamGameServer( true );
|
||||
_internal = new ISteamGameServer( true );
|
||||
|
||||
return _internal;
|
||||
}
|
||||
@ -37,7 +38,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static event Action<SteamId, SteamId, AuthResponse> OnValidateAuthTicketResponse;
|
||||
|
||||
public static void Init( AppId appid, ServerInit init )
|
||||
public static void Init( AppId appid, SteamServerInit init )
|
||||
{
|
||||
uint ipaddress = 0; // Any Port
|
||||
|
||||
|
@ -13,14 +13,14 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamUser
|
||||
{
|
||||
static Internal.ISteamUser _internal;
|
||||
internal static Internal.ISteamUser Internal
|
||||
static ISteamUser _internal;
|
||||
internal static ISteamUser Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new Internal.ISteamUser();
|
||||
_internal = new ISteamUser();
|
||||
|
||||
richPresence = new Dictionary<string, string>();
|
||||
|
||||
|
@ -11,13 +11,13 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamUtils
|
||||
{
|
||||
static Internal.ISteamUtils _internal;
|
||||
internal static Internal.ISteamUtils Internal
|
||||
static ISteamUtils _internal;
|
||||
internal static ISteamUtils Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamUtils();
|
||||
_internal = new ISteamUtils();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
@ -91,9 +91,9 @@ namespace Steamworks
|
||||
/// <summary>
|
||||
/// returns the image in RGBA format
|
||||
/// </summary>
|
||||
public static Image? GetImage( int image )
|
||||
public static Data.Image? GetImage( int image )
|
||||
{
|
||||
var i = new Image();
|
||||
var i = new Data.Image();
|
||||
|
||||
if ( !GetImageSize( image, out i.Width, out i.Height ) )
|
||||
return null;
|
||||
|
@ -11,13 +11,13 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static class SteamVideo
|
||||
{
|
||||
static Internal.ISteamVideo _internal;
|
||||
internal static Internal.ISteamVideo Internal
|
||||
static ISteamVideo _internal;
|
||||
internal static ISteamVideo Internal
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
_internal = new Internal.ISteamVideo();
|
||||
_internal = new ISteamVideo();
|
||||
|
||||
return _internal;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct DlcInformation
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct DownloadProgress
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct FileDetails
|
||||
{
|
||||
|
@ -101,17 +101,17 @@ namespace Steamworks
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Image?> GetSmallAvatarAsync()
|
||||
public async Task<Data.Image?> GetSmallAvatarAsync()
|
||||
{
|
||||
return await SteamFriends.GetSmallAvatarAsync( Id );
|
||||
}
|
||||
|
||||
public async Task<Image?> GetMediumAvatarAsync()
|
||||
public async Task<Data.Image?> GetMediumAvatarAsync()
|
||||
{
|
||||
return await SteamFriends.GetMediumAvatarAsync( Id );
|
||||
}
|
||||
|
||||
public async Task<Image?> GetLargeAvatarAsync()
|
||||
public async Task<Data.Image?> GetLargeAvatarAsync()
|
||||
{
|
||||
return await SteamFriends.GetLargeAvatarAsync( Id );
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct GameId
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
namespace Steamworks
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct Image
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
namespace Steamworks
|
||||
{
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// A server query packet.
|
||||
/// </summary>
|
||||
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace Steamworks
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
public struct ServerInfo
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace Steamworks
|
||||
/// Used to set up the server.
|
||||
/// The variables in here are all required to be set, and can't be changed once the server is created.
|
||||
/// </summary>
|
||||
public struct ServerInit
|
||||
public struct SteamServerInit
|
||||
{
|
||||
public IPAddress IpAddress;
|
||||
public ushort SteamPort;
|
||||
@ -37,7 +37,7 @@ namespace Steamworks
|
||||
public string GameDescription;
|
||||
|
||||
|
||||
public ServerInit( string modDir, string gameDesc )
|
||||
public SteamServerInit( string modDir, string gameDesc )
|
||||
{
|
||||
ModDir = modDir;
|
||||
GameDescription = gameDesc;
|
||||
@ -54,7 +54,7 @@ namespace Steamworks
|
||||
/// <summary>
|
||||
/// Set the Steam quert port
|
||||
/// </summary>
|
||||
public ServerInit WithRandomSteamPort()
|
||||
public SteamServerInit WithRandomSteamPort()
|
||||
{
|
||||
SteamPort = (ushort)new Random().Next( 10000, 60000 );
|
||||
return this;
|
||||
@ -67,7 +67,7 @@ namespace Steamworks
|
||||
///
|
||||
/// More info about this here: https://partner.steamgames.com/doc/api/ISteamGameServer#HandleIncomingPacket
|
||||
/// </summary>
|
||||
public ServerInit WithQueryShareGamePort()
|
||||
public SteamServerInit WithQueryShareGamePort()
|
||||
{
|
||||
QueryPort = 0xFFFF;
|
||||
return this;
|
||||
|
@ -7,9 +7,9 @@ using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Steamworks.Internal
|
||||
namespace Steamworks
|
||||
{
|
||||
public abstract class BaseSteamInterface
|
||||
internal abstract class BaseSteamInterface
|
||||
{
|
||||
public IntPtr Self;
|
||||
public IntPtr VTable;
|
||||
|
@ -18,13 +18,14 @@ namespace Generator
|
||||
WriteLine( $"using System.Runtime.InteropServices;" );
|
||||
WriteLine( $"using System.Text;" );
|
||||
WriteLine( $"using System.Threading.Tasks;" );
|
||||
WriteLine( $"using Steamworks.Data;" );
|
||||
WriteLine();
|
||||
|
||||
WriteLine();
|
||||
|
||||
StartBlock( $"namespace Steamworks.Internal" );
|
||||
StartBlock( $"namespace Steamworks" );
|
||||
{
|
||||
StartBlock( $"public class {clss.Name} : BaseSteamInterface" );
|
||||
StartBlock( $"internal class {clss.Name} : BaseSteamInterface" );
|
||||
{
|
||||
StartBlock( $"public {clss.Name}( bool server = false ) : base( server )" );
|
||||
{
|
||||
|
@ -111,6 +111,7 @@ namespace Generator
|
||||
WriteLine( "using System;" );
|
||||
WriteLine( "using System.Runtime.InteropServices;" );
|
||||
WriteLine( "using System.Linq;" );
|
||||
WriteLine( "using Steamworks.Data;" );
|
||||
WriteLine();
|
||||
StartBlock( "namespace " + NamespaceName );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user