public void NativeInit() { if (nativeAd != null) { nativeAd.Destroy(); nativeAd = null; } string adUnitId = ""; if (Application.platform == RuntimePlatform.IPhonePlayer) { adUnitId = "ca-app-pub-7619324821036210/1135180686"; } else { adUnitId = "ca-app-pub-7619324821036210/4647050289"; } AdSize adsize = new AdSize(300, 100); AdPosition adPosition = AdPosition.Top; nativeAd = new NativeExpressAdView(adUnitId, adsize, adPosition); RegisterNativeCallback(); }
public void Play() { if (PlayerPrefs.GetString("type") == "names") { SceneManager.LoadScene(1, LoadSceneMode.Single); } else if (PlayerPrefs.GetString("type") == "passiton") { SceneManager.LoadScene(2, LoadSceneMode.Single); } bannerView.Destroy(); }
public void AdDestory() { try { if (nativeExpressAdView != null) { nativeExpressAdView.Destroy(); } } catch { } }
public override void OnDestroy() { try { // Destroy the NativeExpressAdView. native.Destroy(); native.Visibility = ViewStates.Gone; base.OnDestroy(); } catch (Exception e) { Console.WriteLine(e); } }
public void CleanNativeAds() { nativeExpressAdView.Destroy(); isNativeAdLoaded = false; }
void Update() { progressColor.transform.localPosition = Vector3.Lerp(new Vector3(-390, 0), Vector3.zero, int.Parse(scoreText.text) / barLength); progressColor.transform.localScale = Vector3.Lerp(new Vector3(0, 1, 1), Vector3.one, int.Parse(scoreText.text) / barLength); if (score > int.Parse(scoreText.text)) { scoreText.text = (int.Parse(scoreText.text) + 1).ToString(); } if (Input.GetMouseButtonDown(0)) { Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero); if (hit.collider != null) { if (hit.collider.CompareTag("Chooser")) { chooser = hit.collider.gameObject; chooser.GetComponent <Chooser> ().Choose(); fieldControlls.FadeCells(chooser.GetComponent <Chooser> ().GetNumber()); if (PlayerPrefs.GetString("Sound") == "on") { chooser.GetComponent <AudioSource> ().Play(); } } } } if (Input.GetMouseButton(0)) { Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero); if (chooser != null) { if (hit.collider != null && hit.collider.CompareTag("Cell") && !hit.collider.GetComponent <Cell> ().IsFade()) { if (activeCell != null && hit.collider.gameObject != activeCell && activeCell.GetComponent <Cell>().IsChoose()) { activeCell.GetComponent <Animation> ().Play("CellAntiChoose"); activeCell.GetComponent <Cell> ().AntiChoose(); } activeCell = hit.collider.gameObject; if (!activeCell.GetComponent <Cell> ().IsChoose()) { activeCell.GetComponent <Cell> ().Choose(); activeCell.GetComponent <Animation> ().Play("CellChoose"); } } else { if (activeCell != null && activeCell.GetComponent <Cell> ().IsChoose()) { activeCell.GetComponent <Animation> ().Play("CellAntiChoose"); activeCell.GetComponent <Cell> ().AntiChoose(); } } } } if (Input.GetMouseButtonUp(0)) { Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero); if (chooser != null) { if (hit.collider != null && hit.collider.gameObject.CompareTag("Cell") && chooser.transform.IsChildOf(bottomBar.transform) && hit.collider.gameObject.GetComponent <Cell> ().ChangeNumber(chooser.GetComponent <Chooser> ().GetNumber(), fieldControlls.GetRange())) { chooser.GetComponent <Chooser> ().Delete(hit.collider.gameObject.transform.localPosition); fieldControlls.IncreaseChooserCount(false); if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <AudioSource> ().Play(); } StartCoroutine(LateCheckTurns()); } else { chooser.GetComponent <Chooser> ().GetBack(); if (PlayerPrefs.GetString("Sound") == "on") { chooser.transform.GetChild(0).GetComponent <AudioSource> ().Play(); } } if (activeCell != null) { activeCell.GetComponent <Cell> ().AntiChoose(); activeCell.GetComponent <Animation> ().Play("CellAntiChoose"); activeCell = null; } chooser = null; fieldControlls.AntiFadeCells(); } if (hit.collider != null && hit.collider.name == "Pause") { Pause(); if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <AudioSource> ().Play(); } } if (hit.collider != null && hit.collider.name == "Restart Button") { if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <AudioSource> ().Play(); field.GetComponent <AudioSource> ().Play(); } if (loseScreen.activeSelf) { GetComponent <Animation> ().Play("RestartFromLose"); StartCoroutine(LoadScene("Game")); } else { GetComponent <Animation> ().Play("RestartFromPause"); StartCoroutine(LoadScene("Game")); } if (banner != null) { banner.Destroy(); } if (banner2 != null) { banner2.Destroy(); } } if (hit.collider != null && hit.collider.name == "Menu Button") { if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <AudioSource> ().Play(); field.transform.GetChild(0).GetComponent <AudioSource> ().Play(); } if (loseScreen.activeSelf) { GetComponent <Animation> ().Play("MenuFromLose"); StartCoroutine(LoadScene("Menu")); } else { GetComponent <Animation> ().Play("MenuFromPause"); StartCoroutine(LoadScene("Menu")); } if (banner != null) { banner.Destroy(); } if (banner2 != null) { banner2.Destroy(); } } if (hit.collider != null && hit.collider.name == "Music Button") { if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <AudioSource> ().Play(); } if (PlayerPrefs.GetString("Music") == "on") { hit.collider.GetComponent <Animation> ().Play("MusicOff"); PlayerPrefs.SetString("Music", "off"); audioC.transform.GetChild(modeNumber).GetComponent <AudioSource> ().Pause(); } else { hit.collider.GetComponent <Animation> ().Play("MusicOn"); PlayerPrefs.SetString("Music", "on"); audioC.transform.GetChild(modeNumber).GetComponent <AudioSource> ().UnPause(); } } if (hit.collider != null && hit.collider.name == "Sound Button") { if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <AudioSource> ().Play(); } if (PlayerPrefs.GetString("Sound") == "on") { hit.collider.GetComponent <Animation> ().Play("SoundOff"); PlayerPrefs.SetString("Sound", "off"); } else { hit.collider.GetComponent <Animation> ().Play("SoundOn"); PlayerPrefs.SetString("Sound", "on"); } } } }