public VirtualGood[] GetGoods() { int i = 5; VirtualGood[] virtualGoods = new VirtualGood[i]; virtualGoods[--i] = new SingleUseVG("ItemBalanceGate", "", ITEM_ID_BALANCE_GATE, #if UNITY_ANDROID new PurchaseWithMarket("android.test.purchased", 1)); #else new PurchaseWithMarket("noads3", 1)); #endif virtualGoods[--i] = new SingleUseVG("ItemBalanceMission", "", ITEM_ID_BALANCE_MISSION, new PurchaseWithMarket(ITEM_ID_BALANCE_MISSION, 1)); virtualGoods[--i] = new SingleUseVG("ItemBalanceMissionReward", "", ITEM_ID_BALANCE_MISSION_REWARD, new PurchaseWithMarket(ITEM_ID_BALANCE_MISSION_REWARD, 1)); virtualGoods[--i] = new SingleUseVG("ItemVIScore", "", ITEM_ID_VI_SCORE, new PurchaseWithMarket(ITEM_ID_VI_SCORE, 1)); virtualGoods[--i] = new SingleUseVG("ItemVIReward", "", ITEM_ID_VI_REWARD, new PurchaseWithMarket(ITEM_ID_VI_REWARD, 1)); return virtualGoods; }
protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) { AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniStorageManager = new AndroidJavaClass("com.soomla.store.data.StorageManager")) { using(AndroidJavaObject jniVGStorage = jniStorageManager.CallStatic<AndroidJavaObject>("getVirtualGoodsStorage")) { jniVGStorage.Call("assignCurrentUpgrade", good.ItemId, upgradeVG.ItemId, notify); } } AndroidJNI.PopLocalFrame(IntPtr.Zero); }
private void Awake() { this.VirtualGood = this.GetVirtualGood(); this.ItemId = this.VirtualGood.ItemId; this.Description.text = this.VirtualGood.Name; this.Info.text = this.VirtualGood.Description; StoreEvents.OnGoodBalanceChanged += this.OnGoodBalanceChanged; ShopManager.Instance.ShopDataInitializedEvent += this.OnShopDataInitialized; }
public void PushEventOnGoodBalanceChanged(VirtualGood good, int balance, int amountAdded) { var eventJSON = new JSONObject(); eventJSON.AddField("itemId", good.ItemId); eventJSON.AddField("balance", balance); eventJSON.AddField("amountAdded", amountAdded); _pushEventGoodBalanceChanged(eventJSON.print()); }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { string upgradeVGItemId; int err = vgStorage_GetCurrentUpgrade(good.ItemId, out upgradeVGItemId); IOS_ErrorCodes.CheckAndThrowException(err); if (!string.IsNullOrEmpty(upgradeVGItemId)) { return (UpgradeVG) StoreInfo.GetItemByItemId(upgradeVGItemId); } return null; }
/// <summary> /// Handles an <c>onGoodBalanceChanged</c> event, which is fired when the balance of a specific /// <c>VirtualGood</c> has changed. /// </summary> /// <param name="message">Message that contains information about the good whose balance has /// changed.</param> public void onGoodBalanceChanged(string message) { SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodBalanceChanged:" + message); string[] vars = Regex.Split(message, "#SOOM#"); VirtualGood vg = (VirtualGood)StoreInfo.GetItemByItemId(vars[0]); int balance = int.Parse(vars[1]); int amountAdded = int.Parse(vars[2]); StoreEvents.OnGoodBalanceChanged(vg, balance, amountAdded); }
/// <summary> /// Removes all upgrades from the virtual good with the given <c>goodItemId</c>. /// </summary> /// <param name="goodItemId">Id of the good whose upgrades are to be removed.</param> /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception> public static void RemoveGoodUpgrades(string goodItemId) { SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY Calling RemoveGoodUpgrades with: " + goodItemId); List <UpgradeVG> upgrades = StoreInfo.GetUpgradesForVirtualGood(goodItemId); foreach (UpgradeVG upgrade in upgrades) { VirtualGoodsStorage.Remove(upgrade, 1, true); } VirtualGood good = (VirtualGood)StoreInfo.GetItemByItemId(goodItemId); VirtualGoodsStorage.RemoveUpgrades(good); }
/// <summary> /// Retrieves the current upgrade of the good with the given id. /// </summary> /// <param name="goodItemId">Id of the good whose upgrade we want to fetch. </param> /// <returns>The good's current upgrade.</returns> /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception> public static string GetGoodCurrentUpgrade(string goodItemId) { SoomlaUtils.LogDebug(TAG, "Checking " + goodItemId + " current upgrade"); VirtualGood good = (VirtualGood)StoreInfo.GetItemByItemId(goodItemId); UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good); if (upgradeVG == null) { return(""); } return(upgradeVG.ItemId); }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { SoomlaWpStore.domain.virtualGoods.UpgradeVG uvg = null; SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId); if (vg is SoomlaWpStore.domain.virtualGoods.UpgradeVG) { uvg = SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().getCurrentUpgrade(vg); } if (uvg!=null) { return (UpgradeVG) StoreInfo.GetItemByItemId(uvg.GetId()); } return null; }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { string upgradeVGItemId; int err = vgStorage_GetCurrentUpgrade(good.ItemId, out upgradeVGItemId); IOS_ErrorCodes.CheckAndThrowException(err); if (!string.IsNullOrEmpty(upgradeVGItemId)) { return((UpgradeVG)StoreInfo.GetItemByItemId(upgradeVGItemId)); } return(null); }
/// <summary> /// Takes upgrade from the user, or in other words DOWNGRADES the associated /// <code>VirtualGood</code> (mGood). /// Checks if the current Upgrade is really associated with the <code>VirtualGood</code> and: /// </summary> /// <param name="amount">NOT USED HERE!.</param> /// <param name="notify">see parent.</param> public override int Take(int amount, bool notify) { VirtualGood good = null; try { good = (VirtualGood)StoreInfo.GetItemByItemId(GoodItemId); } catch (VirtualItemNotFoundException) { SoomlaUtils.LogError(TAG, "VirtualGood with itemId: " + GoodItemId + " doesn't exist! Can't downgrade."); return(0); } UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good); // Case: Upgrade is not assigned to this Virtual Good if (upgradeVG != this) { SoomlaUtils.LogError(TAG, "You can't take an upgrade that's not currently assigned." + "The UpgradeVG " + Name + " is not assigned to " + "the VirtualGood: " + good.Name); return(0); } if (!string.IsNullOrEmpty(PrevItemId)) { UpgradeVG prevUpgradeVG = null; // Case: downgrade is not possible because previous upgrade does not exist try { prevUpgradeVG = (UpgradeVG)StoreInfo.GetItemByItemId(PrevItemId); } catch (VirtualItemNotFoundException) { SoomlaUtils.LogError(TAG, "Previous UpgradeVG with itemId: " + PrevItemId + " doesn't exist! Can't downgrade."); return(0); } // Case: downgrade is successful! SoomlaUtils.LogDebug(TAG, "Downgrading " + good.Name + " to: " + prevUpgradeVG.Name); VirtualGoodsStorage.AssignCurrentUpgrade(good, prevUpgradeVG, notify); } // Case: first Upgrade in the series - so we downgrade to NO upgrade. else { SoomlaUtils.LogDebug(TAG, "Downgrading " + good.Name + " to NO-UPGRADE"); VirtualGoodsStorage.RemoveUpgrades(good, notify); } return(base.Take(amount, notify)); }
/// <summary> /// Handles an <c>onGoodUpgrade</c> event, which is fired when a specific <c>UpgradeVG</c> has /// been upgraded/downgraded. /// </summary> /// <param name="message">Message that contains information about the good that has been /// upgraded/downgraded.</param> public void onGoodUpgrade(string message) { SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodUpgrade:" + message); string[] vars = Regex.Split(message, "#SOOM#"); VirtualGood vg = (VirtualGood)StoreInfo.GetItemByItemId(vars[0]); UpgradeVG vgu = null; if (vars.Length > 1) { vgu = (UpgradeVG)StoreInfo.GetItemByItemId(vars[1]); } StoreEvents.OnGoodUpgrade(vg, vgu); }
void bought(VirtualGood arg1, UpgradeVG arg2) { if (upgrades) { int upgdLevel = StoreInventory.GetGoodUpgradeLevel (id); if(upgdLevel==5){ el_desc.text = LanguageManager.current.getText(LanguageNode.FullUpgraded); buy.gameObject.SetActive(false); el_upgradeMeter.fillAmount = 1f; }else{ el_upgradeMeter.fillAmount = upgdLevel / 5f; el_price.text = AnimineStoreAssets.UPGRADE_PRICE [upgdLevel]+""; } } }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { string upgradeVGItemId = null; SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId); if (vg is SoomlaWpStore.domain.virtualGoods.UpgradeVG) { upgradeVGItemId = SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().getCurrentUpgrade(vg).getItemId(); } if (!string.IsNullOrEmpty(upgradeVGItemId)) { return (UpgradeVG) StoreInfo.GetItemByItemId(upgradeVGItemId); } return null; }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { SoomlaWpStore.domain.virtualGoods.UpgradeVG uvg = null; SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId); if (vg is SoomlaWpStore.domain.virtualGoods.UpgradeVG) { uvg = SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().getCurrentUpgrade(vg); } if (uvg != null) { return((UpgradeVG)StoreInfo.GetItemByItemId(uvg.GetId())); } return(null); }
/** Unity-Editor Functions **/ protected virtual void _removeUpgrades(VirtualGood good, bool notify) { #if UNITY_EDITOR string itemId = good.ItemId; string key = keyGoodUpgrade(itemId); PlayerPrefs.DeleteKey(key); if (notify) { JSONObject eventJSON = new JSONObject(); eventJSON.AddField("itemId", good.ItemId); StoreEvents.Instance.onGoodUpgrade(eventJSON.print()); } #endif }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { string upgradeVGItemId; AndroidJNI.PushLocalFrame(100); using(AndroidJavaClass jniStorageManager = new AndroidJavaClass("com.soomla.store.data.StorageManager")) { using(AndroidJavaObject jniVGStorage = jniStorageManager.CallStatic<AndroidJavaObject>("getVirtualGoodsStorage")) { upgradeVGItemId = jniVGStorage.Call<string>("getCurrentUpgrade", good.ItemId); } } AndroidJNI.PopLocalFrame(IntPtr.Zero); if (!string.IsNullOrEmpty(upgradeVGItemId)) { return (UpgradeVG) StoreInfo.GetItemByItemId(upgradeVGItemId); } return null; }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { string upgradeVGItemId = null; SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId); if (vg is SoomlaWpStore.domain.virtualGoods.UpgradeVG) { upgradeVGItemId = SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().getCurrentUpgrade(vg).getItemId(); } if (!string.IsNullOrEmpty(upgradeVGItemId)) { return((UpgradeVG)StoreInfo.GetItemByItemId(upgradeVGItemId)); } return(null); }
public static void onGoodBalanceChanged(GoodBalanceChangedEvent _Event, bool alsoPush) { SoomlaWpStore.domain.virtualGoods.VirtualGood good = _Event.GetGood(); int balance = _Event.GetBalance(); int amountAdded = _Event.GetAmountAdded(); SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodBalanceChanged:" + good.getItemId() + " " + balance.ToString() + " " + amountAdded.ToString()); VirtualGood vg = (VirtualGood)StoreInfo.GetItemByItemId(good.getItemId()); StoreInventory.RefreshOnGoodBalanceChanged(vg, balance, amountAdded); StoreEvents.OnGoodBalanceChanged(vg, balance, amountAdded); if (alsoPush) { sep.PushEventOnGoodBalanceChanged(_Event); } }
/// <summary> /// Assigns the current upgrade to the associated <code>VirtualGood</code> (mGood). /// </summary> /// <param name="amount">NOT USED HERE!</param> /// <param name="notify">notify of change in user's balance of current virtual item.</param> public override int Give(int amount, bool notify) { SoomlaUtils.LogDebug(TAG, "Assigning " + Name + " to: " + GoodItemId); VirtualGood good = null; try { good = (VirtualGood)StoreInfo.GetItemByItemId(GoodItemId); } catch (VirtualItemNotFoundException) { SoomlaUtils.LogError(TAG, "VirtualGood with itemId: " + GoodItemId + " doesn't exist! Can't upgrade."); return(0); } VirtualGoodsStorage.AssignCurrentUpgrade(good, this, notify); return(base.Give(amount, notify)); }
protected override UpgradeVG _getCurrentUpgrade(VirtualGood good) { string upgradeVGItemId; AndroidJNI.PushLocalFrame(100); using (AndroidJavaClass jniStorageManager = new AndroidJavaClass("com.soomla.store.data.StorageManager")) { using (AndroidJavaObject jniVGStorage = jniStorageManager.CallStatic <AndroidJavaObject>("getVirtualGoodsStorage")) { upgradeVGItemId = jniVGStorage.Call <string>("getCurrentUpgrade", good.ItemId); } } AndroidJNI.PopLocalFrame(IntPtr.Zero); if (!string.IsNullOrEmpty(upgradeVGItemId)) { return((UpgradeVG)StoreInfo.GetItemByItemId(upgradeVGItemId)); } return(null); }
/// <summary> /// Determines if the user is in a state that allows him/her to buy an <code>UpgradeVG</code> /// This method enforces allowing/rejecting of upgrades here so users won't buy them when /// they are not supposed to. /// If you want to give your users free upgrades, use the <code>give</code> function. /// </summary> /// <returns><c>true</c>, if can buy, <c>false</c> otherwise.</returns> protected override bool canBuy() { VirtualGood good = null; try { good = (VirtualGood)StoreInfo.GetItemByItemId(GoodItemId); } catch (VirtualItemNotFoundException) { SoomlaUtils.LogError(TAG, "VirtualGood with itemId: " + GoodItemId + " doesn't exist! Returning NO (can't buy)."); return(false); } UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good); return(((upgradeVG == null && string.IsNullOrEmpty(PrevItemId)) || (upgradeVG != null && ((upgradeVG.NextItemId == this.ItemId) || (upgradeVG.PrevItemId == this.ItemId)))) && base.canBuy()); }
public static void onGoodUpgrade(GoodUpgradeEvent _Event, bool alsoPush) { SoomlaWpStore.domain.virtualGoods.VirtualGood good = _Event.GetGood(); SoomlaWpStore.domain.virtualGoods.UpgradeVG upgradeVG = _Event.GetUpgradeVG(); SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodUpgrade:" + good.getItemId() + " " + upgradeVG.getItemId()); VirtualGood vg = (VirtualGood)StoreInfo.GetItemByItemId(good.getItemId()); UpgradeVG vgu = null; if (upgradeVG != null) { vgu = (UpgradeVG)StoreInfo.GetItemByItemId(upgradeVG.getItemId()); } StoreInventory.RefreshOnGoodUpgrade(vg, vgu); StoreEvents.OnGoodUpgrade(vg, vgu); if (alsoPush) { sep.PushEventOnGoodUpgrade(_Event); } }
public void onGoodBalanceChanged(string message, bool alsoPush) { SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodBalanceChanged:" + message); JSONObject eventJSON = new JSONObject(message); VirtualGood vg = (VirtualGood)StoreInfo.GetItemByItemId(eventJSON["itemId"].str); int balance = (int)eventJSON["balance"].n; int amountAdded = (int)eventJSON["amountAdded"].n; StoreInventory.RefreshOnGoodBalanceChanged(vg, balance, amountAdded); StoreEvents.OnGoodBalanceChanged(vg, balance, amountAdded); if (alsoPush) { #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR sep.PushEventOnGoodBalanceChanged(vg, balance, amountAdded); #endif } }
/** A set of private functions to refresh the local inventory whenever there are changes on runtime. **/ public static void RefreshOnGoodUpgrade(VirtualGood vg, UpgradeVG uvg) { if (uvg == null) { localUpgrades.Remove(vg.ItemId); } else { int upgradeLevel = GetGoodUpgradeLevel(vg.ItemId); LocalUpgrade upgrade; if (localUpgrades.TryGetValue(vg.ItemId, out upgrade)) { upgrade.itemId = uvg.ItemId; upgrade.level = upgradeLevel; } else { localUpgrades.Add(vg.ItemId, new LocalUpgrade { itemId = uvg.ItemId, level = upgradeLevel }); } } }
protected virtual void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) { #if UNITY_EDITOR UpgradeVG upgrade = GetCurrentUpgrade(good); if (upgrade != null && upgrade.ItemId == upgradeVG.ItemId) { return; } string itemId = good.ItemId; string key = keyGoodUpgrade(itemId); string upItemId = upgradeVG.ItemId; PlayerPrefs.SetString(key, upItemId); if (notify) { var eventJSON = new JSONObject(); eventJSON.AddField("itemId", good.ItemId); eventJSON.AddField("upgradeItemId", upgradeVG.ItemId); StoreEvents.Instance.onGoodUpgrade(eventJSON.print()); } #endif }
protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) { int err = vgStorage_AssignCurrentUpgrade(good.ItemId, upgradeVG.ItemId, notify); IOS_ErrorCodes.CheckAndThrowException(err); }
public GoodBalanceChangedEvent (VirtualGood item, int balance, int amountAdded) : this(item, balance, amountAdded, null) { }
protected override void _removeUpgrades(VirtualGood good, bool notify) { int err = vgStorage_RemoveUpgrades(good.ItemId, notify); IOS_ErrorCodes.CheckAndThrowException(err); }
private void UpdateItemView(VirtualGood item) { var virtualStoreItemView = FindObjectsOfType<VirtualStoreItemView>() .SingleOrDefault(v => v.Item != null && v.Item.ItemId == item.ItemId); if (virtualStoreItemView != null) { virtualStoreItemView.Item = item; } }
/// <summary> /// Removes any upgrade associated with the given <code>VirtualGood</code>. /// </summary> /// <param name="good">VirtualGood to remove upgrade from.</param> /// <param name="notify">true will also post event.</param> public static void RemoveUpgrades(VirtualGood good, bool notify){ SoomlaUtils.LogDebug(TAG, "Removing upgrade information from virtual good: " + good.ItemId); instance._removeUpgrades(good, notify); }
/// <summary> /// Removes any upgrade associated with the given <code>VirtualGood</code>. /// </summary> /// <param name="good">VirtualGood to remove upgrade from.</param> public static void RemoveUpgrades(VirtualGood good) { RemoveUpgrades(good, true); }
protected virtual UpgradeVG _getCurrentUpgrade(VirtualGood good) { #if UNITY_EDITOR string itemId = good.ItemId; string key = keyGoodUpgrade(itemId); string upItemId = PlayerPrefs.GetString(key); if (string.IsNullOrEmpty(upItemId)) { SoomlaUtils.LogDebug(TAG, "You tried to fetch the current upgrade of " + good.ItemId + " but there's no upgrade for it."); return null; } try { return (UpgradeVG) StoreInfo.GetItemByItemId(upItemId); } catch (VirtualItemNotFoundException) { SoomlaUtils.LogError(TAG, "The current upgrade's itemId from the DB is not found in StoreInfo."); } catch (InvalidCastException) { SoomlaUtils.LogError(TAG, "The current upgrade's itemId from the DB is not an UpgradeVG."); } return null; #else return null; #endif }
/// <summary> /// Handles a good upgraded event. /// </summary> /// <param name="good">Virtual good that is being upgraded.</param> /// <param name="currentUpgrade">The current upgrade that the given virtual /// good is being upgraded to.</param> public void onGoodUpgrade(VirtualGood good, UpgradeVG currentUpgrade) { }
public void PushEventOnGoodUpgrade(VirtualGood good, UpgradeVG upgrade) { var eventJSON = new JSONObject(); eventJSON.AddField("itemId", good.ItemId); eventJSON.AddField("upgradeItemId", (upgrade==null ? null : upgrade.ItemId)); _pushEventGoodUpgrade(eventJSON.print()); }
/// <summary> /// Retrieves the current upgrade for the given virtual good. /// </summary> /// <param name="good">the virtual good to retrieve upgrade for.</param> /// <return>the current upgrade for the given virtual good.</return> public static UpgradeVG GetCurrentUpgrade(VirtualGood good) { SoomlaUtils.LogDebug(TAG, "Fetching upgrade to virtual good: " + good.ItemId); return(instance._getCurrentUpgrade(good)); }
/// <summary> /// Assigns a specific upgrade to the given virtual good. /// </summary> /// <param name="good">the virtual good to upgrade.</param> /// <param name="upgradeVG">the upgrade to assign.</param> /// <param name="notify">true will also post event.</param> public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify){ SoomlaUtils.LogDebug(TAG, "Assigning upgrade " + upgradeVG.ItemId + " to virtual good: " + good.ItemId); instance._assignCurrentUpgrade(good, upgradeVG, notify); }
private void OnGoodUpgrade(VirtualGood good, UpgradeVG currentUpgrade) { Debug.Log(string.Format("GNOME: GoodUpgrade - ItemId: {0}", good.ItemId)); }
public static void RefreshOnGoodBalanceChanged(VirtualGood good, int balance, int amountAdded) { UpdateLocalBalance(good.ItemId, balance); }
/// <summary> /// Handles a good balance changed event. /// </summary> /// <param name="good">Virtual good whose balance has changed.</param> /// <param name="balance">Balance.</param> /// <param name="amountAdded">Amount added.</param> public void onGoodBalanceChanged(VirtualGood good, int balance, int amountAdded) { }
/// <summary> /// Retrieves the current upgrade for the given virtual good. /// </summary> /// <param name="good">the virtual good to retrieve upgrade for.</param> /// <return>the current upgrade for the given virtual good.</return> public static UpgradeVG GetCurrentUpgrade(VirtualGood good){ SoomlaUtils.LogDebug(TAG, "Fetching upgrade to virtual good: " + good.ItemId); return instance._getCurrentUpgrade(good); }
protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) { SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId); SoomlaWpStore.domain.virtualGoods.UpgradeVG uvg = (SoomlaWpStore.domain.virtualGoods.UpgradeVG)SoomlaWpStore.data.StoreInfo.getVirtualItem(upgradeVG.ItemId); SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().assignCurrentUpgrade(vg, uvg, notify); }
public GoodBalanceChangedEvent (VirtualGood item, int balance, int amountAdded, Object sender) : base(sender) { mItem = item; mBalance = balance; mAmountAdded = amountAdded; }
/// <summary> /// Removes any upgrade associated with the given <code>VirtualGood</code>. /// </summary> /// <param name="good">VirtualGood to remove upgrade from.</param> public static void RemoveUpgrades(VirtualGood good){ RemoveUpgrades(good, true); }
/// <summary> /// Assigns a specific upgrade to the given virtual good. /// </summary> /// <param name="good">the virtual good to upgrade.</param> /// <param name="upgradeVG">the upgrade to assign.</param> public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG){ AssignCurrentUpgrade(good, upgradeVG, true); }
protected override void _removeUpgrades(VirtualGood good, bool notify) { SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId); SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().removeUpgrades(vg, notify); }
private void OnGoodBalanceChanged(VirtualGood vg, int balance, int amountAdded) { Debug.Log(string.Format("GNOME: VirtualGoodBalanceChanged - Id: {0}, Balance: {1}", vg.ItemId, balance)); GoodsBalances[vg.ItemId] = balance; }
// updating counters, when balance of goods changed void onGoodBalanceChanged(VirtualGood good, int balance, int amountAdded) { ItemCounter.RefreshAll (); }
/// <summary> /// Assigns a specific upgrade to the given virtual good. /// </summary> /// <param name="good">the virtual good to upgrade.</param> /// <param name="upgradeVG">the upgrade to assign.</param> public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG) { AssignCurrentUpgrade(good, upgradeVG, true); }