sab*_*nke 22 c# android unity-game-engine in-app-purchase soomla
我正在创建一个实现Soomla Unity IAP插件的应用程序.为了让IAP工作,我已经达到了可以在编辑器中进行购买的程度.(不是真正的购买,它只是更新用户可以在游戏中购买/消费的虚拟货币).
当我在Android设备上启动它时,我收到此错误:需要身份验证.您需要登录自己的Google帐户.
现在我已经阅读了多篇不同的文章,其中人们已经遇到过这个问题,似乎没有什么能帮助我.
这是我到目前为止所尝试的列表:
1)确保应用程序发布到alpha或beta进行测试.(现在在alpha中)
2)确保价格与游戏和开发者控制台相匹配.
3)使用以未使用开发人员电子邮件的用户身份登录的设备.
4)确保测试设备上的电子邮件在开发人员控制台中列为测试人员.
5)确保Android Manifest中列出了必要的权限.
6)确认商家帐户已正确设置并验证.
7)确保构建为发布而不是开发(不确定这是否重要,但我尝试了两种方式).
8)从项目中完全删除了所有Soomla插件,然后将其添加回来,同时非常仔细地遵循教程,以确保没有错过任何小的.仍然没有骰子.
我将核心和商店组件添加到他们必要的场景中.如果您对解决此问题应采取的措施有任何其他想法,请告诉我.同时,这是我用于设置Soomla的StoreAssets.cs代码:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Soomla.Store;
public class StoreAssets : IStoreAssets
{
public static bool purchased = false;
public int GetVersion()
{
return 0;
}
public void onItemPurchased(PurchasableVirtualItem pvi, string payload)
{
purchased = true;
}
public VirtualCurrency[] GetCurrencies()
{
return new VirtualCurrency[]{TOKEN_CURRENCY};
}
public VirtualGood[] GetGoods()
{
return new VirtualGood[] {BACKUP_FORCEFIELD, IMMUNITY, EMP, MULTIPLIER};
}
public VirtualCurrencyPack[] GetCurrencyPacks()
{
return new VirtualCurrencyPack[] {FIVE_TOKEN_PACK, TEN_TOKEN_PACK, FIFTY_TOKEN_PACK};
}
public VirtualCategory[] GetCategories()
{
return new VirtualCategory[]{};
}
/** Virtual Currencies **/
public static VirtualCurrency TOKEN_CURRENCY = new VirtualCurrency
(
"Token", // Name
"Token currency", // Description
"token_currency_ID" // Item ID
);
/** Virtual Currency Packs **/
public static VirtualCurrencyPack FIVE_TOKEN_PACK = new VirtualCurrencyPack
(
"5 Tokens", // Name
"5 token currency units", // Description
"5_tokens_id", // Item ID
5, // Number of currencies in the pack
"token_currency_ID", // ID of the currency associated with this pack
new PurchaseWithMarket
( // Purchase type (with real money $)
"tokens_5_PROD_ID", // Product ID
0.99 // Price (in real money $)
)
);
public static VirtualCurrencyPack TEN_TOKEN_PACK = new VirtualCurrencyPack
(
"10 Tokens", // Name
"10 token currency units", // Description
"10_tokens_id", // Item ID
10, // Number of currencies in the pack
"token_currency_ID", // ID of the currency associated with this pack
new PurchaseWithMarket
( // Purchase type (with real money $)
"tokens_10_PROD_ID", // Product ID
1.99 // Price (in real money $)
)
);
public static VirtualCurrencyPack FIFTY_TOKEN_PACK = new VirtualCurrencyPack
(
"50 Tokens", // Name
"50 token currency units", // Description
"50_tokens_id", // Item ID
50, // Number of currencies in the pack
"token_currency_ID", // ID of the currency associated with this pack
new PurchaseWithMarket
( // Purchase type (with real money $)
"tokens_50_PROD_ID", // Product ID
4.99 // Price (in real money $)
)
);
/** Virtual Goods **/
public static VirtualGood BACKUP_FORCEFIELD = new SingleUseVG
(
"BackupForcefield", // Name
"Secondary forcefield for extra protection.", // Description
"bff_ID", // Item ID
new PurchaseWithVirtualItem
( // Purchase type (with virtual currency)
"token_currency_ID", // ID of the item used to pay with
1 // Price (amount of coins)
)
);
public static VirtualGood EMP = new SingleUseVG
(
"Emp", // Name
"Clear the surrounding space of all lasers.", // Description
"emp_ID", // Item ID
new PurchaseWithVirtualItem
( // Purchase type (with virtual currency)
"token_currency_ID", // ID of the item used to pay with
5 // Price (amount of coins)
)
);
public static VirtualGood IMMUNITY = new SingleUseVG
(
"Immunity", // Name
"Immune to damage.", // Description
"immunity_ID", // Item ID
new PurchaseWithVirtualItem
( // Purchase type (with virtual currency)
"token_currency_ID", // ID of the item used to pay with
10 // Price (amount of coins)
)
);
public static VirtualGood MULTIPLIER = new SingleUseVG
(
"Multiplier", // Name
"Double your score per deflected laser.", // Description
"multiplier_ID", // Item ID
new PurchaseWithVirtualItem
( // Purchase type (with virtual currency)
"token_currency_ID", // ID of the item used to pay with
15 // Price (amount of coins)
)
);
}
Run Code Online (Sandbox Code Playgroud)
为了购买物品,我打电话给:
StoreInventory.BuyItem("the id of my item");
Run Code Online (Sandbox Code Playgroud)
要使用已购买的商品,我打电话:
StoreInventory.TakeItem("the id of my item");
Run Code Online (Sandbox Code Playgroud)
StoreInventory是一个在导入Unity时包含在Soomla中的类.
以下是完成购买和物品消耗的代码:
public class Purchase : MonoBehaviour
{
public Text tokens;
public static bool bffFilled = false,
immFilled = false, empFilled = false,
multFilled = false, init = false;
void Start()
{
if (!init)
{
init = true;
SoomlaStore.Initialize(new StoreAssets());
}
Token.updateTokens (tokens);
}
void Update()
{
if (StoreEvents.balanceChanged)
{
StoreEvents.balanceChanged = false;
Token.updateTokens(tokens);
}
}
public void BuyItem (int item)
{
if (item == 1)
{
StoreInventory.BuyItem (StoreAssets.FIVE_TOKEN_PACK.ItemId);
}
else if (item == 2)
{
StoreInventory.BuyItem (StoreAssets.TEN_TOKEN_PACK.ItemId);
}
else if (item == 3)
{
StoreInventory.BuyItem (StoreAssets.FIFTY_TOKEN_PACK.ItemId);
}
Token.updateTokens(tokens);
}
public void getUpgrade(int upgrade)
{
if (upgrade == 1)
{
bool bffNotBought = PlayerPrefs.GetInt("Bff Available", 0) == 0;
if (StoreAssets.TOKEN_CURRENCY.GetBalance() >= 1 && bffNotBought)
{
PlayerPrefs.SetInt("Bff Available", 1);
PlayerPrefs.Save();
bffFilled = true;
StoreInventory.TakeItem(StoreAssets.TOKEN_CURRENCY.ItemId, 1);
}
}
else if (upgrade == 2)
{
bool empNotBought = PlayerPrefs.GetInt("Emp Available", 0) == 0;
if (StoreAssets.TOKEN_CURRENCY.GetBalance() >= 5 && empNotBought)
{
PlayerPrefs.SetInt("Emp Available", 1);
PlayerPrefs.Save();
empFilled = true;
StoreInventory.TakeItem(StoreAssets.TOKEN_CURRENCY.ItemId, 5);
}
}
else if (upgrade == 3)
{
bool immNotBought = PlayerPrefs.GetInt("Imm Available", 0) == 0;
if (StoreAssets.TOKEN_CURRENCY.GetBalance() >= 10 && immNotBought)
{
PlayerPrefs.SetInt("Imm Available", 1);
PlayerPrefs.Save();
immFilled = true;
StoreInventory.TakeItem(StoreAssets.TOKEN_CURRENCY.ItemId, 10);
}
}
else if (upgrade == 4)
{
bool multNotBought = PlayerPrefs.GetInt("Mult Available", 0) == 0;
if (StoreAssets.TOKEN_CURRENCY.GetBalance() >= 15 && multNotBought)
{
PlayerPrefs.SetInt("Mult Available", 1);
PlayerPrefs.Save();
multFilled = true;
StoreInventory.TakeItem(StoreAssets.TOKEN_CURRENCY.ItemId, 15);
}
}
Token.updateTokens (tokens);
}
}
Run Code Online (Sandbox Code Playgroud)
15年8月26日
我现在已经创建了一个谷歌小组和谷歌社区来测试这个应用程序.我添加了我的其他Android设备的电子邮件到这两个,我使用提供的链接下载该应用程序.完成所有这些操作仍会导致与以前相同的错误.
15年8月27日
我刚注意到我的商家帐户上的信用卡已过期.如果商家帐户存在问题,我读过的其中一篇文章提到了这样的问题.我已经更新了信息,现在我必须等待他们将存入我的帐户的存款,以确保它正常工作.一旦完成,我将更新是否修复了我当前的问题.
15年8月31日
在Google Play上最终验证我的商家帐户后,我似乎仍然遇到了同样的问题.修复我的商家帐户没有改变任何我无法分辨的内容.
我刚刚更新了我的帖子,以包含我的整个StoreAssets.cs脚本,以及当玩家使用它们时我用来购买和消费物品的内容.我添加了这个,因为我不知道问题还有什么.
15年9月7日
到目前为止仍然没有运气.问题在android中仍然存在.编辑器本身进行测试购买,但是如果没有得到与上面列出的相同的错误,则无法从Android设备进行购买.
15年9月9日
就像快速更新一样,我尝试在没有在构建设置中选择开发构建的情况下构建项目,并将链接发送给我的Google社区中的所有人,以便为其提供帮助.每个人仍然有与我的测试设备相同的错误.
15年9月11日
在尝试了Tony指出的一些事情之后,我注意到当我使用它时没有调用onBillingSupported()函数:StoreEvents.OnBillingSupported + = onBillingSupported; 我还不确定为什么呢.
15年9月12日
在浏览了soomla网站上的教程之后,我已经做了所有的事情,除了在后台启动Iab和欺诈保护,因为它们不是必需的.仍未调用onBillingSupported方法,我仍然在Android设备上获得与以前相同的错误.
15年9月12日
我刚删除了Soomla插件的所有内容并导入了最新版本并再次按照说明操作,我仍然得到同样的错误.
15年9月16日
真的不知道我在这里缺少什么.删除所有Soomla插件然后再次添加它并在多次尝试后仍然得到相同的错误.我按照教程说的那样跟踪了所有内容,并且我拥有上面的所有代码.
我从来没有遇到你描述的问题.我创建了一个私人Google+社区,并将社区添加为测试人员.将我的应用程序转移到Beta版.并邀请人们访问我的私人社区,其中有链接下载应用程序并进行测试.很容易.
第二点,是你上面的代码.您正在获取4种商品和3种货币包,但代码并未反映出这一点.也许你只粘贴了一半的课程.
最后,看看这个帖子是否有用:http://answers.soom.la/t/solved-some-clarification-about-iab-testing/2067/8
顺便说一句,SOOMLA有一个专门的网站answers.soom.la用于SOOMLA相关问题.
| 归档时间: |
|
| 查看次数: |
1735 次 |
| 最近记录: |