Esempio n. 1
0
 public void click()
 {
     googleAnalytics.LogEvent(new EventHitBuilder()
                              .SetEventCategory("Button")
                              .SetEventLabel("credit")
                              .SetEventAction("click"));
     credits.SetActive(true);
     this.transform.parent.parent.gameObject.SetActive(false);
 }
Esempio n. 2
0
 public void ShowLogScoreOfSingle(int _score)
 {
     m_myAnalytics.LogEvent(new EventHitBuilder()
                            .SetEventCategory("HighScore")
                            .SetEventAction(GamePlayConfig.Instance.ModeLevel.ToString())
                            .SetEventLabel(DataManager.instance.m_choosenCategory.m_category)
                            .SetEventValue(_score)
                            );
 }
Esempio n. 3
0
 private void trackGACustomEvent(string eventType, Dictionary <string, object> parameters)
 {
     foreach (var entry in parameters)
     {
         googleAnalyticsTracker.LogEvent(new EventHitBuilder()
                                         .SetEventCategory(eventType)
                                         .SetEventAction(entry.Key)
                                         .SetEventLabel(Convert.ToString(entry.Value)));
         //.SetEventValue(5));
     }
 }
Esempio n. 4
0
    public void gameOver(bool outOfMoves)
    {
        isGameOver = true;
        pauzeButtonScript.pauseNoMenu();
        pauzeButton.interactable = false;

        if (outOfMoves)
        {
            outOfMovesSprite.GetComponent <Renderer>().enabled = true;
        }
        else
        {
            gameOverSprite.GetComponent <Renderer>().enabled = true;
        }

        gameOverPanel.SetActive(true);
        int playerId = PlayerPrefs.GetInt("playerId");

        googleAnalytics.LogEvent("Level failed - " + getLevelManager().currentLevelIndex, "Player: " + playerId + ", level failed - " + getLevelManager().currentLevelIndex, "BecauseOutOfMoves: " + outOfMoves, 1);
        googleAnalytics.DispatchHits();
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     replayCoroutineDone = true;
     GameSaveSystem.Instance.LoadGame();
     AutoTimeMode();
     BackDropSwap.Instance.Swap(timeMode);
     CalculateHeight();
     InitializeGlobalTime();
     googleAnalytics.StartSession();
     AchievementMonitor.Instance.AParams.noOfSessions++;
     googleAnalytics.LogEvent("Game", "Language", versionName, 0);
 }
Esempio n. 6
0
    public void click()
    {
        playSound.Play();

        googleAnalytics.LogEvent(new EventHitBuilder()
                                 .SetEventCategory("Button")
                                 .SetEventLabel("play")
                                 .SetEventAction("click"));
        miniGamesMenu.SetActive(true);
        miniGamesMenu.GetComponentInChildren <AnimationGUI>().animIt();

        this.transform.parent.parent.gameObject.SetActive(false);
    }
Esempio n. 7
0
 public void LogEvent(gaEventCategories eventType, string actionTaken, string label, long eventValue)
 {
     if (isAnalyticsEnabled == true && googleAnalytics != null)
     {
         try {
             googleAnalytics.LogEvent(new EventHitBuilder()
                                      .SetEventCategory(eventType.ToString())
                                      .SetEventAction(actionTaken)
                                      .SetEventLabel(label)
                                      .SetEventValue(eventValue));
         } catch (System.Exception exception) {
             //Debug.Log(exception);
         }
     }
 }
Esempio n. 8
0
 // Use this for initialization
 public void click()
 {
     googleAnalytics.LogEvent(new EventHitBuilder()
                              .SetEventCategory("Button")
                              .SetEventLabel("removeAds")
                              .SetEventAction("click"));
     if (StoreInventory.GetItemBalance(boutique.NO_ADS_LTVG.ItemId) <= 0)
     {
         try {
             SoomlaStore.RestoreTransactions();
         } catch (Exception e) {
             Debug.LogError("SOOMLA/UNITY " + e.Message);
         }
         try {
             StoreInventory.BuyItem(boutique.NO_ADS_LTVG.ItemId);
         } catch (Exception e) {
             popUpErreur.SetActive(true);
             Debug.LogError("SOOMLA/UNITY " + e.Message);
         }
     }
 }
Esempio n. 9
0
 public void OpenSealifeTrustPage()
 {
     // Debug.Log("ANALYTICS FIRE");
     googleAnalytics.LogEvent("URL_link", "Clicked", "sealifetrust.org", 1);
     Application.OpenURL("http://www.sealifetrust.org");
 }
Esempio n. 10
0
    IEnumerator RequestPermissions()
    {
        // wait for the first frame...
        yield return(null);

        var receiver = PermissionCallbackReceiver.GetPermissionCallbackReceiver();

        if (Debug.isDebugBuild)
        {
            Debug.Log("Showing permissions explanation...");
        }

        if (Debug.isDebugBuild)
        {
            Debug.Log("Requesting CAMERA permission...");
        }
        receiver.EnsureRequiredPermission(PermissionCallbackReceiver.CAMERA_PERMISSION, cameraPermissionRequiredTitle, cameraPermissionRequiredMessage, permissionInstructionsAfterNeverAskAgainOrHomeOut, () =>
        {
            hasCameraPermission = true;
            googleAnalytics.LogEvent("Permissions", "Camera", "True", 1);
        });

        while (!hasCameraPermission.HasValue || hasCameraPermission.Value == false)
        {
            yield return(null);
        }

        if (Debug.isDebugBuild)
        {
            Debug.Log("All permissions granted.");
        }

        AllPermissionsGranted = true;
    }
Esempio n. 11
0
    void OnCollisionEnter2D(Collision2D colInfo)
    {
        if (firstCollision)
        {
            firstCollision = false;
            return;
        }

        if (colInfo.collider.tag == "Enemy")
        {
            return;
        }

        // reset early detection at every wall collision
        earlyDetection = null;

        // reset swipe lock
        lastTouch = "";

        // determine the side of the player that collided
        String dir = getCollisionSide(colInfo);

        if (GameSetup.debugMode)
        {
            Debug.Log("collision detected on player side: " + dir);
        }

        if (direction == dir && !areaCapture.colliderPartOfPath(colInfo.gameObject.GetComponent <BoxCollider2D>()))
        {
            if (GameSetup.debugMode)
            {
                Debug.Log("setting current wall");
            }
            currentWall = colInfo.gameObject.GetComponent <BoxCollider2D>();
        }

        // if the player did not collide in the direction he was going => corner problem, do nothing
        if (direction != dir)
        {
            badWall = colInfo.gameObject.GetComponent <BoxCollider2D>();
            if (GameSetup.debugMode)
            {
                Debug.Log("badwall");
            }
            return;
        }

        // stop generating trail
        if (!areaCapture.colliderPartOfPath(colInfo.gameObject.GetComponent <BoxCollider2D>()))
        {
            // check if asynchronous collision ended game
            if (!setup.isGameOverBool())
            {
                trailRenderer.stopTrail();
            }
        }
        String lastWallSide = wallSide;

        // set wall side
        setWallSide();
        //Debug.Log(wallSide);

        // create new captured area and move player in right direction
        if (!onSide)
        {
            if (GameSetup.debugMode)
            {
                Debug.Log("building wall");
            }
            areaCapture.createCollisionIfRequired(true, colInfo.gameObject.GetComponent <BoxCollider2D>());
            int playerId = PlayerPrefs.GetInt("playerId");
            googleAnalytics.LogEvent("Moves per capture - level" + GameSetup.getLevelManager().currentLevelIndex, "Player: " + playerId + ", Moves per capture - level" + GameSetup.getLevelManager().currentLevelIndex, "CaptureMoves: " + (movesInPath - 1), 1);
            //googleAnalytics.DispatchHits();
        }
        else
        {
            if (lastWallSide == "bottom")
            {
                moveDown();
            }
            if (lastWallSide == "top")
            {
                moveUp();
            }
            if (lastWallSide == "left")
            {
                moveLeft();
            }
            if (lastWallSide == "right")
            {
                moveRight();
            }
            rb.position = (setup.findClosestGridElement(rb.position).transform.position);
        }

        if (colInfo.gameObject.name == "rightWall" ||
            colInfo.gameObject.name == "leftWall" ||
            colInfo.gameObject.name == "topWall" ||
            colInfo.gameObject.name == "bottomWall")
        {
            onSide      = true;
            movesInPath = 0;
        }
        else
        {
            if (!areaCapture.colliderPartOfPath(colInfo.gameObject.GetComponent <BoxCollider2D>()))
            {
                foreach (BoxCollider2D collider in areaCapture.walls)
                {
                    if (collider == colInfo.collider)
                    {
                        onSide      = true;
                        movesInPath = 0;
                    }
                }
            }
        }

        if (!areaCapture.colliderPartOfPath(colInfo.gameObject.GetComponent <BoxCollider2D>()))
        {
            areaCapture.setLastMovePointNull();
        }
    }
Esempio n. 12
0
    public void SendAnalyticsData(int gmScore, bool mode)
    {
        score    = gmScore;
        easyMode = mode;

        googleAnalytics.LogEvent("Gameplay", "Score", "Player's Final Score", score);

        if (easyMode)
        {
            googleAnalytics.LogEvent("Gameplay", "Mode", "Game Mode Selected", 0);

//			googleAnalytics.LogEvent (new EventHitBuilder ()
//				.SetEventCategory ("Gameplay")
//				.SetEventAction ("Mode")
//				.SetEventLabel ("Easy or Hard Mode")
//				.SetEventValue (0)
//				.SetCustomMetric (0, "Easy"));
        }
        else
        {
            googleAnalytics.LogEvent("Gameplay", "Mode", "Game Mode Selected", 1);

//			googleAnalytics.LogEvent(new EventHitBuilder()
//				.SetEventCategory("Gameplay")
//				.SetEventAction("Mode")
//				.SetEventLabel("Easy or Hard Mode")
//				.SetEventValue(1)
//				.SetCustomMetric(1, "Hard"));
        }

        if (ones - free >= 1)
        {
            googleAnalytics.LogEvent("Payment", "Cash", "$1 Bill", ones);
        }
        if (fives >= 1)
        {
            googleAnalytics.LogEvent("Payment", "Cash", "$5 Bill", fives);
        }
        if (tens >= 1)
        {
            googleAnalytics.LogEvent("Payment", "Cash", "$10 Bill", tens);
        }
        if (credit >= 1)
        {
            googleAnalytics.LogEvent("Payment", "Credit", "Paid with Credit Card", credit);
        }
        if (free >= 1)
        {
            googleAnalytics.LogEvent("Payment", "Free", "Free play", free);
        }
        googleAnalytics.LogEvent("Payment", "Total", "Total Amount Paid Per Session", totalPayment);

        googleAnalytics.LogEvent("Gameplay", "Plays", "Plays paid for", plays);

        googleAnalytics.LogEvent("Time", "Time of day game was played", System.DateTime.Now.ToString(), 0);

        ResetData();
    }
Esempio n. 13
0
    public void Init()
    {
        sessionId = guid();

        PLAYER_FILE              = Application.persistentDataPath + Path.DirectorySeparatorChar + "User";
        TUTORIAL_ONE_FILE        = Application.persistentDataPath + Path.DirectorySeparatorChar + "Tut1";
        TUTORIAL_ONE_REPEAT_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "Tut1Repeat";
        TUTORIAL_TWO_FILE        = Application.persistentDataPath + Path.DirectorySeparatorChar + "Tut2";
        FEEDBACK_FILE            = Application.persistentDataPath + Path.DirectorySeparatorChar + "Fdbk";
        VIEW_COUNT_FILE          = Application.persistentDataPath + Path.DirectorySeparatorChar + "VC";

        try {
            gav3 = GetComponent <GoogleAnalyticsV3> ();

            if (Application.isEditor)
            {
                gav3.androidTrackingCode = gav3.otherTrackingCode = preProdTrackingCode;
            }
        } catch (System.Exception e) {
            LogException("Error setting up gav3", false);
        }

        // check and register repeat user
        if (File.Exists(PLAYER_FILE))
        {
            try {
                var sr = new StreamReader(PLAYER_FILE);
                userId = sr.ReadLine();
                if (userId != null && !userId.Trim().Equals(""))
                {
                    sessionCount = int.Parse(sr.ReadLine());
                }
                sessionCount++;
                sr.Close();
            } catch (System.Exception e) {
                LogException("Error reading player file", false);
            }

            try {
                var sw = new StreamWriter(PLAYER_FILE);
                sw.Write(userId + "\n" + sessionCount);
                sw.Close();
            } catch (System.Exception e) {
                LogException("Error writing player file for new user", false);
            }

            LogEvent("Application", "ReturnUser");
//			LogEvent("Application", "SessionCount:" + sessionCount);
            gav3.LogEvent(new EventHitBuilder().SetEventCategory("Application:" + sessionId).SetEventAction("SessionCount:" + sessionCount));
        }
        else
        {
            firstTimeUser = true;
        }

        // else assign userId (even if file is corrupted)
        if (userId == null || userId.Trim().Equals(""))
        {
            userId       = "U" + guid();
            sessionCount = 1;

            try {
                var sw = new StreamWriter(PLAYER_FILE);
                sw.Write(userId + "\n" + sessionCount);
                sw.Close();
            } catch (System.Exception e) {
                LogException("Error writing player file for new/null user", false);
            }
            firstTimeUser = true;
        }

        tutorialOneFinished       = File.Exists(TUTORIAL_ONE_FILE);
        tutorialOneRepeatFinished = File.Exists(TUTORIAL_ONE_REPEAT_FILE);
        tutorialTwoFinished       = File.Exists(TUTORIAL_TWO_FILE);
        feedbackFinished          = File.Exists(FEEDBACK_FILE);

        if (File.Exists(VIEW_COUNT_FILE))
        {
            try {
                var sr = new StreamReader(VIEW_COUNT_FILE);
                monoViewCount = int.Parse(sr.ReadLine());
                string svc = sr.ReadLine();
                stereoViewCount = (svc != null && !svc.Trim().Equals("") ? int.Parse(svc) : 0);
                string sivc = sr.ReadLine();
                stereoImgViewCount = (sivc != null && !sivc.Trim().Equals("") ? int.Parse(sivc) : 0);
                sr.Close();
            } catch (System.Exception e) {
                LogException("Error reading view count file", false);
            }
        }

        // register session with timestamp
        System.TimeSpan t = System.DateTime.UtcNow - new System.DateTime(1970, 1, 1);
        double          secondsSinceEpoch = t.TotalSeconds;

        if (gav3)
        {
            gav3.LogEvent(new EventHitBuilder().SetEventCategory("UserSessions").SetEventAction(userId).SetEventValue(1));
            gav3.LogEvent(new EventHitBuilder().SetEventCategory("Sessions").SetEventAction(secondsSinceEpoch + ":" + gav3.bundleVersion + ":" + userId + ":" + sessionId));
        }
        LogEvent("Application", "Platform-" + Application.platform);

        ready = true;
    }
Esempio n. 14
0
    void Start()
    {
        aSources = gameObject.GetComponents<AudioSource>();
        aliveScript = gameObject.GetComponent<AliveScript>();
        animator = gameObject.GetComponent<Animator>();
        spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
        if (playerSpeed != startPlayerSpeed) playerSpeed = startPlayerSpeed;

        spriteRenderer.color = new Color(0.6f, 0.6f, 0.6f, 1f);
        DrawLives();
        lifeIcons = GameObject.FindGameObjectsWithTag("LifeIcon");
        googleAnalytics = GameObject.FindGameObjectWithTag("GoogleAnalyticsObject").GetComponent<GoogleAnalyticsV3>();
        googleAnalytics.LogEvent(new EventHitBuilder().SetEventCategory("Level Start").SetEventAction("Level Started"));
        timeFromStart = Time.time;
    }
Esempio n. 15
0
 void OnApplicationQuit()
 {
     Debug.Log("Application ending after " + Time.time + " seconds");
     googleAnalytics.LogEvent("App", "Quit", "current view: " + currentView.Name, 1);
 }
Esempio n. 16
0
    public void Init()
    {
        sessionId = guid();

        PLAYER_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "User";
        TUTORIAL_ONE_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "Tut1";
        TUTORIAL_ONE_REPEAT_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "Tut1Repeat";
        TUTORIAL_TWO_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "Tut2";
        FEEDBACK_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "Fdbk";
        VIEW_COUNT_FILE = Application.persistentDataPath + Path.DirectorySeparatorChar + "VC";

        try {
            gav3 = GetComponent<GoogleAnalyticsV3> ();

            if (Application.isEditor) {
                gav3.androidTrackingCode = gav3.otherTrackingCode = preProdTrackingCode;
            }
        } catch (System.Exception e) {
            LogException("Error setting up gav3", false);
        }

        // check and register repeat user
        if (File.Exists(PLAYER_FILE)) {
            try {
                var sr = new StreamReader(PLAYER_FILE);
                userId = sr.ReadLine();
                if (userId != null && !userId.Trim().Equals("")) {
                    sessionCount = int.Parse(sr.ReadLine());
                }
                sessionCount++;
                sr.Close();
            } catch (System.Exception e) {
                LogException("Error reading player file", false);
            }

            try {
                var sw = new StreamWriter(PLAYER_FILE);
                sw.Write(userId + "\n" + sessionCount);
                sw.Close();
            } catch (System.Exception e) {
                LogException("Error writing player file for new user", false);
            }

            LogEvent("Application", "ReturnUser");
        //			LogEvent("Application", "SessionCount:" + sessionCount);
            gav3.LogEvent( new EventHitBuilder().SetEventCategory("Application:"+sessionId).SetEventAction("SessionCount:" + sessionCount) );
        } else {
            firstTimeUser = true;
        }

        // else assign userId (even if file is corrupted)
        if (userId == null || userId.Trim().Equals("")) {
            userId = "U" + guid();
            sessionCount = 1;

            try {
                var sw = new StreamWriter(PLAYER_FILE);
                sw.Write(userId + "\n" + sessionCount);
                sw.Close();
            } catch (System.Exception e) {
                LogException("Error writing player file for new/null user", false);
            }
            firstTimeUser = true;
        }

        tutorialOneFinished = File.Exists (TUTORIAL_ONE_FILE);
        tutorialOneRepeatFinished = File.Exists (TUTORIAL_ONE_REPEAT_FILE);
        tutorialTwoFinished = File.Exists (TUTORIAL_TWO_FILE);
        feedbackFinished = File.Exists (FEEDBACK_FILE);

        if (File.Exists (VIEW_COUNT_FILE)) {
            try {
                var sr = new StreamReader(VIEW_COUNT_FILE);
                monoViewCount = int.Parse(sr.ReadLine());
                string svc = sr.ReadLine();
                stereoViewCount = (svc != null && !svc.Trim().Equals("") ? int.Parse(svc) : 0);
                string sivc = sr.ReadLine();
                stereoImgViewCount = (sivc != null && !sivc.Trim().Equals("") ? int.Parse(sivc) : 0);
                sr.Close();
            } catch (System.Exception e) {
                LogException("Error reading view count file", false);
            }
        }

        // register session with timestamp
        System.TimeSpan t = System.DateTime.UtcNow - new System.DateTime(1970, 1, 1);
        double secondsSinceEpoch = t.TotalSeconds;
        if (gav3) {
            gav3.LogEvent( new EventHitBuilder().SetEventCategory("UserSessions").SetEventAction(userId).SetEventValue(1) );
            gav3.LogEvent( new EventHitBuilder().SetEventCategory("Sessions").SetEventAction(secondsSinceEpoch + ":" + gav3.bundleVersion + ":" + userId + ":" + sessionId) );
        }
        LogEvent("Application", "Platform-" + Application.platform);

        ready = true;
    }