mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
Big clean
This commit is contained in:
parent
a634f80790
commit
bf6883deb9
@ -1,92 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public class Achievements
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void GetCount()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var gotStats = false;
|
|
||||||
client.Achievements.OnUpdated += () => { gotStats = true; };
|
|
||||||
|
|
||||||
while ( !gotStats )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine( "Found " + client.Achievements.All.Length + " Achievements" );
|
|
||||||
|
|
||||||
Assert.AreNotEqual( 0, client.Achievements.All.Length );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetNames()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var gotStats = false;
|
|
||||||
client.Achievements.OnUpdated += () => { gotStats = true; };
|
|
||||||
|
|
||||||
while ( !gotStats )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach( var ach in client.Achievements.All )
|
|
||||||
{
|
|
||||||
Assert.IsNotNull( ach.Id );
|
|
||||||
|
|
||||||
Console.WriteLine( " " + ach.Id );
|
|
||||||
Console.WriteLine( " - - " + ach.Name );
|
|
||||||
Console.WriteLine( " - - " + ach.Description );
|
|
||||||
Console.WriteLine( " - - " + ach.State );
|
|
||||||
Console.WriteLine( " - - " + ach.UnlockTime );
|
|
||||||
Console.WriteLine( " - - " + ach.GlobalUnlockedPercentage );
|
|
||||||
|
|
||||||
if ( ach.Icon != null )
|
|
||||||
{
|
|
||||||
Console.WriteLine( " - - " + ach.Icon.Width + " x " + ach.Icon.Height );
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine( "" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Trigger()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var gotStats = false;
|
|
||||||
client.Achievements.OnUpdated += () => { gotStats = true; };
|
|
||||||
|
|
||||||
while ( !gotStats )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( var ach in client.Achievements.All )
|
|
||||||
{
|
|
||||||
ach.Trigger();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,169 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public partial class Client
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Init_10()
|
|
||||||
{
|
|
||||||
for ( int i = 0; i < 10; i++ )
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
}
|
|
||||||
|
|
||||||
GC.Collect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Name()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var username = client.Username;
|
|
||||||
Console.WriteLine( username );
|
|
||||||
Assert.IsNotNull( username );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void SteamId()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var steamid = client.SteamId;
|
|
||||||
Console.WriteLine( steamid );
|
|
||||||
Assert.AreNotEqual( 0, steamid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
for( int i=0; i<1024; i++ )
|
|
||||||
{
|
|
||||||
sw.Restart();
|
|
||||||
client.Update();
|
|
||||||
Console.WriteLine( $"{sw.Elapsed.TotalMilliseconds}ms" );
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Subscribed()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
Assert.IsTrue(client.IsSubscribed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Owner()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
Assert.AreEqual(client.OwnerSteamId, client.SteamId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void InstallFolder()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
Assert.IsTrue(client.InstallFolder.Exists);
|
|
||||||
|
|
||||||
Console.Write($"Install Folder: {client.InstallFolder}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void CurrentLanguage()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
Assert.IsTrue( client.CurrentLanguage != null );
|
|
||||||
Assert.IsTrue( client.CurrentLanguage.Length > 0 );
|
|
||||||
|
|
||||||
Console.Write( $"CurrentLanguage: {client.CurrentLanguage}" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void AvailableLanguages()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
Assert.IsTrue( client.AvailableLanguages != null );
|
|
||||||
Assert.IsTrue( client.AvailableLanguages.Length > 0 );
|
|
||||||
|
|
||||||
foreach ( var lang in client.AvailableLanguages )
|
|
||||||
{
|
|
||||||
Console.Write( $"AvailableLanguages: {lang}" );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Cybercafe()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
Assert.IsFalse(client.IsCybercafe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void LowViolence()
|
|
||||||
{
|
|
||||||
var sw = new Stopwatch();
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
Assert.IsFalse(client.IsLowViolence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -88,25 +88,15 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AchievementsTest.cs" />
|
|
||||||
<Compile Include="UserTest.cs" />
|
<Compile Include="UserTest.cs" />
|
||||||
<Compile Include="UtilsTest.cs" />
|
<Compile Include="UtilsTest.cs" />
|
||||||
<Compile Include="ClientTest.cs" />
|
|
||||||
<Compile Include="LobbyTest.cs" />
|
|
||||||
<Compile Include="LeaderboardTest.cs" />
|
|
||||||
<Compile Include="AppTest.cs" />
|
<Compile Include="AppTest.cs" />
|
||||||
<Compile Include="RemoteStorageTest.cs" />
|
|
||||||
<Compile Include="InventoryTest.cs" />
|
|
||||||
<Compile Include="WorkshopTest.cs" />
|
|
||||||
<Compile Include="NetworkingTest.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="FriendsTest.cs" />
|
|
||||||
<Compile Include="GameServerTest.cs" />
|
<Compile Include="GameServerTest.cs" />
|
||||||
<Compile Include="Client\Server\StatsTest.cs" />
|
<Compile Include="Client\Server\StatsTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ServerlistTest.cs" />
|
<Compile Include="ServerlistTest.cs" />
|
||||||
<Compile Include="StatsTest.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
@ -1,173 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Steamworks
|
|
||||||
{
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
[TestClass]
|
|
||||||
public class FriendsTest
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void GetFriends()
|
|
||||||
{
|
|
||||||
foreach ( var friend in Friends.GetFriends() )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"{friend.Id.Value}: {friend.Name} (Friend:{friend.IsFriend}) (Blocked:{friend.IsBlocked})" );
|
|
||||||
Console.WriteLine( $" {string.Join( ", ", friend.NameHistory)}" );
|
|
||||||
|
|
||||||
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetBlocked()
|
|
||||||
{
|
|
||||||
foreach ( var friend in Friends.GetBlocked() )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"{friend.Id.Value}: {friend.Name} (Friend:{friend.IsFriend}) (Blocked:{friend.IsBlocked})" );
|
|
||||||
Console.WriteLine( $" {string.Join( ", ", friend.NameHistory )}" );
|
|
||||||
|
|
||||||
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetPlayedWith()
|
|
||||||
{
|
|
||||||
foreach ( var friend in Friends.GetPlayedWith() )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"{friend.Id.Value}: {friend.Name} (Friend:{friend.IsFriend}) (Blocked:{friend.IsBlocked})" );
|
|
||||||
Console.WriteLine( $" {string.Join( ", ", friend.NameHistory )}" );
|
|
||||||
|
|
||||||
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public async Task LargeAvatar()
|
|
||||||
{
|
|
||||||
ulong id = (ulong)(76561197960279927 + (new Random().Next() % 10000));
|
|
||||||
|
|
||||||
var image = await Friends.GetLargeAvatarAsync( id );
|
|
||||||
if ( !image.HasValue )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Console.WriteLine( $"image.Width {image.Value.Width}" );
|
|
||||||
Console.WriteLine( $"image.Height {image.Value.Height}" );
|
|
||||||
|
|
||||||
DrawImage( image.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public async Task MediumAvatar()
|
|
||||||
{
|
|
||||||
ulong id = (ulong)(76561197960279927 + (new Random().Next() % 10000));
|
|
||||||
|
|
||||||
Console.WriteLine( $"Steam: http://steamcommunity.com/profiles/{id}" );
|
|
||||||
|
|
||||||
var image = await Friends.GetMediumAvatarAsync( id );
|
|
||||||
if ( !image.HasValue )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Console.WriteLine( $"image.Width {image.Value.Width}" );
|
|
||||||
Console.WriteLine( $"image.Height {image.Value.Height}" );
|
|
||||||
|
|
||||||
DrawImage( image.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public async Task SmallAvatar()
|
|
||||||
{
|
|
||||||
ulong id = (ulong)(76561197960279927 + (new Random().Next() % 10000));
|
|
||||||
|
|
||||||
var image = await Friends.GetSmallAvatarAsync( id );
|
|
||||||
if ( !image.HasValue )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Console.WriteLine( $"image.Width {image.Value.Width}" );
|
|
||||||
Console.WriteLine( $"image.Height {image.Value.Height}" );
|
|
||||||
|
|
||||||
DrawImage( image.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public async Task GetFriendsAvatars()
|
|
||||||
{
|
|
||||||
foreach ( var friend in Friends.GetFriends() )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"{friend.Id.Value}: {friend.Name}" );
|
|
||||||
|
|
||||||
var image = await friend.GetSmallAvatarAsync();
|
|
||||||
if ( image.HasValue )
|
|
||||||
{
|
|
||||||
DrawImage( image.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
[TestMethod]
|
|
||||||
public void FriendListWithoutRefresh()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
foreach ( var friend in client.Friends.All )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}: {1} (Friend:{2}) (Blocked:{3})", friend.Id, friend.Name, friend.IsFriend, friend.IsBlocked );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void CachedAvatar()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
var friend = client.Friends.All.First();
|
|
||||||
|
|
||||||
var image = client.Friends.GetCachedAvatar( Steamworks.Friends.AvatarSize.Medium, friend.Id );
|
|
||||||
|
|
||||||
if (image != null)
|
|
||||||
{
|
|
||||||
Assert.AreEqual(image.Width, 64);
|
|
||||||
Assert.AreEqual(image.Height, 64);
|
|
||||||
Assert.AreEqual(image.Data.Length, image.Width * image.Height * 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
public static void DrawImage( Image img )
|
|
||||||
{
|
|
||||||
var grad = " -:+#";
|
|
||||||
|
|
||||||
for ( int y = 0; y<img.Height; y++ )
|
|
||||||
{
|
|
||||||
var str = "";
|
|
||||||
|
|
||||||
for ( int x = 0; x < img.Width; x++ )
|
|
||||||
{
|
|
||||||
var p = img.GetPixel( x, y );
|
|
||||||
|
|
||||||
var brightness = 1 - ((float)(p.r + p.g + p.b) / (255.0f * 3.0f));
|
|
||||||
var c = (int) ((grad.Length) * brightness);
|
|
||||||
if ( c > 3 ) c = 3;
|
|
||||||
str += grad[c];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine( str );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
@ -41,6 +40,7 @@ public async Task PublicIp()
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task BeginAuthSession()
|
public async Task BeginAuthSession()
|
||||||
{
|
{
|
||||||
|
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
AuthSessionResponse response = AuthSessionResponse.AuthTicketInvalidAlreadyUsed;
|
AuthSessionResponse response = AuthSessionResponse.AuthTicketInvalidAlreadyUsed;
|
||||||
|
|
||||||
@ -83,23 +83,35 @@ public async Task BeginAuthSession()
|
|||||||
// Wait for that to go through steam
|
// Wait for that to go through steam
|
||||||
//
|
//
|
||||||
while ( !finished )
|
while ( !finished )
|
||||||
|
{
|
||||||
|
if ( stopwatch.Elapsed.TotalSeconds > 5 )
|
||||||
|
throw new System.Exception( "Took too long waiting for AuthSessionResponse.OK" );
|
||||||
|
|
||||||
await Task.Delay( 10 );
|
await Task.Delay( 10 );
|
||||||
|
}
|
||||||
|
|
||||||
Assert.AreEqual( response, AuthSessionResponse.OK );
|
Assert.AreEqual( response, AuthSessionResponse.OK );
|
||||||
|
|
||||||
finished = false;
|
finished = false;
|
||||||
|
stopwatch = System.Diagnostics.Stopwatch.StartNew();
|
||||||
|
|
||||||
//
|
//
|
||||||
// The client is leaving, and now wants to cancel the ticket
|
// The client is leaving, and now wants to cancel the ticket
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Assert.AreNotEqual( 0, clientTicket.Handle );
|
||||||
clientTicket.Cancel();
|
clientTicket.Cancel();
|
||||||
|
|
||||||
//
|
//
|
||||||
// We should get another callback
|
// We should get another callback
|
||||||
//
|
//
|
||||||
while ( !finished )
|
while ( !finished )
|
||||||
|
{
|
||||||
|
if ( stopwatch.Elapsed.TotalSeconds > 5 )
|
||||||
|
throw new System.Exception( "Took too long waiting for AuthSessionResponse.AuthTicketCanceled" );
|
||||||
|
|
||||||
await Task.Delay( 10 );
|
await Task.Delay( 10 );
|
||||||
|
}
|
||||||
|
|
||||||
Assert.AreEqual( response, AuthSessionResponse.AuthTicketCanceled );
|
Assert.AreEqual( response, AuthSessionResponse.AuthTicketCanceled );
|
||||||
|
|
||||||
|
@ -1,295 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
[TestClass]
|
|
||||||
public class Inventory
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void InventoryDefinitions()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull( client.Inventory.Definitions );
|
|
||||||
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
|
|
||||||
|
|
||||||
foreach ( var i in client.Inventory.Definitions.Where( x => x.PriceCategory != "" ) )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}: {1} ({2})", i.Id, i.Name, i.Type );
|
|
||||||
Console.WriteLine( " itemshortname: {0}", i.GetStringProperty( "itemshortname" ) );
|
|
||||||
Console.WriteLine( " workshopdownload: {0}", i.GetStringProperty( "workshopdownload" ) );
|
|
||||||
Console.WriteLine( " IconUrl: {0}", i.IconUrl );
|
|
||||||
Console.WriteLine( " IconLargeUrl: {0}", i.IconLargeUrl );
|
|
||||||
Console.WriteLine( " PriceRaw: {0}", i.PriceCategory );
|
|
||||||
Console.WriteLine( " PriceDollars: {0}", i.PriceDollars );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void InventoryDefinitionExchange()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull( client.Inventory.Definitions );
|
|
||||||
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
|
|
||||||
|
|
||||||
foreach ( var i in client.Inventory.Definitions )
|
|
||||||
{
|
|
||||||
if ( i.Recipes == null ) continue;
|
|
||||||
|
|
||||||
Console.WriteLine( "Ways To Create " + i.Name );
|
|
||||||
|
|
||||||
foreach ( var r in i.Recipes )
|
|
||||||
{
|
|
||||||
Console.WriteLine( " " + string.Join( ", ", r.Ingredients.Select( x => x.Count + " x " + x.Definition.Name ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void InventoryDefinitionIngredients()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull( client.Inventory.Definitions );
|
|
||||||
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
|
|
||||||
|
|
||||||
foreach ( var i in client.Inventory.Definitions )
|
|
||||||
{
|
|
||||||
if ( i.IngredientFor == null ) continue;
|
|
||||||
|
|
||||||
Console.WriteLine( i.Name + " Can Be Used to Make" );
|
|
||||||
|
|
||||||
foreach ( var r in i.IngredientFor )
|
|
||||||
{
|
|
||||||
Console.WriteLine( " " + r.Result.Name );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void InventoryItemList()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CallbackCalled = false;
|
|
||||||
|
|
||||||
// OnUpdate hsould be called when we receive a list of our items
|
|
||||||
client.Inventory.OnUpdate += () => { CallbackCalled = true; };
|
|
||||||
|
|
||||||
// tell steam to download the items
|
|
||||||
client.Inventory.Refresh();
|
|
||||||
|
|
||||||
// Wait for the items
|
|
||||||
var timeout = Stopwatch.StartNew();
|
|
||||||
while ( client.Inventory.Items == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 1000 );
|
|
||||||
|
|
||||||
if ( timeout.Elapsed.TotalSeconds > 10 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure callback was called
|
|
||||||
Assert.IsTrue( CallbackCalled );
|
|
||||||
|
|
||||||
// Make sure items are valid
|
|
||||||
foreach ( var item in client.Inventory.Items )
|
|
||||||
{
|
|
||||||
Assert.IsNotNull( item );
|
|
||||||
Assert.IsNotNull( item.Definition );
|
|
||||||
|
|
||||||
Console.WriteLine( item.Definition.Name + " - " + item.Id );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void InventoryItemProperties()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
while ( true )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (client.Inventory.Items == null) continue;
|
|
||||||
|
|
||||||
foreach (var item in client.Inventory.Items)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"{item.Id} ({item.Definition.Name})");
|
|
||||||
|
|
||||||
foreach (var property in item.Properties)
|
|
||||||
{
|
|
||||||
Console.WriteLine($" {property.Key} = {property.Value}");
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Deserialize()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
Assert.IsNotNull(client.Inventory.Definitions);
|
|
||||||
Assert.AreNotEqual(0, client.Inventory.Definitions.Length);
|
|
||||||
|
|
||||||
client.Inventory.Refresh();
|
|
||||||
|
|
||||||
var stopwatch = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Block until we have the items
|
|
||||||
//
|
|
||||||
while ( client.Inventory.SerializedItems == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (stopwatch.Elapsed.Seconds > 10)
|
|
||||||
throw new System.Exception("Getting SerializedItems took too long");
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull( client.Inventory.SerializedItems );
|
|
||||||
Assert.IsTrue( client.Inventory.SerializedItems.Length > 4 );
|
|
||||||
/*
|
|
||||||
using ( var server = new Facepunch.Steamworks.Server( 252490, new ServerInit( "rust", "Rust" ) ) )
|
|
||||||
{
|
|
||||||
server.LogOnAnonymous();
|
|
||||||
Assert.IsTrue( server.IsValid );
|
|
||||||
|
|
||||||
var result = server.Inventory.Deserialize( client.Inventory.SerializedItems );
|
|
||||||
|
|
||||||
stopwatch = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (result.IsPending)
|
|
||||||
{
|
|
||||||
server.Update();
|
|
||||||
|
|
||||||
if (stopwatch.Elapsed.Seconds > 10)
|
|
||||||
throw new System.Exception("result took too long");
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsFalse( result.IsPending );
|
|
||||||
Assert.IsNotNull( result.Items );
|
|
||||||
|
|
||||||
foreach ( var item in result.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Item: {0} ({1})", item.Id, item.DefinitionId );
|
|
||||||
Console.WriteLine( "Item: {0} ({1})", item.Id, item.DefinitionId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void PurchaseItems()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull(client.Inventory.Definitions);
|
|
||||||
Assert.AreNotEqual(0, client.Inventory.Definitions.Length);
|
|
||||||
|
|
||||||
while ( client.Inventory.Currency == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
var shoppingList = client.Inventory.DefinitionsWithPrices.Take(2).ToArray();
|
|
||||||
bool waitingForCallback = true;
|
|
||||||
|
|
||||||
if ( !client.Inventory.StartPurchase(shoppingList, ( order, tran ) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Order: {order}, Transaction {tran}");
|
|
||||||
waitingForCallback = false;
|
|
||||||
|
|
||||||
} ) )
|
|
||||||
{
|
|
||||||
throw new Exception("Couldn't Buy!");
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( waitingForCallback )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void ListPrices()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
while ( client.Inventory.Definitions == null )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep( 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull(client.Inventory.Definitions);
|
|
||||||
Assert.AreNotEqual(0, client.Inventory.Definitions.Length);
|
|
||||||
|
|
||||||
while (client.Inventory.Currency == null)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( var i in client.Inventory.Definitions.Where( x => x.LocalPrice > 0 ) )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $" {i.Name} - {i.LocalPriceFormatted} ({client.Inventory.Currency})" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,276 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public class Leaderboard
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void GetLeaderboard()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
|
||||||
|
|
||||||
var time = Stopwatch.StartNew();
|
|
||||||
while ( !board.IsValid )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (time.Elapsed.TotalSeconds > 10 )
|
|
||||||
{
|
|
||||||
throw new Exception("board.IsValid took too long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsTrue( board.IsValid );
|
|
||||||
Assert.IsFalse( board.IsError );
|
|
||||||
Assert.IsNotNull( board.Name );
|
|
||||||
|
|
||||||
Console.WriteLine( $"Board name is \"{board.Name}\"" );
|
|
||||||
Console.WriteLine( $"Board has \"{board.TotalEntries}\" entries" );
|
|
||||||
|
|
||||||
board.AddScore( true, 86275309, 7, 8, 9 );
|
|
||||||
|
|
||||||
board.FetchScores( Steamworks.Leaderboard.RequestType.Global, 0, 20 );
|
|
||||||
|
|
||||||
time = Stopwatch.StartNew();
|
|
||||||
while ( board.IsQuerying )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (time.Elapsed.TotalSeconds > 10)
|
|
||||||
{
|
|
||||||
throw new Exception("board.IsQuerying took too long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsFalse( board.IsError );
|
|
||||||
Assert.IsNotNull( board.Results );
|
|
||||||
|
|
||||||
foreach ( var entry in board.Results )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"{entry.GlobalRank}: {entry.SteamId} ({entry.Name}) with {entry.Score}" );
|
|
||||||
|
|
||||||
if ( entry.SubScores != null )
|
|
||||||
Console.WriteLine( " - " + string.Join( ";", entry.SubScores.Select( x => x.ToString() ).ToArray() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetLeaderboardCallback()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
|
||||||
|
|
||||||
var time = Stopwatch.StartNew();
|
|
||||||
while ( !board.IsValid )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (time.Elapsed.TotalSeconds > 10)
|
|
||||||
{
|
|
||||||
throw new Exception("board.IsValid took too long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsTrue( board.IsValid );
|
|
||||||
Assert.IsFalse( board.IsError );
|
|
||||||
Assert.IsNotNull( board.Name );
|
|
||||||
|
|
||||||
board.AddScore( true, 86275309, 7, 8, 9 );
|
|
||||||
|
|
||||||
var done = false;
|
|
||||||
|
|
||||||
board.FetchScores( Steamworks.Leaderboard.RequestType.Global, 0, 20, results =>
|
|
||||||
{
|
|
||||||
foreach ( var entry in results )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"{entry.GlobalRank}: {entry.SteamId} ({entry.Name}) with {entry.Score}" );
|
|
||||||
|
|
||||||
if ( entry.SubScores != null )
|
|
||||||
Console.WriteLine( " - " + string.Join( ";", entry.SubScores.Select( x => x.ToString() ).ToArray() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
done = true;
|
|
||||||
}, error => Assert.Fail( error.ToString() ) );
|
|
||||||
|
|
||||||
while ( !done )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void AddScores()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
|
||||||
|
|
||||||
var time = Stopwatch.StartNew();
|
|
||||||
while (!board.IsValid)
|
|
||||||
{
|
|
||||||
Thread.Sleep(10);
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (time.Elapsed.TotalSeconds > 10)
|
|
||||||
{
|
|
||||||
throw new Exception("board.IsValid took too long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsTrue( board.IsValid );
|
|
||||||
Assert.IsFalse( board.IsError );
|
|
||||||
|
|
||||||
board.AddScore( true, 1234 );
|
|
||||||
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
board.AddScore( true, 34566 );
|
|
||||||
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
board.AddScore( true, 86275309, 7, 8, 9, 7, 4, 7, 98, 24, 5, 76, 124, 6 );
|
|
||||||
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
board.AddScore( false, 86275309, 7, 8, 9, 7, 4, 7, 98, 24, 5, 76, 124, 6 );
|
|
||||||
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void AddScoresCallback()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
|
||||||
|
|
||||||
var time = Stopwatch.StartNew();
|
|
||||||
while (!board.IsValid)
|
|
||||||
{
|
|
||||||
Thread.Sleep(10);
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if ( board.IsError )
|
|
||||||
{
|
|
||||||
throw new Exception( "Board is Error" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time.Elapsed.TotalSeconds > 10)
|
|
||||||
{
|
|
||||||
throw new Exception("board.IsValid took too long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsTrue( board.IsValid );
|
|
||||||
Assert.IsFalse( board.IsError );
|
|
||||||
|
|
||||||
var done = false;
|
|
||||||
|
|
||||||
const int score = 5678;
|
|
||||||
|
|
||||||
board.AddScore( false, score, null, result =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue( result.ScoreChanged );
|
|
||||||
Assert.AreEqual( result.Score, score );
|
|
||||||
|
|
||||||
done = true;
|
|
||||||
}, error => Assert.Fail( error.ToString() ) );
|
|
||||||
|
|
||||||
while ( !done )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void AddFileAttachment()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
|
||||||
|
|
||||||
var time = Stopwatch.StartNew();
|
|
||||||
while (!board.IsValid)
|
|
||||||
{
|
|
||||||
Thread.Sleep(10);
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if (time.Elapsed.TotalSeconds > 10)
|
|
||||||
{
|
|
||||||
throw new Exception("board.IsValid took too long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsTrue( board.IsValid );
|
|
||||||
Assert.IsFalse( board.IsError );
|
|
||||||
|
|
||||||
var done = false;
|
|
||||||
|
|
||||||
const int score = 5678;
|
|
||||||
const string attachment = "Hello world!";
|
|
||||||
|
|
||||||
var file = client.RemoteStorage.CreateFile( "score/example.txt" );
|
|
||||||
file.WriteAllText( attachment );
|
|
||||||
|
|
||||||
Assert.IsTrue( board.AddScore( false, score, null, result =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue( result.ScoreChanged );
|
|
||||||
|
|
||||||
Assert.IsTrue( board.AttachRemoteFile( file, () =>
|
|
||||||
{
|
|
||||||
done = true;
|
|
||||||
}, error => Assert.Fail( error.ToString() ) ) );
|
|
||||||
}, error => Assert.Fail( error.ToString() ) ) );
|
|
||||||
|
|
||||||
while ( !done )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
done = false;
|
|
||||||
|
|
||||||
Assert.IsTrue( board.FetchScores( Steamworks.Leaderboard.RequestType.GlobalAroundUser, 0, 0, entries =>
|
|
||||||
{
|
|
||||||
Assert.AreEqual( 1, entries.Length );
|
|
||||||
Assert.IsNotNull( entries[0].AttachedFile );
|
|
||||||
|
|
||||||
Assert.IsTrue( entries[0].AttachedFile.Download( () =>
|
|
||||||
{
|
|
||||||
Assert.AreEqual( attachment, entries[0].AttachedFile.ReadAllText() );
|
|
||||||
|
|
||||||
done = true;
|
|
||||||
}, error => Assert.Fail( error.ToString() ) ) );
|
|
||||||
}, error => Assert.Fail( error.ToString() ) ) );
|
|
||||||
|
|
||||||
while ( !done )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,389 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Facepunch.Steamworks;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem("steam_api64.dll")]
|
|
||||||
public class Lobby
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void CreateLobby()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
Console.WriteLine($"Owner: {client.Lobby.Owner}");
|
|
||||||
Console.WriteLine($"Max Members: {client.Lobby.MaxMembers}");
|
|
||||||
Console.WriteLine($"Num Members: {client.Lobby.NumMembers}");
|
|
||||||
client.Lobby.Leave();
|
|
||||||
};
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 3)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetCreatedLobbyData()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
foreach (KeyValuePair<string, string> data in client.Lobby.CurrentLobbyData.GetAllData())
|
|
||||||
{
|
|
||||||
if (data.Key == "appid")
|
|
||||||
{
|
|
||||||
Assert.IsTrue(data.Value == "252490");
|
|
||||||
}
|
|
||||||
Console.WriteLine($"{data.Key} {data.Value}");
|
|
||||||
}
|
|
||||||
client.Lobby.Leave();
|
|
||||||
};
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 3)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void UpdateLobbyData()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
|
|
||||||
client.Lobby.Name = "My Updated Lobby Name";
|
|
||||||
client.Lobby.CurrentLobbyData.SetData("testkey", "testvalue");
|
|
||||||
client.Lobby.LobbyType = Steamworks.Lobby.Type.Private;
|
|
||||||
client.Lobby.MaxMembers = 5;
|
|
||||||
client.Lobby.Joinable = false;
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> data in client.Lobby.CurrentLobbyData.GetAllData())
|
|
||||||
{
|
|
||||||
if (data.Key == "appid")
|
|
||||||
{
|
|
||||||
Assert.IsTrue(data.Value == "252490");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.Key == "testkey")
|
|
||||||
{
|
|
||||||
Assert.IsTrue(data.Value == "testvalue");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.Key == "lobbytype")
|
|
||||||
{
|
|
||||||
Assert.IsTrue(data.Value == Steamworks.Lobby.Type.Private.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine($"{data.Key} {data.Value}");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyDataUpdated = () =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobby data updated");
|
|
||||||
Console.WriteLine(client.Lobby.MaxMembers);
|
|
||||||
Console.WriteLine(client.Lobby.Joinable);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 3)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Lobby.Leave();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void RefreshLobbyList()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
client.LobbyList.Refresh();
|
|
||||||
};
|
|
||||||
|
|
||||||
client.LobbyList.OnLobbiesUpdated = () =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobbies updating");
|
|
||||||
if (client.LobbyList.Finished)
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobbies finished updating");
|
|
||||||
Console.WriteLine($"found {client.LobbyList.Lobbies.Count} lobbies");
|
|
||||||
|
|
||||||
foreach (LobbyList.Lobby lobby in client.LobbyList.Lobbies)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Found Lobby: {lobby.Name}");
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Lobby.Leave();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 3)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void RefreshLobbyListWithFilter()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
client.Lobby.CurrentLobbyData.SetData("testkey", "testvalue");
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyDataUpdated = () =>
|
|
||||||
{
|
|
||||||
var filter = new LobbyList.Filter();
|
|
||||||
filter.StringFilters.Add("testkey", "testvalue");
|
|
||||||
client.LobbyList.Refresh(filter);
|
|
||||||
};
|
|
||||||
|
|
||||||
client.LobbyList.OnLobbiesUpdated = () =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobbies updating");
|
|
||||||
if (client.LobbyList.Finished)
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobbies finished updating");
|
|
||||||
Console.WriteLine($"found {client.LobbyList.Lobbies.Count} lobbies");
|
|
||||||
|
|
||||||
foreach (LobbyList.Lobby lobby in client.LobbyList.Lobbies)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Found Lobby: {lobby.Name}");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 5)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Lobby.Leave();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void RefreshLobbyListWithFilterAndGetLobbyDataFromListLobby()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(755870))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
client.Lobby.CurrentLobbyData.SetData("testkey", "testvalue");
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyDataUpdated = () =>
|
|
||||||
{
|
|
||||||
var filter = new LobbyList.Filter();
|
|
||||||
filter.StringFilters.Add("testkey", "testvalue");
|
|
||||||
client.LobbyList.Refresh(filter);
|
|
||||||
};
|
|
||||||
|
|
||||||
client.LobbyList.OnLobbiesUpdated = () =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobbies updating");
|
|
||||||
if (client.LobbyList.Finished)
|
|
||||||
{
|
|
||||||
Console.WriteLine("lobbies finished updating");
|
|
||||||
Console.WriteLine($"found {client.LobbyList.Lobbies.Count} lobbies");
|
|
||||||
|
|
||||||
foreach (LobbyList.Lobby lobby in client.LobbyList.Lobbies)
|
|
||||||
{
|
|
||||||
foreach (var pair in lobby.GetAllData())
|
|
||||||
{
|
|
||||||
Console.WriteLine(string.Format("Key: {0,-36} Value: {1}", pair.Key, pair.Value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 5)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Lobby.Leave();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void SendChatMessage()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
string testString = "Hello, World";
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
client.Lobby.CurrentLobbyData.SetData("testkey", "testvalue");
|
|
||||||
client.Lobby.SendChatMessage(testString);
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.OnChatMessageRecieved = (steamID, bytes, length) =>
|
|
||||||
{
|
|
||||||
string message = Encoding.UTF8.GetString(bytes, 0, length);
|
|
||||||
Console.WriteLine("message recieved");
|
|
||||||
Assert.IsTrue(message == testString);
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.OnChatStringRecieved = (steamID, message) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("message recieved");
|
|
||||||
Assert.IsTrue(message == testString);
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 5)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Lobby.Leave();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void SetGetUserMetadata()
|
|
||||||
{
|
|
||||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
||||||
{
|
|
||||||
Assert.IsTrue(client.IsValid);
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyCreated = (success) =>
|
|
||||||
{
|
|
||||||
Assert.IsTrue(success);
|
|
||||||
Assert.IsTrue(client.Lobby.IsValid);
|
|
||||||
Console.WriteLine("lobby created: " + client.Lobby.CurrentLobby);
|
|
||||||
client.Lobby.SetMemberData("testkey", "testvalue");
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.OnLobbyMemberDataUpdated = (steamID) =>
|
|
||||||
{
|
|
||||||
var friend = new global::Steamworks.Friend( steamID );
|
|
||||||
Console.WriteLine( friend.Name + " updated data");
|
|
||||||
Assert.IsTrue(client.Lobby.GetMemberData(steamID, "testkey") == "testvalue");
|
|
||||||
Console.WriteLine("testkey is now: " + client.Lobby.GetMemberData(steamID, "testkey"));
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while (sw.Elapsed.TotalSeconds < 5)
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
System.Threading.Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Lobby.Leave();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public partial class Networking
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void PeerToPeerSend()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var TestString = "This string will be transformed to bytes, sent over the Steam P2P network, then converted back to a string.";
|
|
||||||
var OutputReceived = false;
|
|
||||||
var data = Encoding.UTF8.GetBytes( TestString );
|
|
||||||
|
|
||||||
//
|
|
||||||
// Enable listening on this channel
|
|
||||||
//
|
|
||||||
client.Networking.SetListenChannel( 0, true );
|
|
||||||
|
|
||||||
client.Networking.OnP2PData = ( steamid, bytes, length, channel ) =>
|
|
||||||
{
|
|
||||||
var str = Encoding.UTF8.GetString( bytes, 0, length );
|
|
||||||
Assert.AreEqual( str, TestString );
|
|
||||||
Assert.AreEqual( steamid, client.SteamId );
|
|
||||||
OutputReceived = true;
|
|
||||||
|
|
||||||
Console.WriteLine( "Got: " + str );
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Networking.OnIncomingConnection = ( steamid ) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Incoming P2P Connection: " + steamid );
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Networking.OnConnectionFailed = ( steamid, error ) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Connection Error: " + steamid + " - " + error );
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Networking.SendP2PPacket( client.SteamId, data, data.Length );
|
|
||||||
|
|
||||||
while( true )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
if ( OutputReceived )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void PeerToPeerFailure()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var TestString = "This string will be transformed to bytes, sent over the Steam P2P network, then converted back to a string.";
|
|
||||||
var TimeoutReceived = false;
|
|
||||||
var data = Encoding.UTF8.GetBytes( TestString );
|
|
||||||
|
|
||||||
client.Networking.OnIncomingConnection = ( steamid ) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Incoming P2P Connection: " + steamid );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
client.Networking.OnConnectionFailed = ( steamid, error ) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Connection Error: " + steamid + " - " + error );
|
|
||||||
TimeoutReceived = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
ulong rand = (ulong) new Random().Next( 1024 * 16 );
|
|
||||||
|
|
||||||
// Send to an invalid, not listening steamid
|
|
||||||
if ( !client.Networking.SendP2PPacket( client.SteamId + rand, data, data.Length ) )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Couldn't send packet" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
|
||||||
|
|
||||||
while ( true )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
client.Update();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Timout is usually around 15 seconds
|
|
||||||
//
|
|
||||||
if ( TimeoutReceived )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if ( sw.Elapsed.TotalSeconds > 30 )
|
|
||||||
{
|
|
||||||
Assert.Fail( "Didn't time out" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public class RemoteStorage
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void GetQuota()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
ulong total = client.RemoteStorage.QuotaTotal;
|
|
||||||
var available = client.RemoteStorage.QuotaRemaining;
|
|
||||||
|
|
||||||
Console.WriteLine( $"Total quota: {total} bytes" );
|
|
||||||
Console.WriteLine( $"Available: {available} bytes" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void WriteFile()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var file = client.RemoteStorage.CreateFile( "test.txt" );
|
|
||||||
|
|
||||||
const string text = "Hello world!";
|
|
||||||
|
|
||||||
file.WriteAllText( text );
|
|
||||||
|
|
||||||
Assert.IsTrue( file.Exists );
|
|
||||||
|
|
||||||
var read = file.ReadAllText();
|
|
||||||
Assert.AreEqual( text, read );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void ReadText()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var text = client.RemoteStorage.ReadString( "test.txt" );
|
|
||||||
|
|
||||||
Assert.IsNotNull( text );
|
|
||||||
Assert.AreEqual( text, "Hello world!" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void WriteText()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var result = client.RemoteStorage.WriteString( "test.txt", "Hello world!" );
|
|
||||||
Assert.IsTrue( result );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void WriteFiles()
|
|
||||||
{
|
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
for ( var i = 0; i < 10; ++i )
|
|
||||||
{
|
|
||||||
client.RemoteStorage
|
|
||||||
.CreateFile( $"test_{i}/example.txt" )
|
|
||||||
.WriteAllText( Guid.NewGuid().ToString() );
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine( $"File count: {client.RemoteStorage.FileCount}" );
|
|
||||||
|
|
||||||
foreach ( var file in client.RemoteStorage.Files )
|
|
||||||
{
|
|
||||||
DateTime t = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(file.FileTimestamp);
|
|
||||||
Console.WriteLine( $"- {file.FileName} ({file.SizeInBytes} bytes), modified {t:O}" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,9 +19,9 @@ public void IpAddressConversions()
|
|||||||
var ipstr = "185.38.150.40";
|
var ipstr = "185.38.150.40";
|
||||||
var ip = IPAddress.Parse( ipstr );
|
var ip = IPAddress.Parse( ipstr );
|
||||||
|
|
||||||
var ip_int = Facepunch.Steamworks.Utility.IpToInt32( ip );
|
var ip_int = Utility.IpToInt32( ip );
|
||||||
|
|
||||||
var ip_back = Facepunch.Steamworks.Utility.Int32ToIp( ip_int );
|
var ip_back = Utility.Int32ToIp( ip_int );
|
||||||
|
|
||||||
Console.WriteLine( "ipstr: " + ipstr );
|
Console.WriteLine( "ipstr: " + ipstr );
|
||||||
Console.WriteLine( "ip: " + ip );
|
Console.WriteLine( "ip: " + ip );
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public class Stats
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void UpdateStats()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
client.Stats.UpdateStats();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void UpdateSUpdateGlobalStatstats()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
client.Stats.UpdateGlobalStats( 1 );
|
|
||||||
client.Stats.UpdateGlobalStats( 3 );
|
|
||||||
client.Stats.UpdateGlobalStats( 7 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetClientFloat()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var v = client.Stats.GetFloat( "deaths" );
|
|
||||||
Console.WriteLine( v );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetClientInt()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var v = client.Stats.GetInt( "deaths" );
|
|
||||||
Console.WriteLine( v );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetGlobalFloat()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var v = client.Stats.GetGlobalFloat( "deaths" );
|
|
||||||
Console.WriteLine( v );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetGlobalInt()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
var v = client.Stats.GetGlobalInt( "deaths" );
|
|
||||||
Console.WriteLine( v );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -69,7 +69,7 @@ public void AuthSession()
|
|||||||
|
|
||||||
var result = User.BeginAuthSession( ticket.Data, User.SteamId );
|
var result = User.BeginAuthSession( ticket.Data, User.SteamId );
|
||||||
Console.WriteLine( $"result: { result }" );
|
Console.WriteLine( $"result: { result }" );
|
||||||
Assert.AreEqual( result, SteamNative.BeginAuthSessionResult.OK );
|
Assert.AreEqual( result, BeginAuthSessionResult.OK );
|
||||||
|
|
||||||
User.EndAuthSession( User.SteamId );
|
User.EndAuthSession( User.SteamId );
|
||||||
}
|
}
|
||||||
|
@ -1,541 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Facepunch.Steamworks.Callbacks;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
[DeploymentItem( "steam_api64.dll" )]
|
|
||||||
public class WorkshopTest
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void Query()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var Query = client.Workshop.CreateQuery();
|
|
||||||
Query.Order = Workshop.Order.RankedByTrend;
|
|
||||||
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
// Block, wait for result
|
|
||||||
// (don't do this in realtime)
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
// results
|
|
||||||
|
|
||||||
Console.WriteLine( "Searching" );
|
|
||||||
|
|
||||||
Query.Order = Workshop.Order.RankedByTextSearch;
|
|
||||||
Query.QueryType = Workshop.QueryType.MicrotransactionItems;
|
|
||||||
Query.SearchText = "black";
|
|
||||||
Query.RequireTags.Add( "LongTShirt Skin" );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
// Block, wait for result
|
|
||||||
// (don't do this in realtime)
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
foreach ( var item in Query.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}", item.Title );
|
|
||||||
Console.WriteLine( "\t WebsiteViews: {0}", item.WebsiteViews );
|
|
||||||
Console.WriteLine( "\t VotesUp: {0}", item.VotesUp );
|
|
||||||
Console.WriteLine( "\t PreviewUrl: {0}", item.PreviewImageUrl );
|
|
||||||
|
|
||||||
Assert.IsTrue( item.PreviewImageUrl.Contains( "http" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryMyFiles()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var Query = client.Workshop.CreateQuery();
|
|
||||||
|
|
||||||
Query.UserId = client.SteamId;
|
|
||||||
Query.UserQueryType = Workshop.UserQueryType.Published;
|
|
||||||
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
// Block, wait for result
|
|
||||||
// (don't do this in realtime)
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
foreach ( var item in Query.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}", item.Title );
|
|
||||||
Console.WriteLine( "\t WebsiteViews: {0}", item.WebsiteViews );
|
|
||||||
Console.WriteLine( "\t VotesUp: {0}", item.VotesUp );
|
|
||||||
Console.WriteLine( "\t PreviewUrl: {0}", item.PreviewImageUrl );
|
|
||||||
Console.WriteLine( "\t Directory: {0}", item.Directory );
|
|
||||||
|
|
||||||
Assert.IsTrue( item.PreviewImageUrl.Contains( "http" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryTagRequire()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.RequireTags.Add( "LongTShirt Skin" );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
foreach ( var item in Query.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}", item.Title );
|
|
||||||
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
|
|
||||||
|
|
||||||
Assert.IsTrue( item.Tags.Contains( "longtshirt skin" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryTagRequireMultiple()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.RequireTags.Add( "LongTShirt Skin" );
|
|
||||||
Query.RequireTags.Add( "version2" );
|
|
||||||
Query.RequireAllTags = true;
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
foreach ( var item in Query.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}", item.Title );
|
|
||||||
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
|
|
||||||
|
|
||||||
Assert.IsTrue( item.Tags.Contains( "longtshirt skin" ) );
|
|
||||||
Assert.IsTrue( item.Tags.Contains( "version2" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryTagExclude()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.RequireTags.Add( "LongTShirt Skin" );
|
|
||||||
Query.ExcludeTags.Add( "version2" );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
foreach ( var item in Query.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}", item.Title );
|
|
||||||
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
|
|
||||||
|
|
||||||
Assert.IsTrue( item.Tags.Contains( "longtshirt skin" ) );
|
|
||||||
Assert.IsFalse( item.Tags.Contains( "version2" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryFile()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.FileId.Add( 751993251 );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.IsRunning );
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.AreEqual( Query.TotalResults, 1 );
|
|
||||||
Assert.AreEqual( Query.Items.Length, 1 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
Assert.AreEqual<ulong>( Query.Items[0].Id, 751993251 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryCallback()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
var gotCallback = false;
|
|
||||||
|
|
||||||
Query.OnResult = ( q ) =>
|
|
||||||
{
|
|
||||||
Assert.AreEqual( q.Items.Length, 1 );
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", q.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", q.Items.Length );
|
|
||||||
|
|
||||||
gotCallback = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
Query.FileId.Add( 751993251 );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.IsRunning );
|
|
||||||
|
|
||||||
client.UpdateWhile( () => gotCallback == false );
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.AreEqual( Query.TotalResults, 1 );
|
|
||||||
|
|
||||||
Assert.AreEqual<ulong>( Query.Items[0].Id, 751993251 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void QueryFiles()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.FileId.Add( 751993251 );
|
|
||||||
Query.FileId.Add( 747266909 );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.IsRunning );
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.AreEqual( Query.TotalResults, 2 );
|
|
||||||
Assert.AreEqual( Query.Items.Length, 2 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.Items.Any( x => x.Id == 751993251 ) );
|
|
||||||
Assert.IsTrue( Query.Items.Any( x => x.Id == 747266909 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Query_255()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.PerPage = 255;
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Assert.IsTrue( Query.IsRunning );
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.AreEqual( Query.Items.Length, 255 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Query_28()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.PerPage = 28;
|
|
||||||
Query.Run();
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
var firstPage = Query.Items;
|
|
||||||
Assert.AreEqual( firstPage.Length, 28 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Page 2" );
|
|
||||||
Query.Page++;
|
|
||||||
Query.Run();
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
|
|
||||||
var secondPage = Query.Items;
|
|
||||||
Assert.AreEqual( secondPage.Length, 28 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Page 3" );
|
|
||||||
Query.Page++;
|
|
||||||
Query.Run();
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
var thirdPage = Query.Items;
|
|
||||||
Assert.AreEqual( thirdPage.Length, 28 );
|
|
||||||
|
|
||||||
foreach ( var i in firstPage )
|
|
||||||
{
|
|
||||||
Assert.IsFalse( secondPage.Any( x => x.Id == i.Id ) );
|
|
||||||
Assert.IsFalse( thirdPage.Any( x => x.Id == i.Id ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( var i in secondPage )
|
|
||||||
{
|
|
||||||
Assert.IsFalse( firstPage.Any( x => x.Id == i.Id ) );
|
|
||||||
Assert.IsFalse( thirdPage.Any( x => x.Id == i.Id ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( var i in thirdPage )
|
|
||||||
{
|
|
||||||
Assert.IsFalse( secondPage.Any( x => x.Id == i.Id ) );
|
|
||||||
Assert.IsFalse( firstPage.Any( x => x.Id == i.Id ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void DownloadFile()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var item = client.Workshop.GetItem( 844466101 );
|
|
||||||
|
|
||||||
var time = Stopwatch.StartNew();
|
|
||||||
if ( !item.Installed )
|
|
||||||
{
|
|
||||||
item.Download();
|
|
||||||
|
|
||||||
while ( !item.Installed )
|
|
||||||
{
|
|
||||||
Thread.Sleep( 500 );
|
|
||||||
client.Update();
|
|
||||||
Console.WriteLine( "Download Progress: {0}", item.DownloadProgress );
|
|
||||||
|
|
||||||
if (time.Elapsed.Seconds > 30)
|
|
||||||
throw new Exception("item.Installed Took Too Long");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsNotNull( item.Directory );
|
|
||||||
Assert.AreNotEqual( 0, item.Size );
|
|
||||||
|
|
||||||
Console.WriteLine( "item.Installed: {0}", item.Installed );
|
|
||||||
Console.WriteLine( "item.Downloading: {0}", item.Downloading );
|
|
||||||
Console.WriteLine( "item.DownloadPending: {0}", item.DownloadPending );
|
|
||||||
Console.WriteLine( "item.Directory: {0}", item.Directory );
|
|
||||||
Console.WriteLine( "item.Size: {0}mb", (item.Size / 1024 / 1024) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
[TestCategory( "Run Manually" )]
|
|
||||||
public void CreatePublish()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var item = client.Workshop.CreateItem( Workshop.ItemType.Microtransaction );
|
|
||||||
|
|
||||||
item.Title = "Facepunch.Steamworks Unit test";
|
|
||||||
item.Tags.Add( "Apple" );
|
|
||||||
item.Tags.Add( "Banana" );
|
|
||||||
|
|
||||||
// Make a folder
|
|
||||||
var testFolder = new System.IO.DirectoryInfo("BlahBlah");
|
|
||||||
if (!testFolder.Exists) testFolder.Create();
|
|
||||||
|
|
||||||
item.Folder = testFolder.FullName;
|
|
||||||
|
|
||||||
// Upload a file of random bytes
|
|
||||||
var rand = new Random();
|
|
||||||
var testFile = new byte[1024 * 1024 * 32];
|
|
||||||
rand.NextBytes(testFile);
|
|
||||||
System.IO.File.WriteAllBytes( testFolder.FullName + "/testfile1.bin", testFile);
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine(item.Folder);
|
|
||||||
|
|
||||||
item.OnChangesSubmitted += result =>
|
|
||||||
{
|
|
||||||
Console.WriteLine( "OnChangesSubmitted called: " + result );
|
|
||||||
Assert.AreEqual( Result.OK, result );
|
|
||||||
};
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
item.Publish();
|
|
||||||
|
|
||||||
while ( item.Publishing )
|
|
||||||
{
|
|
||||||
client.Update();
|
|
||||||
Thread.Sleep( 10 );
|
|
||||||
|
|
||||||
Console.WriteLine("Progress: " + item.Progress);
|
|
||||||
Console.WriteLine("BytesUploaded: " + item.BytesUploaded);
|
|
||||||
Console.WriteLine("BytesTotal: " + item.BytesTotal);
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.IsFalse( item.Publishing );
|
|
||||||
Assert.AreNotEqual( 0, item.Id );
|
|
||||||
Assert.IsNull( item.Error, item.Error );
|
|
||||||
|
|
||||||
Console.WriteLine( "item.Id: {0}", item.Id );
|
|
||||||
|
|
||||||
using ( var Query = client.Workshop.CreateQuery() )
|
|
||||||
{
|
|
||||||
Query.FileId.Add( item.Id );
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
var itemInfo = Query.Items[0];
|
|
||||||
|
|
||||||
Assert.AreEqual( itemInfo.Id, item.Id );
|
|
||||||
Assert.AreEqual( itemInfo.OwnerId, client.SteamId );
|
|
||||||
Assert.AreEqual( itemInfo.Title, item.Title );
|
|
||||||
Assert.IsTrue( itemInfo.Tags.Contains( "apple" ), "Missing Tag" );
|
|
||||||
Assert.IsTrue( itemInfo.Tags.Contains( "banana" ), "Missing Tag" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Deleting: {0}", item.Id );
|
|
||||||
item.Delete();
|
|
||||||
|
|
||||||
System.IO.File.Delete(testFolder.FullName + "/testfile.bin");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void UserQuery()
|
|
||||||
{
|
|
||||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
|
||||||
{
|
|
||||||
Assert.IsTrue( client.IsValid );
|
|
||||||
|
|
||||||
var Query = client.Workshop.CreateQuery();
|
|
||||||
|
|
||||||
Query.UserId = 76561197960279927;
|
|
||||||
Query.UserQueryType = Workshop.UserQueryType.Published;
|
|
||||||
|
|
||||||
Query.Run();
|
|
||||||
|
|
||||||
// Block, wait for result
|
|
||||||
// (don't do this in realtime)
|
|
||||||
Query.Block();
|
|
||||||
|
|
||||||
Assert.IsFalse( Query.IsRunning );
|
|
||||||
Assert.IsTrue( Query.TotalResults > 0 );
|
|
||||||
Assert.IsTrue( Query.Items.Length > 0 );
|
|
||||||
|
|
||||||
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
|
|
||||||
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
|
|
||||||
|
|
||||||
foreach ( var item in Query.Items )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "{0}", item.Title );
|
|
||||||
Assert.AreEqual<ulong>( item.OwnerId, 76561197960279927 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
using SteamNative;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@ -95,7 +94,7 @@ internal static void InstallEvents()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the time of the purchase of the app
|
/// Returns the time of the purchase of the app
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static DateTime PurchaseTime( AppId appid ) => Facepunch.Steamworks.Utility.Epoch.ToDateTime( Internal.GetEarliestPurchaseUnixTime( appid.Value ) );
|
public static DateTime PurchaseTime( AppId appid ) => Utility.Epoch.ToDateTime( Internal.GetEarliestPurchaseUnixTime( appid.Value ) );
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the user is subscribed to the current app through a free weekend
|
/// Checks if the user is subscribed to the current app through a free weekend
|
||||||
@ -109,12 +108,12 @@ internal static void InstallEvents()
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static IEnumerable<DlcInformation> DlcInformation()
|
public static IEnumerable<DlcInformation> DlcInformation()
|
||||||
{
|
{
|
||||||
var appid = default( SteamNative.AppId_t );
|
var appid = default( AppId_t );
|
||||||
var available = false;
|
var available = false;
|
||||||
|
|
||||||
for ( int i = 0; i < Internal.GetDLCCount(); i++ )
|
for ( int i = 0; i < Internal.GetDLCCount(); i++ )
|
||||||
{
|
{
|
||||||
var sb = SteamNative.Helpers.TakeStringBuilder();
|
var sb = Helpers.TakeStringBuilder();
|
||||||
|
|
||||||
if ( !Internal.BGetDLCDataByIndex( i, ref appid, ref available, sb, sb.Capacity ) )
|
if ( !Internal.BGetDLCDataByIndex( i, ref appid, ref available, sb, sb.Capacity ) )
|
||||||
continue;
|
continue;
|
||||||
@ -145,7 +144,7 @@ public static string CurrentBetaName
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var sb = SteamNative.Helpers.TakeStringBuilder();
|
var sb = Helpers.TakeStringBuilder();
|
||||||
|
|
||||||
if ( !Internal.GetCurrentBetaName( sb, sb.Capacity ) )
|
if ( !Internal.GetCurrentBetaName( sb, sb.Capacity ) )
|
||||||
return null;
|
return null;
|
||||||
@ -167,7 +166,7 @@ public static string CurrentBetaName
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static IEnumerable<DepotId> InstalledDepots( AppId appid )
|
public static IEnumerable<DepotId> InstalledDepots( AppId appid )
|
||||||
{
|
{
|
||||||
var depots = new SteamNative.DepotId_t[32];
|
var depots = new DepotId_t[32];
|
||||||
uint count = 0;
|
uint count = 0;
|
||||||
|
|
||||||
count = Internal.GetInstalledDepots( appid.Value, depots, (uint) depots.Length );
|
count = Internal.GetInstalledDepots( appid.Value, depots, (uint) depots.Length );
|
||||||
@ -184,7 +183,7 @@ public static IEnumerable<DepotId> InstalledDepots( AppId appid )
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string AppInstallDir( AppId appid )
|
public static string AppInstallDir( AppId appid )
|
||||||
{
|
{
|
||||||
var sb = SteamNative.Helpers.TakeStringBuilder();
|
var sb = Helpers.TakeStringBuilder();
|
||||||
|
|
||||||
if ( Internal.GetAppInstallDir( appid.Value, sb, (uint) sb.Capacity ) == 0 )
|
if ( Internal.GetAppInstallDir( appid.Value, sb, (uint) sb.Capacity ) == 0 )
|
||||||
return null;
|
return null;
|
||||||
@ -246,7 +245,7 @@ public static async Task<FileDetails> GetFileDetailsAsync( string filename )
|
|||||||
|
|
||||||
return new FileDetails
|
return new FileDetails
|
||||||
{
|
{
|
||||||
Found = r.Value.Result == SteamNative.Result.OK,
|
Found = r.Value.Result == Result.OK,
|
||||||
SizeInBytes = r.Value.FileSize,
|
SizeInBytes = r.Value.FileSize,
|
||||||
Flags = r.Value.Flags,
|
Flags = r.Value.Flags,
|
||||||
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )
|
Sha1 = string.Join( "", r.Value.FileSHA.Select( x => x.ToString( "x" ) ) )
|
||||||
@ -265,7 +264,7 @@ public static string CommandLine
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var sb = SteamNative.Helpers.TakeStringBuilder();
|
var sb = Helpers.TakeStringBuilder();
|
||||||
var len = Internal.GetLaunchCommandLine( sb, sb.Capacity );
|
var len = Internal.GetLaunchCommandLine( sb, sb.Capacity );
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
@ -1,215 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Facepunch.Steamworks.Interop;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Implements shared functionality between Steamworks.Client and Steamworks.Server
|
|
||||||
/// </summary>
|
|
||||||
public class BaseSteamworks : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Current running program's AppId
|
|
||||||
/// </summary>
|
|
||||||
public uint AppId { get; internal set; }
|
|
||||||
|
|
||||||
public Networking Networking { get; internal set; }
|
|
||||||
public Inventory Inventory { get; internal set; }
|
|
||||||
public Workshop Workshop { get; internal set; }
|
|
||||||
|
|
||||||
internal event Action OnUpdate;
|
|
||||||
|
|
||||||
internal Interop.NativeInterface native;
|
|
||||||
|
|
||||||
private List<SteamNative.CallbackHandle> CallbackHandles = new List<SteamNative.CallbackHandle>();
|
|
||||||
private List<SteamNative.CallResult> CallResults = new List<SteamNative.CallResult>();
|
|
||||||
protected bool disposed = false;
|
|
||||||
|
|
||||||
|
|
||||||
protected BaseSteamworks( uint appId )
|
|
||||||
{
|
|
||||||
if ( IntPtr.Size == 4 )
|
|
||||||
throw new System.Exception( "Sorry - 32bit processes aren't supported. It's 2019 or later, come on!" );
|
|
||||||
|
|
||||||
AppId = appId;
|
|
||||||
|
|
||||||
//
|
|
||||||
// No need for the "steam_appid.txt" file any more
|
|
||||||
//
|
|
||||||
System.Environment.SetEnvironmentVariable("SteamAppId", AppId.ToString());
|
|
||||||
System.Environment.SetEnvironmentVariable("SteamGameId", AppId.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
~BaseSteamworks()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( disposed ) return;
|
|
||||||
|
|
||||||
Callbacks.Clear();
|
|
||||||
|
|
||||||
foreach ( var h in CallbackHandles )
|
|
||||||
{
|
|
||||||
h.Dispose();
|
|
||||||
}
|
|
||||||
CallbackHandles.Clear();
|
|
||||||
|
|
||||||
foreach ( var h in CallResults )
|
|
||||||
{
|
|
||||||
h.Dispose();
|
|
||||||
}
|
|
||||||
CallResults.Clear();
|
|
||||||
|
|
||||||
if ( Workshop != null )
|
|
||||||
{
|
|
||||||
Workshop.Dispose();
|
|
||||||
Workshop = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Inventory != null )
|
|
||||||
{
|
|
||||||
Inventory.Dispose();
|
|
||||||
Inventory = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Networking != null )
|
|
||||||
{
|
|
||||||
Networking.Dispose();
|
|
||||||
Networking = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( native != null )
|
|
||||||
{
|
|
||||||
native.Dispose();
|
|
||||||
native = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.Environment.SetEnvironmentVariable("SteamAppId", null );
|
|
||||||
System.Environment.SetEnvironmentVariable("SteamGameId", null );
|
|
||||||
disposed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetupCommonInterfaces()
|
|
||||||
{
|
|
||||||
Networking = new Steamworks.Networking( this, native.networking );
|
|
||||||
Inventory = new Steamworks.Inventory( this, native.inventory, IsGameServer );
|
|
||||||
Workshop = new Steamworks.Workshop( this, native.ugc, native.remoteStorage );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if this instance has initialized properly.
|
|
||||||
/// If this returns false you should Dispose and throw an error.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsValid
|
|
||||||
{
|
|
||||||
get { return native != null; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal virtual bool IsGameServer { get { return false; } }
|
|
||||||
|
|
||||||
internal void RegisterCallbackHandle( SteamNative.CallbackHandle handle )
|
|
||||||
{
|
|
||||||
CallbackHandles.Add( handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RegisterCallResult( SteamNative.CallResult handle )
|
|
||||||
{
|
|
||||||
CallResults.Add( handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void UnregisterCallResult( SteamNative.CallResult handle )
|
|
||||||
{
|
|
||||||
CallResults.Remove( handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Update()
|
|
||||||
{
|
|
||||||
Networking.Update();
|
|
||||||
|
|
||||||
RunUpdateCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This gets called automatically in Update. Only call it manually if you know why you're doing it.
|
|
||||||
/// </summary>
|
|
||||||
public void RunUpdateCallbacks()
|
|
||||||
{
|
|
||||||
if ( OnUpdate != null )
|
|
||||||
OnUpdate();
|
|
||||||
|
|
||||||
for( int i=0; i < CallResults.Count; i++ )
|
|
||||||
{
|
|
||||||
CallResults[i].Try();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Run Update until func returns false.
|
|
||||||
/// This will cause your program to lock up until it finishes.
|
|
||||||
/// This is useful for things like tests or command line utilities etc.
|
|
||||||
/// </summary>
|
|
||||||
public void UpdateWhile( Func<bool> func )
|
|
||||||
{
|
|
||||||
const int sleepMs = 1;
|
|
||||||
|
|
||||||
while ( func() )
|
|
||||||
{
|
|
||||||
Update();
|
|
||||||
#if NET_CORE
|
|
||||||
System.Threading.Tasks.Task.Delay( sleepMs ).Wait();
|
|
||||||
#else
|
|
||||||
System.Threading.Thread.Sleep( sleepMs );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Debug function, called for every callback. Only really used to confirm that callbacks are working properly.
|
|
||||||
/// </summary>
|
|
||||||
public Action<object> OnAnyCallback;
|
|
||||||
|
|
||||||
Dictionary<Type, List<Action<object>>> Callbacks = new Dictionary<Type, List<Action<object>>>();
|
|
||||||
|
|
||||||
internal List<Action<object>> CallbackList( Type T )
|
|
||||||
{
|
|
||||||
List<Action<object>> list = null;
|
|
||||||
|
|
||||||
if ( !Callbacks.TryGetValue( T, out list ) )
|
|
||||||
{
|
|
||||||
list = new List<Action<object>>();
|
|
||||||
Callbacks[T] = list;
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnCallback<T>( T data )
|
|
||||||
{
|
|
||||||
var list = CallbackList( typeof( T ) );
|
|
||||||
|
|
||||||
foreach ( var i in list )
|
|
||||||
{
|
|
||||||
i( data );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( OnAnyCallback != null )
|
|
||||||
{
|
|
||||||
OnAnyCallback.Invoke( data );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RegisterCallback<T>( Action<T> func )
|
|
||||||
{
|
|
||||||
var list = CallbackList( typeof( T ) );
|
|
||||||
list.Add( ( o ) => func( (T) o ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
41
Facepunch.Steamworks/Callbacks/Callback.VTable.cs
Normal file
41
Facepunch.Steamworks/Callbacks/Callback.VTable.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Steamworks
|
||||||
|
{
|
||||||
|
internal partial class Callback
|
||||||
|
{
|
||||||
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
|
public class VTable
|
||||||
|
{
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD();
|
||||||
|
|
||||||
|
public ResultD ResultA;
|
||||||
|
public ResultWithInfoD ResultB;
|
||||||
|
public GetSizeD GetSize;
|
||||||
|
|
||||||
|
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
||||||
|
{
|
||||||
|
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) );
|
||||||
|
|
||||||
|
var vTable = new Callback.VTable
|
||||||
|
{
|
||||||
|
ResultA = onResultThis,
|
||||||
|
ResultB = onResultWithInfoThis,
|
||||||
|
GetSize = onGetSizeThis,
|
||||||
|
};
|
||||||
|
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
||||||
|
|
||||||
|
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
||||||
|
|
||||||
|
return vTablePtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
42
Facepunch.Steamworks/Callbacks/Callback.VTableThis.cs
Normal file
42
Facepunch.Steamworks/Callbacks/Callback.VTableThis.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Steamworks
|
||||||
|
{
|
||||||
|
internal partial class Callback
|
||||||
|
{
|
||||||
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
|
public class VTableThis
|
||||||
|
{
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
|
||||||
|
|
||||||
|
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
||||||
|
{
|
||||||
|
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) );
|
||||||
|
|
||||||
|
var vTable = new Callback.VTableThis
|
||||||
|
{
|
||||||
|
ResultA = onResultThis,
|
||||||
|
ResultB = onResultWithInfoThis,
|
||||||
|
GetSize = onGetSizeThis,
|
||||||
|
};
|
||||||
|
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
||||||
|
|
||||||
|
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
||||||
|
|
||||||
|
return vTablePtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr );
|
||||||
|
|
||||||
|
public ResultD ResultA;
|
||||||
|
public ResultWithInfoD ResultB;
|
||||||
|
public GetSizeD GetSize;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
41
Facepunch.Steamworks/Callbacks/Callback.VTableWin.cs
Normal file
41
Facepunch.Steamworks/Callbacks/Callback.VTableWin.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Steamworks
|
||||||
|
{
|
||||||
|
internal partial class Callback
|
||||||
|
{
|
||||||
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
|
public class VTableWin
|
||||||
|
{
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD();
|
||||||
|
|
||||||
|
public ResultWithInfoD ResultB;
|
||||||
|
public ResultD ResultA;
|
||||||
|
public GetSizeD GetSize;
|
||||||
|
|
||||||
|
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
||||||
|
{
|
||||||
|
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) );
|
||||||
|
|
||||||
|
var vTable = new Callback.VTableWin
|
||||||
|
{
|
||||||
|
ResultA = onResultThis,
|
||||||
|
ResultB = onResultWithInfoThis,
|
||||||
|
GetSize = onGetSizeThis,
|
||||||
|
};
|
||||||
|
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
||||||
|
|
||||||
|
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
||||||
|
|
||||||
|
return vTablePtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
41
Facepunch.Steamworks/Callbacks/Callback.VTableWinThis.cs
Normal file
41
Facepunch.Steamworks/Callbacks/Callback.VTableWinThis.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Steamworks
|
||||||
|
{
|
||||||
|
internal partial class Callback
|
||||||
|
{
|
||||||
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
|
public class VTableWinThis
|
||||||
|
{
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall );
|
||||||
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr );
|
||||||
|
|
||||||
|
public ResultWithInfoD ResultB;
|
||||||
|
public ResultD ResultA;
|
||||||
|
public GetSizeD GetSize;
|
||||||
|
|
||||||
|
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
||||||
|
{
|
||||||
|
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) );
|
||||||
|
|
||||||
|
var vTable = new Callback.VTableWinThis
|
||||||
|
{
|
||||||
|
ResultA = onResultThis,
|
||||||
|
ResultB = onResultWithInfoThis,
|
||||||
|
GetSize = onGetSizeThis,
|
||||||
|
};
|
||||||
|
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
||||||
|
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
||||||
|
|
||||||
|
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
||||||
|
|
||||||
|
return vTablePtr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
20
Facepunch.Steamworks/Callbacks/Callback.cs
Normal file
20
Facepunch.Steamworks/Callbacks/Callback.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Steamworks
|
||||||
|
{
|
||||||
|
[StructLayout( LayoutKind.Sequential )]
|
||||||
|
internal partial class Callback
|
||||||
|
{
|
||||||
|
internal enum Flags : byte
|
||||||
|
{
|
||||||
|
Registered = 0x01,
|
||||||
|
GameServer = 0x02
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntPtr vTablePtr;
|
||||||
|
public byte CallbackFlags;
|
||||||
|
public int CallbackId;
|
||||||
|
};
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
@ -61,15 +60,14 @@ internal Event( Action<T> onresult, bool gameserver = false )
|
|||||||
//
|
//
|
||||||
// Create the functions we need for the vtable
|
// Create the functions we need for the vtable
|
||||||
//
|
//
|
||||||
if ( Facepunch.Steamworks.Config.UseThisCall )
|
if ( Config.UseThisCall )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Create the VTable by manually allocating the memory and copying across
|
// Create the VTable by manually allocating the memory and copying across
|
||||||
//
|
//
|
||||||
if ( Platform.IsWindows )
|
if ( Config.Os == OsType.Windows )
|
||||||
{
|
{
|
||||||
vTablePtr = Callback.VTableWinThis.GetVTable( OnResultThis, OnResultWithInfoThis, OnGetSizeThis, Allocations );
|
vTablePtr = Callback.VTableWinThis.GetVTable( OnResultThis, OnResultWithInfoThis, OnGetSizeThis, Allocations );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -81,7 +79,7 @@ internal Event( Action<T> onresult, bool gameserver = false )
|
|||||||
//
|
//
|
||||||
// Create the VTable by manually allocating the memory and copying across
|
// Create the VTable by manually allocating the memory and copying across
|
||||||
//
|
//
|
||||||
if ( Platform.IsWindows )
|
if ( Config.Os == OsType.Windows )
|
||||||
{
|
{
|
||||||
vTablePtr = Callback.VTableWin.GetVTable( OnResult, OnResultWithInfo, OnGetSize, Allocations );
|
vTablePtr = Callback.VTableWin.GetVTable( OnResult, OnResultWithInfo, OnGetSize, Allocations );
|
||||||
}
|
}
|
||||||
@ -111,13 +109,13 @@ internal Event( Action<T> onresult, bool gameserver = false )
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallback] internal void OnResultThis( IntPtr self, IntPtr param ) => OnResult( param );
|
[MonoPInvokeCallback] internal void OnResultThis( IntPtr self, IntPtr param ) => OnResult( param );
|
||||||
[MonoPInvokeCallback] internal void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) => OnResultWithInfo( param, failure, call );
|
[MonoPInvokeCallback] internal void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamAPICall_t call ) => OnResultWithInfo( param, failure, call );
|
||||||
[MonoPInvokeCallback] internal int OnGetSizeThis( IntPtr self ) => OnGetSize();
|
[MonoPInvokeCallback] internal int OnGetSizeThis( IntPtr self ) => OnGetSize();
|
||||||
[MonoPInvokeCallback] internal int OnGetSize() => template.GetStructSize();
|
[MonoPInvokeCallback] internal int OnGetSize() => template.GetStructSize();
|
||||||
[MonoPInvokeCallback] internal void OnResult( IntPtr param ) => OnResultWithInfo( param, false, 0 );
|
[MonoPInvokeCallback] internal void OnResult( IntPtr param ) => OnResultWithInfo( param, false, 0 );
|
||||||
|
|
||||||
[MonoPInvokeCallback]
|
[MonoPInvokeCallback]
|
||||||
internal void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call )
|
internal void OnResultWithInfo( IntPtr param, bool failure, SteamAPICall_t call )
|
||||||
{
|
{
|
||||||
if ( failure ) return;
|
if ( failure ) return;
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
|
@ -1,283 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Client : BaseSteamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A singleton accessor to get the current client instance.
|
|
||||||
/// </summary>
|
|
||||||
public static Client Instance { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Current user's Username
|
|
||||||
/// </summary>
|
|
||||||
public string Username { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Current user's SteamId
|
|
||||||
/// </summary>
|
|
||||||
public ulong SteamId { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If we're sharing this game, this is the owner of it.
|
|
||||||
/// </summary>
|
|
||||||
public ulong OwnerSteamId { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Current Beta name, if we're using a beta branch.
|
|
||||||
/// </summary>
|
|
||||||
public string BetaName { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The BuildId of the current build
|
|
||||||
/// </summary>
|
|
||||||
public int BuildId { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The folder in which this app is installed
|
|
||||||
/// </summary>
|
|
||||||
public DirectoryInfo InstallFolder { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The 2 digit ISO 3166-1-alpha-2 format country code (e.g. "US" or "UK")
|
|
||||||
/// </summary>
|
|
||||||
public string CurrentCountry { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The currently selected language
|
|
||||||
/// </summary>
|
|
||||||
public string CurrentLanguage { get; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of languages available to the game
|
|
||||||
/// </summary>
|
|
||||||
public string[] AvailableLanguages { get; }
|
|
||||||
|
|
||||||
public ServerList ServerList { get; private set; }
|
|
||||||
public LobbyList LobbyList { get; private set; }
|
|
||||||
public Achievements Achievements { get; private set; }
|
|
||||||
public Stats Stats { get; private set; }
|
|
||||||
public MicroTransactions MicroTransactions { get; private set; }
|
|
||||||
public RemoteStorage RemoteStorage { get; private set; }
|
|
||||||
|
|
||||||
public Client( uint appId ) : base( appId )
|
|
||||||
{
|
|
||||||
if ( Instance != null )
|
|
||||||
{
|
|
||||||
throw new System.Exception( "Only one Facepunch.Steamworks.Client can exist - dispose the old one before trying to create a new one." );
|
|
||||||
}
|
|
||||||
|
|
||||||
Instance = this;
|
|
||||||
native = new Interop.NativeInterface();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get other interfaces
|
|
||||||
//
|
|
||||||
if ( !native.InitClient( this ) )
|
|
||||||
{
|
|
||||||
native.Dispose();
|
|
||||||
native = null;
|
|
||||||
Instance = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Register Callbacks
|
|
||||||
//
|
|
||||||
|
|
||||||
SteamNative.Callbacks.RegisterCallbacks( this );
|
|
||||||
|
|
||||||
//
|
|
||||||
// Setup interfaces that client and server both have
|
|
||||||
//
|
|
||||||
SetupCommonInterfaces();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Client only interfaces
|
|
||||||
//
|
|
||||||
ServerList = new ServerList( this );
|
|
||||||
LobbyList = new LobbyList(this);
|
|
||||||
Stats = new Stats( this );
|
|
||||||
Achievements = new Achievements( this );
|
|
||||||
MicroTransactions = new MicroTransactions( this );
|
|
||||||
RemoteStorage = new RemoteStorage( this );
|
|
||||||
|
|
||||||
Stats.UpdateStats();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cache common, unchanging info
|
|
||||||
//
|
|
||||||
AppId = appId;
|
|
||||||
Username = native.friends.GetPersonaName();
|
|
||||||
SteamId = native.user.GetSteamID();
|
|
||||||
BetaName = native.apps.GetCurrentBetaName();
|
|
||||||
OwnerSteamId = native.apps.GetAppOwner();
|
|
||||||
var appInstallDir = native.apps.GetAppInstallDir(AppId);
|
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(appInstallDir) && Directory.Exists(appInstallDir))
|
|
||||||
InstallFolder = new DirectoryInfo(appInstallDir);
|
|
||||||
|
|
||||||
BuildId = native.apps.GetAppBuildId();
|
|
||||||
CurrentCountry = native.utils.GetIPCountry();
|
|
||||||
CurrentLanguage = native.apps.GetCurrentGameLanguage();
|
|
||||||
AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated
|
|
||||||
|
|
||||||
//
|
|
||||||
// Run update, first call does some initialization
|
|
||||||
//
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
~Client()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Should be called at least once every frame
|
|
||||||
/// </summary>
|
|
||||||
public override void Update()
|
|
||||||
{
|
|
||||||
if ( !IsValid )
|
|
||||||
return;
|
|
||||||
|
|
||||||
RunCallbacks();
|
|
||||||
base.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This is called in Update() - there's no need to call it manually unless you're running your own Update
|
|
||||||
/// </summary>
|
|
||||||
public void RunCallbacks()
|
|
||||||
{
|
|
||||||
native.api.SteamAPI_RunCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Call when finished to shut down the Steam client.
|
|
||||||
/// </summary>
|
|
||||||
public override void Dispose()
|
|
||||||
{
|
|
||||||
if ( disposed ) return;
|
|
||||||
|
|
||||||
if ( ServerList != null )
|
|
||||||
{
|
|
||||||
ServerList.Dispose();
|
|
||||||
ServerList = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LobbyList != null)
|
|
||||||
{
|
|
||||||
LobbyList.Dispose();
|
|
||||||
LobbyList = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Stats != null )
|
|
||||||
{
|
|
||||||
Stats.Dispose();
|
|
||||||
Stats = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Achievements != null )
|
|
||||||
{
|
|
||||||
Achievements.Dispose();
|
|
||||||
Achievements = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( MicroTransactions != null )
|
|
||||||
{
|
|
||||||
MicroTransactions.Dispose();
|
|
||||||
MicroTransactions = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( RemoteStorage != null )
|
|
||||||
{
|
|
||||||
RemoteStorage.Dispose();
|
|
||||||
RemoteStorage = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Instance == this )
|
|
||||||
{
|
|
||||||
Instance = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
base.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum LeaderboardSortMethod
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Ascending = 1, // top-score is lowest number
|
|
||||||
Descending = 2, // top-score is highest number
|
|
||||||
};
|
|
||||||
|
|
||||||
// the display type (used by the Steam Community web site) for a leaderboard
|
|
||||||
public enum LeaderboardDisplayType
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Numeric = 1, // simple numerical score
|
|
||||||
TimeSeconds = 2, // the score represents a time, in seconds
|
|
||||||
TimeMilliSeconds = 3, // the score represents a time, in milliseconds
|
|
||||||
};
|
|
||||||
|
|
||||||
public Leaderboard GetLeaderboard( string name, LeaderboardSortMethod sortMethod = LeaderboardSortMethod.None, LeaderboardDisplayType displayType = LeaderboardDisplayType.None )
|
|
||||||
{
|
|
||||||
var board = new Leaderboard( this );
|
|
||||||
native.userstats.FindOrCreateLeaderboard( name, (SteamNative.LeaderboardSortMethod)sortMethod, (SteamNative.LeaderboardDisplayType)displayType, board.OnBoardCreated );
|
|
||||||
return board;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks if the current user's Steam client is connected and logged on to the Steam servers.
|
|
||||||
/// If it's not then no real-time services provided by the Steamworks API will be enabled.
|
|
||||||
/// The Steam client will automatically be trying to recreate the connection as often as possible.
|
|
||||||
/// All of the API calls that rely on this will check internally.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsLoggedOn => native.user.BLoggedOn();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if we're subscribed/authorised to be running this app
|
|
||||||
/// </summary>
|
|
||||||
public bool IsSubscribed => native.apps.BIsSubscribed();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if we're a cybercafe account
|
|
||||||
/// </summary>
|
|
||||||
public bool IsCybercafe => native.apps.BIsCybercafe();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if we're subscribed/authorised to be running this app, but only temporarily
|
|
||||||
/// due to a free weekend etc.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsSubscribedFromFreeWeekend => native.apps.BIsSubscribedFromFreeWeekend();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if we're in low violence mode (germans are only allowed to see the insides of bodies in porn)
|
|
||||||
/// </summary>
|
|
||||||
public bool IsLowViolence => native.apps.BIsLowViolence();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.
|
|
||||||
/// If this returns true then it starts the Steam client if required and launches your game again through it,
|
|
||||||
/// and you should quit your process as soon as possible. This effectively runs steam://run/AppId so it may
|
|
||||||
/// not relaunch the exact executable that called it, as it will always relaunch from the version installed
|
|
||||||
/// in your Steam library folder.
|
|
||||||
/// If it returns false, then your game was launched by the Steam client and no action needs to be taken.
|
|
||||||
/// One exception is if a steam_appid.txt file is present then this will return false regardless. This allows
|
|
||||||
/// you to develop and test without launching your game through the Steam client. Make sure to remove the
|
|
||||||
/// steam_appid.txt file when uploading the game to your Steam depot!
|
|
||||||
/// </summary>
|
|
||||||
public static bool RestartIfNecessary( uint appid )
|
|
||||||
{
|
|
||||||
using ( var api = new SteamNative.SteamApi() )
|
|
||||||
{
|
|
||||||
return api.SteamAPI_RestartAppIfNecessary( appid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,263 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public class Achievements : IDisposable
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
public Achievement[] All { get; private set; }
|
|
||||||
|
|
||||||
public event Action OnUpdated;
|
|
||||||
public event Action<Achievement> OnAchievementStateChanged;
|
|
||||||
|
|
||||||
private List<Achievement> unlockedRecently = new List<Achievement>();
|
|
||||||
|
|
||||||
internal Achievements( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
|
|
||||||
All = new Achievement[0];
|
|
||||||
c.RegisterCallback<UserStatsReceived_t>( UserStatsReceived );
|
|
||||||
c.RegisterCallback<UserStatsStored_t>( UserStatsStored );
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Refresh()
|
|
||||||
{
|
|
||||||
var old = All;
|
|
||||||
|
|
||||||
All = Enumerable.Range( 0, (int)client.native.userstats.GetNumAchievements() )
|
|
||||||
.Select( x =>
|
|
||||||
{
|
|
||||||
if ( old != null )
|
|
||||||
{
|
|
||||||
var name = client.native.userstats.GetAchievementName( (uint)x );
|
|
||||||
var found = old.FirstOrDefault( y => y.Id == name );
|
|
||||||
if ( found != null )
|
|
||||||
{
|
|
||||||
if ( found.Refresh() )
|
|
||||||
{
|
|
||||||
unlockedRecently.Add( found );
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Achievement( client, x );
|
|
||||||
} )
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
foreach ( var i in unlockedRecently )
|
|
||||||
{
|
|
||||||
OnUnlocked( i );
|
|
||||||
}
|
|
||||||
|
|
||||||
unlockedRecently.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnUnlocked( Achievement a )
|
|
||||||
{
|
|
||||||
OnAchievementStateChanged?.Invoke( a );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Find an achievement by name. Will be null if not found, or not ready.
|
|
||||||
/// </summary>
|
|
||||||
public Achievement Find( string identifier )
|
|
||||||
{
|
|
||||||
return All.FirstOrDefault( x => x.Id == identifier );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unlock an achievement by identifier. If apply is true this will happen as expected
|
|
||||||
/// and the achievement overlay will popup etc. If it's false then you'll have to manually
|
|
||||||
/// call Stats.StoreStats() to actually trigger it.
|
|
||||||
/// </summary>
|
|
||||||
public bool Trigger( string identifier, bool apply = true )
|
|
||||||
{
|
|
||||||
var a = Find( identifier );
|
|
||||||
if ( a == null ) return false;
|
|
||||||
|
|
||||||
return a.Trigger( apply );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reset an achievement by identifier
|
|
||||||
/// </summary>
|
|
||||||
public bool Reset( string identifier )
|
|
||||||
{
|
|
||||||
return client.native.userstats.ClearAchievement( identifier );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UserStatsReceived( UserStatsReceived_t stats )
|
|
||||||
{
|
|
||||||
if ( stats.GameID != client.AppId ) return;
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
|
|
||||||
OnUpdated?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UserStatsStored( UserStatsStored_t stats )
|
|
||||||
{
|
|
||||||
if ( stats.GameID != client.AppId ) return;
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
|
|
||||||
OnUpdated?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Achievement
|
|
||||||
{
|
|
||||||
private Client client;
|
|
||||||
|
|
||||||
public string Id { get; private set; }
|
|
||||||
public string Name { get; private set; }
|
|
||||||
public string Description { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if unlocked
|
|
||||||
/// </summary>
|
|
||||||
public bool State { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Should hold the unlock time if State is true
|
|
||||||
/// </summary>
|
|
||||||
public DateTime UnlockTime { get; private set; }
|
|
||||||
|
|
||||||
private int iconId { get; set; } = -1;
|
|
||||||
private int refreshCount = 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the percentage of users who have unlocked the specified achievement, or -1 if no data available.
|
|
||||||
/// </summary>
|
|
||||||
public float GlobalUnlockedPercentage
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( State )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
float pct = 0;
|
|
||||||
|
|
||||||
if ( !client.native.userstats.GetAchievementAchievedPercent( Id, out pct ) )
|
|
||||||
return -1.0f;
|
|
||||||
|
|
||||||
return pct;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Image _icon;
|
|
||||||
|
|
||||||
public Image Icon
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( iconId <= 0 ) return null;
|
|
||||||
|
|
||||||
if ( _icon == null )
|
|
||||||
{
|
|
||||||
_icon = new Image();
|
|
||||||
_icon.Id = iconId;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( _icon.IsLoaded )
|
|
||||||
return _icon;
|
|
||||||
|
|
||||||
if ( !_icon.TryLoad( client.native.utils ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return _icon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Achievement( Client client, int index )
|
|
||||||
{
|
|
||||||
this.client = client;
|
|
||||||
|
|
||||||
Id = client.native.userstats.GetAchievementName( (uint) index );
|
|
||||||
Name = client.native.userstats.GetAchievementDisplayAttribute( Id, "name" );
|
|
||||||
Description = client.native.userstats.GetAchievementDisplayAttribute( Id, "desc" );
|
|
||||||
|
|
||||||
iconId = client.native.userstats.GetAchievementIcon( Id );
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Make this achievement earned
|
|
||||||
/// </summary>
|
|
||||||
public bool Trigger( bool apply = true )
|
|
||||||
{
|
|
||||||
if ( State )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
State = true;
|
|
||||||
UnlockTime = DateTime.Now;
|
|
||||||
|
|
||||||
var r = client.native.userstats.SetAchievement( Id );
|
|
||||||
|
|
||||||
if ( apply )
|
|
||||||
{
|
|
||||||
client.Stats.StoreStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
client.Achievements.OnUnlocked( this );
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reset this achievement to not achieved
|
|
||||||
/// </summary>
|
|
||||||
public bool Reset()
|
|
||||||
{
|
|
||||||
State = false;
|
|
||||||
UnlockTime = DateTime.Now;
|
|
||||||
|
|
||||||
return client.native.userstats.ClearAchievement( Id );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Refresh the unlock state. You shouldn't need to call this manually
|
|
||||||
/// but it's here if you have to for some reason. Retuns true if state changed (meaning, probably unlocked)
|
|
||||||
/// </summary>
|
|
||||||
public bool Refresh()
|
|
||||||
{
|
|
||||||
bool previousState = State;
|
|
||||||
|
|
||||||
bool state = false;
|
|
||||||
uint unlockTime;
|
|
||||||
|
|
||||||
State = false;
|
|
||||||
|
|
||||||
if ( client.native.userstats.GetAchievementAndUnlockTime( Id, ref state, out unlockTime ) )
|
|
||||||
{
|
|
||||||
State = state;
|
|
||||||
UnlockTime = Utility.Epoch.ToDateTime( unlockTime );
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshCount++;
|
|
||||||
|
|
||||||
if ( previousState != State && refreshCount > 1 )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public class Image
|
|
||||||
{
|
|
||||||
public int Id { get; internal set; }
|
|
||||||
public int Width { get; internal set; }
|
|
||||||
public int Height { get; internal set; }
|
|
||||||
|
|
||||||
public byte[] Data { get; internal set; }
|
|
||||||
|
|
||||||
public bool IsLoaded { get; internal set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true if this image couldn't be loaded for some reason
|
|
||||||
/// </summary>
|
|
||||||
public bool IsError { get; internal set; }
|
|
||||||
|
|
||||||
unsafe internal bool TryLoad( SteamNative.SteamUtils utils )
|
|
||||||
{
|
|
||||||
if ( IsLoaded ) return true;
|
|
||||||
|
|
||||||
uint width = 0, height = 0;
|
|
||||||
|
|
||||||
if ( utils.GetImageSize( Id, out width, out height ) == false )
|
|
||||||
{
|
|
||||||
IsError = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var buffer = new byte[ width * height * 4 ];
|
|
||||||
|
|
||||||
fixed ( byte* ptr = buffer )
|
|
||||||
{
|
|
||||||
if ( utils.GetImageRGBA( Id, (IntPtr) ptr, buffer.Length ) == false )
|
|
||||||
{
|
|
||||||
IsError = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Width = (int) width;
|
|
||||||
Height = (int) height;
|
|
||||||
Data = buffer;
|
|
||||||
IsLoaded = true;
|
|
||||||
IsError = false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color GetPixel( int x, int y )
|
|
||||||
{
|
|
||||||
if ( !IsLoaded ) throw new System.Exception( "Image not loaded" );
|
|
||||||
if ( x < 0 || x >= Width ) throw new System.Exception( "x out of bounds" );
|
|
||||||
if ( y < 0 || y >= Height ) throw new System.Exception( "y out of bounds" );
|
|
||||||
|
|
||||||
Color c = new Color();
|
|
||||||
|
|
||||||
var i = ( y * Width + x ) * 4;
|
|
||||||
|
|
||||||
c.r = Data[i + 0];
|
|
||||||
c.g = Data[i + 1];
|
|
||||||
c.b = Data[i + 2];
|
|
||||||
c.a = Data[i + 3];
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct Color
|
|
||||||
{
|
|
||||||
public byte r, g, b, a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,390 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Facepunch.Steamworks.Callbacks;
|
|
||||||
using SteamNative;
|
|
||||||
using Result = SteamNative.Result;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public class Leaderboard : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Type of leaderboard request
|
|
||||||
/// </summary>
|
|
||||||
public enum RequestType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Query everyone and everything
|
|
||||||
/// </summary>
|
|
||||||
Global = LeaderboardDataRequest.Global,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Query entries near to this user's rank
|
|
||||||
/// </summary>
|
|
||||||
GlobalAroundUser = LeaderboardDataRequest.GlobalAroundUser,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only show friends of this user
|
|
||||||
/// </summary>
|
|
||||||
Friends = LeaderboardDataRequest.Friends
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly int[] subEntriesBuffer = new int[512];
|
|
||||||
|
|
||||||
internal ulong BoardId;
|
|
||||||
public ulong GetBoardId()
|
|
||||||
{
|
|
||||||
return BoardId;
|
|
||||||
}
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
private readonly Queue<Action> _onCreated = new Queue<Action>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The results from the last query. Can be null.
|
|
||||||
/// </summary>
|
|
||||||
public Entry[] Results;
|
|
||||||
|
|
||||||
internal Leaderboard( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The name of this board, as retrieved from Steam
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The total number of entries on this board
|
|
||||||
/// </summary>
|
|
||||||
public int TotalEntries { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if this board is valid, ie, we've received
|
|
||||||
/// a positive response from Steam about it.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsValid => BoardId != 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if we asked steam about this board but it returned
|
|
||||||
/// an error.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsError { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if we're querying scores
|
|
||||||
/// </summary>
|
|
||||||
public bool IsQuerying { get; private set; }
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DispatchOnCreatedCallbacks()
|
|
||||||
{
|
|
||||||
while ( _onCreated.Count > 0 )
|
|
||||||
{
|
|
||||||
_onCreated.Dequeue()();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool DeferOnCreated( Action onValid, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
if ( IsValid || IsError ) return false;
|
|
||||||
|
|
||||||
_onCreated.Enqueue( () =>
|
|
||||||
{
|
|
||||||
if ( IsValid ) onValid();
|
|
||||||
else onFailure?.Invoke( Callbacks.Result.Fail );
|
|
||||||
} );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the leaderboard information is successfully recieved from Steam
|
|
||||||
/// </summary>
|
|
||||||
public Action OnBoardInformation;
|
|
||||||
|
|
||||||
internal void OnBoardCreated( LeaderboardFindResult_t result, bool error )
|
|
||||||
{
|
|
||||||
Console.WriteLine( $"result.LeaderboardFound: {result.LeaderboardFound}" );
|
|
||||||
Console.WriteLine( $"result.SteamLeaderboard: {result.SteamLeaderboard}" );
|
|
||||||
|
|
||||||
if ( error || ( result.LeaderboardFound == 0 ) )
|
|
||||||
{
|
|
||||||
IsError = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BoardId = result.SteamLeaderboard;
|
|
||||||
|
|
||||||
if ( IsValid )
|
|
||||||
{
|
|
||||||
Name = client.native.userstats.GetLeaderboardName( BoardId );
|
|
||||||
TotalEntries = client.native.userstats.GetLeaderboardEntryCount( BoardId );
|
|
||||||
|
|
||||||
OnBoardInformation?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DispatchOnCreatedCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add a score to this leaderboard.
|
|
||||||
/// Subscores are totally optional, and can be used for other game defined data such as laps etc.. although
|
|
||||||
/// they have no bearing on sorting at all
|
|
||||||
/// If onlyIfBeatsOldScore is true, the score will only be updated if it beats the existing score, else it will always
|
|
||||||
/// be updated. Beating the existing score is subjective - and depends on how your leaderboard was set up as to whether
|
|
||||||
/// that means higher or lower.
|
|
||||||
/// </summary>
|
|
||||||
public bool AddScore( bool onlyIfBeatsOldScore, int score, params int[] subscores )
|
|
||||||
{
|
|
||||||
if ( IsError ) return false;
|
|
||||||
if ( !IsValid ) return DeferOnCreated( () => AddScore( onlyIfBeatsOldScore, score, subscores ) );
|
|
||||||
|
|
||||||
var flags = LeaderboardUploadScoreMethod.ForceUpdate;
|
|
||||||
if ( onlyIfBeatsOldScore ) flags = LeaderboardUploadScoreMethod.KeepBest;
|
|
||||||
|
|
||||||
client.native.userstats.UploadLeaderboardScore( BoardId, flags, score, subscores, subscores.Length );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback invoked by <see cref="AddScore(bool, int, int[], AddScoreCallback, FailureCallback)"/> when score submission
|
|
||||||
/// is complete.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="result">If successful, information about the new entry</param>
|
|
||||||
public delegate void AddScoreCallback( AddScoreResult result );
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Information about a newly submitted score.
|
|
||||||
/// </summary>
|
|
||||||
public struct AddScoreResult
|
|
||||||
{
|
|
||||||
public int Score;
|
|
||||||
public bool ScoreChanged;
|
|
||||||
public int GlobalRankNew;
|
|
||||||
public int GlobalRankPrevious;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add a score to this leaderboard.
|
|
||||||
/// Subscores are totally optional, and can be used for other game defined data such as laps etc.. although
|
|
||||||
/// they have no bearing on sorting at all
|
|
||||||
/// If onlyIfBeatsOldScore is true, the score will only be updated if it beats the existing score, else it will always
|
|
||||||
/// be updated.
|
|
||||||
/// Information about the newly submitted score is passed to the optional <paramref name="onSuccess"/>.
|
|
||||||
/// </summary>
|
|
||||||
public bool AddScore( bool onlyIfBeatsOldScore, int score, int[] subscores = null, AddScoreCallback onSuccess = null, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
if ( IsError ) return false;
|
|
||||||
if ( !IsValid ) return DeferOnCreated( () => AddScore( onlyIfBeatsOldScore, score, subscores, onSuccess, onFailure ), onFailure );
|
|
||||||
|
|
||||||
if ( subscores == null ) subscores = new int[0];
|
|
||||||
|
|
||||||
var flags = LeaderboardUploadScoreMethod.ForceUpdate;
|
|
||||||
if ( onlyIfBeatsOldScore ) flags = LeaderboardUploadScoreMethod.KeepBest;
|
|
||||||
|
|
||||||
client.native.userstats.UploadLeaderboardScore( BoardId, flags, score, subscores, subscores.Length, ( result, error ) =>
|
|
||||||
{
|
|
||||||
if ( !error && result.Success != 0 )
|
|
||||||
{
|
|
||||||
onSuccess?.Invoke( new AddScoreResult
|
|
||||||
{
|
|
||||||
Score = result.Score,
|
|
||||||
ScoreChanged = result.ScoreChanged != 0,
|
|
||||||
GlobalRankNew = result.GlobalRankNew,
|
|
||||||
GlobalRankPrevious = result.GlobalRankPrevious
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onFailure?.Invoke( error ? Callbacks.Result.IOFailure : Callbacks.Result.Fail );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback invoked by <see cref="Leaderboard.AttachRemoteFile"/> when file attachment is complete.
|
|
||||||
/// </summary>
|
|
||||||
public delegate void AttachRemoteFileCallback();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempt to attach a <see cref="RemoteStorage"/> file to the current user's leaderboard entry.
|
|
||||||
/// Can be useful for storing replays along with scores.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the file attachment process has started</returns>
|
|
||||||
public bool AttachRemoteFile( RemoteFile file, AttachRemoteFileCallback onSuccess = null, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
if ( IsError ) return false;
|
|
||||||
if ( !IsValid ) return DeferOnCreated( () => AttachRemoteFile( file, onSuccess, onFailure ), onFailure );
|
|
||||||
|
|
||||||
if ( file.IsShared )
|
|
||||||
{
|
|
||||||
var handle = client.native.userstats.AttachLeaderboardUGC( BoardId, file.UGCHandle, ( result, error ) =>
|
|
||||||
{
|
|
||||||
if ( !error && result.Result == Result.OK )
|
|
||||||
{
|
|
||||||
onSuccess?.Invoke();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onFailure?.Invoke( result.Result == 0 ? Callbacks.Result.IOFailure : (Callbacks.Result) result.Result );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
return handle.IsValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
file.Share( () =>
|
|
||||||
{
|
|
||||||
if ( !file.IsShared || !AttachRemoteFile( file, onSuccess, onFailure ) )
|
|
||||||
{
|
|
||||||
onFailure?.Invoke( Callbacks.Result.Fail );
|
|
||||||
}
|
|
||||||
}, onFailure );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fetch a subset of scores. The scores end up in Results.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Returns true if we have started the query</returns>
|
|
||||||
public bool FetchScores( RequestType RequestType, int start, int end )
|
|
||||||
{
|
|
||||||
if ( !IsValid ) return false;
|
|
||||||
if ( IsQuerying ) return false;
|
|
||||||
|
|
||||||
client.native.userstats.DownloadLeaderboardEntries( BoardId, (LeaderboardDataRequest) RequestType, start, end, OnScores );
|
|
||||||
|
|
||||||
Results = null;
|
|
||||||
IsQuerying = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void ReadScores( LeaderboardScoresDownloaded_t result, List<Entry> dest )
|
|
||||||
{
|
|
||||||
for ( var i = 0; i < result.CEntryCount; i++ )
|
|
||||||
fixed ( int* ptr = subEntriesBuffer )
|
|
||||||
{
|
|
||||||
var entry = new LeaderboardEntry_t();
|
|
||||||
if ( client.native.userstats.GetDownloadedLeaderboardEntry( result.SteamLeaderboardEntries, i, ref entry, (IntPtr) ptr, subEntriesBuffer.Length ) )
|
|
||||||
dest.Add( new Entry
|
|
||||||
{
|
|
||||||
GlobalRank = entry.GlobalRank,
|
|
||||||
Score = entry.Score,
|
|
||||||
SteamId = entry.SteamIDUser,
|
|
||||||
SubScores = entry.CDetails == 0 ? null : subEntriesBuffer.Take( entry.CDetails ).ToArray(),
|
|
||||||
// Name = client.Friends.GetName( entry.SteamIDUser ),
|
|
||||||
AttachedFile = (entry.UGC >> 32) == 0xffffffff ? null : new RemoteFile( client.RemoteStorage, entry.UGC )
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[ThreadStatic] private static List<Entry> _sEntryBuffer;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback invoked by <see cref="FetchScores(RequestType, int, int, FetchScoresCallback, FailureCallback)"/> when
|
|
||||||
/// a query is complete.
|
|
||||||
/// </summary>
|
|
||||||
public delegate void FetchScoresCallback( Entry[] results );
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fetch a subset of scores. The scores are passed to <paramref name="onSuccess"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Returns true if we have started the query</returns>
|
|
||||||
public bool FetchScores( RequestType RequestType, int start, int end, FetchScoresCallback onSuccess, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
if ( IsError ) return false;
|
|
||||||
if ( !IsValid ) return DeferOnCreated( () => FetchScores( RequestType, start, end, onSuccess, onFailure ), onFailure );
|
|
||||||
|
|
||||||
client.native.userstats.DownloadLeaderboardEntries( BoardId, (LeaderboardDataRequest) RequestType, start, end, ( result, error ) =>
|
|
||||||
{
|
|
||||||
if ( error )
|
|
||||||
{
|
|
||||||
onFailure?.Invoke( Callbacks.Result.IOFailure );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( _sEntryBuffer == null ) _sEntryBuffer = new List<Entry>();
|
|
||||||
else _sEntryBuffer.Clear();
|
|
||||||
|
|
||||||
ReadScores( result, _sEntryBuffer );
|
|
||||||
onSuccess( _sEntryBuffer.ToArray() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe bool FetchUsersScores( RequestType RequestType, UInt64[] steamIds, FetchScoresCallback onSuccess, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( IsError ) return false;
|
|
||||||
if ( !IsValid ) return DeferOnCreated( () => FetchUsersScores( RequestType, steamIds, onSuccess, onFailure ), onFailure );
|
|
||||||
|
|
||||||
fixed(ulong* pointer = steamIds){
|
|
||||||
|
|
||||||
client.native.userstats.DownloadLeaderboardEntriesForUsers(BoardId, (IntPtr)pointer, steamIds.Length, (result, error) =>
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
onFailure?.Invoke(Callbacks.Result.IOFailure);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_sEntryBuffer == null) _sEntryBuffer = new List<Entry>();
|
|
||||||
else _sEntryBuffer.Clear();
|
|
||||||
|
|
||||||
ReadScores(result, _sEntryBuffer);
|
|
||||||
onSuccess(_sEntryBuffer.ToArray());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnScores( LeaderboardScoresDownloaded_t result, bool error )
|
|
||||||
{
|
|
||||||
IsQuerying = false;
|
|
||||||
|
|
||||||
if ( client == null ) return;
|
|
||||||
if ( error ) return;
|
|
||||||
|
|
||||||
// Entry count may have changed
|
|
||||||
TotalEntries = client.native.userstats.GetLeaderboardEntryCount(BoardId);
|
|
||||||
|
|
||||||
var list = new List<Entry>();
|
|
||||||
ReadScores( result, list );
|
|
||||||
|
|
||||||
Results = list.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A single entry in a leaderboard
|
|
||||||
/// </summary>
|
|
||||||
public struct Entry
|
|
||||||
{
|
|
||||||
public ulong SteamId;
|
|
||||||
public int Score;
|
|
||||||
public int[] SubScores;
|
|
||||||
public int GlobalRank;
|
|
||||||
public RemoteFile AttachedFile;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Note that the player's name might not be immediately available.
|
|
||||||
/// If that's the case you'll have to use Friends.GetName to find the name
|
|
||||||
/// </summary>
|
|
||||||
public string Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Lobby
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class to hold global lobby data. This is stuff like maps/modes/etc. Data set here can be filtered by LobbyList.
|
|
||||||
/// </summary>
|
|
||||||
public class LobbyData
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
internal ulong lobby;
|
|
||||||
internal Dictionary<string, string> data;
|
|
||||||
|
|
||||||
public LobbyData( Client c, ulong l )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
lobby = l;
|
|
||||||
data = new Dictionary<string, string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the lobby value for the specific key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="k">The key to find</param>
|
|
||||||
/// <returns>The value at key</returns>
|
|
||||||
public string GetData( string k )
|
|
||||||
{
|
|
||||||
if ( data.ContainsKey( k ) )
|
|
||||||
{
|
|
||||||
return data[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
return "ERROR: key not found";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a list of all the data in the Lobby
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Dictionary of all the key/value pairs in the data</returns>
|
|
||||||
public Dictionary<string, string> GetAllData()
|
|
||||||
{
|
|
||||||
Dictionary<string, string> returnData = new Dictionary<string, string>();
|
|
||||||
foreach ( KeyValuePair<string, string> item in data )
|
|
||||||
{
|
|
||||||
returnData.Add( item.Key, item.Value );
|
|
||||||
}
|
|
||||||
return returnData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set the value for specified Key. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="k">The key to set the value for</param>
|
|
||||||
/// <param name="v">The value of the Key</param>
|
|
||||||
/// <returns>True if data successfully set</returns>
|
|
||||||
public bool SetData( string k, string v )
|
|
||||||
{
|
|
||||||
if ( data.ContainsKey( k ) )
|
|
||||||
{
|
|
||||||
if ( data[k] == v ) { return true; }
|
|
||||||
if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) )
|
|
||||||
{
|
|
||||||
data[k] = v;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) )
|
|
||||||
{
|
|
||||||
data.Add( k, v );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Remove the key from the LobbyData. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="k">The key to remove</param>
|
|
||||||
/// <returns>True if Key successfully removed</returns>
|
|
||||||
public bool RemoveData( string k )
|
|
||||||
{
|
|
||||||
if ( data.ContainsKey( k ) )
|
|
||||||
{
|
|
||||||
if ( client.native.matchmaking.DeleteLobbyData( lobby, k ) )
|
|
||||||
{
|
|
||||||
data.Remove( k );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*not implemented
|
|
||||||
|
|
||||||
//set the game server of the lobby
|
|
||||||
client.native.matchmaking.GetLobbyGameServer;
|
|
||||||
client.native.matchmaking.SetLobbyGameServer;
|
|
||||||
|
|
||||||
//used with game server stuff
|
|
||||||
SteamNative.LobbyGameCreated_t
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,599 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Client : IDisposable
|
|
||||||
{
|
|
||||||
Lobby _lobby;
|
|
||||||
|
|
||||||
public Lobby Lobby
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _lobby == null )
|
|
||||||
_lobby = new Steamworks.Lobby( this );
|
|
||||||
return _lobby;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public partial class Lobby : IDisposable
|
|
||||||
{
|
|
||||||
//The type of lobby you are creating
|
|
||||||
public enum Type : int
|
|
||||||
{
|
|
||||||
Private = SteamNative.LobbyType.Private,
|
|
||||||
FriendsOnly = SteamNative.LobbyType.FriendsOnly,
|
|
||||||
Public = SteamNative.LobbyType.Public,
|
|
||||||
Invisible = SteamNative.LobbyType.Invisible,
|
|
||||||
Error //happens if you try to get this when you aren't in a valid lobby
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
public Lobby( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
|
|
||||||
// For backwards compatibility
|
|
||||||
OnLobbyJoinRequested = Join;
|
|
||||||
|
|
||||||
client.RegisterCallback<SteamNative.LobbyDataUpdate_t>( OnLobbyDataUpdatedAPI );
|
|
||||||
client.RegisterCallback<SteamNative.LobbyChatMsg_t>( OnLobbyChatMessageRecievedAPI );
|
|
||||||
client.RegisterCallback<SteamNative.LobbyChatUpdate_t>( OnLobbyStateUpdatedAPI );
|
|
||||||
client.RegisterCallback<SteamNative.GameLobbyJoinRequested_t>( OnLobbyJoinRequestedAPI );
|
|
||||||
client.RegisterCallback<SteamNative.LobbyInvite_t>( OnUserInvitedToLobbyAPI );
|
|
||||||
client.RegisterCallback<SteamNative.PersonaStateChange_t>( OnLobbyMemberPersonaChangeAPI );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The CSteamID of the lobby we're currently in.
|
|
||||||
/// </summary>
|
|
||||||
public ulong CurrentLobby { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The LobbyData of the CurrentLobby. Note this is the global data for the lobby. Use SetMemberData to set specific member data.
|
|
||||||
/// </summary>
|
|
||||||
public LobbyData CurrentLobbyData { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if this lobby is valid, ie, we've succesffuly created and/or joined a lobby.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsValid => CurrentLobby != 0;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Join a Lobby through its LobbyID. OnLobbyJoined is called with the result of the Join attempt.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lobbyID">CSteamID of lobby to join</param>
|
|
||||||
public void Join( ulong lobbyID )
|
|
||||||
{
|
|
||||||
Leave();
|
|
||||||
client.native.matchmaking.JoinLobby( lobbyID, OnLobbyJoinedAPI );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLobbyJoinedAPI( LobbyEnter_t callback, bool error )
|
|
||||||
{
|
|
||||||
if ( error || (callback.EChatRoomEnterResponse != (uint)(SteamNative.ChatRoomEnterResponse.Success)) )
|
|
||||||
{
|
|
||||||
if ( OnLobbyJoined != null ) { OnLobbyJoined( false ); }
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentLobby = callback.SteamIDLobby;
|
|
||||||
UpdateLobbyData();
|
|
||||||
if ( OnLobbyJoined != null ) { OnLobbyJoined( true ); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a lobby has been attempted joined. Returns true if lobby was successfuly joined, false if not.
|
|
||||||
/// </summary>
|
|
||||||
public Action<bool> OnLobbyJoined;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a lobby and returns the created lobby. You auto join the created lobby. The lobby is stored in Client.Lobby.CurrentLobby if successful.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lobbyType">The Lobby.Type of Lobby to be created</param>
|
|
||||||
/// <param name="maxMembers">The maximum amount of people you want to be able to be in this lobby, including yourself</param>
|
|
||||||
public void Create( Lobby.Type lobbyType, int maxMembers )
|
|
||||||
{
|
|
||||||
client.native.matchmaking.CreateLobby( (SteamNative.LobbyType)lobbyType, maxMembers, OnLobbyCreatedAPI );
|
|
||||||
createdLobbyType = lobbyType;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Type createdLobbyType;
|
|
||||||
|
|
||||||
internal void OnLobbyCreatedAPI( LobbyCreated_t callback, bool error )
|
|
||||||
{
|
|
||||||
//from SpaceWarClient.cpp 793
|
|
||||||
if ( error || (callback.Result != Result.OK) )
|
|
||||||
{
|
|
||||||
if ( OnLobbyCreated != null ) { OnLobbyCreated( false ); }
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//set owner specific properties
|
|
||||||
Owner = client.SteamId;
|
|
||||||
CurrentLobby = callback.SteamIDLobby;
|
|
||||||
CurrentLobbyData = new LobbyData( client, CurrentLobby );
|
|
||||||
Name = client.Username + "'s Lobby";
|
|
||||||
CurrentLobbyData.SetData( "appid", client.AppId.ToString() );
|
|
||||||
LobbyType = createdLobbyType;
|
|
||||||
CurrentLobbyData.SetData( "lobbytype", LobbyType.ToString() );
|
|
||||||
Joinable = true;
|
|
||||||
if ( OnLobbyCreated != null ) { OnLobbyCreated( true ); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback for when lobby is created. Parameter resolves true when the Lobby was successfully created
|
|
||||||
/// </summary>
|
|
||||||
public Action<bool> OnLobbyCreated;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets user data for the Lobby. Things like Character, Skin, Ready, etc. Can only set your own member data
|
|
||||||
/// </summary>
|
|
||||||
public void SetMemberData( string key, string value )
|
|
||||||
{
|
|
||||||
if ( CurrentLobby == 0 ) { return; }
|
|
||||||
client.native.matchmaking.SetLobbyMemberData( CurrentLobby, key, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the per-user metadata from this lobby. Can get data from any user
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="steamID">ulong SteamID of the user you want to get data from</param>
|
|
||||||
/// <param name="key">String key of the type of data you want to get</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string GetMemberData( ulong steamID, string key )
|
|
||||||
{
|
|
||||||
if ( CurrentLobby == 0 ) { return "ERROR: NOT IN ANY LOBBY"; }
|
|
||||||
return client.native.matchmaking.GetLobbyMemberData( CurrentLobby, steamID, key );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnLobbyDataUpdatedAPI( LobbyDataUpdate_t callback )
|
|
||||||
{
|
|
||||||
if ( callback.SteamIDLobby != CurrentLobby ) return;
|
|
||||||
|
|
||||||
if ( callback.SteamIDLobby == CurrentLobby ) //actual lobby data was updated by owner
|
|
||||||
{
|
|
||||||
UpdateLobbyData();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( UserIsInCurrentLobby( callback.SteamIDMember ) ) //some member of this lobby updated their information
|
|
||||||
{
|
|
||||||
if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamIDMember ); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the LobbyData property to have the data for the current lobby, if any
|
|
||||||
/// </summary>
|
|
||||||
internal void UpdateLobbyData()
|
|
||||||
{
|
|
||||||
int dataCount = client.native.matchmaking.GetLobbyDataCount( CurrentLobby );
|
|
||||||
CurrentLobbyData = new LobbyData( client, CurrentLobby );
|
|
||||||
for ( int i = 0; i < dataCount; i++ )
|
|
||||||
{
|
|
||||||
if ( client.native.matchmaking.GetLobbyDataByIndex( CurrentLobby, i, out string key, out string value ) )
|
|
||||||
{
|
|
||||||
CurrentLobbyData.SetData( key, value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( OnLobbyDataUpdated != null ) { OnLobbyDataUpdated(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the lobby data itself has been updated. Called when someone has joined/left, Owner has updated data, etc.
|
|
||||||
/// </summary>
|
|
||||||
public Action OnLobbyDataUpdated;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a member of the lobby has updated either their personal Lobby metadata or someone's global steam state has changed (like a display name). Parameter is the user who changed.
|
|
||||||
/// </summary>
|
|
||||||
public Action<ulong> OnLobbyMemberDataUpdated;
|
|
||||||
|
|
||||||
|
|
||||||
public Type LobbyType
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return Type.Error; } //if we're currently in a valid server
|
|
||||||
|
|
||||||
//we know that we've set the lobby type via the lobbydata in the creation function
|
|
||||||
//ps this is important because steam doesn't have an easy way to get lobby type (why idk)
|
|
||||||
string lobbyType = CurrentLobbyData.GetData( "lobbytype" );
|
|
||||||
switch ( lobbyType )
|
|
||||||
{
|
|
||||||
case "Private":
|
|
||||||
return Type.Private;
|
|
||||||
case "FriendsOnly":
|
|
||||||
return Type.FriendsOnly;
|
|
||||||
case "Invisible":
|
|
||||||
return Type.Invisible;
|
|
||||||
case "Public":
|
|
||||||
return Type.Public;
|
|
||||||
default:
|
|
||||||
return Type.Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return; }
|
|
||||||
if ( client.native.matchmaking.SetLobbyType( CurrentLobby, (SteamNative.LobbyType)value ) )
|
|
||||||
{
|
|
||||||
CurrentLobbyData.SetData( "lobbytype", value.ToString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] chatMessageData = new byte[1024 * 4];
|
|
||||||
|
|
||||||
private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callback )
|
|
||||||
{
|
|
||||||
//from Client.Networking
|
|
||||||
if ( callback.SteamIDLobby != CurrentLobby )
|
|
||||||
return;
|
|
||||||
|
|
||||||
SteamNative.CSteamID steamid = 1;
|
|
||||||
ChatEntryType chatEntryType; // "If set then this will just always return k_EChatEntryTypeChatMsg. This can usually just be set to NULL."
|
|
||||||
int readData = 0;
|
|
||||||
fixed ( byte* p = chatMessageData )
|
|
||||||
{
|
|
||||||
readData = client.native.matchmaking.GetLobbyChatEntry( CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OnChatMessageRecieved?.Invoke( steamid, chatMessageData, readData );
|
|
||||||
|
|
||||||
if ( readData > 0 )
|
|
||||||
{
|
|
||||||
OnChatStringRecieved?.Invoke( steamid, Encoding.UTF8.GetString( chatMessageData, 0, readData ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback to get chat messages. Use Encoding.UTF8.GetString to retrive the message.
|
|
||||||
/// </summary>
|
|
||||||
public Action<ulong, byte[], int> OnChatMessageRecieved;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Like OnChatMessageRecieved but the data is converted to a string
|
|
||||||
/// </summary>
|
|
||||||
public Action<ulong, string> OnChatStringRecieved;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Broadcasts a chat message to the all the users in the lobby users in the lobby (including the local user) will receive a LobbyChatMsg_t callback.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if message successfully sent</returns>
|
|
||||||
public unsafe bool SendChatMessage( string message )
|
|
||||||
{
|
|
||||||
var data = Encoding.UTF8.GetBytes( message );
|
|
||||||
fixed ( byte* p = data )
|
|
||||||
{
|
|
||||||
// pvMsgBody can be binary or text data, up to 4k
|
|
||||||
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
|
|
||||||
return client.native.matchmaking.SendLobbyChatMsg( CurrentLobby, (IntPtr)p, data.Length );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enums to catch the state of a user when their state has changed
|
|
||||||
/// </summary>
|
|
||||||
public enum MemberStateChange
|
|
||||||
{
|
|
||||||
Entered = ChatMemberStateChange.Entered,
|
|
||||||
Left = ChatMemberStateChange.Left,
|
|
||||||
Disconnected = ChatMemberStateChange.Disconnected,
|
|
||||||
Kicked = ChatMemberStateChange.Kicked,
|
|
||||||
Banned = ChatMemberStateChange.Banned,
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnLobbyStateUpdatedAPI( LobbyChatUpdate_t callback )
|
|
||||||
{
|
|
||||||
if ( callback.SteamIDLobby != CurrentLobby )
|
|
||||||
return;
|
|
||||||
|
|
||||||
MemberStateChange change = (MemberStateChange)callback.GfChatMemberStateChange;
|
|
||||||
ulong initiator = callback.SteamIDMakingChange;
|
|
||||||
ulong affected = callback.SteamIDUserChanged;
|
|
||||||
|
|
||||||
OnLobbyStateChanged?.Invoke( change, initiator, affected );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the state of the Lobby is somehow shifted. Usually when someone joins or leaves the lobby.
|
|
||||||
/// The first ulong is the SteamID of the user that initiated the change.
|
|
||||||
/// The second ulong is the person that was affected
|
|
||||||
/// </summary>
|
|
||||||
public Action<MemberStateChange, ulong, ulong> OnLobbyStateChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The name of the lobby as a property for easy getting/setting. Note that this is setting LobbyData, which you cannot do unless you are the Owner of the lobby
|
|
||||||
/// </summary>
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return ""; }
|
|
||||||
return CurrentLobbyData.GetData( "name" );
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return; }
|
|
||||||
CurrentLobbyData.SetData( "name", value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// returns true if we're the current owner
|
|
||||||
/// </summary>
|
|
||||||
public bool IsOwner
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Owner == client.SteamId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Owner of the current lobby. Returns 0 if you are not in a valid lobby.
|
|
||||||
/// </summary>
|
|
||||||
public ulong Owner
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( IsValid )
|
|
||||||
{
|
|
||||||
return client.native.matchmaking.GetLobbyOwner( CurrentLobby );
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ( Owner == value ) return;
|
|
||||||
client.native.matchmaking.SetLobbyOwner( CurrentLobby, value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is the Lobby joinable by other people? Defaults to true;
|
|
||||||
/// </summary>
|
|
||||||
public bool Joinable
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return false; }
|
|
||||||
string joinable = CurrentLobbyData.GetData( "joinable" );
|
|
||||||
switch ( joinable )
|
|
||||||
{
|
|
||||||
case "true":
|
|
||||||
return true;
|
|
||||||
case "false":
|
|
||||||
return false;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return; }
|
|
||||||
if ( client.native.matchmaking.SetLobbyJoinable( CurrentLobby, value ) )
|
|
||||||
{
|
|
||||||
CurrentLobbyData.SetData( "joinable", value.ToString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How many people can be in the Lobby
|
|
||||||
/// </summary>
|
|
||||||
public int MaxMembers
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return 0; } //0 is default, but value is inited when lobby is created.
|
|
||||||
return client.native.matchmaking.GetLobbyMemberLimit( CurrentLobby );
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ( !IsValid ) { return; }
|
|
||||||
client.native.matchmaking.SetLobbyMemberLimit( CurrentLobby, value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How many people are currently in the Lobby
|
|
||||||
/// </summary>
|
|
||||||
public int NumMembers
|
|
||||||
{
|
|
||||||
get { return client.native.matchmaking.GetNumLobbyMembers( CurrentLobby ); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Leave the CurrentLobby.
|
|
||||||
/// </summary>
|
|
||||||
public void Leave()
|
|
||||||
{
|
|
||||||
if ( CurrentLobby != 0 )
|
|
||||||
{
|
|
||||||
client.native.matchmaking.LeaveLobby( CurrentLobby );
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentLobby = 0;
|
|
||||||
CurrentLobbyData = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get an array of all the CSteamIDs in the CurrentLobby.
|
|
||||||
/// Note that you must be in the Lobby you are trying to request the MemberIDs from.
|
|
||||||
/// Returns an empty array if you aren't in a lobby.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Array of member SteamIDs</returns>
|
|
||||||
public ulong[] GetMemberIDs()
|
|
||||||
{
|
|
||||||
ulong[] memIDs = new ulong[NumMembers];
|
|
||||||
for ( int i = 0; i < NumMembers; i++ )
|
|
||||||
{
|
|
||||||
memIDs[i] = client.native.matchmaking.GetLobbyMemberByIndex( CurrentLobby, i );
|
|
||||||
}
|
|
||||||
return memIDs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check to see if a user is in your CurrentLobby
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="steamID">SteamID of the user to check for</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool UserIsInCurrentLobby( ulong steamID )
|
|
||||||
{
|
|
||||||
if ( CurrentLobby == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ulong[] mems = GetMemberIDs();
|
|
||||||
|
|
||||||
for ( int i = 0; i < mems.Length; i++ )
|
|
||||||
{
|
|
||||||
if ( mems[i] == steamID )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invites the specified user to the CurrentLobby the user is in.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="friendID">ulong ID of person to invite</param>
|
|
||||||
public bool InviteUserToLobby( ulong friendID )
|
|
||||||
{
|
|
||||||
return client.native.matchmaking.InviteUserToLobby( CurrentLobby, friendID );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnUserInvitedToLobbyAPI( LobbyInvite_t callback )
|
|
||||||
{
|
|
||||||
if ( callback.GameID != client.AppId ) return;
|
|
||||||
if ( OnUserInvitedToLobby != null ) { OnUserInvitedToLobby( callback.SteamIDLobby, callback.SteamIDUser ); }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Activates the steam overlay to invite friends to the CurrentLobby the user is in.
|
|
||||||
/// </summary>
|
|
||||||
public void OpenFriendInviteOverlay()
|
|
||||||
{
|
|
||||||
client.native.friends.ActivateGameOverlayInviteDialog(CurrentLobby);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a user invites the current user to a lobby. The first parameter is the lobby the user was invited to, the second is the CSteamID of the person who invited this user
|
|
||||||
/// </summary>
|
|
||||||
public Action<ulong, ulong> OnUserInvitedToLobby;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when a user accepts an invitation to a lobby while the game is running. The parameter is a lobby id.
|
|
||||||
/// </summary>
|
|
||||||
public Action<ulong> OnLobbyJoinRequested;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Joins a lobby if a request was made to join the lobby through the friends list or an invite
|
|
||||||
/// </summary>
|
|
||||||
internal void OnLobbyJoinRequestedAPI( GameLobbyJoinRequested_t callback )
|
|
||||||
{
|
|
||||||
if (OnLobbyJoinRequested != null) { OnLobbyJoinRequested(callback.SteamIDLobby); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Makes sure we send an update callback if a Lobby user updates their information
|
|
||||||
/// </summary>
|
|
||||||
internal void OnLobbyMemberPersonaChangeAPI( PersonaStateChange_t callback )
|
|
||||||
{
|
|
||||||
if ( !UserIsInCurrentLobby( callback.SteamID ) ) return;
|
|
||||||
if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamID ); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the game server associated with the lobby.
|
|
||||||
/// This can only be set by the owner of the lobby.
|
|
||||||
/// Either the IP/Port or the Steam ID of the game server must be valid, depending on how you want the clients to be able to connect.
|
|
||||||
/// </summary>
|
|
||||||
public bool SetGameServer( System.Net.IPAddress ip, int port, ulong serverSteamId = 0 )
|
|
||||||
{
|
|
||||||
if ( !IsValid || !IsOwner ) return false;
|
|
||||||
|
|
||||||
var ipint = System.Net.IPAddress.NetworkToHostOrder( ip.Address );
|
|
||||||
client.native.matchmaking.SetLobbyGameServer( CurrentLobby, (uint)ipint, (ushort)port, serverSteamId );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the details of a game server set in a lobby.
|
|
||||||
/// </summary>
|
|
||||||
public System.Net.IPAddress GameServerIp
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
uint ip;
|
|
||||||
ushort port;
|
|
||||||
CSteamID steamid;
|
|
||||||
|
|
||||||
if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) || ip == 0 )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new System.Net.IPAddress( System.Net.IPAddress.HostToNetworkOrder( ip ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the details of a game server set in a lobby.
|
|
||||||
/// </summary>
|
|
||||||
public int GameServerPort
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
uint ip;
|
|
||||||
ushort port;
|
|
||||||
CSteamID steamid;
|
|
||||||
|
|
||||||
if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return (int)port;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the details of a game server set in a lobby.
|
|
||||||
/// </summary>
|
|
||||||
public ulong GameServerSteamId
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
uint ip;
|
|
||||||
ushort port;
|
|
||||||
CSteamID steamid;
|
|
||||||
|
|
||||||
if ( !client.native.matchmaking.GetLobbyGameServer( CurrentLobby, out ip, out port, out steamid ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return steamid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*not implemented
|
|
||||||
|
|
||||||
//set the game server of the lobby
|
|
||||||
client.native.matchmaking.GetLobbyGameServer;
|
|
||||||
client.native.matchmaking.SetLobbyGameServer;
|
|
||||||
|
|
||||||
//used with game server stuff
|
|
||||||
SteamNative.LobbyGameCreated_t
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class LobbyList
|
|
||||||
{
|
|
||||||
public class Lobby
|
|
||||||
{
|
|
||||||
private Dictionary<string, string> lobbyData;
|
|
||||||
internal Client Client;
|
|
||||||
public string Name { get; private set; }
|
|
||||||
public ulong LobbyID { get; private set; }
|
|
||||||
public ulong Owner { get; private set; }
|
|
||||||
public int MemberLimit{ get; private set; }
|
|
||||||
public int NumMembers{ get; private set; }
|
|
||||||
public string LobbyType { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the lobby value for the specific key
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="k">The key to find</param>
|
|
||||||
/// <returns>The value at key</returns>
|
|
||||||
public string GetData(string k)
|
|
||||||
{
|
|
||||||
if (lobbyData.TryGetValue(k, out var v))
|
|
||||||
return v;
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a list of all the data in the Lobby
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Dictionary of all the key/value pairs in the data</returns>
|
|
||||||
public Dictionary<string, string> GetAllData()
|
|
||||||
{
|
|
||||||
var returnData = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
foreach ( var item in lobbyData)
|
|
||||||
{
|
|
||||||
returnData.Add(item.Key, item.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnData;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Lobby FromSteam(Client client, ulong lobby)
|
|
||||||
{
|
|
||||||
var lobbyData = new Dictionary<string, string>();
|
|
||||||
int dataCount = client.native.matchmaking.GetLobbyDataCount(lobby);
|
|
||||||
|
|
||||||
for (int i = 0; i < dataCount; i++)
|
|
||||||
{
|
|
||||||
if (client.native.matchmaking.GetLobbyDataByIndex(lobby, i, out var datakey, out var datavalue))
|
|
||||||
{
|
|
||||||
lobbyData.Add(datakey, datavalue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Lobby()
|
|
||||||
{
|
|
||||||
Client = client,
|
|
||||||
LobbyID = lobby,
|
|
||||||
Name = client.native.matchmaking.GetLobbyData(lobby, "name"),
|
|
||||||
LobbyType = client.native.matchmaking.GetLobbyData(lobby, "lobbytype"),
|
|
||||||
MemberLimit = client.native.matchmaking.GetLobbyMemberLimit(lobby),
|
|
||||||
Owner = client.native.matchmaking.GetLobbyOwner(lobby),
|
|
||||||
NumMembers = client.native.matchmaking.GetNumLobbyMembers(lobby),
|
|
||||||
lobbyData = lobbyData
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,185 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class LobbyList : IDisposable
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
//The list of retrieved lobbies
|
|
||||||
public List<Lobby> Lobbies { get; private set; }
|
|
||||||
|
|
||||||
//True when all the possible lobbies have had their data updated
|
|
||||||
//if the number of lobbies is now equal to the initial request number, we've found all lobbies
|
|
||||||
public bool Finished { get; private set; }
|
|
||||||
|
|
||||||
//The number of possible lobbies we can get data from
|
|
||||||
internal List<ulong> requests;
|
|
||||||
|
|
||||||
internal LobbyList(Client client)
|
|
||||||
{
|
|
||||||
this.client = client;
|
|
||||||
Lobbies = new List<Lobby>();
|
|
||||||
requests = new List<ulong>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Refresh the List of Lobbies. If no filter is passed in, a default one is created that filters based on AppId ("appid").
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filter"></param>
|
|
||||||
public void Refresh ( Filter filter = null)
|
|
||||||
{
|
|
||||||
//init out values
|
|
||||||
Lobbies.Clear();
|
|
||||||
requests.Clear();
|
|
||||||
Finished = false;
|
|
||||||
|
|
||||||
if (filter == null)
|
|
||||||
{
|
|
||||||
filter = new Filter();
|
|
||||||
filter.StringFilters.Add("appid", client.AppId.ToString());
|
|
||||||
client.native.matchmaking.RequestLobbyList(OnLobbyList);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.native.matchmaking.AddRequestLobbyListDistanceFilter((SteamNative.LobbyDistanceFilter)filter.DistanceFilter);
|
|
||||||
|
|
||||||
if (filter.SlotsAvailable != null)
|
|
||||||
{
|
|
||||||
client.native.matchmaking.AddRequestLobbyListFilterSlotsAvailable((int)filter.SlotsAvailable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.MaxResults != null)
|
|
||||||
{
|
|
||||||
client.native.matchmaking.AddRequestLobbyListResultCountFilter((int)filter.MaxResults);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> fil in filter.StringFilters)
|
|
||||||
{
|
|
||||||
client.native.matchmaking.AddRequestLobbyListStringFilter(fil.Key, fil.Value, SteamNative.LobbyComparison.Equal);
|
|
||||||
}
|
|
||||||
foreach (KeyValuePair<string, int> fil in filter.NearFilters)
|
|
||||||
{
|
|
||||||
client.native.matchmaking.AddRequestLobbyListNearValueFilter(fil.Key, fil.Value);
|
|
||||||
}
|
|
||||||
//foreach (KeyValuePair<string, KeyValuePair<Filter.Comparison, int>> fil in filter.NumericalFilters)
|
|
||||||
//{
|
|
||||||
// client.native.matchmaking.AddRequestLobbyListNumericalFilter(fil.Key, fil.Value.Value, (SteamNative.LobbyComparison)fil.Value.Key);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
// this will never return lobbies that are full (via the actual api)
|
|
||||||
client.native.matchmaking.RequestLobbyList(OnLobbyList);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void OnLobbyList(LobbyMatchList_t callback, bool error)
|
|
||||||
{
|
|
||||||
if (error) return;
|
|
||||||
|
|
||||||
//how many lobbies matched
|
|
||||||
uint lobbiesMatching = callback.LobbiesMatching;
|
|
||||||
|
|
||||||
// lobbies are returned in order of closeness to the user, so add them to the list in that order
|
|
||||||
for (int i = 0; i < lobbiesMatching; i++)
|
|
||||||
{
|
|
||||||
//add the lobby to the list of requests
|
|
||||||
ulong lobby = client.native.matchmaking.GetLobbyByIndex(i);
|
|
||||||
requests.Add(lobby);
|
|
||||||
|
|
||||||
//cast to a LobbyList.Lobby
|
|
||||||
Lobby newLobby = Lobby.FromSteam(client, lobby);
|
|
||||||
if (newLobby.Name != "")
|
|
||||||
{
|
|
||||||
//if the lobby is valid add it to the valid return lobbies
|
|
||||||
Lobbies.Add(newLobby);
|
|
||||||
checkFinished();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//else we need to get the info for the missing lobby
|
|
||||||
client.native.matchmaking.RequestLobbyData(lobby);
|
|
||||||
client.RegisterCallback<SteamNative.LobbyDataUpdate_t>( OnLobbyDataUpdated );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
checkFinished();
|
|
||||||
|
|
||||||
if (OnLobbiesUpdated != null) { OnLobbiesUpdated(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkFinished()
|
|
||||||
{
|
|
||||||
if (Lobbies.Count == requests.Count)
|
|
||||||
{
|
|
||||||
Finished = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Finished = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnLobbyDataUpdated(LobbyDataUpdate_t callback)
|
|
||||||
{
|
|
||||||
if (callback.Success == 1) //1 if success, 0 if failure
|
|
||||||
{
|
|
||||||
//find the lobby that has been updated
|
|
||||||
Lobby lobby = Lobbies.Find(x => x.LobbyID == callback.SteamIDLobby);
|
|
||||||
|
|
||||||
//if this lobby isn't yet in the list of lobbies, we know that we should add it
|
|
||||||
if (lobby == null)
|
|
||||||
{
|
|
||||||
Lobbies.Add(lobby);
|
|
||||||
checkFinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
//otherwise lobby data in general was updated and you should listen to see what changed
|
|
||||||
if (OnLobbiesUpdated != null) { OnLobbiesUpdated(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action OnLobbiesUpdated;
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Filter
|
|
||||||
{
|
|
||||||
// Filters that match actual metadata keys exactly
|
|
||||||
public Dictionary<string, string> StringFilters = new Dictionary<string, string>();
|
|
||||||
// Filters that are of string key and int value for that key to be close to
|
|
||||||
public Dictionary<string, int> NearFilters = new Dictionary<string, int>();
|
|
||||||
//Filters that are of string key and int value, with a comparison filter to say how we should relate to the value
|
|
||||||
//public Dictionary<string, KeyValuePair<Comparison, int>> NumericalFilters = new Dictionary<string, KeyValuePair<Comparison, int>>();
|
|
||||||
public Distance DistanceFilter = Distance.Worldwide;
|
|
||||||
public int? SlotsAvailable { get; set; }
|
|
||||||
public int? MaxResults { get; set; }
|
|
||||||
|
|
||||||
public enum Distance : int
|
|
||||||
{
|
|
||||||
Close = SteamNative.LobbyDistanceFilter.Close,
|
|
||||||
Default = SteamNative.LobbyDistanceFilter.Default,
|
|
||||||
Far = SteamNative.LobbyDistanceFilter.Far,
|
|
||||||
Worldwide = SteamNative.LobbyDistanceFilter.Worldwide
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Comparison : int
|
|
||||||
{
|
|
||||||
EqualToOrLessThan = SteamNative.LobbyComparison.EqualToOrLessThan,
|
|
||||||
LessThan = SteamNative.LobbyComparison.LessThan,
|
|
||||||
Equal = SteamNative.LobbyComparison.Equal,
|
|
||||||
GreaterThan = SteamNative.LobbyComparison.GreaterThan,
|
|
||||||
EqualToOrGreaterThan = SteamNative.LobbyComparison.EqualToOrGreaterThan,
|
|
||||||
NotEqual = SteamNative.LobbyComparison.NotEqual
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public class MicroTransactions : IDisposable
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
public delegate void AuthorizationResponse( bool authorized, int appId, ulong orderId );
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called on the MicroTxnAuthorizationResponse_t event
|
|
||||||
/// </summary>
|
|
||||||
public event AuthorizationResponse OnAuthorizationResponse;
|
|
||||||
|
|
||||||
internal MicroTransactions( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
|
|
||||||
client.RegisterCallback<SteamNative.MicroTxnAuthorizationResponse_t>( onMicroTxnAuthorizationResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onMicroTxnAuthorizationResponse( MicroTxnAuthorizationResponse_t arg1 )
|
|
||||||
{
|
|
||||||
if ( OnAuthorizationResponse != null )
|
|
||||||
{
|
|
||||||
OnAuthorizationResponse( arg1.Authorized == 1, (int) arg1.AppID, arg1.OrderID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,323 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Facepunch.Steamworks.Callbacks;
|
|
||||||
using SteamNative;
|
|
||||||
using Result = SteamNative.Result;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a file stored in a user's Steam Cloud.
|
|
||||||
/// </summary>
|
|
||||||
public class RemoteFile
|
|
||||||
{
|
|
||||||
internal readonly RemoteStorage remoteStorage;
|
|
||||||
|
|
||||||
private readonly bool _isUgc;
|
|
||||||
private string _fileName;
|
|
||||||
private int _sizeInBytes = -1;
|
|
||||||
private long _timestamp = 0;
|
|
||||||
private UGCHandle_t _handle;
|
|
||||||
private ulong _ownerId;
|
|
||||||
|
|
||||||
private bool _isDownloading;
|
|
||||||
private byte[] _downloadedData;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if the file exists.
|
|
||||||
/// </summary>
|
|
||||||
public bool Exists { get; internal set; }
|
|
||||||
|
|
||||||
public bool IsDownloading { get { return _isUgc && _isDownloading && _downloadedData == null; } }
|
|
||||||
|
|
||||||
public bool IsDownloaded { get { return !_isUgc || _downloadedData != null; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If true, the file is available for other users to download.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsShared { get { return _handle.Value != 0; } }
|
|
||||||
|
|
||||||
internal UGCHandle_t UGCHandle { get { return _handle; } }
|
|
||||||
|
|
||||||
public ulong SharingId { get { return UGCHandle.Value; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name and path of the file.
|
|
||||||
/// </summary>
|
|
||||||
public string FileName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _fileName != null ) return _fileName;
|
|
||||||
GetUGCDetails();
|
|
||||||
return _fileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Steam ID of the file's owner.
|
|
||||||
/// </summary>
|
|
||||||
public ulong OwnerId
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _ownerId != 0 ) return _ownerId;
|
|
||||||
GetUGCDetails();
|
|
||||||
return _ownerId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Total size of the file in bytes.
|
|
||||||
/// </summary>
|
|
||||||
public int SizeInBytes
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _sizeInBytes != -1 ) return _sizeInBytes;
|
|
||||||
if ( _isUgc ) throw new NotImplementedException();
|
|
||||||
_sizeInBytes = remoteStorage.native.GetFileSize( FileName );
|
|
||||||
return _sizeInBytes;
|
|
||||||
}
|
|
||||||
internal set { _sizeInBytes = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Date modified timestamp in epoch format.
|
|
||||||
/// </summary>
|
|
||||||
public long FileTimestamp
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _timestamp != 0 ) return _timestamp;
|
|
||||||
if (_isUgc) throw new NotImplementedException();
|
|
||||||
_timestamp = remoteStorage.native.GetFileTimestamp(FileName);
|
|
||||||
return _timestamp;
|
|
||||||
}
|
|
||||||
internal set { _timestamp = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal RemoteFile( RemoteStorage r, UGCHandle_t handle )
|
|
||||||
{
|
|
||||||
Exists = true;
|
|
||||||
|
|
||||||
remoteStorage = r;
|
|
||||||
|
|
||||||
_isUgc = true;
|
|
||||||
_handle = handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal RemoteFile( RemoteStorage r, string name, ulong ownerId, int sizeInBytes = -1, long timestamp = 0 )
|
|
||||||
{
|
|
||||||
remoteStorage = r;
|
|
||||||
|
|
||||||
_isUgc = false;
|
|
||||||
_fileName = name;
|
|
||||||
_ownerId = ownerId;
|
|
||||||
_sizeInBytes = sizeInBytes;
|
|
||||||
_timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a <see cref="RemoteFileWriteStream"/> used to write to this file.
|
|
||||||
/// </summary>
|
|
||||||
public RemoteFileWriteStream OpenWrite()
|
|
||||||
{
|
|
||||||
if (_isUgc) throw new InvalidOperationException("Cannot write to a shared file.");
|
|
||||||
|
|
||||||
return new RemoteFileWriteStream( remoteStorage, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write a byte array to this file, replacing any existing contents.
|
|
||||||
/// </summary>
|
|
||||||
public void WriteAllBytes( byte[] buffer )
|
|
||||||
{
|
|
||||||
using ( var stream = OpenWrite() )
|
|
||||||
{
|
|
||||||
stream.Write( buffer, 0, buffer.Length );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write a string to this file, replacing any existing contents.
|
|
||||||
/// </summary>
|
|
||||||
public void WriteAllText( string text, Encoding encoding = null )
|
|
||||||
{
|
|
||||||
if ( encoding == null ) encoding = Encoding.UTF8;
|
|
||||||
WriteAllBytes( encoding.GetBytes( text ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback invoked by <see cref="RemoteFile.Download"/> when a file download is complete.
|
|
||||||
/// </summary>
|
|
||||||
public delegate void DownloadCallback();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the number of bytes downloaded and the total number of bytes expected while
|
|
||||||
/// this file is downloading.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the file is downloading</returns>
|
|
||||||
public bool GetDownloadProgress( out int bytesDownloaded, out int bytesExpected )
|
|
||||||
{
|
|
||||||
return remoteStorage.native.GetUGCDownloadProgress( _handle, out bytesDownloaded, out bytesExpected );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to start downloading a shared file.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the download has successfully started</returns>
|
|
||||||
public bool Download( DownloadCallback onSuccess = null, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
if ( !_isUgc ) return false;
|
|
||||||
if ( _isDownloading ) return false;
|
|
||||||
if ( IsDownloaded ) return false;
|
|
||||||
|
|
||||||
_isDownloading = true;
|
|
||||||
|
|
||||||
remoteStorage.native.UGCDownload( _handle, 1000, ( result, error ) =>
|
|
||||||
{
|
|
||||||
_isDownloading = false;
|
|
||||||
|
|
||||||
if ( error || result.Result != Result.OK )
|
|
||||||
{
|
|
||||||
onFailure?.Invoke( result.Result == 0 ? Callbacks.Result.IOFailure : (Callbacks.Result) result.Result );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ownerId = result.SteamIDOwner;
|
|
||||||
_sizeInBytes = result.SizeInBytes;
|
|
||||||
_fileName = result.PchFileName;
|
|
||||||
|
|
||||||
unsafe
|
|
||||||
{
|
|
||||||
_downloadedData = new byte[_sizeInBytes];
|
|
||||||
fixed ( byte* bufferPtr = _downloadedData )
|
|
||||||
{
|
|
||||||
remoteStorage.native.UGCRead( _handle, (IntPtr) bufferPtr, _sizeInBytes, 0, UGCReadAction.ontinueReading );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onSuccess?.Invoke();
|
|
||||||
} );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens a stream used to read from this file.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Stream OpenRead()
|
|
||||||
{
|
|
||||||
return new MemoryStream( ReadAllBytes(), false );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads the entire contents of the file as a byte array.
|
|
||||||
/// </summary>
|
|
||||||
public unsafe byte[] ReadAllBytes()
|
|
||||||
{
|
|
||||||
if ( _isUgc )
|
|
||||||
{
|
|
||||||
if ( !IsDownloaded ) throw new Exception( "Cannot read a file that hasn't been downloaded." );
|
|
||||||
return _downloadedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
var size = SizeInBytes;
|
|
||||||
var buffer = new byte[size];
|
|
||||||
|
|
||||||
fixed ( byte* bufferPtr = buffer )
|
|
||||||
{
|
|
||||||
remoteStorage.native.FileRead( FileName, (IntPtr) bufferPtr, size );
|
|
||||||
}
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads the entire contents of the file as a string.
|
|
||||||
/// </summary>
|
|
||||||
public string ReadAllText( Encoding encoding = null )
|
|
||||||
{
|
|
||||||
if ( encoding == null ) encoding = Encoding.UTF8;
|
|
||||||
return encoding.GetString( ReadAllBytes() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback invoked by <see cref="RemoteFile.Share"/> when file sharing is complete.
|
|
||||||
/// </summary>
|
|
||||||
public delegate void ShareCallback();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempt to publish this file for other users to download.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if we have started attempting to share</returns>
|
|
||||||
public bool Share( ShareCallback onSuccess = null, FailureCallback onFailure = null )
|
|
||||||
{
|
|
||||||
if ( _isUgc ) return false;
|
|
||||||
|
|
||||||
// Already shared
|
|
||||||
if ( _handle.Value != 0 ) return false;
|
|
||||||
|
|
||||||
remoteStorage.native.FileShare( FileName, ( result, error ) =>
|
|
||||||
{
|
|
||||||
if ( !error && result.Result == Result.OK )
|
|
||||||
{
|
|
||||||
_handle.Value = result.File;
|
|
||||||
onSuccess?.Invoke();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onFailure?.Invoke( result.Result == 0 ? Callbacks.Result.IOFailure : (Callbacks.Result) result.Result );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delete this file from remote storage.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the file could be deleted</returns>
|
|
||||||
public bool Delete()
|
|
||||||
{
|
|
||||||
if ( !Exists ) return false;
|
|
||||||
if ( _isUgc ) return false;
|
|
||||||
if ( !remoteStorage.native.FileDelete( FileName ) ) return false;
|
|
||||||
|
|
||||||
Exists = false;
|
|
||||||
remoteStorage.InvalidateFiles();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Remove this file from remote storage, while keeping a local copy.
|
|
||||||
/// Writing to this file again will re-add it to the cloud.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>True if the file was forgotten</returns>
|
|
||||||
public bool Forget()
|
|
||||||
{
|
|
||||||
if ( !Exists ) return false;
|
|
||||||
if ( _isUgc ) return false;
|
|
||||||
|
|
||||||
return remoteStorage.native.FileForget( FileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GetUGCDetails()
|
|
||||||
{
|
|
||||||
if ( !_isUgc ) throw new InvalidOperationException();
|
|
||||||
|
|
||||||
var appId = new AppId_t { Value = remoteStorage.native.steamworks.AppId };
|
|
||||||
|
|
||||||
CSteamID ownerId;
|
|
||||||
remoteStorage.native.GetUGCDetails( _handle, ref appId, out _fileName, out ownerId );
|
|
||||||
|
|
||||||
_ownerId = ownerId.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Stream used to write to a <see cref="RemoteFile"/>.
|
|
||||||
/// </summary>
|
|
||||||
public class RemoteFileWriteStream : Stream
|
|
||||||
{
|
|
||||||
internal readonly RemoteStorage remoteStorage;
|
|
||||||
|
|
||||||
private readonly UGCFileWriteStreamHandle_t _handle;
|
|
||||||
private readonly RemoteFile _file;
|
|
||||||
|
|
||||||
private int _written;
|
|
||||||
private bool _closed;
|
|
||||||
|
|
||||||
internal RemoteFileWriteStream( RemoteStorage r, RemoteFile file )
|
|
||||||
{
|
|
||||||
remoteStorage = r;
|
|
||||||
|
|
||||||
_handle = remoteStorage.native.FileWriteStreamOpen( file.FileName );
|
|
||||||
_file = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Flush() { }
|
|
||||||
|
|
||||||
public override int Read( byte[] buffer, int offset, int count )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override long Seek( long offset, SeekOrigin origin )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetLength( long value )
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override unsafe void Write( byte[] buffer, int offset, int count )
|
|
||||||
{
|
|
||||||
if ( _closed ) throw new ObjectDisposedException( ToString() );
|
|
||||||
|
|
||||||
fixed ( byte* bufferPtr = buffer )
|
|
||||||
{
|
|
||||||
if ( remoteStorage.native.FileWriteStreamWriteChunk( _handle, (IntPtr)(bufferPtr + offset), count ) )
|
|
||||||
{
|
|
||||||
_written += count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool CanRead => false;
|
|
||||||
public override bool CanSeek => false;
|
|
||||||
public override bool CanWrite => true;
|
|
||||||
public override long Length => _written;
|
|
||||||
public override long Position { get { return _written; } set { throw new NotImplementedException(); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Close the stream without saving the file to remote storage.
|
|
||||||
/// </summary>
|
|
||||||
public void Cancel()
|
|
||||||
{
|
|
||||||
if ( _closed ) return;
|
|
||||||
|
|
||||||
_closed = true;
|
|
||||||
remoteStorage.native.FileWriteStreamCancel( _handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Close()
|
|
||||||
{
|
|
||||||
if ( _closed ) return;
|
|
||||||
|
|
||||||
_closed = true;
|
|
||||||
remoteStorage.native.FileWriteStreamClose( _handle );
|
|
||||||
|
|
||||||
_file.remoteStorage.OnWrittenNewFile( _file );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose( bool disposing )
|
|
||||||
{
|
|
||||||
if ( disposing ) Close();
|
|
||||||
base.Dispose( disposing );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,269 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Handles Steam Cloud related actions.
|
|
||||||
/// </summary>
|
|
||||||
public class RemoteStorage : IDisposable
|
|
||||||
{
|
|
||||||
private static string NormalizePath( string path )
|
|
||||||
{
|
|
||||||
// TODO: DUMB HACK ALERT
|
|
||||||
|
|
||||||
return SteamNative.Platform.IsWindows
|
|
||||||
? new FileInfo( $"x:/{path}" ).FullName.Substring( 3 )
|
|
||||||
: new FileInfo( $"/x/{path}" ).FullName.Substring( 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Client client;
|
|
||||||
internal SteamNative.SteamRemoteStorage native;
|
|
||||||
|
|
||||||
private bool _filesInvalid = true;
|
|
||||||
private readonly List<RemoteFile> _files = new List<RemoteFile>();
|
|
||||||
|
|
||||||
internal RemoteStorage( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
native = client.native.remoteStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if Steam Cloud is currently enabled by the current user.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsCloudEnabledForAccount
|
|
||||||
{
|
|
||||||
get { return native.IsCloudEnabledForAccount(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True if Steam Cloud is currently enabled for this app by the current user.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsCloudEnabledForApp
|
|
||||||
{
|
|
||||||
get { return native.IsCloudEnabledForApp(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the total number of files in the current user's remote storage for the current game.
|
|
||||||
/// </summary>
|
|
||||||
public int FileCount
|
|
||||||
{
|
|
||||||
get { return native.GetFileCount(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all files in the current user's remote storage for the current game.
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<RemoteFile> Files
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
UpdateFiles();
|
|
||||||
return _files;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new <see cref="RemoteFile"/> with the given <paramref name="path"/>.
|
|
||||||
/// If a file exists at that path it will be overwritten.
|
|
||||||
/// </summary>
|
|
||||||
public RemoteFile CreateFile( string path )
|
|
||||||
{
|
|
||||||
path = NormalizePath( path );
|
|
||||||
|
|
||||||
InvalidateFiles();
|
|
||||||
var existing = Files.FirstOrDefault( x => x.FileName == path );
|
|
||||||
return existing ?? new RemoteFile( this, path, client.SteamId, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens the file if it exists, else returns null;
|
|
||||||
/// </summary>
|
|
||||||
public RemoteFile OpenFile( string path )
|
|
||||||
{
|
|
||||||
path = NormalizePath( path );
|
|
||||||
|
|
||||||
InvalidateFiles();
|
|
||||||
var existing = Files.FirstOrDefault( x => x.FileName == path );
|
|
||||||
return existing;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens a previously shared <see cref="RemoteFile"/>
|
|
||||||
/// with the given <paramref name="sharingId"/>.
|
|
||||||
/// </summary>
|
|
||||||
public RemoteFile OpenSharedFile( ulong sharingId )
|
|
||||||
{
|
|
||||||
return new RemoteFile( this, sharingId );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write all text to the file at the specified path. This
|
|
||||||
/// overwrites the contents - it does not append.
|
|
||||||
/// </summary>
|
|
||||||
public bool WriteString( string path, string text, Encoding encoding = null )
|
|
||||||
{
|
|
||||||
var file = CreateFile( path );
|
|
||||||
file.WriteAllText( text, encoding );
|
|
||||||
return file.Exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Write all data to the file at the specified path. This
|
|
||||||
/// overwrites the contents - it does not append.
|
|
||||||
/// </summary>
|
|
||||||
public bool WriteBytes( string path, byte[] data )
|
|
||||||
{
|
|
||||||
var file = CreateFile( path );
|
|
||||||
file.WriteAllBytes( data );
|
|
||||||
return file.Exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read the entire contents of the file as a string.
|
|
||||||
/// Returns null if the file isn't found.
|
|
||||||
/// </summary>
|
|
||||||
public string ReadString( string path, Encoding encoding = null )
|
|
||||||
{
|
|
||||||
var file = OpenFile( path );
|
|
||||||
if ( file == null ) return null;
|
|
||||||
return file.ReadAllText( encoding );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read the entire contents of the file as raw data.
|
|
||||||
/// Returns null if the file isn't found.
|
|
||||||
/// </summary>
|
|
||||||
public byte[] ReadBytes( string path )
|
|
||||||
{
|
|
||||||
var file = OpenFile( path );
|
|
||||||
if ( file == null ) return null;
|
|
||||||
return file.ReadAllBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnWrittenNewFile( RemoteFile file )
|
|
||||||
{
|
|
||||||
if ( _files.Any( x => x.FileName == file.FileName ) ) return;
|
|
||||||
|
|
||||||
_files.Add( file );
|
|
||||||
file.Exists = true;
|
|
||||||
|
|
||||||
InvalidateFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void InvalidateFiles()
|
|
||||||
{
|
|
||||||
_filesInvalid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateFiles()
|
|
||||||
{
|
|
||||||
if ( !_filesInvalid ) return;
|
|
||||||
_filesInvalid = false;
|
|
||||||
|
|
||||||
foreach ( var file in _files )
|
|
||||||
{
|
|
||||||
file.Exists = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var count = FileCount;
|
|
||||||
for ( var i = 0; i < count; ++i )
|
|
||||||
{
|
|
||||||
int size;
|
|
||||||
var name = NormalizePath( native.GetFileNameAndSize( i, out size ) );
|
|
||||||
var timestamp = native.GetFileTimestamp(name);
|
|
||||||
|
|
||||||
var existing = _files.FirstOrDefault( x => x.FileName == name );
|
|
||||||
if ( existing == null )
|
|
||||||
{
|
|
||||||
existing = new RemoteFile( this, name, client.SteamId, size, timestamp );
|
|
||||||
_files.Add( existing );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
existing.SizeInBytes = size;
|
|
||||||
existing.FileTimestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
existing.Exists = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( var i = _files.Count - 1; i >= 0; --i )
|
|
||||||
{
|
|
||||||
if ( !_files[i].Exists ) _files.RemoveAt( i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets whether a file exists in remote storage at the given <paramref name="path"/>.
|
|
||||||
/// </summary>
|
|
||||||
public bool FileExists( string path )
|
|
||||||
{
|
|
||||||
return native.FileExists( path );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
native = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of bytes used out of the user's total quota
|
|
||||||
/// </summary>
|
|
||||||
public ulong QuotaUsed
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
ulong totalBytes = 0;
|
|
||||||
ulong availableBytes = 0;
|
|
||||||
|
|
||||||
if ( !native.GetQuota( out totalBytes, out availableBytes ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return totalBytes - availableBytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Total quota size in bytes
|
|
||||||
/// </summary>
|
|
||||||
public ulong QuotaTotal
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
ulong totalBytes = 0;
|
|
||||||
ulong availableBytes = 0;
|
|
||||||
|
|
||||||
if ( !native.GetQuota( out totalBytes, out availableBytes ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return totalBytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of bytes remaining out of the user's total quota
|
|
||||||
/// </summary>
|
|
||||||
public ulong QuotaRemaining
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
ulong totalBytes = 0;
|
|
||||||
ulong availableBytes = 0;
|
|
||||||
|
|
||||||
if ( !native.GetQuota( out totalBytes, out availableBytes ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return availableBytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Client : IDisposable
|
|
||||||
{
|
|
||||||
Screenshots _screenshots;
|
|
||||||
|
|
||||||
public Screenshots Screenshots
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _screenshots == null )
|
|
||||||
_screenshots = new Screenshots( this );
|
|
||||||
|
|
||||||
return _screenshots;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Screenshots
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
internal Screenshots( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Trigger()
|
|
||||||
{
|
|
||||||
client.native.screenshots.TriggerScreenshot();
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe void Write( byte[] rgbData, int width, int height )
|
|
||||||
{
|
|
||||||
if ( rgbData == null )
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException( nameof(rgbData) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( width < 1 )
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException( nameof(width), width,
|
|
||||||
$"Expected {nameof(width)} to be at least 1." );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( height < 1 )
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException( nameof(height), height,
|
|
||||||
$"Expected {nameof(height)} to be at least 1." );
|
|
||||||
}
|
|
||||||
|
|
||||||
var size = width * height * 3;
|
|
||||||
if ( rgbData.Length < size )
|
|
||||||
{
|
|
||||||
throw new ArgumentException( nameof(rgbData),
|
|
||||||
$"Expected {nameof(rgbData)} to contain at least {size} elements (actual size: {rgbData.Length})." );
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed ( byte* ptr = rgbData )
|
|
||||||
{
|
|
||||||
client.native.screenshots.WriteScreenshot( (IntPtr) ptr, (uint) rgbData.Length, width, height );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe void AddScreenshotToLibrary( string filename, string thumbnailFilename, int width, int height)
|
|
||||||
{
|
|
||||||
client.native.screenshots.AddScreenshotToLibrary(filename, thumbnailFilename, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe void AddScreenshotToLibrary( string filename, int width, int height)
|
|
||||||
{
|
|
||||||
client.native.screenshots.AddScreenshotToLibrary(filename, null, width, height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class ServerList : IDisposable
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
internal ServerList( Client client )
|
|
||||||
{
|
|
||||||
this.client = client;
|
|
||||||
|
|
||||||
UpdateFavouriteList();
|
|
||||||
}
|
|
||||||
|
|
||||||
HashSet<ulong> FavouriteHash = new HashSet<ulong>();
|
|
||||||
HashSet<ulong> HistoryHash = new HashSet<ulong>();
|
|
||||||
|
|
||||||
internal void UpdateFavouriteList()
|
|
||||||
{
|
|
||||||
FavouriteHash.Clear();
|
|
||||||
HistoryHash.Clear();
|
|
||||||
|
|
||||||
for ( int i=0; i< client.native.matchmaking.GetFavoriteGameCount(); i++ )
|
|
||||||
{
|
|
||||||
AppId_t appid = 0;
|
|
||||||
uint ip;
|
|
||||||
ushort conPort;
|
|
||||||
ushort queryPort;
|
|
||||||
uint lastplayed;
|
|
||||||
uint flags;
|
|
||||||
|
|
||||||
client.native.matchmaking.GetFavoriteGame( i, ref appid, out ip, out conPort, out queryPort, out flags, out lastplayed );
|
|
||||||
|
|
||||||
ulong encoded = ip;
|
|
||||||
encoded = encoded << 32;
|
|
||||||
encoded = encoded | (uint)conPort;
|
|
||||||
|
|
||||||
// if ( ( flags & Server.k_unFavoriteFlagFavorite ) == Server.k_unFavoriteFlagFavorite )
|
|
||||||
// FavouriteHash.Add( encoded );
|
|
||||||
|
|
||||||
// if ( ( flags & Server.k_unFavoriteFlagFavorite ) == Server.k_unFavoriteFlagFavorite )
|
|
||||||
// HistoryHash.Add( encoded );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public class Stats : IDisposable
|
|
||||||
{
|
|
||||||
internal Client client;
|
|
||||||
|
|
||||||
internal Stats( Client c )
|
|
||||||
{
|
|
||||||
client = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool StoreStats()
|
|
||||||
{
|
|
||||||
return client.native.userstats.StoreStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateStats()
|
|
||||||
{
|
|
||||||
client.native.userstats.RequestCurrentStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateGlobalStats( int days = 1 )
|
|
||||||
{
|
|
||||||
client.native.userstats.GetNumberOfCurrentPlayers();
|
|
||||||
client.native.userstats.RequestGlobalAchievementPercentages();
|
|
||||||
client.native.userstats.RequestGlobalStats( days );
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetInt( string name )
|
|
||||||
{
|
|
||||||
int data = 0;
|
|
||||||
client.native.userstats.GetStat( name, out data );
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long GetGlobalInt( string name )
|
|
||||||
{
|
|
||||||
long data = 0;
|
|
||||||
client.native.userstats.GetGlobalStat( name, out data );
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float GetFloat( string name )
|
|
||||||
{
|
|
||||||
float data = 0;
|
|
||||||
client.native.userstats.GetStat0( name, out data );
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GetGlobalFloat( string name )
|
|
||||||
{
|
|
||||||
double data = 0;
|
|
||||||
client.native.userstats.GetGlobalStat0( name, out data );
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set a stat value. This will automatically call StoreStats() after a successful call
|
|
||||||
/// unless you pass false as the last argument.
|
|
||||||
/// </summary>
|
|
||||||
public bool Set( string name, int value, bool store = true )
|
|
||||||
{
|
|
||||||
var r = client.native.userstats.SetStat( name, value );
|
|
||||||
|
|
||||||
if ( store )
|
|
||||||
{
|
|
||||||
return r && client.native.userstats.StoreStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set a stat value. This will automatically call StoreStats() after a successful call
|
|
||||||
/// unless you pass false as the last argument.
|
|
||||||
/// </summary>
|
|
||||||
public bool Set( string name, float value, bool store = true )
|
|
||||||
{
|
|
||||||
var r = client.native.userstats.SetStat0( name, value );
|
|
||||||
|
|
||||||
if ( store )
|
|
||||||
{
|
|
||||||
return r && client.native.userstats.StoreStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds this amount to the named stat. Internally this calls Get() and adds
|
|
||||||
/// to that value. Steam doesn't provide a mechanism for atomically increasing
|
|
||||||
/// stats like this, this functionality is added here as a convenience.
|
|
||||||
/// </summary>
|
|
||||||
public bool Add( string name, int amount = 1, bool store = true )
|
|
||||||
{
|
|
||||||
var val = GetInt( name );
|
|
||||||
val += amount;
|
|
||||||
return Set( name, val, store );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Practically wipes the slate clean for this user. If includeAchievements is true, will wipe
|
|
||||||
/// any achievements too.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool ResetAll( bool includeAchievements )
|
|
||||||
{
|
|
||||||
return client.native.userstats.ResetAllStats( includeAchievements );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public static class Config
|
public static class Config
|
||||||
{
|
{
|
||||||
/// <summary>
|
public static OsType Os { get; set; }
|
||||||
/// Should be called before creating any interfaces, to configure Steam for Unity.
|
public static bool PackSmall => Os != OsType.Windows;
|
||||||
/// </summary>
|
|
||||||
/// <param name="platform">Please pass in Application.platform.ToString()</param>
|
/// <summary>
|
||||||
public static void ForUnity( string platform )
|
/// Should be called before creating any interfaces, to configure Steam for Unity.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="platform">Please pass in Application.platform.ToString()</param>
|
||||||
|
public static void ForUnity( string platform )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Windows Config
|
// Windows Config
|
||||||
@ -20,21 +23,21 @@ public static void ForUnity( string platform )
|
|||||||
//
|
//
|
||||||
if (IntPtr.Size == 4) UseThisCall = false;
|
if (IntPtr.Size == 4) UseThisCall = false;
|
||||||
|
|
||||||
ForcePlatform( OperatingSystem.Windows );
|
Os = OsType.Windows;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( platform == "OSXEditor" || platform == "OSXPlayer" || platform == "OSXDashboardPlayer" )
|
if ( platform == "OSXEditor" || platform == "OSXPlayer" || platform == "OSXDashboardPlayer" )
|
||||||
{
|
{
|
||||||
ForcePlatform( OperatingSystem.macOS );
|
Os = OsType.macOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( platform == "LinuxPlayer" || platform == "LinuxEditor" )
|
if ( platform == "LinuxPlayer" || platform == "LinuxEditor" )
|
||||||
{
|
{
|
||||||
ForcePlatform( OperatingSystem.Linux );
|
Os = OsType.Linux;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine( "Facepunch.Steamworks Unity: " + platform );
|
Console.WriteLine( "Steamworks Unity: " + platform );
|
||||||
Console.WriteLine( "Facepunch.Steamworks Os: " + SteamNative.Platform.Os );
|
Console.WriteLine( "Steamworks Os: " + Os );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -47,17 +50,12 @@ public static void ForUnity( string platform )
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool UseThisCall { get; set; } = true;
|
public static bool UseThisCall { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// You can force the platform to a particular one here.
|
|
||||||
/// This is useful if you're on OSX because some versions of mono don't have a way
|
|
||||||
/// to tell which platform we're running
|
|
||||||
/// </summary>
|
|
||||||
public static void ForcePlatform( Facepunch.Steamworks.OperatingSystem os )
|
|
||||||
{
|
|
||||||
SteamNative.Platform.Os = os;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum OsType
|
||||||
|
{
|
||||||
|
Windows,
|
||||||
|
Linux,
|
||||||
|
macOS,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Facepunch.Steamworks;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
@ -76,7 +74,7 @@ internal static void InstallEvents()
|
|||||||
/// Called when the user tries to join a lobby from their friends list
|
/// Called when the user tries to join a lobby from their friends list
|
||||||
/// game client should attempt to connect to specified lobby when this is received
|
/// game client should attempt to connect to specified lobby when this is received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event Action<CSteamID, CSteamID> OnGameLobbyJoinRequested;
|
public static event Action<SteamId, SteamId> OnGameLobbyJoinRequested;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback indicating updated data about friends rich presence information
|
/// Callback indicating updated data about friends rich presence information
|
||||||
@ -164,7 +162,7 @@ public static IEnumerable<Friend> GetPlayedWith()
|
|||||||
/// "friendrequestaccept" - Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.
|
/// "friendrequestaccept" - Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.
|
||||||
/// "friendrequestignore" - Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.
|
/// "friendrequestignore" - Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void OpenUserOverlay( CSteamID id, string type ) => Internal.ActivateGameOverlayToUser( type, id );
|
public static void OpenUserOverlay( SteamId id, string type ) => Internal.ActivateGameOverlayToUser( type, id );
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Activates the Steam Overlay to the Steam store page for the provided app.
|
/// Activates the Steam Overlay to the Steam store page for the provided app.
|
||||||
@ -179,15 +177,15 @@ public static IEnumerable<Friend> GetPlayedWith()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Activates the Steam Overlay to open the invite dialog. Invitations sent from this dialog will be for the provided lobby.
|
/// Activates the Steam Overlay to open the invite dialog. Invitations sent from this dialog will be for the provided lobby.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void OpenGameInviteOverlay( CSteamID lobby ) => Internal.ActivateGameOverlayInviteDialog( lobby );
|
public static void OpenGameInviteOverlay( SteamId lobby ) => Internal.ActivateGameOverlayInviteDialog( lobby );
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mark a target user as 'played with'.
|
/// Mark a target user as 'played with'.
|
||||||
/// NOTE: The current user must be in game with the other player for the association to work.
|
/// NOTE: The current user must be in game with the other player for the association to work.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetPlayedWith( CSteamID steamid ) => Internal.SetPlayedWith( steamid );
|
public static void SetPlayedWith( SteamId steamid ) => Internal.SetPlayedWith( steamid );
|
||||||
|
|
||||||
static async Task CacheUserInformationAsync( CSteamID steamid, bool nameonly )
|
static async Task CacheUserInformationAsync( SteamId steamid, bool nameonly )
|
||||||
{
|
{
|
||||||
// Got it straight away, skip any waiting.
|
// Got it straight away, skip any waiting.
|
||||||
if ( !Internal.RequestUserInformation( steamid, nameonly ) )
|
if ( !Internal.RequestUserInformation( steamid, nameonly ) )
|
||||||
@ -206,19 +204,19 @@ static async Task CacheUserInformationAsync( CSteamID steamid, bool nameonly )
|
|||||||
await Task.Delay( 500 );
|
await Task.Delay( 500 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<Image?> GetSmallAvatarAsync( CSteamID steamid )
|
public static async Task<Image?> GetSmallAvatarAsync( SteamId steamid )
|
||||||
{
|
{
|
||||||
await CacheUserInformationAsync( steamid, false );
|
await CacheUserInformationAsync( steamid, false );
|
||||||
return Utils.GetImage( Internal.GetSmallFriendAvatar( steamid ) );
|
return Utils.GetImage( Internal.GetSmallFriendAvatar( steamid ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<Image?> GetMediumAvatarAsync( CSteamID steamid )
|
public static async Task<Image?> GetMediumAvatarAsync( SteamId steamid )
|
||||||
{
|
{
|
||||||
await CacheUserInformationAsync( steamid, false );
|
await CacheUserInformationAsync( steamid, false );
|
||||||
return Utils.GetImage( Internal.GetMediumFriendAvatar( steamid ) );
|
return Utils.GetImage( Internal.GetMediumFriendAvatar( steamid ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<Image?> GetLargeAvatarAsync( CSteamID steamid )
|
public static async Task<Image?> GetLargeAvatarAsync( SteamId steamid )
|
||||||
{
|
{
|
||||||
await CacheUserInformationAsync( steamid, false );
|
await CacheUserInformationAsync( steamid, false );
|
||||||
|
|
@ -4,7 +4,6 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Facepunch.Steamworks;
|
using Facepunch.Steamworks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
@ -37,7 +36,7 @@ internal static void InstallEvents()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// User has been authed or rejected
|
/// User has been authed or rejected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event Action<CSteamID, CSteamID, AuthSessionResponse> OnValidateAuthTicketResponse;
|
public static event Action<SteamId, SteamId, AuthSessionResponse> OnValidateAuthTicketResponse;
|
||||||
|
|
||||||
public static void Init( AppId appid, ServerInit init )
|
public static void Init( AppId appid, ServerInit init )
|
||||||
{
|
{
|
||||||
@ -308,7 +307,7 @@ public static unsafe bool BeginAuthSession( byte[] data, ulong steamid )
|
|||||||
{
|
{
|
||||||
var result = Internal.BeginAuthSession( (IntPtr)p, data.Length, steamid );
|
var result = Internal.BeginAuthSession( (IntPtr)p, data.Length, steamid );
|
||||||
|
|
||||||
if ( result == SteamNative.BeginAuthSessionResult.OK )
|
if ( result == BeginAuthSessionResult.OK )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
@ -280,13 +279,13 @@ public bool BIsAppInstalled( AppId_t appID )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetAppOwnerDelegate( IntPtr self, ref CSteamID retVal );
|
public delegate void GetAppOwnerDelegate( IntPtr self, ref SteamId retVal );
|
||||||
private GetAppOwnerDelegate GetAppOwnerDelegatePointer;
|
private GetAppOwnerDelegate GetAppOwnerDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetAppOwner()
|
public SteamId GetAppOwner()
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetAppOwnerDelegatePointer( Self, ref retVal );
|
GetAppOwnerDelegatePointer( Self, ref retVal );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
@ -138,46 +137,46 @@ public int GetFriendCount( int iFriendFlags )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetFriendByIndexDelegate( IntPtr self, ref CSteamID retVal, int iFriend, int iFriendFlags );
|
public delegate void GetFriendByIndexDelegate( IntPtr self, ref SteamId retVal, int iFriend, int iFriendFlags );
|
||||||
private GetFriendByIndexDelegate GetFriendByIndexDelegatePointer;
|
private GetFriendByIndexDelegate GetFriendByIndexDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetFriendByIndex( int iFriend, int iFriendFlags )
|
public SteamId GetFriendByIndex( int iFriend, int iFriendFlags )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetFriendByIndexDelegatePointer( Self, ref retVal, iFriend, iFriendFlags );
|
GetFriendByIndexDelegatePointer( Self, ref retVal, iFriend, iFriendFlags );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate FriendRelationship GetFriendRelationshipDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate FriendRelationship GetFriendRelationshipDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendRelationshipDelegate GetFriendRelationshipDelegatePointer;
|
private GetFriendRelationshipDelegate GetFriendRelationshipDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public FriendRelationship GetFriendRelationship( CSteamID steamIDFriend )
|
public FriendRelationship GetFriendRelationship( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetFriendRelationshipDelegatePointer( Self, steamIDFriend );
|
return GetFriendRelationshipDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate PersonaState GetFriendPersonaStateDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate PersonaState GetFriendPersonaStateDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendPersonaStateDelegate GetFriendPersonaStateDelegatePointer;
|
private GetFriendPersonaStateDelegate GetFriendPersonaStateDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public PersonaState GetFriendPersonaState( CSteamID steamIDFriend )
|
public PersonaState GetFriendPersonaState( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetFriendPersonaStateDelegatePointer( Self, steamIDFriend );
|
return GetFriendPersonaStateDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetFriendPersonaNameDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate IntPtr GetFriendPersonaNameDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendPersonaNameDelegate GetFriendPersonaNameDelegatePointer;
|
private GetFriendPersonaNameDelegate GetFriendPersonaNameDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetFriendPersonaName( CSteamID steamIDFriend )
|
public string GetFriendPersonaName( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetString( GetFriendPersonaNameDelegatePointer( Self, steamIDFriend ) );
|
return GetString( GetFriendPersonaNameDelegatePointer( Self, steamIDFriend ) );
|
||||||
}
|
}
|
||||||
@ -185,44 +184,44 @@ public string GetFriendPersonaName( CSteamID steamIDFriend )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool GetFriendGamePlayedDelegate( IntPtr self, CSteamID steamIDFriend, ref FriendGameInfo_t pFriendGameInfo );
|
public delegate bool GetFriendGamePlayedDelegate( IntPtr self, SteamId steamIDFriend, ref FriendGameInfo_t pFriendGameInfo );
|
||||||
private GetFriendGamePlayedDelegate GetFriendGamePlayedDelegatePointer;
|
private GetFriendGamePlayedDelegate GetFriendGamePlayedDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool GetFriendGamePlayed( CSteamID steamIDFriend, ref FriendGameInfo_t pFriendGameInfo )
|
public bool GetFriendGamePlayed( SteamId steamIDFriend, ref FriendGameInfo_t pFriendGameInfo )
|
||||||
{
|
{
|
||||||
return GetFriendGamePlayedDelegatePointer( Self, steamIDFriend, ref pFriendGameInfo );
|
return GetFriendGamePlayedDelegatePointer( Self, steamIDFriend, ref pFriendGameInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetFriendPersonaNameHistoryDelegate( IntPtr self, CSteamID steamIDFriend, int iPersonaName );
|
public delegate IntPtr GetFriendPersonaNameHistoryDelegate( IntPtr self, SteamId steamIDFriend, int iPersonaName );
|
||||||
private GetFriendPersonaNameHistoryDelegate GetFriendPersonaNameHistoryDelegatePointer;
|
private GetFriendPersonaNameHistoryDelegate GetFriendPersonaNameHistoryDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName )
|
public string GetFriendPersonaNameHistory( SteamId steamIDFriend, int iPersonaName )
|
||||||
{
|
{
|
||||||
return GetString( GetFriendPersonaNameHistoryDelegatePointer( Self, steamIDFriend, iPersonaName ) );
|
return GetString( GetFriendPersonaNameHistoryDelegatePointer( Self, steamIDFriend, iPersonaName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetFriendSteamLevelDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate int GetFriendSteamLevelDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendSteamLevelDelegate GetFriendSteamLevelDelegatePointer;
|
private GetFriendSteamLevelDelegate GetFriendSteamLevelDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetFriendSteamLevel( CSteamID steamIDFriend )
|
public int GetFriendSteamLevel( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetFriendSteamLevelDelegatePointer( Self, steamIDFriend );
|
return GetFriendSteamLevelDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetPlayerNicknameDelegate( IntPtr self, CSteamID steamIDPlayer );
|
public delegate IntPtr GetPlayerNicknameDelegate( IntPtr self, SteamId steamIDPlayer );
|
||||||
private GetPlayerNicknameDelegate GetPlayerNicknameDelegatePointer;
|
private GetPlayerNicknameDelegate GetPlayerNicknameDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetPlayerNickname( CSteamID steamIDPlayer )
|
public string GetPlayerNickname( SteamId steamIDPlayer )
|
||||||
{
|
{
|
||||||
return GetString( GetPlayerNicknameDelegatePointer( Self, steamIDPlayer ) );
|
return GetString( GetPlayerNicknameDelegatePointer( Self, steamIDPlayer ) );
|
||||||
}
|
}
|
||||||
@ -273,11 +272,11 @@ public int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetFriendsGroupMembersListDelegate( IntPtr self, FriendsGroupID_t friendsGroupID, [In,Out] CSteamID[] pOutSteamIDMembers, int nMembersCount );
|
public delegate void GetFriendsGroupMembersListDelegate( IntPtr self, FriendsGroupID_t friendsGroupID, [In,Out] SteamId[] pOutSteamIDMembers, int nMembersCount );
|
||||||
private GetFriendsGroupMembersListDelegate GetFriendsGroupMembersListDelegatePointer;
|
private GetFriendsGroupMembersListDelegate GetFriendsGroupMembersListDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, [In,Out] CSteamID[] pOutSteamIDMembers, int nMembersCount )
|
public void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, [In,Out] SteamId[] pOutSteamIDMembers, int nMembersCount )
|
||||||
{
|
{
|
||||||
GetFriendsGroupMembersListDelegatePointer( Self, friendsGroupID, pOutSteamIDMembers, nMembersCount );
|
GetFriendsGroupMembersListDelegatePointer( Self, friendsGroupID, pOutSteamIDMembers, nMembersCount );
|
||||||
}
|
}
|
||||||
@ -285,11 +284,11 @@ public void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, [In,Out
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool HasFriendDelegate( IntPtr self, CSteamID steamIDFriend, int iFriendFlags );
|
public delegate bool HasFriendDelegate( IntPtr self, SteamId steamIDFriend, int iFriendFlags );
|
||||||
private HasFriendDelegate HasFriendDelegatePointer;
|
private HasFriendDelegate HasFriendDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool HasFriend( CSteamID steamIDFriend, int iFriendFlags )
|
public bool HasFriend( SteamId steamIDFriend, int iFriendFlags )
|
||||||
{
|
{
|
||||||
return HasFriendDelegatePointer( Self, steamIDFriend, iFriendFlags );
|
return HasFriendDelegatePointer( Self, steamIDFriend, iFriendFlags );
|
||||||
}
|
}
|
||||||
@ -307,35 +306,35 @@ public int GetClanCount()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetClanByIndexDelegate( IntPtr self, ref CSteamID retVal, int iClan );
|
public delegate void GetClanByIndexDelegate( IntPtr self, ref SteamId retVal, int iClan );
|
||||||
private GetClanByIndexDelegate GetClanByIndexDelegatePointer;
|
private GetClanByIndexDelegate GetClanByIndexDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetClanByIndex( int iClan )
|
public SteamId GetClanByIndex( int iClan )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetClanByIndexDelegatePointer( Self, ref retVal, iClan );
|
GetClanByIndexDelegatePointer( Self, ref retVal, iClan );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetClanNameDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate IntPtr GetClanNameDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private GetClanNameDelegate GetClanNameDelegatePointer;
|
private GetClanNameDelegate GetClanNameDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetClanName( CSteamID steamIDClan )
|
public string GetClanName( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return GetString( GetClanNameDelegatePointer( Self, steamIDClan ) );
|
return GetString( GetClanNameDelegatePointer( Self, steamIDClan ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetClanTagDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate IntPtr GetClanTagDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private GetClanTagDelegate GetClanTagDelegatePointer;
|
private GetClanTagDelegate GetClanTagDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetClanTag( CSteamID steamIDClan )
|
public string GetClanTag( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return GetString( GetClanTagDelegatePointer( Self, steamIDClan ) );
|
return GetString( GetClanTagDelegatePointer( Self, steamIDClan ) );
|
||||||
}
|
}
|
||||||
@ -343,46 +342,46 @@ public string GetClanTag( CSteamID steamIDClan )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool GetClanActivityCountsDelegate( IntPtr self, CSteamID steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting );
|
public delegate bool GetClanActivityCountsDelegate( IntPtr self, SteamId steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting );
|
||||||
private GetClanActivityCountsDelegate GetClanActivityCountsDelegatePointer;
|
private GetClanActivityCountsDelegate GetClanActivityCountsDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool GetClanActivityCounts( CSteamID steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting )
|
public bool GetClanActivityCounts( SteamId steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting )
|
||||||
{
|
{
|
||||||
return GetClanActivityCountsDelegatePointer( Self, steamIDClan, ref pnOnline, ref pnInGame, ref pnChatting );
|
return GetClanActivityCountsDelegatePointer( Self, steamIDClan, ref pnOnline, ref pnInGame, ref pnChatting );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t DownloadClanActivityCountsDelegate( IntPtr self, [In,Out] CSteamID[] psteamIDClans, int cClansToRequest );
|
public delegate SteamAPICall_t DownloadClanActivityCountsDelegate( IntPtr self, [In,Out] SteamId[] psteamIDClans, int cClansToRequest );
|
||||||
private DownloadClanActivityCountsDelegate DownloadClanActivityCountsDelegatePointer;
|
private DownloadClanActivityCountsDelegate DownloadClanActivityCountsDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<DownloadClanActivityCountsResult_t?> DownloadClanActivityCounts( [In,Out] CSteamID[] psteamIDClans, int cClansToRequest )
|
public async Task<DownloadClanActivityCountsResult_t?> DownloadClanActivityCounts( [In,Out] SteamId[] psteamIDClans, int cClansToRequest )
|
||||||
{
|
{
|
||||||
return await (new Result<DownloadClanActivityCountsResult_t>( DownloadClanActivityCountsDelegatePointer( Self, psteamIDClans, cClansToRequest ) )).GetResult();
|
return await (new Result<DownloadClanActivityCountsResult_t>( DownloadClanActivityCountsDelegatePointer( Self, psteamIDClans, cClansToRequest ) )).GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetFriendCountFromSourceDelegate( IntPtr self, CSteamID steamIDSource );
|
public delegate int GetFriendCountFromSourceDelegate( IntPtr self, SteamId steamIDSource );
|
||||||
private GetFriendCountFromSourceDelegate GetFriendCountFromSourceDelegatePointer;
|
private GetFriendCountFromSourceDelegate GetFriendCountFromSourceDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetFriendCountFromSource( CSteamID steamIDSource )
|
public int GetFriendCountFromSource( SteamId steamIDSource )
|
||||||
{
|
{
|
||||||
return GetFriendCountFromSourceDelegatePointer( Self, steamIDSource );
|
return GetFriendCountFromSourceDelegatePointer( Self, steamIDSource );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetFriendFromSourceByIndexDelegate( IntPtr self, ref CSteamID retVal, CSteamID steamIDSource, int iFriend );
|
public delegate void GetFriendFromSourceByIndexDelegate( IntPtr self, ref SteamId retVal, SteamId steamIDSource, int iFriend );
|
||||||
private GetFriendFromSourceByIndexDelegate GetFriendFromSourceByIndexDelegatePointer;
|
private GetFriendFromSourceByIndexDelegate GetFriendFromSourceByIndexDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend )
|
public SteamId GetFriendFromSourceByIndex( SteamId steamIDSource, int iFriend )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetFriendFromSourceByIndexDelegatePointer( Self, ref retVal, steamIDSource, iFriend );
|
GetFriendFromSourceByIndexDelegatePointer( Self, ref retVal, steamIDSource, iFriend );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
@ -390,22 +389,22 @@ public CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool IsUserInSourceDelegate( IntPtr self, CSteamID steamIDUser, CSteamID steamIDSource );
|
public delegate bool IsUserInSourceDelegate( IntPtr self, SteamId steamIDUser, SteamId steamIDSource );
|
||||||
private IsUserInSourceDelegate IsUserInSourceDelegatePointer;
|
private IsUserInSourceDelegate IsUserInSourceDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource )
|
public bool IsUserInSource( SteamId steamIDUser, SteamId steamIDSource )
|
||||||
{
|
{
|
||||||
return IsUserInSourceDelegatePointer( Self, steamIDUser, steamIDSource );
|
return IsUserInSourceDelegatePointer( Self, steamIDUser, steamIDSource );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void SetInGameVoiceSpeakingDelegate( IntPtr self, CSteamID steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bSpeaking );
|
public delegate void SetInGameVoiceSpeakingDelegate( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bSpeaking );
|
||||||
private SetInGameVoiceSpeakingDelegate SetInGameVoiceSpeakingDelegatePointer;
|
private SetInGameVoiceSpeakingDelegate SetInGameVoiceSpeakingDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void SetInGameVoiceSpeaking( CSteamID steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bSpeaking )
|
public void SetInGameVoiceSpeaking( SteamId steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bSpeaking )
|
||||||
{
|
{
|
||||||
SetInGameVoiceSpeakingDelegatePointer( Self, steamIDUser, bSpeaking );
|
SetInGameVoiceSpeakingDelegatePointer( Self, steamIDUser, bSpeaking );
|
||||||
}
|
}
|
||||||
@ -423,11 +422,11 @@ public void ActivateGameOverlay( string pchDialog )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void ActivateGameOverlayToUserDelegate( IntPtr self, string pchDialog, CSteamID steamID );
|
public delegate void ActivateGameOverlayToUserDelegate( IntPtr self, string pchDialog, SteamId steamID );
|
||||||
private ActivateGameOverlayToUserDelegate ActivateGameOverlayToUserDelegatePointer;
|
private ActivateGameOverlayToUserDelegate ActivateGameOverlayToUserDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void ActivateGameOverlayToUser( string pchDialog, CSteamID steamID )
|
public void ActivateGameOverlayToUser( string pchDialog, SteamId steamID )
|
||||||
{
|
{
|
||||||
ActivateGameOverlayToUserDelegatePointer( Self, pchDialog, steamID );
|
ActivateGameOverlayToUserDelegatePointer( Self, pchDialog, steamID );
|
||||||
}
|
}
|
||||||
@ -456,55 +455,55 @@ public void ActivateGameOverlayToStore( AppId_t nAppID, OverlayToStoreFlag eFlag
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void SetPlayedWithDelegate( IntPtr self, CSteamID steamIDUserPlayedWith );
|
public delegate void SetPlayedWithDelegate( IntPtr self, SteamId steamIDUserPlayedWith );
|
||||||
private SetPlayedWithDelegate SetPlayedWithDelegatePointer;
|
private SetPlayedWithDelegate SetPlayedWithDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void SetPlayedWith( CSteamID steamIDUserPlayedWith )
|
public void SetPlayedWith( SteamId steamIDUserPlayedWith )
|
||||||
{
|
{
|
||||||
SetPlayedWithDelegatePointer( Self, steamIDUserPlayedWith );
|
SetPlayedWithDelegatePointer( Self, steamIDUserPlayedWith );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void ActivateGameOverlayInviteDialogDelegate( IntPtr self, CSteamID steamIDLobby );
|
public delegate void ActivateGameOverlayInviteDialogDelegate( IntPtr self, SteamId steamIDLobby );
|
||||||
private ActivateGameOverlayInviteDialogDelegate ActivateGameOverlayInviteDialogDelegatePointer;
|
private ActivateGameOverlayInviteDialogDelegate ActivateGameOverlayInviteDialogDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby )
|
public void ActivateGameOverlayInviteDialog( SteamId steamIDLobby )
|
||||||
{
|
{
|
||||||
ActivateGameOverlayInviteDialogDelegatePointer( Self, steamIDLobby );
|
ActivateGameOverlayInviteDialogDelegatePointer( Self, steamIDLobby );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetSmallFriendAvatarDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate int GetSmallFriendAvatarDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetSmallFriendAvatarDelegate GetSmallFriendAvatarDelegatePointer;
|
private GetSmallFriendAvatarDelegate GetSmallFriendAvatarDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetSmallFriendAvatar( CSteamID steamIDFriend )
|
public int GetSmallFriendAvatar( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetSmallFriendAvatarDelegatePointer( Self, steamIDFriend );
|
return GetSmallFriendAvatarDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetMediumFriendAvatarDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate int GetMediumFriendAvatarDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetMediumFriendAvatarDelegate GetMediumFriendAvatarDelegatePointer;
|
private GetMediumFriendAvatarDelegate GetMediumFriendAvatarDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetMediumFriendAvatar( CSteamID steamIDFriend )
|
public int GetMediumFriendAvatar( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetMediumFriendAvatarDelegatePointer( Self, steamIDFriend );
|
return GetMediumFriendAvatarDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetLargeFriendAvatarDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate int GetLargeFriendAvatarDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetLargeFriendAvatarDelegate GetLargeFriendAvatarDelegatePointer;
|
private GetLargeFriendAvatarDelegate GetLargeFriendAvatarDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetLargeFriendAvatar( CSteamID steamIDFriend )
|
public int GetLargeFriendAvatar( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetLargeFriendAvatarDelegatePointer( Self, steamIDFriend );
|
return GetLargeFriendAvatarDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
@ -512,59 +511,59 @@ public int GetLargeFriendAvatar( CSteamID steamIDFriend )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool RequestUserInformationDelegate( IntPtr self, CSteamID steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bRequireNameOnly );
|
public delegate bool RequestUserInformationDelegate( IntPtr self, SteamId steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bRequireNameOnly );
|
||||||
private RequestUserInformationDelegate RequestUserInformationDelegatePointer;
|
private RequestUserInformationDelegate RequestUserInformationDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool RequestUserInformation( CSteamID steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bRequireNameOnly )
|
public bool RequestUserInformation( SteamId steamIDUser, [MarshalAs( UnmanagedType.U1 )] bool bRequireNameOnly )
|
||||||
{
|
{
|
||||||
return RequestUserInformationDelegatePointer( Self, steamIDUser, bRequireNameOnly );
|
return RequestUserInformationDelegatePointer( Self, steamIDUser, bRequireNameOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t RequestClanOfficerListDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate SteamAPICall_t RequestClanOfficerListDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private RequestClanOfficerListDelegate RequestClanOfficerListDelegatePointer;
|
private RequestClanOfficerListDelegate RequestClanOfficerListDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<ClanOfficerListResponse_t?> RequestClanOfficerList( CSteamID steamIDClan )
|
public async Task<ClanOfficerListResponse_t?> RequestClanOfficerList( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return await (new Result<ClanOfficerListResponse_t>( RequestClanOfficerListDelegatePointer( Self, steamIDClan ) )).GetResult();
|
return await (new Result<ClanOfficerListResponse_t>( RequestClanOfficerListDelegatePointer( Self, steamIDClan ) )).GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetClanOwnerDelegate( IntPtr self, ref CSteamID retVal, CSteamID steamIDClan );
|
public delegate void GetClanOwnerDelegate( IntPtr self, ref SteamId retVal, SteamId steamIDClan );
|
||||||
private GetClanOwnerDelegate GetClanOwnerDelegatePointer;
|
private GetClanOwnerDelegate GetClanOwnerDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetClanOwner( CSteamID steamIDClan )
|
public SteamId GetClanOwner( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetClanOwnerDelegatePointer( Self, ref retVal, steamIDClan );
|
GetClanOwnerDelegatePointer( Self, ref retVal, steamIDClan );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetClanOfficerCountDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate int GetClanOfficerCountDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private GetClanOfficerCountDelegate GetClanOfficerCountDelegatePointer;
|
private GetClanOfficerCountDelegate GetClanOfficerCountDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetClanOfficerCount( CSteamID steamIDClan )
|
public int GetClanOfficerCount( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return GetClanOfficerCountDelegatePointer( Self, steamIDClan );
|
return GetClanOfficerCountDelegatePointer( Self, steamIDClan );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetClanOfficerByIndexDelegate( IntPtr self, ref CSteamID retVal, CSteamID steamIDClan, int iOfficer );
|
public delegate void GetClanOfficerByIndexDelegate( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iOfficer );
|
||||||
private GetClanOfficerByIndexDelegate GetClanOfficerByIndexDelegatePointer;
|
private GetClanOfficerByIndexDelegate GetClanOfficerByIndexDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer )
|
public SteamId GetClanOfficerByIndex( SteamId steamIDClan, int iOfficer )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetClanOfficerByIndexDelegatePointer( Self, ref retVal, steamIDClan, iOfficer );
|
GetClanOfficerByIndexDelegatePointer( Self, ref retVal, steamIDClan, iOfficer );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
@ -605,44 +604,44 @@ public void ClearRichPresence()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetFriendRichPresenceDelegate( IntPtr self, CSteamID steamIDFriend, string pchKey );
|
public delegate IntPtr GetFriendRichPresenceDelegate( IntPtr self, SteamId steamIDFriend, string pchKey );
|
||||||
private GetFriendRichPresenceDelegate GetFriendRichPresenceDelegatePointer;
|
private GetFriendRichPresenceDelegate GetFriendRichPresenceDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetFriendRichPresence( CSteamID steamIDFriend, string pchKey )
|
public string GetFriendRichPresence( SteamId steamIDFriend, string pchKey )
|
||||||
{
|
{
|
||||||
return GetString( GetFriendRichPresenceDelegatePointer( Self, steamIDFriend, pchKey ) );
|
return GetString( GetFriendRichPresenceDelegatePointer( Self, steamIDFriend, pchKey ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetFriendRichPresenceKeyCountDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate int GetFriendRichPresenceKeyCountDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendRichPresenceKeyCountDelegate GetFriendRichPresenceKeyCountDelegatePointer;
|
private GetFriendRichPresenceKeyCountDelegate GetFriendRichPresenceKeyCountDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend )
|
public int GetFriendRichPresenceKeyCount( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetFriendRichPresenceKeyCountDelegatePointer( Self, steamIDFriend );
|
return GetFriendRichPresenceKeyCountDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate IntPtr GetFriendRichPresenceKeyByIndexDelegate( IntPtr self, CSteamID steamIDFriend, int iKey );
|
public delegate IntPtr GetFriendRichPresenceKeyByIndexDelegate( IntPtr self, SteamId steamIDFriend, int iKey );
|
||||||
private GetFriendRichPresenceKeyByIndexDelegate GetFriendRichPresenceKeyByIndexDelegatePointer;
|
private GetFriendRichPresenceKeyByIndexDelegate GetFriendRichPresenceKeyByIndexDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public string GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey )
|
public string GetFriendRichPresenceKeyByIndex( SteamId steamIDFriend, int iKey )
|
||||||
{
|
{
|
||||||
return GetString( GetFriendRichPresenceKeyByIndexDelegatePointer( Self, steamIDFriend, iKey ) );
|
return GetString( GetFriendRichPresenceKeyByIndexDelegatePointer( Self, steamIDFriend, iKey ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void RequestFriendRichPresenceDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate void RequestFriendRichPresenceDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private RequestFriendRichPresenceDelegate RequestFriendRichPresenceDelegatePointer;
|
private RequestFriendRichPresenceDelegate RequestFriendRichPresenceDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void RequestFriendRichPresence( CSteamID steamIDFriend )
|
public void RequestFriendRichPresence( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
RequestFriendRichPresenceDelegatePointer( Self, steamIDFriend );
|
RequestFriendRichPresenceDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
@ -650,11 +649,11 @@ public void RequestFriendRichPresence( CSteamID steamIDFriend )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool InviteUserToGameDelegate( IntPtr self, CSteamID steamIDFriend, string pchConnectString );
|
public delegate bool InviteUserToGameDelegate( IntPtr self, SteamId steamIDFriend, string pchConnectString );
|
||||||
private InviteUserToGameDelegate InviteUserToGameDelegatePointer;
|
private InviteUserToGameDelegate InviteUserToGameDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool InviteUserToGame( CSteamID steamIDFriend, string pchConnectString )
|
public bool InviteUserToGame( SteamId steamIDFriend, string pchConnectString )
|
||||||
{
|
{
|
||||||
return InviteUserToGameDelegatePointer( Self, steamIDFriend, pchConnectString );
|
return InviteUserToGameDelegatePointer( Self, steamIDFriend, pchConnectString );
|
||||||
}
|
}
|
||||||
@ -672,46 +671,46 @@ public int GetCoplayFriendCount()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetCoplayFriendDelegate( IntPtr self, ref CSteamID retVal, int iCoplayFriend );
|
public delegate void GetCoplayFriendDelegate( IntPtr self, ref SteamId retVal, int iCoplayFriend );
|
||||||
private GetCoplayFriendDelegate GetCoplayFriendDelegatePointer;
|
private GetCoplayFriendDelegate GetCoplayFriendDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetCoplayFriend( int iCoplayFriend )
|
public SteamId GetCoplayFriend( int iCoplayFriend )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetCoplayFriendDelegatePointer( Self, ref retVal, iCoplayFriend );
|
GetCoplayFriendDelegatePointer( Self, ref retVal, iCoplayFriend );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetFriendCoplayTimeDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate int GetFriendCoplayTimeDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendCoplayTimeDelegate GetFriendCoplayTimeDelegatePointer;
|
private GetFriendCoplayTimeDelegate GetFriendCoplayTimeDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetFriendCoplayTime( CSteamID steamIDFriend )
|
public int GetFriendCoplayTime( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetFriendCoplayTimeDelegatePointer( Self, steamIDFriend );
|
return GetFriendCoplayTimeDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate AppId_t GetFriendCoplayGameDelegate( IntPtr self, CSteamID steamIDFriend );
|
public delegate AppId_t GetFriendCoplayGameDelegate( IntPtr self, SteamId steamIDFriend );
|
||||||
private GetFriendCoplayGameDelegate GetFriendCoplayGameDelegatePointer;
|
private GetFriendCoplayGameDelegate GetFriendCoplayGameDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public AppId_t GetFriendCoplayGame( CSteamID steamIDFriend )
|
public AppId_t GetFriendCoplayGame( SteamId steamIDFriend )
|
||||||
{
|
{
|
||||||
return GetFriendCoplayGameDelegatePointer( Self, steamIDFriend );
|
return GetFriendCoplayGameDelegatePointer( Self, steamIDFriend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t JoinClanChatRoomDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate SteamAPICall_t JoinClanChatRoomDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private JoinClanChatRoomDelegate JoinClanChatRoomDelegatePointer;
|
private JoinClanChatRoomDelegate JoinClanChatRoomDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<JoinClanChatRoomCompletionResult_t?> JoinClanChatRoom( CSteamID steamIDClan )
|
public async Task<JoinClanChatRoomCompletionResult_t?> JoinClanChatRoom( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return await (new Result<JoinClanChatRoomCompletionResult_t>( JoinClanChatRoomDelegatePointer( Self, steamIDClan ) )).GetResult();
|
return await (new Result<JoinClanChatRoomCompletionResult_t>( JoinClanChatRoomDelegatePointer( Self, steamIDClan ) )).GetResult();
|
||||||
}
|
}
|
||||||
@ -719,35 +718,35 @@ public AppId_t GetFriendCoplayGame( CSteamID steamIDFriend )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool LeaveClanChatRoomDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate bool LeaveClanChatRoomDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private LeaveClanChatRoomDelegate LeaveClanChatRoomDelegatePointer;
|
private LeaveClanChatRoomDelegate LeaveClanChatRoomDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool LeaveClanChatRoom( CSteamID steamIDClan )
|
public bool LeaveClanChatRoom( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return LeaveClanChatRoomDelegatePointer( Self, steamIDClan );
|
return LeaveClanChatRoomDelegatePointer( Self, steamIDClan );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetClanChatMemberCountDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate int GetClanChatMemberCountDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private GetClanChatMemberCountDelegate GetClanChatMemberCountDelegatePointer;
|
private GetClanChatMemberCountDelegate GetClanChatMemberCountDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetClanChatMemberCount( CSteamID steamIDClan )
|
public int GetClanChatMemberCount( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return GetClanChatMemberCountDelegatePointer( Self, steamIDClan );
|
return GetClanChatMemberCountDelegatePointer( Self, steamIDClan );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetChatMemberByIndexDelegate( IntPtr self, ref CSteamID retVal, CSteamID steamIDClan, int iUser );
|
public delegate void GetChatMemberByIndexDelegate( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iUser );
|
||||||
private GetChatMemberByIndexDelegate GetChatMemberByIndexDelegatePointer;
|
private GetChatMemberByIndexDelegate GetChatMemberByIndexDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser )
|
public SteamId GetChatMemberByIndex( SteamId steamIDClan, int iUser )
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetChatMemberByIndexDelegatePointer( Self, ref retVal, steamIDClan, iUser );
|
GetChatMemberByIndexDelegatePointer( Self, ref retVal, steamIDClan, iUser );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
@ -755,22 +754,22 @@ public CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool SendClanChatMessageDelegate( IntPtr self, CSteamID steamIDClanChat, string pchText );
|
public delegate bool SendClanChatMessageDelegate( IntPtr self, SteamId steamIDClanChat, string pchText );
|
||||||
private SendClanChatMessageDelegate SendClanChatMessageDelegatePointer;
|
private SendClanChatMessageDelegate SendClanChatMessageDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool SendClanChatMessage( CSteamID steamIDClanChat, string pchText )
|
public bool SendClanChatMessage( SteamId steamIDClanChat, string pchText )
|
||||||
{
|
{
|
||||||
return SendClanChatMessageDelegatePointer( Self, steamIDClanChat, pchText );
|
return SendClanChatMessageDelegatePointer( Self, steamIDClanChat, pchText );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetClanChatMessageDelegate( IntPtr self, CSteamID steamIDClanChat, int iMessage, IntPtr prgchText, int cchTextMax, ref ChatEntryType peChatEntryType, ref CSteamID psteamidChatter );
|
public delegate int GetClanChatMessageDelegate( IntPtr self, SteamId steamIDClanChat, int iMessage, IntPtr prgchText, int cchTextMax, ref ChatEntryType peChatEntryType, ref SteamId psteamidChatter );
|
||||||
private GetClanChatMessageDelegate GetClanChatMessageDelegatePointer;
|
private GetClanChatMessageDelegate GetClanChatMessageDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, IntPtr prgchText, int cchTextMax, ref ChatEntryType peChatEntryType, ref CSteamID psteamidChatter )
|
public int GetClanChatMessage( SteamId steamIDClanChat, int iMessage, IntPtr prgchText, int cchTextMax, ref ChatEntryType peChatEntryType, ref SteamId psteamidChatter )
|
||||||
{
|
{
|
||||||
return GetClanChatMessageDelegatePointer( Self, steamIDClanChat, iMessage, prgchText, cchTextMax, ref peChatEntryType, ref psteamidChatter );
|
return GetClanChatMessageDelegatePointer( Self, steamIDClanChat, iMessage, prgchText, cchTextMax, ref peChatEntryType, ref psteamidChatter );
|
||||||
}
|
}
|
||||||
@ -778,11 +777,11 @@ public int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, IntPtr pr
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool IsClanChatAdminDelegate( IntPtr self, CSteamID steamIDClanChat, CSteamID steamIDUser );
|
public delegate bool IsClanChatAdminDelegate( IntPtr self, SteamId steamIDClanChat, SteamId steamIDUser );
|
||||||
private IsClanChatAdminDelegate IsClanChatAdminDelegatePointer;
|
private IsClanChatAdminDelegate IsClanChatAdminDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser )
|
public bool IsClanChatAdmin( SteamId steamIDClanChat, SteamId steamIDUser )
|
||||||
{
|
{
|
||||||
return IsClanChatAdminDelegatePointer( Self, steamIDClanChat, steamIDUser );
|
return IsClanChatAdminDelegatePointer( Self, steamIDClanChat, steamIDUser );
|
||||||
}
|
}
|
||||||
@ -790,11 +789,11 @@ public bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool IsClanChatWindowOpenInSteamDelegate( IntPtr self, CSteamID steamIDClanChat );
|
public delegate bool IsClanChatWindowOpenInSteamDelegate( IntPtr self, SteamId steamIDClanChat );
|
||||||
private IsClanChatWindowOpenInSteamDelegate IsClanChatWindowOpenInSteamDelegatePointer;
|
private IsClanChatWindowOpenInSteamDelegate IsClanChatWindowOpenInSteamDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat )
|
public bool IsClanChatWindowOpenInSteam( SteamId steamIDClanChat )
|
||||||
{
|
{
|
||||||
return IsClanChatWindowOpenInSteamDelegatePointer( Self, steamIDClanChat );
|
return IsClanChatWindowOpenInSteamDelegatePointer( Self, steamIDClanChat );
|
||||||
}
|
}
|
||||||
@ -802,11 +801,11 @@ public bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool OpenClanChatWindowInSteamDelegate( IntPtr self, CSteamID steamIDClanChat );
|
public delegate bool OpenClanChatWindowInSteamDelegate( IntPtr self, SteamId steamIDClanChat );
|
||||||
private OpenClanChatWindowInSteamDelegate OpenClanChatWindowInSteamDelegatePointer;
|
private OpenClanChatWindowInSteamDelegate OpenClanChatWindowInSteamDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat )
|
public bool OpenClanChatWindowInSteam( SteamId steamIDClanChat )
|
||||||
{
|
{
|
||||||
return OpenClanChatWindowInSteamDelegatePointer( Self, steamIDClanChat );
|
return OpenClanChatWindowInSteamDelegatePointer( Self, steamIDClanChat );
|
||||||
}
|
}
|
||||||
@ -814,11 +813,11 @@ public bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool CloseClanChatWindowInSteamDelegate( IntPtr self, CSteamID steamIDClanChat );
|
public delegate bool CloseClanChatWindowInSteamDelegate( IntPtr self, SteamId steamIDClanChat );
|
||||||
private CloseClanChatWindowInSteamDelegate CloseClanChatWindowInSteamDelegatePointer;
|
private CloseClanChatWindowInSteamDelegate CloseClanChatWindowInSteamDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat )
|
public bool CloseClanChatWindowInSteam( SteamId steamIDClanChat )
|
||||||
{
|
{
|
||||||
return CloseClanChatWindowInSteamDelegatePointer( Self, steamIDClanChat );
|
return CloseClanChatWindowInSteamDelegatePointer( Self, steamIDClanChat );
|
||||||
}
|
}
|
||||||
@ -838,44 +837,44 @@ public bool SetListenForFriendsMessages( [MarshalAs( UnmanagedType.U1 )] bool bI
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool ReplyToFriendMessageDelegate( IntPtr self, CSteamID steamIDFriend, string pchMsgToSend );
|
public delegate bool ReplyToFriendMessageDelegate( IntPtr self, SteamId steamIDFriend, string pchMsgToSend );
|
||||||
private ReplyToFriendMessageDelegate ReplyToFriendMessageDelegatePointer;
|
private ReplyToFriendMessageDelegate ReplyToFriendMessageDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool ReplyToFriendMessage( CSteamID steamIDFriend, string pchMsgToSend )
|
public bool ReplyToFriendMessage( SteamId steamIDFriend, string pchMsgToSend )
|
||||||
{
|
{
|
||||||
return ReplyToFriendMessageDelegatePointer( Self, steamIDFriend, pchMsgToSend );
|
return ReplyToFriendMessageDelegatePointer( Self, steamIDFriend, pchMsgToSend );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int GetFriendMessageDelegate( IntPtr self, CSteamID steamIDFriend, int iMessageID, IntPtr pvData, int cubData, ref ChatEntryType peChatEntryType );
|
public delegate int GetFriendMessageDelegate( IntPtr self, SteamId steamIDFriend, int iMessageID, IntPtr pvData, int cubData, ref ChatEntryType peChatEntryType );
|
||||||
private GetFriendMessageDelegate GetFriendMessageDelegatePointer;
|
private GetFriendMessageDelegate GetFriendMessageDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, IntPtr pvData, int cubData, ref ChatEntryType peChatEntryType )
|
public int GetFriendMessage( SteamId steamIDFriend, int iMessageID, IntPtr pvData, int cubData, ref ChatEntryType peChatEntryType )
|
||||||
{
|
{
|
||||||
return GetFriendMessageDelegatePointer( Self, steamIDFriend, iMessageID, pvData, cubData, ref peChatEntryType );
|
return GetFriendMessageDelegatePointer( Self, steamIDFriend, iMessageID, pvData, cubData, ref peChatEntryType );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t GetFollowerCountDelegate( IntPtr self, CSteamID steamID );
|
public delegate SteamAPICall_t GetFollowerCountDelegate( IntPtr self, SteamId steamID );
|
||||||
private GetFollowerCountDelegate GetFollowerCountDelegatePointer;
|
private GetFollowerCountDelegate GetFollowerCountDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<FriendsGetFollowerCount_t?> GetFollowerCount( CSteamID steamID )
|
public async Task<FriendsGetFollowerCount_t?> GetFollowerCount( SteamId steamID )
|
||||||
{
|
{
|
||||||
return await (new Result<FriendsGetFollowerCount_t>( GetFollowerCountDelegatePointer( Self, steamID ) )).GetResult();
|
return await (new Result<FriendsGetFollowerCount_t>( GetFollowerCountDelegatePointer( Self, steamID ) )).GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t IsFollowingDelegate( IntPtr self, CSteamID steamID );
|
public delegate SteamAPICall_t IsFollowingDelegate( IntPtr self, SteamId steamID );
|
||||||
private IsFollowingDelegate IsFollowingDelegatePointer;
|
private IsFollowingDelegate IsFollowingDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<FriendsIsFollowing_t?> IsFollowing( CSteamID steamID )
|
public async Task<FriendsIsFollowing_t?> IsFollowing( SteamId steamID )
|
||||||
{
|
{
|
||||||
return await (new Result<FriendsIsFollowing_t>( IsFollowingDelegatePointer( Self, steamID ) )).GetResult();
|
return await (new Result<FriendsIsFollowing_t>( IsFollowingDelegatePointer( Self, steamID ) )).GetResult();
|
||||||
}
|
}
|
||||||
@ -894,11 +893,11 @@ public int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, IntPtr pvDa
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool IsClanPublicDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate bool IsClanPublicDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private IsClanPublicDelegate IsClanPublicDelegatePointer;
|
private IsClanPublicDelegate IsClanPublicDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool IsClanPublic( CSteamID steamIDClan )
|
public bool IsClanPublic( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return IsClanPublicDelegatePointer( Self, steamIDClan );
|
return IsClanPublicDelegatePointer( Self, steamIDClan );
|
||||||
}
|
}
|
||||||
@ -906,11 +905,11 @@ public bool IsClanPublic( CSteamID steamIDClan )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool IsClanOfficialGameGroupDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate bool IsClanOfficialGameGroupDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private IsClanOfficialGameGroupDelegate IsClanOfficialGameGroupDelegatePointer;
|
private IsClanOfficialGameGroupDelegate IsClanOfficialGameGroupDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool IsClanOfficialGameGroup( CSteamID steamIDClan )
|
public bool IsClanOfficialGameGroup( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return IsClanOfficialGameGroupDelegatePointer( Self, steamIDClan );
|
return IsClanOfficialGameGroupDelegatePointer( Self, steamIDClan );
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
@ -178,13 +177,13 @@ public bool BSecure()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetSteamIDDelegate( IntPtr self, ref CSteamID retVal );
|
public delegate void GetSteamIDDelegate( IntPtr self, ref SteamId retVal );
|
||||||
private GetSteamIDDelegate GetSteamIDDelegatePointer;
|
private GetSteamIDDelegate GetSteamIDDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetSteamID()
|
public SteamId GetSteamID()
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetSteamIDDelegatePointer( Self, ref retVal );
|
GetSteamIDDelegatePointer( Self, ref retVal );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
@ -336,35 +335,35 @@ public void SetRegion( string pszRegion )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool SendUserConnectAndAuthenticateDelegate( IntPtr self, uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref CSteamID pSteamIDUser );
|
public delegate bool SendUserConnectAndAuthenticateDelegate( IntPtr self, uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser );
|
||||||
private SendUserConnectAndAuthenticateDelegate SendUserConnectAndAuthenticateDelegatePointer;
|
private SendUserConnectAndAuthenticateDelegate SendUserConnectAndAuthenticateDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool SendUserConnectAndAuthenticate( uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref CSteamID pSteamIDUser )
|
public bool SendUserConnectAndAuthenticate( uint unIPClient, IntPtr pvAuthBlob, uint cubAuthBlobSize, ref SteamId pSteamIDUser )
|
||||||
{
|
{
|
||||||
return SendUserConnectAndAuthenticateDelegatePointer( Self, unIPClient, pvAuthBlob, cubAuthBlobSize, ref pSteamIDUser );
|
return SendUserConnectAndAuthenticateDelegatePointer( Self, unIPClient, pvAuthBlob, cubAuthBlobSize, ref pSteamIDUser );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void CreateUnauthenticatedUserConnectionDelegate( IntPtr self, ref CSteamID retVal );
|
public delegate void CreateUnauthenticatedUserConnectionDelegate( IntPtr self, ref SteamId retVal );
|
||||||
private CreateUnauthenticatedUserConnectionDelegate CreateUnauthenticatedUserConnectionDelegatePointer;
|
private CreateUnauthenticatedUserConnectionDelegate CreateUnauthenticatedUserConnectionDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID CreateUnauthenticatedUserConnection()
|
public SteamId CreateUnauthenticatedUserConnection()
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
CreateUnauthenticatedUserConnectionDelegatePointer( Self, ref retVal );
|
CreateUnauthenticatedUserConnectionDelegatePointer( Self, ref retVal );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void SendUserDisconnectDelegate( IntPtr self, CSteamID steamIDUser );
|
public delegate void SendUserDisconnectDelegate( IntPtr self, SteamId steamIDUser );
|
||||||
private SendUserDisconnectDelegate SendUserDisconnectDelegatePointer;
|
private SendUserDisconnectDelegate SendUserDisconnectDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void SendUserDisconnect( CSteamID steamIDUser )
|
public void SendUserDisconnect( SteamId steamIDUser )
|
||||||
{
|
{
|
||||||
SendUserDisconnectDelegatePointer( Self, steamIDUser );
|
SendUserDisconnectDelegatePointer( Self, steamIDUser );
|
||||||
}
|
}
|
||||||
@ -372,11 +371,11 @@ public void SendUserDisconnect( CSteamID steamIDUser )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool BUpdateUserDataDelegate( IntPtr self, CSteamID steamIDUser, string pchPlayerName, uint uScore );
|
public delegate bool BUpdateUserDataDelegate( IntPtr self, SteamId steamIDUser, string pchPlayerName, uint uScore );
|
||||||
private BUpdateUserDataDelegate BUpdateUserDataDelegatePointer;
|
private BUpdateUserDataDelegate BUpdateUserDataDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool BUpdateUserData( CSteamID steamIDUser, string pchPlayerName, uint uScore )
|
public bool BUpdateUserData( SteamId steamIDUser, string pchPlayerName, uint uScore )
|
||||||
{
|
{
|
||||||
return BUpdateUserDataDelegatePointer( Self, steamIDUser, pchPlayerName, uScore );
|
return BUpdateUserDataDelegatePointer( Self, steamIDUser, pchPlayerName, uScore );
|
||||||
}
|
}
|
||||||
@ -394,22 +393,22 @@ public HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref ui
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate BeginAuthSessionResult BeginAuthSessionDelegate( IntPtr self, IntPtr pAuthTicket, int cbAuthTicket, CSteamID steamID );
|
public delegate BeginAuthSessionResult BeginAuthSessionDelegate( IntPtr self, IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID );
|
||||||
private BeginAuthSessionDelegate BeginAuthSessionDelegatePointer;
|
private BeginAuthSessionDelegate BeginAuthSessionDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public BeginAuthSessionResult BeginAuthSession( IntPtr pAuthTicket, int cbAuthTicket, CSteamID steamID )
|
public BeginAuthSessionResult BeginAuthSession( IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID )
|
||||||
{
|
{
|
||||||
return BeginAuthSessionDelegatePointer( Self, pAuthTicket, cbAuthTicket, steamID );
|
return BeginAuthSessionDelegatePointer( Self, pAuthTicket, cbAuthTicket, steamID );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void EndAuthSessionDelegate( IntPtr self, CSteamID steamID );
|
public delegate void EndAuthSessionDelegate( IntPtr self, SteamId steamID );
|
||||||
private EndAuthSessionDelegate EndAuthSessionDelegatePointer;
|
private EndAuthSessionDelegate EndAuthSessionDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void EndAuthSession( CSteamID steamID )
|
public void EndAuthSession( SteamId steamID )
|
||||||
{
|
{
|
||||||
EndAuthSessionDelegatePointer( Self, steamID );
|
EndAuthSessionDelegatePointer( Self, steamID );
|
||||||
}
|
}
|
||||||
@ -427,11 +426,11 @@ public void CancelAuthTicket( HAuthTicket hAuthTicket )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate UserHasLicenseForAppResult UserHasLicenseForAppDelegate( IntPtr self, CSteamID steamID, AppId_t appID );
|
public delegate UserHasLicenseForAppResult UserHasLicenseForAppDelegate( IntPtr self, SteamId steamID, AppId_t appID );
|
||||||
private UserHasLicenseForAppDelegate UserHasLicenseForAppDelegatePointer;
|
private UserHasLicenseForAppDelegate UserHasLicenseForAppDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public UserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID )
|
public UserHasLicenseForAppResult UserHasLicenseForApp( SteamId steamID, AppId_t appID )
|
||||||
{
|
{
|
||||||
return UserHasLicenseForAppDelegatePointer( Self, steamID, appID );
|
return UserHasLicenseForAppDelegatePointer( Self, steamID, appID );
|
||||||
}
|
}
|
||||||
@ -439,11 +438,11 @@ public UserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
public delegate bool RequestUserGroupStatusDelegate( IntPtr self, CSteamID steamIDUser, CSteamID steamIDGroup );
|
public delegate bool RequestUserGroupStatusDelegate( IntPtr self, SteamId steamIDUser, SteamId steamIDGroup );
|
||||||
private RequestUserGroupStatusDelegate RequestUserGroupStatusDelegatePointer;
|
private RequestUserGroupStatusDelegate RequestUserGroupStatusDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public bool RequestUserGroupStatus( CSteamID steamIDUser, CSteamID steamIDGroup )
|
public bool RequestUserGroupStatus( SteamId steamIDUser, SteamId steamIDGroup )
|
||||||
{
|
{
|
||||||
return RequestUserGroupStatusDelegatePointer( Self, steamIDUser, steamIDGroup );
|
return RequestUserGroupStatusDelegatePointer( Self, steamIDUser, steamIDGroup );
|
||||||
}
|
}
|
||||||
@ -539,22 +538,22 @@ public void ForceHeartbeat()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t AssociateWithClanDelegate( IntPtr self, CSteamID steamIDClan );
|
public delegate SteamAPICall_t AssociateWithClanDelegate( IntPtr self, SteamId steamIDClan );
|
||||||
private AssociateWithClanDelegate AssociateWithClanDelegatePointer;
|
private AssociateWithClanDelegate AssociateWithClanDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<AssociateWithClanResult_t?> AssociateWithClan( CSteamID steamIDClan )
|
public async Task<AssociateWithClanResult_t?> AssociateWithClan( SteamId steamIDClan )
|
||||||
{
|
{
|
||||||
return await (new Result<AssociateWithClanResult_t>( AssociateWithClanDelegatePointer( Self, steamIDClan ) )).GetResult();
|
return await (new Result<AssociateWithClanResult_t>( AssociateWithClanDelegatePointer( Self, steamIDClan ) )).GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate SteamAPICall_t ComputeNewPlayerCompatibilityDelegate( IntPtr self, CSteamID steamIDNewPlayer );
|
public delegate SteamAPICall_t ComputeNewPlayerCompatibilityDelegate( IntPtr self, SteamId steamIDNewPlayer );
|
||||||
private ComputeNewPlayerCompatibilityDelegate ComputeNewPlayerCompatibilityDelegatePointer;
|
private ComputeNewPlayerCompatibilityDelegate ComputeNewPlayerCompatibilityDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public async Task<ComputeNewPlayerCompatibilityResult_t?> ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer )
|
public async Task<ComputeNewPlayerCompatibilityResult_t?> ComputeNewPlayerCompatibility( SteamId steamIDNewPlayer )
|
||||||
{
|
{
|
||||||
return await (new Result<ComputeNewPlayerCompatibilityResult_t>( ComputeNewPlayerCompatibilityDelegatePointer( Self, steamIDNewPlayer ) )).GetResult();
|
return await (new Result<ComputeNewPlayerCompatibilityResult_t>( ComputeNewPlayerCompatibilityDelegatePointer( Self, steamIDNewPlayer ) )).GetResult();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
@ -74,24 +73,24 @@ public bool BLoggedOn()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void GetSteamIDDelegate( IntPtr self, ref CSteamID retVal );
|
public delegate void GetSteamIDDelegate( IntPtr self, ref SteamId retVal );
|
||||||
private GetSteamIDDelegate GetSteamIDDelegatePointer;
|
private GetSteamIDDelegate GetSteamIDDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public CSteamID GetSteamID()
|
public SteamId GetSteamID()
|
||||||
{
|
{
|
||||||
var retVal = default( CSteamID );
|
var retVal = default( SteamId );
|
||||||
GetSteamIDDelegatePointer( Self, ref retVal );
|
GetSteamIDDelegatePointer( Self, ref retVal );
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate int InitiateGameConnectionDelegate( IntPtr self, IntPtr pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure );
|
public delegate int InitiateGameConnectionDelegate( IntPtr self, IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure );
|
||||||
private InitiateGameConnectionDelegate InitiateGameConnectionDelegatePointer;
|
private InitiateGameConnectionDelegate InitiateGameConnectionDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public int InitiateGameConnection( IntPtr pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure )
|
public int InitiateGameConnection( IntPtr pAuthBlob, int cbMaxAuthBlob, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer, [MarshalAs( UnmanagedType.U1 )] bool bSecure )
|
||||||
{
|
{
|
||||||
return InitiateGameConnectionDelegatePointer( Self, pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure );
|
return InitiateGameConnectionDelegatePointer( Self, pAuthBlob, cbMaxAuthBlob, steamIDGameServer, unIPServer, usPortServer, bSecure );
|
||||||
}
|
}
|
||||||
@ -109,11 +108,11 @@ public void TerminateGameConnection( uint unIPServer, ushort usPortServer )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void TrackAppUsageEventDelegate( IntPtr self, CGameID gameID, int eAppUsageEvent, string pchExtraInfo );
|
public delegate void TrackAppUsageEventDelegate( IntPtr self, GameId gameID, int eAppUsageEvent, string pchExtraInfo );
|
||||||
private TrackAppUsageEventDelegate TrackAppUsageEventDelegatePointer;
|
private TrackAppUsageEventDelegate TrackAppUsageEventDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, string pchExtraInfo )
|
public void TrackAppUsageEvent( GameId gameID, int eAppUsageEvent, string pchExtraInfo )
|
||||||
{
|
{
|
||||||
TrackAppUsageEventDelegatePointer( Self, gameID, eAppUsageEvent, pchExtraInfo );
|
TrackAppUsageEventDelegatePointer( Self, gameID, eAppUsageEvent, pchExtraInfo );
|
||||||
}
|
}
|
||||||
@ -209,22 +208,22 @@ public HAuthTicket GetAuthSessionTicket( IntPtr pTicket, int cbMaxTicket, ref ui
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate BeginAuthSessionResult BeginAuthSessionDelegate( IntPtr self, IntPtr pAuthTicket, int cbAuthTicket, CSteamID steamID );
|
public delegate BeginAuthSessionResult BeginAuthSessionDelegate( IntPtr self, IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID );
|
||||||
private BeginAuthSessionDelegate BeginAuthSessionDelegatePointer;
|
private BeginAuthSessionDelegate BeginAuthSessionDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public BeginAuthSessionResult BeginAuthSession( IntPtr pAuthTicket, int cbAuthTicket, CSteamID steamID )
|
public BeginAuthSessionResult BeginAuthSession( IntPtr pAuthTicket, int cbAuthTicket, SteamId steamID )
|
||||||
{
|
{
|
||||||
return BeginAuthSessionDelegatePointer( Self, pAuthTicket, cbAuthTicket, steamID );
|
return BeginAuthSessionDelegatePointer( Self, pAuthTicket, cbAuthTicket, steamID );
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void EndAuthSessionDelegate( IntPtr self, CSteamID steamID );
|
public delegate void EndAuthSessionDelegate( IntPtr self, SteamId steamID );
|
||||||
private EndAuthSessionDelegate EndAuthSessionDelegatePointer;
|
private EndAuthSessionDelegate EndAuthSessionDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void EndAuthSession( CSteamID steamID )
|
public void EndAuthSession( SteamId steamID )
|
||||||
{
|
{
|
||||||
EndAuthSessionDelegatePointer( Self, steamID );
|
EndAuthSessionDelegatePointer( Self, steamID );
|
||||||
}
|
}
|
||||||
@ -242,11 +241,11 @@ public void CancelAuthTicket( HAuthTicket hAuthTicket )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate UserHasLicenseForAppResult UserHasLicenseForAppDelegate( IntPtr self, CSteamID steamID, AppId_t appID );
|
public delegate UserHasLicenseForAppResult UserHasLicenseForAppDelegate( IntPtr self, SteamId steamID, AppId_t appID );
|
||||||
private UserHasLicenseForAppDelegate UserHasLicenseForAppDelegatePointer;
|
private UserHasLicenseForAppDelegate UserHasLicenseForAppDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public UserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID )
|
public UserHasLicenseForAppResult UserHasLicenseForApp( SteamId steamID, AppId_t appID )
|
||||||
{
|
{
|
||||||
return UserHasLicenseForAppDelegatePointer( Self, steamID, appID );
|
return UserHasLicenseForAppDelegatePointer( Self, steamID, appID );
|
||||||
}
|
}
|
||||||
@ -265,11 +264,11 @@ public bool BIsBehindNAT()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
public delegate void AdvertiseGameDelegate( IntPtr self, CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer );
|
public delegate void AdvertiseGameDelegate( IntPtr self, SteamId steamIDGameServer, uint unIPServer, ushort usPortServer );
|
||||||
private AdvertiseGameDelegate AdvertiseGameDelegatePointer;
|
private AdvertiseGameDelegate AdvertiseGameDelegatePointer;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public void AdvertiseGame( CSteamID steamIDGameServer, uint unIPServer, ushort usPortServer )
|
public void AdvertiseGame( SteamId steamIDGameServer, uint unIPServer, ushort usPortServer )
|
||||||
{
|
{
|
||||||
AdvertiseGameDelegatePointer( Self, steamIDGameServer, unIPServer, usPortServer );
|
AdvertiseGameDelegatePointer( Self, steamIDGameServer, unIPServer, usPortServer );
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Steamworks.Internal
|
namespace Steamworks.Internal
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SteamNative
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
internal static class CallbackIdentifiers
|
internal static class CallbackIdentifiers
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SteamNative
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// EUniverse
|
// EUniverse
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace SteamNative
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
public struct GID_t
|
public struct GID_t
|
||||||
{
|
{
|
||||||
@ -754,34 +754,4 @@ public static implicit operator ulong( SteamInventoryUpdateHandle_t value )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct CGameID
|
|
||||||
{
|
|
||||||
public ulong Value;
|
|
||||||
|
|
||||||
public static implicit operator CGameID( ulong value )
|
|
||||||
{
|
|
||||||
return new CGameID(){ Value = value };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator ulong( CGameID value )
|
|
||||||
{
|
|
||||||
return value.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct CSteamID
|
|
||||||
{
|
|
||||||
public ulong Value;
|
|
||||||
|
|
||||||
public static implicit operator CSteamID( ulong value )
|
|
||||||
{
|
|
||||||
return new CSteamID(){ Value = value };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator ulong( CSteamID value )
|
|
||||||
{
|
|
||||||
return value.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,384 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Inventory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An item definition. This describes an item in your Steam inventory, but is
|
|
||||||
/// not unique to that item. For example, this might be a tshirt, but you might be able to own
|
|
||||||
/// multiple tshirts.
|
|
||||||
/// </summary>
|
|
||||||
public class Definition
|
|
||||||
{
|
|
||||||
internal Inventory inventory;
|
|
||||||
|
|
||||||
public int Id { get; private set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// URL to an image specified by the schema, else empty
|
|
||||||
/// </summary>
|
|
||||||
public string IconUrl { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// URL to an image specified by the schema, else empty
|
|
||||||
/// </summary>
|
|
||||||
public string IconLargeUrl { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Type can be whatever the schema defines.
|
|
||||||
/// </summary>
|
|
||||||
public string Type { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If this item can be created using other items this string will contain a comma seperated
|
|
||||||
/// list of definition ids that can be used, ie "100,101;102x5;103x3,104x3"
|
|
||||||
/// </summary>
|
|
||||||
public string ExchangeSchema { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of recepies for creating this item. Can be null if none.
|
|
||||||
/// </summary>
|
|
||||||
public Recipe[] Recipes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of recepies we're included in
|
|
||||||
/// </summary>
|
|
||||||
public Recipe[] IngredientFor { get; set; }
|
|
||||||
|
|
||||||
public DateTime Created { get; set; }
|
|
||||||
public DateTime Modified { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The raw contents of price_category from the schema
|
|
||||||
/// </summary>
|
|
||||||
public string PriceCategory { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The dollar price from PriceRaw
|
|
||||||
/// </summary>
|
|
||||||
public double PriceDollars { get; internal set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The price in the local player's currency. The local player's currency
|
|
||||||
/// is available in Invetory.Currency
|
|
||||||
/// </summary>
|
|
||||||
public double LocalPrice { get; internal set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Local Price but probably how you want to display it (ie, $3.99, £1.99 etc )
|
|
||||||
/// </summary>
|
|
||||||
public string LocalPriceFormatted { get; internal set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if this item can be sold on the marketplace
|
|
||||||
/// </summary>
|
|
||||||
public bool Marketable { get; set; }
|
|
||||||
|
|
||||||
public bool IsGenerator
|
|
||||||
{
|
|
||||||
get { return Type == "generator"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<string, string> customProperties;
|
|
||||||
|
|
||||||
internal Definition( Inventory i, int id )
|
|
||||||
{
|
|
||||||
inventory = i;
|
|
||||||
Id = id;
|
|
||||||
|
|
||||||
SetupCommonProperties();
|
|
||||||
UpdatePrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If you're manually occupying the Definition (because maybe you're on a server
|
|
||||||
/// and want to hack around the fact that definitions aren't presented to you),
|
|
||||||
/// you can use this to set propertis.
|
|
||||||
/// </summary>
|
|
||||||
public void SetProperty( string name, string value )
|
|
||||||
{
|
|
||||||
if ( customProperties == null )
|
|
||||||
customProperties = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
if ( !customProperties.ContainsKey( name ) )
|
|
||||||
customProperties.Add( name, value );
|
|
||||||
else
|
|
||||||
customProperties[name] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read a raw property from the definition schema
|
|
||||||
/// </summary>
|
|
||||||
public T GetProperty<T>( string name )
|
|
||||||
{
|
|
||||||
string val = GetStringProperty( name );
|
|
||||||
|
|
||||||
if ( string.IsNullOrEmpty( val ) )
|
|
||||||
return default( T );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return (T)Convert.ChangeType( val, typeof( T ) );
|
|
||||||
}
|
|
||||||
catch ( System.Exception )
|
|
||||||
{
|
|
||||||
return default( T );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read a raw property from the definition schema
|
|
||||||
/// </summary>
|
|
||||||
public string GetStringProperty( string name )
|
|
||||||
{
|
|
||||||
string val = string.Empty;
|
|
||||||
|
|
||||||
if ( customProperties != null && customProperties.ContainsKey( name ) )
|
|
||||||
return customProperties[name];
|
|
||||||
|
|
||||||
if ( !inventory.inventory.GetItemDefinitionProperty( Id, name, out val ) )
|
|
||||||
return string.Empty;
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read and cache a raw property from the definition schema to make accessing it faster in the future
|
|
||||||
/// </summary>
|
|
||||||
public string GetCachedStringProperty( string name )
|
|
||||||
{
|
|
||||||
string val = string.Empty;
|
|
||||||
|
|
||||||
if ( customProperties == null )
|
|
||||||
customProperties = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
if ( !customProperties.TryGetValue( name, out val ) )
|
|
||||||
{
|
|
||||||
inventory.inventory.GetItemDefinitionProperty( Id, name, out val );
|
|
||||||
customProperties.Add( name, val );
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read a raw property from the definition schema
|
|
||||||
/// </summary>
|
|
||||||
public bool GetBoolProperty( string name )
|
|
||||||
{
|
|
||||||
string val = GetStringProperty( name );
|
|
||||||
|
|
||||||
if ( val.Length == 0 ) return false;
|
|
||||||
if ( val[0] == '0' || val[0] == 'F'|| val[0] == 'f' ) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetupCommonProperties()
|
|
||||||
{
|
|
||||||
Name = GetStringProperty( "name" );
|
|
||||||
Description = GetStringProperty( "description" );
|
|
||||||
Created = GetProperty<DateTime>( "timestamp" );
|
|
||||||
Modified = GetProperty<DateTime>( "modified" );
|
|
||||||
ExchangeSchema = GetStringProperty( "exchange" );
|
|
||||||
IconUrl = GetStringProperty( "icon_url" );
|
|
||||||
IconLargeUrl = GetStringProperty( "icon_url_large" );
|
|
||||||
Type = GetStringProperty( "type" );
|
|
||||||
PriceCategory = GetStringProperty( "price_category" );
|
|
||||||
Marketable = GetBoolProperty( "marketable" );
|
|
||||||
|
|
||||||
if ( !string.IsNullOrEmpty( PriceCategory ) )
|
|
||||||
{
|
|
||||||
PriceDollars = PriceCategoryToFloat( PriceCategory );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Trigger an item drop. Call this when it's a good time to award
|
|
||||||
/// an item drop to a player. This won't automatically result in giving
|
|
||||||
/// an item to a player. Just call it every minute or so, or on launch.
|
|
||||||
/// ItemDefinition is usually a generator
|
|
||||||
/// </summary>
|
|
||||||
public void TriggerItemDrop()
|
|
||||||
{
|
|
||||||
inventory.TriggerItemDrop( Id );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Trigger a promo item drop. You can call this at startup, it won't
|
|
||||||
/// give users multiple promo drops.
|
|
||||||
/// </summary>
|
|
||||||
public void TriggerPromoDrop()
|
|
||||||
{
|
|
||||||
inventory.TriggerPromoDrop( Id );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Link( Definition[] definitions )
|
|
||||||
{
|
|
||||||
LinkExchange( definitions );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LinkExchange( Definition[] definitions )
|
|
||||||
{
|
|
||||||
if ( string.IsNullOrEmpty( ExchangeSchema ) ) return;
|
|
||||||
|
|
||||||
var parts = ExchangeSchema.Split( new[] { ';' }, StringSplitOptions.RemoveEmptyEntries );
|
|
||||||
|
|
||||||
Recipes = parts.Select( x => Recipe.FromString( x, definitions, this ) ).ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void InRecipe( Recipe r )
|
|
||||||
{
|
|
||||||
if ( IngredientFor == null )
|
|
||||||
IngredientFor = new Recipe[0];
|
|
||||||
|
|
||||||
var list = new List<Recipe>( IngredientFor );
|
|
||||||
list.Add( r );
|
|
||||||
|
|
||||||
IngredientFor = list.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void UpdatePrice()
|
|
||||||
{
|
|
||||||
if ( inventory.inventory.GetItemPrice( Id, out ulong price, out ulong basePrice ) )
|
|
||||||
{
|
|
||||||
LocalPrice = price / 100.0;
|
|
||||||
LocalPriceFormatted = Utility.FormatPrice( inventory.Currency, price );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LocalPrice = 0;
|
|
||||||
LocalPriceFormatted = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Trigger a promo item drop. You can call this at startup, it won't
|
|
||||||
/// give users multiple promo drops.
|
|
||||||
/// </summary>
|
|
||||||
public void TriggerPromoDrop( int definitionId )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t result = 0;
|
|
||||||
inventory.AddPromoItem( ref result, definitionId );
|
|
||||||
inventory.DestroyResult( result );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Trigger an item drop for this user. This is for timed drops. For promo
|
|
||||||
/// drops use TriggerPromoDrop.
|
|
||||||
/// </summary>
|
|
||||||
public void TriggerItemDrop( int definitionId )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t result = 0;
|
|
||||||
inventory.TriggerItemDrop( ref result, definitionId );
|
|
||||||
inventory.DestroyResult( result );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Grant all promotional items the user is eligible for.
|
|
||||||
/// </summary>
|
|
||||||
public void GrantAllPromoItems()
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t result = 0;
|
|
||||||
inventory.GrantPromoItems( ref result );
|
|
||||||
inventory.DestroyResult( result );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a crafting recepie which was defined using the exchange
|
|
||||||
/// section in the item schema.
|
|
||||||
/// </summary>
|
|
||||||
public struct Recipe
|
|
||||||
{
|
|
||||||
public struct Ingredient
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The definition ID of the ingredient.
|
|
||||||
/// </summary>
|
|
||||||
public int DefinitionId;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If we don't know about this item definition this might be null.
|
|
||||||
/// In which case, DefinitionId should still hold the correct id.
|
|
||||||
/// </summary>
|
|
||||||
public Definition Definition;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The amount of this item needed. Generally this will be 1.
|
|
||||||
/// </summary>
|
|
||||||
public int Count;
|
|
||||||
|
|
||||||
internal static Ingredient FromString( string part, Definition[] definitions )
|
|
||||||
{
|
|
||||||
var i = new Ingredient();
|
|
||||||
i.Count = 1;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( part.Contains( 'x' ) )
|
|
||||||
{
|
|
||||||
var idx = part.IndexOf( 'x' );
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
if ( int.TryParse( part.Substring( idx + 1 ), out count ) )
|
|
||||||
i.Count = count;
|
|
||||||
|
|
||||||
part = part.Substring( 0, idx );
|
|
||||||
}
|
|
||||||
|
|
||||||
i.DefinitionId = int.Parse( part );
|
|
||||||
i.Definition = definitions.FirstOrDefault( x => x.Id == i.DefinitionId );
|
|
||||||
|
|
||||||
}
|
|
||||||
catch ( System.Exception )
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The item that this will create.
|
|
||||||
/// </summary>
|
|
||||||
public Definition Result;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The items, with quantity required to create this item.
|
|
||||||
/// </summary>
|
|
||||||
public Ingredient[] Ingredients;
|
|
||||||
|
|
||||||
internal static Recipe FromString( string part, Definition[] definitions, Definition Result )
|
|
||||||
{
|
|
||||||
var r = new Recipe();
|
|
||||||
r.Result = Result;
|
|
||||||
var parts = part.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries );
|
|
||||||
|
|
||||||
r.Ingredients = parts.Select( x => Ingredient.FromString( x, definitions ) ).Where( x => x.DefinitionId != 0 ).ToArray();
|
|
||||||
|
|
||||||
foreach ( var i in r.Ingredients )
|
|
||||||
{
|
|
||||||
if ( i.Definition == null )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
i.Definition.InRecipe( r );
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,183 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Inventory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An item in your inventory.
|
|
||||||
/// </summary>
|
|
||||||
public class Item : IEquatable<Item>
|
|
||||||
{
|
|
||||||
internal Item( Inventory Inventory, ulong Id, int Quantity, int DefinitionId )
|
|
||||||
{
|
|
||||||
this.Inventory = Inventory;
|
|
||||||
this.Id = Id;
|
|
||||||
this.Quantity = Quantity;
|
|
||||||
this.DefinitionId = DefinitionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct Amount
|
|
||||||
{
|
|
||||||
public Item Item;
|
|
||||||
public int Quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong Id;
|
|
||||||
public int Quantity;
|
|
||||||
|
|
||||||
public int DefinitionId;
|
|
||||||
|
|
||||||
internal Inventory Inventory;
|
|
||||||
|
|
||||||
public Dictionary<string, string> Properties { get; internal set; }
|
|
||||||
|
|
||||||
private Definition _cachedDefinition;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Careful, this might not be available. Especially on a game server.
|
|
||||||
/// </summary>
|
|
||||||
public Definition Definition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _cachedDefinition != null )
|
|
||||||
return _cachedDefinition;
|
|
||||||
|
|
||||||
_cachedDefinition = Inventory.FindDefinition( DefinitionId );
|
|
||||||
return _cachedDefinition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TradeLocked;
|
|
||||||
|
|
||||||
public bool Equals(Item other)
|
|
||||||
{
|
|
||||||
if (ReferenceEquals(null, other)) return false;
|
|
||||||
if (ReferenceEquals(this, other)) return true;
|
|
||||||
return Id == other.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
if (ReferenceEquals(null, obj)) return false;
|
|
||||||
if (ReferenceEquals(this, obj)) return true;
|
|
||||||
if (obj.GetType() != this.GetType()) return false;
|
|
||||||
return Equals((Item)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return Id.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator ==(Item left, Item right)
|
|
||||||
{
|
|
||||||
return Equals(left, right);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator !=(Item left, Item right)
|
|
||||||
{
|
|
||||||
return !Equals(left, right);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed.
|
|
||||||
/// Once an item is removed it cannot be recovered.This is not for the faint of heart - if your game implements item removal at all,
|
|
||||||
/// a high-friction UI confirmation process is highly recommended.ConsumeItem can be restricted to certain item definitions or fully
|
|
||||||
/// blocked via the Steamworks website to minimize support/abuse issues such as the classic "my brother borrowed my laptop and deleted all of my rare items".
|
|
||||||
/// </summary>
|
|
||||||
public Result Consume( int amount = 1 )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
if ( !Inventory.inventory.ConsumeItem( ref resultHandle, Id, (uint)amount ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Result( Inventory, resultHandle, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Split stack into two items
|
|
||||||
/// </summary>
|
|
||||||
public Result SplitStack( int quantity = 1 )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
if ( !Inventory.inventory.TransferItemQuantity( ref resultHandle, Id, (uint)quantity, ulong.MaxValue ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Result( Inventory, resultHandle, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
SteamNative.SteamInventoryUpdateHandle_t updateHandle;
|
|
||||||
|
|
||||||
private void UpdatingProperties()
|
|
||||||
{
|
|
||||||
if (!Inventory.EnableItemProperties)
|
|
||||||
throw new InvalidOperationException("Item properties are disabled.");
|
|
||||||
|
|
||||||
if (updateHandle != 0) return;
|
|
||||||
|
|
||||||
updateHandle = Inventory.inventory.StartUpdateProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetProperty( string name, string value )
|
|
||||||
{
|
|
||||||
UpdatingProperties();
|
|
||||||
Properties[name] = value.ToString();
|
|
||||||
return Inventory.inventory.SetProperty(updateHandle, Id, name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetProperty(string name, bool value)
|
|
||||||
{
|
|
||||||
UpdatingProperties();
|
|
||||||
Properties[name] = value.ToString();
|
|
||||||
return Inventory.inventory.SetProperty0(updateHandle, Id, name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetProperty(string name, long value)
|
|
||||||
{
|
|
||||||
UpdatingProperties();
|
|
||||||
Properties[name] = value.ToString();
|
|
||||||
return Inventory.inventory.SetProperty1(updateHandle, Id, name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetProperty(string name, float value)
|
|
||||||
{
|
|
||||||
UpdatingProperties();
|
|
||||||
Properties[name] = value.ToString();
|
|
||||||
return Inventory.inventory.SetProperty2(updateHandle, Id, name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called to finalize any changes made using SetProperty
|
|
||||||
/// </summary>
|
|
||||||
public bool SubmitProperties()
|
|
||||||
{
|
|
||||||
if (updateHandle == 0)
|
|
||||||
throw new Exception("SubmitProperties called without updating properties");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t result = -1;
|
|
||||||
|
|
||||||
if (!Inventory.inventory.SubmitUpdateProperties(updateHandle, ref result))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Inventory.inventory.DestroyResult(result);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
updateHandle = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,216 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Inventory
|
|
||||||
{
|
|
||||||
public class Result : IDisposable
|
|
||||||
{
|
|
||||||
internal static Dictionary< int, Result > Pending;
|
|
||||||
internal Inventory inventory;
|
|
||||||
|
|
||||||
private SteamNative.SteamInventoryResult_t Handle { get; set; } = -1;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when result is successfully returned
|
|
||||||
/// </summary>
|
|
||||||
public Action<Result> OnResult;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Items that exist, or that have been created, or changed
|
|
||||||
/// </summary>
|
|
||||||
public Item[] Items { get; internal set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Items that have been removed or somehow destroyed
|
|
||||||
/// </summary>
|
|
||||||
public Item[] Removed { get; internal set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Items that have been consumed, like in a craft or something
|
|
||||||
/// </summary>
|
|
||||||
public Item[] Consumed { get; internal set; }
|
|
||||||
|
|
||||||
protected bool _gotResult = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if this result is still pending
|
|
||||||
/// </summary>
|
|
||||||
public bool IsPending
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _gotResult ) return false;
|
|
||||||
|
|
||||||
if ( Status() == Callbacks.Result.OK )
|
|
||||||
{
|
|
||||||
Fill();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status() == Callbacks.Result.Pending;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal uint Timestamp { get; private set; }
|
|
||||||
|
|
||||||
internal bool IsSuccess
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( Items != null ) return true;
|
|
||||||
if ( Handle == -1 ) return false;
|
|
||||||
return Status() == Callbacks.Result.OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Callbacks.Result Status()
|
|
||||||
{
|
|
||||||
if ( Handle == -1 ) return Callbacks.Result.InvalidParam;
|
|
||||||
return (Callbacks.Result)inventory.inventory.GetResultStatus( Handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Result( Inventory inventory, int Handle, bool pending )
|
|
||||||
{
|
|
||||||
if ( pending )
|
|
||||||
{
|
|
||||||
Pending.Add( Handle, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Handle = Handle;
|
|
||||||
this.inventory = inventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal void Fill()
|
|
||||||
{
|
|
||||||
if ( _gotResult )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( Items != null )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( Status() != Callbacks.Result.OK )
|
|
||||||
return;
|
|
||||||
|
|
||||||
_gotResult = true;
|
|
||||||
|
|
||||||
Timestamp = inventory.inventory.GetResultTimestamp( Handle );
|
|
||||||
|
|
||||||
SteamNative.SteamItemDetails_t[] steamItems = inventory.inventory.GetResultItems( Handle );
|
|
||||||
|
|
||||||
if ( steamItems == null )
|
|
||||||
return;
|
|
||||||
|
|
||||||
var tempItems = new List<Item>();
|
|
||||||
var tempRemoved = new List<Item>();
|
|
||||||
var tempConsumed = new List<Item>();
|
|
||||||
|
|
||||||
for ( int i=0; i< steamItems.Length; i++ )
|
|
||||||
{
|
|
||||||
var item = inventory.ItemFrom( Handle, steamItems[i], i );
|
|
||||||
if ( item == null )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ( steamItems[i].Flags & (int)SteamNative.SteamItemFlags.Removed ) != 0 )
|
|
||||||
{
|
|
||||||
tempRemoved.Add(item);
|
|
||||||
}
|
|
||||||
else if ((steamItems[i].Flags & (int)SteamNative.SteamItemFlags.Consumed) != 0)
|
|
||||||
{
|
|
||||||
tempConsumed.Add(item);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tempItems.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Items = tempItems.ToArray();
|
|
||||||
Removed = tempRemoved.ToArray();
|
|
||||||
Consumed = tempConsumed.ToArray();
|
|
||||||
|
|
||||||
if ( OnResult != null )
|
|
||||||
{
|
|
||||||
OnResult( this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void OnSteamResult( SteamInventoryResultReady_t data )
|
|
||||||
{
|
|
||||||
var success = data.Result == SteamNative.Result.OK;
|
|
||||||
|
|
||||||
if ( success )
|
|
||||||
{
|
|
||||||
Fill();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal unsafe byte[] Serialize()
|
|
||||||
{
|
|
||||||
uint size = 0;
|
|
||||||
|
|
||||||
if ( !inventory.inventory.SerializeResult( Handle, IntPtr.Zero, out size ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var data = new byte[size];
|
|
||||||
|
|
||||||
fixed ( byte* ptr = data )
|
|
||||||
{
|
|
||||||
if ( !inventory.inventory.SerializeResult( Handle, (IntPtr)ptr, out size ) )
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
if ( Handle != -1 && inventory != null )
|
|
||||||
{
|
|
||||||
inventory.inventory.DestroyResult( Handle );
|
|
||||||
Handle = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
inventory = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Item ItemFrom( SteamInventoryResult_t handle, SteamItemDetails_t detail, int index )
|
|
||||||
{
|
|
||||||
Dictionary<string, string> props = null;
|
|
||||||
|
|
||||||
if ( EnableItemProperties && inventory.GetResultItemProperty(handle, (uint) index, null, out string propertyNames) )
|
|
||||||
{
|
|
||||||
props = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
foreach ( var propertyName in propertyNames.Split( ',' ) )
|
|
||||||
{
|
|
||||||
if ( inventory.GetResultItemProperty(handle, (uint)index, propertyName, out string propertyValue ) )
|
|
||||||
{
|
|
||||||
if (propertyName == "error")
|
|
||||||
{
|
|
||||||
Console.Write("Steam item error: ");
|
|
||||||
Console.WriteLine(propertyValue);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
props.Add(propertyName, propertyValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var item = new Item( this, detail.ItemId, detail.Quantity, detail.Definition );
|
|
||||||
item.Properties = props;
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,487 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Inventory : IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the local client's items are first retrieved, and when they change.
|
|
||||||
/// Obviously not called on the server.
|
|
||||||
/// </summary>
|
|
||||||
public event Action OnUpdate;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of items owned by this user. You should call Refresh() before trying to access this,
|
|
||||||
/// and then wait until it's non null or listen to OnUpdate to find out immediately when it's populated.
|
|
||||||
/// </summary>
|
|
||||||
public Item[] Items;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// You can send this data to a server, or another player who can then deserialize it
|
|
||||||
/// and get a verified list of items.
|
|
||||||
/// </summary>
|
|
||||||
public byte[] SerializedItems;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serialized data exprires after an hour. This is the time the value in SerializedItems will expire.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime SerializedExpireTime;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Controls whether per-item properties (<see cref="Item.Properties"/>) are available or not. Default true.
|
|
||||||
/// This can improve performance of full inventory updates.
|
|
||||||
/// </summary>
|
|
||||||
public bool EnableItemProperties = true;
|
|
||||||
|
|
||||||
internal uint LastTimestamp = 0;
|
|
||||||
|
|
||||||
internal SteamNative.SteamInventory inventory;
|
|
||||||
|
|
||||||
private bool IsServer { get; set; }
|
|
||||||
|
|
||||||
public event Action OnDefinitionsUpdated;
|
|
||||||
|
|
||||||
public event Action<Result> OnInventoryResultReady;
|
|
||||||
|
|
||||||
internal Inventory( BaseSteamworks steamworks, SteamNative.SteamInventory c, bool server )
|
|
||||||
{
|
|
||||||
IsServer = server;
|
|
||||||
inventory = c;
|
|
||||||
|
|
||||||
steamworks.RegisterCallback<SteamNative.SteamInventoryDefinitionUpdate_t>( onDefinitionsUpdated );
|
|
||||||
|
|
||||||
Result.Pending = new Dictionary<int, Result>();
|
|
||||||
|
|
||||||
FetchItemDefinitions();
|
|
||||||
LoadDefinitions();
|
|
||||||
UpdatePrices();
|
|
||||||
|
|
||||||
if ( !server )
|
|
||||||
{
|
|
||||||
steamworks.RegisterCallback<SteamNative.SteamInventoryResultReady_t>( onResultReady );
|
|
||||||
steamworks.RegisterCallback<SteamNative.SteamInventoryFullUpdate_t>( onFullUpdate );
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get a list of our items immediately
|
|
||||||
//
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Should get called when the definitions get updated from Steam.
|
|
||||||
/// </summary>
|
|
||||||
private void onDefinitionsUpdated( SteamInventoryDefinitionUpdate_t obj )
|
|
||||||
{
|
|
||||||
LoadDefinitions();
|
|
||||||
UpdatePrices();
|
|
||||||
|
|
||||||
if ( OnDefinitionsUpdated != null )
|
|
||||||
{
|
|
||||||
OnDefinitionsUpdated.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool LoadDefinitions()
|
|
||||||
{
|
|
||||||
var ids = inventory.GetItemDefinitionIDs();
|
|
||||||
if ( ids == null )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Definitions = ids.Select( x => CreateDefinition( x ) ).ToArray();
|
|
||||||
|
|
||||||
foreach ( var def in Definitions )
|
|
||||||
{
|
|
||||||
def.Link( Definitions );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// We've received a FULL update
|
|
||||||
/// </summary>
|
|
||||||
private void onFullUpdate( SteamInventoryFullUpdate_t data )
|
|
||||||
{
|
|
||||||
var result = new Result( this, data.Handle, false );
|
|
||||||
result.Fill();
|
|
||||||
|
|
||||||
onResult( result, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A generic result has returned.
|
|
||||||
/// </summary>
|
|
||||||
private void onResultReady( SteamInventoryResultReady_t data )
|
|
||||||
{
|
|
||||||
Result result;
|
|
||||||
if ( Result.Pending.TryGetValue( data.Handle, out result ) )
|
|
||||||
{
|
|
||||||
result.OnSteamResult( data );
|
|
||||||
|
|
||||||
if ( data.Result == SteamNative.Result.OK )
|
|
||||||
{
|
|
||||||
onResult( result, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
Result.Pending.Remove( data.Handle );
|
|
||||||
result.Dispose();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = new Result(this, data.Handle, false);
|
|
||||||
result.Fill();
|
|
||||||
}
|
|
||||||
|
|
||||||
OnInventoryResultReady?.Invoke(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onResult( Result r, bool isFullUpdate )
|
|
||||||
{
|
|
||||||
if ( r.IsSuccess )
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// We only serialize FULL updates
|
|
||||||
//
|
|
||||||
if ( isFullUpdate )
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Only serialize if this result is newer than the last one
|
|
||||||
//
|
|
||||||
if ( r.Timestamp < LastTimestamp )
|
|
||||||
return;
|
|
||||||
|
|
||||||
SerializedItems = r.Serialize();
|
|
||||||
SerializedExpireTime = DateTime.Now.Add( TimeSpan.FromMinutes( 60 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
LastTimestamp = r.Timestamp;
|
|
||||||
ApplyResult( r, isFullUpdate );
|
|
||||||
}
|
|
||||||
|
|
||||||
r.Dispose();
|
|
||||||
r = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Apply this result to our current stack of Items
|
|
||||||
/// Here we're trying to keep our stack up to date with whatever happens
|
|
||||||
/// with the crafting, stacking etc
|
|
||||||
/// </summary>
|
|
||||||
internal void ApplyResult( Result r, bool isFullUpdate )
|
|
||||||
{
|
|
||||||
if ( IsServer ) return;
|
|
||||||
|
|
||||||
if ( r.IsSuccess && r.Items != null )
|
|
||||||
{
|
|
||||||
if ( Items == null )
|
|
||||||
Items = new Item[0];
|
|
||||||
|
|
||||||
if (isFullUpdate)
|
|
||||||
{
|
|
||||||
Items = r.Items;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// keep the new item instance because it might have a different quantity, properties, etc
|
|
||||||
Items = Items
|
|
||||||
.UnionSelect(r.Items, (oldItem, newItem) => newItem)
|
|
||||||
.Where(x => !r.Removed.Contains(x))
|
|
||||||
.Where(x => !r.Consumed.Contains(x))
|
|
||||||
.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tell everyone we've got new items!
|
|
||||||
//
|
|
||||||
OnUpdate?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
inventory = null;
|
|
||||||
|
|
||||||
Items = null;
|
|
||||||
SerializedItems = null;
|
|
||||||
|
|
||||||
Result.Pending = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Call this at least every two minutes, every frame doesn't hurt.
|
|
||||||
/// You should call it when you consider it active play time.
|
|
||||||
/// IE - your player is alive, and playing.
|
|
||||||
/// Don't stress on it too much tho cuz it's super hijackable anyway.
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete( "No longer required, will be removed in a later version" )]
|
|
||||||
public void PlaytimeHeartbeat()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Call this to retrieve the items.
|
|
||||||
/// Note that if this has already been called it won't
|
|
||||||
/// trigger a call to OnUpdate unless the items have changed
|
|
||||||
/// </summary>
|
|
||||||
public void Refresh()
|
|
||||||
{
|
|
||||||
if ( IsServer ) return;
|
|
||||||
|
|
||||||
SteamNative.SteamInventoryResult_t request = 0;
|
|
||||||
if ( !inventory.GetAllItems( ref request ) || request == -1 )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "GetAllItems failed!?" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Some definitions aren't sent to the client, and all aren't available on the server.
|
|
||||||
/// Manually getting a Definition here lets you call functions on those definitions.
|
|
||||||
/// </summary>
|
|
||||||
public Definition CreateDefinition( int id )
|
|
||||||
{
|
|
||||||
return new Definition( this, id );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fetch item definitions in case new ones have been added since we've initialized
|
|
||||||
/// </summary>
|
|
||||||
public void FetchItemDefinitions()
|
|
||||||
{
|
|
||||||
inventory.LoadItemDefinitions();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// No need to call this manually if you're calling Update
|
|
||||||
/// </summary>
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of items defined for this app.
|
|
||||||
/// This should be immediately populated and available.
|
|
||||||
/// </summary>
|
|
||||||
public Definition[] Definitions;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of item definitions that have prices and so can be bought.
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<Definition> DefinitionsWithPrices
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( Definitions == null )
|
|
||||||
yield break;
|
|
||||||
|
|
||||||
for ( int i=0; i< Definitions.Length; i++ )
|
|
||||||
{
|
|
||||||
if (Definitions[i].LocalPrice > 0)
|
|
||||||
yield return Definitions[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Utility, given a "1;VLV250" string, convert it to a 2.5
|
|
||||||
/// </summary>
|
|
||||||
public static float PriceCategoryToFloat( string price )
|
|
||||||
{
|
|
||||||
if ( string.IsNullOrEmpty( price ) )
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
price = price.Replace( "1;VLV", "" );
|
|
||||||
|
|
||||||
int iPrice = 0;
|
|
||||||
if ( !int.TryParse( price, out iPrice ) )
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
return int.Parse( price ) / 100.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// We might be better off using a dictionary for this, once there's 1000+ definitions
|
|
||||||
/// </summary>
|
|
||||||
public Definition FindDefinition( int DefinitionId )
|
|
||||||
{
|
|
||||||
if ( Definitions == null ) return null;
|
|
||||||
|
|
||||||
for( int i=0; i< Definitions.Length; i++ )
|
|
||||||
{
|
|
||||||
if ( Definitions[i].Id == DefinitionId )
|
|
||||||
return Definitions[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe Result Deserialize( byte[] data, int dataLength = -1 )
|
|
||||||
{
|
|
||||||
if (data == null)
|
|
||||||
throw new ArgumentException("data should nto be null");
|
|
||||||
|
|
||||||
if ( dataLength == -1 )
|
|
||||||
dataLength = data.Length;
|
|
||||||
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
|
|
||||||
fixed ( byte* ptr = data )
|
|
||||||
{
|
|
||||||
var result = inventory.DeserializeResult( ref resultHandle, (IntPtr) ptr, (uint)dataLength, false );
|
|
||||||
if ( !result || resultHandle == -1 )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var r = new Result( this, resultHandle, false );
|
|
||||||
r.Fill();
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Crafting! Uses the passed items to buy the target item.
|
|
||||||
/// You need to have set up the appropriate exchange rules in your item
|
|
||||||
/// definitions. This assumes all the items passed in aren't stacked.
|
|
||||||
/// </summary>
|
|
||||||
public Result CraftItem( Item[] list, Definition target )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
|
|
||||||
var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t() { Value = target.Id } };
|
|
||||||
var newItemC = new uint[] { 1 };
|
|
||||||
|
|
||||||
var takeItems = list.Select( x => (SteamNative.SteamItemInstanceID_t)x.Id ).ToArray();
|
|
||||||
var takeItemsC = list.Select( x => (uint)1 ).ToArray();
|
|
||||||
|
|
||||||
if ( !inventory.ExchangeItems( ref resultHandle, newItems, newItemC, 1, takeItems, takeItemsC, (uint)takeItems.Length ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Result( this, resultHandle, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Crafting! Uses the passed items to buy the target item.
|
|
||||||
/// You need to have set up the appropriate exchange rules in your item
|
|
||||||
/// definitions.
|
|
||||||
/// </summary>
|
|
||||||
public Result CraftItem( Item.Amount[] list, Definition target )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
|
|
||||||
var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t() { Value = target.Id } };
|
|
||||||
var newItemC = new uint[] { 1 };
|
|
||||||
|
|
||||||
var takeItems = list.Select( x => (SteamNative.SteamItemInstanceID_t)x.Item.Id ).ToArray();
|
|
||||||
var takeItemsC = list.Select( x => (uint)x.Quantity ).ToArray();
|
|
||||||
|
|
||||||
if ( !inventory.ExchangeItems( ref resultHandle, newItems, newItemC, 1, takeItems, takeItemsC, (uint)takeItems.Length ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Result( this, resultHandle, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Split stack into two items
|
|
||||||
/// </summary>
|
|
||||||
public Result SplitStack( Item item, int quantity = 1 )
|
|
||||||
{
|
|
||||||
return item.SplitStack( quantity );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stack source item onto dest item
|
|
||||||
/// </summary>
|
|
||||||
public Result Stack( Item source, Item dest, int quantity = 1 )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
if ( !inventory.TransferItemQuantity( ref resultHandle, source.Id, (uint)quantity, dest.Id ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Result( this, resultHandle, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This is used to grant a specific item to the user. This should
|
|
||||||
/// only be used for development prototyping, from a trusted server,
|
|
||||||
/// or if you don't care about hacked clients granting arbitrary items.
|
|
||||||
/// This call can be disabled by a setting on Steamworks.
|
|
||||||
/// </summary>
|
|
||||||
public Result GenerateItem( Definition target, int amount )
|
|
||||||
{
|
|
||||||
SteamNative.SteamInventoryResult_t resultHandle = -1;
|
|
||||||
|
|
||||||
var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t() { Value = target.Id } };
|
|
||||||
var newItemC = new uint[] { (uint) amount };
|
|
||||||
|
|
||||||
if ( !inventory.GenerateItems( ref resultHandle, newItems, newItemC, 1 ) )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new Result( this, resultHandle, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void StartPurchaseSuccess( ulong orderId, ulong transactionId );
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Starts the purchase process for the user, given a "shopping cart" of item definitions that the user would like to buy.
|
|
||||||
/// The user will be prompted in the Steam Overlay to complete the purchase in their local currency, funding their Steam Wallet if necessary, etc.
|
|
||||||
///
|
|
||||||
/// If was succesful the callback orderId and transactionId will be non 0
|
|
||||||
/// </summary>
|
|
||||||
public bool StartPurchase( Definition[] items, StartPurchaseSuccess callback = null )
|
|
||||||
{
|
|
||||||
var itemGroup = items.GroupBy(x => x.Id);
|
|
||||||
|
|
||||||
var newItems = itemGroup.Select( x => new SteamItemDef_t { Value = x.Key } ).ToArray();
|
|
||||||
var newItemC = itemGroup.Select( x => (uint) x.Count() ).ToArray();
|
|
||||||
|
|
||||||
var h = inventory.StartPurchase( newItems, newItemC, (uint) newItemC.Length, ( result, error ) =>
|
|
||||||
{
|
|
||||||
if ( error )
|
|
||||||
{
|
|
||||||
callback?.Invoke(0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callback?.Invoke(result.OrderID, result.TransID);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return h != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This might be null until Steam has actually recieved the prices.
|
|
||||||
/// </summary>
|
|
||||||
public string Currency { get; private set; }
|
|
||||||
|
|
||||||
public void UpdatePrices()
|
|
||||||
{
|
|
||||||
if (IsServer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
inventory.RequestPrices((result, b) =>
|
|
||||||
{
|
|
||||||
Currency = result.Currency;
|
|
||||||
|
|
||||||
if ( Definitions == null )
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < Definitions.Length; i++)
|
|
||||||
{
|
|
||||||
Definitions[i].UpdatePrice();
|
|
||||||
}
|
|
||||||
|
|
||||||
OnUpdate?.Invoke();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,199 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public class Networking : IDisposable
|
|
||||||
{
|
|
||||||
private static byte[] ReceiveBuffer = new byte[1024 * 64];
|
|
||||||
|
|
||||||
public delegate void OnRecievedP2PData( ulong steamid, byte[] data, int dataLength, int channel );
|
|
||||||
|
|
||||||
public OnRecievedP2PData OnP2PData;
|
|
||||||
public Func<ulong, bool> OnIncomingConnection;
|
|
||||||
public Action<ulong, SessionError> OnConnectionFailed;
|
|
||||||
|
|
||||||
private List<int> ListenChannels = new List<int>();
|
|
||||||
|
|
||||||
private System.Diagnostics.Stopwatch UpdateTimer = System.Diagnostics.Stopwatch.StartNew();
|
|
||||||
|
|
||||||
internal SteamNative.SteamNetworking networking;
|
|
||||||
|
|
||||||
internal Networking( BaseSteamworks steamworks, SteamNative.SteamNetworking networking )
|
|
||||||
{
|
|
||||||
this.networking = networking;
|
|
||||||
|
|
||||||
steamworks.RegisterCallback<SteamNative.P2PSessionRequest_t>( onP2PConnectionRequest );
|
|
||||||
steamworks.RegisterCallback<SteamNative.P2PSessionConnectFail_t>( onP2PConnectionFailed );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
networking = null;
|
|
||||||
|
|
||||||
OnIncomingConnection = null;
|
|
||||||
OnConnectionFailed = null;
|
|
||||||
OnP2PData = null;
|
|
||||||
ListenChannels.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// No need to call this manually if you're calling Update()
|
|
||||||
/// </summary>
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
if ( OnP2PData == null )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Update every 60th of a second
|
|
||||||
if ( UpdateTimer.Elapsed.TotalSeconds < 1.0 / 60.0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
UpdateTimer.Reset();
|
|
||||||
UpdateTimer.Start();
|
|
||||||
|
|
||||||
foreach ( var channel in ListenChannels )
|
|
||||||
{
|
|
||||||
while ( ReadP2PPacket( channel ) )
|
|
||||||
{
|
|
||||||
// Nothing Here.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Enable or disable listening on a specific channel.
|
|
||||||
/// If you donp't enable the channel we won't listen to it,
|
|
||||||
/// so you won't be able to receive messages on it.
|
|
||||||
/// </summary>
|
|
||||||
public void SetListenChannel( int ChannelId, bool Listen )
|
|
||||||
{
|
|
||||||
ListenChannels.RemoveAll( x => x == ChannelId );
|
|
||||||
|
|
||||||
if ( Listen )
|
|
||||||
{
|
|
||||||
ListenChannels.Add( ChannelId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onP2PConnectionRequest( SteamNative.P2PSessionRequest_t o )
|
|
||||||
{
|
|
||||||
if ( OnIncomingConnection != null )
|
|
||||||
{
|
|
||||||
var accept = OnIncomingConnection( o.SteamIDRemote );
|
|
||||||
|
|
||||||
if ( accept )
|
|
||||||
{
|
|
||||||
networking.AcceptP2PSessionWithUser( o.SteamIDRemote );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
networking.CloseP2PSessionWithUser( o.SteamIDRemote );
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Default is to reject the session
|
|
||||||
//
|
|
||||||
networking.CloseP2PSessionWithUser( o.SteamIDRemote );
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SessionError : byte
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
NotRunningApp = 1, // target is not running the same game
|
|
||||||
NoRightsToApp = 2, // local user doesn't own the app that is running
|
|
||||||
DestinationNotLoggedIn = 3, // target user isn't connected to Steam
|
|
||||||
Timeout = 4, // target isn't responding, perhaps not calling AcceptP2PSessionWithUser()
|
|
||||||
// corporate firewalls can also block this (NAT traversal is not firewall traversal)
|
|
||||||
// make sure that UDP ports 3478, 4379, and 4380 are open in an outbound direction
|
|
||||||
Max = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
private void onP2PConnectionFailed( SteamNative.P2PSessionConnectFail_t o )
|
|
||||||
{
|
|
||||||
if ( OnConnectionFailed != null )
|
|
||||||
{
|
|
||||||
OnConnectionFailed( o.SteamIDRemote, (SessionError) o.P2PSessionError );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum SendType : int
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare).
|
|
||||||
/// The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or
|
|
||||||
/// there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again.
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
Unreliable = 0,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first
|
|
||||||
/// packet sent to a remote host almost guarantees the packet will be dropped.
|
|
||||||
/// This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets
|
|
||||||
/// </summary>
|
|
||||||
UnreliableNoDelay = 1,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reliable message send. Can send up to 1MB of data in a single message.
|
|
||||||
/// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for efficient sends of large chunks of data.
|
|
||||||
/// </summary>
|
|
||||||
Reliable = 2,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// As above, but applies the Nagle algorithm to the send - sends will accumulate
|
|
||||||
/// until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm).
|
|
||||||
/// Useful if you want to send a set of smaller messages but have the coalesced into a single packet
|
|
||||||
/// Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then
|
|
||||||
/// do a normal k_EP2PSendReliable to force all the buffered data to be sent.
|
|
||||||
/// </summary>
|
|
||||||
ReliableWithBuffering = 3,
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe bool SendP2PPacket( ulong steamid, byte[] data, int length, SendType eP2PSendType = SendType.Reliable, int nChannel = 0 )
|
|
||||||
{
|
|
||||||
fixed ( byte* p = data )
|
|
||||||
{
|
|
||||||
return networking.SendP2PPacket( steamid, (IntPtr) p, (uint)length, (SteamNative.P2PSend)(int)eP2PSendType, nChannel );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe bool ReadP2PPacket( int channel )
|
|
||||||
{
|
|
||||||
uint DataAvailable = 0;
|
|
||||||
|
|
||||||
if ( !networking.IsP2PPacketAvailable( out DataAvailable, channel ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( ReceiveBuffer.Length < DataAvailable )
|
|
||||||
ReceiveBuffer = new byte[ DataAvailable + 1024 ];
|
|
||||||
|
|
||||||
fixed ( byte* p = ReceiveBuffer )
|
|
||||||
{
|
|
||||||
SteamNative.CSteamID steamid = 1;
|
|
||||||
if ( !networking.ReadP2PPacket( (IntPtr)p, DataAvailable, out DataAvailable, out steamid, channel ) || DataAvailable == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
OnP2PData?.Invoke( steamid, ReceiveBuffer, (int) DataAvailable, channel );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This should be called when you're done communicating with a user, as this will free up all of the resources allocated for the connection under-the-hood.
|
|
||||||
/// If the remote user tries to send data to you again, a new onP2PConnectionRequest callback will be posted.
|
|
||||||
/// </summary>
|
|
||||||
public bool CloseSession( ulong steamId )
|
|
||||||
{
|
|
||||||
return networking.CloseP2PSessionWithUser( steamId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,238 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using SteamNative;
|
|
||||||
using Result = Facepunch.Steamworks.Callbacks.Result;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Workshop
|
|
||||||
{
|
|
||||||
public class Editor
|
|
||||||
{
|
|
||||||
internal Workshop workshop;
|
|
||||||
|
|
||||||
internal CallbackHandle CreateItem;
|
|
||||||
internal CallbackHandle SubmitItemUpdate;
|
|
||||||
internal SteamNative.UGCUpdateHandle_t UpdateHandle;
|
|
||||||
|
|
||||||
public ulong Id { get; internal set; }
|
|
||||||
public string Title { get; set; } = null;
|
|
||||||
public string Description { get; set; } = null;
|
|
||||||
public string Folder { get; set; } = null;
|
|
||||||
public string PreviewImage { get; set; } = null;
|
|
||||||
public List<string> Tags { get; set; } = new List<string>();
|
|
||||||
public bool Publishing { get; internal set; }
|
|
||||||
public ItemType? Type { get; set; }
|
|
||||||
public string Error { get; internal set; } = null;
|
|
||||||
public string ChangeNote { get; set; } = "";
|
|
||||||
public uint WorkshopUploadAppId { get; set; }
|
|
||||||
public string MetaData { get; set; } = null;
|
|
||||||
public Dictionary<string, string[]> KeyValues { get; set; } = new Dictionary<string, string[]>();
|
|
||||||
|
|
||||||
public enum VisibilityType : int
|
|
||||||
{
|
|
||||||
Public = 0,
|
|
||||||
FriendsOnly = 1,
|
|
||||||
Private = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
public VisibilityType ? Visibility { get; set; }
|
|
||||||
|
|
||||||
public bool NeedToAgreeToWorkshopLegal { get; internal set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when published changes have finished being submitted.
|
|
||||||
/// </summary>
|
|
||||||
public event Action<Result> OnChangesSubmitted;
|
|
||||||
|
|
||||||
public double Progress
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var bt = BytesTotal;
|
|
||||||
if (bt == 0) return 0;
|
|
||||||
|
|
||||||
return (double)BytesUploaded / (double)bt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int bytesUploaded = 0;
|
|
||||||
|
|
||||||
public int BytesUploaded
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( !Publishing ) return bytesUploaded;
|
|
||||||
if (UpdateHandle == 0) return bytesUploaded;
|
|
||||||
|
|
||||||
ulong b = 0;
|
|
||||||
ulong t = 0;
|
|
||||||
|
|
||||||
workshop.steamworks.native.ugc.GetItemUpdateProgress( UpdateHandle, out b, out t );
|
|
||||||
bytesUploaded = Math.Max( bytesUploaded, (int) b );
|
|
||||||
return (int)bytesUploaded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int bytesTotal = 0;
|
|
||||||
|
|
||||||
public int BytesTotal
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( !Publishing ) return bytesTotal;
|
|
||||||
if (UpdateHandle == 0 ) return bytesTotal;
|
|
||||||
|
|
||||||
ulong b = 0;
|
|
||||||
ulong t = 0;
|
|
||||||
|
|
||||||
workshop.steamworks.native.ugc.GetItemUpdateProgress( UpdateHandle, out b, out t );
|
|
||||||
bytesTotal = Math.Max(bytesTotal, (int)t);
|
|
||||||
return (int)bytesTotal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Publish()
|
|
||||||
{
|
|
||||||
bytesUploaded = 0;
|
|
||||||
bytesTotal = 0;
|
|
||||||
|
|
||||||
Publishing = true;
|
|
||||||
Error = null;
|
|
||||||
|
|
||||||
if ( Id == 0 )
|
|
||||||
{
|
|
||||||
StartCreatingItem();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PublishChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StartCreatingItem()
|
|
||||||
{
|
|
||||||
if ( !Type.HasValue )
|
|
||||||
throw new System.Exception( "Editor.Type must be set when creating a new item!" );
|
|
||||||
|
|
||||||
if ( WorkshopUploadAppId == 0 )
|
|
||||||
throw new Exception( "WorkshopUploadAppId should not be 0" );
|
|
||||||
|
|
||||||
CreateItem = workshop.ugc.CreateItem( WorkshopUploadAppId, (SteamNative.WorkshopFileType)(uint)Type, OnItemCreated );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnItemCreated( SteamNative.CreateItemResult_t obj, bool Failed )
|
|
||||||
{
|
|
||||||
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
|
|
||||||
CreateItem.Dispose();
|
|
||||||
CreateItem = null;
|
|
||||||
|
|
||||||
if ( obj.Result == SteamNative.Result.OK && !Failed )
|
|
||||||
{
|
|
||||||
Error = null;
|
|
||||||
Id = obj.PublishedFileId;
|
|
||||||
PublishChanges();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Error = $"Error creating new file: {obj.Result} ({obj.PublishedFileId})";
|
|
||||||
Publishing = false;
|
|
||||||
|
|
||||||
OnChangesSubmitted?.Invoke( (Result) obj.Result );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PublishChanges()
|
|
||||||
{
|
|
||||||
if ( WorkshopUploadAppId == 0 )
|
|
||||||
throw new Exception( "WorkshopUploadAppId should not be 0" );
|
|
||||||
|
|
||||||
UpdateHandle = workshop.ugc.StartItemUpdate(WorkshopUploadAppId, Id );
|
|
||||||
|
|
||||||
if ( Title != null )
|
|
||||||
workshop.ugc.SetItemTitle( UpdateHandle, Title );
|
|
||||||
|
|
||||||
if ( Description != null )
|
|
||||||
workshop.ugc.SetItemDescription( UpdateHandle, Description );
|
|
||||||
|
|
||||||
if ( Folder != null )
|
|
||||||
{
|
|
||||||
var info = new System.IO.DirectoryInfo( Folder );
|
|
||||||
|
|
||||||
if ( !info.Exists )
|
|
||||||
throw new System.Exception( $"Folder doesn't exist ({Folder})" );
|
|
||||||
|
|
||||||
workshop.ugc.SetItemContent( UpdateHandle, Folder );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( Tags != null && Tags.Count > 0 )
|
|
||||||
workshop.ugc.SetItemTags( UpdateHandle, Tags.ToArray() );
|
|
||||||
|
|
||||||
if ( Visibility.HasValue )
|
|
||||||
workshop.ugc.SetItemVisibility( UpdateHandle, (SteamNative.RemoteStoragePublishedFileVisibility)(uint)Visibility.Value );
|
|
||||||
|
|
||||||
if ( PreviewImage != null )
|
|
||||||
{
|
|
||||||
var info = new System.IO.FileInfo( PreviewImage );
|
|
||||||
|
|
||||||
if ( !info.Exists )
|
|
||||||
throw new System.Exception( $"PreviewImage doesn't exist ({PreviewImage})" );
|
|
||||||
|
|
||||||
if ( info.Length >= 1024 * 1024 )
|
|
||||||
throw new System.Exception( $"PreviewImage should be under 1MB ({info.Length})" );
|
|
||||||
|
|
||||||
workshop.ugc.SetItemPreview( UpdateHandle, PreviewImage );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( MetaData != null )
|
|
||||||
{
|
|
||||||
workshop.ugc.SetItemMetadata( UpdateHandle, MetaData );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( KeyValues != null )
|
|
||||||
{
|
|
||||||
foreach ( var key in KeyValues )
|
|
||||||
{
|
|
||||||
foreach ( var value in key.Value )
|
|
||||||
{
|
|
||||||
workshop.ugc.AddItemKeyValueTag( UpdateHandle, key.Key, value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
workshop.ugc.SetItemUpdateLanguage( UpdateId, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
|
|
||||||
workshop.ugc.RemoveItemKeyValueTags( UpdateId, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
|
|
||||||
workshop.ugc.AddItemPreviewFile( UpdateId, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
|
||||||
workshop.ugc.AddItemPreviewVideo( UpdateId, const char *pszVideoID ) = 0; // add preview video for this item
|
|
||||||
workshop.ugc.UpdateItemPreviewFile( UpdateId, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
|
||||||
workshop.ugc.UpdateItemPreviewVideo( UpdateId, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
|
|
||||||
workshop.ugc.RemoveItemPreview( UpdateId, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
|
|
||||||
*/
|
|
||||||
|
|
||||||
SubmitItemUpdate = workshop.ugc.SubmitItemUpdate( UpdateHandle, ChangeNote, OnChangesSubmittedInternal );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnChangesSubmittedInternal( SteamNative.SubmitItemUpdateResult_t obj, bool Failed )
|
|
||||||
{
|
|
||||||
if ( Failed )
|
|
||||||
throw new System.Exception( "CreateItemResult_t Failed" );
|
|
||||||
|
|
||||||
UpdateHandle = 0;
|
|
||||||
SubmitItemUpdate = null;
|
|
||||||
NeedToAgreeToWorkshopLegal = obj.UserNeedsToAcceptWorkshopLegalAgreement;
|
|
||||||
Publishing = false;
|
|
||||||
|
|
||||||
Error = obj.Result != SteamNative.Result.OK
|
|
||||||
? $"Error publishing changes: {obj.Result} ({NeedToAgreeToWorkshopLegal})"
|
|
||||||
: null;
|
|
||||||
|
|
||||||
OnChangesSubmitted?.Invoke( (Result) obj.Result );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Delete()
|
|
||||||
{
|
|
||||||
workshop.ugc.DeleteItem( Id );
|
|
||||||
Id = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,233 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Workshop
|
|
||||||
{
|
|
||||||
public class Item
|
|
||||||
{
|
|
||||||
internal Workshop workshop;
|
|
||||||
|
|
||||||
public string Description { get; private set; }
|
|
||||||
public ulong Id { get; private set; }
|
|
||||||
public ulong OwnerId { get; private set; }
|
|
||||||
public float Score { get; private set; }
|
|
||||||
public string[] Tags { get; private set; }
|
|
||||||
public string Title { get; private set; }
|
|
||||||
public uint VotesDown { get; private set; }
|
|
||||||
public uint VotesUp { get; private set; }
|
|
||||||
public DateTime Modified { get; private set; }
|
|
||||||
public DateTime Created { get; private set; }
|
|
||||||
|
|
||||||
public Item( ulong Id, Workshop workshop )
|
|
||||||
{
|
|
||||||
this.Id = Id;
|
|
||||||
this.workshop = workshop;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Item From( SteamNative.SteamUGCDetails_t details, Workshop workshop )
|
|
||||||
{
|
|
||||||
var item = new Item( details.PublishedFileId, workshop);
|
|
||||||
|
|
||||||
item.Title = details.Title;
|
|
||||||
item.Description = details.Description;
|
|
||||||
item.OwnerId = details.SteamIDOwner;
|
|
||||||
item.Tags = details.Tags.Split( ',' ).Select( x=> x.ToLower() ).ToArray();
|
|
||||||
item.Score = details.Score;
|
|
||||||
item.VotesUp = details.VotesUp;
|
|
||||||
item.VotesDown = details.VotesDown;
|
|
||||||
item.Modified = Utility.Epoch.ToDateTime( details.TimeUpdated );
|
|
||||||
item.Created = Utility.Epoch.ToDateTime( details.TimeCreated );
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Download( bool highPriority = true )
|
|
||||||
{
|
|
||||||
if ( Installed ) return true;
|
|
||||||
if ( Downloading ) return true;
|
|
||||||
|
|
||||||
if ( !workshop.ugc.DownloadItem( Id, highPriority ) )
|
|
||||||
{
|
|
||||||
Console.WriteLine( "Download Failed" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
workshop.OnFileDownloaded += OnFileDownloaded;
|
|
||||||
workshop.OnItemInstalled += OnItemInstalled;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Subscribe()
|
|
||||||
{
|
|
||||||
workshop.ugc.SubscribeItem(Id);
|
|
||||||
SubscriptionCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UnSubscribe()
|
|
||||||
{
|
|
||||||
workshop.ugc.UnsubscribeItem(Id);
|
|
||||||
SubscriptionCount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void OnFileDownloaded( ulong fileid, Callbacks.Result result )
|
|
||||||
{
|
|
||||||
if ( fileid != Id ) return;
|
|
||||||
|
|
||||||
workshop.OnFileDownloaded -= OnFileDownloaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnItemInstalled( ulong fileid )
|
|
||||||
{
|
|
||||||
if ( fileid != Id ) return;
|
|
||||||
|
|
||||||
workshop.OnItemInstalled -= OnItemInstalled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong BytesDownloaded { get { UpdateDownloadProgress(); return _BytesDownloaded; } }
|
|
||||||
public ulong BytesTotalDownload { get { UpdateDownloadProgress(); return _BytesTotal; } }
|
|
||||||
|
|
||||||
public double DownloadProgress
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
UpdateDownloadProgress();
|
|
||||||
if ( _BytesTotal == 0 ) return 0;
|
|
||||||
return (double)_BytesDownloaded / (double)_BytesTotal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Installed { get { return ( State & ItemState.Installed ) != 0; } }
|
|
||||||
public bool Downloading { get { return ( State & ItemState.Downloading ) != 0; } }
|
|
||||||
public bool DownloadPending { get { return ( State & ItemState.DownloadPending ) != 0; } }
|
|
||||||
public bool Subscribed { get { return ( State & ItemState.Subscribed ) != 0; } }
|
|
||||||
public bool NeedsUpdate { get { return ( State & ItemState.NeedsUpdate ) != 0; } }
|
|
||||||
|
|
||||||
private SteamNative.ItemState State { get { return ( SteamNative.ItemState) workshop.ugc.GetItemState( Id ); } }
|
|
||||||
|
|
||||||
|
|
||||||
private DirectoryInfo _directory;
|
|
||||||
|
|
||||||
public DirectoryInfo Directory
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _directory != null )
|
|
||||||
return _directory;
|
|
||||||
|
|
||||||
if ( !Installed )
|
|
||||||
return null;
|
|
||||||
|
|
||||||
ulong sizeOnDisk;
|
|
||||||
string folder;
|
|
||||||
uint timestamp;
|
|
||||||
|
|
||||||
if ( workshop.ugc.GetItemInstallInfo( Id, out sizeOnDisk, out folder, out timestamp ) )
|
|
||||||
{
|
|
||||||
_directory = new DirectoryInfo( folder );
|
|
||||||
Size = sizeOnDisk;
|
|
||||||
|
|
||||||
if ( !_directory.Exists )
|
|
||||||
{
|
|
||||||
// Size = 0;
|
|
||||||
// _directory = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _directory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong Size { get; private set; }
|
|
||||||
|
|
||||||
private ulong _BytesDownloaded, _BytesTotal;
|
|
||||||
|
|
||||||
internal void UpdateDownloadProgress()
|
|
||||||
{
|
|
||||||
workshop.ugc.GetItemDownloadInfo( Id, out _BytesDownloaded, out _BytesTotal );
|
|
||||||
}
|
|
||||||
|
|
||||||
private int YourVote = 0;
|
|
||||||
|
|
||||||
|
|
||||||
public void VoteUp()
|
|
||||||
{
|
|
||||||
if ( YourVote == 1 ) return;
|
|
||||||
if ( YourVote == -1 ) VotesDown--;
|
|
||||||
|
|
||||||
VotesUp++;
|
|
||||||
workshop.ugc.SetUserItemVote( Id, true );
|
|
||||||
YourVote = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void VoteDown()
|
|
||||||
{
|
|
||||||
if ( YourVote == -1 ) return;
|
|
||||||
if ( YourVote == 1 ) VotesUp--;
|
|
||||||
|
|
||||||
VotesDown++;
|
|
||||||
workshop.ugc.SetUserItemVote( Id, false );
|
|
||||||
YourVote = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Editor Edit()
|
|
||||||
{
|
|
||||||
return workshop.EditItem( Id );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return a URL to view this item online
|
|
||||||
/// </summary>
|
|
||||||
public string Url { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/?source=Facepunch.Steamworks&id={0}", Id ); } }
|
|
||||||
|
|
||||||
public string ChangelogUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/changelog/{0}", Id ); } }
|
|
||||||
|
|
||||||
public string CommentsUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/comments/{0}", Id ); } }
|
|
||||||
|
|
||||||
public string DiscussUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/discussions/{0}", Id ); } }
|
|
||||||
|
|
||||||
public string StartsUrl { get { return string.Format( "http://steamcommunity.com/sharedfiles/filedetails/stats/{0}", Id ); } }
|
|
||||||
|
|
||||||
public int SubscriptionCount { get; internal set; }
|
|
||||||
public int FavouriteCount { get; internal set; }
|
|
||||||
public int FollowerCount { get; internal set; }
|
|
||||||
public int WebsiteViews { get; internal set; }
|
|
||||||
public int ReportScore { get; internal set; }
|
|
||||||
public string PreviewImageUrl { get; internal set; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
string _ownerName = null;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Friend OwnerName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _ownerName == null && workshop.friends != null )
|
|
||||||
{
|
|
||||||
_ownerName = workshop.friends.GetName( OwnerId );
|
|
||||||
if ( _ownerName == "[unknown]" )
|
|
||||||
{
|
|
||||||
_ownerName = null;
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( _ownerName == null )
|
|
||||||
return string.Empty;
|
|
||||||
|
|
||||||
return _ownerName;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,262 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public partial class Workshop
|
|
||||||
{
|
|
||||||
public class Query : IDisposable
|
|
||||||
{
|
|
||||||
internal const int SteamResponseSize = 50;
|
|
||||||
|
|
||||||
internal SteamNative.UGCQueryHandle_t Handle;
|
|
||||||
internal SteamNative.CallbackHandle Callback;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The AppId you're querying. This defaults to this appid.
|
|
||||||
/// </summary>
|
|
||||||
public uint AppId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The AppId of the app used to upload the item. This defaults to 0
|
|
||||||
/// which means all/any.
|
|
||||||
/// </summary>
|
|
||||||
public uint UploaderAppId { get; set; }
|
|
||||||
|
|
||||||
public QueryType QueryType { get; set; } = QueryType.Items;
|
|
||||||
public Order Order { get; set; } = Order.RankedByVote;
|
|
||||||
|
|
||||||
public string SearchText { get; set; }
|
|
||||||
|
|
||||||
public Item[] Items { get; set; }
|
|
||||||
|
|
||||||
public int TotalResults { get; set; }
|
|
||||||
|
|
||||||
public ulong? UserId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If order is RankedByTrend, this value represents how many days to take
|
|
||||||
/// into account.
|
|
||||||
/// </summary>
|
|
||||||
public int RankedByTrendDays { get; set; }
|
|
||||||
|
|
||||||
public UserQueryType UserQueryType { get; set; } = UserQueryType.Published;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the query finishes
|
|
||||||
/// </summary>
|
|
||||||
public Action<Query> OnResult;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Page starts at 1 !!
|
|
||||||
/// </summary>
|
|
||||||
public int Page { get; set; } = 1;
|
|
||||||
|
|
||||||
public int PerPage { get; set; } = SteamResponseSize;
|
|
||||||
|
|
||||||
internal Workshop workshop;
|
|
||||||
|
|
||||||
private int _resultPage = 0;
|
|
||||||
private int _resultsRemain = 0;
|
|
||||||
private int _resultSkip = 0;
|
|
||||||
private List<Item> _results;
|
|
||||||
|
|
||||||
public void Run()
|
|
||||||
{
|
|
||||||
if ( Callback != null )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( Page <= 0 )
|
|
||||||
throw new System.Exception( "Page should be 1 or above" );
|
|
||||||
|
|
||||||
var actualOffset = ((Page-1) * PerPage);
|
|
||||||
|
|
||||||
TotalResults = 0;
|
|
||||||
|
|
||||||
_resultSkip = actualOffset % SteamResponseSize;
|
|
||||||
_resultsRemain = PerPage;
|
|
||||||
_resultPage = (int) Math.Floor( (float) actualOffset / (float)SteamResponseSize );
|
|
||||||
_results = new List<Item>();
|
|
||||||
|
|
||||||
RunInternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe void RunInternal()
|
|
||||||
{
|
|
||||||
if ( FileId.Count != 0 )
|
|
||||||
{
|
|
||||||
var fileArray = FileId.Select( x => (SteamNative.PublishedFileId_t)x ).ToArray();
|
|
||||||
_resultsRemain = fileArray.Length;
|
|
||||||
|
|
||||||
Handle = workshop.ugc.CreateQueryUGCDetailsRequest( fileArray );
|
|
||||||
}
|
|
||||||
else if ( UserId.HasValue )
|
|
||||||
{
|
|
||||||
uint accountId = (uint)( UserId.Value & 0xFFFFFFFFul );
|
|
||||||
Handle = workshop.ugc.CreateQueryUserUGCRequest( accountId, (SteamNative.UserUGCList)( int)UserQueryType, (SteamNative.UGCMatchingUGCType)( int)QueryType, SteamNative.UserUGCListSortOrder.LastUpdatedDesc, UploaderAppId, AppId, (uint)_resultPage + 1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Handle = workshop.ugc.CreateQueryAllUGCRequest( (SteamNative.UGCQuery)(int)Order, (SteamNative.UGCMatchingUGCType)(int)QueryType, UploaderAppId, AppId, (uint)_resultPage + 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !string.IsNullOrEmpty( SearchText ) )
|
|
||||||
workshop.ugc.SetSearchText( Handle, SearchText );
|
|
||||||
|
|
||||||
foreach ( var tag in RequireTags )
|
|
||||||
workshop.ugc.AddRequiredTag( Handle, tag );
|
|
||||||
|
|
||||||
if ( RequireTags.Count > 0 )
|
|
||||||
workshop.ugc.SetMatchAnyTag( Handle, !RequireAllTags );
|
|
||||||
|
|
||||||
if ( RankedByTrendDays > 0 )
|
|
||||||
workshop.ugc.SetRankedByTrendDays( Handle, (uint) RankedByTrendDays );
|
|
||||||
|
|
||||||
foreach ( var tag in ExcludeTags )
|
|
||||||
workshop.ugc.AddExcludedTag( Handle, tag );
|
|
||||||
|
|
||||||
Callback = workshop.ugc.SendQueryUGCRequest( Handle, ResultCallback );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ResultCallback( SteamNative.SteamUGCQueryCompleted_t data, bool bFailed )
|
|
||||||
{
|
|
||||||
if ( bFailed )
|
|
||||||
throw new System.Exception( "bFailed!" );
|
|
||||||
|
|
||||||
var gotFiles = 0;
|
|
||||||
for ( int i = 0; i < data.NumResultsReturned; i++ )
|
|
||||||
{
|
|
||||||
if ( _resultSkip > 0 )
|
|
||||||
{
|
|
||||||
_resultSkip--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SteamNative.SteamUGCDetails_t details = new SteamNative.SteamUGCDetails_t();
|
|
||||||
if ( !workshop.ugc.GetQueryUGCResult( data.Handle, (uint)i, ref details ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// We already have this file, so skip it
|
|
||||||
if ( _results.Any( x => x.Id == details.PublishedFileId ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
var item = Item.From( details, workshop );
|
|
||||||
|
|
||||||
item.SubscriptionCount = GetStat( data.Handle, i, ItemStatistic.NumSubscriptions );
|
|
||||||
item.FavouriteCount = GetStat( data.Handle, i, ItemStatistic.NumFavorites );
|
|
||||||
item.FollowerCount = GetStat( data.Handle, i, ItemStatistic.NumFollowers );
|
|
||||||
item.WebsiteViews = GetStat( data.Handle, i, ItemStatistic.NumUniqueWebsiteViews );
|
|
||||||
item.ReportScore = GetStat( data.Handle, i, ItemStatistic.ReportScore );
|
|
||||||
|
|
||||||
string url = null;
|
|
||||||
if ( workshop.ugc.GetQueryUGCPreviewURL( data.Handle, (uint)i, out url ) )
|
|
||||||
item.PreviewImageUrl = url;
|
|
||||||
|
|
||||||
_results.Add( item );
|
|
||||||
|
|
||||||
_resultsRemain--;
|
|
||||||
gotFiles++;
|
|
||||||
|
|
||||||
if ( _resultsRemain <= 0 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
TotalResults = TotalResults > data.TotalMatchingResults ? TotalResults : (int)data.TotalMatchingResults;
|
|
||||||
|
|
||||||
Callback.Dispose();
|
|
||||||
Callback = null;
|
|
||||||
|
|
||||||
_resultPage++;
|
|
||||||
|
|
||||||
if ( _resultsRemain > 0 && gotFiles > 0 )
|
|
||||||
{
|
|
||||||
RunInternal();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Items = _results.ToArray();
|
|
||||||
|
|
||||||
if ( OnResult != null )
|
|
||||||
{
|
|
||||||
OnResult( this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetStat( ulong handle, int index, ItemStatistic stat )
|
|
||||||
{
|
|
||||||
ulong val = 0;
|
|
||||||
if ( !workshop.ugc.GetQueryUGCStatistic( handle, (uint)index, (SteamNative.ItemStatistic)(uint)stat, out val ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return (int) val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsRunning
|
|
||||||
{
|
|
||||||
get { return Callback != null; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only return items with these tags
|
|
||||||
/// </summary>
|
|
||||||
public List<string> RequireTags { get; set; } = new List<string>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If true, return items that have all RequireTags
|
|
||||||
/// If false, return items that have any tags in RequireTags
|
|
||||||
/// </summary>
|
|
||||||
public bool RequireAllTags { get; set; } = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Don't return any items with this tag
|
|
||||||
/// </summary>
|
|
||||||
public List<string> ExcludeTags { get; set; } = new List<string>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If you're querying for a particular file or files, add them to this.
|
|
||||||
/// </summary>
|
|
||||||
public List<ulong> FileId { get; set; } = new List<ulong>();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Don't call this in production!
|
|
||||||
/// </summary>
|
|
||||||
public void Block()
|
|
||||||
{
|
|
||||||
const int sleepMs = 10;
|
|
||||||
|
|
||||||
workshop.steamworks.Update();
|
|
||||||
|
|
||||||
while ( IsRunning )
|
|
||||||
{
|
|
||||||
#if NET_CORE
|
|
||||||
System.Threading.Tasks.Task.Delay( sleepMs ).Wait();
|
|
||||||
#else
|
|
||||||
System.Threading.Thread.Sleep( sleepMs );
|
|
||||||
#endif
|
|
||||||
workshop.steamworks.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
// ReleaseQueryUGCRequest
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum ItemStatistic : uint
|
|
||||||
{
|
|
||||||
NumSubscriptions = 0,
|
|
||||||
NumFavorites = 1,
|
|
||||||
NumFollowers = 2,
|
|
||||||
NumUniqueSubscriptions = 3,
|
|
||||||
NumUniqueFavorites = 4,
|
|
||||||
NumUniqueFollowers = 5,
|
|
||||||
NumUniqueWebsiteViews = 6,
|
|
||||||
ReportScore = 7,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,286 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Allows you to interact with Steam's UGC stuff (User Generated Content).
|
|
||||||
/// To put simply, this allows you to upload a folder of files to Steam.
|
|
||||||
///
|
|
||||||
/// To upload a new file use CreateItem. This returns an Editor object.
|
|
||||||
/// This object is also used to edit existing items.
|
|
||||||
///
|
|
||||||
/// To get a list of items you can call CreateQuery. From there you can download
|
|
||||||
/// an item and retrieve the folder that it's downloaded to.
|
|
||||||
///
|
|
||||||
/// Generally there's no need to compress and decompress your uploads, so you should
|
|
||||||
/// usually be able to use the content straight from the destination folder.
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public partial class Workshop : IDisposable
|
|
||||||
{
|
|
||||||
static Workshop()
|
|
||||||
{
|
|
||||||
Debug.Assert( Marshal.SizeOf( typeof(PublishedFileId_t) ) == Marshal.SizeOf( typeof(ulong) ),
|
|
||||||
$"sizeof({nameof(PublishedFileId_t)}) != sizeof({nameof(UInt64)})" );
|
|
||||||
}
|
|
||||||
|
|
||||||
internal const ulong InvalidHandle = 0xffffffffffffffff;
|
|
||||||
|
|
||||||
internal SteamNative.SteamUGC ugc;
|
|
||||||
internal BaseSteamworks steamworks;
|
|
||||||
internal SteamNative.SteamRemoteStorage remoteStorage;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when an item has been downloaded. This could have been
|
|
||||||
/// because of a call to Download.
|
|
||||||
/// </summary>
|
|
||||||
public event Action<ulong, Callbacks.Result> OnFileDownloaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when an item has been installed. This could have been
|
|
||||||
/// because of a call to Download or because of a subscription triggered
|
|
||||||
/// via the browser/app.
|
|
||||||
/// </summary>
|
|
||||||
public event Action<ulong> OnItemInstalled;
|
|
||||||
|
|
||||||
internal Workshop( BaseSteamworks steamworks, SteamNative.SteamUGC ugc, SteamNative.SteamRemoteStorage remoteStorage )
|
|
||||||
{
|
|
||||||
this.ugc = ugc;
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
this.remoteStorage = remoteStorage;
|
|
||||||
|
|
||||||
steamworks.RegisterCallback<SteamNative.DownloadItemResult_t>( onDownloadResult );
|
|
||||||
steamworks.RegisterCallback<SteamNative.ItemInstalled_t>( onItemInstalled );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// You should never have to call this manually
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
ugc = null;
|
|
||||||
steamworks = null;
|
|
||||||
remoteStorage = null;
|
|
||||||
|
|
||||||
OnFileDownloaded = null;
|
|
||||||
OnItemInstalled = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onItemInstalled( SteamNative.ItemInstalled_t obj )
|
|
||||||
{
|
|
||||||
if ( OnItemInstalled != null && obj.AppID == Client.Instance.AppId )
|
|
||||||
OnItemInstalled( obj.PublishedFileId );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onDownloadResult( SteamNative.DownloadItemResult_t obj )
|
|
||||||
{
|
|
||||||
if ( OnFileDownloaded != null && obj.AppID == Client.Instance.AppId )
|
|
||||||
OnFileDownloaded( obj.PublishedFileId, (Callbacks.Result) obj.Result );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the IDs of all subscribed workshop items. Not all items may be currently installed.
|
|
||||||
/// </summary>
|
|
||||||
public unsafe ulong[] GetSubscribedItemIds()
|
|
||||||
{
|
|
||||||
var count = ugc.GetNumSubscribedItems();
|
|
||||||
var array = new ulong[count];
|
|
||||||
|
|
||||||
fixed ( ulong* ptr = array )
|
|
||||||
{
|
|
||||||
ugc.GetSubscribedItems( (PublishedFileId_t*) ptr, count );
|
|
||||||
}
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
[ThreadStatic]
|
|
||||||
private static ulong[] _sSubscribedItemBuffer;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the IDs of all subscribed workshop items, avoiding repeated allocations.
|
|
||||||
/// Not all items may be currently installed.
|
|
||||||
/// </summary>
|
|
||||||
public unsafe int GetSubscribedItemIds( List<ulong> destList )
|
|
||||||
{
|
|
||||||
const int bufferSize = 1024;
|
|
||||||
|
|
||||||
var count = ugc.GetNumSubscribedItems();
|
|
||||||
|
|
||||||
if ( count >= bufferSize )
|
|
||||||
{
|
|
||||||
// Fallback for exceptional cases
|
|
||||||
destList.AddRange( GetSubscribedItemIds() );
|
|
||||||
return (int) count;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( _sSubscribedItemBuffer == null )
|
|
||||||
{
|
|
||||||
_sSubscribedItemBuffer = new ulong[bufferSize];
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed ( ulong* ptr = _sSubscribedItemBuffer)
|
|
||||||
{
|
|
||||||
count = ugc.GetSubscribedItems( (PublishedFileId_t*) ptr, bufferSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( var i = 0; i < count; ++i )
|
|
||||||
{
|
|
||||||
destList.Add( _sSubscribedItemBuffer[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int) count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a query object, which is used to get a list of items.
|
|
||||||
///
|
|
||||||
/// This could be a list of the most popular items, or a search,
|
|
||||||
/// or just getting a list of the items you've uploaded.
|
|
||||||
/// </summary>
|
|
||||||
public Query CreateQuery()
|
|
||||||
{
|
|
||||||
return new Query()
|
|
||||||
{
|
|
||||||
AppId = steamworks.AppId,
|
|
||||||
workshop = this,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new Editor object with the intention of creating a new item.
|
|
||||||
/// Your item won't actually be created until you call Publish() on the object.
|
|
||||||
/// </summary>
|
|
||||||
public Editor CreateItem( ItemType type = ItemType.Community )
|
|
||||||
{
|
|
||||||
return CreateItem(this.steamworks.AppId, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new Editor object with the intention of creating a new item.
|
|
||||||
/// Your item won't actually be created until you call Publish() on the object.
|
|
||||||
/// Your item will be published to the provided appId.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>You need to add app publish permissions for cross app uploading to work.</remarks>
|
|
||||||
public Editor CreateItem( uint workshopUploadAppId, ItemType type = ItemType.Community )
|
|
||||||
{
|
|
||||||
return new Editor() { workshop = this, WorkshopUploadAppId = workshopUploadAppId, Type = type };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a class representing this ItemId. We don't query
|
|
||||||
/// item name, description etc. We don't verify that item exists.
|
|
||||||
/// We don't verify that this item belongs to your app.
|
|
||||||
/// </summary>
|
|
||||||
public Editor EditItem( ulong itemId )
|
|
||||||
{
|
|
||||||
return new Editor() { workshop = this, Id = itemId, WorkshopUploadAppId = steamworks.AppId };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets an Item object for a specific item. This doesn't currently
|
|
||||||
/// query the item's name and description. It's only really useful
|
|
||||||
/// if you know an item's ID and want to download it, or check its
|
|
||||||
/// current download status.
|
|
||||||
/// </summary>
|
|
||||||
public Item GetItem( ulong itemid )
|
|
||||||
{
|
|
||||||
return new Item( itemid, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// How a query should be ordered.
|
|
||||||
/// </summary>
|
|
||||||
public enum Order
|
|
||||||
{
|
|
||||||
RankedByVote = 0,
|
|
||||||
RankedByPublicationDate = 1,
|
|
||||||
AcceptedForGameRankedByAcceptanceDate = 2,
|
|
||||||
RankedByTrend = 3,
|
|
||||||
FavoritedByFriendsRankedByPublicationDate = 4,
|
|
||||||
CreatedByFriendsRankedByPublicationDate = 5,
|
|
||||||
RankedByNumTimesReported = 6,
|
|
||||||
CreatedByFollowedUsersRankedByPublicationDate = 7,
|
|
||||||
NotYetRated = 8,
|
|
||||||
RankedByTotalVotesAsc = 9,
|
|
||||||
RankedByVotesUp = 10,
|
|
||||||
RankedByTextSearch = 11,
|
|
||||||
RankedByTotalUniqueSubscriptions = 12,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The type of item you are querying for
|
|
||||||
/// </summary>
|
|
||||||
public enum QueryType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Both MicrotransactionItems and subscriptionItems
|
|
||||||
/// </summary>
|
|
||||||
Items = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Workshop item that is meant to be voted on for the purpose of selling in-game
|
|
||||||
/// </summary>
|
|
||||||
MicrotransactionItems = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// normal Workshop item that can be subscribed to
|
|
||||||
/// </summary>
|
|
||||||
SubscriptionItems = 2,
|
|
||||||
Collections = 3,
|
|
||||||
Artwork = 4,
|
|
||||||
Videos = 5,
|
|
||||||
Screenshots = 6,
|
|
||||||
AllGuides = 7, // both web guides and integrated guides
|
|
||||||
WebGuides = 8,
|
|
||||||
IntegratedGuides = 9,
|
|
||||||
UsableInGame = 10, // ready-to-use items and integrated guides
|
|
||||||
ControllerBindings = 11,
|
|
||||||
GameManagedItems = 12, // game managed items (not managed by users)
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used to define the item type when creating
|
|
||||||
/// </summary>
|
|
||||||
public enum ItemType
|
|
||||||
{
|
|
||||||
Community = 0, // normal Workshop item that can be subscribed to
|
|
||||||
Microtransaction = 1, // Workshop item that is meant to be voted on for the purpose of selling in-game
|
|
||||||
Collection = 2, // a collection of Workshop or Greenlight items
|
|
||||||
Art = 3, // artwork
|
|
||||||
Video = 4, // external video
|
|
||||||
Screenshot = 5, // screenshot
|
|
||||||
Game = 6, // Greenlight game entry
|
|
||||||
Software = 7, // Greenlight software entry
|
|
||||||
Concept = 8, // Greenlight concept
|
|
||||||
WebGuide = 9, // Steam web guide
|
|
||||||
IntegratedGuide = 10, // application integrated guide
|
|
||||||
Merch = 11, // Workshop merchandise meant to be voted on for the purpose of being sold
|
|
||||||
ControllerBinding = 12, // Steam Controller bindings
|
|
||||||
SteamworksAccessInvite = 13, // internal
|
|
||||||
SteamVideo = 14, // Steam video
|
|
||||||
GameManagedItem = 15, // managed completely by the game, not the user, and not shown on the web
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// When querying a specific user's items this defines what
|
|
||||||
/// type of items you're looking for.
|
|
||||||
/// </summary>
|
|
||||||
public enum UserQueryType : uint
|
|
||||||
{
|
|
||||||
Published = 0,
|
|
||||||
VotedOn,
|
|
||||||
VotedUp,
|
|
||||||
VotedDown,
|
|
||||||
WillVoteLater,
|
|
||||||
Favorited,
|
|
||||||
Subscribed,
|
|
||||||
UsedOrPlayed,
|
|
||||||
Followed,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,243 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Interop
|
|
||||||
{
|
|
||||||
internal class NativeInterface : IDisposable
|
|
||||||
{
|
|
||||||
internal SteamNative.SteamApi api;
|
|
||||||
internal SteamNative.SteamClient client;
|
|
||||||
internal SteamNative.SteamUser user;
|
|
||||||
internal SteamNative.SteamApps apps;
|
|
||||||
internal SteamNative.SteamAppList applist;
|
|
||||||
internal SteamNative.SteamFriends friends;
|
|
||||||
internal SteamNative.SteamMatchmakingServers servers;
|
|
||||||
internal SteamNative.SteamMatchmaking matchmaking;
|
|
||||||
internal SteamNative.SteamInventory inventory;
|
|
||||||
internal SteamNative.SteamNetworking networking;
|
|
||||||
internal SteamNative.SteamUserStats userstats;
|
|
||||||
internal SteamNative.SteamUtils utils;
|
|
||||||
internal SteamNative.SteamScreenshots screenshots;
|
|
||||||
internal SteamNative.SteamHTTP http;
|
|
||||||
internal SteamNative.SteamUGC ugc;
|
|
||||||
internal SteamNative.SteamGameServer gameServer;
|
|
||||||
internal SteamNative.SteamGameServerStats gameServerStats;
|
|
||||||
internal SteamNative.SteamRemoteStorage remoteStorage;
|
|
||||||
|
|
||||||
private bool isServer;
|
|
||||||
|
|
||||||
internal bool InitClient( BaseSteamworks steamworks )
|
|
||||||
{
|
|
||||||
isServer = false;
|
|
||||||
|
|
||||||
api = new SteamNative.SteamApi();
|
|
||||||
|
|
||||||
if ( !api.SteamAPI_Init() )
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine( "InitClient: SteamAPI_Init returned false" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hUser = api.SteamAPI_GetHSteamUser();
|
|
||||||
var hPipe = api.SteamAPI_GetHSteamPipe();
|
|
||||||
if ( hPipe == 0 )
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine( "InitClient: hPipe == 0" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FillInterfaces( steamworks, hUser, hPipe );
|
|
||||||
|
|
||||||
if ( !user.IsValid )
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine( "InitClient: ISteamUser is null" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool InitServer( BaseSteamworks steamworks, uint IpAddress /*uint32*/, ushort usPort /*uint16*/, ushort GamePort /*uint16*/, ushort QueryPort /*uint16*/, int eServerMode /*int*/, string pchVersionString /*const char **/)
|
|
||||||
{
|
|
||||||
isServer = true;
|
|
||||||
|
|
||||||
api = new SteamNative.SteamApi();
|
|
||||||
|
|
||||||
if ( !api.SteamInternal_GameServer_Init( IpAddress, usPort, GamePort, QueryPort, eServerMode, pchVersionString ) )
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine( "InitServer: GameServer_Init returned false" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hUser = api.SteamGameServer_GetHSteamUser();
|
|
||||||
var hPipe = api.SteamGameServer_GetHSteamPipe();
|
|
||||||
if ( hPipe == 0 )
|
|
||||||
{
|
|
||||||
Console.Error.WriteLine( "InitServer: hPipe == 0" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
FillInterfaces( steamworks, hPipe, hUser );
|
|
||||||
|
|
||||||
if ( !gameServer.IsValid )
|
|
||||||
{
|
|
||||||
gameServer = null;
|
|
||||||
throw new System.Exception( "Steam Server: Couldn't load SteamGameServer012" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FillInterfaces( BaseSteamworks steamworks, int hpipe, int huser )
|
|
||||||
{
|
|
||||||
var clientPtr = api.SteamInternal_CreateInterface( "SteamClient018" );
|
|
||||||
if ( clientPtr == IntPtr.Zero )
|
|
||||||
throw new System.Exception( "Steam Server: Couldn't load SteamClient018" );
|
|
||||||
|
|
||||||
client = new SteamNative.SteamClient( steamworks, clientPtr );
|
|
||||||
|
|
||||||
user = client.GetISteamUser( huser, hpipe, SteamNative.Defines.STEAMUSER_INTERFACE_VERSION );
|
|
||||||
utils = client.GetISteamUtils( hpipe, SteamNative.Defines.STEAMUTILS_INTERFACE_VERSION );
|
|
||||||
networking = client.GetISteamNetworking( huser, hpipe, SteamNative.Defines.STEAMNETWORKING_INTERFACE_VERSION );
|
|
||||||
gameServerStats = client.GetISteamGameServerStats( huser, hpipe, SteamNative.Defines.STEAMGAMESERVERSTATS_INTERFACE_VERSION );
|
|
||||||
http = client.GetISteamHTTP( huser, hpipe, SteamNative.Defines.STEAMHTTP_INTERFACE_VERSION );
|
|
||||||
inventory = client.GetISteamInventory( huser, hpipe, SteamNative.Defines.STEAMINVENTORY_INTERFACE_VERSION );
|
|
||||||
ugc = client.GetISteamUGC( huser, hpipe, SteamNative.Defines.STEAMUGC_INTERFACE_VERSION );
|
|
||||||
apps = client.GetISteamApps( huser, hpipe, SteamNative.Defines.STEAMAPPS_INTERFACE_VERSION );
|
|
||||||
gameServer = client.GetISteamGameServer( huser, hpipe, SteamNative.Defines.STEAMGAMESERVER_INTERFACE_VERSION );
|
|
||||||
friends = client.GetISteamFriends( huser, hpipe, SteamNative.Defines.STEAMFRIENDS_INTERFACE_VERSION );
|
|
||||||
servers = client.GetISteamMatchmakingServers( huser, hpipe, SteamNative.Defines.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION );
|
|
||||||
userstats = client.GetISteamUserStats( huser, hpipe, SteamNative.Defines.STEAMUSERSTATS_INTERFACE_VERSION );
|
|
||||||
screenshots = client.GetISteamScreenshots( huser, hpipe, SteamNative.Defines.STEAMSCREENSHOTS_INTERFACE_VERSION );
|
|
||||||
remoteStorage = client.GetISteamRemoteStorage( huser, hpipe, SteamNative.Defines.STEAMREMOTESTORAGE_INTERFACE_VERSION );
|
|
||||||
matchmaking = client.GetISteamMatchmaking( huser, hpipe, SteamNative.Defines.STEAMMATCHMAKING_INTERFACE_VERSION );
|
|
||||||
applist = client.GetISteamAppList( huser, hpipe, SteamNative.Defines.STEAMAPPLIST_INTERFACE_VERSION );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
if ( user != null )
|
|
||||||
{
|
|
||||||
user.Dispose();
|
|
||||||
user = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( utils != null )
|
|
||||||
{
|
|
||||||
utils.Dispose();
|
|
||||||
utils = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( networking != null )
|
|
||||||
{
|
|
||||||
networking.Dispose();
|
|
||||||
networking = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( gameServerStats != null )
|
|
||||||
{
|
|
||||||
gameServerStats.Dispose();
|
|
||||||
gameServerStats = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( http != null )
|
|
||||||
{
|
|
||||||
http.Dispose();
|
|
||||||
http = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( inventory != null )
|
|
||||||
{
|
|
||||||
inventory.Dispose();
|
|
||||||
inventory = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ugc != null )
|
|
||||||
{
|
|
||||||
ugc.Dispose();
|
|
||||||
ugc = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( apps != null )
|
|
||||||
{
|
|
||||||
apps.Dispose();
|
|
||||||
apps = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( gameServer != null )
|
|
||||||
{
|
|
||||||
gameServer.Dispose();
|
|
||||||
gameServer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( friends != null )
|
|
||||||
{
|
|
||||||
friends.Dispose();
|
|
||||||
friends = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( servers != null )
|
|
||||||
{
|
|
||||||
servers.Dispose();
|
|
||||||
servers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( userstats != null )
|
|
||||||
{
|
|
||||||
userstats.Dispose();
|
|
||||||
userstats = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( screenshots != null )
|
|
||||||
{
|
|
||||||
screenshots.Dispose();
|
|
||||||
screenshots = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( remoteStorage != null )
|
|
||||||
{
|
|
||||||
remoteStorage.Dispose();
|
|
||||||
remoteStorage = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( matchmaking != null )
|
|
||||||
{
|
|
||||||
matchmaking.Dispose();
|
|
||||||
matchmaking = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( applist != null )
|
|
||||||
{
|
|
||||||
applist.Dispose();
|
|
||||||
applist = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( client != null )
|
|
||||||
{
|
|
||||||
client.Dispose();
|
|
||||||
client = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( api != null )
|
|
||||||
{
|
|
||||||
if ( isServer )
|
|
||||||
api.SteamGameServer_Shutdown();
|
|
||||||
else
|
|
||||||
api.SteamAPI_Shutdown();
|
|
||||||
|
|
||||||
//
|
|
||||||
// The functions above destroy the pipeline handles
|
|
||||||
// and all of the classes. Trying to call a steam function
|
|
||||||
// at this point will result in a crash - because any
|
|
||||||
// pointers we stored are not invalid.
|
|
||||||
//
|
|
||||||
|
|
||||||
api.Dispose();
|
|
||||||
api = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -1,148 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
#if false
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Allows getting and setting stats on users from the gameserver. These stats
|
|
||||||
/// should have been set up on the Steamworks website for your app.
|
|
||||||
/// </summary>
|
|
||||||
public class ServerStats
|
|
||||||
{
|
|
||||||
internal Server server;
|
|
||||||
|
|
||||||
internal ServerStats( Server s )
|
|
||||||
{
|
|
||||||
server = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential )]
|
|
||||||
public struct StatsReceived
|
|
||||||
{
|
|
||||||
public int Result;
|
|
||||||
public ulong SteamId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve the stats for this user. If you pass a callback function in
|
|
||||||
/// this will be called when the stats are recieved, the bool will signify whether
|
|
||||||
/// it was successful or not.
|
|
||||||
/// </summary>
|
|
||||||
public void Refresh( ulong steamid, Action<ulong, bool> Callback = null )
|
|
||||||
{
|
|
||||||
if ( Callback == null )
|
|
||||||
{
|
|
||||||
server.native.gameServerStats.RequestUserStats( steamid );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
server.native.gameServerStats.RequestUserStats( steamid, ( o, failed ) =>
|
|
||||||
{
|
|
||||||
Callback( steamid, o.Result == SteamNative.Result.OK && !failed );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Once you've set a stat change on a user you need to commit your changes.
|
|
||||||
/// You can do that using this function. The callback will let you know if
|
|
||||||
/// your action succeeded, but most of the time you can fire and forget.
|
|
||||||
/// </summary>
|
|
||||||
public void Commit( ulong steamid, Action<ulong, bool> Callback = null )
|
|
||||||
{
|
|
||||||
if ( Callback == null )
|
|
||||||
{
|
|
||||||
server.native.gameServerStats.StoreUserStats( steamid );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
server.native.gameServerStats.StoreUserStats( steamid, ( o, failed ) =>
|
|
||||||
{
|
|
||||||
Callback( steamid, o.Result == SteamNative.Result.OK && !failed );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set the named stat for this user. Setting stats should follow the rules
|
|
||||||
/// you defined in Steamworks.
|
|
||||||
/// </summary>
|
|
||||||
public bool SetInt( ulong steamid, string name, int stat )
|
|
||||||
{
|
|
||||||
return server.native.gameServerStats.SetUserStat( steamid, name, stat );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Set the named stat for this user. Setting stats should follow the rules
|
|
||||||
/// you defined in Steamworks.
|
|
||||||
/// </summary>
|
|
||||||
public bool SetFloat( ulong steamid, string name, float stat )
|
|
||||||
{
|
|
||||||
return server.native.gameServerStats.SetUserStat0( steamid, name, stat );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the named stat for this user. If getting the stat failed, will return
|
|
||||||
/// defaultValue. You should have called Refresh for this userid - which downloads
|
|
||||||
/// the stats from the backend. If you didn't call it this will always return defaultValue.
|
|
||||||
/// </summary>
|
|
||||||
public int GetInt( ulong steamid, string name, int defaultValue = 0 )
|
|
||||||
{
|
|
||||||
int data = defaultValue;
|
|
||||||
|
|
||||||
if ( !server.native.gameServerStats.GetUserStat( steamid, name, out data ) )
|
|
||||||
return defaultValue;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the named stat for this user. If getting the stat failed, will return
|
|
||||||
/// defaultValue. You should have called Refresh for this userid - which downloads
|
|
||||||
/// the stats from the backend. If you didn't call it this will always return defaultValue.
|
|
||||||
/// </summary>
|
|
||||||
public float GetFloat( ulong steamid, string name, float defaultValue = 0 )
|
|
||||||
{
|
|
||||||
float data = defaultValue;
|
|
||||||
|
|
||||||
if ( !server.native.gameServerStats.GetUserStat0( steamid, name, out data ) )
|
|
||||||
return defaultValue;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unlocks the specified achievement for the specified user. Must have called Refresh on a steamid first.
|
|
||||||
/// Remember to use Commit after use.
|
|
||||||
/// </summary>
|
|
||||||
public bool SetAchievement( ulong steamid, string name )
|
|
||||||
{
|
|
||||||
return server.native.gameServerStats.SetUserAchievement( steamid, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resets the unlock status of an achievement for the specified user. Must have called Refresh on a steamid first.
|
|
||||||
/// Remember to use Commit after use.
|
|
||||||
/// </summary>
|
|
||||||
public bool ClearAchievement( ulong steamid, string name )
|
|
||||||
{
|
|
||||||
return server.native.gameServerStats.ClearUserAchievement( steamid, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true if available, exists and unlocked
|
|
||||||
/// </summary>
|
|
||||||
public bool GetAchievement( ulong steamid, string name )
|
|
||||||
{
|
|
||||||
bool achieved = false;
|
|
||||||
|
|
||||||
if ( !server.native.gameServerStats.GetUserAchievement( steamid, name, ref achieved ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return achieved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -3,7 +3,6 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SteamNative;
|
|
||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
@ -1,404 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Facepunch.Steamworks;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
[StructLayout( LayoutKind.Sequential )]
|
|
||||||
internal class Callback
|
|
||||||
{
|
|
||||||
internal enum Flags : byte
|
|
||||||
{
|
|
||||||
Registered = 0x01,
|
|
||||||
GameServer = 0x02
|
|
||||||
}
|
|
||||||
|
|
||||||
public IntPtr vTablePtr;
|
|
||||||
public byte CallbackFlags;
|
|
||||||
public int CallbackId;
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
|
||||||
public class VTable
|
|
||||||
{
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD();
|
|
||||||
|
|
||||||
public ResultD ResultA;
|
|
||||||
public ResultWithInfoD ResultB;
|
|
||||||
public GetSizeD GetSize;
|
|
||||||
|
|
||||||
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
|
||||||
{
|
|
||||||
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) );
|
|
||||||
|
|
||||||
var vTable = new Callback.VTable
|
|
||||||
{
|
|
||||||
ResultA = onResultThis,
|
|
||||||
ResultB = onResultWithInfoThis,
|
|
||||||
GetSize = onGetSizeThis,
|
|
||||||
};
|
|
||||||
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
|
||||||
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
|
|
||||||
return vTablePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
|
||||||
public class VTableWin
|
|
||||||
{
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultD( IntPtr pvParam );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate void ResultWithInfoD( IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.StdCall )] public delegate int GetSizeD();
|
|
||||||
|
|
||||||
public ResultWithInfoD ResultB;
|
|
||||||
public ResultD ResultA;
|
|
||||||
public GetSizeD GetSize;
|
|
||||||
|
|
||||||
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
|
||||||
{
|
|
||||||
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) );
|
|
||||||
|
|
||||||
var vTable = new Callback.VTableWin
|
|
||||||
{
|
|
||||||
ResultA = onResultThis,
|
|
||||||
ResultB = onResultWithInfoThis,
|
|
||||||
GetSize = onGetSizeThis,
|
|
||||||
};
|
|
||||||
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
|
||||||
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
|
|
||||||
return vTablePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
|
||||||
public class VTableThis
|
|
||||||
{
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
|
|
||||||
|
|
||||||
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
|
||||||
{
|
|
||||||
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) );
|
|
||||||
|
|
||||||
var vTable = new Callback.VTableThis
|
|
||||||
{
|
|
||||||
ResultA = onResultThis,
|
|
||||||
ResultB = onResultWithInfoThis,
|
|
||||||
GetSize = onGetSizeThis,
|
|
||||||
};
|
|
||||||
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
|
||||||
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
|
|
||||||
return vTablePtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr );
|
|
||||||
|
|
||||||
public ResultD ResultA;
|
|
||||||
public ResultWithInfoD ResultB;
|
|
||||||
public GetSizeD GetSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
|
||||||
public class VTableWinThis
|
|
||||||
{
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultD( IntPtr thisptr, IntPtr pvParam );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate void ResultWithInfoD( IntPtr thisptr, IntPtr pvParam, bool bIOFailure, SteamNative.SteamAPICall_t hSteamAPICall );
|
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] public delegate int GetSizeD( IntPtr thisptr );
|
|
||||||
|
|
||||||
public ResultWithInfoD ResultB;
|
|
||||||
public ResultD ResultA;
|
|
||||||
public GetSizeD GetSize;
|
|
||||||
|
|
||||||
internal static IntPtr GetVTable( ResultD onResultThis, ResultWithInfoD onResultWithInfoThis, GetSizeD onGetSizeThis, List<GCHandle> allocations )
|
|
||||||
{
|
|
||||||
var vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) );
|
|
||||||
|
|
||||||
var vTable = new Callback.VTableWinThis
|
|
||||||
{
|
|
||||||
ResultA = onResultThis,
|
|
||||||
ResultB = onResultWithInfoThis,
|
|
||||||
GetSize = onGetSizeThis,
|
|
||||||
};
|
|
||||||
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultA ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.ResultB ) );
|
|
||||||
allocations.Add( GCHandle.Alloc( vTable.GetSize ) );
|
|
||||||
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
|
|
||||||
return vTablePtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// Created on registration of a callback
|
|
||||||
//
|
|
||||||
internal class CallbackHandle : IDisposable
|
|
||||||
{
|
|
||||||
internal BaseSteamworks Steamworks;
|
|
||||||
|
|
||||||
// Get Rid
|
|
||||||
internal GCHandle FuncA;
|
|
||||||
internal GCHandle FuncB;
|
|
||||||
internal GCHandle FuncC;
|
|
||||||
internal IntPtr vTablePtr;
|
|
||||||
internal GCHandle PinnedCallback;
|
|
||||||
|
|
||||||
internal CallbackHandle( Facepunch.Steamworks.BaseSteamworks steamworks )
|
|
||||||
{
|
|
||||||
Steamworks = steamworks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
UnregisterCallback();
|
|
||||||
|
|
||||||
if ( FuncA.IsAllocated )
|
|
||||||
FuncA.Free();
|
|
||||||
|
|
||||||
if ( FuncB.IsAllocated )
|
|
||||||
FuncB.Free();
|
|
||||||
|
|
||||||
if ( FuncC.IsAllocated )
|
|
||||||
FuncC.Free();
|
|
||||||
|
|
||||||
if ( PinnedCallback.IsAllocated )
|
|
||||||
PinnedCallback.Free();
|
|
||||||
|
|
||||||
if ( vTablePtr != IntPtr.Zero )
|
|
||||||
{
|
|
||||||
Marshal.FreeHGlobal( vTablePtr );
|
|
||||||
vTablePtr = IntPtr.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UnregisterCallback()
|
|
||||||
{
|
|
||||||
if ( !PinnedCallback.IsAllocated )
|
|
||||||
return;
|
|
||||||
|
|
||||||
Steamworks.native.api.SteamAPI_UnregisterCallback( PinnedCallback.AddrOfPinnedObject() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool IsValid { get { return true; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class CallbackHandle<T> : CallbackHandle where T: struct, Steamworks.ISteamCallback
|
|
||||||
{
|
|
||||||
T template;
|
|
||||||
|
|
||||||
internal CallbackHandle( Facepunch.Steamworks.BaseSteamworks steamworks ) : base( steamworks )
|
|
||||||
{
|
|
||||||
template = new T();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create the functions we need for the vtable
|
|
||||||
//
|
|
||||||
if ( Facepunch.Steamworks.Config.UseThisCall )
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Create the VTable by manually allocating the memory and copying across
|
|
||||||
//
|
|
||||||
if ( Platform.IsWindows )
|
|
||||||
{
|
|
||||||
vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWinThis ) ) );
|
|
||||||
var vTable = new Callback.VTableWinThis
|
|
||||||
{
|
|
||||||
ResultA = OnResultThis,
|
|
||||||
ResultB = OnResultWithInfoThis,
|
|
||||||
GetSize = OnGetSizeThis,
|
|
||||||
};
|
|
||||||
FuncA = GCHandle.Alloc( vTable.ResultA );
|
|
||||||
FuncB = GCHandle.Alloc( vTable.ResultB );
|
|
||||||
FuncC = GCHandle.Alloc( vTable.GetSize );
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableThis ) ) );
|
|
||||||
var vTable = new Callback.VTableThis
|
|
||||||
{
|
|
||||||
ResultA = OnResultThis,
|
|
||||||
ResultB = OnResultWithInfoThis,
|
|
||||||
GetSize = OnGetSizeThis,
|
|
||||||
};
|
|
||||||
FuncA = GCHandle.Alloc( vTable.ResultA );
|
|
||||||
FuncB = GCHandle.Alloc( vTable.ResultB );
|
|
||||||
FuncC = GCHandle.Alloc( vTable.GetSize );
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Create the VTable by manually allocating the memory and copying across
|
|
||||||
//
|
|
||||||
if ( Platform.IsWindows )
|
|
||||||
{
|
|
||||||
vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTableWin ) ) );
|
|
||||||
var vTable = new Callback.VTableWin
|
|
||||||
{
|
|
||||||
ResultA = OnResult,
|
|
||||||
ResultB = OnResultWithInfo,
|
|
||||||
GetSize = OnGetSize,
|
|
||||||
};
|
|
||||||
FuncA = GCHandle.Alloc( vTable.ResultA );
|
|
||||||
FuncB = GCHandle.Alloc( vTable.ResultB );
|
|
||||||
FuncC = GCHandle.Alloc( vTable.GetSize );
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vTablePtr = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( Callback.VTable ) ) );
|
|
||||||
var vTable = new Callback.VTable
|
|
||||||
{
|
|
||||||
ResultA = OnResult,
|
|
||||||
ResultB = OnResultWithInfo,
|
|
||||||
GetSize = OnGetSize,
|
|
||||||
};
|
|
||||||
FuncA = GCHandle.Alloc( vTable.ResultA );
|
|
||||||
FuncB = GCHandle.Alloc( vTable.ResultB );
|
|
||||||
FuncC = GCHandle.Alloc( vTable.GetSize );
|
|
||||||
Marshal.StructureToPtr( vTable, vTablePtr, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create the callback object
|
|
||||||
//
|
|
||||||
var cb = new Callback();
|
|
||||||
cb.vTablePtr = vTablePtr;
|
|
||||||
cb.CallbackFlags = steamworks.IsGameServer ? (byte)SteamNative.Callback.Flags.GameServer : (byte)0;
|
|
||||||
cb.CallbackId = template.GetCallbackId();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Pin the callback, so it doesn't get garbage collected and we can pass the pointer to native
|
|
||||||
//
|
|
||||||
PinnedCallback = GCHandle.Alloc( cb, GCHandleType.Pinned );
|
|
||||||
|
|
||||||
//
|
|
||||||
// Register the callback with Steam
|
|
||||||
//
|
|
||||||
steamworks.native.api.SteamAPI_RegisterCallback( PinnedCallback.AddrOfPinnedObject(), cb.CallbackId );
|
|
||||||
|
|
||||||
steamworks.RegisterCallbackHandle( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback]
|
|
||||||
internal void OnResultThis( IntPtr self, IntPtr param ) { OnResult( param ); }
|
|
||||||
[MonoPInvokeCallback]
|
|
||||||
internal void OnResultWithInfoThis( IntPtr self, IntPtr param, bool failure, SteamNative.SteamAPICall_t call ) { OnResultWithInfo( param, failure, call ); }
|
|
||||||
[MonoPInvokeCallback]
|
|
||||||
internal int OnGetSizeThis( IntPtr self ) { return OnGetSize(); }
|
|
||||||
[MonoPInvokeCallback]
|
|
||||||
internal int OnGetSize() { return template.GetStructSize(); }
|
|
||||||
|
|
||||||
[MonoPInvokeCallback]
|
|
||||||
internal void OnResult( IntPtr param )
|
|
||||||
{
|
|
||||||
OnResultWithInfo( param, false, 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
[MonoPInvokeCallback]
|
|
||||||
internal void OnResultWithInfo( IntPtr param, bool failure, SteamNative.SteamAPICall_t call )
|
|
||||||
{
|
|
||||||
if ( failure ) return;
|
|
||||||
|
|
||||||
var value = (T) template.Fill( param );
|
|
||||||
|
|
||||||
if ( Facepunch.Steamworks.Client.Instance != null )
|
|
||||||
Facepunch.Steamworks.Client.Instance.OnCallback<T>( value );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal abstract class CallResult : CallbackHandle
|
|
||||||
{
|
|
||||||
internal SteamAPICall_t Call;
|
|
||||||
public override bool IsValid { get { return Call > 0; } }
|
|
||||||
|
|
||||||
|
|
||||||
internal CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call ) : base( steamworks )
|
|
||||||
{
|
|
||||||
Call = call;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Try()
|
|
||||||
{
|
|
||||||
bool failed = false;
|
|
||||||
|
|
||||||
if ( !Steamworks.native.utils.IsAPICallCompleted( Call, ref failed ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Steamworks.UnregisterCallResult( this );
|
|
||||||
|
|
||||||
RunCallback();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal abstract void RunCallback();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal class CallResult<T> : CallResult where T : struct, Steamworks.ISteamCallback
|
|
||||||
{
|
|
||||||
T template;
|
|
||||||
|
|
||||||
private static byte[] resultBuffer = new byte[1024 * 16];
|
|
||||||
|
|
||||||
internal delegate T ConvertFromPointer( IntPtr p );
|
|
||||||
|
|
||||||
Action<T, bool> CallbackFunction;
|
|
||||||
|
|
||||||
internal CallResult( Facepunch.Steamworks.BaseSteamworks steamworks, SteamAPICall_t call, Action<T, bool> callbackFunction ) : base( steamworks, call )
|
|
||||||
{
|
|
||||||
template = new T();
|
|
||||||
CallbackFunction = callbackFunction;
|
|
||||||
|
|
||||||
Steamworks.RegisterCallResult( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"CallResult( {typeof(T).Name}, {template.GetCallbackId()}, {template.GetStructSize()}b )";
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe internal override void RunCallback()
|
|
||||||
{
|
|
||||||
bool failed = false;
|
|
||||||
|
|
||||||
fixed ( byte* ptr = resultBuffer )
|
|
||||||
{
|
|
||||||
if ( !Steamworks.native.utils.GetAPICallResult( Call, (IntPtr)ptr, resultBuffer.Length, template.GetCallbackId(), ref failed ) || failed )
|
|
||||||
{
|
|
||||||
CallbackFunction( default(T), true );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var val = (T) template.Fill( (IntPtr)ptr );
|
|
||||||
CallbackFunction( val, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class MonoPInvokeCallbackAttribute : Attribute
|
|
||||||
{
|
|
||||||
public MonoPInvokeCallbackAttribute() { }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,788 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal static partial class Platform
|
|
||||||
{
|
|
||||||
internal interface Interface : IDisposable
|
|
||||||
{
|
|
||||||
// Implementation should return true if _ptr is non null
|
|
||||||
bool IsValid { get; }
|
|
||||||
|
|
||||||
uint /*uint32*/ ISteamAppList_GetNumInstalledApps();
|
|
||||||
uint /*uint32*/ ISteamAppList_GetInstalledApps( IntPtr /*AppId_t **/ pvecAppID, uint /*uint32*/ unMaxAppIDs );
|
|
||||||
int /*int*/ ISteamAppList_GetAppName( uint nAppID, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameMax );
|
|
||||||
int /*int*/ ISteamAppList_GetAppInstallDir( uint nAppID, System.Text.StringBuilder /*char **/ pchDirectory, int /*int*/ cchNameMax );
|
|
||||||
int /*int*/ ISteamAppList_GetAppBuildId( uint nAppID );
|
|
||||||
bool /*bool*/ ISteamApps_BIsSubscribed();
|
|
||||||
bool /*bool*/ ISteamApps_BIsLowViolence();
|
|
||||||
bool /*bool*/ ISteamApps_BIsCybercafe();
|
|
||||||
bool /*bool*/ ISteamApps_BIsVACBanned();
|
|
||||||
IntPtr ISteamApps_GetCurrentGameLanguage();
|
|
||||||
IntPtr ISteamApps_GetAvailableGameLanguages();
|
|
||||||
bool /*bool*/ ISteamApps_BIsSubscribedApp( uint appID );
|
|
||||||
bool /*bool*/ ISteamApps_BIsDlcInstalled( uint appID );
|
|
||||||
uint /*uint32*/ ISteamApps_GetEarliestPurchaseUnixTime( uint nAppID );
|
|
||||||
bool /*bool*/ ISteamApps_BIsSubscribedFromFreeWeekend();
|
|
||||||
int /*int*/ ISteamApps_GetDLCCount();
|
|
||||||
bool /*bool*/ ISteamApps_BGetDLCDataByIndex( int /*int*/ iDLC, ref uint pAppID, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAvailable, System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize );
|
|
||||||
void /*void*/ ISteamApps_InstallDLC( uint nAppID );
|
|
||||||
void /*void*/ ISteamApps_UninstallDLC( uint nAppID );
|
|
||||||
void /*void*/ ISteamApps_RequestAppProofOfPurchaseKey( uint nAppID );
|
|
||||||
bool /*bool*/ ISteamApps_GetCurrentBetaName( System.Text.StringBuilder /*char **/ pchName, int /*int*/ cchNameBufferSize );
|
|
||||||
bool /*bool*/ ISteamApps_MarkContentCorrupt( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMissingFilesOnly );
|
|
||||||
uint /*uint32*/ ISteamApps_GetInstalledDepots( uint appID, IntPtr /*DepotId_t **/ pvecDepots, uint /*uint32*/ cMaxDepots );
|
|
||||||
uint /*uint32*/ ISteamApps_GetAppInstallDir( uint appID, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderBufferSize );
|
|
||||||
bool /*bool*/ ISteamApps_BIsAppInstalled( uint appID );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamApps_GetAppOwner();
|
|
||||||
IntPtr ISteamApps_GetLaunchQueryParam( string /*const char **/ pchKey );
|
|
||||||
bool /*bool*/ ISteamApps_GetDlcDownloadProgress( uint nAppID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal );
|
|
||||||
int /*int*/ ISteamApps_GetAppBuildId();
|
|
||||||
void /*void*/ ISteamApps_RequestAllProofOfPurchaseKeys();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamApps_GetFileDetails( string /*const char **/ pszFileName );
|
|
||||||
int /*int*/ ISteamApps_GetLaunchCommandLine( System.Text.StringBuilder /*char **/ pszCommandLine, int /*int*/ cubCommandLine );
|
|
||||||
bool /*bool*/ ISteamApps_BIsSubscribedFromFamilySharing();
|
|
||||||
HSteamPipe /*(HSteamPipe)*/ ISteamClient_CreateSteamPipe();
|
|
||||||
bool /*bool*/ ISteamClient_BReleaseSteamPipe( int hSteamPipe );
|
|
||||||
HSteamUser /*(HSteamUser)*/ ISteamClient_ConnectToGlobalUser( int hSteamPipe );
|
|
||||||
HSteamUser /*(HSteamUser)*/ ISteamClient_CreateLocalUser( out int phSteamPipe, AccountType /*EAccountType*/ eAccountType );
|
|
||||||
void /*void*/ ISteamClient_ReleaseUser( int hSteamPipe, int hUser );
|
|
||||||
IntPtr /*class ISteamUser **/ ISteamClient_GetISteamUser( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamGameServer **/ ISteamClient_GetISteamGameServer( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
void /*void*/ ISteamClient_SetLocalIPBinding( uint /*uint32*/ unIP, ushort /*uint16*/ usPort );
|
|
||||||
IntPtr /*class ISteamFriends **/ ISteamClient_GetISteamFriends( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamUtils **/ ISteamClient_GetISteamUtils( int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamMatchmaking **/ ISteamClient_GetISteamMatchmaking( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamMatchmakingServers **/ ISteamClient_GetISteamMatchmakingServers( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*void **/ ISteamClient_GetISteamGenericInterface( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamUserStats **/ ISteamClient_GetISteamUserStats( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamGameServerStats **/ ISteamClient_GetISteamGameServerStats( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamApps **/ ISteamClient_GetISteamApps( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamNetworking **/ ISteamClient_GetISteamNetworking( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamRemoteStorage **/ ISteamClient_GetISteamRemoteStorage( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamScreenshots **/ ISteamClient_GetISteamScreenshots( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamGameSearch **/ ISteamClient_GetISteamGameSearch( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
uint /*uint32*/ ISteamClient_GetIPCCallCount();
|
|
||||||
void /*void*/ ISteamClient_SetWarningMessageHook( IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction );
|
|
||||||
bool /*bool*/ ISteamClient_BShutdownIfAllPipesClosed();
|
|
||||||
IntPtr /*class ISteamHTTP **/ ISteamClient_GetISteamHTTP( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamController **/ ISteamClient_GetISteamController( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamUGC **/ ISteamClient_GetISteamUGC( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamAppList **/ ISteamClient_GetISteamAppList( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamMusic **/ ISteamClient_GetISteamMusic( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamMusicRemote **/ ISteamClient_GetISteamMusicRemote( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamHTMLSurface **/ ISteamClient_GetISteamHTMLSurface( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamInventory **/ ISteamClient_GetISteamInventory( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamVideo **/ ISteamClient_GetISteamVideo( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamParentalSettings **/ ISteamClient_GetISteamParentalSettings( int hSteamuser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamInput **/ ISteamClient_GetISteamInput( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
IntPtr /*class ISteamParties **/ ISteamClient_GetISteamParties( int hSteamUser, int hSteamPipe, string /*const char **/ pchVersion );
|
|
||||||
bool /*bool*/ ISteamController_Init();
|
|
||||||
bool /*bool*/ ISteamController_Shutdown();
|
|
||||||
void /*void*/ ISteamController_RunFrame();
|
|
||||||
int /*int*/ ISteamController_GetConnectedControllers( IntPtr /*ControllerHandle_t **/ handlesOut );
|
|
||||||
ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ ISteamController_GetActionSetHandle( string /*const char **/ pszActionSetName );
|
|
||||||
void /*void*/ ISteamController_ActivateActionSet( ulong controllerHandle, ulong actionSetHandle );
|
|
||||||
ControllerActionSetHandle_t /*(ControllerActionSetHandle_t)*/ ISteamController_GetCurrentActionSet( ulong controllerHandle );
|
|
||||||
void /*void*/ ISteamController_ActivateActionSetLayer( ulong controllerHandle, ulong actionSetLayerHandle );
|
|
||||||
void /*void*/ ISteamController_DeactivateActionSetLayer( ulong controllerHandle, ulong actionSetLayerHandle );
|
|
||||||
void /*void*/ ISteamController_DeactivateAllActionSetLayers( ulong controllerHandle );
|
|
||||||
int /*int*/ ISteamController_GetActiveActionSetLayers( ulong controllerHandle, IntPtr /*ControllerActionSetHandle_t **/ handlesOut );
|
|
||||||
ControllerDigitalActionHandle_t /*(ControllerDigitalActionHandle_t)*/ ISteamController_GetDigitalActionHandle( string /*const char **/ pszActionName );
|
|
||||||
InputDigitalActionData_t /*struct InputDigitalActionData_t*/ ISteamController_GetDigitalActionData( ulong controllerHandle, ulong digitalActionHandle );
|
|
||||||
int /*int*/ ISteamController_GetDigitalActionOrigins( ulong controllerHandle, ulong actionSetHandle, ulong digitalActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut );
|
|
||||||
ControllerAnalogActionHandle_t /*(ControllerAnalogActionHandle_t)*/ ISteamController_GetAnalogActionHandle( string /*const char **/ pszActionName );
|
|
||||||
InputAnalogActionData_t /*struct InputAnalogActionData_t*/ ISteamController_GetAnalogActionData( ulong controllerHandle, ulong analogActionHandle );
|
|
||||||
int /*int*/ ISteamController_GetAnalogActionOrigins( ulong controllerHandle, ulong actionSetHandle, ulong analogActionHandle, out ControllerActionOrigin /*EControllerActionOrigin **/ originsOut );
|
|
||||||
IntPtr ISteamController_GetGlyphForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin );
|
|
||||||
IntPtr ISteamController_GetStringForActionOrigin( ControllerActionOrigin /*EControllerActionOrigin*/ eOrigin );
|
|
||||||
void /*void*/ ISteamController_StopAnalogActionMomentum( ulong controllerHandle, ulong eAction );
|
|
||||||
InputMotionData_t /*struct InputMotionData_t*/ ISteamController_GetMotionData( ulong controllerHandle );
|
|
||||||
void /*void*/ ISteamController_TriggerHapticPulse( ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec );
|
|
||||||
void /*void*/ ISteamController_TriggerRepeatedHapticPulse( ulong controllerHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags );
|
|
||||||
void /*void*/ ISteamController_TriggerVibration( ulong controllerHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed );
|
|
||||||
void /*void*/ ISteamController_SetLEDColor( ulong controllerHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags );
|
|
||||||
bool /*bool*/ ISteamController_ShowBindingPanel( ulong controllerHandle );
|
|
||||||
SteamInputType /*ESteamInputType*/ ISteamController_GetInputTypeForHandle( ulong controllerHandle );
|
|
||||||
ControllerHandle_t /*(ControllerHandle_t)*/ ISteamController_GetControllerForGamepadIndex( int /*int*/ nIndex );
|
|
||||||
int /*int*/ ISteamController_GetGamepadIndexForController( ulong ulControllerHandle );
|
|
||||||
IntPtr ISteamController_GetStringForXboxOrigin( XboxOrigin /*EXboxOrigin*/ eOrigin );
|
|
||||||
IntPtr ISteamController_GetGlyphForXboxOrigin( XboxOrigin /*EXboxOrigin*/ eOrigin );
|
|
||||||
ControllerActionOrigin /*EControllerActionOrigin*/ ISteamController_GetActionOriginFromXboxOrigin( ulong controllerHandle, XboxOrigin /*EXboxOrigin*/ eOrigin );
|
|
||||||
ControllerActionOrigin /*EControllerActionOrigin*/ ISteamController_TranslateActionOrigin( SteamInputType /*ESteamInputType*/ eDestinationInputType, ControllerActionOrigin /*EControllerActionOrigin*/ eSourceOrigin );
|
|
||||||
IntPtr ISteamFriends_GetPersonaName();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_SetPersonaName( string /*const char **/ pchPersonaName );
|
|
||||||
PersonaState /*EPersonaState*/ ISteamFriends_GetPersonaState();
|
|
||||||
int /*int*/ ISteamFriends_GetFriendCount( int /*int*/ iFriendFlags );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetFriendByIndex( int /*int*/ iFriend, int /*int*/ iFriendFlags );
|
|
||||||
FriendRelationship /*EFriendRelationship*/ ISteamFriends_GetFriendRelationship( ulong steamIDFriend );
|
|
||||||
PersonaState /*EPersonaState*/ ISteamFriends_GetFriendPersonaState( ulong steamIDFriend );
|
|
||||||
IntPtr ISteamFriends_GetFriendPersonaName( ulong steamIDFriend );
|
|
||||||
bool /*bool*/ ISteamFriends_GetFriendGamePlayed( ulong steamIDFriend, ref FriendGameInfo_t /*struct FriendGameInfo_t **/ pFriendGameInfo );
|
|
||||||
IntPtr ISteamFriends_GetFriendPersonaNameHistory( ulong steamIDFriend, int /*int*/ iPersonaName );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendSteamLevel( ulong steamIDFriend );
|
|
||||||
IntPtr ISteamFriends_GetPlayerNickname( ulong steamIDPlayer );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendsGroupCount();
|
|
||||||
FriendsGroupID_t /*(FriendsGroupID_t)*/ ISteamFriends_GetFriendsGroupIDByIndex( int /*int*/ iFG );
|
|
||||||
IntPtr ISteamFriends_GetFriendsGroupName( short friendsGroupID );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendsGroupMembersCount( short friendsGroupID );
|
|
||||||
void /*void*/ ISteamFriends_GetFriendsGroupMembersList( short friendsGroupID, IntPtr /*class CSteamID **/ pOutSteamIDMembers, int /*int*/ nMembersCount );
|
|
||||||
bool /*bool*/ ISteamFriends_HasFriend( ulong steamIDFriend, int /*int*/ iFriendFlags );
|
|
||||||
int /*int*/ ISteamFriends_GetClanCount();
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetClanByIndex( int /*int*/ iClan );
|
|
||||||
IntPtr ISteamFriends_GetClanName( ulong steamIDClan );
|
|
||||||
IntPtr ISteamFriends_GetClanTag( ulong steamIDClan );
|
|
||||||
bool /*bool*/ ISteamFriends_GetClanActivityCounts( ulong steamIDClan, out int /*int **/ pnOnline, out int /*int **/ pnInGame, out int /*int **/ pnChatting );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_DownloadClanActivityCounts( IntPtr /*class CSteamID **/ psteamIDClans, int /*int*/ cClansToRequest );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendCountFromSource( ulong steamIDSource );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetFriendFromSourceByIndex( ulong steamIDSource, int /*int*/ iFriend );
|
|
||||||
bool /*bool*/ ISteamFriends_IsUserInSource( ulong steamIDUser, ulong steamIDSource );
|
|
||||||
void /*void*/ ISteamFriends_SetInGameVoiceSpeaking( ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSpeaking );
|
|
||||||
void /*void*/ ISteamFriends_ActivateGameOverlay( string /*const char **/ pchDialog );
|
|
||||||
void /*void*/ ISteamFriends_ActivateGameOverlayToUser( string /*const char **/ pchDialog, ulong steamID );
|
|
||||||
void /*void*/ ISteamFriends_ActivateGameOverlayToWebPage( string /*const char **/ pchURL, ActivateGameOverlayToWebPageMode /*EActivateGameOverlayToWebPageMode*/ eMode );
|
|
||||||
void /*void*/ ISteamFriends_ActivateGameOverlayToStore( uint nAppID, OverlayToStoreFlag /*EOverlayToStoreFlag*/ eFlag );
|
|
||||||
void /*void*/ ISteamFriends_SetPlayedWith( ulong steamIDUserPlayedWith );
|
|
||||||
void /*void*/ ISteamFriends_ActivateGameOverlayInviteDialog( ulong steamIDLobby );
|
|
||||||
int /*int*/ ISteamFriends_GetSmallFriendAvatar( ulong steamIDFriend );
|
|
||||||
int /*int*/ ISteamFriends_GetMediumFriendAvatar( ulong steamIDFriend );
|
|
||||||
int /*int*/ ISteamFriends_GetLargeFriendAvatar( ulong steamIDFriend );
|
|
||||||
bool /*bool*/ ISteamFriends_RequestUserInformation( ulong steamIDUser, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireNameOnly );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_RequestClanOfficerList( ulong steamIDClan );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetClanOwner( ulong steamIDClan );
|
|
||||||
int /*int*/ ISteamFriends_GetClanOfficerCount( ulong steamIDClan );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetClanOfficerByIndex( ulong steamIDClan, int /*int*/ iOfficer );
|
|
||||||
uint /*uint32*/ ISteamFriends_GetUserRestrictions();
|
|
||||||
bool /*bool*/ ISteamFriends_SetRichPresence( string /*const char **/ pchKey, string /*const char **/ pchValue );
|
|
||||||
void /*void*/ ISteamFriends_ClearRichPresence();
|
|
||||||
IntPtr ISteamFriends_GetFriendRichPresence( ulong steamIDFriend, string /*const char **/ pchKey );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendRichPresenceKeyCount( ulong steamIDFriend );
|
|
||||||
IntPtr ISteamFriends_GetFriendRichPresenceKeyByIndex( ulong steamIDFriend, int /*int*/ iKey );
|
|
||||||
void /*void*/ ISteamFriends_RequestFriendRichPresence( ulong steamIDFriend );
|
|
||||||
bool /*bool*/ ISteamFriends_InviteUserToGame( ulong steamIDFriend, string /*const char **/ pchConnectString );
|
|
||||||
int /*int*/ ISteamFriends_GetCoplayFriendCount();
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetCoplayFriend( int /*int*/ iCoplayFriend );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendCoplayTime( ulong steamIDFriend );
|
|
||||||
AppId_t /*(AppId_t)*/ ISteamFriends_GetFriendCoplayGame( ulong steamIDFriend );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_JoinClanChatRoom( ulong steamIDClan );
|
|
||||||
bool /*bool*/ ISteamFriends_LeaveClanChatRoom( ulong steamIDClan );
|
|
||||||
int /*int*/ ISteamFriends_GetClanChatMemberCount( ulong steamIDClan );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamFriends_GetChatMemberByIndex( ulong steamIDClan, int /*int*/ iUser );
|
|
||||||
bool /*bool*/ ISteamFriends_SendClanChatMessage( ulong steamIDClanChat, string /*const char **/ pchText );
|
|
||||||
int /*int*/ ISteamFriends_GetClanChatMessage( ulong steamIDClanChat, int /*int*/ iMessage, IntPtr /*void **/ prgchText, int /*int*/ cchTextMax, out ChatEntryType /*EChatEntryType **/ peChatEntryType, out ulong psteamidChatter );
|
|
||||||
bool /*bool*/ ISteamFriends_IsClanChatAdmin( ulong steamIDClanChat, ulong steamIDUser );
|
|
||||||
bool /*bool*/ ISteamFriends_IsClanChatWindowOpenInSteam( ulong steamIDClanChat );
|
|
||||||
bool /*bool*/ ISteamFriends_OpenClanChatWindowInSteam( ulong steamIDClanChat );
|
|
||||||
bool /*bool*/ ISteamFriends_CloseClanChatWindowInSteam( ulong steamIDClanChat );
|
|
||||||
bool /*bool*/ ISteamFriends_SetListenForFriendsMessages( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bInterceptEnabled );
|
|
||||||
bool /*bool*/ ISteamFriends_ReplyToFriendMessage( ulong steamIDFriend, string /*const char **/ pchMsgToSend );
|
|
||||||
int /*int*/ ISteamFriends_GetFriendMessage( ulong steamIDFriend, int /*int*/ iMessageID, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_GetFollowerCount( ulong steamID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_IsFollowing( ulong steamID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamFriends_EnumerateFollowingList( uint /*uint32*/ unStartIndex );
|
|
||||||
bool /*bool*/ ISteamFriends_IsClanPublic( ulong steamIDClan );
|
|
||||||
bool /*bool*/ ISteamFriends_IsClanOfficialGameGroup( ulong steamIDClan );
|
|
||||||
int /*int*/ ISteamFriends_GetNumChatsWithUnreadPriorityMessages();
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_AddGameSearchParams( string /*const char **/ pchKeyToFind, string /*const char **/ pchValuesToFind );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SearchForGameWithLobby( ulong steamIDLobby, int /*int*/ nPlayerMin, int /*int*/ nPlayerMax );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SearchForGameSolo( int /*int*/ nPlayerMin, int /*int*/ nPlayerMax );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_AcceptGame();
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_DeclineGame();
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RetrieveConnectionDetails( ulong steamIDHost, System.Text.StringBuilder /*char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_EndGameSearch();
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SetGameHostParams( string /*const char **/ pchKey, string /*const char **/ pchValue );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SetConnectionDetails( string /*const char **/ pchConnectionDetails, int /*int*/ cubConnectionDetails );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_RequestPlayersForGame( int /*int*/ nPlayerMin, int /*int*/ nPlayerMax, int /*int*/ nMaxTeamSize );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_HostConfirmGameStart( ulong /*uint64*/ ullUniqueGameID );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_CancelRequestPlayersForGame();
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_SubmitPlayerResult( ulong /*uint64*/ ullUniqueGameID, ulong steamIDPlayer, PlayerResult_t /*EPlayerResult_t*/ EPlayerResult );
|
|
||||||
GameSearchErrorCode_t /*EGameSearchErrorCode_t*/ ISteamGameSearch_EndGame( ulong /*uint64*/ ullUniqueGameID );
|
|
||||||
bool /*bool*/ ISteamGameServer_InitGameServer( uint /*uint32*/ unIP, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, uint /*uint32*/ unFlags, uint nGameAppId, string /*const char **/ pchVersionString );
|
|
||||||
void /*void*/ ISteamGameServer_SetProduct( string /*const char **/ pszProduct );
|
|
||||||
void /*void*/ ISteamGameServer_SetGameDescription( string /*const char **/ pszGameDescription );
|
|
||||||
void /*void*/ ISteamGameServer_SetModDir( string /*const char **/ pszModDir );
|
|
||||||
void /*void*/ ISteamGameServer_SetDedicatedServer( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bDedicated );
|
|
||||||
void /*void*/ ISteamGameServer_LogOn( string /*const char **/ pszToken );
|
|
||||||
void /*void*/ ISteamGameServer_LogOnAnonymous();
|
|
||||||
void /*void*/ ISteamGameServer_LogOff();
|
|
||||||
bool /*bool*/ ISteamGameServer_BLoggedOn();
|
|
||||||
bool /*bool*/ ISteamGameServer_BSecure();
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamGameServer_GetSteamID();
|
|
||||||
bool /*bool*/ ISteamGameServer_WasRestartRequested();
|
|
||||||
void /*void*/ ISteamGameServer_SetMaxPlayerCount( int /*int*/ cPlayersMax );
|
|
||||||
void /*void*/ ISteamGameServer_SetBotPlayerCount( int /*int*/ cBotplayers );
|
|
||||||
void /*void*/ ISteamGameServer_SetServerName( string /*const char **/ pszServerName );
|
|
||||||
void /*void*/ ISteamGameServer_SetMapName( string /*const char **/ pszMapName );
|
|
||||||
void /*void*/ ISteamGameServer_SetPasswordProtected( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bPasswordProtected );
|
|
||||||
void /*void*/ ISteamGameServer_SetSpectatorPort( ushort /*uint16*/ unSpectatorPort );
|
|
||||||
void /*void*/ ISteamGameServer_SetSpectatorServerName( string /*const char **/ pszSpectatorServerName );
|
|
||||||
void /*void*/ ISteamGameServer_ClearAllKeyValues();
|
|
||||||
void /*void*/ ISteamGameServer_SetKeyValue( string /*const char **/ pKey, string /*const char **/ pValue );
|
|
||||||
void /*void*/ ISteamGameServer_SetGameTags( string /*const char **/ pchGameTags );
|
|
||||||
void /*void*/ ISteamGameServer_SetGameData( string /*const char **/ pchGameData );
|
|
||||||
void /*void*/ ISteamGameServer_SetRegion( string /*const char **/ pszRegion );
|
|
||||||
bool /*bool*/ ISteamGameServer_SendUserConnectAndAuthenticate( uint /*uint32*/ unIPClient, IntPtr /*const void **/ pvAuthBlob, uint /*uint32*/ cubAuthBlobSize, out ulong pSteamIDUser );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamGameServer_CreateUnauthenticatedUserConnection();
|
|
||||||
void /*void*/ ISteamGameServer_SendUserDisconnect( ulong steamIDUser );
|
|
||||||
bool /*bool*/ ISteamGameServer_BUpdateUserData( ulong steamIDUser, string /*const char **/ pchPlayerName, uint /*uint32*/ uScore );
|
|
||||||
HAuthTicket /*(HAuthTicket)*/ ISteamGameServer_GetAuthSessionTicket( IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket );
|
|
||||||
BeginAuthSessionResult /*EBeginAuthSessionResult*/ ISteamGameServer_BeginAuthSession( IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID );
|
|
||||||
void /*void*/ ISteamGameServer_EndAuthSession( ulong steamID );
|
|
||||||
void /*void*/ ISteamGameServer_CancelAuthTicket( uint hAuthTicket );
|
|
||||||
UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ ISteamGameServer_UserHasLicenseForApp( ulong steamID, uint appID );
|
|
||||||
bool /*bool*/ ISteamGameServer_RequestUserGroupStatus( ulong steamIDUser, ulong steamIDGroup );
|
|
||||||
void /*void*/ ISteamGameServer_GetGameplayStats();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamGameServer_GetServerReputation();
|
|
||||||
uint /*uint32*/ ISteamGameServer_GetPublicIP();
|
|
||||||
bool /*bool*/ ISteamGameServer_HandleIncomingPacket( IntPtr /*const void **/ pData, int /*int*/ cbData, uint /*uint32*/ srcIP, ushort /*uint16*/ srcPort );
|
|
||||||
int /*int*/ ISteamGameServer_GetNextOutgoingPacket( IntPtr /*void **/ pOut, int /*int*/ cbMaxOut, out uint /*uint32 **/ pNetAdr, out ushort /*uint16 **/ pPort );
|
|
||||||
void /*void*/ ISteamGameServer_EnableHeartbeats( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bActive );
|
|
||||||
void /*void*/ ISteamGameServer_SetHeartbeatInterval( int /*int*/ iHeartbeatInterval );
|
|
||||||
void /*void*/ ISteamGameServer_ForceHeartbeat();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamGameServer_AssociateWithClan( ulong steamIDClan );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamGameServer_ComputeNewPlayerCompatibility( ulong steamIDNewPlayer );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamGameServerStats_RequestUserStats( ulong steamIDUser );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_GetUserStat( ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_GetUserStat0( ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_GetUserAchievement( ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_SetUserStat( ulong steamIDUser, string /*const char **/ pchName, int /*int32*/ nData );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_SetUserStat0( ulong steamIDUser, string /*const char **/ pchName, float /*float*/ fData );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_UpdateUserAvgRateStat( ulong steamIDUser, string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_SetUserAchievement( ulong steamIDUser, string /*const char **/ pchName );
|
|
||||||
bool /*bool*/ ISteamGameServerStats_ClearUserAchievement( ulong steamIDUser, string /*const char **/ pchName );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamGameServerStats_StoreUserStats( ulong steamIDUser );
|
|
||||||
void /*void*/ ISteamHTMLSurface_DestructISteamHTMLSurface();
|
|
||||||
bool /*bool*/ ISteamHTMLSurface_Init();
|
|
||||||
bool /*bool*/ ISteamHTMLSurface_Shutdown();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamHTMLSurface_CreateBrowser( string /*const char **/ pchUserAgent, string /*const char **/ pchUserCSS );
|
|
||||||
void /*void*/ ISteamHTMLSurface_RemoveBrowser( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_LoadURL( uint unBrowserHandle, string /*const char **/ pchURL, string /*const char **/ pchPostData );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetSize( uint unBrowserHandle, uint /*uint32*/ unWidth, uint /*uint32*/ unHeight );
|
|
||||||
void /*void*/ ISteamHTMLSurface_StopLoad( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_Reload( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_GoBack( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_GoForward( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_AddHeader( uint unBrowserHandle, string /*const char **/ pchKey, string /*const char **/ pchValue );
|
|
||||||
void /*void*/ ISteamHTMLSurface_ExecuteJavascript( uint unBrowserHandle, string /*const char **/ pchScript );
|
|
||||||
void /*void*/ ISteamHTMLSurface_MouseUp( uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton );
|
|
||||||
void /*void*/ ISteamHTMLSurface_MouseDown( uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton );
|
|
||||||
void /*void*/ ISteamHTMLSurface_MouseDoubleClick( uint unBrowserHandle, HTMLMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ eMouseButton );
|
|
||||||
void /*void*/ ISteamHTMLSurface_MouseMove( uint unBrowserHandle, int /*int*/ x, int /*int*/ y );
|
|
||||||
void /*void*/ ISteamHTMLSurface_MouseWheel( uint unBrowserHandle, int /*int32*/ nDelta );
|
|
||||||
void /*void*/ ISteamHTMLSurface_KeyDown( uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bIsSystemKey );
|
|
||||||
void /*void*/ ISteamHTMLSurface_KeyUp( uint unBrowserHandle, uint /*uint32*/ nNativeKeyCode, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers );
|
|
||||||
void /*void*/ ISteamHTMLSurface_KeyChar( uint unBrowserHandle, uint /*uint32*/ cUnicodeChar, HTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ eHTMLKeyModifiers );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetHorizontalScroll( uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetVerticalScroll( uint unBrowserHandle, uint /*uint32*/ nAbsolutePixelScroll );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetKeyFocus( uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHasKeyFocus );
|
|
||||||
void /*void*/ ISteamHTMLSurface_ViewSource( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_CopyToClipboard( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_PasteFromClipboard( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_Find( uint unBrowserHandle, string /*const char **/ pchSearchStr, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bCurrentlyInFind, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReverse );
|
|
||||||
void /*void*/ ISteamHTMLSurface_StopFind( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_GetLinkAtPosition( uint unBrowserHandle, int /*int*/ x, int /*int*/ y );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetCookie( string /*const char **/ pchHostname, string /*const char **/ pchKey, string /*const char **/ pchValue, string /*const char **/ pchPath, uint nExpires, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHTTPOnly );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetPageScaleFactor( uint unBrowserHandle, float /*float*/ flZoom, int /*int*/ nPointX, int /*int*/ nPointY );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetBackgroundMode( uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bBackgroundMode );
|
|
||||||
void /*void*/ ISteamHTMLSurface_SetDPIScalingFactor( uint unBrowserHandle, float /*float*/ flDPIScaling );
|
|
||||||
void /*void*/ ISteamHTMLSurface_OpenDeveloperTools( uint unBrowserHandle );
|
|
||||||
void /*void*/ ISteamHTMLSurface_AllowStartRequest( uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowed );
|
|
||||||
void /*void*/ ISteamHTMLSurface_JSDialogResponse( uint unBrowserHandle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bResult );
|
|
||||||
HTTPRequestHandle /*(HTTPRequestHandle)*/ ISteamHTTP_CreateHTTPRequest( HTTPMethod /*EHTTPMethod*/ eHTTPRequestMethod, string /*const char **/ pchAbsoluteURL );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestContextValue( uint hRequest, ulong /*uint64*/ ulContextValue );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( uint hRequest, uint /*uint32*/ unTimeoutSeconds );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestHeaderValue( uint hRequest, string /*const char **/ pchHeaderName, string /*const char **/ pchHeaderValue );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestGetOrPostParameter( uint hRequest, string /*const char **/ pchParamName, string /*const char **/ pchParamValue );
|
|
||||||
bool /*bool*/ ISteamHTTP_SendHTTPRequest( uint hRequest, ref ulong pCallHandle );
|
|
||||||
bool /*bool*/ ISteamHTTP_SendHTTPRequestAndStreamResponse( uint hRequest, ref ulong pCallHandle );
|
|
||||||
bool /*bool*/ ISteamHTTP_DeferHTTPRequest( uint hRequest );
|
|
||||||
bool /*bool*/ ISteamHTTP_PrioritizeHTTPRequest( uint hRequest );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPResponseHeaderSize( uint hRequest, string /*const char **/ pchHeaderName, out uint /*uint32 **/ unResponseHeaderSize );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPResponseHeaderValue( uint hRequest, string /*const char **/ pchHeaderName, out byte /*uint8 **/ pHeaderValueBuffer, uint /*uint32*/ unBufferSize );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPResponseBodySize( uint hRequest, out uint /*uint32 **/ unBodySize );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPResponseBodyData( uint hRequest, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPStreamingResponseBodyData( uint hRequest, uint /*uint32*/ cOffset, out byte /*uint8 **/ pBodyDataBuffer, uint /*uint32*/ unBufferSize );
|
|
||||||
bool /*bool*/ ISteamHTTP_ReleaseHTTPRequest( uint hRequest );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPDownloadProgressPct( uint hRequest, out float /*float **/ pflPercentOut );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestRawPostBody( uint hRequest, string /*const char **/ pchContentType, out byte /*uint8 **/ pubBody, uint /*uint32*/ unBodyLen );
|
|
||||||
HTTPCookieContainerHandle /*(HTTPCookieContainerHandle)*/ ISteamHTTP_CreateCookieContainer( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowResponsesToModify );
|
|
||||||
bool /*bool*/ ISteamHTTP_ReleaseCookieContainer( uint hCookieContainer );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetCookie( uint hCookieContainer, string /*const char **/ pchHost, string /*const char **/ pchUrl, string /*const char **/ pchCookie );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestCookieContainer( uint hRequest, uint hCookieContainer );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestUserAgentInfo( uint hRequest, string /*const char **/ pchUserAgentInfo );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( uint hRequest, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRequireVerifiedCertificate );
|
|
||||||
bool /*bool*/ ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( uint hRequest, uint /*uint32*/ unMilliseconds );
|
|
||||||
bool /*bool*/ ISteamHTTP_GetHTTPRequestWasTimedOut( uint hRequest, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbWasTimedOut );
|
|
||||||
bool /*bool*/ ISteamInput_Init();
|
|
||||||
bool /*bool*/ ISteamInput_Shutdown();
|
|
||||||
void /*void*/ ISteamInput_RunFrame();
|
|
||||||
int /*int*/ ISteamInput_GetConnectedControllers( IntPtr /*InputHandle_t **/ handlesOut );
|
|
||||||
InputActionSetHandle_t /*(InputActionSetHandle_t)*/ ISteamInput_GetActionSetHandle( string /*const char **/ pszActionSetName );
|
|
||||||
void /*void*/ ISteamInput_ActivateActionSet( ulong inputHandle, ulong actionSetHandle );
|
|
||||||
InputActionSetHandle_t /*(InputActionSetHandle_t)*/ ISteamInput_GetCurrentActionSet( ulong inputHandle );
|
|
||||||
void /*void*/ ISteamInput_ActivateActionSetLayer( ulong inputHandle, ulong actionSetLayerHandle );
|
|
||||||
void /*void*/ ISteamInput_DeactivateActionSetLayer( ulong inputHandle, ulong actionSetLayerHandle );
|
|
||||||
void /*void*/ ISteamInput_DeactivateAllActionSetLayers( ulong inputHandle );
|
|
||||||
int /*int*/ ISteamInput_GetActiveActionSetLayers( ulong inputHandle, IntPtr /*InputActionSetHandle_t **/ handlesOut );
|
|
||||||
InputDigitalActionHandle_t /*(InputDigitalActionHandle_t)*/ ISteamInput_GetDigitalActionHandle( string /*const char **/ pszActionName );
|
|
||||||
InputDigitalActionData_t /*struct InputDigitalActionData_t*/ ISteamInput_GetDigitalActionData( ulong inputHandle, ulong digitalActionHandle );
|
|
||||||
int /*int*/ ISteamInput_GetDigitalActionOrigins( ulong inputHandle, ulong actionSetHandle, ulong digitalActionHandle, out InputActionOrigin /*EInputActionOrigin **/ originsOut );
|
|
||||||
InputAnalogActionHandle_t /*(InputAnalogActionHandle_t)*/ ISteamInput_GetAnalogActionHandle( string /*const char **/ pszActionName );
|
|
||||||
InputAnalogActionData_t /*struct InputAnalogActionData_t*/ ISteamInput_GetAnalogActionData( ulong inputHandle, ulong analogActionHandle );
|
|
||||||
int /*int*/ ISteamInput_GetAnalogActionOrigins( ulong inputHandle, ulong actionSetHandle, ulong analogActionHandle, out InputActionOrigin /*EInputActionOrigin **/ originsOut );
|
|
||||||
IntPtr ISteamInput_GetGlyphForActionOrigin( InputActionOrigin /*EInputActionOrigin*/ eOrigin );
|
|
||||||
IntPtr ISteamInput_GetStringForActionOrigin( InputActionOrigin /*EInputActionOrigin*/ eOrigin );
|
|
||||||
void /*void*/ ISteamInput_StopAnalogActionMomentum( ulong inputHandle, ulong eAction );
|
|
||||||
InputMotionData_t /*struct InputMotionData_t*/ ISteamInput_GetMotionData( ulong inputHandle );
|
|
||||||
void /*void*/ ISteamInput_TriggerVibration( ulong inputHandle, ushort /*unsigned short*/ usLeftSpeed, ushort /*unsigned short*/ usRightSpeed );
|
|
||||||
void /*void*/ ISteamInput_SetLEDColor( ulong inputHandle, byte /*uint8*/ nColorR, byte /*uint8*/ nColorG, byte /*uint8*/ nColorB, uint /*unsigned int*/ nFlags );
|
|
||||||
void /*void*/ ISteamInput_TriggerHapticPulse( ulong inputHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec );
|
|
||||||
void /*void*/ ISteamInput_TriggerRepeatedHapticPulse( ulong inputHandle, SteamControllerPad /*ESteamControllerPad*/ eTargetPad, ushort /*unsigned short*/ usDurationMicroSec, ushort /*unsigned short*/ usOffMicroSec, ushort /*unsigned short*/ unRepeat, uint /*unsigned int*/ nFlags );
|
|
||||||
bool /*bool*/ ISteamInput_ShowBindingPanel( ulong inputHandle );
|
|
||||||
SteamInputType /*ESteamInputType*/ ISteamInput_GetInputTypeForHandle( ulong inputHandle );
|
|
||||||
InputHandle_t /*(InputHandle_t)*/ ISteamInput_GetControllerForGamepadIndex( int /*int*/ nIndex );
|
|
||||||
int /*int*/ ISteamInput_GetGamepadIndexForController( ulong ulinputHandle );
|
|
||||||
IntPtr ISteamInput_GetStringForXboxOrigin( XboxOrigin /*EXboxOrigin*/ eOrigin );
|
|
||||||
IntPtr ISteamInput_GetGlyphForXboxOrigin( XboxOrigin /*EXboxOrigin*/ eOrigin );
|
|
||||||
InputActionOrigin /*EInputActionOrigin*/ ISteamInput_GetActionOriginFromXboxOrigin( ulong inputHandle, XboxOrigin /*EXboxOrigin*/ eOrigin );
|
|
||||||
InputActionOrigin /*EInputActionOrigin*/ ISteamInput_TranslateActionOrigin( SteamInputType /*ESteamInputType*/ eDestinationInputType, InputActionOrigin /*EInputActionOrigin*/ eSourceOrigin );
|
|
||||||
Result /*EResult*/ ISteamInventory_GetResultStatus( int resultHandle );
|
|
||||||
bool /*bool*/ ISteamInventory_GetResultItems( int resultHandle, IntPtr /*struct SteamItemDetails_t **/ pOutItemsArray, out uint /*uint32 **/ punOutItemsArraySize );
|
|
||||||
bool /*bool*/ ISteamInventory_GetResultItemProperty( int resultHandle, uint /*uint32*/ unItemIndex, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut );
|
|
||||||
uint /*uint32*/ ISteamInventory_GetResultTimestamp( int resultHandle );
|
|
||||||
bool /*bool*/ ISteamInventory_CheckResultSteamID( int resultHandle, ulong steamIDExpected );
|
|
||||||
void /*void*/ ISteamInventory_DestroyResult( int resultHandle );
|
|
||||||
bool /*bool*/ ISteamInventory_GetAllItems( ref int pResultHandle );
|
|
||||||
bool /*bool*/ ISteamInventory_GetItemsByID( ref int pResultHandle, ulong[] pInstanceIDs, uint /*uint32*/ unCountInstanceIDs );
|
|
||||||
bool /*bool*/ ISteamInventory_SerializeResult( int resultHandle, IntPtr /*void **/ pOutBuffer, out uint /*uint32 **/ punOutBufferSize );
|
|
||||||
bool /*bool*/ ISteamInventory_DeserializeResult( ref int pOutResultHandle, IntPtr /*const void **/ pBuffer, uint /*uint32*/ unBufferSize, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bRESERVED_MUST_BE_FALSE );
|
|
||||||
bool /*bool*/ ISteamInventory_GenerateItems( ref int pResultHandle, int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength );
|
|
||||||
bool /*bool*/ ISteamInventory_GrantPromoItems( ref int pResultHandle );
|
|
||||||
bool /*bool*/ ISteamInventory_AddPromoItem( ref int pResultHandle, int itemDef );
|
|
||||||
bool /*bool*/ ISteamInventory_AddPromoItems( ref int pResultHandle, int[] pArrayItemDefs, uint /*uint32*/ unArrayLength );
|
|
||||||
bool /*bool*/ ISteamInventory_ConsumeItem( ref int pResultHandle, ulong itemConsume, uint /*uint32*/ unQuantity );
|
|
||||||
bool /*bool*/ ISteamInventory_ExchangeItems( ref int pResultHandle, int[] pArrayGenerate, uint[] /*const uint32 **/ punArrayGenerateQuantity, uint /*uint32*/ unArrayGenerateLength, ulong[] pArrayDestroy, uint[] /*const uint32 **/ punArrayDestroyQuantity, uint /*uint32*/ unArrayDestroyLength );
|
|
||||||
bool /*bool*/ ISteamInventory_TransferItemQuantity( ref int pResultHandle, ulong itemIdSource, uint /*uint32*/ unQuantity, ulong itemIdDest );
|
|
||||||
void /*void*/ ISteamInventory_SendItemDropHeartbeat();
|
|
||||||
bool /*bool*/ ISteamInventory_TriggerItemDrop( ref int pResultHandle, int dropListDefinition );
|
|
||||||
bool /*bool*/ ISteamInventory_TradeItems( ref int pResultHandle, ulong steamIDTradePartner, ulong[] pArrayGive, uint[] /*const uint32 **/ pArrayGiveQuantity, uint /*uint32*/ nArrayGiveLength, ulong[] pArrayGet, uint[] /*const uint32 **/ pArrayGetQuantity, uint /*uint32*/ nArrayGetLength );
|
|
||||||
bool /*bool*/ ISteamInventory_LoadItemDefinitions();
|
|
||||||
bool /*bool*/ ISteamInventory_GetItemDefinitionIDs( IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize );
|
|
||||||
bool /*bool*/ ISteamInventory_GetItemDefinitionProperty( int iDefinition, string /*const char **/ pchPropertyName, System.Text.StringBuilder /*char **/ pchValueBuffer, out uint /*uint32 **/ punValueBufferSizeOut );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( ulong steamID );
|
|
||||||
bool /*bool*/ ISteamInventory_GetEligiblePromoItemDefinitionIDs( ulong steamID, IntPtr /*SteamItemDef_t **/ pItemDefIDs, out uint /*uint32 **/ punItemDefIDsArraySize );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_StartPurchase( int[] pArrayItemDefs, uint[] /*const uint32 **/ punArrayQuantity, uint /*uint32*/ unArrayLength );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamInventory_RequestPrices();
|
|
||||||
uint /*uint32*/ ISteamInventory_GetNumItemsWithPrices();
|
|
||||||
bool /*bool*/ ISteamInventory_GetItemsWithPrices( IntPtr /*SteamItemDef_t **/ pArrayItemDefs, IntPtr /*uint64 **/ pCurrentPrices, IntPtr /*uint64 **/ pBasePrices, uint /*uint32*/ unArrayLength );
|
|
||||||
bool /*bool*/ ISteamInventory_GetItemPrice( int iDefinition, out ulong /*uint64 **/ pCurrentPrice, out ulong /*uint64 **/ pBasePrice );
|
|
||||||
SteamInventoryUpdateHandle_t /*(SteamInventoryUpdateHandle_t)*/ ISteamInventory_StartUpdateProperties();
|
|
||||||
bool /*bool*/ ISteamInventory_RemoveProperty( ulong handle, ulong nItemID, string /*const char **/ pchPropertyName );
|
|
||||||
bool /*bool*/ ISteamInventory_SetProperty( ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, string /*const char **/ pchPropertyValue );
|
|
||||||
bool /*bool*/ ISteamInventory_SetProperty0( ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamInventory_SetProperty0( ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, long /*int64*/ nValue );
|
|
||||||
bool /*bool*/ ISteamInventory_SetProperty0( ulong handle, ulong nItemID, string /*const char **/ pchPropertyName, float /*float*/ flValue );
|
|
||||||
bool /*bool*/ ISteamInventory_SubmitUpdateProperties( ulong handle, ref int pResultHandle );
|
|
||||||
int /*int*/ ISteamMatchmaking_GetFavoriteGameCount();
|
|
||||||
bool /*bool*/ ISteamMatchmaking_GetFavoriteGame( int /*int*/ iGame, ref uint pnAppID, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnConnPort, out ushort /*uint16 **/ pnQueryPort, out uint /*uint32 **/ punFlags, out uint /*uint32 **/ pRTime32LastPlayedOnServer );
|
|
||||||
int /*int*/ ISteamMatchmaking_AddFavoriteGame( uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags, uint /*uint32*/ rTime32LastPlayedOnServer );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_RemoveFavoriteGame( uint nAppID, uint /*uint32*/ nIP, ushort /*uint16*/ nConnPort, ushort /*uint16*/ nQueryPort, uint /*uint32*/ unFlags );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamMatchmaking_RequestLobbyList();
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListStringFilter( string /*const char **/ pchKeyToMatch, string /*const char **/ pchValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType );
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListNumericalFilter( string /*const char **/ pchKeyToMatch, int /*int*/ nValueToMatch, LobbyComparison /*ELobbyComparison*/ eComparisonType );
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListNearValueFilter( string /*const char **/ pchKeyToMatch, int /*int*/ nValueToBeCloseTo );
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( int /*int*/ nSlotsAvailable );
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListDistanceFilter( LobbyDistanceFilter /*ELobbyDistanceFilter*/ eLobbyDistanceFilter );
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListResultCountFilter( int /*int*/ cMaxResults );
|
|
||||||
void /*void*/ ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( ulong steamIDLobby );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamMatchmaking_GetLobbyByIndex( int /*int*/ iLobby );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamMatchmaking_CreateLobby( LobbyType /*ELobbyType*/ eLobbyType, int /*int*/ cMaxMembers );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamMatchmaking_JoinLobby( ulong steamIDLobby );
|
|
||||||
void /*void*/ ISteamMatchmaking_LeaveLobby( ulong steamIDLobby );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_InviteUserToLobby( ulong steamIDLobby, ulong steamIDInvitee );
|
|
||||||
int /*int*/ ISteamMatchmaking_GetNumLobbyMembers( ulong steamIDLobby );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamMatchmaking_GetLobbyMemberByIndex( ulong steamIDLobby, int /*int*/ iMember );
|
|
||||||
IntPtr ISteamMatchmaking_GetLobbyData( ulong steamIDLobby, string /*const char **/ pchKey );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SetLobbyData( ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue );
|
|
||||||
int /*int*/ ISteamMatchmaking_GetLobbyDataCount( ulong steamIDLobby );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_GetLobbyDataByIndex( ulong steamIDLobby, int /*int*/ iLobbyData, System.Text.StringBuilder /*char **/ pchKey, int /*int*/ cchKeyBufferSize, System.Text.StringBuilder /*char **/ pchValue, int /*int*/ cchValueBufferSize );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_DeleteLobbyData( ulong steamIDLobby, string /*const char **/ pchKey );
|
|
||||||
IntPtr ISteamMatchmaking_GetLobbyMemberData( ulong steamIDLobby, ulong steamIDUser, string /*const char **/ pchKey );
|
|
||||||
void /*void*/ ISteamMatchmaking_SetLobbyMemberData( ulong steamIDLobby, string /*const char **/ pchKey, string /*const char **/ pchValue );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SendLobbyChatMsg( ulong steamIDLobby, IntPtr /*const void **/ pvMsgBody, int /*int*/ cubMsgBody );
|
|
||||||
int /*int*/ ISteamMatchmaking_GetLobbyChatEntry( ulong steamIDLobby, int /*int*/ iChatID, out ulong pSteamIDUser, IntPtr /*void **/ pvData, int /*int*/ cubData, out ChatEntryType /*EChatEntryType **/ peChatEntryType );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_RequestLobbyData( ulong steamIDLobby );
|
|
||||||
void /*void*/ ISteamMatchmaking_SetLobbyGameServer( ulong steamIDLobby, uint /*uint32*/ unGameServerIP, ushort /*uint16*/ unGameServerPort, ulong steamIDGameServer );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_GetLobbyGameServer( ulong steamIDLobby, out uint /*uint32 **/ punGameServerIP, out ushort /*uint16 **/ punGameServerPort, out ulong psteamIDGameServer );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SetLobbyMemberLimit( ulong steamIDLobby, int /*int*/ cMaxMembers );
|
|
||||||
int /*int*/ ISteamMatchmaking_GetLobbyMemberLimit( ulong steamIDLobby );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SetLobbyType( ulong steamIDLobby, LobbyType /*ELobbyType*/ eLobbyType );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SetLobbyJoinable( ulong steamIDLobby, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bLobbyJoinable );
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamMatchmaking_GetLobbyOwner( ulong steamIDLobby );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SetLobbyOwner( ulong steamIDLobby, ulong steamIDNewOwner );
|
|
||||||
bool /*bool*/ ISteamMatchmaking_SetLinkedLobby( ulong steamIDLobby, ulong steamIDLobbyDependent );
|
|
||||||
HServerListRequest /*(HServerListRequest)*/ ISteamMatchmakingServers_RequestInternetServerList( uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse );
|
|
||||||
HServerListRequest /*(HServerListRequest)*/ ISteamMatchmakingServers_RequestLANServerList( uint iApp, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse );
|
|
||||||
HServerListRequest /*(HServerListRequest)*/ ISteamMatchmakingServers_RequestFriendsServerList( uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse );
|
|
||||||
HServerListRequest /*(HServerListRequest)*/ ISteamMatchmakingServers_RequestFavoritesServerList( uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse );
|
|
||||||
HServerListRequest /*(HServerListRequest)*/ ISteamMatchmakingServers_RequestHistoryServerList( uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse );
|
|
||||||
HServerListRequest /*(HServerListRequest)*/ ISteamMatchmakingServers_RequestSpectatorServerList( uint iApp, IntPtr /*struct MatchMakingKeyValuePair_t ***/ ppchFilters, uint /*uint32*/ nFilters, IntPtr /*class ISteamMatchmakingServerListResponse **/ pRequestServersResponse );
|
|
||||||
void /*void*/ ISteamMatchmakingServers_ReleaseRequest( IntPtr hServerListRequest );
|
|
||||||
IntPtr /*class gameserveritem_t **/ ISteamMatchmakingServers_GetServerDetails( IntPtr hRequest, int /*int*/ iServer );
|
|
||||||
void /*void*/ ISteamMatchmakingServers_CancelQuery( IntPtr hRequest );
|
|
||||||
void /*void*/ ISteamMatchmakingServers_RefreshQuery( IntPtr hRequest );
|
|
||||||
bool /*bool*/ ISteamMatchmakingServers_IsRefreshing( IntPtr hRequest );
|
|
||||||
int /*int*/ ISteamMatchmakingServers_GetServerCount( IntPtr hRequest );
|
|
||||||
void /*void*/ ISteamMatchmakingServers_RefreshServer( IntPtr hRequest, int /*int*/ iServer );
|
|
||||||
HServerQuery /*(HServerQuery)*/ ISteamMatchmakingServers_PingServer( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPingResponse **/ pRequestServersResponse );
|
|
||||||
HServerQuery /*(HServerQuery)*/ ISteamMatchmakingServers_PlayerDetails( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingPlayersResponse **/ pRequestServersResponse );
|
|
||||||
HServerQuery /*(HServerQuery)*/ ISteamMatchmakingServers_ServerRules( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, IntPtr /*class ISteamMatchmakingRulesResponse **/ pRequestServersResponse );
|
|
||||||
void /*void*/ ISteamMatchmakingServers_CancelServerQuery( int hServerQuery );
|
|
||||||
bool /*bool*/ ISteamMusic_BIsEnabled();
|
|
||||||
bool /*bool*/ ISteamMusic_BIsPlaying();
|
|
||||||
AudioPlayback_Status /*AudioPlayback_Status*/ ISteamMusic_GetPlaybackStatus();
|
|
||||||
void /*void*/ ISteamMusic_Play();
|
|
||||||
void /*void*/ ISteamMusic_Pause();
|
|
||||||
void /*void*/ ISteamMusic_PlayPrevious();
|
|
||||||
void /*void*/ ISteamMusic_PlayNext();
|
|
||||||
void /*void*/ ISteamMusic_SetVolume( float /*float*/ flVolume );
|
|
||||||
float /*float*/ ISteamMusic_GetVolume();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_RegisterSteamMusicRemote( string /*const char **/ pchName );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_DeregisterSteamMusicRemote();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_BIsCurrentMusicRemote();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_BActivationSuccess( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_SetDisplayName( string /*const char **/ pchDisplayName );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_SetPNGIcon_64x64( IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_EnablePlayPrevious( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_EnablePlayNext( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_EnableShuffled( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_EnableLooped( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_EnableQueue( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_EnablePlaylists( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdatePlaybackStatus( AudioPlayback_Status /*AudioPlayback_Status*/ nStatus );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdateShuffled( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdateLooped( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdateVolume( float /*float*/ flValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_CurrentEntryWillChange();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_CurrentEntryIsAvailable( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAvailable );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdateCurrentEntryText( string /*const char **/ pchText );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( int /*int*/ nValue );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_UpdateCurrentEntryCoverArt( IntPtr /*void **/ pvBuffer, uint /*uint32*/ cbBufferLength );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_CurrentEntryDidChange();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_QueueWillChange();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_ResetQueueEntries();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_SetQueueEntry( int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_SetCurrentQueueEntry( int /*int*/ nID );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_QueueDidChange();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_PlaylistWillChange();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_ResetPlaylistEntries();
|
|
||||||
bool /*bool*/ ISteamMusicRemote_SetPlaylistEntry( int /*int*/ nID, int /*int*/ nPosition, string /*const char **/ pchEntryText );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_SetCurrentPlaylistEntry( int /*int*/ nID );
|
|
||||||
bool /*bool*/ ISteamMusicRemote_PlaylistDidChange();
|
|
||||||
bool /*bool*/ ISteamNetworking_SendP2PPacket( ulong steamIDRemote, IntPtr /*const void **/ pubData, uint /*uint32*/ cubData, P2PSend /*EP2PSend*/ eP2PSendType, int /*int*/ nChannel );
|
|
||||||
bool /*bool*/ ISteamNetworking_IsP2PPacketAvailable( out uint /*uint32 **/ pcubMsgSize, int /*int*/ nChannel );
|
|
||||||
bool /*bool*/ ISteamNetworking_ReadP2PPacket( IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, out ulong psteamIDRemote, int /*int*/ nChannel );
|
|
||||||
bool /*bool*/ ISteamNetworking_AcceptP2PSessionWithUser( ulong steamIDRemote );
|
|
||||||
bool /*bool*/ ISteamNetworking_CloseP2PSessionWithUser( ulong steamIDRemote );
|
|
||||||
bool /*bool*/ ISteamNetworking_CloseP2PChannelWithUser( ulong steamIDRemote, int /*int*/ nChannel );
|
|
||||||
bool /*bool*/ ISteamNetworking_GetP2PSessionState( ulong steamIDRemote, ref P2PSessionState_t /*struct P2PSessionState_t **/ pConnectionState );
|
|
||||||
bool /*bool*/ ISteamNetworking_AllowP2PPacketRelay( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllow );
|
|
||||||
SNetListenSocket_t /*(SNetListenSocket_t)*/ ISteamNetworking_CreateListenSocket( int /*int*/ nVirtualP2PPort, uint /*uint32*/ nIP, ushort /*uint16*/ nPort, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay );
|
|
||||||
SNetSocket_t /*(SNetSocket_t)*/ ISteamNetworking_CreateP2PConnectionSocket( ulong steamIDTarget, int /*int*/ nVirtualPort, int /*int*/ nTimeoutSec, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowUseOfPacketRelay );
|
|
||||||
SNetSocket_t /*(SNetSocket_t)*/ ISteamNetworking_CreateConnectionSocket( uint /*uint32*/ nIP, ushort /*uint16*/ nPort, int /*int*/ nTimeoutSec );
|
|
||||||
bool /*bool*/ ISteamNetworking_DestroySocket( uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd );
|
|
||||||
bool /*bool*/ ISteamNetworking_DestroyListenSocket( uint hSocket, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bNotifyRemoteEnd );
|
|
||||||
bool /*bool*/ ISteamNetworking_SendDataOnSocket( uint hSocket, IntPtr /*void **/ pubData, uint /*uint32*/ cubData, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReliable );
|
|
||||||
bool /*bool*/ ISteamNetworking_IsDataAvailableOnSocket( uint hSocket, out uint /*uint32 **/ pcubMsgSize );
|
|
||||||
bool /*bool*/ ISteamNetworking_RetrieveDataFromSocket( uint hSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize );
|
|
||||||
bool /*bool*/ ISteamNetworking_IsDataAvailable( uint hListenSocket, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket );
|
|
||||||
bool /*bool*/ ISteamNetworking_RetrieveData( uint hListenSocket, IntPtr /*void **/ pubDest, uint /*uint32*/ cubDest, out uint /*uint32 **/ pcubMsgSize, ref uint phSocket );
|
|
||||||
bool /*bool*/ ISteamNetworking_GetSocketInfo( uint hSocket, out ulong pSteamIDRemote, IntPtr /*int **/ peSocketStatus, out uint /*uint32 **/ punIPRemote, out ushort /*uint16 **/ punPortRemote );
|
|
||||||
bool /*bool*/ ISteamNetworking_GetListenSocketInfo( uint hListenSocket, out uint /*uint32 **/ pnIP, out ushort /*uint16 **/ pnPort );
|
|
||||||
SNetSocketConnectionType /*ESNetSocketConnectionType*/ ISteamNetworking_GetSocketConnectionType( uint hSocket );
|
|
||||||
int /*int*/ ISteamNetworking_GetMaxPacketSize( uint hSocket );
|
|
||||||
bool /*bool*/ ISteamParentalSettings_BIsParentalLockEnabled();
|
|
||||||
bool /*bool*/ ISteamParentalSettings_BIsParentalLockLocked();
|
|
||||||
bool /*bool*/ ISteamParentalSettings_BIsAppBlocked( uint nAppID );
|
|
||||||
bool /*bool*/ ISteamParentalSettings_BIsAppInBlockList( uint nAppID );
|
|
||||||
bool /*bool*/ ISteamParentalSettings_BIsFeatureBlocked( ParentalFeature /*EParentalFeature*/ eFeature );
|
|
||||||
bool /*bool*/ ISteamParentalSettings_BIsFeatureInBlockList( ParentalFeature /*EParentalFeature*/ eFeature );
|
|
||||||
uint /*uint32*/ ISteamParties_GetNumActiveBeacons();
|
|
||||||
PartyBeaconID_t /*(PartyBeaconID_t)*/ ISteamParties_GetBeaconByIndex( uint /*uint32*/ unIndex );
|
|
||||||
bool /*bool*/ ISteamParties_GetBeaconDetails( ulong ulBeaconID, out ulong pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t /*struct SteamPartyBeaconLocation_t **/ pLocation, System.Text.StringBuilder /*char **/ pchMetadata, int /*int*/ cchMetadata );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamParties_JoinParty( ulong ulBeaconID );
|
|
||||||
bool /*bool*/ ISteamParties_GetNumAvailableBeaconLocations( IntPtr /*uint32 **/ puNumLocations );
|
|
||||||
bool /*bool*/ ISteamParties_GetAvailableBeaconLocations( ref SteamPartyBeaconLocation_t /*struct SteamPartyBeaconLocation_t **/ pLocationList, uint /*uint32*/ uMaxNumLocations );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamParties_CreateBeacon( uint /*uint32*/ unOpenSlots, ref SteamPartyBeaconLocation_t /*struct SteamPartyBeaconLocation_t **/ pBeaconLocation, string /*const char **/ pchConnectString, string /*const char **/ pchMetadata );
|
|
||||||
void /*void*/ ISteamParties_OnReservationCompleted( ulong ulBeacon, ulong steamIDUser );
|
|
||||||
void /*void*/ ISteamParties_CancelReservation( ulong ulBeacon, ulong steamIDUser );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamParties_ChangeNumOpenSlots( ulong ulBeacon, uint /*uint32*/ unOpenSlots );
|
|
||||||
bool /*bool*/ ISteamParties_DestroyBeacon( ulong ulBeacon );
|
|
||||||
bool /*bool*/ ISteamParties_GetBeaconLocationData( SteamPartyBeaconLocation_t /*struct SteamPartyBeaconLocation_t*/ BeaconLocation, SteamPartyBeaconLocationData /*ESteamPartyBeaconLocationData*/ eData, System.Text.StringBuilder /*char **/ pchDataStringOut, int /*int*/ cchDataStringOut );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileWrite( string /*const char **/ pchFile, IntPtr /*const void **/ pvData, int /*int32*/ cubData );
|
|
||||||
int /*int32*/ ISteamRemoteStorage_FileRead( string /*const char **/ pchFile, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_FileWriteAsync( string /*const char **/ pchFile, IntPtr /*const void **/ pvData, uint /*uint32*/ cubData );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_FileReadAsync( string /*const char **/ pchFile, uint /*uint32*/ nOffset, uint /*uint32*/ cubToRead );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileReadAsyncComplete( ulong hReadCall, IntPtr /*void **/ pvBuffer, uint /*uint32*/ cubToRead );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileForget( string /*const char **/ pchFile );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileDelete( string /*const char **/ pchFile );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_FileShare( string /*const char **/ pchFile );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_SetSyncPlatforms( string /*const char **/ pchFile, RemoteStoragePlatform /*ERemoteStoragePlatform*/ eRemoteStoragePlatform );
|
|
||||||
UGCFileWriteStreamHandle_t /*(UGCFileWriteStreamHandle_t)*/ ISteamRemoteStorage_FileWriteStreamOpen( string /*const char **/ pchFile );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileWriteStreamWriteChunk( ulong writeHandle, IntPtr /*const void **/ pvData, int /*int32*/ cubData );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileWriteStreamClose( ulong writeHandle );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileWriteStreamCancel( ulong writeHandle );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FileExists( string /*const char **/ pchFile );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_FilePersisted( string /*const char **/ pchFile );
|
|
||||||
int /*int32*/ ISteamRemoteStorage_GetFileSize( string /*const char **/ pchFile );
|
|
||||||
long /*int64*/ ISteamRemoteStorage_GetFileTimestamp( string /*const char **/ pchFile );
|
|
||||||
RemoteStoragePlatform /*ERemoteStoragePlatform*/ ISteamRemoteStorage_GetSyncPlatforms( string /*const char **/ pchFile );
|
|
||||||
int /*int32*/ ISteamRemoteStorage_GetFileCount();
|
|
||||||
IntPtr ISteamRemoteStorage_GetFileNameAndSize( int /*int*/ iFile, out int /*int32 **/ pnFileSizeInBytes );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_GetQuota( out ulong /*uint64 **/ pnTotalBytes, out ulong /*uint64 **/ puAvailableBytes );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForAccount();
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_IsCloudEnabledForApp();
|
|
||||||
void /*void*/ ISteamRemoteStorage_SetCloudEnabledForApp( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_UGCDownload( ulong hContent, uint /*uint32*/ unPriority );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_GetUGCDownloadProgress( ulong hContent, out int /*int32 **/ pnBytesDownloaded, out int /*int32 **/ pnBytesExpected );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_GetUGCDetails( ulong hContent, ref uint pnAppID, System.Text.StringBuilder /*char ***/ ppchName, out int /*int32 **/ pnFileSizeInBytes, out ulong pSteamIDOwner );
|
|
||||||
int /*int32*/ ISteamRemoteStorage_UGCRead( ulong hContent, IntPtr /*void **/ pvData, int /*int32*/ cubDataToRead, uint /*uint32*/ cOffset, UGCReadAction /*EUGCReadAction*/ eAction );
|
|
||||||
int /*int32*/ ISteamRemoteStorage_GetCachedUGCCount();
|
|
||||||
UGCHandle_t /*(UGCHandle_t)*/ ISteamRemoteStorage_GetCachedUGCHandle( int /*int32*/ iCachedContent );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_PublishWorkshopFile( string /*const char **/ pchFile, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, WorkshopFileType /*EWorkshopFileType*/ eWorkshopFileType );
|
|
||||||
PublishedFileUpdateHandle_t /*(PublishedFileUpdateHandle_t)*/ ISteamRemoteStorage_CreatePublishedFileUpdateRequest( ulong unPublishedFileId );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFileFile( ulong updateHandle, string /*const char **/ pchFile );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFilePreviewFile( ulong updateHandle, string /*const char **/ pchPreviewFile );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFileTitle( ulong updateHandle, string /*const char **/ pchTitle );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFileDescription( ulong updateHandle, string /*const char **/ pchDescription );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFileVisibility( ulong updateHandle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFileTags( ulong updateHandle, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_CommitPublishedFileUpdate( ulong updateHandle );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_GetPublishedFileDetails( ulong unPublishedFileId, uint /*uint32*/ unMaxSecondsOld );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_DeletePublishedFile( ulong unPublishedFileId );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_EnumerateUserPublishedFiles( uint /*uint32*/ unStartIndex );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_SubscribePublishedFile( ulong unPublishedFileId );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_EnumerateUserSubscribedFiles( uint /*uint32*/ unStartIndex );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_UnsubscribePublishedFile( ulong unPublishedFileId );
|
|
||||||
bool /*bool*/ ISteamRemoteStorage_UpdatePublishedFileSetChangeDescription( ulong updateHandle, string /*const char **/ pchChangeDescription );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_GetPublishedItemVoteDetails( ulong unPublishedFileId );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_UpdateUserPublishedItemVote( ulong unPublishedFileId, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_GetUserPublishedItemVoteDetails( ulong unPublishedFileId );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles( ulong steamId, uint /*uint32*/ unStartIndex, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pRequiredTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pExcludedTags );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_PublishVideo( WorkshopVideoProvider /*EWorkshopVideoProvider*/ eVideoProvider, string /*const char **/ pchVideoAccount, string /*const char **/ pchVideoIdentifier, string /*const char **/ pchPreviewFile, uint nConsumerAppId, string /*const char **/ pchTitle, string /*const char **/ pchDescription, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_SetUserPublishedFileAction( ulong unPublishedFileId, WorkshopFileAction /*EWorkshopFileAction*/ eAction );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_EnumeratePublishedFilesByUserAction( WorkshopFileAction /*EWorkshopFileAction*/ eAction, uint /*uint32*/ unStartIndex );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_EnumeratePublishedWorkshopFiles( WorkshopEnumerationType /*EWorkshopEnumerationType*/ eEnumerationType, uint /*uint32*/ unStartIndex, uint /*uint32*/ unCount, uint /*uint32*/ unDays, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pTags, ref SteamParamStringArray_t /*struct SteamParamStringArray_t **/ pUserTags );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamRemoteStorage_UGCDownloadToLocation( ulong hContent, string /*const char **/ pchLocation, uint /*uint32*/ unPriority );
|
|
||||||
ScreenshotHandle /*(ScreenshotHandle)*/ ISteamScreenshots_WriteScreenshot( IntPtr /*void **/ pubRGB, uint /*uint32*/ cubRGB, int /*int*/ nWidth, int /*int*/ nHeight );
|
|
||||||
ScreenshotHandle /*(ScreenshotHandle)*/ ISteamScreenshots_AddScreenshotToLibrary( string /*const char **/ pchFilename, string /*const char **/ pchThumbnailFilename, int /*int*/ nWidth, int /*int*/ nHeight );
|
|
||||||
void /*void*/ ISteamScreenshots_TriggerScreenshot();
|
|
||||||
void /*void*/ ISteamScreenshots_HookScreenshots( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHook );
|
|
||||||
bool /*bool*/ ISteamScreenshots_SetLocation( uint hScreenshot, string /*const char **/ pchLocation );
|
|
||||||
bool /*bool*/ ISteamScreenshots_TagUser( uint hScreenshot, ulong steamID );
|
|
||||||
bool /*bool*/ ISteamScreenshots_TagPublishedFile( uint hScreenshot, ulong unPublishedFileID );
|
|
||||||
bool /*bool*/ ISteamScreenshots_IsScreenshotsHooked();
|
|
||||||
ScreenshotHandle /*(ScreenshotHandle)*/ ISteamScreenshots_AddVRScreenshotToLibrary( VRScreenshotType /*EVRScreenshotType*/ eType, string /*const char **/ pchFilename, string /*const char **/ pchVRFilename );
|
|
||||||
UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUserUGCRequest( uint unAccountID, UserUGCList /*EUserUGCList*/ eListType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingUGCType, UserUGCListSortOrder /*EUserUGCListSortOrder*/ eSortOrder, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage );
|
|
||||||
UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryAllUGCRequest( UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, uint /*uint32*/ unPage );
|
|
||||||
UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryAllUGCRequest0( UGCQuery /*EUGCQuery*/ eQueryType, UGCMatchingUGCType /*EUGCMatchingUGCType*/ eMatchingeMatchingUGCTypeFileType, uint nCreatorAppID, uint nConsumerAppID, string /*const char **/ pchCursor );
|
|
||||||
UGCQueryHandle_t /*(UGCQueryHandle_t)*/ ISteamUGC_CreateQueryUGCDetailsRequest( IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_SendQueryUGCRequest( ulong handle );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCResult( ulong handle, uint /*uint32*/ index, ref SteamUGCDetails_t /*struct SteamUGCDetails_t **/ pDetails );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCPreviewURL( ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchURL, uint /*uint32*/ cchURLSize );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCMetadata( ulong handle, uint /*uint32*/ index, System.Text.StringBuilder /*char **/ pchMetadata, uint /*uint32*/ cchMetadatasize );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCChildren( ulong handle, uint /*uint32*/ index, IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCStatistic( ulong handle, uint /*uint32*/ index, ItemStatistic /*EItemStatistic*/ eStatType, out ulong /*uint64 **/ pStatValue );
|
|
||||||
uint /*uint32*/ ISteamUGC_GetQueryUGCNumAdditionalPreviews( ulong handle, uint /*uint32*/ index );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCAdditionalPreview( ulong handle, uint /*uint32*/ index, uint /*uint32*/ previewIndex, System.Text.StringBuilder /*char **/ pchURLOrVideoID, uint /*uint32*/ cchURLSize, System.Text.StringBuilder /*char **/ pchOriginalFileName, uint /*uint32*/ cchOriginalFileNameSize, out ItemPreviewType /*EItemPreviewType **/ pPreviewType );
|
|
||||||
uint /*uint32*/ ISteamUGC_GetQueryUGCNumKeyValueTags( ulong handle, uint /*uint32*/ index );
|
|
||||||
bool /*bool*/ ISteamUGC_GetQueryUGCKeyValueTag( ulong handle, uint /*uint32*/ index, uint /*uint32*/ keyValueTagIndex, System.Text.StringBuilder /*char **/ pchKey, uint /*uint32*/ cchKeySize, System.Text.StringBuilder /*char **/ pchValue, uint /*uint32*/ cchValueSize );
|
|
||||||
bool /*bool*/ ISteamUGC_ReleaseQueryUGCRequest( ulong handle );
|
|
||||||
bool /*bool*/ ISteamUGC_AddRequiredTag( ulong handle, string /*const char **/ pTagName );
|
|
||||||
bool /*bool*/ ISteamUGC_AddExcludedTag( ulong handle, string /*const char **/ pTagName );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnOnlyIDs( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnOnlyIDs );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnKeyValueTags( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnKeyValueTags );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnLongDescription( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnLongDescription );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnMetadata( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnMetadata );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnChildren( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnChildren );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnAdditionalPreviews( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnAdditionalPreviews );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnTotalOnly( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bReturnTotalOnly );
|
|
||||||
bool /*bool*/ ISteamUGC_SetReturnPlaytimeStats( ulong handle, uint /*uint32*/ unDays );
|
|
||||||
bool /*bool*/ ISteamUGC_SetLanguage( ulong handle, string /*const char **/ pchLanguage );
|
|
||||||
bool /*bool*/ ISteamUGC_SetAllowCachedResponse( ulong handle, uint /*uint32*/ unMaxAgeSeconds );
|
|
||||||
bool /*bool*/ ISteamUGC_SetCloudFileNameFilter( ulong handle, string /*const char **/ pMatchCloudFileName );
|
|
||||||
bool /*bool*/ ISteamUGC_SetMatchAnyTag( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bMatchAnyTag );
|
|
||||||
bool /*bool*/ ISteamUGC_SetSearchText( ulong handle, string /*const char **/ pSearchText );
|
|
||||||
bool /*bool*/ ISteamUGC_SetRankedByTrendDays( ulong handle, uint /*uint32*/ unDays );
|
|
||||||
bool /*bool*/ ISteamUGC_AddRequiredKeyValueTag( ulong handle, string /*const char **/ pKey, string /*const char **/ pValue );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_RequestUGCDetails( ulong nPublishedFileID, uint /*uint32*/ unMaxAgeSeconds );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_CreateItem( uint nConsumerAppId, WorkshopFileType /*EWorkshopFileType*/ eFileType );
|
|
||||||
UGCUpdateHandle_t /*(UGCUpdateHandle_t)*/ ISteamUGC_StartItemUpdate( uint nConsumerAppId, ulong nPublishedFileID );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemTitle( ulong handle, string /*const char **/ pchTitle );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemDescription( ulong handle, string /*const char **/ pchDescription );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemUpdateLanguage( ulong handle, string /*const char **/ pchLanguage );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemMetadata( ulong handle, string /*const char **/ pchMetaData );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemVisibility( ulong handle, RemoteStoragePublishedFileVisibility /*ERemoteStoragePublishedFileVisibility*/ eVisibility );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemTags( ulong updateHandle, ref SteamParamStringArray_t /*const struct SteamParamStringArray_t **/ pTags );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemContent( ulong handle, string /*const char **/ pszContentFolder );
|
|
||||||
bool /*bool*/ ISteamUGC_SetItemPreview( ulong handle, string /*const char **/ pszPreviewFile );
|
|
||||||
bool /*bool*/ ISteamUGC_SetAllowLegacyUpload( ulong handle, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAllowLegacyUpload );
|
|
||||||
bool /*bool*/ ISteamUGC_RemoveItemKeyValueTags( ulong handle, string /*const char **/ pchKey );
|
|
||||||
bool /*bool*/ ISteamUGC_AddItemKeyValueTag( ulong handle, string /*const char **/ pchKey, string /*const char **/ pchValue );
|
|
||||||
bool /*bool*/ ISteamUGC_AddItemPreviewFile( ulong handle, string /*const char **/ pszPreviewFile, ItemPreviewType /*EItemPreviewType*/ type );
|
|
||||||
bool /*bool*/ ISteamUGC_AddItemPreviewVideo( ulong handle, string /*const char **/ pszVideoID );
|
|
||||||
bool /*bool*/ ISteamUGC_UpdateItemPreviewFile( ulong handle, uint /*uint32*/ index, string /*const char **/ pszPreviewFile );
|
|
||||||
bool /*bool*/ ISteamUGC_UpdateItemPreviewVideo( ulong handle, uint /*uint32*/ index, string /*const char **/ pszVideoID );
|
|
||||||
bool /*bool*/ ISteamUGC_RemoveItemPreview( ulong handle, uint /*uint32*/ index );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_SubmitItemUpdate( ulong handle, string /*const char **/ pchChangeNote );
|
|
||||||
ItemUpdateStatus /*EItemUpdateStatus*/ ISteamUGC_GetItemUpdateProgress( ulong handle, out ulong /*uint64 **/ punBytesProcessed, out ulong /*uint64 **/ punBytesTotal );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_SetUserItemVote( ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bVoteUp );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_GetUserItemVote( ulong nPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_AddItemToFavorites( uint nAppId, ulong nPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_RemoveItemFromFavorites( uint nAppId, ulong nPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_SubscribeItem( ulong nPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_UnsubscribeItem( ulong nPublishedFileID );
|
|
||||||
uint /*uint32*/ ISteamUGC_GetNumSubscribedItems();
|
|
||||||
uint /*uint32*/ ISteamUGC_GetSubscribedItems( IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ cMaxEntries );
|
|
||||||
uint /*uint32*/ ISteamUGC_GetItemState( ulong nPublishedFileID );
|
|
||||||
bool /*bool*/ ISteamUGC_GetItemInstallInfo( ulong nPublishedFileID, out ulong /*uint64 **/ punSizeOnDisk, System.Text.StringBuilder /*char **/ pchFolder, uint /*uint32*/ cchFolderSize, out uint /*uint32 **/ punTimeStamp );
|
|
||||||
bool /*bool*/ ISteamUGC_GetItemDownloadInfo( ulong nPublishedFileID, out ulong /*uint64 **/ punBytesDownloaded, out ulong /*uint64 **/ punBytesTotal );
|
|
||||||
bool /*bool*/ ISteamUGC_DownloadItem( ulong nPublishedFileID, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bHighPriority );
|
|
||||||
bool /*bool*/ ISteamUGC_BInitWorkshopForGameServer( uint unWorkshopDepotID, string /*const char **/ pszFolder );
|
|
||||||
void /*void*/ ISteamUGC_SuspendDownloads( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSuspend );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_StartPlaytimeTracking( IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_StopPlaytimeTracking( IntPtr /*PublishedFileId_t **/ pvecPublishedFileID, uint /*uint32*/ unNumPublishedFileIDs );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_StopPlaytimeTrackingForAllItems();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_AddDependency( ulong nParentPublishedFileID, ulong nChildPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_RemoveDependency( ulong nParentPublishedFileID, ulong nChildPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_AddAppDependency( ulong nPublishedFileID, uint nAppID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_RemoveAppDependency( ulong nPublishedFileID, uint nAppID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_GetAppDependencies( ulong nPublishedFileID );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUGC_DeleteItem( ulong nPublishedFileID );
|
|
||||||
HSteamUser /*(HSteamUser)*/ ISteamUser_GetHSteamUser();
|
|
||||||
bool /*bool*/ ISteamUser_BLoggedOn();
|
|
||||||
CSteamID /*(class CSteamID)*/ ISteamUser_GetSteamID();
|
|
||||||
int /*int*/ ISteamUser_InitiateGameConnection( IntPtr /*void **/ pAuthBlob, int /*int*/ cbMaxAuthBlob, ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bSecure );
|
|
||||||
void /*void*/ ISteamUser_TerminateGameConnection( uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer );
|
|
||||||
void /*void*/ ISteamUser_TrackAppUsageEvent( ulong gameID, int /*int*/ eAppUsageEvent, string /*const char **/ pchExtraInfo );
|
|
||||||
bool /*bool*/ ISteamUser_GetUserDataFolder( System.Text.StringBuilder /*char **/ pchBuffer, int /*int*/ cubBuffer );
|
|
||||||
void /*void*/ ISteamUser_StartVoiceRecording();
|
|
||||||
void /*void*/ ISteamUser_StopVoiceRecording();
|
|
||||||
VoiceResult /*EVoiceResult*/ ISteamUser_GetAvailableVoice( out uint /*uint32 **/ pcbCompressed, out uint /*uint32 **/ pcbUncompressed_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated );
|
|
||||||
VoiceResult /*EVoiceResult*/ ISteamUser_GetVoice( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bWantUncompressed_Deprecated, IntPtr /*void **/ pUncompressedDestBuffer_Deprecated, uint /*uint32*/ cbUncompressedDestBufferSize_Deprecated, out uint /*uint32 **/ nUncompressBytesWritten_Deprecated, uint /*uint32*/ nUncompressedVoiceDesiredSampleRate_Deprecated );
|
|
||||||
VoiceResult /*EVoiceResult*/ ISteamUser_DecompressVoice( IntPtr /*const void **/ pCompressed, uint /*uint32*/ cbCompressed, IntPtr /*void **/ pDestBuffer, uint /*uint32*/ cbDestBufferSize, out uint /*uint32 **/ nBytesWritten, uint /*uint32*/ nDesiredSampleRate );
|
|
||||||
uint /*uint32*/ ISteamUser_GetVoiceOptimalSampleRate();
|
|
||||||
HAuthTicket /*(HAuthTicket)*/ ISteamUser_GetAuthSessionTicket( IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket );
|
|
||||||
BeginAuthSessionResult /*EBeginAuthSessionResult*/ ISteamUser_BeginAuthSession( IntPtr /*const void **/ pAuthTicket, int /*int*/ cbAuthTicket, ulong steamID );
|
|
||||||
void /*void*/ ISteamUser_EndAuthSession( ulong steamID );
|
|
||||||
void /*void*/ ISteamUser_CancelAuthTicket( uint hAuthTicket );
|
|
||||||
UserHasLicenseForAppResult /*EUserHasLicenseForAppResult*/ ISteamUser_UserHasLicenseForApp( ulong steamID, uint appID );
|
|
||||||
bool /*bool*/ ISteamUser_BIsBehindNAT();
|
|
||||||
void /*void*/ ISteamUser_AdvertiseGame( ulong steamIDGameServer, uint /*uint32*/ unIPServer, ushort /*uint16*/ usPortServer );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUser_RequestEncryptedAppTicket( IntPtr /*void **/ pDataToInclude, int /*int*/ cbDataToInclude );
|
|
||||||
bool /*bool*/ ISteamUser_GetEncryptedAppTicket( IntPtr /*void **/ pTicket, int /*int*/ cbMaxTicket, out uint /*uint32 **/ pcbTicket );
|
|
||||||
int /*int*/ ISteamUser_GetGameBadgeLevel( int /*int*/ nSeries, [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bFoil );
|
|
||||||
int /*int*/ ISteamUser_GetPlayerSteamLevel();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUser_RequestStoreAuthURL( string /*const char **/ pchRedirectURL );
|
|
||||||
bool /*bool*/ ISteamUser_BIsPhoneVerified();
|
|
||||||
bool /*bool*/ ISteamUser_BIsTwoFactorEnabled();
|
|
||||||
bool /*bool*/ ISteamUser_BIsPhoneIdentifying();
|
|
||||||
bool /*bool*/ ISteamUser_BIsPhoneRequiringVerification();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUser_GetMarketEligibility();
|
|
||||||
bool /*bool*/ ISteamUserStats_RequestCurrentStats();
|
|
||||||
bool /*bool*/ ISteamUserStats_GetStat( string /*const char **/ pchName, out int /*int32 **/ pData );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetStat0( string /*const char **/ pchName, out float /*float **/ pData );
|
|
||||||
bool /*bool*/ ISteamUserStats_SetStat( string /*const char **/ pchName, int /*int32*/ nData );
|
|
||||||
bool /*bool*/ ISteamUserStats_SetStat0( string /*const char **/ pchName, float /*float*/ fData );
|
|
||||||
bool /*bool*/ ISteamUserStats_UpdateAvgRateStat( string /*const char **/ pchName, float /*float*/ flCountThisSession, double /*double*/ dSessionLength );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetAchievement( string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved );
|
|
||||||
bool /*bool*/ ISteamUserStats_SetAchievement( string /*const char **/ pchName );
|
|
||||||
bool /*bool*/ ISteamUserStats_ClearAchievement( string /*const char **/ pchName );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetAchievementAndUnlockTime( string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime );
|
|
||||||
bool /*bool*/ ISteamUserStats_StoreStats();
|
|
||||||
int /*int*/ ISteamUserStats_GetAchievementIcon( string /*const char **/ pchName );
|
|
||||||
IntPtr ISteamUserStats_GetAchievementDisplayAttribute( string /*const char **/ pchName, string /*const char **/ pchKey );
|
|
||||||
bool /*bool*/ ISteamUserStats_IndicateAchievementProgress( string /*const char **/ pchName, uint /*uint32*/ nCurProgress, uint /*uint32*/ nMaxProgress );
|
|
||||||
uint /*uint32*/ ISteamUserStats_GetNumAchievements();
|
|
||||||
IntPtr ISteamUserStats_GetAchievementName( uint /*uint32*/ iAchievement );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_RequestUserStats( ulong steamIDUser );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetUserStat( ulong steamIDUser, string /*const char **/ pchName, out int /*int32 **/ pData );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetUserStat0( ulong steamIDUser, string /*const char **/ pchName, out float /*float **/ pData );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetUserAchievement( ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetUserAchievementAndUnlockTime( ulong steamIDUser, string /*const char **/ pchName, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved, out uint /*uint32 **/ punUnlockTime );
|
|
||||||
bool /*bool*/ ISteamUserStats_ResetAllStats( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bAchievementsToo );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_FindOrCreateLeaderboard( string /*const char **/ pchLeaderboardName, LeaderboardSortMethod /*ELeaderboardSortMethod*/ eLeaderboardSortMethod, LeaderboardDisplayType /*ELeaderboardDisplayType*/ eLeaderboardDisplayType );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_FindLeaderboard( string /*const char **/ pchLeaderboardName );
|
|
||||||
IntPtr ISteamUserStats_GetLeaderboardName( ulong hSteamLeaderboard );
|
|
||||||
int /*int*/ ISteamUserStats_GetLeaderboardEntryCount( ulong hSteamLeaderboard );
|
|
||||||
LeaderboardSortMethod /*ELeaderboardSortMethod*/ ISteamUserStats_GetLeaderboardSortMethod( ulong hSteamLeaderboard );
|
|
||||||
LeaderboardDisplayType /*ELeaderboardDisplayType*/ ISteamUserStats_GetLeaderboardDisplayType( ulong hSteamLeaderboard );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_DownloadLeaderboardEntries( ulong hSteamLeaderboard, LeaderboardDataRequest /*ELeaderboardDataRequest*/ eLeaderboardDataRequest, int /*int*/ nRangeStart, int /*int*/ nRangeEnd );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_DownloadLeaderboardEntriesForUsers( ulong hSteamLeaderboard, IntPtr /*class CSteamID **/ prgUsers, int /*int*/ cUsers );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetDownloadedLeaderboardEntry( ulong hSteamLeaderboardEntries, int /*int*/ index, ref LeaderboardEntry_t /*struct LeaderboardEntry_t **/ pLeaderboardEntry, IntPtr /*int32 **/ pDetails, int /*int*/ cDetailsMax );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_UploadLeaderboardScore( ulong hSteamLeaderboard, LeaderboardUploadScoreMethod /*ELeaderboardUploadScoreMethod*/ eLeaderboardUploadScoreMethod, int /*int32*/ nScore, int[] /*const int32 **/ pScoreDetails, int /*int*/ cScoreDetailsCount );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_AttachLeaderboardUGC( ulong hSteamLeaderboard, ulong hUGC );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_GetNumberOfCurrentPlayers();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_RequestGlobalAchievementPercentages();
|
|
||||||
int /*int*/ ISteamUserStats_GetMostAchievedAchievementInfo( System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved );
|
|
||||||
int /*int*/ ISteamUserStats_GetNextMostAchievedAchievementInfo( int /*int*/ iIteratorPrevious, System.Text.StringBuilder /*char **/ pchName, uint /*uint32*/ unNameBufLen, out float /*float **/ pflPercent, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbAchieved );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetAchievementAchievedPercent( string /*const char **/ pchName, out float /*float **/ pflPercent );
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUserStats_RequestGlobalStats( int /*int*/ nHistoryDays );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetGlobalStat( string /*const char **/ pchStatName, out long /*int64 **/ pData );
|
|
||||||
bool /*bool*/ ISteamUserStats_GetGlobalStat0( string /*const char **/ pchStatName, out double /*double **/ pData );
|
|
||||||
int /*int32*/ ISteamUserStats_GetGlobalStatHistory( string /*const char **/ pchStatName, out long /*int64 **/ pData, uint /*uint32*/ cubData );
|
|
||||||
int /*int32*/ ISteamUserStats_GetGlobalStatHistory0( string /*const char **/ pchStatName, out double /*double **/ pData, uint /*uint32*/ cubData );
|
|
||||||
uint /*uint32*/ ISteamUtils_GetSecondsSinceAppActive();
|
|
||||||
uint /*uint32*/ ISteamUtils_GetSecondsSinceComputerActive();
|
|
||||||
Universe /*EUniverse*/ ISteamUtils_GetConnectedUniverse();
|
|
||||||
uint /*uint32*/ ISteamUtils_GetServerRealTime();
|
|
||||||
IntPtr ISteamUtils_GetIPCountry();
|
|
||||||
bool /*bool*/ ISteamUtils_GetImageSize( int /*int*/ iImage, out uint /*uint32 **/ pnWidth, out uint /*uint32 **/ pnHeight );
|
|
||||||
bool /*bool*/ ISteamUtils_GetImageRGBA( int /*int*/ iImage, IntPtr /*uint8 **/ pubDest, int /*int*/ nDestBufferSize );
|
|
||||||
bool /*bool*/ ISteamUtils_GetCSERIPPort( out uint /*uint32 **/ unIP, out ushort /*uint16 **/ usPort );
|
|
||||||
byte /*uint8*/ ISteamUtils_GetCurrentBatteryPower();
|
|
||||||
uint /*uint32*/ ISteamUtils_GetAppID();
|
|
||||||
void /*void*/ ISteamUtils_SetOverlayNotificationPosition( NotificationPosition /*ENotificationPosition*/ eNotificationPosition );
|
|
||||||
bool /*bool*/ ISteamUtils_IsAPICallCompleted( ulong hSteamAPICall, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed );
|
|
||||||
SteamAPICallFailure /*ESteamAPICallFailure*/ ISteamUtils_GetAPICallFailureReason( ulong hSteamAPICall );
|
|
||||||
bool /*bool*/ ISteamUtils_GetAPICallResult( ulong hSteamAPICall, IntPtr /*void **/ pCallback, int /*int*/ cubCallback, int /*int*/ iCallbackExpected, [MarshalAs(UnmanagedType.U1)] ref bool /*bool **/ pbFailed );
|
|
||||||
uint /*uint32*/ ISteamUtils_GetIPCCallCount();
|
|
||||||
void /*void*/ ISteamUtils_SetWarningMessageHook( IntPtr /*SteamAPIWarningMessageHook_t*/ pFunction );
|
|
||||||
bool /*bool*/ ISteamUtils_IsOverlayEnabled();
|
|
||||||
bool /*bool*/ ISteamUtils_BOverlayNeedsPresent();
|
|
||||||
SteamAPICall_t /*(SteamAPICall_t)*/ ISteamUtils_CheckFileSignature( string /*const char **/ szFileName );
|
|
||||||
bool /*bool*/ ISteamUtils_ShowGamepadTextInput( GamepadTextInputMode /*EGamepadTextInputMode*/ eInputMode, GamepadTextInputLineMode /*EGamepadTextInputLineMode*/ eLineInputMode, string /*const char **/ pchDescription, uint /*uint32*/ unCharMax, string /*const char **/ pchExistingText );
|
|
||||||
uint /*uint32*/ ISteamUtils_GetEnteredGamepadTextLength();
|
|
||||||
bool /*bool*/ ISteamUtils_GetEnteredGamepadTextInput( System.Text.StringBuilder /*char **/ pchText, uint /*uint32*/ cchText );
|
|
||||||
IntPtr ISteamUtils_GetSteamUILanguage();
|
|
||||||
bool /*bool*/ ISteamUtils_IsSteamRunningInVR();
|
|
||||||
void /*void*/ ISteamUtils_SetOverlayNotificationInset( int /*int*/ nHorizontalInset, int /*int*/ nVerticalInset );
|
|
||||||
bool /*bool*/ ISteamUtils_IsSteamInBigPictureMode();
|
|
||||||
void /*void*/ ISteamUtils_StartVRDashboard();
|
|
||||||
bool /*bool*/ ISteamUtils_IsVRHeadsetStreamingEnabled();
|
|
||||||
void /*void*/ ISteamUtils_SetVRHeadsetStreamingEnabled( [MarshalAs(UnmanagedType.U1)] bool /*bool*/ bEnabled );
|
|
||||||
void /*void*/ ISteamVideo_GetVideoURL( uint unVideoAppID );
|
|
||||||
bool /*bool*/ ISteamVideo_IsBroadcasting( IntPtr /*int **/ pnNumViewers );
|
|
||||||
void /*void*/ ISteamVideo_GetOPFSettings( uint unVideoAppID );
|
|
||||||
bool /*bool*/ ISteamVideo_GetOPFStringForApp( uint unVideoAppID, System.Text.StringBuilder /*char **/ pchBuffer, out int /*int32 **/ pnBufferSize );
|
|
||||||
bool /*bool*/ SteamApi_SteamAPI_Init();
|
|
||||||
void /*void*/ SteamApi_SteamAPI_RunCallbacks();
|
|
||||||
void /*void*/ SteamApi_SteamGameServer_RunCallbacks();
|
|
||||||
void /*void*/ SteamApi_SteamAPI_RegisterCallback( IntPtr /*void **/ pCallback, int /*int*/ callback );
|
|
||||||
void /*void*/ SteamApi_SteamAPI_UnregisterCallback( IntPtr /*void **/ pCallback );
|
|
||||||
void /*void*/ SteamApi_SteamAPI_RegisterCallResult( IntPtr /*void **/ pCallback, ulong callback );
|
|
||||||
void /*void*/ SteamApi_SteamAPI_UnregisterCallResult( IntPtr /*void **/ pCallback, ulong callback );
|
|
||||||
bool /*bool*/ SteamApi_SteamInternal_GameServer_Init( uint /*uint32*/ unIP, ushort /*uint16*/ usPort, ushort /*uint16*/ usGamePort, ushort /*uint16*/ usQueryPort, int /*int*/ eServerMode, string /*const char **/ pchVersionString );
|
|
||||||
void /*void*/ SteamApi_SteamAPI_Shutdown();
|
|
||||||
void /*void*/ SteamApi_SteamGameServer_Shutdown();
|
|
||||||
HSteamUser /*(HSteamUser)*/ SteamApi_SteamAPI_GetHSteamUser();
|
|
||||||
HSteamPipe /*(HSteamPipe)*/ SteamApi_SteamAPI_GetHSteamPipe();
|
|
||||||
HSteamUser /*(HSteamUser)*/ SteamApi_SteamGameServer_GetHSteamUser();
|
|
||||||
HSteamPipe /*(HSteamPipe)*/ SteamApi_SteamGameServer_GetHSteamPipe();
|
|
||||||
IntPtr /*void **/ SteamApi_SteamInternal_CreateInterface( string /*const char **/ version );
|
|
||||||
bool /*bool*/ SteamApi_SteamAPI_RestartAppIfNecessary( uint /*uint32*/ unOwnAppID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,76 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
|
||||||
{
|
|
||||||
public enum OperatingSystem
|
|
||||||
{
|
|
||||||
Unset,
|
|
||||||
Windows,
|
|
||||||
Linux,
|
|
||||||
macOS,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal static partial class Platform
|
|
||||||
{
|
|
||||||
private static Facepunch.Steamworks.OperatingSystem _os;
|
|
||||||
|
|
||||||
public static Facepunch.Steamworks.OperatingSystem RunningPlatform()
|
|
||||||
{
|
|
||||||
switch (Environment.OSVersion.Platform)
|
|
||||||
{
|
|
||||||
case PlatformID.Unix:
|
|
||||||
// macOS sometimes reports to .NET as Unix. Fix is to check against macOS root folders
|
|
||||||
if (Directory.Exists("/Applications") && Directory.Exists("/System") && Directory.Exists("/Users") && Directory.Exists("/Volumes"))
|
|
||||||
return Facepunch.Steamworks.OperatingSystem.macOS;
|
|
||||||
else
|
|
||||||
return Facepunch.Steamworks.OperatingSystem.Linux;
|
|
||||||
case PlatformID.MacOSX:
|
|
||||||
return Facepunch.Steamworks.OperatingSystem.macOS;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return Facepunch.Steamworks.OperatingSystem.Windows;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Facepunch.Steamworks.OperatingSystem Os
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Work out our platform
|
|
||||||
//
|
|
||||||
if ( _os == Facepunch.Steamworks.OperatingSystem.Unset )
|
|
||||||
{
|
|
||||||
_os = Facepunch.Steamworks.OperatingSystem.Windows;
|
|
||||||
|
|
||||||
#if !NET_CORE
|
|
||||||
// Fixed Bet
|
|
||||||
_os = RunningPlatform();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return _os;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_os = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsWindows => Os == Facepunch.Steamworks.OperatingSystem.Windows;
|
|
||||||
public static bool IsLinux => Os == Facepunch.Steamworks.OperatingSystem.Linux;
|
|
||||||
public static bool IsOsx => Os == Facepunch.Steamworks.OperatingSystem.macOS;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// We're only Pack = 8 on Windows
|
|
||||||
/// </summary>
|
|
||||||
public static bool PackSmall => Os != Facepunch.Steamworks.OperatingSystem.Windows;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamApi : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamApi()
|
|
||||||
{
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( ((IntPtr)1) );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( ((IntPtr)1) );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( ((IntPtr)1) );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamPipe
|
|
||||||
public HSteamPipe SteamAPI_GetHSteamPipe()
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamAPI_GetHSteamPipe();
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamUser
|
|
||||||
public HSteamUser SteamAPI_GetHSteamUser()
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamAPI_GetHSteamUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SteamAPI_Init()
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamAPI_Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamAPI_RegisterCallback( IntPtr pCallback /*void **/, int callback /*int*/ )
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamAPI_RegisterCallback( (IntPtr) pCallback, callback );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamAPI_RegisterCallResult( IntPtr pCallback /*void **/, SteamAPICall_t callback /*SteamAPICall_t*/ )
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamAPI_RegisterCallResult( (IntPtr) pCallback, callback.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SteamAPI_RestartAppIfNecessary( uint unOwnAppID /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamAPI_RestartAppIfNecessary( unOwnAppID );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamAPI_RunCallbacks()
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamAPI_RunCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamAPI_Shutdown()
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamAPI_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamAPI_UnregisterCallback( IntPtr pCallback /*void **/ )
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamAPI_UnregisterCallback( (IntPtr) pCallback );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamAPI_UnregisterCallResult( IntPtr pCallback /*void **/, SteamAPICall_t callback /*SteamAPICall_t*/ )
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamAPI_UnregisterCallResult( (IntPtr) pCallback, callback.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamPipe
|
|
||||||
public HSteamPipe SteamGameServer_GetHSteamPipe()
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamGameServer_GetHSteamPipe();
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamUser
|
|
||||||
public HSteamUser SteamGameServer_GetHSteamUser()
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamGameServer_GetHSteamUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamGameServer_RunCallbacks()
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamGameServer_RunCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SteamGameServer_Shutdown()
|
|
||||||
{
|
|
||||||
platform.SteamApi_SteamGameServer_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// IntPtr
|
|
||||||
public IntPtr SteamInternal_CreateInterface( string version /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamInternal_CreateInterface( version );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SteamInternal_GameServer_Init( uint unIP /*uint32*/, ushort usPort /*uint16*/, ushort usGamePort /*uint16*/, ushort usQueryPort /*uint16*/, int eServerMode /*int*/, string pchVersionString /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.SteamApi_SteamInternal_GameServer_Init( unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamAppList : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamAppList( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetAppBuildId( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamAppList_GetAppBuildId( nAppID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
// with: Detect_StringFetch True
|
|
||||||
public string GetAppInstallDir( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
int bSuccess = default( int );
|
|
||||||
System.Text.StringBuilder pchDirectory_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cchNameMax = 4096;
|
|
||||||
bSuccess = platform.ISteamAppList_GetAppInstallDir( nAppID.Value, pchDirectory_sb, cchNameMax );
|
|
||||||
if ( bSuccess <= 0 ) return null;
|
|
||||||
return pchDirectory_sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
// with: Detect_StringFetch True
|
|
||||||
public string GetAppName( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
int bSuccess = default( int );
|
|
||||||
System.Text.StringBuilder pchName_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cchNameMax = 4096;
|
|
||||||
bSuccess = platform.ISteamAppList_GetAppName( nAppID.Value, pchName_sb, cchNameMax );
|
|
||||||
if ( bSuccess <= 0 ) return null;
|
|
||||||
return pchName_sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// with: Detect_VectorReturn
|
|
||||||
// uint
|
|
||||||
public uint GetInstalledApps( AppId_t[] pvecAppID /*AppId_t **/ )
|
|
||||||
{
|
|
||||||
var unMaxAppIDs = (uint) pvecAppID.Length;
|
|
||||||
fixed ( AppId_t* pvecAppID_ptr = pvecAppID )
|
|
||||||
{
|
|
||||||
return platform.ISteamAppList_GetInstalledApps( (IntPtr) pvecAppID_ptr, unMaxAppIDs );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetNumInstalledApps()
|
|
||||||
{
|
|
||||||
return platform.ISteamAppList_GetNumInstalledApps();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,254 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamApps : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamApps( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// with: Detect_StringFetch False
|
|
||||||
public bool BGetDLCDataByIndex( int iDLC /*int*/, ref AppId_t pAppID /*AppId_t **/, ref bool pbAvailable /*bool **/, out string pchName /*char **/ )
|
|
||||||
{
|
|
||||||
bool bSuccess = default( bool );
|
|
||||||
pchName = string.Empty;
|
|
||||||
System.Text.StringBuilder pchName_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cchNameBufferSize = 4096;
|
|
||||||
bSuccess = platform.ISteamApps_BGetDLCDataByIndex( iDLC, ref pAppID.Value, ref pbAvailable, pchName_sb, cchNameBufferSize );
|
|
||||||
if ( !bSuccess ) return bSuccess;
|
|
||||||
pchName = pchName_sb.ToString();
|
|
||||||
return bSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsAppInstalled( AppId_t appID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsAppInstalled( appID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsCybercafe()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsCybercafe();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsDlcInstalled( AppId_t appID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsDlcInstalled( appID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsLowViolence()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsLowViolence();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsSubscribed()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsSubscribed();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsSubscribedApp( AppId_t appID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsSubscribedApp( appID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsSubscribedFromFamilySharing()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsSubscribedFromFamilySharing();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsSubscribedFromFreeWeekend()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsSubscribedFromFreeWeekend();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsVACBanned()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_BIsVACBanned();
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetAppBuildId()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_GetAppBuildId();
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
// with: Detect_StringFetch True
|
|
||||||
public string GetAppInstallDir( AppId_t appID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
uint bSuccess = default( uint );
|
|
||||||
System.Text.StringBuilder pchFolder_sb = Helpers.TakeStringBuilder();
|
|
||||||
uint cchFolderBufferSize = 4096;
|
|
||||||
bSuccess = platform.ISteamApps_GetAppInstallDir( appID.Value, pchFolder_sb, cchFolderBufferSize );
|
|
||||||
if ( bSuccess <= 0 ) return null;
|
|
||||||
return pchFolder_sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetAppOwner()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_GetAppOwner();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetAvailableGameLanguages()
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamApps_GetAvailableGameLanguages();
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// with: Detect_StringFetch True
|
|
||||||
public string GetCurrentBetaName()
|
|
||||||
{
|
|
||||||
bool bSuccess = default( bool );
|
|
||||||
System.Text.StringBuilder pchName_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cchNameBufferSize = 4096;
|
|
||||||
bSuccess = platform.ISteamApps_GetCurrentBetaName( pchName_sb, cchNameBufferSize );
|
|
||||||
if ( !bSuccess ) return null;
|
|
||||||
return pchName_sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetCurrentGameLanguage()
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamApps_GetCurrentGameLanguage();
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetDLCCount()
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_GetDLCCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetDlcDownloadProgress( AppId_t nAppID /*AppId_t*/, out ulong punBytesDownloaded /*uint64 **/, out ulong punBytesTotal /*uint64 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_GetDlcDownloadProgress( nAppID.Value, out punBytesDownloaded, out punBytesTotal );
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetEarliestPurchaseUnixTime( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_GetEarliestPurchaseUnixTime( nAppID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<FileDetailsResult_t> GetFileDetails( string pszFileName /*const char **/, Action<FileDetailsResult_t, bool> CallbackFunction = null /*Action<FileDetailsResult_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamApps_GetFileDetails( pszFileName );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<FileDetailsResult_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetInstalledDepots( AppId_t appID /*AppId_t*/, IntPtr pvecDepots /*DepotId_t **/, uint cMaxDepots /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_GetInstalledDepots( appID.Value, (IntPtr) pvecDepots, cMaxDepots );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
// with: Detect_StringFetch True
|
|
||||||
public string GetLaunchCommandLine()
|
|
||||||
{
|
|
||||||
int bSuccess = default( int );
|
|
||||||
System.Text.StringBuilder pszCommandLine_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cubCommandLine = 4096;
|
|
||||||
bSuccess = platform.ISteamApps_GetLaunchCommandLine( pszCommandLine_sb, cubCommandLine );
|
|
||||||
if ( bSuccess <= 0 ) return null;
|
|
||||||
return pszCommandLine_sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetLaunchQueryParam( string pchKey /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamApps_GetLaunchQueryParam( pchKey );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void InstallDLC( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamApps_InstallDLC( nAppID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool MarkContentCorrupt( bool bMissingFilesOnly /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamApps_MarkContentCorrupt( bMissingFilesOnly );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RequestAllProofOfPurchaseKeys()
|
|
||||||
{
|
|
||||||
platform.ISteamApps_RequestAllProofOfPurchaseKeys();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RequestAppProofOfPurchaseKey( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamApps_RequestAppProofOfPurchaseKey( nAppID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void UninstallDLC( AppId_t nAppID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamApps_UninstallDLC( nAppID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,330 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamClient : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamClient( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BReleaseSteamPipe( HSteamPipe hSteamPipe /*HSteamPipe*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_BReleaseSteamPipe( hSteamPipe.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BShutdownIfAllPipesClosed()
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_BShutdownIfAllPipesClosed();
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamUser
|
|
||||||
public HSteamUser ConnectToGlobalUser( HSteamPipe hSteamPipe /*HSteamPipe*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_ConnectToGlobalUser( hSteamPipe.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamUser
|
|
||||||
public HSteamUser CreateLocalUser( out HSteamPipe phSteamPipe /*HSteamPipe **/, AccountType eAccountType /*EAccountType*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_CreateLocalUser( out phSteamPipe.Value, eAccountType );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HSteamPipe
|
|
||||||
public HSteamPipe CreateSteamPipe()
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_CreateSteamPipe();
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetIPCCallCount()
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_GetIPCCallCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamAppList *
|
|
||||||
public SteamAppList GetISteamAppList( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamAppList( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamAppList( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamApps *
|
|
||||||
public SteamApps GetISteamApps( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamApps( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamApps( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamController *
|
|
||||||
public SteamController GetISteamController( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamController( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamController( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamFriends *
|
|
||||||
public SteamFriends GetISteamFriends( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamFriends( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamFriends( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamGameSearch *
|
|
||||||
public SteamGameSearch GetISteamGameSearch( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamGameSearch( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamGameSearch( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamGameServer *
|
|
||||||
public SteamGameServer GetISteamGameServer( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamGameServer( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamGameServer( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamGameServerStats *
|
|
||||||
public SteamGameServerStats GetISteamGameServerStats( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamGameServerStats( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamGameServerStats( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// IntPtr
|
|
||||||
public IntPtr GetISteamGenericInterface( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamClient_GetISteamGenericInterface( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamHTMLSurface *
|
|
||||||
public SteamHTMLSurface GetISteamHTMLSurface( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamHTMLSurface( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamHTMLSurface( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamHTTP *
|
|
||||||
public SteamHTTP GetISteamHTTP( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamHTTP( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamHTTP( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamInput *
|
|
||||||
public SteamInput GetISteamInput( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamInput( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamInput( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamInventory *
|
|
||||||
public SteamInventory GetISteamInventory( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamInventory( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamInventory( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamMatchmaking *
|
|
||||||
public SteamMatchmaking GetISteamMatchmaking( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamMatchmaking( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamMatchmaking( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamMatchmakingServers *
|
|
||||||
public SteamMatchmakingServers GetISteamMatchmakingServers( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamMatchmakingServers( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamMatchmakingServers( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamMusic *
|
|
||||||
public SteamMusic GetISteamMusic( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamMusic( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamMusic( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamMusicRemote *
|
|
||||||
public SteamMusicRemote GetISteamMusicRemote( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamMusicRemote( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamMusicRemote( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamNetworking *
|
|
||||||
public SteamNetworking GetISteamNetworking( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamNetworking( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamNetworking( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamParentalSettings *
|
|
||||||
public SteamParentalSettings GetISteamParentalSettings( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamParentalSettings( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamParentalSettings( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamParties *
|
|
||||||
public SteamParties GetISteamParties( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamParties( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamParties( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamRemoteStorage *
|
|
||||||
public SteamRemoteStorage GetISteamRemoteStorage( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamRemoteStorage( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamRemoteStorage( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamScreenshots *
|
|
||||||
public SteamScreenshots GetISteamScreenshots( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamScreenshots( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamScreenshots( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamUGC *
|
|
||||||
public SteamUGC GetISteamUGC( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamUGC( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamUGC( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamUser *
|
|
||||||
public SteamUser GetISteamUser( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamUser( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamUser( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamUserStats *
|
|
||||||
public SteamUserStats GetISteamUserStats( HSteamUser hSteamUser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamUserStats( hSteamUser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamUserStats( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamUtils *
|
|
||||||
public SteamUtils GetISteamUtils( HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamUtils( hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamUtils( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ISteamVideo *
|
|
||||||
public SteamVideo GetISteamVideo( HSteamUser hSteamuser /*HSteamUser*/, HSteamPipe hSteamPipe /*HSteamPipe*/, string pchVersion /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr interface_pointer;
|
|
||||||
interface_pointer = platform.ISteamClient_GetISteamVideo( hSteamuser.Value, hSteamPipe.Value, pchVersion );
|
|
||||||
if ( interface_pointer == IntPtr.Zero ) throw new System.Exception( $"Error getting interface {pchVersion}");
|
|
||||||
return new SteamVideo( steamworks, interface_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ReleaseUser( HSteamPipe hSteamPipe /*HSteamPipe*/, HSteamUser hUser /*HSteamUser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamClient_ReleaseUser( hSteamPipe.Value, hUser.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetLocalIPBinding( uint unIP /*uint32*/, ushort usPort /*uint16*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamClient_SetLocalIPBinding( unIP, usPort );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetWarningMessageHook( IntPtr pFunction /*SteamAPIWarningMessageHook_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamClient_SetWarningMessageHook( (IntPtr) pFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,255 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamController : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamController( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateActionSet( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetHandle /*ControllerActionSetHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_ActivateActionSet( controllerHandle.Value, actionSetHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateActionSetLayer( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetLayerHandle /*ControllerActionSetHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_ActivateActionSetLayer( controllerHandle.Value, actionSetLayerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void DeactivateActionSetLayer( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetLayerHandle /*ControllerActionSetHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_DeactivateActionSetLayer( controllerHandle.Value, actionSetLayerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void DeactivateAllActionSetLayers( ControllerHandle_t controllerHandle /*ControllerHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_DeactivateAllActionSetLayers( controllerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerActionOrigin
|
|
||||||
public ControllerActionOrigin GetActionOriginFromXboxOrigin( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, XboxOrigin eOrigin /*EXboxOrigin*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetActionOriginFromXboxOrigin( controllerHandle.Value, eOrigin );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerActionSetHandle_t
|
|
||||||
public ControllerActionSetHandle_t GetActionSetHandle( string pszActionSetName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetActionSetHandle( pszActionSetName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetActiveActionSetLayers( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, IntPtr handlesOut /*ControllerActionSetHandle_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetActiveActionSetLayers( controllerHandle.Value, (IntPtr) handlesOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputAnalogActionData_t
|
|
||||||
public InputAnalogActionData_t GetAnalogActionData( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerAnalogActionHandle_t analogActionHandle /*ControllerAnalogActionHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetAnalogActionData( controllerHandle.Value, analogActionHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerAnalogActionHandle_t
|
|
||||||
public ControllerAnalogActionHandle_t GetAnalogActionHandle( string pszActionName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetAnalogActionHandle( pszActionName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetAnalogActionOrigins( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetHandle /*ControllerActionSetHandle_t*/, ControllerAnalogActionHandle_t analogActionHandle /*ControllerAnalogActionHandle_t*/, out ControllerActionOrigin originsOut /*EControllerActionOrigin **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetAnalogActionOrigins( controllerHandle.Value, actionSetHandle.Value, analogActionHandle.Value, out originsOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetConnectedControllers( IntPtr handlesOut /*ControllerHandle_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetConnectedControllers( (IntPtr) handlesOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerHandle_t
|
|
||||||
public ControllerHandle_t GetControllerForGamepadIndex( int nIndex /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetControllerForGamepadIndex( nIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerActionSetHandle_t
|
|
||||||
public ControllerActionSetHandle_t GetCurrentActionSet( ControllerHandle_t controllerHandle /*ControllerHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetCurrentActionSet( controllerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputDigitalActionData_t
|
|
||||||
public InputDigitalActionData_t GetDigitalActionData( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerDigitalActionHandle_t digitalActionHandle /*ControllerDigitalActionHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetDigitalActionData( controllerHandle.Value, digitalActionHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerDigitalActionHandle_t
|
|
||||||
public ControllerDigitalActionHandle_t GetDigitalActionHandle( string pszActionName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetDigitalActionHandle( pszActionName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetDigitalActionOrigins( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerActionSetHandle_t actionSetHandle /*ControllerActionSetHandle_t*/, ControllerDigitalActionHandle_t digitalActionHandle /*ControllerDigitalActionHandle_t*/, out ControllerActionOrigin originsOut /*EControllerActionOrigin **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetDigitalActionOrigins( controllerHandle.Value, actionSetHandle.Value, digitalActionHandle.Value, out originsOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetGamepadIndexForController( ControllerHandle_t ulControllerHandle /*ControllerHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetGamepadIndexForController( ulControllerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetGlyphForActionOrigin( ControllerActionOrigin eOrigin /*EControllerActionOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamController_GetGlyphForActionOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetGlyphForXboxOrigin( XboxOrigin eOrigin /*EXboxOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamController_GetGlyphForXboxOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamInputType
|
|
||||||
public SteamInputType GetInputTypeForHandle( ControllerHandle_t controllerHandle /*ControllerHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetInputTypeForHandle( controllerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputMotionData_t
|
|
||||||
public InputMotionData_t GetMotionData( ControllerHandle_t controllerHandle /*ControllerHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_GetMotionData( controllerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetStringForActionOrigin( ControllerActionOrigin eOrigin /*EControllerActionOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamController_GetStringForActionOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetStringForXboxOrigin( XboxOrigin eOrigin /*EXboxOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamController_GetStringForXboxOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool Init()
|
|
||||||
{
|
|
||||||
return platform.ISteamController_Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RunFrame()
|
|
||||||
{
|
|
||||||
platform.ISteamController_RunFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetLEDColor( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, byte nColorR /*uint8*/, byte nColorG /*uint8*/, byte nColorB /*uint8*/, uint nFlags /*unsigned int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_SetLEDColor( controllerHandle.Value, nColorR, nColorG, nColorB, nFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ShowBindingPanel( ControllerHandle_t controllerHandle /*ControllerHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_ShowBindingPanel( controllerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool Shutdown()
|
|
||||||
{
|
|
||||||
return platform.ISteamController_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void StopAnalogActionMomentum( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ControllerAnalogActionHandle_t eAction /*ControllerAnalogActionHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_StopAnalogActionMomentum( controllerHandle.Value, eAction.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ControllerActionOrigin
|
|
||||||
public ControllerActionOrigin TranslateActionOrigin( SteamInputType eDestinationInputType /*ESteamInputType*/, ControllerActionOrigin eSourceOrigin /*EControllerActionOrigin*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamController_TranslateActionOrigin( eDestinationInputType, eSourceOrigin );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void TriggerHapticPulse( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, SteamControllerPad eTargetPad /*ESteamControllerPad*/, ushort usDurationMicroSec /*unsigned short*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_TriggerHapticPulse( controllerHandle.Value, eTargetPad, usDurationMicroSec );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void TriggerRepeatedHapticPulse( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, SteamControllerPad eTargetPad /*ESteamControllerPad*/, ushort usDurationMicroSec /*unsigned short*/, ushort usOffMicroSec /*unsigned short*/, ushort unRepeat /*unsigned short*/, uint nFlags /*unsigned int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_TriggerRepeatedHapticPulse( controllerHandle.Value, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void TriggerVibration( ControllerHandle_t controllerHandle /*ControllerHandle_t*/, ushort usLeftSpeed /*unsigned short*/, ushort usRightSpeed /*unsigned short*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamController_TriggerVibration( controllerHandle.Value, usLeftSpeed, usRightSpeed );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,546 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamFriends : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamFriends( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateGameOverlay( string pchDialog /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_ActivateGameOverlay( pchDialog );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_ActivateGameOverlayInviteDialog( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateGameOverlayToStore( AppId_t nAppID /*AppId_t*/, OverlayToStoreFlag eFlag /*EOverlayToStoreFlag*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_ActivateGameOverlayToStore( nAppID.Value, eFlag );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateGameOverlayToUser( string pchDialog /*const char **/, CSteamID steamID /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_ActivateGameOverlayToUser( pchDialog, steamID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateGameOverlayToWebPage( string pchURL /*const char **/, ActivateGameOverlayToWebPageMode eMode /*EActivateGameOverlayToWebPageMode*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_ActivateGameOverlayToWebPage( pchURL, eMode );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ClearRichPresence()
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_ClearRichPresence();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_CloseClanChatWindowInSteam( steamIDClanChat.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public SteamAPICall_t DownloadClanActivityCounts( IntPtr psteamIDClans /*class CSteamID **/, int cClansToRequest /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_DownloadClanActivityCounts( (IntPtr) psteamIDClans, cClansToRequest );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<FriendsEnumerateFollowingList_t> EnumerateFollowingList( uint unStartIndex /*uint32*/, Action<FriendsEnumerateFollowingList_t, bool> CallbackFunction = null /*Action<FriendsEnumerateFollowingList_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamFriends_EnumerateFollowingList( unStartIndex );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<FriendsEnumerateFollowingList_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetChatMemberByIndex( CSteamID steamIDClan /*class CSteamID*/, int iUser /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetChatMemberByIndex( steamIDClan.Value, iUser );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetClanActivityCounts( CSteamID steamIDClan /*class CSteamID*/, out int pnOnline /*int **/, out int pnInGame /*int **/, out int pnChatting /*int **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanActivityCounts( steamIDClan.Value, out pnOnline, out pnInGame, out pnChatting );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetClanByIndex( int iClan /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanByIndex( iClan );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetClanChatMemberCount( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanChatMemberCount( steamIDClan.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetClanChatMessage( CSteamID steamIDClanChat /*class CSteamID*/, int iMessage /*int*/, IntPtr prgchText /*void **/, int cchTextMax /*int*/, out ChatEntryType peChatEntryType /*EChatEntryType **/, out CSteamID psteamidChatter /*class CSteamID **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanChatMessage( steamIDClanChat.Value, iMessage, (IntPtr) prgchText, cchTextMax, out peChatEntryType, out psteamidChatter.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetClanCount()
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetClanName( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetClanName( steamIDClan.Value );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetClanOfficerByIndex( CSteamID steamIDClan /*class CSteamID*/, int iOfficer /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanOfficerByIndex( steamIDClan.Value, iOfficer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetClanOfficerCount( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanOfficerCount( steamIDClan.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetClanOwner( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetClanOwner( steamIDClan.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetClanTag( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetClanTag( steamIDClan.Value );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetCoplayFriend( int iCoplayFriend /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetCoplayFriend( iCoplayFriend );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetCoplayFriendCount()
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetCoplayFriendCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<FriendsGetFollowerCount_t> GetFollowerCount( CSteamID steamID /*class CSteamID*/, Action<FriendsGetFollowerCount_t, bool> CallbackFunction = null /*Action<FriendsGetFollowerCount_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamFriends_GetFollowerCount( steamID.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<FriendsGetFollowerCount_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetFriendByIndex( int iFriend /*int*/, int iFriendFlags /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendByIndex( iFriend, iFriendFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// AppId_t
|
|
||||||
public AppId_t GetFriendCoplayGame( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendCoplayGame( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendCoplayTime( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendCoplayTime( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendCount( int iFriendFlags /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendCount( iFriendFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendCountFromSource( CSteamID steamIDSource /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendCountFromSource( steamIDSource.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetFriendFromSourceByIndex( CSteamID steamIDSource /*class CSteamID*/, int iFriend /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendFromSourceByIndex( steamIDSource.Value, iFriend );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetFriendGamePlayed( CSteamID steamIDFriend /*class CSteamID*/, ref FriendGameInfo_t pFriendGameInfo /*struct FriendGameInfo_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendGamePlayed( steamIDFriend.Value, ref pFriendGameInfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendMessage( CSteamID steamIDFriend /*class CSteamID*/, int iMessageID /*int*/, IntPtr pvData /*void **/, int cubData /*int*/, out ChatEntryType peChatEntryType /*EChatEntryType **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendMessage( steamIDFriend.Value, iMessageID, (IntPtr) pvData, cubData, out peChatEntryType );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetFriendPersonaName( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetFriendPersonaName( steamIDFriend.Value );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetFriendPersonaNameHistory( CSteamID steamIDFriend /*class CSteamID*/, int iPersonaName /*int*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetFriendPersonaNameHistory( steamIDFriend.Value, iPersonaName );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// PersonaState
|
|
||||||
public PersonaState GetFriendPersonaState( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendPersonaState( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// FriendRelationship
|
|
||||||
public FriendRelationship GetFriendRelationship( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendRelationship( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetFriendRichPresence( CSteamID steamIDFriend /*class CSteamID*/, string pchKey /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetFriendRichPresence( steamIDFriend.Value, pchKey );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend /*class CSteamID*/, int iKey /*int*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetFriendRichPresenceKeyByIndex( steamIDFriend.Value, iKey );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendRichPresenceKeyCount( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendsGroupCount()
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendsGroupCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// FriendsGroupID_t
|
|
||||||
public FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendsGroupIDByIndex( iFG );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID /*FriendsGroupID_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendsGroupMembersCount( friendsGroupID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID /*FriendsGroupID_t*/, IntPtr pOutSteamIDMembers /*class CSteamID **/, int nMembersCount /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_GetFriendsGroupMembersList( friendsGroupID.Value, (IntPtr) pOutSteamIDMembers, nMembersCount );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetFriendsGroupName( FriendsGroupID_t friendsGroupID /*FriendsGroupID_t*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetFriendsGroupName( friendsGroupID.Value );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFriendSteamLevel( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetFriendSteamLevel( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetLargeFriendAvatar( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetLargeFriendAvatar( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetMediumFriendAvatar( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetMediumFriendAvatar( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetNumChatsWithUnreadPriorityMessages()
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetNumChatsWithUnreadPriorityMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetPersonaName()
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetPersonaName();
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// PersonaState
|
|
||||||
public PersonaState GetPersonaState()
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetPersonaState();
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetPlayerNickname( CSteamID steamIDPlayer /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamFriends_GetPlayerNickname( steamIDPlayer.Value );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetSmallFriendAvatar( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetSmallFriendAvatar( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetUserRestrictions()
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_GetUserRestrictions();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool HasFriend( CSteamID steamIDFriend /*class CSteamID*/, int iFriendFlags /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_HasFriend( steamIDFriend.Value, iFriendFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool InviteUserToGame( CSteamID steamIDFriend /*class CSteamID*/, string pchConnectString /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_InviteUserToGame( steamIDFriend.Value, pchConnectString );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsClanChatAdmin( CSteamID steamIDClanChat /*class CSteamID*/, CSteamID steamIDUser /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_IsClanChatAdmin( steamIDClanChat.Value, steamIDUser.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_IsClanChatWindowOpenInSteam( steamIDClanChat.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsClanOfficialGameGroup( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_IsClanOfficialGameGroup( steamIDClan.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsClanPublic( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_IsClanPublic( steamIDClan.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<FriendsIsFollowing_t> IsFollowing( CSteamID steamID /*class CSteamID*/, Action<FriendsIsFollowing_t, bool> CallbackFunction = null /*Action<FriendsIsFollowing_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamFriends_IsFollowing( steamID.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<FriendsIsFollowing_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsUserInSource( CSteamID steamIDUser /*class CSteamID*/, CSteamID steamIDSource /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_IsUserInSource( steamIDUser.Value, steamIDSource.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<JoinClanChatRoomCompletionResult_t> JoinClanChatRoom( CSteamID steamIDClan /*class CSteamID*/, Action<JoinClanChatRoomCompletionResult_t, bool> CallbackFunction = null /*Action<JoinClanChatRoomCompletionResult_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamFriends_JoinClanChatRoom( steamIDClan.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<JoinClanChatRoomCompletionResult_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool LeaveClanChatRoom( CSteamID steamIDClan /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_LeaveClanChatRoom( steamIDClan.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_OpenClanChatWindowInSteam( steamIDClanChat.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ReplyToFriendMessage( CSteamID steamIDFriend /*class CSteamID*/, string pchMsgToSend /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_ReplyToFriendMessage( steamIDFriend.Value, pchMsgToSend );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<ClanOfficerListResponse_t> RequestClanOfficerList( CSteamID steamIDClan /*class CSteamID*/, Action<ClanOfficerListResponse_t, bool> CallbackFunction = null /*Action<ClanOfficerListResponse_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamFriends_RequestClanOfficerList( steamIDClan.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<ClanOfficerListResponse_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RequestFriendRichPresence( CSteamID steamIDFriend /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_RequestFriendRichPresence( steamIDFriend.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RequestUserInformation( CSteamID steamIDUser /*class CSteamID*/, bool bRequireNameOnly /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_RequestUserInformation( steamIDUser.Value, bRequireNameOnly );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendClanChatMessage( CSteamID steamIDClanChat /*class CSteamID*/, string pchText /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_SendClanChatMessage( steamIDClanChat.Value, pchText );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetInGameVoiceSpeaking( CSteamID steamIDUser /*class CSteamID*/, bool bSpeaking /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_SetInGameVoiceSpeaking( steamIDUser.Value, bSpeaking );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetListenForFriendsMessages( bool bInterceptEnabled /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_SetListenForFriendsMessages( bInterceptEnabled );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<SetPersonaNameResponse_t> SetPersonaName( string pchPersonaName /*const char **/, Action<SetPersonaNameResponse_t, bool> CallbackFunction = null /*Action<SetPersonaNameResponse_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamFriends_SetPersonaName( pchPersonaName );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<SetPersonaNameResponse_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetPlayedWith( CSteamID steamIDUserPlayedWith /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamFriends_SetPlayedWith( steamIDUserPlayedWith.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetRichPresence( string pchKey /*const char **/, string pchValue /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamFriends_SetRichPresence( pchKey, pchValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,136 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamGameSearch : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamGameSearch( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t AcceptGame()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_AcceptGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t AddGameSearchParams( string pchKeyToFind /*const char **/, string pchValuesToFind /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_AddGameSearchParams( pchKeyToFind, pchValuesToFind );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t CancelRequestPlayersForGame()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_CancelRequestPlayersForGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t DeclineGame()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_DeclineGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t EndGame( ulong ullUniqueGameID /*uint64*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_EndGame( ullUniqueGameID );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t EndGameSearch()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_EndGameSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t HostConfirmGameStart( ulong ullUniqueGameID /*uint64*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_HostConfirmGameStart( ullUniqueGameID );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t RequestPlayersForGame( int nPlayerMin /*int*/, int nPlayerMax /*int*/, int nMaxTeamSize /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_RequestPlayersForGame( nPlayerMin, nPlayerMax, nMaxTeamSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
// with: Detect_StringFetch False
|
|
||||||
public GameSearchErrorCode_t RetrieveConnectionDetails( CSteamID steamIDHost /*class CSteamID*/, out string pchConnectionDetails /*char **/ )
|
|
||||||
{
|
|
||||||
GameSearchErrorCode_t bSuccess = default( GameSearchErrorCode_t );
|
|
||||||
pchConnectionDetails = string.Empty;
|
|
||||||
System.Text.StringBuilder pchConnectionDetails_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cubConnectionDetails = 4096;
|
|
||||||
bSuccess = platform.ISteamGameSearch_RetrieveConnectionDetails( steamIDHost.Value, pchConnectionDetails_sb, cubConnectionDetails );
|
|
||||||
pchConnectionDetails = pchConnectionDetails_sb.ToString();
|
|
||||||
return bSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t SearchForGameSolo( int nPlayerMin /*int*/, int nPlayerMax /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_SearchForGameSolo( nPlayerMin, nPlayerMax );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t SearchForGameWithLobby( CSteamID steamIDLobby /*class CSteamID*/, int nPlayerMin /*int*/, int nPlayerMax /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_SearchForGameWithLobby( steamIDLobby.Value, nPlayerMin, nPlayerMax );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t SetConnectionDetails( string pchConnectionDetails /*const char **/, int cubConnectionDetails /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_SetConnectionDetails( pchConnectionDetails, cubConnectionDetails );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t SetGameHostParams( string pchKey /*const char **/, string pchValue /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_SetGameHostParams( pchKey, pchValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// GameSearchErrorCode_t
|
|
||||||
public GameSearchErrorCode_t SubmitPlayerResult( ulong ullUniqueGameID /*uint64*/, CSteamID steamIDPlayer /*class CSteamID*/, PlayerResult_t EPlayerResult /*EPlayerResult_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameSearch_SubmitPlayerResult( ullUniqueGameID, steamIDPlayer.Value, EPlayerResult );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,327 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamGameServer : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamGameServer( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<AssociateWithClanResult_t> AssociateWithClan( CSteamID steamIDClan /*class CSteamID*/, Action<AssociateWithClanResult_t, bool> CallbackFunction = null /*Action<AssociateWithClanResult_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamGameServer_AssociateWithClan( steamIDClan.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<AssociateWithClanResult_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// BeginAuthSessionResult
|
|
||||||
public BeginAuthSessionResult BeginAuthSession( IntPtr pAuthTicket /*const void **/, int cbAuthTicket /*int*/, CSteamID steamID /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_BeginAuthSession( (IntPtr) pAuthTicket, cbAuthTicket, steamID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BLoggedOn()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_BLoggedOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BSecure()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_BSecure();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BUpdateUserData( CSteamID steamIDUser /*class CSteamID*/, string pchPlayerName /*const char **/, uint uScore /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_BUpdateUserData( steamIDUser.Value, pchPlayerName, uScore );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void CancelAuthTicket( HAuthTicket hAuthTicket /*HAuthTicket*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_CancelAuthTicket( hAuthTicket.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ClearAllKeyValues()
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_ClearAllKeyValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<ComputeNewPlayerCompatibilityResult_t> ComputeNewPlayerCompatibility( CSteamID steamIDNewPlayer /*class CSteamID*/, Action<ComputeNewPlayerCompatibilityResult_t, bool> CallbackFunction = null /*Action<ComputeNewPlayerCompatibilityResult_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamGameServer_ComputeNewPlayerCompatibility( steamIDNewPlayer.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<ComputeNewPlayerCompatibilityResult_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong CreateUnauthenticatedUserConnection()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_CreateUnauthenticatedUserConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void EnableHeartbeats( bool bActive /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_EnableHeartbeats( bActive );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void EndAuthSession( CSteamID steamID /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_EndAuthSession( steamID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ForceHeartbeat()
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_ForceHeartbeat();
|
|
||||||
}
|
|
||||||
|
|
||||||
// HAuthTicket
|
|
||||||
public HAuthTicket GetAuthSessionTicket( IntPtr pTicket /*void **/, int cbMaxTicket /*int*/, out uint pcbTicket /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_GetAuthSessionTicket( (IntPtr) pTicket, cbMaxTicket, out pcbTicket );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void GetGameplayStats()
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_GetGameplayStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetNextOutgoingPacket( IntPtr pOut /*void **/, int cbMaxOut /*int*/, out uint pNetAdr /*uint32 **/, out ushort pPort /*uint16 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_GetNextOutgoingPacket( (IntPtr) pOut, cbMaxOut, out pNetAdr, out pPort );
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetPublicIP()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_GetPublicIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<GSReputation_t> GetServerReputation( Action<GSReputation_t, bool> CallbackFunction = null /*Action<GSReputation_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamGameServer_GetServerReputation();
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<GSReputation_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetSteamID()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_GetSteamID();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool HandleIncomingPacket( IntPtr pData /*const void **/, int cbData /*int*/, uint srcIP /*uint32*/, ushort srcPort /*uint16*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_HandleIncomingPacket( (IntPtr) pData, cbData, srcIP, srcPort );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool InitGameServer( uint unIP /*uint32*/, ushort usGamePort /*uint16*/, ushort usQueryPort /*uint16*/, uint unFlags /*uint32*/, AppId_t nGameAppId /*AppId_t*/, string pchVersionString /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_InitGameServer( unIP, usGamePort, usQueryPort, unFlags, nGameAppId.Value, pchVersionString );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void LogOff()
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_LogOff();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void LogOn( string pszToken /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_LogOn( pszToken );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void LogOnAnonymous()
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_LogOnAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RequestUserGroupStatus( CSteamID steamIDUser /*class CSteamID*/, CSteamID steamIDGroup /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_RequestUserGroupStatus( steamIDUser.Value, steamIDGroup.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendUserConnectAndAuthenticate( uint unIPClient /*uint32*/, IntPtr pvAuthBlob /*const void **/, uint cubAuthBlobSize /*uint32*/, out CSteamID pSteamIDUser /*class CSteamID **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_SendUserConnectAndAuthenticate( unIPClient, (IntPtr) pvAuthBlob, cubAuthBlobSize, out pSteamIDUser.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SendUserDisconnect( CSteamID steamIDUser /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SendUserDisconnect( steamIDUser.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetBotPlayerCount( int cBotplayers /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetBotPlayerCount( cBotplayers );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetDedicatedServer( bool bDedicated /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetDedicatedServer( bDedicated );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetGameData( string pchGameData /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetGameData( pchGameData );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetGameDescription( string pszGameDescription /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetGameDescription( pszGameDescription );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetGameTags( string pchGameTags /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetGameTags( pchGameTags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetHeartbeatInterval( int iHeartbeatInterval /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetHeartbeatInterval( iHeartbeatInterval );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetKeyValue( string pKey /*const char **/, string pValue /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetKeyValue( pKey, pValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetMapName( string pszMapName /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetMapName( pszMapName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetMaxPlayerCount( int cPlayersMax /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetMaxPlayerCount( cPlayersMax );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetModDir( string pszModDir /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetModDir( pszModDir );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetPasswordProtected( bool bPasswordProtected /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetPasswordProtected( bPasswordProtected );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetProduct( string pszProduct /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetProduct( pszProduct );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetRegion( string pszRegion /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetRegion( pszRegion );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetServerName( string pszServerName /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetServerName( pszServerName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetSpectatorPort( ushort unSpectatorPort /*uint16*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetSpectatorPort( unSpectatorPort );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetSpectatorServerName( string pszSpectatorServerName /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamGameServer_SetSpectatorServerName( pszSpectatorServerName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// UserHasLicenseForAppResult
|
|
||||||
public UserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID /*class CSteamID*/, AppId_t appID /*AppId_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_UserHasLicenseForApp( steamID.Value, appID.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool WasRestartRequested()
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServer_WasRestartRequested();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamGameServerStats : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamGameServerStats( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ClearUserAchievement( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_ClearUserAchievement( steamIDUser.Value, pchName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetUserAchievement( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/, ref bool pbAchieved /*bool **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_GetUserAchievement( steamIDUser.Value, pchName, ref pbAchieved );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetUserStat( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/, out int pData /*int32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_GetUserStat( steamIDUser.Value, pchName, out pData );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetUserStat0( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/, out float pData /*float **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_GetUserStat0( steamIDUser.Value, pchName, out pData );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<GSStatsReceived_t> RequestUserStats( CSteamID steamIDUser /*class CSteamID*/, Action<GSStatsReceived_t, bool> CallbackFunction = null /*Action<GSStatsReceived_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamGameServerStats_RequestUserStats( steamIDUser.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<GSStatsReceived_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetUserAchievement( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_SetUserAchievement( steamIDUser.Value, pchName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetUserStat( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/, int nData /*int32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_SetUserStat( steamIDUser.Value, pchName, nData );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetUserStat0( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/, float fData /*float*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_SetUserStat0( steamIDUser.Value, pchName, fData );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<GSStatsStored_t> StoreUserStats( CSteamID steamIDUser /*class CSteamID*/, Action<GSStatsStored_t, bool> CallbackFunction = null /*Action<GSStatsStored_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamGameServerStats_StoreUserStats( steamIDUser.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<GSStatsStored_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateUserAvgRateStat( CSteamID steamIDUser /*class CSteamID*/, string pchName /*const char **/, float flCountThisSession /*float*/, double dSessionLength /*double*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamGameServerStats_UpdateUserAvgRateStat( steamIDUser.Value, pchName, flCountThisSession, dSessionLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,273 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamHTMLSurface : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamHTMLSurface( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddHeader( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, string pchKey /*const char **/, string pchValue /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_AddHeader( unBrowserHandle.Value, pchKey, pchValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AllowStartRequest( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, bool bAllowed /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_AllowStartRequest( unBrowserHandle.Value, bAllowed );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void CopyToClipboard( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_CopyToClipboard( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<HTML_BrowserReady_t> CreateBrowser( string pchUserAgent /*const char **/, string pchUserCSS /*const char **/, Action<HTML_BrowserReady_t, bool> CallbackFunction = null /*Action<HTML_BrowserReady_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamHTMLSurface_CreateBrowser( pchUserAgent, pchUserCSS );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<HTML_BrowserReady_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void DestructISteamHTMLSurface()
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_DestructISteamHTMLSurface();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ExecuteJavascript( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, string pchScript /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_ExecuteJavascript( unBrowserHandle.Value, pchScript );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void Find( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, string pchSearchStr /*const char **/, bool bCurrentlyInFind /*bool*/, bool bReverse /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_Find( unBrowserHandle.Value, pchSearchStr, bCurrentlyInFind, bReverse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void GetLinkAtPosition( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, int x /*int*/, int y /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_GetLinkAtPosition( unBrowserHandle.Value, x, y );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void GoBack( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_GoBack( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void GoForward( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_GoForward( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool Init()
|
|
||||||
{
|
|
||||||
return platform.ISteamHTMLSurface_Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void JSDialogResponse( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, bool bResult /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_JSDialogResponse( unBrowserHandle.Value, bResult );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void KeyChar( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, uint cUnicodeChar /*uint32*/, HTMLKeyModifiers eHTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_KeyChar( unBrowserHandle.Value, cUnicodeChar, eHTMLKeyModifiers );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void KeyDown( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, uint nNativeKeyCode /*uint32*/, HTMLKeyModifiers eHTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/, bool bIsSystemKey /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_KeyDown( unBrowserHandle.Value, nNativeKeyCode, eHTMLKeyModifiers, bIsSystemKey );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void KeyUp( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, uint nNativeKeyCode /*uint32*/, HTMLKeyModifiers eHTMLKeyModifiers /*ISteamHTMLSurface::EHTMLKeyModifiers*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_KeyUp( unBrowserHandle.Value, nNativeKeyCode, eHTMLKeyModifiers );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void LoadURL( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, string pchURL /*const char **/, string pchPostData /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_LoadURL( unBrowserHandle.Value, pchURL, pchPostData );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void MouseDoubleClick( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, HTMLMouseButton eMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_MouseDoubleClick( unBrowserHandle.Value, eMouseButton );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void MouseDown( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, HTMLMouseButton eMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_MouseDown( unBrowserHandle.Value, eMouseButton );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void MouseMove( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, int x /*int*/, int y /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_MouseMove( unBrowserHandle.Value, x, y );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void MouseUp( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, HTMLMouseButton eMouseButton /*ISteamHTMLSurface::EHTMLMouseButton*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_MouseUp( unBrowserHandle.Value, eMouseButton );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void MouseWheel( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, int nDelta /*int32*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_MouseWheel( unBrowserHandle.Value, nDelta );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void OpenDeveloperTools( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_OpenDeveloperTools( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void PasteFromClipboard( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_PasteFromClipboard( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void Reload( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_Reload( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RemoveBrowser( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_RemoveBrowser( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetBackgroundMode( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, bool bBackgroundMode /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetBackgroundMode( unBrowserHandle.Value, bBackgroundMode );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetCookie( string pchHostname /*const char **/, string pchKey /*const char **/, string pchValue /*const char **/, string pchPath /*const char **/, RTime32 nExpires /*RTime32*/, bool bSecure /*bool*/, bool bHTTPOnly /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetCookie( pchHostname, pchKey, pchValue, pchPath, nExpires.Value, bSecure, bHTTPOnly );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetDPIScalingFactor( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, float flDPIScaling /*float*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetDPIScalingFactor( unBrowserHandle.Value, flDPIScaling );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetHorizontalScroll( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, uint nAbsolutePixelScroll /*uint32*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetHorizontalScroll( unBrowserHandle.Value, nAbsolutePixelScroll );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetKeyFocus( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, bool bHasKeyFocus /*bool*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetKeyFocus( unBrowserHandle.Value, bHasKeyFocus );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetPageScaleFactor( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, float flZoom /*float*/, int nPointX /*int*/, int nPointY /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetPageScaleFactor( unBrowserHandle.Value, flZoom, nPointX, nPointY );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetSize( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, uint unWidth /*uint32*/, uint unHeight /*uint32*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetSize( unBrowserHandle.Value, unWidth, unHeight );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetVerticalScroll( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/, uint nAbsolutePixelScroll /*uint32*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_SetVerticalScroll( unBrowserHandle.Value, nAbsolutePixelScroll );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool Shutdown()
|
|
||||||
{
|
|
||||||
return platform.ISteamHTMLSurface_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void StopFind( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_StopFind( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void StopLoad( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_StopLoad( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ViewSource( HHTMLBrowser unBrowserHandle /*HHTMLBrowser*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamHTMLSurface_ViewSource( unBrowserHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,195 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamHTTP : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamHTTP( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTPCookieContainerHandle
|
|
||||||
public HTTPCookieContainerHandle CreateCookieContainer( bool bAllowResponsesToModify /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_CreateCookieContainer( bAllowResponsesToModify );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTPRequestHandle
|
|
||||||
public HTTPRequestHandle CreateHTTPRequest( HTTPMethod eHTTPRequestMethod /*EHTTPMethod*/, string pchAbsoluteURL /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_CreateHTTPRequest( eHTTPRequestMethod, pchAbsoluteURL );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool DeferHTTPRequest( HTTPRequestHandle hRequest /*HTTPRequestHandle*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_DeferHTTPRequest( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, out float pflPercentOut /*float **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPDownloadProgressPct( hRequest.Value, out pflPercentOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, ref bool pbWasTimedOut /*bool **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPRequestWasTimedOut( hRequest.Value, ref pbWasTimedOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPResponseBodyData( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, out byte pBodyDataBuffer /*uint8 **/, uint unBufferSize /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPResponseBodyData( hRequest.Value, out pBodyDataBuffer, unBufferSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPResponseBodySize( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, out uint unBodySize /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPResponseBodySize( hRequest.Value, out unBodySize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPResponseHeaderSize( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, string pchHeaderName /*const char **/, out uint unResponseHeaderSize /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPResponseHeaderSize( hRequest.Value, pchHeaderName, out unResponseHeaderSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPResponseHeaderValue( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, string pchHeaderName /*const char **/, out byte pHeaderValueBuffer /*uint8 **/, uint unBufferSize /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPResponseHeaderValue( hRequest.Value, pchHeaderName, out pHeaderValueBuffer, unBufferSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetHTTPStreamingResponseBodyData( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, uint cOffset /*uint32*/, out byte pBodyDataBuffer /*uint8 **/, uint unBufferSize /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_GetHTTPStreamingResponseBodyData( hRequest.Value, cOffset, out pBodyDataBuffer, unBufferSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool PrioritizeHTTPRequest( HTTPRequestHandle hRequest /*HTTPRequestHandle*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_PrioritizeHTTPRequest( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ReleaseCookieContainer( HTTPCookieContainerHandle hCookieContainer /*HTTPCookieContainerHandle*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_ReleaseCookieContainer( hCookieContainer.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ReleaseHTTPRequest( HTTPRequestHandle hRequest /*HTTPRequestHandle*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_ReleaseHTTPRequest( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendHTTPRequest( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, ref SteamAPICall_t pCallHandle /*SteamAPICall_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SendHTTPRequest( hRequest.Value, ref pCallHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendHTTPRequestAndStreamResponse( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, ref SteamAPICall_t pCallHandle /*SteamAPICall_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SendHTTPRequestAndStreamResponse( hRequest.Value, ref pCallHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetCookie( HTTPCookieContainerHandle hCookieContainer /*HTTPCookieContainerHandle*/, string pchHost /*const char **/, string pchUrl /*const char **/, string pchCookie /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetCookie( hCookieContainer.Value, pchHost, pchUrl, pchCookie );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, uint unMilliseconds /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestAbsoluteTimeoutMS( hRequest.Value, unMilliseconds );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestContextValue( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, ulong ulContextValue /*uint64*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestContextValue( hRequest.Value, ulContextValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestCookieContainer( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, HTTPCookieContainerHandle hCookieContainer /*HTTPCookieContainerHandle*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestCookieContainer( hRequest.Value, hCookieContainer.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, string pchParamName /*const char **/, string pchParamValue /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestGetOrPostParameter( hRequest.Value, pchParamName, pchParamValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestHeaderValue( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, string pchHeaderName /*const char **/, string pchHeaderValue /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestHeaderValue( hRequest.Value, pchHeaderName, pchHeaderValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestNetworkActivityTimeout( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, uint unTimeoutSeconds /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestNetworkActivityTimeout( hRequest.Value, unTimeoutSeconds );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, string pchContentType /*const char **/, out byte pubBody /*uint8 **/, uint unBodyLen /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestRawPostBody( hRequest.Value, pchContentType, out pubBody, unBodyLen );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestRequiresVerifiedCertificate( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, bool bRequireVerifiedCertificate /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestRequiresVerifiedCertificate( hRequest.Value, bRequireVerifiedCertificate );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetHTTPRequestUserAgentInfo( HTTPRequestHandle hRequest /*HTTPRequestHandle*/, string pchUserAgentInfo /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamHTTP_SetHTTPRequestUserAgentInfo( hRequest.Value, pchUserAgentInfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,255 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamInput : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamInput( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateActionSet( InputHandle_t inputHandle /*InputHandle_t*/, InputActionSetHandle_t actionSetHandle /*InputActionSetHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_ActivateActionSet( inputHandle.Value, actionSetHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ActivateActionSetLayer( InputHandle_t inputHandle /*InputHandle_t*/, InputActionSetHandle_t actionSetLayerHandle /*InputActionSetHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_ActivateActionSetLayer( inputHandle.Value, actionSetLayerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void DeactivateActionSetLayer( InputHandle_t inputHandle /*InputHandle_t*/, InputActionSetHandle_t actionSetLayerHandle /*InputActionSetHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_DeactivateActionSetLayer( inputHandle.Value, actionSetLayerHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void DeactivateAllActionSetLayers( InputHandle_t inputHandle /*InputHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_DeactivateAllActionSetLayers( inputHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputActionOrigin
|
|
||||||
public InputActionOrigin GetActionOriginFromXboxOrigin( InputHandle_t inputHandle /*InputHandle_t*/, XboxOrigin eOrigin /*EXboxOrigin*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetActionOriginFromXboxOrigin( inputHandle.Value, eOrigin );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputActionSetHandle_t
|
|
||||||
public InputActionSetHandle_t GetActionSetHandle( string pszActionSetName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetActionSetHandle( pszActionSetName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetActiveActionSetLayers( InputHandle_t inputHandle /*InputHandle_t*/, IntPtr handlesOut /*InputActionSetHandle_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetActiveActionSetLayers( inputHandle.Value, (IntPtr) handlesOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputAnalogActionData_t
|
|
||||||
public InputAnalogActionData_t GetAnalogActionData( InputHandle_t inputHandle /*InputHandle_t*/, InputAnalogActionHandle_t analogActionHandle /*InputAnalogActionHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetAnalogActionData( inputHandle.Value, analogActionHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputAnalogActionHandle_t
|
|
||||||
public InputAnalogActionHandle_t GetAnalogActionHandle( string pszActionName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetAnalogActionHandle( pszActionName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetAnalogActionOrigins( InputHandle_t inputHandle /*InputHandle_t*/, InputActionSetHandle_t actionSetHandle /*InputActionSetHandle_t*/, InputAnalogActionHandle_t analogActionHandle /*InputAnalogActionHandle_t*/, out InputActionOrigin originsOut /*EInputActionOrigin **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetAnalogActionOrigins( inputHandle.Value, actionSetHandle.Value, analogActionHandle.Value, out originsOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetConnectedControllers( IntPtr handlesOut /*InputHandle_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetConnectedControllers( (IntPtr) handlesOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputHandle_t
|
|
||||||
public InputHandle_t GetControllerForGamepadIndex( int nIndex /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetControllerForGamepadIndex( nIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputActionSetHandle_t
|
|
||||||
public InputActionSetHandle_t GetCurrentActionSet( InputHandle_t inputHandle /*InputHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetCurrentActionSet( inputHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputDigitalActionData_t
|
|
||||||
public InputDigitalActionData_t GetDigitalActionData( InputHandle_t inputHandle /*InputHandle_t*/, InputDigitalActionHandle_t digitalActionHandle /*InputDigitalActionHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetDigitalActionData( inputHandle.Value, digitalActionHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputDigitalActionHandle_t
|
|
||||||
public InputDigitalActionHandle_t GetDigitalActionHandle( string pszActionName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetDigitalActionHandle( pszActionName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetDigitalActionOrigins( InputHandle_t inputHandle /*InputHandle_t*/, InputActionSetHandle_t actionSetHandle /*InputActionSetHandle_t*/, InputDigitalActionHandle_t digitalActionHandle /*InputDigitalActionHandle_t*/, out InputActionOrigin originsOut /*EInputActionOrigin **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetDigitalActionOrigins( inputHandle.Value, actionSetHandle.Value, digitalActionHandle.Value, out originsOut );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetGamepadIndexForController( InputHandle_t ulinputHandle /*InputHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetGamepadIndexForController( ulinputHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetGlyphForActionOrigin( InputActionOrigin eOrigin /*EInputActionOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamInput_GetGlyphForActionOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetGlyphForXboxOrigin( XboxOrigin eOrigin /*EXboxOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamInput_GetGlyphForXboxOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamInputType
|
|
||||||
public SteamInputType GetInputTypeForHandle( InputHandle_t inputHandle /*InputHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetInputTypeForHandle( inputHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputMotionData_t
|
|
||||||
public InputMotionData_t GetMotionData( InputHandle_t inputHandle /*InputHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_GetMotionData( inputHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetStringForActionOrigin( InputActionOrigin eOrigin /*EInputActionOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamInput_GetStringForActionOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetStringForXboxOrigin( XboxOrigin eOrigin /*EXboxOrigin*/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamInput_GetStringForXboxOrigin( eOrigin );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool Init()
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RunFrame()
|
|
||||||
{
|
|
||||||
platform.ISteamInput_RunFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetLEDColor( InputHandle_t inputHandle /*InputHandle_t*/, byte nColorR /*uint8*/, byte nColorG /*uint8*/, byte nColorB /*uint8*/, uint nFlags /*unsigned int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_SetLEDColor( inputHandle.Value, nColorR, nColorG, nColorB, nFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ShowBindingPanel( InputHandle_t inputHandle /*InputHandle_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_ShowBindingPanel( inputHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool Shutdown()
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void StopAnalogActionMomentum( InputHandle_t inputHandle /*InputHandle_t*/, InputAnalogActionHandle_t eAction /*InputAnalogActionHandle_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_StopAnalogActionMomentum( inputHandle.Value, eAction.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// InputActionOrigin
|
|
||||||
public InputActionOrigin TranslateActionOrigin( SteamInputType eDestinationInputType /*ESteamInputType*/, InputActionOrigin eSourceOrigin /*EInputActionOrigin*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInput_TranslateActionOrigin( eDestinationInputType, eSourceOrigin );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void TriggerHapticPulse( InputHandle_t inputHandle /*InputHandle_t*/, SteamControllerPad eTargetPad /*ESteamControllerPad*/, ushort usDurationMicroSec /*unsigned short*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_TriggerHapticPulse( inputHandle.Value, eTargetPad, usDurationMicroSec );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void TriggerRepeatedHapticPulse( InputHandle_t inputHandle /*InputHandle_t*/, SteamControllerPad eTargetPad /*ESteamControllerPad*/, ushort usDurationMicroSec /*unsigned short*/, ushort usOffMicroSec /*unsigned short*/, ushort unRepeat /*unsigned short*/, uint nFlags /*unsigned int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_TriggerRepeatedHapticPulse( inputHandle.Value, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void TriggerVibration( InputHandle_t inputHandle /*InputHandle_t*/, ushort usLeftSpeed /*unsigned short*/, ushort usRightSpeed /*unsigned short*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInput_TriggerVibration( inputHandle.Value, usLeftSpeed, usRightSpeed );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,340 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamInventory : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamInventory( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool AddPromoItem( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t itemDef /*SteamItemDef_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_AddPromoItem( ref pResultHandle.Value, itemDef.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool AddPromoItems( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t[] pArrayItemDefs /*const SteamItemDef_t **/, uint unArrayLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_AddPromoItems( ref pResultHandle.Value, pArrayItemDefs.Select( x => x.Value ).ToArray(), unArrayLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CheckResultSteamID( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/, CSteamID steamIDExpected /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_CheckResultSteamID( resultHandle.Value, steamIDExpected.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ConsumeItem( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemInstanceID_t itemConsume /*SteamItemInstanceID_t*/, uint unQuantity /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_ConsumeItem( ref pResultHandle.Value, itemConsume.Value, unQuantity );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool DeserializeResult( ref SteamInventoryResult_t pOutResultHandle /*SteamInventoryResult_t **/, IntPtr pBuffer /*const void **/, uint unBufferSize /*uint32*/, bool bRESERVED_MUST_BE_FALSE /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_DeserializeResult( ref pOutResultHandle.Value, (IntPtr) pBuffer, unBufferSize, bRESERVED_MUST_BE_FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void DestroyResult( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamInventory_DestroyResult( resultHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ExchangeItems( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t[] pArrayGenerate /*const SteamItemDef_t **/, uint[] punArrayGenerateQuantity /*const uint32 **/, uint unArrayGenerateLength /*uint32*/, SteamItemInstanceID_t[] pArrayDestroy /*const SteamItemInstanceID_t **/, uint[] punArrayDestroyQuantity /*const uint32 **/, uint unArrayDestroyLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_ExchangeItems( ref pResultHandle.Value, pArrayGenerate.Select( x => x.Value ).ToArray(), punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy.Select( x => x.Value ).ToArray(), punArrayDestroyQuantity, unArrayDestroyLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GenerateItems( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t[] pArrayItemDefs /*const SteamItemDef_t **/, uint[] punArrayQuantity /*const uint32 **/, uint unArrayLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GenerateItems( ref pResultHandle.Value, pArrayItemDefs.Select( x => x.Value ).ToArray(), punArrayQuantity, unArrayLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetAllItems( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetAllItems( ref pResultHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// using: Detect_MultiSizeArrayReturn
|
|
||||||
public SteamItemDef_t[] GetEligiblePromoItemDefinitionIDs( CSteamID steamID /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
uint punItemDefIDsArraySize = 0;
|
|
||||||
|
|
||||||
bool success = false;
|
|
||||||
success = platform.ISteamInventory_GetEligiblePromoItemDefinitionIDs( steamID.Value, IntPtr.Zero, out punItemDefIDsArraySize );
|
|
||||||
if ( !success || punItemDefIDsArraySize == 0) return null;
|
|
||||||
|
|
||||||
var pItemDefIDs = new SteamItemDef_t[punItemDefIDsArraySize];
|
|
||||||
fixed ( void* pItemDefIDs_ptr = pItemDefIDs )
|
|
||||||
{
|
|
||||||
success = platform.ISteamInventory_GetEligiblePromoItemDefinitionIDs( steamID.Value, (IntPtr) pItemDefIDs_ptr, out punItemDefIDsArraySize );
|
|
||||||
if ( !success ) return null;
|
|
||||||
return pItemDefIDs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// using: Detect_MultiSizeArrayReturn
|
|
||||||
public SteamItemDef_t[] GetItemDefinitionIDs()
|
|
||||||
{
|
|
||||||
uint punItemDefIDsArraySize = 0;
|
|
||||||
|
|
||||||
bool success = false;
|
|
||||||
success = platform.ISteamInventory_GetItemDefinitionIDs( IntPtr.Zero, out punItemDefIDsArraySize );
|
|
||||||
if ( !success || punItemDefIDsArraySize == 0) return null;
|
|
||||||
|
|
||||||
var pItemDefIDs = new SteamItemDef_t[punItemDefIDsArraySize];
|
|
||||||
fixed ( void* pItemDefIDs_ptr = pItemDefIDs )
|
|
||||||
{
|
|
||||||
success = platform.ISteamInventory_GetItemDefinitionIDs( (IntPtr) pItemDefIDs_ptr, out punItemDefIDsArraySize );
|
|
||||||
if ( !success ) return null;
|
|
||||||
return pItemDefIDs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// with: Detect_StringFetch False
|
|
||||||
public bool GetItemDefinitionProperty( SteamItemDef_t iDefinition /*SteamItemDef_t*/, string pchPropertyName /*const char **/, out string pchValueBuffer /*char **/ )
|
|
||||||
{
|
|
||||||
bool bSuccess = default( bool );
|
|
||||||
pchValueBuffer = string.Empty;
|
|
||||||
System.Text.StringBuilder pchValueBuffer_sb = Helpers.TakeStringBuilder();
|
|
||||||
uint punValueBufferSizeOut = 4096;
|
|
||||||
bSuccess = platform.ISteamInventory_GetItemDefinitionProperty( iDefinition.Value, pchPropertyName, pchValueBuffer_sb, out punValueBufferSizeOut );
|
|
||||||
if ( !bSuccess ) return bSuccess;
|
|
||||||
pchValueBuffer = pchValueBuffer_sb.ToString();
|
|
||||||
return bSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetItemPrice( SteamItemDef_t iDefinition /*SteamItemDef_t*/, out ulong pCurrentPrice /*uint64 **/, out ulong pBasePrice /*uint64 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetItemPrice( iDefinition.Value, out pCurrentPrice, out pBasePrice );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetItemsByID( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemInstanceID_t[] pInstanceIDs /*const SteamItemInstanceID_t **/, uint unCountInstanceIDs /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetItemsByID( ref pResultHandle.Value, pInstanceIDs.Select( x => x.Value ).ToArray(), unCountInstanceIDs );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetItemsWithPrices( IntPtr pArrayItemDefs /*SteamItemDef_t **/, IntPtr pCurrentPrices /*uint64 **/, IntPtr pBasePrices /*uint64 **/, uint unArrayLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetItemsWithPrices( (IntPtr) pArrayItemDefs, (IntPtr) pCurrentPrices, (IntPtr) pBasePrices, unArrayLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetNumItemsWithPrices()
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetNumItemsWithPrices();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// with: Detect_StringFetch False
|
|
||||||
public bool GetResultItemProperty( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/, uint unItemIndex /*uint32*/, string pchPropertyName /*const char **/, out string pchValueBuffer /*char **/ )
|
|
||||||
{
|
|
||||||
bool bSuccess = default( bool );
|
|
||||||
pchValueBuffer = string.Empty;
|
|
||||||
System.Text.StringBuilder pchValueBuffer_sb = Helpers.TakeStringBuilder();
|
|
||||||
uint punValueBufferSizeOut = 4096;
|
|
||||||
bSuccess = platform.ISteamInventory_GetResultItemProperty( resultHandle.Value, unItemIndex, pchPropertyName, pchValueBuffer_sb, out punValueBufferSizeOut );
|
|
||||||
if ( !bSuccess ) return bSuccess;
|
|
||||||
pchValueBuffer = pchValueBuffer_sb.ToString();
|
|
||||||
return bSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// using: Detect_MultiSizeArrayReturn
|
|
||||||
public SteamItemDetails_t[] GetResultItems( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/ )
|
|
||||||
{
|
|
||||||
uint punOutItemsArraySize = 0;
|
|
||||||
|
|
||||||
bool success = false;
|
|
||||||
success = platform.ISteamInventory_GetResultItems( resultHandle.Value, IntPtr.Zero, out punOutItemsArraySize );
|
|
||||||
if ( !success || punOutItemsArraySize == 0) return null;
|
|
||||||
|
|
||||||
var pOutItemsArray = new SteamItemDetails_t[punOutItemsArraySize];
|
|
||||||
fixed ( void* pOutItemsArray_ptr = pOutItemsArray )
|
|
||||||
{
|
|
||||||
success = platform.ISteamInventory_GetResultItems( resultHandle.Value, (IntPtr) pOutItemsArray_ptr, out punOutItemsArraySize );
|
|
||||||
if ( !success ) return null;
|
|
||||||
return pOutItemsArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Result
|
|
||||||
public Result GetResultStatus( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetResultStatus( resultHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// uint
|
|
||||||
public uint GetResultTimestamp( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GetResultTimestamp( resultHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GrantPromoItems( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_GrantPromoItems( ref pResultHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool LoadItemDefinitions()
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_LoadItemDefinitions();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RemoveProperty( SteamInventoryUpdateHandle_t handle /*SteamInventoryUpdateHandle_t*/, SteamItemInstanceID_t nItemID /*SteamItemInstanceID_t*/, string pchPropertyName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_RemoveProperty( handle.Value, nItemID.Value, pchPropertyName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<SteamInventoryEligiblePromoItemDefIDs_t> RequestEligiblePromoItemDefinitionsIDs( CSteamID steamID /*class CSteamID*/, Action<SteamInventoryEligiblePromoItemDefIDs_t, bool> CallbackFunction = null /*Action<SteamInventoryEligiblePromoItemDefIDs_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamInventory_RequestEligiblePromoItemDefinitionsIDs( steamID.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<SteamInventoryEligiblePromoItemDefIDs_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<SteamInventoryRequestPricesResult_t> RequestPrices( Action<SteamInventoryRequestPricesResult_t, bool> CallbackFunction = null /*Action<SteamInventoryRequestPricesResult_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamInventory_RequestPrices();
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<SteamInventoryRequestPricesResult_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SendItemDropHeartbeat()
|
|
||||||
{
|
|
||||||
platform.ISteamInventory_SendItemDropHeartbeat();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SerializeResult( SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/, IntPtr pOutBuffer /*void **/, out uint punOutBufferSize /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_SerializeResult( resultHandle.Value, (IntPtr) pOutBuffer, out punOutBufferSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetProperty( SteamInventoryUpdateHandle_t handle /*SteamInventoryUpdateHandle_t*/, SteamItemInstanceID_t nItemID /*SteamItemInstanceID_t*/, string pchPropertyName /*const char **/, string pchPropertyValue /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_SetProperty( handle.Value, nItemID.Value, pchPropertyName, pchPropertyValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetProperty0( SteamInventoryUpdateHandle_t handle /*SteamInventoryUpdateHandle_t*/, SteamItemInstanceID_t nItemID /*SteamItemInstanceID_t*/, string pchPropertyName /*const char **/, bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_SetProperty0( handle.Value, nItemID.Value, pchPropertyName, bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetProperty1( SteamInventoryUpdateHandle_t handle /*SteamInventoryUpdateHandle_t*/, SteamItemInstanceID_t nItemID /*SteamItemInstanceID_t*/, string pchPropertyName /*const char **/, long nValue /*int64*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_SetProperty0( handle.Value, nItemID.Value, pchPropertyName, nValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetProperty2( SteamInventoryUpdateHandle_t handle /*SteamInventoryUpdateHandle_t*/, SteamItemInstanceID_t nItemID /*SteamItemInstanceID_t*/, string pchPropertyName /*const char **/, float flValue /*float*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_SetProperty0( handle.Value, nItemID.Value, pchPropertyName, flValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<SteamInventoryStartPurchaseResult_t> StartPurchase( SteamItemDef_t[] pArrayItemDefs /*const SteamItemDef_t **/, uint[] punArrayQuantity /*const uint32 **/, uint unArrayLength /*uint32*/, Action<SteamInventoryStartPurchaseResult_t, bool> CallbackFunction = null /*Action<SteamInventoryStartPurchaseResult_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamInventory_StartPurchase( pArrayItemDefs.Select( x => x.Value ).ToArray(), punArrayQuantity, unArrayLength );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<SteamInventoryStartPurchaseResult_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamInventoryUpdateHandle_t
|
|
||||||
public SteamInventoryUpdateHandle_t StartUpdateProperties()
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_StartUpdateProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle /*SteamInventoryUpdateHandle_t*/, ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_SubmitUpdateProperties( handle.Value, ref pResultHandle.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool TradeItems( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, CSteamID steamIDTradePartner /*class CSteamID*/, SteamItemInstanceID_t[] pArrayGive /*const SteamItemInstanceID_t **/, uint[] pArrayGiveQuantity /*const uint32 **/, uint nArrayGiveLength /*uint32*/, SteamItemInstanceID_t[] pArrayGet /*const SteamItemInstanceID_t **/, uint[] pArrayGetQuantity /*const uint32 **/, uint nArrayGetLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_TradeItems( ref pResultHandle.Value, steamIDTradePartner.Value, pArrayGive.Select( x => x.Value ).ToArray(), pArrayGiveQuantity, nArrayGiveLength, pArrayGet.Select( x => x.Value ).ToArray(), pArrayGetQuantity, nArrayGetLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool TransferItemQuantity( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemInstanceID_t itemIdSource /*SteamItemInstanceID_t*/, uint unQuantity /*uint32*/, SteamItemInstanceID_t itemIdDest /*SteamItemInstanceID_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_TransferItemQuantity( ref pResultHandle.Value, itemIdSource.Value, unQuantity, itemIdDest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool TriggerItemDrop( ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t dropListDefinition /*SteamItemDef_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamInventory_TriggerItemDrop( ref pResultHandle.Value, dropListDefinition.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,311 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamMatchmaking : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamMatchmaking( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int AddFavoriteGame( AppId_t nAppID /*AppId_t*/, uint nIP /*uint32*/, ushort nConnPort /*uint16*/, ushort nQueryPort /*uint16*/, uint unFlags /*uint32*/, uint rTime32LastPlayedOnServer /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_AddFavoriteGame( nAppID.Value, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListCompatibleMembersFilter( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListDistanceFilter( LobbyDistanceFilter eLobbyDistanceFilter /*ELobbyDistanceFilter*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListDistanceFilter( eLobbyDistanceFilter );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListFilterSlotsAvailable( int nSlotsAvailable /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListFilterSlotsAvailable( nSlotsAvailable );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListNearValueFilter( string pchKeyToMatch /*const char **/, int nValueToBeCloseTo /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListNearValueFilter( pchKeyToMatch, nValueToBeCloseTo );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListNumericalFilter( string pchKeyToMatch /*const char **/, int nValueToMatch /*int*/, LobbyComparison eComparisonType /*ELobbyComparison*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListNumericalFilter( pchKeyToMatch, nValueToMatch, eComparisonType );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListResultCountFilter( int cMaxResults /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListResultCountFilter( cMaxResults );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void AddRequestLobbyListStringFilter( string pchKeyToMatch /*const char **/, string pchValueToMatch /*const char **/, LobbyComparison eComparisonType /*ELobbyComparison*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_AddRequestLobbyListStringFilter( pchKeyToMatch, pchValueToMatch, eComparisonType );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<LobbyCreated_t> CreateLobby( LobbyType eLobbyType /*ELobbyType*/, int cMaxMembers /*int*/, Action<LobbyCreated_t, bool> CallbackFunction = null /*Action<LobbyCreated_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamMatchmaking_CreateLobby( eLobbyType, cMaxMembers );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<LobbyCreated_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool DeleteLobbyData( CSteamID steamIDLobby /*class CSteamID*/, string pchKey /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_DeleteLobbyData( steamIDLobby.Value, pchKey );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetFavoriteGame( int iGame /*int*/, ref AppId_t pnAppID /*AppId_t **/, out uint pnIP /*uint32 **/, out ushort pnConnPort /*uint16 **/, out ushort pnQueryPort /*uint16 **/, out uint punFlags /*uint32 **/, out uint pRTime32LastPlayedOnServer /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetFavoriteGame( iGame, ref pnAppID.Value, out pnIP, out pnConnPort, out pnQueryPort, out punFlags, out pRTime32LastPlayedOnServer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetFavoriteGameCount()
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetFavoriteGameCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetLobbyByIndex( int iLobby /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyByIndex( iLobby );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetLobbyChatEntry( CSteamID steamIDLobby /*class CSteamID*/, int iChatID /*int*/, out CSteamID pSteamIDUser /*class CSteamID **/, IntPtr pvData /*void **/, int cubData /*int*/, out ChatEntryType peChatEntryType /*EChatEntryType **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyChatEntry( steamIDLobby.Value, iChatID, out pSteamIDUser.Value, (IntPtr) pvData, cubData, out peChatEntryType );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetLobbyData( CSteamID steamIDLobby /*class CSteamID*/, string pchKey /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamMatchmaking_GetLobbyData( steamIDLobby.Value, pchKey );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
// with: Detect_StringFetch False
|
|
||||||
// with: Detect_StringFetch False
|
|
||||||
public bool GetLobbyDataByIndex( CSteamID steamIDLobby /*class CSteamID*/, int iLobbyData /*int*/, out string pchKey /*char **/, out string pchValue /*char **/ )
|
|
||||||
{
|
|
||||||
bool bSuccess = default( bool );
|
|
||||||
pchKey = string.Empty;
|
|
||||||
System.Text.StringBuilder pchKey_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cchKeyBufferSize = 4096;
|
|
||||||
pchValue = string.Empty;
|
|
||||||
System.Text.StringBuilder pchValue_sb = Helpers.TakeStringBuilder();
|
|
||||||
int cchValueBufferSize = 4096;
|
|
||||||
bSuccess = platform.ISteamMatchmaking_GetLobbyDataByIndex( steamIDLobby.Value, iLobbyData, pchKey_sb, cchKeyBufferSize, pchValue_sb, cchValueBufferSize );
|
|
||||||
if ( !bSuccess ) return bSuccess;
|
|
||||||
pchValue = pchValue_sb.ToString();
|
|
||||||
if ( !bSuccess ) return bSuccess;
|
|
||||||
pchKey = pchKey_sb.ToString();
|
|
||||||
return bSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetLobbyDataCount( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyDataCount( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetLobbyGameServer( CSteamID steamIDLobby /*class CSteamID*/, out uint punGameServerIP /*uint32 **/, out ushort punGameServerPort /*uint16 **/, out CSteamID psteamIDGameServer /*class CSteamID **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyGameServer( steamIDLobby.Value, out punGameServerIP, out punGameServerPort, out psteamIDGameServer.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetLobbyMemberByIndex( CSteamID steamIDLobby /*class CSteamID*/, int iMember /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyMemberByIndex( steamIDLobby.Value, iMember );
|
|
||||||
}
|
|
||||||
|
|
||||||
// string
|
|
||||||
// with: Detect_StringReturn
|
|
||||||
public string GetLobbyMemberData( CSteamID steamIDLobby /*class CSteamID*/, CSteamID steamIDUser /*class CSteamID*/, string pchKey /*const char **/ )
|
|
||||||
{
|
|
||||||
IntPtr string_pointer;
|
|
||||||
string_pointer = platform.ISteamMatchmaking_GetLobbyMemberData( steamIDLobby.Value, steamIDUser.Value, pchKey );
|
|
||||||
return Marshal.PtrToStringAnsi( string_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetLobbyMemberLimit( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyMemberLimit( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ulong
|
|
||||||
public ulong GetLobbyOwner( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetLobbyOwner( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetNumLobbyMembers( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_GetNumLobbyMembers( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool InviteUserToLobby( CSteamID steamIDLobby /*class CSteamID*/, CSteamID steamIDInvitee /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_InviteUserToLobby( steamIDLobby.Value, steamIDInvitee.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<LobbyEnter_t> JoinLobby( CSteamID steamIDLobby /*class CSteamID*/, Action<LobbyEnter_t, bool> CallbackFunction = null /*Action<LobbyEnter_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamMatchmaking_JoinLobby( steamIDLobby.Value );
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<LobbyEnter_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void LeaveLobby( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_LeaveLobby( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RemoveFavoriteGame( AppId_t nAppID /*AppId_t*/, uint nIP /*uint32*/, ushort nConnPort /*uint16*/, ushort nQueryPort /*uint16*/, uint unFlags /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_RemoveFavoriteGame( nAppID.Value, nIP, nConnPort, nQueryPort, unFlags );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RequestLobbyData( CSteamID steamIDLobby /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_RequestLobbyData( steamIDLobby.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SteamAPICall_t
|
|
||||||
public CallResult<LobbyMatchList_t> RequestLobbyList( Action<LobbyMatchList_t, bool> CallbackFunction = null /*Action<LobbyMatchList_t, bool>*/ )
|
|
||||||
{
|
|
||||||
SteamAPICall_t callback = 0;
|
|
||||||
callback = platform.ISteamMatchmaking_RequestLobbyList();
|
|
||||||
|
|
||||||
if ( CallbackFunction == null ) return null;
|
|
||||||
if ( callback == 0 ) return null;
|
|
||||||
|
|
||||||
return new CallResult<LobbyMatchList_t>( steamworks, callback, CallbackFunction );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendLobbyChatMsg( CSteamID steamIDLobby /*class CSteamID*/, IntPtr pvMsgBody /*const void **/, int cubMsgBody /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SendLobbyChatMsg( steamIDLobby.Value, (IntPtr) pvMsgBody, cubMsgBody );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetLinkedLobby( CSteamID steamIDLobby /*class CSteamID*/, CSteamID steamIDLobbyDependent /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SetLinkedLobby( steamIDLobby.Value, steamIDLobbyDependent.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetLobbyData( CSteamID steamIDLobby /*class CSteamID*/, string pchKey /*const char **/, string pchValue /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SetLobbyData( steamIDLobby.Value, pchKey, pchValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetLobbyGameServer( CSteamID steamIDLobby /*class CSteamID*/, uint unGameServerIP /*uint32*/, ushort unGameServerPort /*uint16*/, CSteamID steamIDGameServer /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_SetLobbyGameServer( steamIDLobby.Value, unGameServerIP, unGameServerPort, steamIDGameServer.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetLobbyJoinable( CSteamID steamIDLobby /*class CSteamID*/, bool bLobbyJoinable /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SetLobbyJoinable( steamIDLobby.Value, bLobbyJoinable );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetLobbyMemberData( CSteamID steamIDLobby /*class CSteamID*/, string pchKey /*const char **/, string pchValue /*const char **/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmaking_SetLobbyMemberData( steamIDLobby.Value, pchKey, pchValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetLobbyMemberLimit( CSteamID steamIDLobby /*class CSteamID*/, int cMaxMembers /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SetLobbyMemberLimit( steamIDLobby.Value, cMaxMembers );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetLobbyOwner( CSteamID steamIDLobby /*class CSteamID*/, CSteamID steamIDNewOwner /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SetLobbyOwner( steamIDLobby.Value, steamIDNewOwner.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetLobbyType( CSteamID steamIDLobby /*class CSteamID*/, LobbyType eLobbyType /*ELobbyType*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmaking_SetLobbyType( steamIDLobby.Value, eLobbyType );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,156 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamMatchmakingServers : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamMatchmakingServers( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void CancelQuery( HServerListRequest hRequest /*HServerListRequest*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmakingServers_CancelQuery( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void CancelServerQuery( HServerQuery hServerQuery /*HServerQuery*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmakingServers_CancelServerQuery( hServerQuery.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetServerCount( HServerListRequest hRequest /*HServerListRequest*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_GetServerCount( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// gameserveritem_t *
|
|
||||||
// with: Detect_ReturningStruct
|
|
||||||
public gameserveritem_t GetServerDetails( HServerListRequest hRequest /*HServerListRequest*/, int iServer /*int*/ )
|
|
||||||
{
|
|
||||||
IntPtr struct_pointer;
|
|
||||||
struct_pointer = platform.ISteamMatchmakingServers_GetServerDetails( hRequest.Value, iServer );
|
|
||||||
if ( struct_pointer == IntPtr.Zero ) return default(gameserveritem_t);
|
|
||||||
return new gameserveritem_t().Fill( struct_pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsRefreshing( HServerListRequest hRequest /*HServerListRequest*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_IsRefreshing( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerQuery
|
|
||||||
public HServerQuery PingServer( uint unIP /*uint32*/, ushort usPort /*uint16*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingPingResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_PingServer( unIP, usPort, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerQuery
|
|
||||||
public HServerQuery PlayerDetails( uint unIP /*uint32*/, ushort usPort /*uint16*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingPlayersResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_PlayerDetails( unIP, usPort, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RefreshQuery( HServerListRequest hRequest /*HServerListRequest*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmakingServers_RefreshQuery( hRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void RefreshServer( HServerListRequest hRequest /*HServerListRequest*/, int iServer /*int*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmakingServers_RefreshServer( hRequest.Value, iServer );
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void ReleaseRequest( HServerListRequest hServerListRequest /*HServerListRequest*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMatchmakingServers_ReleaseRequest( hServerListRequest.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerListRequest
|
|
||||||
// with: Detect_MatchmakingFilters
|
|
||||||
public HServerListRequest RequestFavoritesServerList( AppId_t iApp /*AppId_t*/, IntPtr ppchFilters /*struct MatchMakingKeyValuePair_t ***/, uint nFilters /*uint32*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingServerListResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_RequestFavoritesServerList( iApp.Value, (IntPtr) ppchFilters, nFilters, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerListRequest
|
|
||||||
// with: Detect_MatchmakingFilters
|
|
||||||
public HServerListRequest RequestFriendsServerList( AppId_t iApp /*AppId_t*/, IntPtr ppchFilters /*struct MatchMakingKeyValuePair_t ***/, uint nFilters /*uint32*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingServerListResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_RequestFriendsServerList( iApp.Value, (IntPtr) ppchFilters, nFilters, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerListRequest
|
|
||||||
// with: Detect_MatchmakingFilters
|
|
||||||
public HServerListRequest RequestHistoryServerList( AppId_t iApp /*AppId_t*/, IntPtr ppchFilters /*struct MatchMakingKeyValuePair_t ***/, uint nFilters /*uint32*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingServerListResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_RequestHistoryServerList( iApp.Value, (IntPtr) ppchFilters, nFilters, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerListRequest
|
|
||||||
// with: Detect_MatchmakingFilters
|
|
||||||
public HServerListRequest RequestInternetServerList( AppId_t iApp /*AppId_t*/, IntPtr ppchFilters /*struct MatchMakingKeyValuePair_t ***/, uint nFilters /*uint32*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingServerListResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_RequestInternetServerList( iApp.Value, (IntPtr) ppchFilters, nFilters, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerListRequest
|
|
||||||
public HServerListRequest RequestLANServerList( AppId_t iApp /*AppId_t*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingServerListResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_RequestLANServerList( iApp.Value, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerListRequest
|
|
||||||
// with: Detect_MatchmakingFilters
|
|
||||||
public HServerListRequest RequestSpectatorServerList( AppId_t iApp /*AppId_t*/, IntPtr ppchFilters /*struct MatchMakingKeyValuePair_t ***/, uint nFilters /*uint32*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingServerListResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_RequestSpectatorServerList( iApp.Value, (IntPtr) ppchFilters, nFilters, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
// HServerQuery
|
|
||||||
public HServerQuery ServerRules( uint unIP /*uint32*/, ushort usPort /*uint16*/, IntPtr pRequestServersResponse /*class ISteamMatchmakingRulesResponse **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMatchmakingServers_ServerRules( unIP, usPort, (IntPtr) pRequestServersResponse );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamMusic : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamMusic( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsEnabled()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusic_BIsEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsPlaying()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusic_BIsPlaying();
|
|
||||||
}
|
|
||||||
|
|
||||||
// AudioPlayback_Status
|
|
||||||
public AudioPlayback_Status GetPlaybackStatus()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusic_GetPlaybackStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
// float
|
|
||||||
public float GetVolume()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusic_GetVolume();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void Pause()
|
|
||||||
{
|
|
||||||
platform.ISteamMusic_Pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void Play()
|
|
||||||
{
|
|
||||||
platform.ISteamMusic_Play();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void PlayNext()
|
|
||||||
{
|
|
||||||
platform.ISteamMusic_PlayNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void PlayPrevious()
|
|
||||||
{
|
|
||||||
platform.ISteamMusic_PlayPrevious();
|
|
||||||
}
|
|
||||||
|
|
||||||
// void
|
|
||||||
public void SetVolume( float flVolume /*float*/ )
|
|
||||||
{
|
|
||||||
platform.ISteamMusic_SetVolume( flVolume );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,237 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamMusicRemote : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamMusicRemote( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BActivationSuccess( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_BActivationSuccess( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool BIsCurrentMusicRemote()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_BIsCurrentMusicRemote();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CurrentEntryDidChange()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_CurrentEntryDidChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CurrentEntryIsAvailable( bool bAvailable /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_CurrentEntryIsAvailable( bAvailable );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CurrentEntryWillChange()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_CurrentEntryWillChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool DeregisterSteamMusicRemote()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_DeregisterSteamMusicRemote();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool EnableLooped( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_EnableLooped( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool EnablePlaylists( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_EnablePlaylists( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool EnablePlayNext( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_EnablePlayNext( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool EnablePlayPrevious( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_EnablePlayPrevious( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool EnableQueue( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_EnableQueue( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool EnableShuffled( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_EnableShuffled( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool PlaylistDidChange()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_PlaylistDidChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool PlaylistWillChange()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_PlaylistWillChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool QueueDidChange()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_QueueDidChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool QueueWillChange()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_QueueWillChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RegisterSteamMusicRemote( string pchName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_RegisterSteamMusicRemote( pchName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ResetPlaylistEntries()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_ResetPlaylistEntries();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ResetQueueEntries()
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_ResetQueueEntries();
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetCurrentPlaylistEntry( int nID /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_SetCurrentPlaylistEntry( nID );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetCurrentQueueEntry( int nID /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_SetCurrentQueueEntry( nID );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetDisplayName( string pchDisplayName /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_SetDisplayName( pchDisplayName );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetPlaylistEntry( int nID /*int*/, int nPosition /*int*/, string pchEntryText /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_SetPlaylistEntry( nID, nPosition, pchEntryText );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetPNGIcon_64x64( IntPtr pvBuffer /*void **/, uint cbBufferLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_SetPNGIcon_64x64( (IntPtr) pvBuffer, cbBufferLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SetQueueEntry( int nID /*int*/, int nPosition /*int*/, string pchEntryText /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_SetQueueEntry( nID, nPosition, pchEntryText );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateCurrentEntryCoverArt( IntPtr pvBuffer /*void **/, uint cbBufferLength /*uint32*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdateCurrentEntryCoverArt( (IntPtr) pvBuffer, cbBufferLength );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateCurrentEntryElapsedSeconds( int nValue /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdateCurrentEntryElapsedSeconds( nValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateCurrentEntryText( string pchText /*const char **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdateCurrentEntryText( pchText );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateLooped( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdateLooped( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdatePlaybackStatus( AudioPlayback_Status nStatus /*AudioPlayback_Status*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdatePlaybackStatus( nStatus );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateShuffled( bool bValue /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdateShuffled( bValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool UpdateVolume( float flValue /*float*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamMusicRemote_UpdateVolume( flValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,177 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace SteamNative
|
|
||||||
{
|
|
||||||
internal unsafe class SteamNetworking : IDisposable
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Holds a platform specific implentation
|
|
||||||
//
|
|
||||||
internal Platform.Interface platform;
|
|
||||||
internal Facepunch.Steamworks.BaseSteamworks steamworks;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor decides which implementation to use based on current platform
|
|
||||||
//
|
|
||||||
internal SteamNetworking( Facepunch.Steamworks.BaseSteamworks steamworks, IntPtr pointer )
|
|
||||||
{
|
|
||||||
this.steamworks = steamworks;
|
|
||||||
|
|
||||||
if ( Platform.IsWindows ) platform = new Platform.Windows( pointer );
|
|
||||||
else if ( Platform.IsLinux ) platform = new Platform.Linux( pointer );
|
|
||||||
else if ( Platform.IsOsx ) platform = new Platform.Mac( pointer );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Class is invalid if we don't have a valid implementation
|
|
||||||
//
|
|
||||||
public bool IsValid => platform != null && platform.IsValid;
|
|
||||||
|
|
||||||
//
|
|
||||||
// When shutting down clear all the internals to avoid accidental use
|
|
||||||
//
|
|
||||||
public virtual void Dispose()
|
|
||||||
{
|
|
||||||
if ( platform != null )
|
|
||||||
{
|
|
||||||
platform.Dispose();
|
|
||||||
platform = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool AcceptP2PSessionWithUser( CSteamID steamIDRemote /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_AcceptP2PSessionWithUser( steamIDRemote.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool AllowP2PPacketRelay( bool bAllow /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_AllowP2PPacketRelay( bAllow );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CloseP2PChannelWithUser( CSteamID steamIDRemote /*class CSteamID*/, int nChannel /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_CloseP2PChannelWithUser( steamIDRemote.Value, nChannel );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool CloseP2PSessionWithUser( CSteamID steamIDRemote /*class CSteamID*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_CloseP2PSessionWithUser( steamIDRemote.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SNetSocket_t
|
|
||||||
public SNetSocket_t CreateConnectionSocket( uint nIP /*uint32*/, ushort nPort /*uint16*/, int nTimeoutSec /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_CreateConnectionSocket( nIP, nPort, nTimeoutSec );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SNetListenSocket_t
|
|
||||||
public SNetListenSocket_t CreateListenSocket( int nVirtualP2PPort /*int*/, uint nIP /*uint32*/, ushort nPort /*uint16*/, bool bAllowUseOfPacketRelay /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_CreateListenSocket( nVirtualP2PPort, nIP, nPort, bAllowUseOfPacketRelay );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SNetSocket_t
|
|
||||||
public SNetSocket_t CreateP2PConnectionSocket( CSteamID steamIDTarget /*class CSteamID*/, int nVirtualPort /*int*/, int nTimeoutSec /*int*/, bool bAllowUseOfPacketRelay /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_CreateP2PConnectionSocket( steamIDTarget.Value, nVirtualPort, nTimeoutSec, bAllowUseOfPacketRelay );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool DestroyListenSocket( SNetListenSocket_t hSocket /*SNetListenSocket_t*/, bool bNotifyRemoteEnd /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_DestroyListenSocket( hSocket.Value, bNotifyRemoteEnd );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool DestroySocket( SNetSocket_t hSocket /*SNetSocket_t*/, bool bNotifyRemoteEnd /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_DestroySocket( hSocket.Value, bNotifyRemoteEnd );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetListenSocketInfo( SNetListenSocket_t hListenSocket /*SNetListenSocket_t*/, out uint pnIP /*uint32 **/, out ushort pnPort /*uint16 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_GetListenSocketInfo( hListenSocket.Value, out pnIP, out pnPort );
|
|
||||||
}
|
|
||||||
|
|
||||||
// int
|
|
||||||
public int GetMaxPacketSize( SNetSocket_t hSocket /*SNetSocket_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_GetMaxPacketSize( hSocket.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetP2PSessionState( CSteamID steamIDRemote /*class CSteamID*/, ref P2PSessionState_t pConnectionState /*struct P2PSessionState_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_GetP2PSessionState( steamIDRemote.Value, ref pConnectionState );
|
|
||||||
}
|
|
||||||
|
|
||||||
// SNetSocketConnectionType
|
|
||||||
public SNetSocketConnectionType GetSocketConnectionType( SNetSocket_t hSocket /*SNetSocket_t*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_GetSocketConnectionType( hSocket.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool GetSocketInfo( SNetSocket_t hSocket /*SNetSocket_t*/, out CSteamID pSteamIDRemote /*class CSteamID **/, IntPtr peSocketStatus /*int **/, out uint punIPRemote /*uint32 **/, out ushort punPortRemote /*uint16 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_GetSocketInfo( hSocket.Value, out pSteamIDRemote.Value, (IntPtr) peSocketStatus, out punIPRemote, out punPortRemote );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsDataAvailable( SNetListenSocket_t hListenSocket /*SNetListenSocket_t*/, out uint pcubMsgSize /*uint32 **/, ref SNetSocket_t phSocket /*SNetSocket_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_IsDataAvailable( hListenSocket.Value, out pcubMsgSize, ref phSocket.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsDataAvailableOnSocket( SNetSocket_t hSocket /*SNetSocket_t*/, out uint pcubMsgSize /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_IsDataAvailableOnSocket( hSocket.Value, out pcubMsgSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool IsP2PPacketAvailable( out uint pcubMsgSize /*uint32 **/, int nChannel /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_IsP2PPacketAvailable( out pcubMsgSize, nChannel );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool ReadP2PPacket( IntPtr pubDest /*void **/, uint cubDest /*uint32*/, out uint pcubMsgSize /*uint32 **/, out CSteamID psteamIDRemote /*class CSteamID **/, int nChannel /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_ReadP2PPacket( (IntPtr) pubDest, cubDest, out pcubMsgSize, out psteamIDRemote.Value, nChannel );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RetrieveData( SNetListenSocket_t hListenSocket /*SNetListenSocket_t*/, IntPtr pubDest /*void **/, uint cubDest /*uint32*/, out uint pcubMsgSize /*uint32 **/, ref SNetSocket_t phSocket /*SNetSocket_t **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_RetrieveData( hListenSocket.Value, (IntPtr) pubDest, cubDest, out pcubMsgSize, ref phSocket.Value );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool RetrieveDataFromSocket( SNetSocket_t hSocket /*SNetSocket_t*/, IntPtr pubDest /*void **/, uint cubDest /*uint32*/, out uint pcubMsgSize /*uint32 **/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_RetrieveDataFromSocket( hSocket.Value, (IntPtr) pubDest, cubDest, out pcubMsgSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendDataOnSocket( SNetSocket_t hSocket /*SNetSocket_t*/, IntPtr pubData /*void **/, uint cubData /*uint32*/, bool bReliable /*bool*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_SendDataOnSocket( hSocket.Value, (IntPtr) pubData, cubData, bReliable );
|
|
||||||
}
|
|
||||||
|
|
||||||
// bool
|
|
||||||
public bool SendP2PPacket( CSteamID steamIDRemote /*class CSteamID*/, IntPtr pubData /*const void **/, uint cubData /*uint32*/, P2PSend eP2PSendType /*EP2PSend*/, int nChannel /*int*/ )
|
|
||||||
{
|
|
||||||
return platform.ISteamNetworking_SendP2PPacket( steamIDRemote.Value, (IntPtr) pubData, cubData, eP2PSendType, nChannel );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user