public override void Authenticate(Action <bool> _onCompletion) { base.Authenticate(_onCompletion); // Request authentication AndroidUserProfilesManager _profilesManager = GetUserProfilesManager(); _profilesManager.AuthenticateLocalUser((AndroidUser _user) => { // Check auth status bool _authSuccess = _user != null; // Update authentication callback m_authCallback = (bool _success) => { m_isAuthenticated = _success; // Set properties if (_success) { m_user = _user; } else { m_user = null; } if (_onCompletion != null) { _onCompletion(_success); } }; OnAuthenticationFinish(_authSuccess); }); }
public override void GetImageAsync(DownloadTexture.Completion _onCompletion) { if (_onCompletion != null) { if (string.IsNullOrEmpty(m_imagePath)) { VoxelBusters.DebugPRO.Console.LogError(Constants.kDebugTag, "[GameServices] No profile image for " + Name); _onCompletion(null, "Texture not found."); } else if (m_imageTexture != null) //If already cached { _onCompletion(m_imageTexture, null); } else { AndroidUserProfilesManager _userManager = ((GameServicesAndroid)(NPBinding.GameServices)).UserProfilesManager; _userManager.LoadProfilePicture(m_imagePath, (Texture2D _texture, string _error) => { m_imageTexture = _texture; if (_onCompletion != null && _onCompletion.Target != null) { _onCompletion(_texture, _error); } }); } } }
public override void LoadFriends(Action <User[]> _onCompletion) { AndroidUserProfilesManager _profilesManager = GetUserProfilesManager(); _profilesManager.LoadLocalUserFriends((AndroidUser[] _friendsJSONList) => { if (_onCompletion != null) { if (_friendsJSONList != null) { m_friends = AndroidUser.ConvertToUserList(_friendsJSONList); _onCompletion(m_friends); } else { _onCompletion(null); } } }); }