(965c31410a) Unstable v0.10.4.0
This commit is contained in:
@@ -12,32 +12,25 @@ namespace Steamworks
|
||||
/// <summary>
|
||||
/// Undocumented Parental Settings
|
||||
/// </summary>
|
||||
public static class SteamInventory
|
||||
public class SteamInventory : SteamSharedClass<SteamInventory>
|
||||
{
|
||||
static ISteamInventory _internal;
|
||||
internal static ISteamInventory Internal
|
||||
internal static ISteamInventory Internal => Interface as ISteamInventory;
|
||||
|
||||
internal override void InitializeInterface( bool server )
|
||||
{
|
||||
get
|
||||
SetInterface( server, new ISteamInventory( server ) );
|
||||
|
||||
InstallEvents( server );
|
||||
}
|
||||
|
||||
internal static void InstallEvents( bool server )
|
||||
{
|
||||
if ( !server )
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamInventory();
|
||||
_internal.Init();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
Dispatch.Install<SteamInventoryFullUpdate_t>( x => InventoryUpdated( x ) );
|
||||
}
|
||||
}
|
||||
internal static void Shutdown()
|
||||
{
|
||||
_internal = null;
|
||||
}
|
||||
|
||||
internal static void InstallEvents()
|
||||
{
|
||||
SteamInventoryFullUpdate_t.Install( x => InventoryUpdated( x ) );
|
||||
SteamInventoryDefinitionUpdate_t.Install( x => LoadDefinitions() );
|
||||
SteamInventoryDefinitionUpdate_t.Install( x => LoadDefinitions(), true );
|
||||
Dispatch.Install<SteamInventoryDefinitionUpdate_t>( x => LoadDefinitions(), server );
|
||||
}
|
||||
|
||||
private static void InventoryUpdated( SteamInventoryFullUpdate_t x )
|
||||
@@ -184,7 +177,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static bool GetAllItems()
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
return Internal.GetAllItems( ref sresult );
|
||||
}
|
||||
|
||||
@@ -193,7 +186,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> GetAllItemsAsync()
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
if ( !Internal.GetAllItems( ref sresult ) )
|
||||
return null;
|
||||
@@ -209,7 +202,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> GenerateItemAsync( InventoryDef target, int amount )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
var defs = new InventoryDefId[] { target.Id };
|
||||
var cnts = new uint[] { (uint)amount };
|
||||
@@ -227,7 +220,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> CraftItemAsync( InventoryItem[] list, InventoryDef target )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
var give = new InventoryDefId[] { target.Id };
|
||||
var givec = new uint[] { 1 };
|
||||
@@ -248,7 +241,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> CraftItemAsync( InventoryItem.Amount[] list, InventoryDef target )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
var give = new InventoryDefId[] { target.Id };
|
||||
var givec = new uint[] { 1 };
|
||||
@@ -290,7 +283,7 @@ namespace Steamworks
|
||||
{
|
||||
Marshal.Copy( data, 0, ptr, dataLength );
|
||||
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
if ( !Internal.DeserializeResult( ref sresult, (IntPtr)ptr, (uint)dataLength, false ) )
|
||||
return null;
|
||||
@@ -311,7 +304,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> GrantPromoItemsAsync()
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
if ( !Internal.GrantPromoItems( ref sresult ) )
|
||||
return null;
|
||||
@@ -325,7 +318,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> TriggerItemDropAsync( InventoryDefId id )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
if ( !Internal.TriggerItemDrop( ref sresult, id ) )
|
||||
return null;
|
||||
@@ -339,7 +332,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static async Task<InventoryResult?> AddPromoItemAsync( InventoryDefId id )
|
||||
{
|
||||
var sresult = default( SteamInventoryResult_t );
|
||||
var sresult = Defines.k_SteamInventoryResultInvalid;
|
||||
|
||||
if ( !Internal.AddPromoItem( ref sresult, id ) )
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user