快速参考
View a quick reference guide for all available Economy SDK methods.
阅读时间2 分钟最后更新于 7 个月前
以下是 SDK 中可用方法的快速参考。有关更详细的信息,请参阅各命名空间的文档。
配置
通过 命名空间中的方法,可以从全局经济配置中检索物品。
Configuration有关这些方法的更多详细信息,请参阅 SDK 配置。
可用的方法有:
public async Task<List<ConfigurationItemDefinition>> SyncConfigurationAsync();public List<CurrencyDefinition> GetCurrencies()public CurrencyDefinition GetCurrency(string id)public List<InventoryItemDefinition> GetInventoryItems()public InventoryItemDefinition GetInventoryItem(string id)public List<VirtualPurchaseDefinition> GetVirtualPurchases()public VirtualPurchaseDefinition GetVirtualPurchase(string id)public List<RealMoneyPurchaseDefinition> GetRealMoneyPurchases()public RealMoneyPurchaseDefinition GetRealMoneyPurchase(string id)
玩家余额
使用 命名空间中的方法,可以检索和更新用户的货币余额。这些方法将从 Authentication SDK 返回当前登录玩家的余额。
PlayerBalances有关这些方法的更多详细信息,请参阅玩家余额。
可用的方法有:
public async Task<GetBalanceResponse> GetBalancesAsync(GetBalancesOptions options = null)public async Task<PlayerBalanceDefinition> SetBalanceAsync(string currencyId, int balance, SetBalanceOptions options = null)public async Task<PlayerBalanceDefinition> IncrementBalanceAsync(string currencyId, int amount, IncrementBalanceOptions options = null)public async Task<PlayerBalanceDefinition> DecrementBalanceAsync(string currencyId, int amount, DecrementBalanceOptions options = null)
玩家背包
使用 命名空间中的方法,可以检索和更新玩家的背包实例。这些方法将从 Authentication SDK 返回当前登录玩家的背包数据。
PlayerInventory有关这些方法的更多详细信息,请参阅玩家背包。
可用的方法有:
public async Task<GetInventoryResult> GetInventoryAsync(GetInventoryOptions options = null)public async Task<PlayerInventoryInstance> AddInventoryItemAsync(string inventoryItemId, AddInventoryItemOptions options = null)public async Task<PlayerInventoryInstance> UpdateInventoryInstanceAsync(string playersInventoryItemId, Dictionary<string, object> instanceData, UpdatePlayersInventoryItemOptions options = null)public async Task DeleteInventoryInstanceAsync(string playersInventoryItemId, DeletePlayersInventoryItemOptions options = null)
购买
使用 命名空间中的方法,您可以进行虚拟购买并为玩家兑换真实货币购买的商品。这些方法为当前使用 Authentication SDK 登录的玩家进行购买。
Purchases有关这些方法的更多详情,请参阅购买。
可用的方法有:
public async Task<MakeVirtualPurchaseResult> MakeVirtualPurchaseAsync(string virtualPurchaseId, MakeVirtualPurchaseOptions options = null)public async Task<RedeemAppleAppStorePurchaseResult> RedeemAppleAppStorePurchaseAsync(RedeemAppleAppStorePurchaseArgs args)public async Task<RedeemGooglePlayPurchaseResult> RedeemGooglePlayPurchaseAsync(RedeemGooglePlayStorePurchaseArgs args)