public void CallLogin() { try{ InputField[] arr = UnityEngine.Object.FindObjectsOfType <InputField>(); string username = arr[0].text; string password = arr[1].text; if (!IsValidEmailAddress(username)) { throw new Exception("E-mail is in wrong format"); } DAO database = new DAO(); database.Register(username, password); FacebookManager.Instance().user_ID = database.LoginWithEmail(username, password); if (FacebookManager.Instance().user_ID > -1) { Texture2D tex = Resources.Load("profile") as Texture2D; FacebookManager.Instance().ProfilePic = Sprite.Create(tex , new Rect(0, 0, 336, 336), new Vector2(0, 0)); AppMaster.currentScene = "user"; AppMaster.Instance().callHit(); Application.LoadLevel("user"); } else { Debug.Log("Failed Login"); } } catch (Exception ex) { Debug.Log("Error : " + ex.Message); } }
// Update is called once per frame void Update() { //Debug.Log("BackButton: Update"); //Debug.Log("BackButton in scene: " + Application.loadedLevelName); // if running on Android if (Application.platform == RuntimePlatform.Android) { // if back button is pressed if (Input.GetKeyDown(KeyCode.Escape)) { // if AR scene go back to user scene if (Application.loadedLevelName == "battle") { AppMaster.currentScene = "user"; } AppMaster.Instance().callHit(); Application.LoadLevel("user"); // if user scene kill the app if (Application.loadedLevelName == "user") { Application.Quit(); } // if login scene kill the app if (Application.loadedLevelName == "login") { Application.Quit(); } } } }
IEnumerator DisplayScene() { yield return(new WaitForSeconds(timer)); AppMaster.currentScene = levelToLoad; AppMaster.Instance().callHit(); Application.LoadLevel(levelToLoad); }
public void loadScene(string scene) { if (scene.Equals("login")) { FacebookManager.Instance().callLogout(); StartCoroutine("Logout"); } AppMaster.currentScene = scene; AppMaster.Instance().callHit(); Application.LoadLevel(scene); }
public void CallFBLogin() { AppMaster.currentScene = "user"; AppMaster.Instance().callHit(); FacebookManager.Instance().callLogin(); }