mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-04-10 11:30:05 +03:00
Microtransaction callback (requested, but untested)
This commit is contained in:
parent
67fd7fe00a
commit
303da3753d
@ -58,6 +58,7 @@ namespace Facepunch.Steamworks
|
|||||||
public App App { get; private set; }
|
public App App { get; private set; }
|
||||||
public Achievements Achievements { get; private set; }
|
public Achievements Achievements { get; private set; }
|
||||||
public Stats Stats { get; private set; }
|
public Stats Stats { get; private set; }
|
||||||
|
public MicroTransactions MicroTransactions { get; private set; }
|
||||||
|
|
||||||
public Client( uint appId )
|
public Client( uint appId )
|
||||||
{
|
{
|
||||||
@ -87,6 +88,7 @@ namespace Facepunch.Steamworks
|
|||||||
App = new App( this );
|
App = new App( this );
|
||||||
Stats = new Stats( this );
|
Stats = new Stats( this );
|
||||||
Achievements = new Achievements( this );
|
Achievements = new Achievements( this );
|
||||||
|
MicroTransactions = new MicroTransactions( this );
|
||||||
|
|
||||||
Workshop.friends = Friends;
|
Workshop.friends = Friends;
|
||||||
|
|
||||||
@ -105,6 +107,8 @@ namespace Facepunch.Steamworks
|
|||||||
CurrentLanguage = native.apps.GetCurrentGameLanguage();
|
CurrentLanguage = native.apps.GetCurrentGameLanguage();
|
||||||
AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated
|
AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Run update, first call does some initialization
|
// Run update, first call does some initialization
|
||||||
//
|
//
|
||||||
@ -168,6 +172,12 @@ namespace Facepunch.Steamworks
|
|||||||
Achievements = null;
|
Achievements = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( MicroTransactions != null )
|
||||||
|
{
|
||||||
|
MicroTransactions.Dispose();
|
||||||
|
MicroTransactions = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ( Instance == this )
|
if ( Instance == this )
|
||||||
{
|
{
|
||||||
Instance = null;
|
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…
x
Reference in New Issue
Block a user