コード例 #1
0
        /// <summary>
        /// Creates an instance of this module for Android platform. This method throws an exception on Non-Android
        /// platforms.
        ///
        /// This method is not thread-safe.
        /// </summary>
        public static AbstractPurchasingModule Instance()
        {
            if (Application.platform != RuntimePlatform.Android)
            {
                throw new NotImplementedException(
                          "Google Play Billing Service is only implemented for Android devices.");
            }

            if (_moduleInstance == null)
            {
                _moduleInstance = new GooglePlayStoreModule();
                var gameObject = new GameObject("GooglePlayBillingUtil");
                // Hide the object so that it it won't be accessible (to make sure it won't be deleted accidentally).
                gameObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector;
                _util = gameObject.AddComponent <GooglePlayBillingUtil>();
            }

            return(_moduleInstance);
        }
コード例 #2
0
 public GooglePlayStoreImpl(GooglePlayBillingUtil googlePlayBillingUtil)
 {
     _inventory   = new GooglePlayBillingInventory();
     _billingUtil = googlePlayBillingUtil;
     _jniUtils    = new JniUtils(_billingUtil);
 }