public VirtualCurrencyPack(string name, string description, string itemId, string productId, double price, int currencyAmount, VirtualCurrency currency) : base(name, description, itemId) { this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price); this.CurrencyAmount = currencyAmount; this.Currency = currency; }
public static void Init () { // List<VirtualCategory> category = StoreInfo.GetVirtualCategories(); AndyUtils.LogDebug(TAG, "getting Virtual Goods"); VirtualGoods = StoreInfo.GetVirtualGoods(); // List<VirtualGood> good = StoreInfo.GetVirtualGoods (); AndyUtils.LogDebug(TAG, "getting Virtual Currency"); VirtualCurrency = StoreInfo.GetVirtualCurrencies()[0]; AndyUtils.LogDebug(TAG, "Got Virtual Currency"); AndyUtils.LogDebug(TAG, "Seperating Virtual Goods by Category"); // foreach (VirtualGood vg in good) { // Debug.Log ("AAUNITY/SOOMLA - VG name: " + vg.Name + ", id: " + vg.ItemId + ", category: " + StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name); // if(StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name == "Powerup") { // VirtualGoodPowerups.Add (vg); // } // if(StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name == "Upograde") { // VirtualGoodUpgrades.Add (vg); // } // if(StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name == "Unlockable") { // VirtualGoodUnlockables.Add(vg); // } // } AndyUtils.LogDebug(TAG, "Finished Seperating"); VirtualCurrencyPacks = StoreInfo.GetVirtualCurrencyPacks (); UpdateBalances (); }
public VirtualCurrencyPack(AndroidJavaObject jniVirtualCurrencyPack) : base(jniVirtualCurrencyPack) { this.CurrencyAmount = jniVirtualCurrencyPack.Call<int>("getCurrencyAmount"); // Google Market Item AndroidJavaObject jniGoogleMarketItem = jniVirtualCurrencyPack.Call<AndroidJavaObject>("getGoogleItem"); this.MarketItem = new MarketItem(jniGoogleMarketItem); // Virtual Currency AndroidJavaObject jniVirtualCurrency = jniVirtualCurrencyPack.Call<AndroidJavaObject>("getVirtualCurrency"); this.Currency = new VirtualCurrency(jniVirtualCurrency); }
public void onCurrencyBalanceChanged(string message) { StoreUtils.LogDebug(TAG, "SOOMLA/UNITY onCurrencyBalanceChanged:" + message); string[] vars = Regex.Split(message, "#SOOM#"); VirtualCurrency vc = (VirtualCurrency)StoreInfo.GetItemByItemId(vars[0]); int balance = int.Parse(vars[1]); int amountAdded = int.Parse(vars[2]); Events.OnCurrencyBalanceChanged(vc, balance, amountAdded); }
public VirtualCurrencyPack(JSONObject jsonVcp) : base(jsonVcp) { this.CurrencyAmount = System.Convert.ToInt32(((JSONObject)jsonVcp[JSONConsts.CURRENCYPACK_AMOUNT]).n); this.MarketItem = new MarketItem(jsonVcp); string currencyItemId = jsonVcp[JSONConsts.CURRENCYPACK_CURRENCYITEMID].str; try { this.Currency = StoreInfo.GetVirtualCurrencyByItemId(currencyItemId); } catch { Debug.Log("Couldn't find the associated currency. itemId: " + currencyItemId); } }
/// <summary> /// Disparado al cambiar el balance de la moneda actual /// </summary> /// <param name="virtualCurrency">Moneda que ha cambiado</param> /// <param name="balance">Balance</param> /// <param name="amountAdded">Cantidad agregada</param> public void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded) { LocalStoreInfo.UpdateBalance(virtualCurrency.ItemId, balance); }
public static VirtualCurrency GetVirtualCurrencyByItemId(string itemId) { #if UNITY_ANDROID VirtualCurrency vc = null; AndroidJNI.PushLocalFrame(100); using(AndroidJavaObject jniVirtualCurrency = AndroidJNIHandler.CallStatic<AndroidJavaObject>( new AndroidJavaClass("com.soomla.unity.StoreInfo"),"getVirtualCurrencyByItemId", itemId)) { vc = new VirtualCurrency(jniVirtualCurrency); } AndroidJNI.PopLocalFrame(IntPtr.Zero); return vc; #elif UNITY_IOS IntPtr p = IntPtr.Zero; int err = storeInfo_GetCurrencyByItemId(itemId, out p); IOS_ErrorCodes.CheckAndThrowException(err); string json = Marshal.PtrToStringAnsi(p); Marshal.FreeHGlobal(p); JSONObject obj = new JSONObject(json); return new VirtualCurrency(obj); #else return null; #endif }