Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class KTInAppTestCS : MonoBehaviour {
- // Use this for initialization
- void Start () {
- }
- void OnGUI () {
- if (GUI.Button(new Rect(100,100,100,50),"Remove Ads")) {
- KTInApp.SharedController().Purchase("com.kashiftasneem.thedarkshadow.removeads");
- }
- if (GUI.Button(new Rect(100,200,100,50),"coin1")) {
- KTInApp.SharedController().Purchase("coin1","Mgamestester");
- }
- if (GUI.Button(new Rect(100,300,100,50),"Restore")) {
- KTInApp.SharedController().RestorePurchases();
- }
- if (GUI.Button(new Rect(100,400,100,50),"550 KT")) {
- KTInApp.SharedController().Purchase("com.kashiftasneem.thedarkshadow.550KTions");
- }
- }
- void OnEnable () {
- StartCoroutine(SetupInAppIds());
- }
- void OnDisable () {
- KTInApp.SharedController().KTPurchaseSuccessful -= PurchaseSuccessful;
- KTInApp.SharedController().KTPurchaseFailed -= PurchaseFailed;
- KTInApp.SharedController().KTRestorePurchaseSuccessful -= RestoreSuccessful;
- KTInApp.SharedController().KTRestorePurchaseFailed -= RestoreFailed;
- }
- IEnumerator SetupInAppIds () {
- yield return new WaitForSeconds(1.0f);
- string[] inappIds = new string[] {"coin1"};
- string[] names = new string[] {"coin1"};
- KTInApp.SharedController().InitializeInApps(inappIds,names,true,true);
- KTInApp.SharedController().KTPurchaseSuccessful += PurchaseSuccessful;
- KTInApp.SharedController().KTPurchaseFailed += PurchaseFailed;
- KTInApp.SharedController().KTRestorePurchaseSuccessful += RestoreSuccessful;
- KTInApp.SharedController().KTRestorePurchaseFailed += RestoreFailed;
- }
- void PurchaseSuccessful (string productId) {
- print ("purchase success of "+productId);
- }
- void PurchaseFailed (string error) {
- print ("purchase failed with error "+error);
- }
- void RestoreFailed (string error) {
- print ("restore failed with error "+error);
- }
- void RestoreSuccessful (string productId) {
- print ("restore success of "+productId);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement