public RawBillingPlatformProvider(UnibillConfiguration config, GameObject o)
 {
     #if UNITY_ANDROID
     this.config = config;
     #endif
     this.gameObject = o;
 }
 public UnibillCurrencyEditor(UnibillConfiguration config)
 {
     this.config = config;
     foreach (var currency in config.currencies) {
         this.currencies.Add (new EditableCurrency (currency));
     }
 }
 public RemoteConfigManager(IResourceLoader loader, IStorage storage, ILogger logger, RuntimePlatform platform)
 {
     this.storage = storage;
     logger.prefix = "Unibill.RemoteConfigManager";
     this.XML = loader.openTextFile ("unibillInventory.json").ReadToEnd ();
     Config = new UnibillConfiguration(XML, platform, logger);
     if (Config.UseHostedConfig) {
         string val = storage.GetString (CACHED_CONFIG_PATH, string.Empty);
         if (string.IsNullOrEmpty (val)) {
             logger.Log ("No cached config available. Using bundled");
         } else {
             logger.Log ("Cached config found, attempting to parse");
             try {
                 Config = new UnibillConfiguration(val, platform, logger);
                 if (Config.inventory.Count == 0) {
                     logger.LogError ("No purchasable items in cached config, ignoring.");
                     Config = new UnibillConfiguration (XML, platform, logger);
                 } else {
                     logger.Log (string.Format ("Using cached config with {0} purchasable items", Config.inventory.Count));
                     XML = val;
                 }
             } catch (Exception e) {
                 logger.LogError ("Error parsing inventory: {0}", e.Message);
                 Config = new UnibillConfiguration(XML, platform, logger);
             }
         }
         refreshCachedConfig (Config.HostedConfigUrl, logger);
     } else {
         logger.Log ("Not using cached inventory, using bundled.");
         Config = new UnibillConfiguration(XML, platform, logger);
     }
 }
 public AppleAppStoreBillingService(UnibillConfiguration db, ProductIdRemapper mapper, IStoreKitPlugin storekit)
 {
     this.storekit = storekit;
     this.remapper = mapper;
     storekit.initialise(this);
     products = new HashSet <PurchasableItem>(db.AllPurchasableItems);
 }
示例#5
0
 public BillerFactory(IResourceLoader resourceLoader, ILogger logger, IStorage storage, IRawBillingPlatformProvider platformProvider, UnibillConfiguration config) {
     this.loader = resourceLoader;
     this.logger = logger;
     this.storage = storage;
     this.platformProvider = platformProvider;
     this.config = config;
 }
 public SamsungAppsBillingService(UnibillConfiguration config, ProductIdRemapper remapper, IRawSamsungAppsBillingService rawSamsung, ILogger logger)
 {
     this.config = config;
     this.remapper = remapper;
     this.rawSamsung = rawSamsung;
     this.logger = logger;
 }
 public AppleAppStoreBillingService(UnibillConfiguration db, ProductIdRemapper mapper, IStoreKitPlugin storekit)
 {
     this.storekit = storekit;
     this.remapper = mapper;
     storekit.initialise(this);
     products = new HashSet<PurchasableItem>(db.AllPurchasableItems);
 }
示例#8
0
    public void OnEnable () {
		items = new List<GUIPurchasable> ();
		toRemove = new List<GUIPurchasable> ();
		InventoryPostProcessor.CreateInventoryIfNecessary ();
		AndroidManifestGenerator.CreateManifestIfNecessary ();
        using (TextReader reader = File.OpenText(InventoryPostProcessor.UNIBILL_JSON_INVENTORY_PATH)) {
            config = new UnibillConfiguration(reader.ReadToEnd(), Application.platform, new Uniject.Impl.UnityLogger());
        }
        for (int t = 0; t < androidBillingPlatforms.Count(); t++) {
            if (androidBillingPlatforms[t] == config.AndroidBillingPlatform.ToString()) {
                androidBillingPlatform = t;
                break;
            }
        }
        foreach (PurchasableItem element in config.inventory) {

            List<IPlatformEditor> editors = new List<IPlatformEditor>();
            editors.Add(new GooglePlayEditor(element));
            editors.Add(new DefaultPlatformEditor(element, BillingPlatform.AmazonAppstore));
            editors.Add(new AppleAppStoreEditor(element));
            editors.Add(new DefaultPlatformEditor(element, BillingPlatform.MacAppStore));
            editors.Add(new DefaultPlatformEditor(element, BillingPlatform.WindowsPhone8));
            editors.Add(new DefaultPlatformEditor(element, BillingPlatform.Windows8_1));
			editors.Add (new DefaultPlatformEditor (element, BillingPlatform.SamsungApps));
            items.Add(new GUIPurchasable(element, editors));
        }

		currencyEditor = new UnibillCurrencyEditor (config);
    }
示例#9
0
 public SamsungAppsBillingService(UnibillConfiguration config, ProductIdRemapper remapper, IRawSamsungAppsBillingService rawSamsung, ILogger logger)
 {
     this.config     = config;
     this.remapper   = remapper;
     this.rawSamsung = rawSamsung;
     this.logger     = logger;
 }
示例#10
0
 public BillerFactory(IResourceLoader resourceLoader, ILogger logger, IStorage storage, IRawBillingPlatformProvider platformProvider, UnibillConfiguration config)
 {
     this.loader           = resourceLoader;
     this.logger           = logger;
     this.storage          = storage;
     this.platformProvider = platformProvider;
     this.config           = config;
 }
示例#11
0
 public AmazonAppStoreBillingService(IRawAmazonAppStoreBillingInterface amazon, ProductIdRemapper remapper, UnibillConfiguration db, TransactionDatabase tDb, ILogger logger) {
     this.remapper = remapper;
     this.db = db;
     this.logger = logger;
     logger.prefix = "UnibillAmazonBillingService";
     this.amazon = amazon;
     this.tDb = tDb;
 }
示例#12
0
 public AmazonAppStoreBillingService(IRawAmazonAppStoreBillingInterface amazon, ProductIdRemapper remapper, UnibillConfiguration db, TransactionDatabase tDb, ILogger logger)
 {
     this.remapper = remapper;
     this.db       = db;
     this.logger   = logger;
     logger.prefix = "UnibillAmazonBillingService";
     this.amazon   = amazon;
     this.tDb      = tDb;
 }
示例#13
0
 public GooglePlayBillingService (IRawGooglePlayInterface rawInterface,
                                  UnibillConfiguration config,
                                  ProductIdRemapper remapper,
                                  ILogger logger) {
     this.rawInterface = rawInterface;
     this.publicKey = config.GooglePlayPublicKey;
     this.remapper = remapper;
     this.db = config;
     this.logger = logger;
 }
示例#14
0
 public WP8BillingService(IWindowsIAP wp8,
                          UnibillConfiguration config,
                          ProductIdRemapper remapper,
                          TransactionDatabase tDb,
                          ILogger logger) {
     this.wp8 = wp8;
     this.db = config;
     this.tDb = tDb;
     this.remapper = remapper;
     this.logger = logger;
 }
示例#15
0
 public GooglePlayBillingService(IRawGooglePlayInterface rawInterface,
                                 UnibillConfiguration config,
                                 ProductIdRemapper remapper,
                                 ILogger logger)
 {
     this.rawInterface = rawInterface;
     this.publicKey    = config.GooglePlayPublicKey;
     this.remapper     = remapper;
     this.db           = config;
     this.logger       = logger;
 }
示例#16
0
        public Biller (UnibillConfiguration config, TransactionDatabase tDb, IBillingService billingSubsystem, ILogger logger, HelpCentre help, ProductIdRemapper remapper, CurrencyManager currencyManager) {
            this.InventoryDatabase = config;
            this.transactionDatabase = tDb;
            this.billingSubsystem = billingSubsystem;
            this.logger = logger;
            logger.prefix = "UnibillBiller";
            this.help = help;
            this.Errors = new List<UnibillError> ();
            this.remapper = remapper;
			this.currencyManager = currencyManager;
        }
示例#17
0
 public BillerFactory(IResourceLoader resourceLoader, Uniject.ILogger logger,
                      IStorage storage, IRawBillingPlatformProvider platformProvider,
                      UnibillConfiguration config, IUtil util, IUnityAnalytics analytics)
 {
     this.loader           = resourceLoader;
     this.logger           = logger;
     this.storage          = storage;
     this.platformProvider = platformProvider;
     this.config           = config;
     this.util             = util;
     this.analytics        = analytics;
 }
示例#18
0
 public WP8BillingService(IWindowsIAP wp8,
                          UnibillConfiguration config,
                          ProductIdRemapper remapper,
                          TransactionDatabase tDb,
                          ILogger logger)
 {
     this.wp8      = wp8;
     this.db       = config;
     this.tDb      = tDb;
     this.remapper = remapper;
     this.logger   = logger;
 }
        public RawAmazonAppStoreBillingInterface(UnibillConfiguration config)
        {
            if (config.CurrentPlatform == BillingPlatform.AmazonAppstore && config.AmazonSandboxEnabled)
            {
                string json = ((TextAsset)Resources.Load("amazon.sdktester.json")).text;
                File.WriteAllText("/sdcard/amazon.sdktester.json", json);
            }

            using (var pluginClass = new AndroidJavaClass("com.outlinegames.unibillAmazon.Unibill")) {
                amazon = pluginClass.CallStatic <AndroidJavaObject> ("instance");
            }
        }
        public RawAmazonAppStoreBillingInterface(UnibillConfiguration config)
        {
            #if UNITY_ANDROID
            if (config.CurrentPlatform == BillingPlatform.AmazonAppstore && config.AmazonSandboxEnabled) {
                string json = ((TextAsset)Resources.Load ("amazon.sdktester.json")).text;
                File.WriteAllText ("/sdcard/amazon.sdktester.json", json);
            }

            using (var pluginClass = new AndroidJavaClass("com.outlinegames.unibillAmazon.Unibill" )) {
                amazon = pluginClass.CallStatic<AndroidJavaObject> ("instance");
            }
            #endif
        }
 public GooglePlayBillingService(IRawGooglePlayInterface rawInterface,
                                 UnibillConfiguration config,
                                 ProductIdRemapper remapper,
                                 ILogger logger)
 {
     this.rawInterface = rawInterface;
     this.publicKey    = config.GooglePlayPublicKey;
     this.remapper     = remapper;
     this.db           = config;
     this.logger       = logger;
     #if UNITY_ANDROID
     this.cryptoProvider = PEMKeyLoader.CryptoServiceProviderFromPublicKeyInfo(publicKey);
     #endif
 }
示例#22
0
 public AnalyticsReporter(Biller biller, UnibillConfiguration config, IHTTPClient client, IStorage storage, IUtil util, ILevelLoadListener listener)
 {
     this.config = config;
     this.client = client;
     this.util   = util;
     this.userId = getUserId(storage);
     biller.onPurchaseComplete        += onSucceeded;
     biller.onPurchaseCancelled       += (PurchasableItem obj) => onEvent(EventType.purchase_cancelled, obj, null);
     biller.onPurchaseRefunded        += (PurchasableItem obj) => onEvent(EventType.purchase_refunded, obj, null);
     biller.onTransactionRestoreBegin += (bool obj) => restoreInProgress = true;
     biller.onTransactionsRestored    += (bool obj) => restoreInProgress = false;
     listener.registerListener(() => onLevelLoad());
     onEvent(EventType.new_session, null, null);
     this.levelName     = util.loadedLevelName();
     this.levelLoadTime = DateTime.UtcNow;
 }
示例#23
0
 public AnalyticsReporter(Biller biller, UnibillConfiguration config, IHTTPClient client, IStorage storage, IUtil util, ILevelLoadListener listener)
 {
     this.config = config;
     this.client = client;
     this.util = util;
     this.userId = getUserId (storage);
     biller.onPurchaseComplete += onSucceeded;
     biller.onPurchaseCancelled += (PurchasableItem obj) => onEvent(EventType.purchase_cancelled, obj, null);
     biller.onPurchaseRefunded += (PurchasableItem obj) => onEvent(EventType.purchase_refunded, obj, null);
     biller.onTransactionRestoreBegin += (bool obj) =>  restoreInProgress = true;
     biller.onTransactionsRestored += (bool obj) => restoreInProgress = false;
     listener.registerListener (() => onLevelLoad ());
     onEvent (EventType.new_session, null, null);
     this.levelName = util.loadedLevelName ();
     this.levelLoadTime = DateTime.UtcNow;
 }
    public static void mergeManifest() {

        if (!Directory.Exists("Assets/Plugins/Android")) {
            AssetDatabase.CreateFolder("Assets/Plugins", "Android");
        }

        if (!File.Exists (AndroidManifestPath)) {
            AssetDatabase.CopyAsset("Assets/Plugins/unibill/static/Manifest.xml", AndroidManifestPath);
            AssetDatabase.ImportAsset(AndroidManifestPath);
        }
        
        UnibillConfiguration config = new UnibillConfiguration(new UnityResourceLoader(), new UnibillXmlParser(new Mono.Xml.SmallXmlParser(), new UnityResourceLoader()), new UnityUtil(), new UnityLogger());
        XDocument doc = XDocument.Load(AndroidManifestPath);
        doc = new AndroidManifestMerger().merge(doc, config.CurrentPlatform, config.AmazonSandboxEnabled);
        doc.Save(AndroidManifestPath);
        AssetDatabase.ImportAsset(AndroidManifestPath);
    }
示例#25
0
    public static IKernel _get () {
        BillingPlatform platform = new UnibillConfiguration(new UnityResourceLoader(), new UnibillXmlParser(new Mono.Xml.SmallXmlParser(), new UnityResourceLoader()), new UnityUtil(), new UnityLogger()).CurrentPlatform;
        NinjectModule module = null;
        switch (platform) {
        case BillingPlatform.AppleAppStore:
		case BillingPlatform.MacAppStore:
            module = new StorekitModule(Application.isEditor);
        break;
        case BillingPlatform.AmazonAppstore:
            module = new AmazonModule(Application.isEditor);
            break;
        case BillingPlatform.GooglePlay:
            module = new GooglePlayModule(Application.isEditor);
            break;
        }
        return new StandardKernel (new UnityNinjectSettings (), new Ninject.Modules.INinjectModule[] {
            new UnityModule (),
            module,
        } );
    }
示例#26
0
 public RemoteConfigManager(IResourceLoader loader, IStorage storage, ILogger logger, RuntimePlatform platform)
 {
     this.storage  = storage;
     logger.prefix = "Unibill.RemoteConfigManager";
     this.XML      = loader.openTextFile("unibillInventory.json").ReadToEnd();
     Config        = new UnibillConfiguration(XML, platform, logger);
     if (Config.UseHostedConfig)
     {
         string val = storage.GetString(CACHED_CONFIG_PATH, string.Empty);
         if (string.IsNullOrEmpty(val))
         {
             logger.Log("No cached config available. Using bundled");
         }
         else
         {
             logger.Log("Cached config found, attempting to parse");
             try {
                 Config = new UnibillConfiguration(val, platform, logger);
                 if (Config.inventory.Count == 0)
                 {
                     logger.LogError("No purchasable items in cached config, ignoring.");
                     Config = new UnibillConfiguration(XML, platform, logger);
                 }
                 else
                 {
                     logger.Log(string.Format("Using cached config with {0} purchasable items", Config.inventory.Count));
                     XML = val;
                 }
             } catch (Exception e) {
                 logger.LogError("Error parsing inventory: {0}", e.Message);
                 Config = new UnibillConfiguration(XML, platform, logger);
             }
         }
         refreshCachedConfig(Config.HostedConfigUrl, logger);
     }
     else
     {
         logger.Log("Not using cached inventory, using bundled.");
         Config = new UnibillConfiguration(XML, platform, logger);
     }
 }
示例#27
0
 public ProductIdRemapper(UnibillConfiguration config)
 {
     this.db = config;
     initialiseForPlatform(config.CurrentPlatform);
 }
 public StorekitMassImportTemplateGenerator(UnibillConfiguration config, IEditorUtil util)
 {
     this.config = config;
     this.util = util;
 }
示例#29
0
 public StorekitMassImportTemplateGenerator(UnibillConfiguration config, IEditorUtil util)
 {
     this.config = config;
     this.util   = util;
 }
示例#30
0
 public RawBillingPlatformProvider(UnibillConfiguration config) {
     this.config = config;
 }
示例#31
0
 public GooglePlayCSVGenerator(IEditorUtil util, UnibillConfiguration config)
 {
     this.util   = util;
     this.config = config;
 }
示例#32
0
 private static UnibillConfiguration getConfig () {
     if (_config == null) {
         _config = new UnibillConfiguration(getResourceLoader(), getParser(), getUtil(), getLogger());
     }
     return _config;
 }
 public AmazonJSONGenerator(UnibillConfiguration config)
 {
     this.config = config;
 }
示例#34
0
 public ProductIdRemapper(UnibillConfiguration config)
 {
     this.db = config;
     initialiseForPlatform(config.CurrentPlatform);
 }
示例#35
0
 public ProductIdRemapper (InventoryDatabase db, UnibillXmlParser parser, UnibillConfiguration config) {
     this.db = db;
     this.parser = parser;
     initialiseForPlatform(config.CurrentPlatform);
 }
 public RawBillingPlatformProvider(UnibillConfiguration config)
 {
     this.config = config;
 }
示例#37
0
 public CurrencyManager(UnibillConfiguration config, IStorage storage)
 {
     this.storage = storage;
     this.config  = config;
     Currencies   = config.currencies.Select <VirtualCurrency, string>(x => x.currencyId).ToArray();
 }
 public RawBillingPlatformProvider(UnibillConfiguration config)
 {
     this.config = config;
     this.gameObject = new GameObject ();
 }
 public GooglePlayCSVGenerator(IEditorUtil util, UnibillConfiguration config)
 {
     this.util = util;
     this.config = config;
 }
 public RawBillingPlatformProvider(UnibillConfiguration config)
 {
     this.config     = config;
     this.gameObject = new GameObject();
 }
示例#41
0
 public SamsungAppsBillingService(UnibillConfiguration config, IRawSamsungAppsBillingService rawSamsung)
 {
     this.config     = config;
     this.rawSamsung = rawSamsung;
 }