Copy DownloadImage

This commit is contained in:
Michel Roux 2024-01-28 17:07:54 +01:00
parent 365615d226
commit 684e53d599
3 changed files with 18 additions and 6 deletions

View File

@ -1,9 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Firebase.Extensions;
using Firebase.Storage;
using TMPro;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
@ -51,7 +51,7 @@ private void DisplayPicture(string _url)
});
}
private IEnumerator DownloadImage(string _url, System.Action<Texture> callback_OnTextureDownloaded)
private IEnumerator DownloadImage(string _url, Action<Texture> callback_OnTextureDownloaded)
{
UnityWebRequest request = UnityWebRequestTexture.GetTexture(_url);
yield return request.SendWebRequest();

View File

@ -1,8 +1,10 @@
using Firebase.Database;
using Firebase.Storage;
using System;
using System.Collections;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
public class StorageManager : MonoBehaviour
{
@ -62,6 +64,20 @@ public void UploadPhoto(string roomCode, string playerId, int question, int prop
.SetValueAsync(imageRef.Path);
}
});
}
public IEnumerator DownloadImage(string _url, Action<Texture> callback_OnTextureDownloaded)
{
UnityWebRequest request = UnityWebRequestTexture.GetTexture(_url);
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
Debug.LogError(request.error);
}
else
{
callback_OnTextureDownloaded?.Invoke(((DownloadHandlerTexture)request.downloadHandler).texture);
}
}
}

View File

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<projectSettings>
<projectSetting name="com.google.external-dependency-managerAnalyticsEnabled" value="False" />
<projectSetting name="com.google.firebaseAnalyticsEnabled" value="False" />
<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.PackageManagerResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" />
<projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False" />
<projectSetting name="GooglePlayServices.UseJetifier" value="True" />
</projectSettings>