Unity Soomla简单的代码给我错误

时间:2014-07-03 04:49:33

标签: android unity3d in-app-purchase soomla

这是资产类:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Soomla.Store;

public class StoreAssets : Soomla.Store.IStoreAssets {

public int GetVersion() {
    return 0;
}

public VirtualCurrency[] GetCurrencies() {
    return new VirtualCurrency[]{MW_ITEM};
}

public VirtualGood[] GetGoods() {
    return new VirtualGood[] {};
}

public VirtualCurrencyPack[] GetCurrencyPacks() {
    return new VirtualCurrencyPack[] {MW_ITEM1,MW_ITEM2,MW_ITEM3};
}

public VirtualCategory[] GetCategories() {
    return new VirtualCategory[]{};
}

public NonConsumableItem[] GetNonConsumableItems() {
    return new NonConsumableItem[]{};
}

public const string ITEMID = "mw_coin";//**NOT GOOGLE PLAY PRODUCT ID**
public const string FIFTY_COINS = "mw1";//**google play store product id**
public const string ONEFIFTY_COINS = "mw2";//**google play store product id**
public const string THREEHUNDRED_COINS = "mw3";//**google play store product id**

public static VirtualCurrency MW_ITEM = new VirtualCurrency ("Coins", "", ITEMID);
public static VirtualCurrencyPack MW_ITEM1 = new VirtualCurrencyPack("Buy 50 Coins", 
                                                                     "Use 50 coins wisely in your game.",
                                                                     "Coins_50",//**NOT GOOGLE PLAY PRODUCT ID**
                                                                     50,
                                                                     ITEMID,
                                                                     new PurchaseWithMarket(FIFTY_COINS,0.99f)
                                                                     );
public static VirtualCurrencyPack MW_ITEM2 = new VirtualCurrencyPack("Buy 150 Coins", 
                                                                     "Use 150 coins wisely in your game.",
                                                                     "Coins_150",//**NOT GOOGLE PLAY PRODUCT ID**
                                                                     150,
                                                                     ITEMID,
                                                                     new PurchaseWithMarket(ONEFIFTY_COINS,1.99f)
                                                                     );
public static VirtualCurrencyPack MW_ITEM3 = new VirtualCurrencyPack("Buy 300 Coins", 
                                                                     "Use 300 coins wisely in your game.",
                                                                     "Coins_300",//**NOT GOOGLE PLAY PRODUCT ID**
                                                                     300,
                                                                     ITEMID,
                                                                     new PurchaseWithMarket(THREEHUNDRED_COINS,2.99f)
                                                                     );

}

Soomla有很多IDS要分配。我只是混淆了在哪里使用id。

我在调用购买项目MW_ITEM1时遇到错误:

AndroidJavaException:com.soomla.store.exceptions.VirtualItem NotFoundException:使用productId = Coin s_50

搜索时未找到虚拟项目

我已从设备中删除该应用并重新安装,然后也无法正常工作,同样的错误。 我已经从设备和更新的应用版本中删除了应用程序,Soomla GetVersion()值构建并使用adb安装它,然后它也给了我同样的错误。

我正在寻求帮助。感谢

1 个答案:

答案 0 :(得分:1)

我也有这个问题。在我的情况下,问题是这些项目在Google Play中无效。

转到Google Play中的应用内购买设置,选择非活动项目,然后将其更改为有效。