Beispiel #1
0
 // Token: 0x06004978 RID: 18808 RVA: 0x00189854 File Offset: 0x00187C54
 private void OnGUI()
 {
     if (GUI.Button(new Rect((float)this.nXStart, (float)this.nYStart, (float)this.nWidth, (float)this.nHeight), "IsReady"))
     {
         Viveport.Core.Logger.Log("IsReady");
         IAPurchase.IsReady(this.mListener, ViveportDemo_IAP.IAP_APP_TEST_KEY);
     }
     if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + this.nWidth + 10), (float)this.nWidth, (float)this.nHeight), "Request"))
     {
         Viveport.Core.Logger.Log("Request");
         this.mListener.mItem.items    = new string[3];
         this.mListener.mItem.items[0] = "sword";
         this.mListener.mItem.items[1] = "knife";
         this.mListener.mItem.items[2] = "medicine";
         IAPurchase.Request(this.mListener, "1");
     }
     if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 2 * this.nWidth + 20), (float)this.nWidth, (float)this.nHeight), "Purchase"))
     {
         Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + this.mListener.mItem.ticket);
         IAPurchase.Purchase(this.mListener, this.mListener.mItem.ticket);
     }
     if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 3 * this.nWidth + 30), (float)this.nWidth, (float)this.nHeight), "Query"))
     {
         Viveport.Core.Logger.Log("Query");
         IAPurchase.Query(this.mListener, this.mListener.mItem.ticket);
     }
     if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 4 * this.nWidth + 40), (float)this.nWidth, (float)this.nHeight), "GetBalance"))
     {
         Viveport.Core.Logger.Log("GetBalance");
         IAPurchase.GetBalance(this.mListener);
     }
     if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 10), (float)(this.nYStart + this.nWidth + 10), (float)(this.nWidth + 70), (float)this.nHeight), "RequestSubscription"))
     {
         Viveport.Core.Logger.Log("RequestSubscription");
         IAPurchase.RequestSubscription(this.mListener, "1", "month", 1, "day", 2, 3, "pID");
     }
     if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 10), (float)(this.nYStart + 2 * this.nWidth + 20), (float)(this.nWidth + 120), (float)this.nHeight), "RequestSubscriptionWithPlanID"))
     {
         Viveport.Core.Logger.Log("RequestSubscriptionWithPlanID");
         IAPurchase.RequestSubscriptionWithPlanID(this.mListener, "pID");
     }
     if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 10), (float)(this.nYStart + 3 * this.nWidth + 30), (float)this.nWidth, (float)this.nHeight), "Subscribe"))
     {
         Viveport.Core.Logger.Log("Subscribe");
         IAPurchase.Subscribe(this.mListener, this.mListener.mItem.subscription_ticket);
     }
     if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 10), (float)(this.nYStart + 4 * this.nWidth + 40), (float)(this.nWidth + 50), (float)this.nHeight), "QuerySubscription"))
     {
         Viveport.Core.Logger.Log("QuerySubscription");
         IAPurchase.QuerySubscription(this.mListener, this.mListener.mItem.subscription_ticket);
     }
     if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 10), (float)(this.nYStart + 5 * this.nWidth + 50), (float)(this.nWidth + 50), (float)this.nHeight), "CancelSubscription"))
     {
         Viveport.Core.Logger.Log("CancelSubscription");
         IAPurchase.CancelSubscription(this.mListener, this.mListener.mItem.subscription_ticket);
     }
 }
 public void StartIAPQuery()
 {
     if (_iapIsReady)
     {
         IAPurchase.Query(_iAPResult);
     }
     else
     {
         Debug.LogError("Viveport IAP IsReady isn't Complete");
     }
 }
Beispiel #3
0
    void OnGUI()
    {
        //******************************************************
        //*                  IAP sample code
        //*****************************************************
#if UNITY_ANDROID
        GUIStyle customButton = new GUIStyle("button");
        customButton.fontSize = 24;
        if (GUI.Button(new Rect(nXStart, nYStart, nWidth, nHeight), "IsReady", customButton))
        {
            Viveport.Core.Logger.Log("IsReady");
            IAPurchase.IsReady(mListener, IAP_APP_TEST_KEY);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 1 * nWidth + 10, nWidth, nHeight), "Request", customButton))
        {
            Viveport.Core.Logger.Log("Request");
            //add virtual items into cache
            mListener.mItem.items    = new string[3];
            mListener.mItem.items[0] = "sword";
            mListener.mItem.items[1] = "knife";
            mListener.mItem.items[2] = "medicine";
            IAPurchase.Request(mListener, "1");
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 2 * nWidth + 20, nWidth, nHeight), "Purchase", customButton))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + mListener.mItem.ticket);
            IAPurchase.Purchase(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 3 * nWidth + 30, nWidth, nHeight), "Query", customButton))
        {
            Viveport.Core.Logger.Log("Query");
            IAPurchase.Query(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 4 * nWidth + 40, nWidth, nHeight), "GetBalance", customButton))
        {
            Viveport.Core.Logger.Log("GetBalance");
            IAPurchase.GetBalance(mListener);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 1 * nWidth + 10, nWidth + 70, nHeight), "RequestSubscription", customButton))
        {
            Viveport.Core.Logger.Log("RequestSubscription");
            IAPurchase.RequestSubscription(mListener, "1", "month", 1, "day", 2, 3, "pID");
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 350, nYStart + 1 * nWidth + 10, nWidth + 70, nHeight), "RequestWithUserData", customButton))
        {
            Viveport.Core.Logger.Log("Request");
            IAPurchase.Request(mListener, "1", "Knife");
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 2 * nWidth + 20, nWidth + 120, nHeight), "RequestSubscriptionWithPlanID", customButton))
        {
            Viveport.Core.Logger.Log("RequestSubscriptionWithPlanID");
            IAPurchase.RequestSubscriptionWithPlanID(mListener, "pID");
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 3 * nWidth + 30, nWidth, nHeight), "Subscribe", customButton))
        {
            Viveport.Core.Logger.Log("Subscribe bIsDuplicatedSubscription=" + bIsDuplicatedSubscription);
            IAPurchase.Subscribe(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 4 * nWidth + 40, nWidth + 50, nHeight), "QuerySubscription", customButton))
        {
            Viveport.Core.Logger.Log("QuerySubscription");
            bIsDuplicatedSubscription = false;
            IAPurchase.QuerySubscription(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 5 * nWidth + 50, nWidth + 50, nHeight), "CancelSubscription", customButton))
        {
            Viveport.Core.Logger.Log("CancelSubscription");
            IAPurchase.CancelSubscription(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 6 * nWidth + 50, nWidth + 50, nHeight), "QueryPurchaseList", customButton))
        {
            Viveport.Core.Logger.Log("QueryPurchaseList");
            IAPurchase.Query(mListener);
        }
#else
        if (GUI.Button(new Rect(nXStart, nYStart, nWidth, nHeight), "IsReady"))
        {
            Viveport.Core.Logger.Log("IsReady");
            IAPurchase.IsReady(mListener, IAP_APP_TEST_KEY);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 1 * nWidth + 10, nWidth + 120, nHeight), "Request"))
        {
            Viveport.Core.Logger.Log("Request");
            //add virtual items into cache
            mListener.mItem.items    = new string[3];
            mListener.mItem.items[0] = "sword";
            mListener.mItem.items[1] = "knife";
            mListener.mItem.items[2] = "medicine";
            IAPurchase.Request(mListener, "1");
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 2 * nWidth - 10, nWidth + 120, nHeight), "RequestWithUserData"))
        {
            Viveport.Core.Logger.Log("Request");
            IAPurchase.Request(mListener, "1", "Knife");
        }

        if (GUI.Button(new Rect(nXStart + 2 * nWidth + 65, nYStart + 1 * nWidth + 40, nWidth, nHeight), "Purchase"))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + mListener.mItem.ticket);
            IAPurchase.Purchase(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart + 4 * nWidth + 20, nYStart + 1 * nWidth + 10, nWidth + 50, nHeight), "Query"))
        {
            Viveport.Core.Logger.Log("Query");
            IAPurchase.Query(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart + 4 * nWidth + 20, nYStart + 2 * nWidth - 10, nWidth + 50, nHeight), "QueryPurchaseList"))
        {
            Viveport.Core.Logger.Log("QueryPurchaseList");
            IAPurchase.Query(mListener);
        }

        if (GUI.Button(new Rect(nXStart + 6 * nWidth + 20, nYStart + 1 * nWidth + 40, nWidth, nHeight), "GetBalance"))
        {
            Viveport.Core.Logger.Log("GetBalance");
            IAPurchase.GetBalance(mListener);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 3 * nWidth + 20, nWidth + 120, nHeight), "RequestSubscription"))
        {
            Viveport.Core.Logger.Log("RequestSubscription");
            IAPurchase.RequestSubscription(mListener, "1", "month", 1, "day", 2, 3, "pID");
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 4 * nWidth, nWidth + 120, nHeight), "RequestSubscriptionWithPlanID"))
        {
            Viveport.Core.Logger.Log("RequestSubscriptionWithPlanID");
            IAPurchase.RequestSubscriptionWithPlanID(mListener, "pID");
        }

        if (GUI.Button(new Rect(nXStart + 3 * nWidth - 10, nYStart + 4 * nWidth - 35, nWidth, nHeight), "Subscribe"))
        {
            Viveport.Core.Logger.Log("Subscribe");
            //Before you call Subscribe(), you should call IAPurchase.QuerySubscription(mListener, null) first to get user's current subscriptions
            //When you find your current subscription is in user's current subscriptions(plan id is identical), and this subscription's status is ACTIVE,
            //You should prompt a dialog to remind user that he has subscribed this plan to avoid duplicated subscription
            IAPurchase.Subscribe(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + 4 * nWidth + 20, nYStart + 4 * nWidth - 35, nWidth + 50, nHeight), "QuerySubscription"))
        {
            Viveport.Core.Logger.Log("QuerySubscription");
            IAPurchase.QuerySubscription(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + 6 * nWidth + 20, nYStart + 4 * nWidth - 35, nWidth + 50, nHeight), "CancelSubscription"))
        {
            Viveport.Core.Logger.Log("CancelSubscription");
            IAPurchase.CancelSubscription(mListener, mListener.mItem.subscription_ticket);
        }
#endif
    }
 public override void OnSuccess(string pchCurrencyName)
 {
     TestLogger.Success("IsReady", string.Format("IsReady success. Currency: {0}", pchCurrencyName));
     IAPurchase.Query(this);
 }
Beispiel #5
0
    // Token: 0x06000E51 RID: 3665 RVA: 0x0005C128 File Offset: 0x0005A328
    private void OnGUI()
    {
        GUIStyle style = new GUIStyle("button");

        GUI.Label(new Rect(15f, 5f, 100f, 20f), "TOP API");
        GUI.Label(new Rect(15f, 65f, 800f, 20f), "==========================================================================================================================================");
        GUI.Label(new Rect(15f, 80f, 100f, 20f), "IAP - Purchase");
        GUI.Label(new Rect(15f, 145f, 800f, 20f), "==========================================================================================================================================");
        GUI.Label(new Rect(15f, 165f, 200f, 20f), "IAP - Purchase With User Data");
        GUI.Label(new Rect(15f, 235f, 800f, 20f), "==========================================================================================================================================");
        GUI.Label(new Rect(15f, 260f, 120f, 20f), "IAP - Subscription");
        GUI.Label(new Rect(15f, 380f, 800f, 20f), "==========================================================================================================================================");
        GUI.Label(new Rect(15f, 400f, 120f, 20f), "IAP - Optional API");
        if ((!ViveportDemo_IAP.bInit_Done && !ViveportDemo_IAP.bIsReady_Done) || ViveportDemo_IAP.bShutdown_Done)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.gray;
        }
        if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart - 15), (float)this.nWidth, (float)this.nHeight), "1.Init", style))
        {
            Viveport.Core.Logger.Log("Init");
            Api.Init(new StatusCallback(ViveportDemo_IAP.InitStatusHandler), ViveportDemo_IAP.IAP_APP_TEST_ID);
        }
        if (ViveportDemo_IAP.bInit_Done && !ViveportDemo_IAP.bIsReady_Done)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.gray;
        }
        if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 15), (float)(this.nYStart - 15), (float)this.nWidth, (float)this.nHeight), "2.IsReady", style))
        {
            Viveport.Core.Logger.Log("IsReady");
            IAPurchase.IsReady(this.mListener, ViveportDemo_IAP.IAP_APP_TEST_KEY);
        }
        if (!ViveportDemo_IAP.bInit_Done || ViveportDemo_IAP.bShutdown_Done)
        {
            GUI.contentColor = Color.grey;
        }
        else
        {
            GUI.contentColor = Color.white;
        }
        if (GUI.Button(new Rect((float)(this.nXStart + 2 * this.nWidth + 30), (float)(this.nYStart - 15), (float)(this.nWidth + 20), (float)this.nHeight), "3.Shutdown", style))
        {
            Viveport.Core.Logger.Log("Shutdown");
            Api.Shutdown(new StatusCallback(ViveportDemo_IAP.ShutdownStatusHandler));
        }
        if (ViveportDemo_IAP.bInit_Done && ViveportDemo_IAP.bIsReady_Done && !ViveportDemo_IAP.bShutdown_Done)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.grey;
        }
        if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 60), (float)(this.nWidth + 20), (float)this.nHeight), "1.1.Request", style))
        {
            Viveport.Core.Logger.Log("Request");
            this.mListener.mItem.items    = new string[3];
            this.mListener.mItem.items[0] = "sword";
            this.mListener.mItem.items[1] = "knife";
            this.mListener.mItem.items[2] = "medicine";
            IAPurchase.Request(this.mListener, "1");
        }
        if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 40), (float)(this.nYStart + 60), (float)(this.nWidth + 20), (float)this.nHeight), "1.2.Purchase", style))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + this.mListener.mItem.ticket);
            IAPurchase.Purchase(this.mListener, this.mListener.mItem.ticket);
        }
        if (GUI.Button(new Rect((float)(this.nXStart + 2 * this.nWidth + 80), (float)(this.nYStart + 60), (float)(this.nWidth + 20), (float)this.nHeight), "2.Query", style))
        {
            Viveport.Core.Logger.Log("Query");
            IAPurchase.Query(this.mListener, this.mListener.mItem.ticket);
        }
        if (ViveportDemo_IAP.bInit_Done && ViveportDemo_IAP.bIsReady_Done && !ViveportDemo_IAP.bShutdown_Done)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.grey;
        }
        if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + this.nHeight + 110), (float)(this.nWidth + 90), (float)this.nHeight), "1.1.RequestWithUserData", style))
        {
            Viveport.Core.Logger.Log("Request");
            IAPurchase.Request(this.mListener, "1", "Knife");
        }
        if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 105), (float)(this.nYStart + this.nHeight + 110), (float)(this.nWidth + 20), (float)this.nHeight), "1.2.Purchase", style))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + this.mListener.mItem.ticket);
            IAPurchase.Purchase(this.mListener, this.mListener.mItem.ticket);
        }
        if (GUI.Button(new Rect((float)(this.nXStart + 2 * this.nWidth + 140), (float)(this.nYStart + this.nHeight + 110), (float)(this.nWidth + 80), (float)this.nHeight), "2.QueryPurchaseList", style))
        {
            Viveport.Core.Logger.Log("QueryPurchaseList");
            IAPurchase.Query(this.mListener);
        }
        if (ViveportDemo_IAP.bInit_Done && ViveportDemo_IAP.bIsReady_Done && !ViveportDemo_IAP.bShutdown_Done)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.grey;
        }
        if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 2 * this.nHeight + 165), (float)(this.nWidth + 160), (float)this.nHeight), "1.1-1.RequestSubscription                 ", style))
        {
            Viveport.Core.Logger.Log("RequestSubscription");
            IAPurchase.RequestSubscription(this.mListener, "1", "month", 1, "day", 2, 3, "pID");
        }
        if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 3 * this.nHeight + 175), (float)(this.nWidth + 160), (float)this.nHeight), "1.1-2.RequestSubscriptionWithPlanID", style))
        {
            Viveport.Core.Logger.Log("RequestSubscriptionWithPlanID");
            IAPurchase.RequestSubscriptionWithPlanID(this.mListener, "pID");
        }
        if (GUI.Button(new Rect((float)(this.nXStart + this.nWidth + 180), (float)(this.nYStart + 2 * this.nHeight + 190), (float)(this.nWidth + 20), (float)this.nHeight), "1.2.Subscribe", style))
        {
            Viveport.Core.Logger.Log("Subscribe");
            IAPurchase.Subscribe(this.mListener, this.mListener.mItem.subscription_ticket);
        }
        if (GUI.Button(new Rect((float)(this.nXStart + 2 * this.nWidth + 218), (float)(this.nYStart + 2 * this.nHeight + 165), (float)(this.nWidth + 90), (float)this.nHeight), "2.1.QuerySubscription", style))
        {
            Viveport.Core.Logger.Log("QuerySubscription");
            IAPurchase.QuerySubscription(this.mListener, this.mListener.mItem.subscription_ticket);
        }
        if (GUI.Button(new Rect((float)(this.nXStart + 2 * this.nWidth + 218), (float)(this.nYStart + 3 * this.nHeight + 175), (float)(this.nWidth + 105), (float)this.nHeight), "2.2.QuerySubscriptionList", style))
        {
            Viveport.Core.Logger.Log("QuerySubscriptionList");
            IAPurchase.QuerySubscriptionList(this.mListener);
        }
        if (GUI.Button(new Rect((float)(this.nXStart + 3 * this.nWidth + 345), (float)(this.nYStart + 2 * this.nHeight + 190), (float)(this.nWidth + 80), (float)this.nHeight), "3.CancelSubscription", style))
        {
            Viveport.Core.Logger.Log("CancelSubscription");
            IAPurchase.CancelSubscription(this.mListener, this.mListener.mItem.subscription_ticket);
        }
        if (ViveportDemo_IAP.bInit_Done && ViveportDemo_IAP.bIsReady_Done && !ViveportDemo_IAP.bShutdown_Done)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.gray;
        }
        if (GUI.Button(new Rect((float)this.nXStart, (float)(this.nYStart + 2 * this.nHeight + 305), (float)(this.nWidth + 20), (float)this.nHeight), "GetBalance", style))
        {
            Viveport.Core.Logger.Log("GetBalance");
            IAPurchase.GetBalance(this.mListener);
        }
    }
Beispiel #6
0
    void OnGUI()
    {
        //******************************************************
        //*                  IAP sample code
        //*****************************************************
        GUIStyle CustButtonStyle = new GUIStyle("button");

#if UNITY_ANDROID
        GUIStyle customButton = new GUIStyle("button");
        customButton.fontSize = 24;
        if (GUI.Button(new Rect(nXStart, nYStart, nWidth, nHeight), "IsReady", customButton))
        {
            Viveport.Core.Logger.Log("IsReady");
            IAPurchase.IsReady(mListener, IAP_APP_TEST_KEY);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 1 * nWidth + 10, nWidth, nHeight), "Request", customButton))
        {
            Viveport.Core.Logger.Log("Request");
            //add virtual items into cache
            mListener.mItem.items    = new string[3];
            mListener.mItem.items[0] = "sword";
            mListener.mItem.items[1] = "knife";
            mListener.mItem.items[2] = "medicine";
            IAPurchase.Request(mListener, "1");
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 2 * nWidth + 20, nWidth, nHeight), "Purchase", customButton))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + mListener.mItem.ticket);
            IAPurchase.Purchase(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 3 * nWidth + 30, nWidth, nHeight), "Query", customButton))
        {
            Viveport.Core.Logger.Log("Query");
            IAPurchase.Query(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 4 * nWidth + 40, nWidth, nHeight), "GetBalance", customButton))
        {
            Viveport.Core.Logger.Log("GetBalance");
            IAPurchase.GetBalance(mListener);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 1 * nWidth + 10, nWidth + 70, nHeight), "RequestSubscription", customButton))
        {
            Viveport.Core.Logger.Log("RequestSubscription");
            IAPurchase.RequestSubscription(mListener, "1", "month", 1, "day", 2, 3, "pID");
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 350, nYStart + 1 * nWidth + 10, nWidth + 70, nHeight), "RequestWithUserData", customButton))
        {
            Viveport.Core.Logger.Log("Request");
            IAPurchase.Request(mListener, "1", "Knife");
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 2 * nWidth + 20, nWidth + 120, nHeight), "RequestSubscriptionWithPlanID", customButton))
        {
            Viveport.Core.Logger.Log("RequestSubscriptionWithPlanID");
            IAPurchase.RequestSubscriptionWithPlanID(mListener, "pID");
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 3 * nWidth + 30, nWidth, nHeight), "Subscribe", customButton))
        {
            Viveport.Core.Logger.Log("Subscribe bIsDuplicatedSubscription=" + bIsDuplicatedSubscription);
            IAPurchase.Subscribe(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 4 * nWidth + 40, nWidth + 50, nHeight), "QuerySubscription", customButton))
        {
            Viveport.Core.Logger.Log("QuerySubscription");
            bIsDuplicatedSubscription = false;
            IAPurchase.QuerySubscription(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 5 * nWidth + 50, nWidth + 50, nHeight), "CancelSubscription", customButton))
        {
            Viveport.Core.Logger.Log("CancelSubscription");
            IAPurchase.CancelSubscription(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 6 * nWidth + 50, nWidth + 50, nHeight), "QueryPurchaseList", customButton))
        {
            Viveport.Core.Logger.Log("QueryPurchaseList");
            IAPurchase.Query(mListener);
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 10, nYStart + 7 * nWidth + 40, nWidth + 50, nHeight), "QuerySubscriptionList", customButton))
        {
            Viveport.Core.Logger.Log("QuerySubscriptionList");
            IAPurchase.QuerySubscriptionList(mListener);
        }
#else
        GUI.Label(new Rect(15, 5, 100, 20), "TOP API");
        GUI.Label(new Rect(15, 65, 800, 20), "==========================================================================================================================================");
        GUI.Label(new Rect(15, 80, 100, 20), "IAP - Purchase");
        GUI.Label(new Rect(15, 145, 800, 20), "==========================================================================================================================================");
        GUI.Label(new Rect(15, 165, 200, 20), "IAP - Purchase With User Data");
        GUI.Label(new Rect(15, 235, 800, 20), "==========================================================================================================================================");
        GUI.Label(new Rect(15, 260, 120, 20), "IAP - Subscription");
        GUI.Label(new Rect(15, 380, 800, 20), "==========================================================================================================================================");
        GUI.Label(new Rect(15, 400, 120, 20), "IAP - Optional API");

        if ((bInit_Done == false && bIsReady_Done == false) || bShutdown_Done == true)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.gray;
        }

        if (GUI.Button(new Rect(nXStart, nYStart - 15, nWidth, nHeight), "1.Init", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Init");
            Api.Init(InitStatusHandler, IAP_APP_TEST_ID);
        }

        if (bInit_Done == true && bIsReady_Done == false)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.gray;
        }

        if (GUI.Button(new Rect(nXStart + nWidth + 15, nYStart - 15, nWidth, nHeight), "2.IsReady", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("IsReady");
            IAPurchase.IsReady(mListener, IAP_APP_TEST_KEY);
        }

        if (bInit_Done == false || bShutdown_Done == true)
        {
            GUI.contentColor = Color.grey;
        }
        else
        {
            GUI.contentColor = Color.white;
        }

        if (GUI.Button(new Rect(nXStart + 2 * nWidth + 30, nYStart - 15, nWidth + 20, nHeight), "3.Shutdown", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Shutdown");
            Api.Shutdown(ShutdownStatusHandler);
        }

        if (bInit_Done == true && bIsReady_Done == true && bShutdown_Done == false)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.grey;
        }

        // *******************************   IAP Purchase  ******************************//

        if (GUI.Button(new Rect(nXStart, nYStart + 60, nWidth + 20, nHeight), "1.1.Request", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Request");
            //add virtual items into cache
            mListener.mItem.items    = new string[3];
            mListener.mItem.items[0] = "sword";
            mListener.mItem.items[1] = "knife";
            mListener.mItem.items[2] = "medicine";
            IAPurchase.Request(mListener, "1");
        }

        if (GUI.Button(new Rect(nXStart + 1 * nWidth + 40, nYStart + 60, nWidth + 20, nHeight), "1.2.Purchase", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + mListener.mItem.ticket);
            IAPurchase.Purchase(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart + 2 * nWidth + 80, nYStart + 60, nWidth + 20, nHeight), "2.Query", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Query");
            IAPurchase.Query(mListener, mListener.mItem.ticket);
        }

        // ************************   IAP Purchase With User Data  ******************************//

        if (bInit_Done == true && bIsReady_Done == true && bShutdown_Done == false)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.grey;
        }

        if (GUI.Button(new Rect(nXStart, nYStart + nHeight + 110, nWidth + 90, nHeight), "1.1.RequestWithUserData", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Request");
            IAPurchase.Request(mListener, "1", "Knife");
        }

        if (GUI.Button(new Rect(nXStart + 1 * nWidth + 105, nYStart + nHeight + 110, nWidth + 20, nHeight), "1.2.Purchase", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Purchase mListener.mItem.ticket=" + mListener.mItem.ticket);
            IAPurchase.Purchase(mListener, mListener.mItem.ticket);
        }

        if (GUI.Button(new Rect(nXStart + 2 * nWidth + 140, nYStart + nHeight + 110, nWidth + 80, nHeight), "2.QueryPurchaseList", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("QueryPurchaseList");
            IAPurchase.Query(mListener);
        }

        // ************************   IAP Subscription  ******************************//

        if (bInit_Done == true && bIsReady_Done == true && bShutdown_Done == false)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.grey;
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 2 * nHeight + 165, nWidth + 160, nHeight), "1.1-1.RequestSubscription                 ", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("RequestSubscription");
            IAPurchase.RequestSubscription(mListener, "1", "month", 1, "day", 2, 3, "pID");
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 3 * nHeight + 175, nWidth + 160, nHeight), "1.1-2.RequestSubscriptionWithPlanID", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("RequestSubscriptionWithPlanID");
            IAPurchase.RequestSubscriptionWithPlanID(mListener, "pID");
        }

        if (GUI.Button(new Rect(nXStart + 1 * nWidth + 180, nYStart + 2 * nHeight + 190, nWidth + 20, nHeight), "1.2.Subscribe", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("Subscribe");
            //Before you call Subscribe(), you should call IAPurchase.QuerySubscription(mListener, null) first to get user's current subscriptions
            //When you find your current subscription is in user's current subscriptions(plan id is identical), and this subscription's status is ACTIVE,
            //You should prompt a dialog to remind user that he has subscribed this plan to avoid duplicated subscription
            IAPurchase.Subscribe(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + 2 * nWidth + 218, nYStart + 2 * nHeight + 165, nWidth + 90, nHeight), "2.1.QuerySubscription", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("QuerySubscription");
            IAPurchase.QuerySubscription(mListener, mListener.mItem.subscription_ticket);
        }

        if (GUI.Button(new Rect(nXStart + 2 * nWidth + 218, nYStart + 3 * nHeight + 175, nWidth + 105, nHeight), "2.2.QuerySubscriptionList", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("QuerySubscriptionList");
            IAPurchase.QuerySubscriptionList(mListener);
        }

        if (GUI.Button(new Rect(nXStart + 3 * nWidth + 345, nYStart + 2 * nHeight + 190, nWidth + 80, nHeight), "3.CancelSubscription", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("CancelSubscription");
            IAPurchase.CancelSubscription(mListener, mListener.mItem.subscription_ticket);
        }

        // ************************   IAP Optional API  ******************************//
        if (bInit_Done == true && bIsReady_Done == true && bShutdown_Done == false)
        {
            GUI.contentColor = Color.white;
        }
        else
        {
            GUI.contentColor = Color.gray;
        }

        if (GUI.Button(new Rect(nXStart, nYStart + 2 * nHeight + 305, nWidth + 20, nHeight), "GetBalance", CustButtonStyle))
        {
            Viveport.Core.Logger.Log("GetBalance");
            IAPurchase.GetBalance(mListener);
        }
#endif
    }