private void SetBag() { BagElement bgE; for (int i = 0; i < 4; i++) { bgE = new BagElement(); bgE.isLocked = false; bgE.bagEType = BagElementType.Tools; bgE.elementTypeIndex = i; bgE.count = 1; bagL.Add(bgE); } int bagUpgradeLevel = StoreInventory.GetGoodUpgradeLevel(AnimineStoreAssets.BAG_VG_ITEM_ID); bagCapacity = (bagUpgradeLevel * 2 + 2) * 10; for (int i = 4; i < bagUpgradeLevel * 2 + 6; i++) { bgE = new BagElement(); bgE.isLocked = false; bagL.Add(bgE); } for (int i = bagUpgradeLevel * 2 + 6; i < 16; i++) { bgE = new BagElement(); bgE.isLocked = true; bagL.Add(bgE); } refreashBag(); }
public async Task <IActionResult> Edit(int id, [Bind("StoreID,ProductID,StockLevel")] StoreInventory storeInventory) { if (id != storeInventory.StoreID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(storeInventory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreInventoryExists(storeInventory.StoreID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductID"] = new SelectList(_context.Products, "ProductID", "ProductID", storeInventory.ProductID); ViewData["StoreID"] = new SelectList(_context.Stores, "StoreID", "StoreID", storeInventory.StoreID); return(View(storeInventory)); }
// Use this for initialization void Start() { balance = StoreInventory.GetItemBalance(ShapeValeStore.NO_ADS_LIFETIME_PRODUCT_ID); tempbox = null; screens = GameObject.FindGameObjectWithTag("screens").gameObject; AssignScreens(screens); defeated = false; victorious = false; paused = false; adz = null; if (GameObject.FindGameObjectWithTag("ads") != null) { adz = GameObject.FindGameObjectWithTag("ads").gameObject; } if ((balance > 0) && (adz != null)) { ads.destroystarting(); } if ((balance > 0) && (adz != null) && (ads.destroyending())) { Destroy(adz); } { //it exists } }
void InitializeEquippedGear() { // Check for equipped gear (head) foreach (Item gear in equipmentsHead.Values) { if (StoreInventory.IsVirtualGoodEquipped(gear.itemId)) { equippedHead = gear; break; } } // Check for equipped gear (body) foreach (Item gear in equipmentsBody.Values) { if (StoreInventory.IsVirtualGoodEquipped(gear.itemId)) { equippedBody = gear; break; } } // Check for equipped gear (legs) foreach (Item gear in equipmentsLegs.Values) { if (StoreInventory.IsVirtualGoodEquipped(gear.itemId)) { equippedLegs = gear; break; } } }
// Use this for initialization void Start() { Screen.sleepTimeout = (int)SleepTimeout.NeverSleep; anim = GetComponent <tk2dAnimatedSprite>(); flipped = hasflipped = false; // set character skin if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.ANDY_GOOD.ItemId)) { anim.Play("Andy"); } if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.KELLY_GOOD.ItemId)) { anim.Play("Kelly"); } if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.NINJA_GOOD.ItemId)) { anim.Play("Ninja"); } if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.PIG_GOOD.ItemId)) { anim.Play("Pig"); } if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.PIRATE_GOOD.ItemId)) { anim.Play("Pirate"); } if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.WIZARD_GOOD.ItemId)) { anim.Play("Wizard"); } }
public ActionResult CreateStoreInventory(StoreInventoryVM inventoryVM) { if (ModelState.IsValid) { try { if (_storeBL.inventoryExists(inventoryVM.ProductID, inventoryVM.StoreID)) { _product = _storeBL.getProductByID(inventoryVM.ProductID); _store = _storeBL.getStoreByID(inventoryVM.StoreID); int storeItemQuantity = _storeBL.getInventoryQuantity(_product, _store); StoreInventory storeInventory = _storeBL.getInventoryItem(_product, _store); storeInventory.InventoryQuantity = storeItemQuantity + inventoryVM.InventoryQuantity; _storeBL.updateStoreInventory(storeInventory); } else { _storeBL.addProductToInventory(_mapper.cast2StoreInventory(inventoryVM)); } return(RedirectToAction(nameof(Index))); } catch { return(View()); } } return(View()); }
// Show ads at the game over screen and unlock death achievements public void showGameOverAds() { go_count++; string death_count = go_count.ToString(); // Unlock achievement for dying specific number of times #if UNITY_ANDROID switch (death_count) { case "10": Achievements.justGettingTheHangOfItAchievement(); break; case "20": Achievements.thisGetsEasierRightAchievement(); break; case "30": Achievements.masochistAchievement(); break; case "50": Achievements.soMuchDeathAchievement(); break; } #endif if (go_count % ad_frequency == 0 && StoreInventory.GetItemBalance(SOAPStoreAssets.NO_ADS_LIFETIME_PRODUCT_ID) == 0) { Chartboost.showInterstitial(CBLocation.GameOver); Debug.Log("show the ads now!"); } }
public void GiveTokens(int amount) { this.tokens += amount; StoreInventory.GiveItem(GnomeStoreAssets.TokenId, amount); this.NotifyTokensChanged(); }
private void InitStoreData() { VirtualCurrencies = StoreInfo.Currencies; VirtualGoods = StoreInfo.Goods; VirtualCurrencyPacks = StoreInfo.CurrencyPacks; VirtualGoodsDictionary = new Dictionary <string, VirtualGood>(); foreach (VirtualGood virtualGood in VirtualGoods) { VirtualGoodsDictionary.Add(virtualGood.ItemId, virtualGood); } this.UpdateStoreBalances(); Debug.Log("GNOME: Notifying Shop Data Initialized"); this.NotifyShopDataInitialized(); // Give 10 tokens for free if it's the first time playing if (PlayerPrefsFast.GetBool(SharedResources.FirstTimeUserKey, true)) { StoreInventory.GiveItem(GnomeStoreAssets.TokenId, 10); PlayerPrefsFast.SetBool(SharedResources.FirstTimeUserKey, false); PlayerPrefsFast.Flush(); } this.NotifyTokensChanged(); }
public ActionResult Save(StoreInventory si) { bool success = false; string message = ""; if (si.status == 0) { if (si.AddInventory()) { success = true; message = "Item Added Successfully"; } else { success = false; message = "Item Adding Failed Details Might be duplicated"; } } else { if (si.UpdateInvenory()) { success = true; message = "Item Updated Successfully"; } else { success = false; message = "Item Updation Failed Details Might be duplicated"; } } return(Json(new { success = success, message = message }, JsonRequestBehavior.AllowGet)); }
// Show ads at the game over screen and unlock death achievements public void showGameOverAds() { go_count++; string death_count = go_count.ToString(); // Unlock achievement for dying specific number of times #if UNITY_ANDROID switch (death_count) { case "10": Achievements.unlockAchivement(GPGSIds.achievement_just_getting_the_hang_of_it); break; case "20": Achievements.unlockAchivement(GPGSIds.achievement_this_gets_easier_right); break; case "30": Achievements.unlockAchivement(GPGSIds.achievement_masochist); break; case "50": Achievements.unlockAchivement(GPGSIds.achievement_so_much_death); break; } #endif if (go_count % ad_frequency == 0 && StoreInventory.GetItemBalance(SOAPStoreAssets.NO_ADS_LIFETIME_PRODUCT_ID) == 0) { Chartboost.showInterstitial(CBLocation.GameOver); Debug.Log("Show the ads now!"); } }
public async Task <IActionResult> NewRequest(int ProductID, [Bind("StoreID,ProductID,StockLevel")] StoreInventory StoreInventory) { if (ProductID != StoreInventory.ProductID) { return(NotFound()); } if (ModelState.IsValid) { var newRequest = new StockRequest(); newRequest.ProductID = ProductID; newRequest.StoreID = StoreInventory.StoreID; newRequest.Quantity = StoreInventory.StockLevel; try { _context.StockRequests.Add(newRequest); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { } return(RedirectToAction(nameof(StoreInventory))); } StoreInventory.Product = await _context.Products.SingleOrDefaultAsync(m => m.ProductID == ProductID); StoreInventory.Store = await _context.Stores.SingleOrDefaultAsync(s => s.StoreID == StoreInventory.StoreID); return(View(StoreInventory)); }
public void OnCoinCollected(Coin coin) { // Debug.Log("give coin"); //it has huge overhead to be called every few frame StoreInventory.GiveItem(MashinRunAssets .MASHIN_RUN_CURRENCY_ITEM_ID, coin.amount); }
public void OnGameSceneLoaded() { thisSessionCoins = 0; coinsUntilThisSession = StoreInventory.GetItemBalance (MashinRunAssets.MASHIN_RUN_CURRENCY_ITEM_ID); TraveledDistance = 0f; }
void OnEnable() { int batteryUpgradeIndex = StoreInventory.GetGoodUpgradeLevel(AnimineStoreAssets.BATTERY_VG_ITEM_ID); BATTERY_DURATION = Constants.BATTERY_DURATION[batteryUpgradeIndex]; StartCoroutine(countdown(BATTERY_DURATION * StoreInventory.GetItemBalance(AnimineStoreAssets.BATTERY_VG_ITEM_ID))); }
public void resetTimer() { //PauseGame(); string ItemId = AndysApplesAssets.LONGEVITY_GOOD.ItemId; int level = StoreInventory.GetGoodUpgradeLevel(ItemId); endSoundPlaying = !endSoundPlaying; //AndyUtils.LogDebug(TAG, "Setting time to default"); countDownSeconds = 60; if (db.getStatus(3)) // returns if longevity is on or off { if (level < 6) { countDownSeconds += (5 * level); } else { countDownSeconds += 25; } } //AndyUtils.LogDebug(TAG, "CountdownSeconds are now " + countDownSeconds); DisplayTimer(); //ResumeGame(); }
public async Task UpdateStoreInventory(int sid, int pid, int quantity) { var storeInventoryToUpdate = await _context.StoreInventory.Where(s => s.ProductID == pid) .Where(s => s.StoreID == sid).SingleOrDefaultAsync(); try { if (storeInventoryToUpdate == null) { var storeinventory = new StoreInventory() { StoreID = sid, ProductID = pid, StockLevel = 1, }; _context.Add(storeinventory); } else { storeInventoryToUpdate.StockLevel += quantity; await _context.SaveChangesAsync(); } } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log.) ModelState.AddModelError("", "Unable to save Store Inventory changes."); } }
void BuyVirtualItem(string itemId) { if (itemId != null) { switch (buyItemWith) { case BuyMethods.VirtualCurrency: if (StoreInventory.CanAfford(itemId)) { StoreInventory.BuyItem(itemId); } else { Debug.Log("You Dont Have Enough Balance to Buy this Product !"); } break; case BuyMethods.Upgrade: if (StoreInventory.CanAfford(itemId)) { StoreInventory.UpgradeGood(itemId); } else { Debug.Log("You Dont Have Enough Balance to Buy this Product !"); } break; case BuyMethods.Market: SoomlaStore.BuyMarketItem(itemId, "Developer Payload"); break; } } }
//private int heroIndex; public void init(string id, int index, string name, int heroIndex, Sprite img) { this.index = index; this.id = id; //this.heroIndex = heroIndex; ch_name.text = name; ch_price.text = AnimineStoreAssets.HEROS_PRICE[heroIndex] + ""; ch_img.sprite = img; buy.onClick.AddListener(() => { OnElementBuy(); }); select.onClick.AddListener(() => { OnEquip(); }); if (StoreInventory.GetItemBalance(id) > 0) { ch_price.gameObject.SetActive(false); buy.gameObject.SetActive(false); bool selected = StoreInventory.IsVirtualGoodEquipped(id); selectedLabel.SetActive(selected); select.gameObject.SetActive(!selected); //if(selected) //GameControl.current.CharacterChanged (index); } }
/// <summary> /// Determines whether the specified character is owned by the player. /// </summary> public bool IsOwned(CharacterType character) { // Character is owned if its item balance in the inventory is 1 (non-zero) string charItemID = CRCAssets.CharactersLTVGArray[(int)character].ItemId; return(StoreInventory.GetItemBalance(charItemID) > 0); }
// Coroutine of booster working IEnumerator CreatingBombs() { busy = true; StoreInventory.TakeItem("freebombs", 1); yield return(StartCoroutine(Utils.WaitFor(SessionAssistant.main.CanIWait, 0.1f))); SessionAssistant.main.EventCounter(); FieldAssistant.main.AddPowerup(Powerup.SimpleBomb); yield return(new WaitForSeconds(0.1f)); FieldAssistant.main.AddPowerup(Powerup.SimpleBomb); yield return(new WaitForSeconds(0.1f)); FieldAssistant.main.AddPowerup(Powerup.SimpleBomb); yield return(new WaitForSeconds(0.1f)); FieldAssistant.main.AddPowerup(Powerup.CrossBomb); yield return(new WaitForSeconds(0.1f)); FieldAssistant.main.AddPowerup(Powerup.CrossBomb); yield return(new WaitForSeconds(0.1f)); FieldAssistant.main.AddPowerup(Powerup.ColorBomb); busy = false; }
/// <summary> /// Resets game data. /// </summary> public void ResetGameData() { // Take the first launch reward (so it can be given again) m_firstLaunchReward.Take(); // Reset coin balance to 0 SetCoinBalance(0); // Unequip equipped character EquippableVG vg = StoreInventory.GetEquippedVirtualGood(CRCAssets.GetCharactersCategory()); if (vg != null) { StoreInventory.UnEquipVirtualGood(vg.ItemId); } // Remove all characters from inventory for (int index = 0; index < CRCAssets.CharactersLTVGArray.Length; ++index) { VirtualGood charVG = CRCAssets.CharactersLTVGArray[index]; if (charVG != null) { charVG.ResetBalance(0); } } // Reset other data SoomlaDataSystem dataSystem = (SoomlaDataSystem)Locator.GetDataSystem(); dataSystem.ResetGameData(); // Reset all characters to unused for (int index = 0; index < CRCAssets.CharactersLTVGArray.Length; ++index) { dataSystem.SetCharacterUsed((CharacterType)index, false); } }
public void EquipItem(Item item) { // Update the cache if (item.type == ItemType.eq_head) { equippedHead = item; StoreInventory.EquipVirtualGood(item.itemId); } else if (item.type == ItemType.eq_body) { equippedBody = item; StoreInventory.EquipVirtualGood(item.itemId); } else if (item.type == ItemType.eq_legs) { equippedLegs = item; StoreInventory.EquipVirtualGood(item.itemId); } else if (item.type == ItemType.item_consumable) { for (int i = 0; i < Game.instance.bagSlots; i++) { if (equippedConsumables[i].itemId == "empty") { equippedConsumables[i] = item; itemsConsumable[item.itemId].balance--; break; } } } }
void Start() { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.DEFAULT_BG.ItemId)) { sky.SetSprite(bkgdSpriteCollection, "newbg 1"); tree.SetSprite(bkgdSpriteCollection, "treeland"); canopy.SetSprite(bkgdSpriteCollection, "treetop"); ray.SetSprite(bkgdSpriteCollection, "hugeray"); bottom.SetSprite(bkgdSpriteCollection, "treeland_bottom"); scoreBack.gameObject.SetActive(false); counterback.gameObject.SetActive(false); } if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.CBLOSSOM_BG.ItemId)) { sky.SetSprite(bkgdSpriteCollection2, "bg_blossom"); tree.SetSprite(bkgdSpriteCollection2, "tree_cherry"); canopy.SetSprite(bkgdSpriteCollection2, "cherryblossombgtop"); ray.SetSprite(bkgdSpriteCollection2, "hugeray2"); bottom.SetSprite(bkgdSpriteCollection2, "tree_cherry_bottom"); scoreBack.gameObject.SetActive(true); counterback.gameObject.SetActive(true); } }
// Use this for initialization void Start() { ChartBoostAndroid.onStart(); StoreController.Initialize(new AndysApplesAssets()); //if (StoreInventory.GetItemBalance(AndysApplesAssets.SUPER_SEED_GOOD.ItemId) == 0) // StoreInventory.GiveItem(AndysApplesAssets.SUPER_SEED_GOOD.ItemId, 2); // Acquire default player skin "Andy" and equip him for use in game. // This is is only run on the first startup of the game or if data is deleted. if (StoreInventory.GetItemBalance(AndysApplesAssets.ANDY_GOOD.ItemId) == 0) { StoreInventory.GiveItem(AndysApplesAssets.ANDY_GOOD.ItemId, 1); StoreInventory.EquipVirtualGood(AndysApplesAssets.ANDY_GOOD.ItemId); } // Acquire default background and equip it for use in game. // This is is only run on the first startup of the game or if data is deleted. if (StoreInventory.GetItemBalance(AndysApplesAssets.DEFAULT_BG.ItemId) == 0) { StoreInventory.GiveItem(AndysApplesAssets.DEFAULT_BG.ItemId, 1); StoreInventory.EquipVirtualGood(AndysApplesAssets.DEFAULT_BG.ItemId); } }
void CheckTouch3(Vector3 pos) { Vector3 wp = Camera.main.ScreenToWorldPoint(pos); hit3 = Physics2D.OverlapPoint(new Vector2(wp.x, wp.y)); if (hit3 != null && hit3.gameObject == gameObject) { if (StoreInventory.GetItemBalance("coin_currency_ID") < 5000) { soundHandler.PlayButtonClickUp(); GameObject.Find("Heart Purchase Banner(Clone)").GetComponent <PurchaseHeartsBannerController> ().SetInstantiateCoinsScreen(true); GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().GetRidOfScreen(); } else { GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().AddToCoinTotal(-5000); GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetHeartNumber(5); GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().UpdateCoinNumber(); soundHandler.PlayCashRegister(); if (GameObject.Find("Level Controller") == null) { GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().SetGetRidOfShade(true); } else { GameObject.Find("Heart Purchase Banner(Clone)").GetComponent <PurchaseHeartsBannerController> ().SetHeartsPurchased(); } GameObject.Find("Screen Handlers").GetComponent <PurchaseLivesScreen> ().GetRidOfScreen(); } } }
public override void OnStartServer() { base.OnStartServer(); if (debug) { Debug.Log("Store Manager: Loading information for store number: " + storeNumber); } StoreInventory storeInventory = SojournDBM.odbm.GetStoreInventory(storeNumber); if (storeInventory == null) { throw new System.Exception("There is no database entry for a store with this number: " + storeNumber); } /* Keep an original version of the store inventory */ originalStoreInventory.Apply(storeInventory); /* This is the inventory that we will actually use */ currentStoreInventory.Apply(new StoreInventory(originalStoreInventory)); /* Reset the store reset timer */ storeResetTimer = STORE_RESET_TIME; PopulateShopSlots(); }
///Ação de compra executada pelo botão Comprar public IEnumerator buyChar(CharType type) { if (Application.internetReachability != NetworkReachability.NotReachable) { Powlitico pow = controller.powliticoForCharType(type); try{ //Tento comprar o personagem StoreInventory.BuyItem(pow.storeValues.PRODUCT_ID); }catch (Exception e) { if (purchase) { purchase.CloseWindow(); } Debug.Log("unity/soomla:" + e.Message); } } else { purchase.CloseWindow(); LoadAlertConnection(); } yield return(null); }
// Coroutine of special control mode IEnumerator Finger() { yield return(StartCoroutine(Utils.WaitFor(SessionAssistant.main.CanIWait, 0.1f))); Chip targetChip = null; while (true) { if (Input.GetMouseButtonDown(0) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)) { targetChip = ControlAssistant.main.GetChipFromTouch(); } if (targetChip != null) { if (targetChip.gameObject.GetComponent <SimpleChip>() != null) { Slot slot = targetChip.parentSlot.slot; FieldAssistant.main.AddPowerup(slot.x, slot.y, Powerup.SimpleBomb); SessionAssistant.main.EventCounter(); break; } } yield return(0); } StoreInventory.TakeItem("finger", 1); UIServer.main.ShowPage("Field"); }
public IActionResult BuyPost(StoreInventory storeInventory) { int availableQty = _context.StoreInventory.Where(x => x.ProductID == storeInventory.ProductID) .Where(x => x.StoreID == storeInventory.StoreID).Select(x => x.StockLevel).First(); if (storeInventory.StockLevel > availableQty) { ModelState.AddModelError("StockLevel", "Requested Quantity cannot be greater than available stock"); storeInventory.StockLevel = availableQty; return(View(storeInventory)); } CartViewModel cart = new CartViewModel(); cart.ProductID = storeInventory.ProductID; cart.ProductName = storeInventory.Product.Name; cart.StoreID = storeInventory.StoreID; cart.StoreName = storeInventory.Store.Name; cart.Price = storeInventory.Product.Price; cart.Quantity = storeInventory.StockLevel; cart.TotalPrice = cart.Quantity * cart.Price; //process the key and store in session string cartkey = cart.ProductID + "/" + cart.StoreID; HttpContext.Session.Set <CartViewModel>(cartkey, cart); return(RedirectToAction(nameof(Index))); }