Guest User

GA v2.1.0 business event PlayMaker fix

a guest
Jul 13th, 2015
355
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #if true
  2.  
  3. using System;
  4. using GameAnalyticsSDK;
  5.  
  6. namespace HutongGames.PlayMaker.Actions
  7. {
  8.     [ActionCategory("GameAnalytics")]
  9.     [Tooltip("Sends a business event message to the GameAnalytics server with no validation")]
  10.     [HelpUrl("https://hutonggames.fogbugz.com/default.asp?W1163")]
  11.     public class SendBusinessEvent : FsmStateAction
  12.     {
  13.         [RequiredField]
  14.         [Tooltip("Abbreviation of the currency used for the transaction. F.x. USD (U.S. Dollars)")]
  15.         public FsmString Currency;
  16.        
  17.         [RequiredField]
  18.         [Tooltip("Amount of real currency, in cents")]
  19.         public FsmInt Amount;
  20.  
  21.         [RequiredField]
  22.         [Tooltip("Type of IAP item purchased (e.g. Coins)")]
  23.         public FsmString ItemType;
  24.        
  25.         [RequiredField]
  26.         [Tooltip("Specific item purchased (e.g. CoinPack001)")]
  27.         public FsmString ItemID;
  28.  
  29.         [RequiredField]
  30.         [Tooltip("Cart Type")]
  31.         public FsmString CartType;
  32.        
  33.         public override void Reset()
  34.         {
  35.             Currency = new FsmString() { UseVariable = false };
  36.             Amount = new FsmInt() { UseVariable = false };
  37.             ItemType = new FsmString() { UseVariable = false };
  38.             ItemID = new FsmString() { UseVariable = false };
  39.             CartType = new FsmString() { UseVariable = false };
  40.         }
  41.        
  42.         public override void OnEnter()
  43.         {
  44.             GameAnalytics.NewBusinessEvent(Currency.Value, Amount.Value, ItemType.Value, ItemID.Value, CartType.Value);
  45.            
  46.             Finish();
  47.         }
  48.     }
  49.  
  50. #if UNITY_IOS
  51.     [ActionCategory("GameAnalytics")]
  52.     [Tooltip("Sends an iOS business event message to the GameAnalytics server")]
  53.     [HelpUrl("https://hutonggames.fogbugz.com/default.asp?W1163")]
  54.     public class SendBusinessEventIOS : FsmStateAction
  55.     {
  56.         [RequiredField]
  57.         [Tooltip("Abbreviation of the currency used for the transaction. F.x. USD (U.S. Dollars)")]
  58.         public FsmString Currency;
  59.  
  60.         [RequiredField]
  61.         [Tooltip("Amount of real currency, in cents")]
  62.         public FsmInt Amount;
  63.  
  64.         [RequiredField]
  65.         [Tooltip("Type of IAP item purchased (e.g. Coins)")]
  66.         public FsmString ItemType;
  67.  
  68.         [RequiredField]
  69.         [Tooltip("Specific item purchased (e.g. CoinPack001)")]
  70.         public FsmString ItemID;
  71.  
  72.         [RequiredField]
  73.         [Tooltip("Cart Type")]
  74.         public FsmString CartType;
  75.  
  76.         [Tooltip("App Store Receipt, used for purchase validation")]
  77.         public FsmString Receipt;
  78.  
  79.         public override void Reset()
  80.         {
  81.             Currency = new FsmString() { UseVariable = false };
  82.             Amount = new FsmInt() { UseVariable = false };
  83.             ItemType = new FsmString() { UseVariable = false };
  84.             ItemID = new FsmString() { UseVariable = false };
  85.             CartType = new FsmString() { UseVariable = false };
  86.             Receipt = new FsmString() { UseVariable = false };
  87.         }
  88.  
  89.         public override void OnEnter()
  90.         {
  91.             GameAnalytics.NewBusinessEventIOS(Currency.Value, Amount.Value, ItemType.Value, ItemID.Value, CartType.Value, Receipt.Value);
  92.  
  93.             Finish();
  94.         }
  95.     }
  96.  
  97.     [ActionCategory("GameAnalytics")]
  98.     [Tooltip("Sends an iOS business with auto fetch receipt event message to the GameAnalytics server")]
  99.     [HelpUrl("https://hutonggames.fogbugz.com/default.asp?W1163")]
  100.     public class SendBusinessEventIOSAutoFetchReceipt : FsmStateAction
  101.     {
  102.         [RequiredField]
  103.         [Tooltip("Abbreviation of the currency used for the transaction. F.x. USD (U.S. Dollars)")]
  104.         public FsmString Currency;
  105.  
  106.         [RequiredField]
  107.         [Tooltip("Amount of real currency, in cents")]
  108.         public FsmInt Amount;
  109.  
  110.         [RequiredField]
  111.         [Tooltip("Type of IAP item purchased (e.g. Coins)")]
  112.         public FsmString ItemType;
  113.  
  114.         [RequiredField]
  115.         [Tooltip("Specific item purchased (e.g. CoinPack001)")]
  116.         public FsmString ItemID;
  117.  
  118.         [RequiredField]
  119.         [Tooltip("Cart Type")]
  120.         public FsmString CartType;
  121.  
  122.         public override void Reset()
  123.         {
  124.             Currency = new FsmString() { UseVariable = false };
  125.             Amount = new FsmInt() { UseVariable = false };
  126.             ItemType = new FsmString() { UseVariable = false };
  127.             ItemID = new FsmString() { UseVariable = false };
  128.             CartType = new FsmString() { UseVariable = false };
  129.         }
  130.  
  131.         public override void OnEnter()
  132.         {
  133.             GameAnalytics.NewBusinessEventIOSAutoFetchReceipt(Currency.Value, Amount.Value, ItemType.Value, ItemID.Value, CartType.Value);
  134.  
  135.             Finish();
  136.         }
  137.     }
  138. #endif
  139.  
  140. #if UNITY_ANDROID
  141.     [ActionCategory("GameAnalytics")]
  142.     [Tooltip("Sends a Google Play business event message to the GameAnalytics server")]
  143.     [HelpUrl("https://hutonggames.fogbugz.com/default.asp?W1163")]
  144.     public class SendBusinessEventGooglePlay : FsmStateAction
  145.     {
  146.         [RequiredField]
  147.         [Tooltip("Abbreviation of the currency used for the transaction. F.x. USD (U.S. Dollars)")]
  148.         public FsmString Currency;
  149.  
  150.         [RequiredField]
  151.         [Tooltip("Amount of real currency, in cents")]
  152.         public FsmInt Amount;
  153.  
  154.         [RequiredField]
  155.         [Tooltip("Type of IAP item purchased (e.g. Coins)")]
  156.         public FsmString ItemType;
  157.  
  158.         [RequiredField]
  159.         [Tooltip("Specific item purchased (e.g. CoinPack001)")]
  160.         public FsmString ItemID;
  161.  
  162.         [RequiredField]
  163.         [Tooltip("Cart Type")]
  164.         public FsmString CartType;
  165.  
  166.         [Tooltip("App Store Receipt, used for purchase validation")]
  167.         public FsmString Receipt;
  168.  
  169.         [RequiredField]
  170.         [Tooltip("Signature for In-App purchase, used for purchase validation")]
  171.         public FsmString Signature;
  172.  
  173.         public override void Reset()
  174.         {
  175.             Currency = new FsmString() { UseVariable = false };
  176.             Amount = new FsmInt() { UseVariable = false };
  177.             ItemType = new FsmString() { UseVariable = false };
  178.             ItemID = new FsmString() { UseVariable = false };
  179.             CartType = new FsmString() { UseVariable = false };
  180.             Receipt = new FsmString() { UseVariable = false };
  181.             Signature = new FsmString() { UseVariable = false };
  182.         }
  183.  
  184.         public override void OnEnter()
  185.         {
  186.             GameAnalytics.NewBusinessEventGooglePlay(Currency.Value, Amount.Value, ItemType.Value, ItemID.Value, CartType.Value, Receipt.Value, Signature.Value);
  187.  
  188.             Finish();
  189.         }
  190.     }
  191. #endif
  192. }
  193.  
  194. #endif
RAW Paste Data