Ejemplo n.º 1
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);
    }
 public static void CreateManifestIfNecessary()
 {
     if (!File.Exists(AndroidManifestPath) && InventoryPostProcessor.ShouldWriteInventory())
     {
         AssetDatabase.CopyAsset("Assets/Plugins/unibill/static/Manifest.xml", AndroidManifestPath);
         AssetDatabase.ImportAsset(AndroidManifestPath);
     }
 }
Ejemplo n.º 3
0
    private void serialise()
    {
        using (StreamWriter o = new StreamWriter(InventoryPostProcessor.UNIBILL_JSON_INVENTORY_PATH)) {
            var json = MiniJSON.jsonEncode(config.Serialize());
            o.Write(json);
        }

        try {
            AssetDatabase.ImportAsset(InventoryPostProcessor.UNIBILL_JSON_INVENTORY_PATH);
        } catch (Exception) {
        }

        UnibillInjector.GetStorekitGenerator().writeFile(BillingPlatform.AppleAppStore);
        UnibillInjector.GetStorekitGenerator().writeFile(BillingPlatform.MacAppStore);
        UnibillInjector.GetGooglePlayCSVGenerator().writeCSV();
        UnibillInjector.GetAmazonGenerator().encodeAll();

        AssetDatabase.ImportAsset("Assets/Plugins/unibill/resources/amazon.sdktester.json.txt");
        AndroidManifestGenerator.mergeManifest();
        InventoryPostProcessor.DeleteLegacyFiles();
    }