test: Storage PT
This commit is contained in:
parent
9da2198871
commit
e6a8387a82
@ -8,18 +8,20 @@ public class StorageManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public GameObject PicturePlayer;
|
public GameObject PicturePlayer;
|
||||||
public GameObject Canvas;
|
public GameObject Canvas;
|
||||||
private FirebaseStorage storage;
|
private StorageReference storage;
|
||||||
private DatabaseReference realtimeDB;
|
private DatabaseReference realtimeDB;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
Debug.Log("non");
|
||||||
FirebaseInitializer.Instance.onFirebaseReady += Initialize;
|
FirebaseInitializer.Instance.onFirebaseReady += Initialize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
|
Debug.Log("oui");
|
||||||
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
|
FirebaseInitializer.Instance.onFirebaseReady -= Initialize;
|
||||||
storage = FirebaseStorage.DefaultInstance;
|
storage = FirebaseStorage.DefaultInstance.RootReference;
|
||||||
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
|
realtimeDB = FirebaseDatabase.DefaultInstance.RootReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +45,7 @@ public void UploadPhoto()
|
|||||||
GameManager game = Canvas.GetComponent<GameManager>();
|
GameManager game = Canvas.GetComponent<GameManager>();
|
||||||
string imageUuid = Guid.NewGuid().ToString();
|
string imageUuid = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
StorageReference storageRef = storage.GetReferenceFromUrl("gs://ggj2024-5cb41.appspot.com");
|
StorageReference imageRef = storage.Child(game.myRoom.code).Child(game.currentPlayer.id).Child($"{imageUuid}.jpg");
|
||||||
StorageReference imageRef = storageRef.Child(game.myRoom.code).Child(game.currentPlayer.id).Child($"{imageUuid}.jpg");
|
|
||||||
|
|
||||||
imageRef.PutBytesAsync(photoBytes).ContinueWith((Task<StorageMetadata> task) =>
|
imageRef.PutBytesAsync(photoBytes).ContinueWith((Task<StorageMetadata> task) =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user