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); }); }
protected override void OnInitFail(string _error) { // Reset attributes m_user = null; m_authResponseData = null; base.OnInitFail(_error); }
private void OnReceivingLocalUsersFriendsList(string _friendsJsonStr) { IList _friendsJsonList = JSONUtility.FromJSON(_friendsJsonStr) as IList; // Send callback if (OnLoadLocalUserFriendsFinished != null) { OnLoadLocalUserFriendsFinished(AndroidUser.ConvertToUserList(_friendsJsonList)); } }
private void OnReceivingUserProfilesList(string _loadedUsersJsonStr) { IList _usersJsonList = JSONUtility.FromJSON(_loadedUsersJsonStr) as IList; // Send callback if (OnLoadUsersFinished != null) { OnLoadUsersFinished(AndroidUser.ConvertToUserList(_usersJsonList)); } }
protected override void OnInitFail() { // Update properties m_user = null; // Reset needless data m_authResponseData = null; base.OnInitFail(); }
protected override void OnInitSuccess(string _error) { IDictionary _infoDict = m_authResponseData.GetIfAvailable <IDictionary>(kLocalUserInfoKey); // Update user info m_user = new AndroidUser(_infoDict); // Release cached data m_authResponseData = null; base.OnInitSuccess(_error); }
protected override void OnInitSuccess() { IDictionary _infoDict = m_authResponseData.GetIfAvailable <IDictionary>(kLocalUserInfoKey); // Update properties m_user = new AndroidUser(_infoDict); // Reset needless data m_authResponseData = null; base.OnInitSuccess(); }
internal AndroidScore (IDictionary _scoreData) { LeaderboardID = _scoreData.GetIfAvailable<string>(kIdentifier); LeaderboardGlobalID = GameServicesIDHandler.GetLeaderboardGID(LeaderboardID); User = new AndroidUser(_scoreData.GetIfAvailable<Dictionary<string, object>>(kUser)); Value = _scoreData.GetIfAvailable<long>(kValue); long _timeInMillis = _scoreData.GetIfAvailable<long>(kDate); Date = _timeInMillis.ToDateTimeFromJavaTime(); Rank = _scoreData.GetIfAvailable<int>(kRank); }
protected override void LoadFriendsFinished(IDictionary _dataDict) { string _error = _dataDict.GetIfAvailable <string>(GameServicesAndroid.kNativeMessageError); IList _friendJSONList = _dataDict.GetIfAvailable <List <object> >(kLocalUserFriendsKey); if (_friendJSONList != null) { // Update property Friends = AndroidUser.ConvertToUserList(_friendJSONList); } LoadFriendsFinished(Friends, _error); }
internal AndroidScore(IDictionary _scoreData) { LeaderboardID = _scoreData.GetIfAvailable <string>(kIdentifier); LeaderboardGlobalID = GameServicesIDHandler.GetLeaderboardGID(LeaderboardID); User = new AndroidUser(_scoreData.GetIfAvailable <Dictionary <string, object> >(kUser)); Value = _scoreData.GetIfAvailable <long>(kValue); long _timeInMillis = _scoreData.GetIfAvailable <long>(kDate); Date = _timeInMillis.ToDateTimeFromJavaTime(); Rank = _scoreData.GetIfAvailable <int>(kRank); }
private void OnReceivingLocalUserAuthenticationStatus(string _usersJsonStr) { IDictionary _usersJson = JSONUtility.FromJSON(_usersJsonStr) as IDictionary; AndroidUser _user = null; if (_usersJson != null) { _user = AndroidUser.ConvertToUser(_usersJson); } // Send internal callback if (OnLocalUserAuthenticationFinished != null) { OnLocalUserAuthenticationFinished(_user); } }
protected override void AuthenticationFinished(IDictionary _dataDict) { string _error = _dataDict.GetIfAvailable <string>(GameServicesAndroid.kNativeMessageError); if (_error == null) { m_authResponseData = _dataDict; } else { // Update properties Friends = null; m_user = null; } AuthenticationFinished(_error); }
internal static User[] ConvertToUserList(IList _userList) { if (_userList == null) { return(null); } int _count = _userList.Count; User[] _usersList = new AndroidUser[_count]; for (int _iter = 0; _iter < _count; _iter++) { _usersList[_iter] = new AndroidUser(_userList[_iter] as IDictionary); } return(_usersList); }
protected override void AuthenticationFinished(IDictionary _dataDict) { // Reset fields to default value m_user = null; // Parse auth response data string _error = _dataDict.GetIfAvailable <string>(GameServicesAndroid.kNativeMessageError); bool _success = (_error == null); if (_success) { // Cache auth response data m_authResponseData = _dataDict; } // Invoke auth finish handler AuthenticationFinished(_success, _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); } } }); }
protected override void OnInitFail () { // Update properties m_user = null; // Reset needless data m_authResponseData = null; base.OnInitFail (); }
internal static AndroidUser[] ConvertToUserList (IList _userList) { if (_userList == null) return null; int _count = _userList.Count; AndroidUser[] _androidUsersList = new AndroidUser[_count]; for (int _iter = 0; _iter < _count; _iter++) _androidUsersList[_iter] = new AndroidUser(_userList[_iter] as IDictionary); return _androidUsersList; }
protected override void AuthenticationFinished (IDictionary _dataDict) { string _error = _dataDict.GetIfAvailable<string>(GameServicesAndroid.kNativeMessageError); if (_error == null) { m_authResponseData = _dataDict; } else { // Update properties Friends = null; m_user = null; } AuthenticationFinished(_error); }
protected override void OnInitSuccess () { IDictionary _infoDict = m_authResponseData.GetIfAvailable<IDictionary>(kLocalUserInfoKey); // Update properties m_user = new AndroidUser(_infoDict); // Reset needless data m_authResponseData = null; base.OnInitSuccess (); }