Esempio n. 1
0
    IEnumerator CheckForSuccessfulLogout()
    {
        // keep yielding until no longer logged in
        if (FB.IsLoggedIn)
        {
            Debug.Log("Logging out - still logged in" + DateTime.Now.ToString("h:mm:ss tt"));
            yield return(new WaitForSeconds(0.1f));

            StartCoroutine("CheckForSuccessfulLogout");
        }
        else
        {
            // successful logout, do what you want here

            //clear facebook instance
            var inst = FacebookManager.Instance();
            inst.FB_ID      = null;
            inst.user_ID    = -1;
            inst.ProfilePic = null;
            inst.Gender     = "";
            inst.FullName   = "";
            inst.callLogout();

            Debug.Log("Logged out!");
            Application.LoadLevel("login");             // logged out, go load the login level now
        }
    }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
    // Use this for initialization
    void Awake()
    {
        DAO       database = new DAO();
        Pedometer ped      = database.GetPedometerInfo(FacebookManager.Instance().user_ID);

        pedometersteps = ped.Total_step;
        isClosed       = true;
    }
Esempio n. 4
0
 void Awake()
 {
     Debug.Log("Login: Awake");
     Debug.Log("FB.IsLoggedIn value: " + FacebookManager.Instance().IsLogged());
     if (FacebookManager.Instance().IsLogged())
     {
         Application.LoadLevel("augmon_select");
     }
 }
Esempio n. 5
0
    void SelectedCharacter4()
    {
        Debug.Log("Character 4 SELECTED");          //Print out in the Unity console which character was selected.
        character1Glow.renderer.enabled = false;    //these lines turn on or off the appropriate character glow.
        character2Glow.renderer.enabled = false;
        character3Glow.renderer.enabled = false;
        character4Glow.renderer.enabled = true;

        FacebookManager.Instance().playerAugmon = "dog";
    }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        character1Glow.renderer.enabled = true;          // We're going to make sure all of the highlighted glows are OFF at scene start.
        character2Glow.renderer.enabled = false;
        character3Glow.renderer.enabled = false;
        character4Glow.renderer.enabled = false;

        // if user select without choosing a different augmon
        FacebookManager.Instance().playerAugmon = "bird";
    }
Esempio n. 7
0
 // Update is called once per frame
 void Update()
 {
     if (FacebookManager.Instance().IsLogged())
     {
         Application.LoadLevel("augmon_select");
     }
     else
     {
         // handle errors here
     }
 }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        //GameObject playerAugmonModel = Instantiate(Resources.Load("Prefabs/" + FacebookManager.Instance ().playerAugmon, typeof(GameObject))) as GameObject;

        //GameObject spawnPoint = (GameObject)Instantiate (playerAugmonModel, playerAugmonModel.transform.position, playerAugmonModel.transform.rotation);
        //playerAugmonModel.name = "PlayerAugmon";

        //playerAugmonModel.renderer.enabled = true;

        //augmonMesh = Instantiate(Resources.Load("Prefabs/" + FacebookManager.Instance().playerAugmon, typeof(Material))) as Material;

        profile        = GameObject.Find("ProfileImage").GetComponent <Image>();
        header         = GameObject.Find("Header").GetComponent <Text>();
        subtitle       = GameObject.Find("Subtitle").GetComponent <Text>();
        augmonSelected = FacebookManager.Instance().playerAugmon;
        augmonModel    = GameObject.Find("AugmonModel");
        //augmonModel = Instantiate(Resources.Load("Prefabs/" + FacebookManager.Instance().playerAugmon, typeof(GameObject))) as GameObject;
        augmonModel.SetActive(false);
        bird  = GameObject.Find("bird");
        bunny = GameObject.Find("bunny");
        cat   = GameObject.Find("cat");
        dog   = GameObject.Find("dog");

        if (augmonSelected == "bird")
        {
            bird.SetActive(true);
            bunny.SetActive(false);
            cat.SetActive(false);
            dog.SetActive(false);
        }
        else if (augmonSelected == "bunny")
        {
            bird.SetActive(false);
            bunny.SetActive(true);
            cat.SetActive(false);
            dog.SetActive(false);
        }
        else if (augmonSelected == "cat")
        {
            bird.SetActive(false);
            bunny.SetActive(false);
            cat.SetActive(true);
            dog.SetActive(false);
        }
        else if (augmonSelected == "dog")
        {
            bird.SetActive(false);
            bunny.SetActive(false);
            cat.SetActive(false);
            dog.SetActive(true);
        }
    }
Esempio n. 9
0
    public void loadScene(string scene)
    {
        if (scene.Equals("login"))
        {
            FacebookManager.Instance().callLogout();
            StartCoroutine("Logout");
        }

        AppMaster.currentScene = scene;
        AppMaster.Instance().callHit();

        Application.LoadLevel(scene);
    }
Esempio n. 10
0
    public void registerSteps()
    {
        DAO       database = new DAO();
        Pedometer ped      = database.GetPedometerInfo(FacebookManager.Instance().user_ID);

        ped.Total_step += FeaturePedometer.Instance().stepCnt;
        pedometersteps += FeaturePedometer.Instance().stepCnt;
        Augmon aug = database.GetAugmonInfo(FacebookManager.Instance().user_ID);

        aug.Lvl += (int)(FeaturePedometer.Instance().stepCnt / 100);
        FeaturePedometer.Instance().stepCnt = 0;
        //update database
        database.UpdateAugmon(aug);
        database.UpdatePedometer(ped);
    }
Esempio n. 11
0
    private void displayStats()
    {
        //change this to FB login ID
        Augmon augmon = database.GetAugmonInfo(FacebookManager.Instance().user_ID);

        for (int i = 0; i < 5; i++)
        {
            RectTransform trans = augmonbuttons[i].ButtonText.rectTransform;
            augmonbuttons[i].ButtonText.fontStyle = FontStyle.Bold;
            switch (augmonbuttons[i].name)
            {
            case "Battle":
                augmonbuttons[i].ButtonText.text = "Name: " + augmon.ID;                        //augmon.Name;
                trans.anchoredPosition           = new Vector2(-20, 0);
                break;

            case "Stats":
                augmonbuttons[i].ButtonText.text = "Level: " + augmon.Lvl;
                trans.anchoredPosition           = new Vector2(-20, 0);
                break;

            case "Feed":
                augmonbuttons[i].ButtonText.text = "Attack: " + augmon.Attack;
                trans.anchoredPosition           = new Vector2(-20, 0);
                break;

            case "Steps":
                augmonbuttons[i].ButtonText.text = "Def: " + augmon.Defense;
                trans.anchoredPosition           = new Vector2(-20, 0);
                break;

            case "Logout":
                //augmonbuttons[i].ButtonText.text = "Health: " + augmon.Happiness + "%";
                //augmonbuttons[i].ButtonText.text = "ID: " + augmon.ID;
                augmonbuttons[i].ButtonText.text = "Health: " + augmon.Happiness + "%";
                trans.anchoredPosition           = new Vector2(-20, 0);
                break;
            }
            augmonbuttons[i].RippleScript.enabled = false;
            augmonbuttons[i].Icon.enabled         = false;
            augmonbuttons[i].ButtonScript.enabled = false;
        }
    }
Esempio n. 12
0
 // Update is called once per frame
 void Update()
 {
     profile.sprite = FacebookManager.Instance().ProfilePic;
     header.text    = FacebookManager.Instance().FullName;
     subtitle.text  = "Step Count: " + ((int)HealthBarScript.pedometersteps + FeaturePedometer.Instance().stepCnt);
 }
Esempio n. 13
0
 public void CallFBLogin()
 {
     AppMaster.currentScene = "user";
     AppMaster.Instance().callHit();
     FacebookManager.Instance().callLogin();
 }