private void OnGetProfileImageComplete(CallbackGetProfileImage _msg) { if (_msg.IsSuccess) { Debug.Log("Get Image profile success"); Texture2D texture = new Texture2D(2, 2); texture.LoadImage(_msg.ImageBytes); AvatarSprite.sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f); } else { Debug.Log("Failed to load avatar"); } }
/// <summary> /// Profile image getted method /// </summary> /// <param name="_callback"></param> public void OnProfileImageGetted(CallbackGetProfileImage _callback) { if (_callback.IsSuccess) { Texture2D texture = new Texture2D(2, 2); texture.LoadImage(_callback.ImageBytes); AvatarImage.sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f); ResizeAvarar(AvatarSize); } else { DisplayDefaultAvatar(); } }
/// <summary> /// Raises a get profile image complete event /// </summary> /// <param name="_callbak">Callback response object</param> public void RaiseGetProfileImageActions(CallbackGetProfileImage _callbak) { OnGetProfileImageActions?.Invoke(_callbak); }