예제 #1
0
    private void AuthSuccessCallback(string UserID)
    {
        LoginMsg.text = "Auth Success";

        SystemManage.GetAllTitleData();                 //取得所有title data
        SystemManage.GetAllStroeItem();                 //取得所有物品

        //使用playfab登入photon
        PlayFabClientAPI.GetPhotonAuthenticationToken(new GetPhotonAuthenticationTokenRequest()
        {
            PhotonApplicationId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime
        }, (xr) =>
        {
            var customAuth = new AuthenticationValues {
                AuthType = CustomAuthenticationType.Custom
            };

            customAuth.AddAuthParameter("username", UserID);
            customAuth.AddAuthParameter("token", xr.PhotonCustomAuthenticationToken);

            PhotonNetwork.AuthValues = customAuth;
            PhotonNetwork.ConnectUsingSettings();

            LoginMsg.text = "Login....";
        },
                                                      (xe) =>
        {
            LoginMsg.text = "Login Fail";
            ModalHelper.WarningMessage("Photon Authentication fail.");
        });
    }