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"); } }
//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); } }
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); } }
public void selectIt() { if (StoreInventory.GetItemBalance(id) > 0) { bool selected = StoreInventory.IsVirtualGoodEquipped(id); selectedLabel.SetActive(selected); select.gameObject.SetActive(!selected); } }
public void EquipPirate() { string itemId = AndysApplesAssets.PIRATE_GOOD.ItemId; AndyUtils.LogDebug(TAG, "StoreInventory.IsVirtualGoodEquipped(" + itemId + ") is " + !StoreInventory.IsVirtualGoodEquipped(itemId)); if (!StoreInventory.IsVirtualGoodEquipped(itemId)) { StoreInventory.EquipVirtualGood(itemId); pirate.displayEquipStats(true); // turn all others off if (StoreInventory.GetItemBalance(AndysApplesAssets.ANDY_GOOD.ItemId) == 1) { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.ANDY_GOOD.ItemId)) { StoreInventory.UnEquipVirtualGood(AndysApplesAssets.ANDY_GOOD.ItemId); } andy.displayEquipStats(false); } if (StoreInventory.GetItemBalance(AndysApplesAssets.KELLY_GOOD.ItemId) == 1) { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.KELLY_GOOD.ItemId)) { StoreInventory.UnEquipVirtualGood(AndysApplesAssets.KELLY_GOOD.ItemId); } kelly.displayEquipStats(false); } if (StoreInventory.GetItemBalance(AndysApplesAssets.NINJA_GOOD.ItemId) == 1) { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.NINJA_GOOD.ItemId)) { StoreInventory.UnEquipVirtualGood(AndysApplesAssets.NINJA_GOOD.ItemId); } ninja.displayEquipStats(false); } if (StoreInventory.GetItemBalance(AndysApplesAssets.PIG_GOOD.ItemId) == 1) { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.PIG_GOOD.ItemId)) { StoreInventory.UnEquipVirtualGood(AndysApplesAssets.PIG_GOOD.ItemId); } pig.displayEquipStats(false); } if (StoreInventory.GetItemBalance(AndysApplesAssets.WIZARD_GOOD.ItemId) == 1) { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.WIZARD_GOOD.ItemId)) { StoreInventory.UnEquipVirtualGood(AndysApplesAssets.WIZARD_GOOD.ItemId); } wizard.displayEquipStats(false); } } }
//get the selected car from resources (the car which player //selected in the main menu) public GameObject GetCarFromResources() { GameObject selectedCar = null; List <GameObject> cars = DataManager .GetAllDataFromResourcesFolder <GameObject>("Cars"); foreach (GameObject car in cars) { //if car is equipped(selected) if ((car.GetComponentInChildren <Car>()) && (car.GetComponentInChildren <Car>().carData) && (StoreInventory.IsVirtualGoodEquipped( car.GetComponentInChildren <Car>().carData.itemId))) { selectedCar = car; } } return(selectedCar.transform.root.gameObject); }
public void EquipBlossomBG() { string itemId = AndysApplesAssets.CBLOSSOM_BG.ItemId; AndyUtils.LogDebug(TAG, "StoreInventory.IsVirtualGoodEquipped(" + itemId + ") is " + !StoreInventory.IsVirtualGoodEquipped(itemId)); if (!StoreInventory.IsVirtualGoodEquipped(itemId)) { StoreInventory.EquipVirtualGood(itemId); blossomBG.displayEquipStats(true); // turn all others off if (StoreInventory.GetItemBalance(AndysApplesAssets.DEFAULT_BG.ItemId) == 1) { if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.DEFAULT_BG.ItemId)) { StoreInventory.UnEquipVirtualGood(AndysApplesAssets.DEFAULT_BG.ItemId); } defaultBG.displayEquipStats(false); } } }
public void Start() { string ItemId; handler = new AndyEventHandler(); AndyUtils.LogDebug(TAG, "LocalStoreInfo Initializing"); LocalStoreInfo.Init(); AndyUtils.LogDebug(TAG, "LocalStoreInfo Initialized"); AndyUtils.LogDebug(TAG, "CurrencyBalance: " + StoreInventory.GetItemBalance(AndysApplesAssets.COMBO_CURRENCY_ITEM_ID)); currencyBalanceLabel.text = StoreInventory.GetItemBalance(AndysApplesAssets.COMBO_CURRENCY_ITEM_ID).ToString(); ItemId = AndysApplesAssets.SHIELD_POTION_GOOD.ItemId; AndyUtils.LogDebug(TAG, "Shield Balace is " + StoreInventory.GetItemBalance(ItemId)); shieldBalance.text = StoreInventory.GetItemBalance(ItemId).ToString(); ItemId = AndysApplesAssets.ENERGY_POTION_GOOD.ItemId; AndyUtils.LogDebug(TAG, "Energy Balance is " + StoreInventory.GetItemBalance(ItemId)); energyBalance.text = StoreInventory.GetItemBalance(ItemId).ToString(); ItemId = AndysApplesAssets.SUPER_SEED_GOOD.ItemId; AndyUtils.LogDebug(TAG, "Seed Balance is " + StoreInventory.GetItemBalance(ItemId)); seedBalance.text = StoreInventory.GetItemBalance(ItemId).ToString(); displayInfo(); // Initialize skins if (StoreInventory.GetItemBalance(AndysApplesAssets.ANDY_GOOD.ItemId) == 1) { andy.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.ANDY_GOOD.ItemId)) { andy.displayEquipStats(true); } else { andy.displayEquipStats(false); } } if (StoreInventory.GetItemBalance(AndysApplesAssets.KELLY_GOOD.ItemId) == 1) { kelly.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.KELLY_GOOD.ItemId)) { kelly.displayEquipStats(true); } else { kelly.displayEquipStats(false); } } else { kelly.notPurchased(); } if (StoreInventory.GetItemBalance(AndysApplesAssets.NINJA_GOOD.ItemId) == 1) { ninja.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.NINJA_GOOD.ItemId)) { ninja.displayEquipStats(true); } else { ninja.displayEquipStats(false); } } else { ninja.notPurchased(); } if (StoreInventory.GetItemBalance(AndysApplesAssets.PIG_GOOD.ItemId) == 1) { pig.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.PIG_GOOD.ItemId)) { pig.displayEquipStats(true); } else { pig.displayEquipStats(false); } } else { pig.notPurchased(); } if (StoreInventory.GetItemBalance(AndysApplesAssets.PIRATE_GOOD.ItemId) == 1) { pirate.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.PIRATE_GOOD.ItemId)) { pirate.displayEquipStats(true); } else { pirate.displayEquipStats(false); } } else { pirate.notPurchased(); } if (StoreInventory.GetItemBalance(AndysApplesAssets.WIZARD_GOOD.ItemId) == 1) { wizard.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.WIZARD_GOOD.ItemId)) { wizard.displayEquipStats(true); } else { wizard.displayEquipStats(false); } } else { wizard.notPurchased(); } int i = 0; foreach (var vg in LocalStoreInfo.VirtualGoods) { AndyUtils.LogDebug(TAG, "[" + i + "].ItemId= " + vg.ItemId); i++; } StoreController.StoreOpening(); // initialize backgrounds if (StoreInventory.GetItemBalance(AndysApplesAssets.DEFAULT_BG.ItemId) == 1) { defaultBG.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.DEFAULT_BG.ItemId)) { defaultBG.displayEquipStats(true); } else { defaultBG.displayEquipStats(false); } } if (StoreInventory.GetItemBalance(AndysApplesAssets.CBLOSSOM_BG.ItemId) == 1) { AndyUtils.LogDebug(TAG, "Running allowEquipping() for " + AndysApplesAssets.CBLOSSOM_BG.ItemId); blossomBG.allowEquipping(); if (StoreInventory.IsVirtualGoodEquipped(AndysApplesAssets.CBLOSSOM_BG.ItemId)) { blossomBG.displayEquipStats(true); } else { blossomBG.displayEquipStats(false); } } else { AndyUtils.LogDebug(TAG, "Running notPurchased() for " + AndysApplesAssets.CBLOSSOM_BG.ItemId); blossomBG.notPurchased(); } }