SocialManager.Login C# (CSharp) Method

Login() public method

public Login ( ) : void
return void
    public void Login()
    {
        #if (UNITY_IPHONE || UNITY_ANDROID)
        if (!Social.localUser.authenticated) {
            busy = true;
            try{
                Social.localUser.Authenticate((bool success) => {
                    if (success){
                        //Automatically log in in the future
                        PlayerPrefs.SetInt("auto_login", 1);
                    }
                    else{
                        //Login failed, don't try again unless the player asks
                        PlayerPrefs.SetInt("auto_login", 0);
                    }
                    busy = false;
                    UpdateButton();
                });
            }
            catch(Exception){
                //Exception is thrown when failing to call into the plugin code
                busy = false;
                UpdateButton();
            }
        }
        else{
            UpdateButton();
        }
        #endif
    }

Usage Example

コード例 #1
0
    public void EnterLevelSelectState()
    {
        panelLevelSelect.GetComponent <FadeInOut>().FadeIn();
        string latestLevel = PlayerPrefs.GetString(PlayerPrefsKey.LatestLevel);

        levelSelectView.Show(latestLevel, currentLevel);
        if (IsCardGuideEnable())
        {
            _levelGuide.TriggerCardGuide();
        }
        else if (IsAdsGuideEnable())
        {
            _levelGuide.TriggerAdsGuide();
        }
        else
        {
            ShowCommentConfirm();
        }
        audioPlayer.PlaySelectBGM();
        _socialMgr.Login();
        // Update All GameCenter Data
    }