コード例 #1
0
    void runGameover()
    {
        if (runOnce)
        {
            return;
        }

        runOnce = true;

        //save score/bestScore
        int lastBestScore = PlayerPrefs.GetInt("PlayerBestScore");

        if (playerScore > lastBestScore)
        {
            //save new best score
            PlayerPrefs.SetInt("PlayerBestScore", (int)playerScore);
            uiPlayerBestScore.GetComponent <TextMesh> ().text = ((int)playerScore).ToString();
        }

        //Send the score the global leader board
        Social.ReportScore((long)playerScore, GPGSIds.leaderboard_global_leader_board, (bool success) => {
            // handle success or failure
        });

        //Tract an event with the player's score
        AppsFlyer.trackEvent("score", playerScore.ToString());

        enableUI(true);

        //show an Ad on screen every 1 out of 5 gameover
        //if (Random.value > 0.80f) {
        //if (AdManagerObject)
        //AdManagerObject.GetComponent<AdManager> ().showInterstitial ();
        //}
    }
コード例 #2
0
 public override System.Collections.Generic.IEnumerator <byte> OnScreenTransition(int index, int screenId, int toScreenId, bool popup)
 {
                 #if APPSFLYER_ANALYTICS_API
     AppsFlyer.trackEvent("ScreenTransition", string.Format("{0} (ID: {1}) to {2} (ID: {3})", FlowSystem.GetWindow(screenId).title, screenId, FlowSystem.GetWindow(toScreenId).title, toScreenId));
                 #endif
     yield return(0);
 }
コード例 #3
0
 public void LogEvent(string eventName)
 {
     FirebaseAnalytics.LogEvent(eventName.Replace(" ", string.Empty));
     if (MonoSingleton <Flurry> .Instance != null)
     {
         MonoSingleton <Flurry> .Instance.LogEvent(eventName);
     }
     FB.LogAppEvent(eventName, null, null);
     AppsFlyer.trackEvent(eventName, null);
 }
コード例 #4
0
    public static void  trackEvent(string eventName, string eventValue)
    {
#if UNITY_EDITOR
        Debug.Log("sendTrackingWithEvent:" + eventName + " value:" + eventValue);
#elif UNITY_ANDROID || UNITY_IPHONE
        //AppsFlyer
        AppsFlyer.trackEvent(eventName, eventValue);
        Debug.Log("AppsFlyer sendTrackingWithEvent:" + eventName + " value:" + eventValue);
#endif
    }