public void watchVideo() { Debug.Log("watchvideoad"); SoundManager.Instance.PlayClickSound(); GameAnalytics.NewDesignEvent("VideoClicked"); AdHandler.GetInstance().showVideoAd(); }
IEnumerator showAd() { yield return(new WaitForSeconds(0.7f)); Debug.Log("Arslan::gameoverAnimCompleteCB"); AdHandler.GetInstance().showInterstatial(); }
void initInfiniteGamePlay() { scorePanel.SetActive(true); levelStarsPanel.SetActive(false); for (int i = 0; i < 4; i++) { groundBox.localPosition = new Vector3(0, -3 * (i + 1), 0); Transform box = BoxPattern.getInstance().getRandomBoxPattern(); Transform boxObj = Instantiate(box, new Vector3(0, -3 * i, 0), Quaternion.identity) as Transform; boxObj.parent = transform; boxObj.localPosition = new Vector3(0, -3 * i, 0); lastBoxPosition = boxObj.localPosition; } addStarGameObject(10); updateScores(0, null); if (numOfStars >= 30) { popButtonGameObject.GetComponent <Image>().sprite = Resources.Load("PopStar", typeof(Sprite)) as Sprite; popButtonGameObject.SetActive(true); } else if (AdHandler.GetInstance().IsVideoAdAvailable()) { popButtonGameObject.GetComponent <Image>().sprite = Resources.Load("PopVideo", typeof(Sprite)) as Sprite; popButtonGameObject.SetActive(true); } else { popButtonGameObject.SetActive(false); } }
public void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary <string, string> extra) { Debug.Log("Arslan::InApp::onMarketPurchase pvi id = " + pvi.ID); if (pvi.ID.Equals("stars100")) { GameManager.Instance.addStars(100); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "Stars", 100, "IAP", "Stars100"); } else if (pvi.ID.Equals("stars500")) { GameManager.Instance.addStars(500); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "Stars", 500, "IAP", "Stars500"); } else if (pvi.ID.Equals("stars1000")) { GameManager.Instance.addStars(1000); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "Stars", 1000, "IAP", "Stars1000"); } else if (pvi.ID.Equals("removead")) { AdHandler.GetInstance().hideAdmobBanner(); ZPlayerPrefs.SetInt("ads", 0); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "RemoveAd", 100, "IAP", "RemoveAd"); } }
void ActivateVideoAdBtn() { if (!AdHandler.GetInstance().IsVideoAdAvailable()) { VidAdBtn.SetActive(false); } else { VidAdBtn.SetActive(true); } }
public void popButtonClicked() { if (numOfStars < 30) { AdHandler.GetInstance().showVideoAd(videoActionComplete); } else { numOfStars -= 30; popButtonGameObject.SetActive(false); StartCoroutine("popBlocks1"); } }
public void shareButtonClick() { GameAnalytics.NewDesignEvent("shareButtonClick"); Debug.Log("share"); SoundManager.Instance.PlayClickSound(); homeBtn.SetActive(false); shareBtn.SetActive(false); AdHandler.GetInstance().hideAdmobBanner(); #if UNITY_IPHONE // GameObject.Find("SharePanel").GetComponent<GeneralSharing>().OnShareTextWithImage(); StartCoroutine(ShareManager.Share(homeBtn, shareBtn)); #endif #if UNITY_ANDROID StartCoroutine(ShareManager.Share(homeBtn, shareBtn)); #endif }
public static IEnumerator Share(GameObject homeBtn, GameObject shareBtn) { string dateAndTime = System.DateTime.Now.ToString(); dateAndTime = dateAndTime.Replace("/", "-"); string screenshotName = "ScreenShot" + "_" + dateAndTime + ".png"; string screenshotPath = Path.Combine(Application.persistentDataPath, screenshotName); Debug.Log("Arslan:: imagePath = " + screenshotPath); // string filename = "ScreenN123.png"; Application.CaptureScreenshot(screenshotName); while (!System.IO.File.Exists(screenshotPath)) { Debug.Log("Arslan:: waiting "); yield return(null); } homeBtn.SetActive(true); shareBtn.SetActive(true); AdHandler.GetInstance().showAdmobBanner(); #if UNITY_ANDROID //instantiate the class Intent AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent"); //instantiate the object Intent AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent"); //call setAction setting ACTION_SEND as parameter intentObject.Call <AndroidJavaObject>("setAction", intentClass.GetStatic <string>("ACTION_SEND")); //instantiate the class Uri AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri"); //instantiate the object Uri with the parse of the url's file AndroidJavaObject uriObject = uriClass.CallStatic <AndroidJavaObject>("parse", "file://" + screenshotPath); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_STREAM"), uriObject); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_SUBJECT"), GameConstants.SHARE_SUBJECT); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TITLE"), GameConstants.SHARE_TITLE); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TEXT"), GameConstants.SHARE_TEXT); //set the type of file intentObject.Call <AndroidJavaObject>("setType", "image/jpeg"); //instantiate the class UnityPlayer AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); //instantiate the object currentActivity AndroidJavaObject currentActivity = unity.GetStatic <AndroidJavaObject>("currentActivity"); // option one WITHOUT chooser: //currentActivity.Call("startActivity", intentObject); // option two WITH chooser: AndroidJavaObject jChooser = intentClass.CallStatic <AndroidJavaObject>("createChooser", intentObject, GameConstants.SHARE_SUBJECT); currentActivity.Call("startActivity", jChooser); #endif #if UNITY_IOS GeneralSharingiOSBridge.ShareTextWithImage(screenshotPath, GameConstants.SHARE_TEXT_IOS); #endif }
void StartBanner() { AdHandler.GetInstance().showAdmobBanner(); }
public void onVideoAd() { SoundManager.Instance.PlayClickSound(); GameAnalytics.NewDesignEvent("VideoClicked"); AdHandler.GetInstance().showVideoAd(); }
IEnumerator showGameOver() { yield return(new WaitForSeconds(3.0f)); int gameOverCount = ZPlayerPrefs.GetInt(GameConstants.GAMEOVER_COUNT_STRING, 0); ZPlayerPrefs.SetInt(GameConstants.GAMEOVER_COUNT_STRING, gameOverCount + 1); GameAnalytics.NewDesignEvent("GameOver", (float)gameOverCount); GameAnalytics.NewDesignEvent("GameOverNew"); ZPlayerPrefs.SetInt(GameConstants.CURRENTSCORE_STRING, currentScore); ZPlayerPrefs.SetInt(GameConstants.BESTSCORE_STRING, bestScore); ZPlayerPrefs.SetInt(GameConstants.GLOBALSTARS_STRING, numOfStars); int socialCount = PlayerPrefs.GetInt(GameConstants.SOCIAL_COUNT_STRING, 0); PlayerPrefs.SetInt(GameConstants.SOCIAL_COUNT_STRING, socialCount + 1); if (gameOverCount % 3 == 0 && GameConstants.LEVEL_TO_LOAD == 0) { // AdHandler.GetInstance().showInterstatial(); StartCoroutine("showAd"); } else if (gameOverCount % 3 == 0 && GameConstants.LEVEL_TO_LOAD != 0) { AdHandler.GetInstance().showInterstatial(); } if (GameConstants.LEVEL_TO_LOAD == 0) { isPauseMenu = true; gameoverPanel.SetActive(true); gameoverScoreText.text = "" + currentScore; iTween.ScaleTo(gameoverBG.gameObject, iTween.Hash( "scale", Vector3.one, "easeType", iTween.EaseType.easeInOutBack, "loopType", iTween.LoopType.none, "time", 0.75f, "oncomplete", "gameoverAnimCompleteCB", "oncompletetarget", gameObject)); if (Social.localUser.authenticated) { SendScore(); } else { Debug.Log("User not logged in. Score not sent to leaderboard"); } } else { if (starCount == 3) { PlayerPrefs.SetInt(GameConstants.LEVEL_STRING + (levelData.levelNumber + 1), 1); if (levelData.levelNumber + 1 >= 99) { GameAnalytics.NewDesignEvent("EndLevel99"); } } SceneManager.LoadScene("LevelScene"); } }