コード例 #1
0
        private IStore InstantiateUDP()
        {
            var store = new UDPImpl();

            BindExtension <IUDPExtensions>(store);
            INativeUDPStore nativeUdpStore = (INativeUDPStore)GetAndroidNativeStore(store);

            store.SetNativeStore(nativeUdpStore);
            return(store);
        }
コード例 #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();
        }