コード例 #1
0
    void Start()
    {
        //Used as Displaying Status for Player.
        Notification.text = "";

        //Show the Current UI (the object that has this script attached to).
        CurrentPanel.SetActive(true);

        //Hide all our panels until we know what UI to display
        LoginPanel.SetActive(false);
        RegisterPanel.SetActive(false);
        SelectScene.SetActive(false);
        RegisterPanel.SetActive(false);

        //Subscribe to events that happen after we authenticate
        PlayFabService.OnLoginSuccess    += OnLoginSuccess;
        PlayFabService.OnRegisterSuccess += OnRegisterSuccess;
        PlayFabService.OnPlayFabError    += OnRegisterFailure;

        //Bind to UI buttons to perform actions when user interacts with the UI.
        LoginButton.onClick.AddListener(OnLoginClicked);
        RegisterButton.onClick.AddListener(OnRegisterButtonClicked);
        LoginCarrot.onClick.AddListener(ShowLogin);
        RegisterCarrot.onClick.AddListener(ShowRegister);
        GuessButton.onClick.AddListener(DeviceRegister);

        //Set the data we want at login from what we chose in our meta data.
        _PlayFabService.InfoRequestParams = InfoRequestParams;

        //Start the authentication process.
        _PlayFabService.Authenticate();
    }
コード例 #2
0
 ///Login()
 /// <summary>
 /// Login via WebGL
 /// </summary>
 /// Pre-Condition: Must WebGL platform.
 /// Post-Condition: Logins in.
 public void Login()
 {
     if (Application.platform == RuntimePlatform.WebGLPlayer)
     {
         _PlayFabService.Authenticate(Authtypes.EmailAndPassword);
     }
 }