mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
Microtransaction callback (requested, but untested)
This commit is contained in:
parent
67fd7fe00a
commit
303da3753d
@ -58,6 +58,7 @@ public partial class Client : BaseSteamworks
|
||||
public App App { get; private set; }
|
||||
public Achievements Achievements { get; private set; }
|
||||
public Stats Stats { get; private set; }
|
||||
public MicroTransactions MicroTransactions { get; private set; }
|
||||
|
||||
public Client( uint appId )
|
||||
{
|
||||
@ -87,6 +88,7 @@ public Client( uint appId )
|
||||
App = new App( this );
|
||||
Stats = new Stats( this );
|
||||
Achievements = new Achievements( this );
|
||||
MicroTransactions = new MicroTransactions( this );
|
||||
|
||||
Workshop.friends = Friends;
|
||||
|
||||
@ -105,6 +107,8 @@ public Client( uint appId )
|
||||
CurrentLanguage = native.apps.GetCurrentGameLanguage();
|
||||
AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Run update, first call does some initialization
|
||||
//
|
||||
@ -168,6 +172,12 @@ public override void Dispose()
|
||||
Achievements = null;
|
||||
}
|
||||
|
||||
if ( MicroTransactions != null )
|
||||
{
|
||||
MicroTransactions.Dispose();
|
||||
MicroTransactions = null;
|
||||
}
|
||||
|
||||
if ( Instance == this )
|
||||
{
|
||||
Instance = null;
|
||||
|
44
Facepunch.Steamworks/Client/MicroTransactions.cs
Normal file
44
Facepunch.Steamworks/Client/MicroTransactions.cs
Normal file
@ -0,0 +1,44 @@
|
||||
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;
|
||||
|
||||
SteamNative.MicroTxnAuthorizationResponse_t.RegisterCallback( client, onMicroTxnAuthorizationResponse );
|
||||
}
|
||||
|
||||
private void onMicroTxnAuthorizationResponse( MicroTxnAuthorizationResponse_t arg1, bool arg2 )
|
||||
{
|
||||
if ( OnAuthorizationResponse != null )
|
||||
{
|
||||
OnAuthorizationResponse( arg1.Authorized == 1, (int) arg1.AppID, arg1.OrderID );
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
client = null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user