【问题标题】:How to use Prime31 Google In App Billing Plugin如何使用 Prime31 Google In App Billing 插件
【发布时间】:2014-09-21 09:05:53
【问题描述】:

我刚刚购买了 Prime31 的“Google In App Billing Plugin for unity3d”。我不明白如何在我要开发的游戏中使用它。

你能给我看一个代码示例吗?我知道我需要使用我的应用程序密钥,但我不知道下一步该做什么。 以及如何使用此插件进行测试购买?

请尽你所能提供帮助,因为我真的在这个问题上卡了很长时间。

这是我的一些“采购商”对象,名为 MoneyTakerScript(继承自 MonoBehaviour):

void Start()
{

    string key = "My App Key...";


    GoogleIAB.init(key);

    var skus = new string[] { "cl.48931", "tp.58932", "mmm.68393" };
    GoogleIAB.queryInventory( skus );

    TPS = GameObject.Find("TPBtn").GetComponent(typeof(TPScript)) as TPScript;
    CLS = GameObject.Find("CLBtn").GetComponent(typeof(CLScript)) as CLScript;
    MMM = GameObject.Find("MMBtn").GetComponent(typeof(MMMScript)) as MMMScript;
}


public void Purchase(string ProductId)
{
    GoogleIAB.purchaseProduct(ProductId);

}



public void UseProduct(string ProductId)
{


    if (ProductId.Contains("cl"))
    {
        CLS.MakeCL();

    }
    if (ProductId.Contains("tp"))
    {
        TPS.MakeTP();

    }
    if (ProductId.Contains("mmm"))
    {
        MMM.MakeMMM();

    }

    GoogleIAB.consumeProduct(ProductId);
}

这是我的一些“购买清单”目标代码:

 void purchaseSucceededEvent(GooglePurchase purchase)
{
    //Debug.Log( "purchaseSucceededEvent: " + purchase );
    MoneyScript.UseProduct(purchase.productId);

}

  void Start()
{
    MoneyScript = GameObject.Find("MoneyTaker").GetComponent(typeof(MoneyTakerScript)) as 
    MoneyTakerScript;        
}

【问题讨论】:

  • 请告诉我们您已经尝试过什么。这听起来太像“为我做我的功课”,这个网站不是关于。

标签: unity3d in-app-purchase prime31


【解决方案1】:

我发现问题并解决了!

由于某种原因,我的 AndroidManifest.Xml 中缺少此行:

<activity android:name="com.prime31.GoogleIABProxyActivity"></activity>

刚刚添加了行,现在我有应用内购买!!

【讨论】:

    猜你喜欢
    • 2014-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-22
    • 1970-01-01
    • 2016-10-30
    • 2011-12-17
    相关资源
    最近更新 更多