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; }
/// <summary> /// This function gives a curtain amout of <c>VirtualGood</c>s according to the given amount and the amount in the pack. /// </summary> /// <param name="amount">amount the amount of the specific item to be given.</param> /// <param name="notify">notify of change in user's balance of current virtual item.</param> public override int Give(int amount, bool notify) { SingleUseVG good = null; try { good = (SingleUseVG)StoreInfo.GetItemByItemId(GoodItemId); } catch (VirtualItemNotFoundException) { SoomlaUtils.LogError(TAG, "SingleUseVG with itemId: " + GoodItemId + " doesn't exist! Can't give this pack."); return(0); } return(VirtualGoodsStorage.Add(good, GoodAmount * amount, notify)); }
public VirtualGood Complete() { VirtualGood good; PurchaseType purchase = null; if (currency == Currency.Dollars) purchase = new PurchaseWithMarket(sku, price); if (currency == Currency.Seeds) purchase = new PurchaseWithVirtualItem("seed", Mathf.CeilToInt(price)); if (consumable) good = new SingleUseVG(name, description, id, purchase); else good = new LifetimeVG(name, description, id, purchase); return good; }