public UDPBindings()
        {
            Type udpIapBridge = UdpIapBridgeInterface.GetClassType();

            if (udpIapBridge != null)
            {
                m_Bridge = Activator.CreateInstance(udpIapBridge);
            }
            else
            {
                Debug.LogError("Failed to access UDP. Please make sure your UDP package is installed and up-to-date");
                throw new NotImplementedException();
            }
        }
Example #2
0
        private INativeStore GetAndroidStoreHelper(IUnityCallback callback, AppStore store, IPurchasingBinder binder,
                                                   IUtil util)
        {
            switch (store)
            {
            case AppStore.AmazonAppStore:
                using (var pluginClass = new AndroidJavaClass("com.unity.purchasing.amazon.AmazonPurchasing"))
                {
                    // Switch Android callbacks to the scripting thread, via ScriptingUnityCallback.
                    var proxy    = new JavaBridge(new ScriptingUnityCallback(callback, util));
                    var instance = pluginClass.CallStatic <AndroidJavaObject> ("instance", proxy);
                    // Hook up our amazon specific functionality.
                    var extensions = new AmazonAppStoreStoreExtensions(instance);
                    binder.RegisterExtension <IAmazonExtensions> (extensions);
                    binder.RegisterConfiguration <IAmazonConfiguration> (extensions);
                    return(new AndroidJavaStore(instance));
                }

            case AppStore.UDP:
            {
                Type udpIapBridge = UdpIapBridgeInterface.GetClassType();
                if (udpIapBridge != null)
                {
                    UDPImpl     udpImpl     = new UDPImpl();
                    UDPBindings udpBindings = new UDPBindings();
                    udpImpl.SetNativeStore(udpBindings);
                    binder.RegisterExtension <IUDPExtensions>(udpImpl);
                    return(udpBindings);
                }
                else
                {
                    Debug.LogError("Cannot set Android target to UDP. Make sure you have installed UDP in your project");
                    throw new NotImplementedException();
                }
            }
            }

            throw new NotImplementedException();
        }