37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
|
|
using Firebase;
|
||
|
|
using Firebase.Analytics;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class FireBaseMgr : MonoBehaviour
|
||
|
|
{
|
||
|
|
public static FireBaseMgr Ins;
|
||
|
|
|
||
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
Ins = this;
|
||
|
|
|
||
|
|
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
|
||
|
|
var dependencyStatus = task.Result;
|
||
|
|
if (dependencyStatus == Firebase.DependencyStatus.Available)
|
||
|
|
{
|
||
|
|
// Firebase 사용 준비 완료
|
||
|
|
Debug.Log("Firebase 종속성 확인 완료. Firebase 사용 가능합니다.");
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
Debug.LogError(System.String.Format("Firebase 종속성을 해결할 수 없습니다: {0}", dependencyStatus));
|
||
|
|
// Firebase를 사용할 수 없음
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public void LogPurchase(string productId, double price, string currency)
|
||
|
|
{
|
||
|
|
FirebaseAnalytics.LogEvent("purchase_item",
|
||
|
|
new Parameter("item_id", productId),
|
||
|
|
new Parameter("value", price),
|
||
|
|
new Parameter("currency", currency)
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|