using Facebook.Unity; using UnityEngine; /// /// In-game Facebook funnel events. Stored in PlayerPrefs so Reset Save does not clear them. /// public static class ActivityFacebookEngagement { const string FirstLobbyReportedKey = "CrazyFruit.Activity.FirstLobbyReported"; public static void TryReportFirstLobbyEntry() { if (PlayerPrefs.GetInt(FirstLobbyReportedKey, 0) != 0) return; if (!FB.IsInitialized) return; ActivityFacebookService.LogEvent("completeregistration", 0f); ActivityFacebookService.LogEvent("addtowishlist", 0f); PlayerPrefs.SetInt(FirstLobbyReportedKey, 1); PlayerPrefs.Save(); } public static void ReportShopPurchase(int priceCoins) { if (!FB.IsInitialized) return; float value = Mathf.Max(0, priceCoins); ActivityFacebookService.LogEvent("addtocart", value); ActivityFacebookService.LogEvent("purchased", value); } }