mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
Make Inventory.OnUpdate an event, FormatPrice can be passed LocalPrice without needing to multiply it
This commit is contained in:
parent
e69e25a1f1
commit
96511dcc64
@ -107,7 +107,7 @@ public void InventoryItemList()
|
|||||||
bool CallbackCalled = false;
|
bool CallbackCalled = false;
|
||||||
|
|
||||||
// OnUpdate hsould be called when we receive a list of our items
|
// OnUpdate hsould be called when we receive a list of our items
|
||||||
client.Inventory.OnUpdate = () => { CallbackCalled = true; };
|
client.Inventory.OnUpdate += () => { CallbackCalled = true; };
|
||||||
|
|
||||||
// tell steam to download the items
|
// tell steam to download the items
|
||||||
client.Inventory.Refresh();
|
client.Inventory.Refresh();
|
||||||
|
@ -14,7 +14,7 @@ public partial class Inventory : IDisposable
|
|||||||
/// Called when the local client's items are first retrieved, and when they change.
|
/// Called when the local client's items are first retrieved, and when they change.
|
||||||
/// Obviously not called on the server.
|
/// Obviously not called on the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action OnUpdate;
|
public event Action OnUpdate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of items owned by this user. You should call Refresh() before trying to access this,
|
/// A list of items owned by this user. You should call Refresh() before trying to access this,
|
||||||
@ -466,6 +466,7 @@ public void UpdatePrices()
|
|||||||
Definitions[i].UpdatePrice();
|
Definitions[i].UpdatePrice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OnUpdate?.Invoke();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,14 @@ public static uint FromDateTime( DateTime dt )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatPrice(string currency, ulong price)
|
internal static string FormatPrice(string currency, ulong price)
|
||||||
{
|
{
|
||||||
var decimaled = (price / 100.0).ToString("0.00");
|
return FormatPrice(currency, price / 100.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatPrice(string currency, double price)
|
||||||
|
{
|
||||||
|
var decimaled = price.ToString("0.00");
|
||||||
|
|
||||||
switch (currency)
|
switch (currency)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user