public static void PickTeamEvent(string team)
 {
     UnityAnalytics.CustomEvent("PickTeam", new Dictionary <string, object>
     {
         { "team", team },
     });
 }
 void OnApplicationQuit()
 {
     Debug.Log("App Close");
     UnityAnalytics.CustomEvent("Events", new Dictionary <string, object> {
         { "Action", "AppClose" }
     });
 }
 public static void ReadAboutEvent(float time)
 {
     UnityAnalytics.CustomEvent("ReadAbout", new Dictionary <string, object>
     {
         { "time", time },
     });
 }
Exemplo n.º 4
0
    void OnTriggerEnter2D(Collider2D col)
    {
        //tag
        if (col.gameObject.tag == "Lazer")
        {
            anim.SetTrigger("died");

            GetComponent <Rigidbody2D>().isKinematic = true;
            GetComponent <Collider2D>().enabled      = false;

            endmenu.SetActive(true);
            ingamedisplay.SetActive(false);
            buttonup.SetActive(false);
            buttondown.SetActive(false);

            GetComponent <AudioSource>().PlayOneShot(died, 3.0F);

            int totalcans = 5;

            UnityAnalytics.CustomEvent("gameOver", new Dictionary <string, object>
            {
                { "totalcan", totalcans },
            });

            Everyplay.StopRecording();
            //Everyplay.SetMetadata("score", score);
            //Everyplay.PlayLastRecording();
        }
    }
 void OnApplicationPause(bool isPaused)
 {
     Debug.Log(isPaused ? "App Pause" : "App Resume");
     UnityAnalytics.CustomEvent("Events", new Dictionary <string, object> {
         { "Action", isPaused ? "App Pause" : "App Resume" }
     });
 }
Exemplo n.º 6
0
 // Métodos estáticos
 public static void CarregarTelaEstatico(Telas tela)
 {
     telaAnterior = telaAtual;
     telaAtual    = tela;
     Debug.Log("AQUI estatico " + tela);
     Application.LoadLevel(Dados.nomeTelas[(int)tela]);
     UnityAnalytics.EnviarPontosMaisTocados();
 }
Exemplo n.º 7
0
 public void RegistrarInicio()
 {
     UnityAnalytics.CustomEvent("gameStart", new Dictionary <string, object>
     {
         //{ "potions", totalPotions },
         //{ "coins", totalCoins },
     });
 }
 public static void EndedScene()
 {
     EndScene();
     UnityAnalytics.CustomEvent("Scene End", new Dictionary <string, object> {
         { "points", points },
         //{ "distance", distance }
     });
     scene = false;
 }
Exemplo n.º 9
0
    public static void GastarMaca(
        long quantidade = 1, bool reiniciar = false)
    {
        if (Dados.macasVerdeTotal > 0)
        {
            Dados.macasVerdeTotal -= quantidade;

            UnityAnalytics.GastouMaca(reiniciar);
        }
    }
 // Use this for initialization
 void Start()
 {
     UnityAnalytics.StartSDK(appId);
     UnityAnalytics.CustomEvent("Events", new Dictionary <string, object> {
         { "Action", "App Start" }
     });
     UnityAnalytics.SetUserBirthYear(1984);
     UnityAnalytics.SetUserGender(SexEnum.M);
     UnityAnalytics.SetUserId("PAHeartBeat");
 }
Exemplo n.º 11
0
    // Events

    /*
     * googleAnalytics.LogEvent("Achievement", "Unlocked", "Slay 10 dragons", 5);
     *
     * //Builder Hit with all Event parameters
     * googleAnalytics.LogEvent(new EventHitBuilder()
     * .SetEventCategory("Achievement")
     * .SetEventAction("Unlocked")
     * .SetEventLabel("Slay 10 dragons")
     * .SetEventValue(5));
     *
     * //Builder Hit with minimum required Event parameters
     * googleAnalytics.LogEvent(new EventHitBuilder()
     * .SetEventCategory("Achievement")
     * .SetEventAction("Unlocked"));
     **/

    /* Exceptions
     * public void LogException(string exceptionDescription, bool isFatal);
     *
     * googleAnalytics.LogException("Incorrect input exception", true);
     *
     * //Builder Hit with all Exception parameters
     * googleAnalytics.LogException(new ExceptionHitBuilder()
     * .SetExceptionDescription("Incorrect input exception")
     * .SetFatal(true));
     *
     * //Builder Hit with minimum required Exception parameters
     * googleAnalytics.LogException(new ExceptionHitBuilder());
     * */

    /*
     * Timings
     *
     * googleAnalytics.LogTiming("Loading", 50L, "Main Menu", "First Load");
     *
     * //Builder Hit with all Timing parameters
     * googleAnalytics.LogTiming(new TimingHitBuilder()
     * .SetTimingCategory("Loading")
     * .SetTimingInterval(50L)
     * .SetTimingName("Main Menu")
     * .SetTimingLabel("First load"));
     *
     * //Builder Hit with minimum required Timing parameters
     * googleAnalytics.LogTiming(new TimingHitBuilder()
     * .SetTimingCategory("Loading"));
     * */

    /* Social
     *
     * googleAnalytics.LogSocial("twitter", "retweet", "twitter.com/googleanalytics/status/482210840234295296");
     *
     * //Builder Hit with all Social parameters (all parameters required)
     * googleAnalytics.LogSocial(new SocialHitBuilder()
     * .SetSocialNetwork("Twitter")
     * .SetSocialAction("Retweet")
     * .SetSocialTarget("twitter.com/googleanalytics/status/482210840234295296"));
     * */

    public void trackTransaction(string productId, string purchaseMethod, float price, string currency)
    {
        if (useGoogleAnalytics && googleAnalyticsTracker != null)
        {
            googleAnalyticsTracker.LogTransaction(productId, purchaseMethod, price, 0.0, 0.0, currency);
        }
        if (useUnityAnalytics)
        {
            UnityAnalytics.Transaction(purchaseMethod + "-" + productId, Convert.ToDecimal(price), currency);
        }
    }
Exemplo n.º 12
0
    void Update()
    {
        // ANALYTICS posicao toque
        if (Input.GetMouseButtonDown(0))
        {
            UnityAnalytics.AdicionarPontoTocado();
        }
        // FIM ANALYTICS

        Verificar();
    }
Exemplo n.º 13
0
    static void EnviarAnalyticsPerder()
    {
        float tempoTotal     = Time.time - analyticsTempoInicial;
        float tempoTotalReal = Time.realtimeSinceStartup -
                               analyticsTempoInicialReal;

        UnityAnalytics.PerdeuNaFase(
            Dados.mundoAtual, Dados.faseAtual, totalDerrubados,
            Dados.pontosUltimaFase, tempoTotal,
            tempoTotalReal, Dados.bolasLancadasNestaFase,
            Dados.rebatedoresDestruidosNestaFase);
    }
Exemplo n.º 14
0
    public void CarregarTela(Telas tela, bool tocarSom = true)
    {
        if (tocarSom && som && Dados.somLigado)
        {
            Instantiate(som, Vector3.zero, Quaternion.identity);
        }

        telaAtual = tela;
        Debug.Log("AQUI " + tela);
        Application.LoadLevel(Dados.nomeTelas[(int)tela]);
        UnityAnalytics.EnviarPontosMaisTocados();
    }
Exemplo n.º 15
0
        public void SendEvent(string name, IDictionary <string, object> data, AnalyticsServices services)
        {
            if (services == AnalyticsServices.ParseDotCom || services == AnalyticsServices.Both)
            {
                var specificData = data.ToDictionary(o => o.Key, o => o.Value.ToString());

                ParseAnalytics.TrackEventAsync(name, specificData);
            }
            if (services == AnalyticsServices.UnityAnalytics || services == AnalyticsServices.Both)
            {
                UnityAnalytics.CustomEvent(name, data);
            }
        }
Exemplo n.º 16
0
    void Start()
    {
        // Google Analytics
        if (useGoogleAnalytics && googleAnalyticsTracker != null)
        {
            // Start session
            googleAnalyticsTracker.StartSession();
        }

        // Unity Analytics
        if (useUnityAnalytics)
        {
            // Start session
            UnityAnalytics.StartSDK(unityAnalyticsAppId);

            // Custom tracking: platform
                        #if UNITY_EDITOR
            trackUACustomEventPlatform("editor");
                        #elif UNITY_IPHONE
            trackUACustomEventPlatform("ios");
                        #elif UNITY_ANDROID
            trackUACustomEventPlatform("android");
                        #elif UNITY_STANDALONE_OSX
            trackUACustomEventPlatform("osx");
                        #elif UNITY_STANDALONE_WIN
            trackUACustomEventPlatform("windows");
                        #elif UNITY_WEBPLAYER
            trackUACustomEventPlatform("web");
                        #elif UNITY_WII
            trackUACustomEventPlatform("wii");
                        #elif UNITY_PS3
            trackUACustomEventPlatform("ps3");
                        #elif UNITY_XBOX360
            trackUACustomEventPlatform("xbox360");
                        #elif UNITY_FLASH
            trackUACustomEventPlatform("flash");
                        #elif UNITY_BLACKBERRY
            trackUACustomEventPlatform("blackberry");
                        #elif UNITY_WP8
            trackUACustomEventPlatform("windows-phone-8");
                        #elif UNITY_METRO
            trackUACustomEventPlatform("windows-metro");
                        #else
            trackUACustomEventPlatform("unknown-" + Application.platform);
                        #endif

            // Custom tracking: user
            trackUACustomEvent("user", "os_language", Application.systemLanguage);
        }
    }
Exemplo n.º 17
0
    private void trackUACustomEvent(string eventType, params object[] paramValues)
    {
        // Track a custom event using Unity Analytics
        //https://analytics.cloud.unity3d.com/docs
        // Max 10 params per custom event

        var parametersDict = new Dictionary <string, object>();

        for (var i = 0; i < paramValues.Length; i += 2)
        {
            parametersDict.Add(paramValues[i] as string, paramValues[i + 1]);
        }

        UnityAnalytics.CustomEvent(eventType, parametersDict);
    }
Exemplo n.º 18
0
    void Update()
    {
        // ANALYTICS posicao toque
        if (Input.GetMouseButtonDown(0))
        {
            UnityAnalytics.AdicionarPontoTocado();
        }

        if (Dados.modoDeJogo != ModosDeJogo.Normal)
        {
            return;
        }
        Atualizar();
        //MostrarPontos();
    }
Exemplo n.º 19
0
    public void RegistrarFin()
    {
        float secsJuego = Time.time;

        //int vidaGirl = GameObject.Find ("Girl").GetComponent<ControlPersonaje> ().energy;
        //int vidaGoblin = GameObject.Find ("goblin archer").GetComponent<ControlEnemigo> ().energy;
        aSource.Stop();
        UnityAnalytics.CustomEvent("gameOver", new Dictionary <string, object>
        {
            { "time", secsJuego },
            { "numReliquias", numReliquias },
            { "numEnemigosDerrotados", numEnemigosDerrotados },
            { "version", version }
        });
    }
Exemplo n.º 20
0
    // Métodos Privados
    void Awake()
    {
        _instancia = this;

        mostradorDePontos.Carregar();

        ControleMusica.MusicaMenu();

        deslocamentoPorTela.x = Screen.width;
        deslocamentoPorTela.y = Screen.height;
        deslocamentoPorTela.z = 0;

        foreach (RectTransform trans in paineisEsquerda)
        {
            float x = Camera.main.ScreenToWorldPoint(new Vector2(
                                                         -deslocamentoPorTela.x + Screen.width / 2, 0)).x;

            trans.position = new Vector3(
                x, trans.position.y, trans.position.z);
        }
        foreach (RectTransform trans in paineisDireita)
        {
            float x = Camera.main.ScreenToWorldPoint(new Vector2(
                                                         deslocamentoPorTela.x + Screen.width / 2, 0)).x;

            trans.position = new Vector3(
                x, trans.position.y, trans.position.z);
        }

        Utilidade.CarregarDados();

        Recarregar();
        //TelaMenu();

        //mostrou = false;
        //proximoTempoAd = Time.time + tempoEsperarAd;

        if (enviouAnalyticsAoComecar == false)
        {
            enviouAnalyticsAoComecar = true;
            UnityAnalytics.EnviarPontosMaisTocados();
        }
    }
Exemplo n.º 21
0
    static void EnviarAnalyticsVencer()
    {
        float tempoTotal     = Time.time - analyticsTempoInicial;
        float tempoTotalReal = Time.realtimeSinceStartup -
                               analyticsTempoInicialReal;

        int mundo = Dados.mundoAtual;
        int fase  = Dados.faseAtual;

        if (Dados.modoDeJogo != ModosDeJogo.Normal)
        {
            mundo = -1;
            fase  = Dados.jogoRapidoDificuldade;
        }

        UnityAnalytics.CompletouFase(
            mundo, fase, totalDerrubados,
            Dados.pontosUltimaFase, tempoTotal,
            tempoTotalReal, Dados.bolasLancadasNestaFase,
            Dados.rebatedoresDestruidosNestaFase);
    }
Exemplo n.º 22
0
    public static void AdicionarMacasPorPontos(int pontos)
    {
        long pts = (long)pontos;

        Dados.macasVerdesUltimaTela = 0;

        while (pts >= Dados.macasDivisorPontos)
        {
            Dados.macasVerdesUltimaTela++;
            pts -= Dados.macasDivisorPontos;
        }

        Debug.Log("Macas verdes última tela:" +
                  Dados.macasVerdesUltimaTela +
                  ", pontos restantes " + pts);

        Dados.macasVerdeTotal += Dados.macasVerdesUltimaTela;

        UnityAnalytics.GanhouMaca(
            false, (int)Dados.macasVerdesUltimaTela);
    }
Exemplo n.º 23
0
    private IEnumerator CheckVersion()
    {
        WWW w = new WWW("http://retalyx.fr/rsgg/latestversion.txt");

        yield return(w);

        if (w.error != null)
        {
            Debug.Log("Error .. " + w.error);
        }
        else
        {
            Debug.Log("Found ... ==>" + w.text + "<==");
            string   val = w.text;
            string[] v   = val.Split('|');
            lv         = v[0];
            lvdownload = v[1];

            if (lv != null && lvdownload != null)
            {
                if (float.Parse(lv) > float.Parse(version))
                {
                    UnityAnalytics.CustomEvent("update", new Dictionary <string, object>
                    {
                        { "needUpdate", true },
                        { "currentVersion", version }
                    });
                }
                else
                {
                    UnityAnalytics.CustomEvent("update", new Dictionary <string, object>
                    {
                        { "needUpdate", false },
                        { "currentVersion", version }
                    });
                }
            }
        }
    }
    public static void GameOverEvent(Dictionary <string, int> units, float time)
    {
        string pMedic   = "PlayerMedic";
        string pRPG     = "PlayerRPG";
        string pSoldier = "PlayerSoldier";
        string pTank    = "PlayerTank";

        string aMedic   = "AIMedic";
        string aRPG     = "AIRPG";
        string aSoldier = "AISoldier";
        string aTank    = "AITank";

        if (units.Count == 0)
        {
            CrossSceneMenuInfo.use.resetDict();
            units = CrossSceneMenuInfo.use.unitsSpawned;
        }


        UnityAnalytics.CustomEvent("GameOver", new Dictionary <string, object>
        {
            { pSoldier, units[pSoldier] },
            { pMedic, units[pMedic] },
            { pRPG, units[pRPG] },
            { pTank, units[pTank] },

            { aSoldier, units[aSoldier] },
            { aMedic, units[aMedic] },
            { aRPG, units[aRPG] },
            { aTank, units[aTank] },

            { "time", time }
        });

        Debug.Log("SentGameOverEvent");
    }
Exemplo n.º 25
0
 void Awake()
 {
     totalErrors = 0;
     analytics = GameObject.FindGameObjectWithTag("Analytics").transform.GetComponent<UnityAnalytics>();
 }
Exemplo n.º 26
0
    void CompletarFase()
    {
        /*
         * if (Dados.modoDeJogo == ModosDeJogo.Sobrevivencia)
         * {
         *      CompletarOnda();
         *      return;
         * }
         * //*/

        Dados.pontosUltimaFasePerfeita    = PontosFasePerfeita();
        Dados.pontosUltimaFaseDificuldade = PontosDificuldade();
        Dados.pontosUltimaFaseOnus        = CalcularPenalidades();

        Dados.pontosUltimaFaseBonus =
            Dados.pontosUltimaFaseRebatidas +
            Dados.pontosUltimaFaseVelocidade +
            Dados.pontosUltimaFaseDificuldade;

        Dados.pontosUltimaFase =
            Dados.pontosUltimaFasePassantes +
            Dados.pontosUltimaFasePerfeita +
            Dados.pontosUltimaFaseBonus -
            Dados.pontosUltimaFaseOnus;

        /*
         * Debug.Log("Pontuação final:\n"+
         *        "Passantes: "+Dados.pontosUltimaFasePassantes+"\n"+
         *        "Bônus: "+Dados.pontosUltimaFaseBonus+"\n"+
         *        "Ônus: "+Dados.pontosUltimaFaseOnus+"\n"+
         *        "Perfeita: "+Dados.pontosUltimaFasePerfeita+"\n"+
         *        "Dificuldade: "+Dados.pontosUltimaFaseDificuldade+"\n"+
         *        "Velocidade: "+Dados.pontosUltimaFaseVelocidade+"\n"+
         *        "Rebatidas: "+Dados.pontosUltimaFaseRebatidas+"\n"+
         *        "");
         * //*/

        EnviarAnalyticsVencer();

        Debug.Log("Pontos ultima fase: " + Dados.pontosUltimaFase);

        switch (Dados.modoDeJogo)
        {
        case ModosDeJogo.Normal:

            if (Dados.pontosUltimaFase > 0)
            {
                //GooglePlay.Pontuar(
                //	LeaderBoards.ModoNormal, Dados.pontosUltimaFase);
            }

            if (Dados.estatisticas.mundos[Dados.mundoAtual]
                .fases[Dados.faseAtual].completo == false)
            {
                Utilidade.AdicionarMacasPorQuantidade(1);
                UnityAnalytics.GanhouMaca(false, 1);
            }

            bool perfect =
                Dados.bolasLancadasNestaFase <= totalDerrubados;

            Dados.estatisticas.mundos[Dados.mundoAtual]
            .fases[Dados.faseAtual]
            .Completou(Dados.pontosUltimaFase, perfect);

            Debug.Log("Estatisticas: \n" +
                      "Pontos Agora:  " + Dados.pontosUltimaFase + "\n" +
                      "Pontos Melhor: " + Dados.estatisticas.mundos[Dados.mundoAtual].fases[Dados.faseAtual].melhorPontuacao + "\n" +
                      "Perfect:       " + Dados.estatisticas.mundos[Dados.mundoAtual].fases[Dados.faseAtual].perfect + "\n" +
                      "");

            Dados.estatisticas.mundos[Dados.mundoAtual]
            .VerificarFasesCompletas();

            Dados.estatisticas.VerificarMundosExtras();

            Utilidade.SalvarDados();

            ControleMusica.Vitoria();
            navegador.CarregarTela(Telas.Jogo_Normal_Vitoria, false);
            break;

        case ModosDeJogo.JogoRapido:
        case ModosDeJogo.Sobrevivencia:

            //GerenciadorUnityAds.ShowRewardedAd();
            if (Dados.pontosUltimaFase > 0)
            {
                /*
                 * GooglePlay.Pontuar(
                 *      (LeaderBoards)
                 *      (Dados.jogoRapidoDificuldade - 1),
                 *      Dados.pontosUltimaFase);
                 */
            }

            Utilidade.AdicionarMacasPorPontos(Dados.pontosUltimaFase);

            Dados.estatisticas.jogoRapido
            .Pontuar(Dados.pontosUltimaFase,
                     Dados.jogoRapidoDificuldade);

            Utilidade.SalvarDados();

            ControleMusica.Vitoria();
            navegador.CarregarTela(Telas.Jogo_Rapido_Vitoria, false);
            break;

        default:
            navegador.CarregarTelaMenu();
            break;
        }
    }
Exemplo n.º 27
0
    void Update()
    {
        // ANALYTICS posicao toque
        if (Dados.pausado == false && Input.GetMouseButtonDown(0))
        {
            UnityAnalytics.AdicionarPontoTocado();
        }
        // FIM ANALYTICS

        tempoDecorrido = Time.time - tempoInicial;
        if (Dados.modoDeJogo != ModosDeJogo.Normal)
        {
            AtualizarTempo();
        }

        if (Dados.modoDeJogo == ModosDeJogo.Sobrevivencia)
        {
            AtualizarSobrevivencia();
            return;
        }

        if (faseCompleta == false)
        {
            AtualizarOndaCima();

            if (Dados.ponteBaixo)
            {
                AtualizarOndaBaixo();
            }

            if (terminouCima)
            {
                if (Dados.ponteBaixo == false ||
                    terminouBaixo)
                {
                    faseCompleta = true;
                }
            }

            if (perdeu)
            {
                PerderNaFase();
            }
        }
        else
        {
            if (esperandoAcabarFase == false)
            {
                FimDaFase();
            }
            else
            {
                if (Time.time > tempoAcabarFase)
                {
                    CompletarFase();
                }
            }
        }

#if UNITY_EDITOR
        if (Input.GetKeyUp(KeyCode.A))
        {
            CompletarFase();
        }
#endif
    }
Exemplo n.º 28
0
 public static void AdicionarMacas(int macas = 1)
 {
     Utilidade.AdicionarMacasPorQuantidade(macas);
     Utilidade.AjeitarMacasVerdes();
     UnityAnalytics.GanhouMaca(true, macas);
 }
    // Use this for initialization
    void Start()
    {
        const string projectId = "7b6545ed-e872-4ff4-ba7f-7d96c62b3371";

        UnityAnalytics.StartSDK(projectId);
    }
Exemplo n.º 30
0
    // Use this for initialization
    void Start()
    {
        const string projectId = "e203e536-999c-4cfb-a838-9af11fbd107e";

        UnityAnalytics.StartSDK(projectId);
    }
Exemplo n.º 31
0
 public override void Load()
 {
     UnityAnalytics.StartSDK(GameCore.Instance.UnityAnalyticsProjectId);
     ParseAnalytics.TrackAppOpenedAsync();
 }