IEnumerator checkConnectionForLoginButton() { StartCoroutine(CheckInternetConnection.Instance.checkInternetConnection()); while (!CheckInternetConnection.Instance.checkDone) { yield return(null); } if (CheckInternetConnection.Instance.internetOK) { FacebookManager.KorisnikoviPodaciSpremni = false; ShopManagerFull.ShopInicijalizovan = false; if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } if (!FB.IsLoggedIn) { FacebookManager.MestoPozivanjaLogina = 2; FacebookManager.FacebookObject.FacebookLogin(); } } else { CheckInternetConnection.Instance.openPopup(); } }
void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } GameObject.Find(releasedItem).GetComponent <Collider>().enabled = false; System.GC.Collect(); Resources.UnloadUnusedAssets(); Application.LoadLevelAsync((StagesParser.currSetIndex * 10) + StagesParser.currStageIndex + 5); } else if (Input.GetMouseButtonDown(0)) { clickedItem = RaycastFunction(Input.mousePosition); if (clickedItem.Equals("Button_Continue") || clickedItem.Equals("Button_Subscribe")) { GameObject temp = GameObject.Find(clickedItem); originalScale = temp.transform.localScale; temp.transform.localScale = originalScale * 0.8f; } } else if (Input.GetMouseButtonUp(0)) { releasedItem = RaycastFunction(Input.mousePosition); // if(!clickedItem.Equals(System.String.Empty)) // { // GameObject temp = GameObject.Find(clickedItem); // temp.transform.localScale = originalScale; // if(releasedItem.Equals("Button_Continue")) // { // if(PlaySounds.soundOn) // PlaySounds.Play_Button_OpenLevel(); // Debug.Log("continue dalje"); // GameObject.Find(releasedItem).collider.enabled = false; // System.GC.Collect(); // Resources.UnloadUnusedAssets(); // Application.LoadLevelAsync((StagesParser.currSetIndex*10)+StagesParser.currStageIndex+5); // } // else if(clickedItem.Equals("Button_Subscribe")) // { // if(PlaySounds.soundOn) // PlaySounds.Play_Button_OpenLevel(); // //keyboard = TouchScreenKeyboard.Open(mail,TouchScreenKeyboardType.ASCIICapable,false,true,false,false, "Enter Your Email Here"); // #if UNITY_ANDROID // using (AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) // { // using (AndroidJavaObject obj_Activity = cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity")) // { // obj_Activity.Call("OtvoriWebView"); // } // } // #elif UNITY_IPHONE // //WebelinxBinding.sendMessage("OpenWebView"); // #endif // PlayerPrefs.SetInt("MailSent",1); // PlayerPrefs.Save(); // GameObject.Find("Button_Subscribe").SetActive(false); // } // } } if (keyboard != null) { if (keyboard.done) { mail = keyboard.text; keyboard = null; if (!mail.Equals(System.String.Empty) && mail.Contains("@")) { Debug.Log("poruka: " + mail); if (invalidMail.activeSelf) { invalidMail.SetActive(false); } GameObject.Find("Button_Subscribe").SetActive(false); //StartCoroutine("postToServer"); } else { Debug.Log("treba da je prazno: " + mail); invalidMail.SetActive(true); } } } }
void Update() { //Debug.Log("savedMusic: " + PlayerPrefs.GetInt("musicOn") + ", savedSound: " + PlayerPrefs.GetInt("soundOn") + ", musicOn: " + PlaySounds.musicOn + ", soundOn: " + PlaySounds.soundOn); if (Input.GetKeyUp(KeyCode.Escape) && !ShopManager.otvorenShop) { } if (Input.GetMouseButtonDown(0)) { clickedItem = RaycastFunction(Input.mousePosition); if (clickedItem.Equals("PlayMain") || clickedItem.Equals("PlayMainFly") || clickedItem.Equals("ButtonFreeCoins") || clickedItem.Equals("ButtonShop") || clickedItem.Equals("ButtonExit")) { GameObject temp = GameObject.Find(clickedItem); originalScale = temp.transform.localScale; temp.transform.localScale = originalScale * 0.8f; } else if (clickedItem != System.String.Empty) { GameObject temp = GameObject.Find(clickedItem); originalScale = temp.transform.localScale; } } if (Input.GetMouseButtonUp(0)) { releasedItem = RaycastFunction(Input.mousePosition); if (!clickedItem.Equals(System.String.Empty)) { GameObject temp = GameObject.Find(clickedItem); temp.transform.localScale = originalScale; if (releasedItem == "MusicMain") { if (!PlaySounds.musicOn) { PlaySounds.musicOn = true; muzikaOff = false; //dugmeMuzika.GetComponent<SpriteRenderer>().sprite = dugmeMuzikaSprite; dugmeMuzika.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>().enabled = false; if (PlayerPrefs.HasKey("soundOn")) { if (PlayerPrefs.GetInt("soundOn") == 1) { PlaySounds.Play_Button_MusicOn(); } } PlaySounds.Play_BackgroundMusic_Menu(); PlayerPrefs.SetInt("musicOn", 1); PlayerPrefs.Save(); } else { PlaySounds.musicOn = false; muzikaOff = true; //dugmeMuzika.GetComponent<SpriteRenderer>().sprite = dugmeMuzikaOffSprite; dugmeMuzika.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>().enabled = true; PlaySounds.Stop_BackgroundMusic_Menu(); PlayerPrefs.SetInt("musicOn", 0); PlayerPrefs.Save(); } } else if (releasedItem == "SoundMain") { if (!PlaySounds.soundOn) { PlaySounds.soundOn = true; soundOff = false; //dugmeSound.GetComponent<SpriteRenderer>().sprite = dugmeSoundSprite; dugmeSound.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>().enabled = false; PlaySounds.Play_Button_SoundOn(); PlayerPrefs.SetInt("soundOn", 1); PlayerPrefs.Save(); } else { PlaySounds.soundOn = false; soundOff = true; //dugmeSound.GetComponent<SpriteRenderer>().sprite = dugmeSoundOffSprite; dugmeSound.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>().enabled = true; PlayerPrefs.SetInt("soundOn", 0); PlayerPrefs.Save(); } } else if (releasedItem == "PlayMainFly") { GameObject.Find(releasedItem).GetComponent <Collider>().enabled = false; if (PlayerPrefs.HasKey("soundOn")) { if (PlayerPrefs.GetInt("soundOn") == 1) { PlaySounds.Play_Button_Play(); } } //bananaRasipuje.Play(); // if(PlayerPrefs.HasKey("VecPokrenuto") || PlayerPrefs.HasKey("starsandstages")) // StartCoroutine(otvoriSledeciNivo()); // else // { // StagesParser.currSetIndex = 0; // StagesParser.currStageIndex = 0; // Application.LoadLevel(2); // } if (!PlayerPrefs.HasKey("OdgledaoTutorial")) { Application.LoadLevel("LoadingScene"); } else { Application.LoadLevel(3); } } else if (releasedItem == "ButtonFreeCoins") { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } StartCoroutine(ShopManager.OpenFreeCoinsCard()); } else if (releasedItem == "ButtonShop") { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } StartCoroutine(ShopManager.OpenShopCard()); } else if (releasedItem == "ButtonExit") { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } Application.Quit(); } } } }
void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } Application.LoadLevel(1); } else if (Input.GetMouseButtonDown(0)) { clickedItem = RaycastFunction(Input.mousePosition); if (clickedItem.Equals("Button_Back") || clickedItem.Equals("Button_Subscribe")) { temp = GameObject.Find(clickedItem); originalScale = temp.transform.localScale; temp.transform.localScale = originalScale * 0.8f; } } else if (Input.GetMouseButtonUp(0)) { releasedItem = RaycastFunction(Input.mousePosition); if (!clickedItem.Equals(System.String.Empty)) { if (temp != null) { temp.transform.localScale = originalScale; } if (releasedItem.Equals("Button_Back")) { if (PlaySounds.BackgroundMusic_Gameplay.isPlaying) { PlaySounds.Stop_BackgroundMusic_Gameplay(); } if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } Application.LoadLevel(1); } // else if(clickedItem.Equals("Button_Subscribe")) // { // keyboard = TouchScreenKeyboard.Open(mail,TouchScreenKeyboardType.ASCIICapable,false,true,false,false, "Enter Term"); // } else if (clickedItem.Equals("Button_Subscribe")) { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } //keyboard = TouchScreenKeyboard.Open(mail,TouchScreenKeyboardType.ASCIICapable,false,true,false,false, "Enter Your Email Here"); PlayerPrefs.SetInt("MailSent", 1); PlayerPrefs.Save(); GameObject.Find("Button_Subscribe").SetActive(false); } } } if (keyboard != null) { if (keyboard.done) { mail = keyboard.text; keyboard = null; if (!mail.Equals(System.String.Empty) && mail.Contains("@")) { Debug.Log("poruka: " + mail); if (invalidMail.activeSelf) { invalidMail.SetActive(false); } GameObject.Find("Button_Subscribe").SetActive(false); //StartCoroutine("postToServer"); } else { Debug.Log("treba da je prazno: " + mail); invalidMail.SetActive(true); } } } }
void Update() { if (Input.GetMouseButtonDown(0)) { if (released) { released = false; } clickedItem = RaycastFunction(Input.mousePosition); vremeKlika = Time.time; clickedPos = Input.mousePosition.x; if (started) { started = false; tempObject = null; } if (clickedItem.StartsWith("Card")) { startX = Input.mousePosition.x; started = true; tempObject = GameObject.Find(clickedItem).transform; //levaGranica = - (tempObject.parent.childCount-1) * tempObject.GetComponent<BoxCollider>().bounds.extents.x*2 - desnaGranica-0.5f; levaGranica = shopDesnaIvica.position.x - 1.5f - (tempObject.parent.childCount - 1) * tempObject.GetComponent <BoxCollider>().bounds.extents.x *2 - tempObject.GetComponent <BoxCollider>().bounds.extents.x; //Debug.Log("leva granica: " + levaGranica + ", ext: " + tempObject.GetComponent<BoxCollider>().bounds.extents.x + ", sveukupno: " + ((tempObject.parent.childCount) * tempObject.GetComponent<BoxCollider>().bounds.extents.x + 1) + ", desna granica: " + desnaGranica); } } if (Input.GetMouseButton(0)) { if (started && ((tempObject.parent.childCount > 2 && Camera.main.aspect < 16f / 9) || (tempObject.parent.childCount > 3 && Camera.main.aspect >= 16f / 9))) { endX = Input.mousePosition.x; pomerajX = (endX - startX) * Camera.main.orthographicSize / 250; if (pomerajX != 0) { moved = true; } //Camera.main.transform.position = new Vector3(Mathf.Clamp(Camera.main.transform.position.x + pomerajX, 87.9f, 95.44f), Camera.main.transform.position.y, Camera.main.transform.position.z); tempObject.parent.position = new Vector3(Mathf.Clamp(tempObject.parent.position.x + pomerajX, levaGranica, desnaGranica), tempObject.parent.position.y, tempObject.parent.position.z); startX = endX; Debug.Log("Uledj"); } } if (released) { if (tempObject.parent.position.x <= levaGranica - 0.5f) { if (bounce) { pomerajX = 0.075f; bounce = false; } //Debug.Log(pomerajX); } else if (tempObject.parent.position.x >= desnaGranica) { if (bounce) { pomerajX = -0.075f; bounce = false; } } //if(Camera.main.transform.position.x > 87.9f + 0.6f && Camera.main.transform.position.x < 95.44f - 0.6f) { tempObject.parent.Translate(pomerajX, 0, 0); pomerajX *= 0.92f; } } else if (Input.GetMouseButtonUp(0)) { releasedItem = RaycastFunction(Input.mousePosition); if (moved) { moved = false; released = true; bounce = true; } startX = endX = 0; if (clickedItem == releasedItem && releasedItem != System.String.Empty && (Time.time - vremeKlika < 0.35f) && Mathf.Abs(Input.mousePosition.x - clickedPos) < 50) { if (releasedItem == "HolderBack") { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } if (Time.timeScale == 0) { StartCoroutine(PausedAnim(buttonShopBack.GetChild(0), "BackButtonClick")); StartCoroutine(CloseShopPaused()); } else { buttonShopBack.GetChild(0).GetComponent <Animation>().Play("BackButtonClick"); StartCoroutine(CloseShop()); } } else if (releasedItem == "ShopHeaderOff1") // TREBA DA SE AKTIVIRA SHOP TAB { holderShopCard.transform.position = new Vector3(desnaGranica, holderShopCard.transform.position.y, holderShopCard.transform.position.z); shopHeaderOff.SetActive(false); shopHeaderOn.SetActive(true); freeCoinsHeaderOn.SetActive(false); freeCoinsHeaderOff.SetActive(true); holderFreeCoinsCard.SetActive(false); holderShopCard.SetActive(true); if (Time.timeScale == 0) { StartCoroutine(PausedAnim(holderShopCard.transform.GetChild(0), "DolazakShop_A")); } else { holderShopCard.transform.GetChild(0).GetComponent <Animation>().Play("DolazakShop_A"); } } else if (releasedItem == "ShopHeaderOff") // TREBA DA SE AKTIVIRA FREE COINS TAB { holderFreeCoinsCard.transform.position = new Vector3(desnaGranica, holderFreeCoinsCard.transform.position.y, holderFreeCoinsCard.transform.position.z); shopHeaderOn.SetActive(false); shopHeaderOff.SetActive(true); freeCoinsHeaderOff.SetActive(false); freeCoinsHeaderOn.SetActive(true); holderShopCard.SetActive(false); holderFreeCoinsCard.SetActive(true); if (Time.timeScale == 0) { StartCoroutine(PausedAnim(holderFreeCoinsCard.transform.GetChild(0), "DolazakShop_A")); } else { holderFreeCoinsCard.transform.GetChild(0).GetComponent <Animation>().Play("DolazakShop_A"); } } else if (releasedItem.StartsWith("Card")) // KLIKNUTO NA BILO KOJU KARTICU { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } if (Time.timeScale == 0) { temp = GameObject.Find(releasedItem); StartCoroutine(PausedAnim(temp.transform.GetChild(0), "ShopCardClick")); } else { temp = GameObject.Find(releasedItem); temp.transform.GetChild(0).GetComponent <Animation>().Play("ShopCardClick"); } if (releasedItem.Contains("LikeBananaIsland")) { FacebookManager.stranica = "BananaIsland"; if (FB.IsLoggedIn) { GameObject.Find("FacebookManager").SendMessage("OpenPage"); } else { GameObject.Find("FacebookManager").SendMessage("FacebookLogin"); } //FacebookManager.FacebookLogin(); } else if (releasedItem.Contains("LikeWebelinx")) { FacebookManager.stranica = "Webelinx"; if (FB.IsLoggedIn) { GameObject.Find("FacebookManager").SendMessage("OpenPage"); } else { GameObject.Find("FacebookManager").SendMessage("FacebookLogin"); } //FacebookManager.FacebookLogin(); } if (releasedItem.Contains("WatchVideo")) { } else if (releasedItem.Contains("Buy")) { string sta = releasedItem.Substring(releasedItem.IndexOf('y') + 1); Debug.Log("Sta: " + sta); } } } } if (Input.GetKeyUp(KeyCode.Escape)) { if (shopHolder.gameObject.activeSelf) { if (PlaySounds.soundOn) { PlaySounds.Play_Button_OpenLevel(); } if (Time.timeScale == 0) { StartCoroutine(PausedAnim(buttonShopBack.GetChild(0), "BackButtonClick")); StartCoroutine(CloseShopPaused()); } else { buttonShopBack.GetChild(0).GetComponent <Animation>().Play("BackButtonClick"); StartCoroutine(CloseShop()); } } } }