private static void OnRetrieveProductsFinised(BillingResult result) { AndroidInAppPurchaseManager.ActionRetrieveProducsFinished -= OnRetrieveProductsFinised; if (result.isSuccess) { foreach (GoogleProductTemplate tpl in AndroidInAppPurchaseManager.instance.inventory.products) { for (int i = 0; i < GUI_Shop.GetInstance().containerShopCoins.transform.childCount; i++) { ShopContent content = GUI_Shop.GetInstance().containerShopCoins.transform.GetChild(i).gameObject.GetComponent <ShopContent>(); if (tpl.SKU.Equals(content.uniqueID)) { GameManager.SetNGUILabel(content.transform.Find("Label Price"), tpl.price); Transform trButtonBuy = content.transform.Find("ButtonBuy"); if (trButtonBuy) { trButtonBuy.gameObject.SetActive(true); } break; } } } } else { //AndroidMessage.Create("Connection Responce", result.response.ToString() + " " + result.message); } Debug.Log("Connection Response: " + result.response.ToString() + " " + result.message); }
private static void OnProductConsumed(BillingResult result) { if (result.isSuccess) { GUI_Shop.GetInstance().OnSuccessfulPurchase(result.purchase.SKU); } else { } Debug.LogError("OnProductConsumed " + result.response.ToString()); }
public void OnClickAdsButton() { GUI_Shop.GetInstance().OnClickFreeEnergy(); GUI_Dialog.ReleaseTopCanvas(); }
public void OnClickSpin() { currCoin = GameManager.GEMUCOINS; currCoin -= 100; GameManager.GEMUCOINS = currCoin; PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, currCoin); GUI_InGame.instance.RefreshGemuCoinInfo(); Debug.Log("spin gacha"); int itemWon = 0, contentChild = 0; Transform trChild; Gamestate_Gameplay gs = GameObject.Find("Gamestate").GetComponent <Gamestate_Gameplay>(); if (gs == null) { return; } //play animation if (Random.value >= 0 && Random.value <= 0.1) { itemWon = Random.Range(0, 4); } else { itemWon = Random.Range(4, gachaList.Count); } gs.ShowDialogBox("Info", "You got " + gachaList [itemWon], false, "", this.gameObject); switch (itemWon) { case 0: contentChild = 1; trChild = GUI_Shop.GetInstance().containerShopJoystick.transform.GetChild(contentChild); setShopItem(trChild, "joystick"); break; case 1: contentChild = 2; trChild = GUI_Shop.GetInstance().containerShopJoystick.transform.GetChild(contentChild); setShopItem(trChild, "joystick"); break; case 2: contentChild = 1; trChild = GUI_Shop.GetInstance().containerShopClaw.transform.GetChild(contentChild); setShopItem(trChild, "claw"); break; case 3: contentChild = 2; trChild = GUI_Shop.GetInstance().containerShopClaw.transform.GetChild(contentChild); setShopItem(trChild, "claw"); break; case 4: contentChild = 0; trChild = GUI_Shop.GetInstance().containerShopPowerups.transform.GetChild(contentChild); setShopItem(trChild, "powerup"); break; case 5: contentChild = 1; trChild = GUI_Shop.GetInstance().containerShopPowerups.transform.GetChild(contentChild); setShopItem(trChild, "powerup"); break; case 6: contentChild = 2; trChild = GUI_Shop.GetInstance().containerShopPowerups.transform.GetChild(contentChild); setShopItem(trChild, "powerup"); break; case 7: contentChild = 3; trChild = GUI_Shop.GetInstance().containerShopPowerups.transform.GetChild(contentChild); setShopItem(trChild, "powerup"); break; case 8: contentChild = 4; trChild = GUI_Shop.GetInstance().containerShopPowerups.transform.GetChild(contentChild); setShopItem(trChild, "powerup"); break; } if (currCoin < 100) { buttonGachaActive.gameObject.SetActive(false); buttonGachaInactive.gameObject.SetActive(true); } else { buttonGachaActive.gameObject.SetActive(true); buttonGachaInactive.gameObject.SetActive(false); } }
public void OnClickShop() { GUI_Dialog.InsertStack(guiShop.gameObject); GUI_Shop.GetInstance().RefreshInfo(); }
public void OnSuccessfulPurchase(string SKU) { Gamestate gs = GameObject.Find("Gamestate").GetComponent <Gamestate>(); if (gs) { //gs.achievementManager.OnAchievementEvent(AchievementType.ShopTime,1); } Transform trChild; // for ( int i=0; i<GUI_Shop.GetInstance().containerShopCoins.transform.childCount; i++ ) // { // Transform trChild = GUI_Shop.GetInstance().containerShopCoins.transform.GetChild(i); // if ( trChild ) // { // ShopContent content = trChild.gameObject.GetComponent<ShopContent>(); // if ( content && content.type == ShopContentType.IAP ) // { // if ( content.uniqueID == SKU ) // { // gs.ShowDialogBox("Info","You bought "+content.Amount+" GemuGold",false,"",GUI_Shop.GetInstance().gameObject); // GameManager.GEMUCOINS += content.Amount; // PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin,GameManager.GEMUCOINS); // RefreshInfo(); // /*GameDataManager.instance.SendPlayResult( // GameDataManager.instance.gameID.ToString(),"0", // GameManager.GEMUCOINS.ToString(), // GameManager.EXP.ToString(), // GameManager.getLevelValue().ToString());*/ // //GL1Connector.GetInstance().PlayResult(this.gameObject,GameManager.getLevelValue().ToString(),"0",GameManager.EXP.ToString(),GameManager.GEMUCOINS.ToString()); // GL1Connector.GetInstance().AddBalance(this.gameObject,"",content.Amount.ToString(),"","BUYGOLD"+content.Amount.ToString()); // if ( gs.GetComponent<Gamestate_Gameplay>() ) // { // Gamestate_Gameplay gsPlay = gs.GetComponent<Gamestate_Gameplay>(); // gsPlay.RefreshAllInfo(); // } // break; // } // } // } // } for (int k = 1; k < GUI_Shop.GetInstance().containerShopFreeCoins.transform.childCount - 2; k++) { trChild = GUI_Shop.GetInstance().containerShopFreeCoins.transform.GetChild(k); if (trChild) { ShopContent content = trChild.gameObject.GetComponent <ShopContent>(); if (content && content.type == ShopContentType.IAP) { if (content.uniqueID == SKU) { GameManager.FREECOINS += content.Amount; gs.ShowDialogBox("Info", "You just bought " + content.Name, false, "confirm", this.gameObject); RefreshInfo(); if (!PlayerPrefs.HasKey(PlayerPrefHandler.keyEnergyAch)) { Social.ReportProgress(GPGSIds.achievement_the_spender, 100.0f, (bool success) => { // handle success or failure //gs.achievementManager.AddToFinalAchievementEvent(); }); PlayerPrefs.SetInt(PlayerPrefHandler.keyEnergyAch, 1); PlayerPrefs.Save(); } break; } } } } for (int i = 1; i < GUI_Shop.GetInstance().containerShopJoystick.transform.childCount; i++) { trChild = GUI_Shop.GetInstance().containerShopJoystick.transform.GetChild(i); if (trChild) { ShopContent content = trChild.gameObject.GetComponent <ShopContent>(); if (content && content.type == ShopContentType.IAP) { if (content.uniqueID == SKU) { gs.ShowDialogBox("Info", "You just bought " + content.Name, false, "confirm", this.gameObject); Transform trButtonBuy = content.transform.Find("ButtonBuy"); GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip"); PlayerPrefs.SetInt("joystick." + content.uniqueID, 1); break; } } } } for (int j = 1; j < GUI_Shop.GetInstance().containerShopClaw.transform.childCount; j++) { trChild = GUI_Shop.GetInstance().containerShopClaw.transform.GetChild(j); if (trChild) { ShopContent content = trChild.gameObject.GetComponent <ShopContent>(); if (content && content.type == ShopContentType.IAP) { if (content.uniqueID == SKU) { gs.ShowDialogBox("Info", "You just bought " + content.Name, false, "confirm", this.gameObject); Transform trButtonBuy = content.transform.Find("ButtonBuy"); GameManager.SetNGUILabel(trButtonBuy.transform.Find("Label"), "Equip"); PlayerPrefs.SetInt("claw." + content.uniqueID, 1); break; } } } } PlayerPrefs.Save(); int playerClaw = 0, playerJoystick = 0; if (PlayerPrefs.HasKey("claw.clawmania.claw2")) { if (PlayerPrefs.GetInt("claw.clawmania.claw2") == 1) { playerClaw++; } } if (PlayerPrefs.HasKey("claw.clawmania.claw3")) { if (PlayerPrefs.GetInt("claw.clawmania.claw3") == 1) { playerClaw++; } } if (playerClaw >= 2) { Social.ReportProgress(GPGSIds.achievement_serious_grabber, 100.0f, (bool success) => { // handle success or failure //gs.achievementManager.AddToFinalAchievementEvent(); }); } if (PlayerPrefs.HasKey("claw.clawmania.joystick2")) { if (PlayerPrefs.GetInt("claw.clawmania.joystick2") == 1) { playerJoystick++; } } if (PlayerPrefs.HasKey("claw.clawmania.joystick3")) { if (PlayerPrefs.GetInt("claw.clawmania.joystick3") == 1) { playerJoystick++; } } if (playerJoystick >= 2) { Social.ReportProgress(GPGSIds.achievement_fancy_grabber, 100.0f, (bool success) => { // handle success or failure //gs.achievementManager.AddToFinalAchievementEvent(); }); } }