Example #1
0
    //------------------------------
    //サインアップ済みか確認 / Already signup?
    //------------------------------
    public bool GetAlreadySignup()
    {
        List <User> users = FASUser.LoadSignedUpUsers();

        Debug.LogWarning(users.Count);
        return(users.Count > 0);
    }
Example #2
0
    //------------------------------
    //ログインを行ってからGUI表示 / Login and show GUI
    //userName: ログインに使用する名前/name used login
    //------------------------------
    public void ShowFGCGui(string userName)
    {
        //  Get signed up users list
        List <User> users = FASUser.LoadSignedUpUsers();

        //  If signed up user already exists
        if (users.Count > 0)
        {
            User user = users[users.Count - 1]; //  this case, we use latest signed up user account.

            Debug.Log("login");
            FASUser.LogIn(user.Id, user.Token, delegate(Error error){
                OnLogin(error);
            });

            return;
        }
        //  If signed up user does not exist
        else
        {
            if (userName == "")
            {
                userName = defaultUserName;
            }
            Debug.Log("SignUp " + userName);
            FASUser.SignUp(userName, delegate(User user, Error error)
            {
                if (error == null)
                {
                    FASUser.LogIn(user.Id, user.Token, delegate(Error error2)
                    {
                        if (error2 == null)
                        {
                            //端末の回転を制御(縦持ちを許可する)/controll screen orientation in mobile
                            //if (!GameController.isIOS8) {
                            Screen.autorotateToPortrait           = true;
                            Screen.autorotateToPortraitUpsideDown = true;
                            //}
                            //GUI表示/show GUI
                            FASGui.ShowGUI(FASGui.Mode.Forum | FASGui.Mode.Leaderboards | FASGui.Mode.MyProfile | FASGui.Mode.GroupMessage, FASGui.Mode.Forum);
                        }
                        else
                        {
                            Debug.LogError(error2.ToString());
                        }
                    });
                }
                else
                {
                    Debug.LogError(error.ToString());
                }
            });
        }
    }
Example #3
0
    public bool SendPoint(int point, string userName)
    {
        Debug.Log(point);
        bool result = false;
        //  Get signed up users list
        List <User> users = FASUser.LoadSignedUpUsers();

        //  If signed up user already exists
        if (users.Count > 0)
        {
            User user = users[users.Count - 1]; //  this case, we use latest signed up user account.
            Debug.Log(user);
            FASUser.LogIn(user.Id, user.Token, delegate(Error error)
            {
                if (error == null)
                {
                    FASLeaderboard.ReportScore(GameController.LEADERBOARD_ID, point, delegate(Score score, Error error2)
                    {
                        result = true;

                        //端末の回転を制御(縦持ちを許可する)/controll screen orientation in mobile
                        //if (!GameController.isIOS8) {
                        Screen.autorotateToPortrait           = true;
                        Screen.autorotateToPortraitUpsideDown = true;
                        //}
                        //GUI表示/show GUI
                        FASGui.ShowGUI(FASGui.Mode.Leaderboards | FASGui.Mode.MyProfile | FASGui.Mode.GroupMessage, returnSceneName, FASGui.Mode.Leaderboards);
                    });
                }
                else
                {
                    Debug.LogError(error.ToString());
                }
            });
        }
        //  If signed up user does not exist
        else
        {
            FASUser.SignUp(userName, delegate(User user, Error error)
            {
                FASUser.SaveSignUpUser(user);
                if (error == null)
                {
                    FASUser.LogIn(user.Id, user.Token, delegate(Error error2)
                    {
                        if (error2 == null)
                        {
                            FASLeaderboard.ReportScore(GameController.LEADERBOARD_ID, point, delegate(Score score, Error error3)
                            {
                                result = true;
                                //端末の回転を制御(縦持ちを許可する)/controll screen orientation in mobile
                                //if (!GameController.isIOS8) {
                                Screen.autorotateToPortrait           = true;
                                Screen.autorotateToPortraitUpsideDown = true;
                                //}
                                //GUI表示/show GUI
                                FASGui.ShowGUI(FASGui.Mode.Leaderboards | FASGui.Mode.MyProfile | FASGui.Mode.GroupMessage, returnSceneName, FASGui.Mode.Leaderboards);
                            });
                        }
                        else
                        {
                            Debug.LogError(error2.ToString());
                        }
                    });
                }
                else
                {
                    Debug.LogError(error.ToString());
                }
            });
        }
        return(result);
    }