Exemplo n.º 1
0
    /// <summary>
    /// Store Facebook details into database through business logic if it is not in database
    /// </summary>
    private void InsertFb()
    {
        string email  = fbScript.Get("email").ToString();
        string fbId   = fbScript.Get("id").ToString();
        string fbName = fbScript.Get("fb_name").ToString();
        bool   exist  = studentBL.CheckFacebookExist(fbId);

        if (exist)
        {
            Global.StudentId   = studentBL.GetFacebookStudentId(fbId);
            Global.StudentName = fbName;
            Global.FbLoggedIn  = true;

            if (studentBL.CheckFacebookCharExist(fbId))
            {
                GetTree().ChangeScene("res://Presentation/MainMenu/MainMenu.tscn");
            }
            else
            {
                GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
            }
        }
        else
        {
            studentBL.InsertFacebookStudent(fbName, email, fbId);
            Global.StudentId   = studentBL.GetFacebookStudentId(fbId);
            Global.StudentName = fbName;
            Global.FbLoggedIn  = true;
            GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
        }
    }