//-------------------------------------- // Do not use this methods, plugin internal use only //-------------------------------------- public void SetPhotoData(GK_PhotoSize size, string base64String) { if (base64String.Length == 0) { return; } byte[] decodedFromBase64 = System.Convert.FromBase64String(base64String); Texture2D loadedPhoto = new Texture2D(1, 1); loadedPhoto.LoadImage(decodedFromBase64); if (size == GK_PhotoSize.GKPhotoSizeSmall) { _SmallPhoto = loadedPhoto; UpdatePhotosCache(SmallPhotoCacheKey, _SmallPhoto); } else { _BigPhoto = loadedPhoto; UpdatePhotosCache(BigPhotoCacheKey, _BigPhoto); } GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, loadedPhoto); OnPlayerPhotoLoaded(result); }
void HandleOnPlayerPhotoLoaded(GK_UserPhotoLoadResult result) { if (result.IsSucceeded) { ISN_Logger.Log(result.Photo); ISN_Logger.Log(GameCenterManager.Player.BigPhoto); } }
//-------------------------------------- // IOS Events //-------------------------------------- void HandleOnPlayerPhotoLoaded(GK_UserPhotoLoadResult res) { if (res.IsSucceeded) { if (res.Size == GK_PhotoSize.GKPhotoSizeSmall) { SmallPhotoLoaded(res.Photo); } else { BigPhotoLoaded(res.Photo); } } }
//-------------------------------------- // Public Methods //-------------------------------------- public void LoadPhoto(GK_PhotoSize size) { if(size == GK_PhotoSize.GKPhotoSizeSmall) { if(_SmallPhoto != null) { GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, _SmallPhoto); OnPlayerPhotoLoaded(result); return; } } else { if(_BigPhoto != null) { GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, _BigPhoto); OnPlayerPhotoLoaded(result); return; } } GameCenterManager.LoadGKPlayerPhoto(Id, size); }
//-------------------------------------- // Do not use this methods, plugin internal use only //-------------------------------------- public void SetPhotoData(GK_PhotoSize size, string base64String) { if(base64String.Length == 0) { return; } byte[] decodedFromBase64 = System.Convert.FromBase64String(base64String); Texture2D loadedPhoto = new Texture2D(1, 1); loadedPhoto.LoadImage(decodedFromBase64); if(size == GK_PhotoSize.GKPhotoSizeSmall) { _SmallPhoto = loadedPhoto; } else { _BigPhoto = loadedPhoto; } GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, loadedPhoto); OnPlayerPhotoLoaded(result); }
//-------------------------------------- // Public Methods //-------------------------------------- public void LoadPhoto(GK_PhotoSize size) { if (size == GK_PhotoSize.GKPhotoSizeSmall) { if (_SmallPhoto != null) { GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, _SmallPhoto); OnPlayerPhotoLoaded(result); return; } } else { if (_BigPhoto != null) { GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, _BigPhoto); OnPlayerPhotoLoaded(result); return; } } GameCenterManager.LoadGKPlayerPhoto(Id, size); }
public void SetPhotoLoadFailedEventData(GK_PhotoSize size, string errorData) { GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, new SA.Common.Models.Error(errorData)); OnPlayerPhotoLoaded(result); }
//-------------------------------------- // IOS Events //-------------------------------------- void HandleOnPlayerPhotoLoaded (GK_UserPhotoLoadResult res) { if(res.IsSucceeded) { if(res.Size == GK_PhotoSize.GKPhotoSizeSmall) { SmallPhotoLoaded(res.Photo); } else { BigPhotoLoaded(res.Photo); } } }
public void SetPhotoLoadFailedEventData(GK_PhotoSize size, string errorData) { GK_UserPhotoLoadResult result = new GK_UserPhotoLoadResult(size, errorData); OnPlayerPhotoLoaded(result); }
void HandleOnPlayerPhotoLoaded (GK_UserPhotoLoadResult result) { if(result.IsSucceeded) { Debug.Log(result.Photo); Debug.Log(GameCenterManager.Player.BigPhoto); } }