Exemplo n.º 1
0
 /// <summary>
 /// Not implemented yet.
 /// </summary>
 public static void LinkDevice(PlayFab.ClientModels.LoginResult result = null)
 {
     #if UNITY_ANDROID
     LinkAndroidDeviceIDRequest request = new LinkAndroidDeviceIDRequest()
     {
         AndroidDeviceId = DBManager.GetDeviceId(),
         ForceLink       = true,
         OS            = SystemInfo.operatingSystem,
         AndroidDevice = SystemInfo.deviceModel,
     };
     PlayFabClientAPI.LinkAndroidDeviceID(request, UnlinkCustomId, OnLinkError);
     #elif UNITY_IOS
     LinkIOSDeviceIDRequest request = new LinkIOSDeviceIDRequest()
     {
         DeviceId    = DBManager.GetDeviceId(),
         ForceLink   = true,
         OS          = SystemInfo.operatingSystem,
         DeviceModel = SystemInfo.deviceModel
     };
     PlayFabClientAPI.LinkIOSDeviceID(request, UnlinkCustomId, OnLinkError);
     #else
     LinkCustomIDRequest request = new LinkCustomIDRequest()
     {
         CustomId  = DBManager.GetDeviceId(),
         ForceLink = true
     };
     PlayFabClientAPI.LinkCustomID(request, UnlinkCustomId, OnLinkError);
     #endif
 }
Exemplo n.º 2
0
        /// <summary>
        /// Logs in with the user device id, using the correct PlayFab method per platform.
        /// A new account will be created when no account is associated with the device id.
        /// </summary>
        public void LoginWithDevice(Action <bool> resultCallback = null)
        {
            #if UNITY_ANDROID
            LoginWithAndroidDeviceIDRequest request = new LoginWithAndroidDeviceIDRequest()
            {
                TitleId         = PlayFabSettings.TitleId,
                AndroidDeviceId = DBManager.GetDeviceId(),
                CreateAccount   = true,
                OS                    = SystemInfo.operatingSystem,
                AndroidDevice         = SystemInfo.deviceModel,
                InfoRequestParameters = accountParams
            };

            PlayFabClientAPI.LoginWithAndroidDeviceID(request, (result) =>
            {
                OnLoggedIn(result);
                if (resultCallback != null)
                {
                    resultCallback(true);
                }
            }, (error) =>
            {
                OnPlayFabError(error);
                if (resultCallback != null)
                {
                    resultCallback(false);
                }
            });
            #elif UNITY_IOS
            LoginWithIOSDeviceIDRequest request = new LoginWithIOSDeviceIDRequest()
            {
                TitleId               = PlayFabSettings.TitleId,
                DeviceId              = DBManager.GetDeviceId(),
                CreateAccount         = true,
                OS                    = SystemInfo.operatingSystem,
                DeviceModel           = SystemInfo.deviceModel,
                InfoRequestParameters = accountParams
            };

            PlayFabClientAPI.LoginWithIOSDeviceID(request, (result) =>
            {
                OnLoggedIn(result);
                if (resultCallback != null)
                {
                    resultCallback(true);
                }
            }, (error) =>
            {
                OnPlayFabError(error);
                if (resultCallback != null)
                {
                    resultCallback(false);
                }
            });
            #else
            LoginWithCustomIDRequest request = new LoginWithCustomIDRequest()
            {
                TitleId               = PlayFabSettings.TitleId,
                CreateAccount         = true,
                CustomId              = DBManager.GetDeviceId(),
                InfoRequestParameters = accountParams
            };

            PlayFabClientAPI.LoginWithCustomID(request, (result) =>
            {
                OnLoggedIn(result);
                if (resultCallback != null)
                {
                    resultCallback(true);
                }
            }, (error) =>
            {
                OnPlayFabError(error);
                if (resultCallback != null)
                {
                    resultCallback(false);
                }
            });

            PlayFabClientAPI.LoginWithCustomID(request, OnLoggedIn, OnPlayFabError);
            #endif
        }