Inheritance: MonoBehaviour
Example #1
0
    static void AddHeatMap()
    {
        GameObject go = new GameObject("GA_HeatMap");

        go.AddComponent <GA_HeatMapRenderer>();
        go.AddComponent <GA_HeatMapDataFilter>();
        Selection.activeObject = go;

        GA_Tracking.SendEvent("Added:GA_HeatMap");
    }
Example #2
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        string[] splitPath = Application.dataPath.Split('/');

        if (!splitPath[splitPath.Length - 2].Equals("ga_unity_wrapper copy"))
        {
            GA_Inspector.CheckForUpdates();

            GA_Tracking.Setup();
        }
    }
Example #3
0
    static void AddGASystemTracker()
    {
        if (FindObjectOfType(typeof(GA_SystemTracker)) == null)
        {
            GameObject go = new GameObject("GA_SystemTracker");
            go.AddComponent <GA_Gui>();
            go.AddComponent <GA_SpecialEvents>();
            go.AddComponent <GA_SystemTracker>();
            Selection.activeObject = go;

            GA_Tracking.SendEvent("Added:GA_SystemTracker");
        }
        else
        {
            GA.LogWarning("A GA_SystemTracker already exists in this scene - you should never have more than one per scene!");
        }
    }
Example #4
0
    static void AddGATracker()
    {
        if (Selection.activeGameObject != null)
        {
            if (Selection.activeGameObject.GetComponent <GA_Tracker> () == null)
            {
                Selection.activeGameObject.AddComponent <GA_Tracker> ();

                GA_Tracking.SendEvent("Added:GA_Tracker");
            }
            else
            {
                GA.LogWarning("That object already contains a GA_Tracker component.");
            }
        }
        else
        {
            GA.LogWarning("You must select the gameobject you want to add the GA_Tracker component to.");
        }
    }
Example #5
0
    /// <summary>
    /// If we already have the same message item in the queue we simply increase the message count instead of adding a duplicate.
    /// </summary>
    /// <param name='queue'>
    /// Queue.
    /// </param>
    /// <param name='item'>
    /// Item.
    /// </param>

    /*private static void StackQueue(List<GA_Submit.Item> queue, GA_Submit.Item item)
     * {
     *      bool stacked = false;
     *      for (int i = 0; i < queue.Count; i++)
     *      {
     *              if (!stacked && queue[i].Type == GA_Submit.CategoryType.GA_Log && item.Type == GA_Submit.CategoryType.GA_Log &&
     *                      queue[i].Parameters.ContainsKey(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID]) &&
     *                      item.Parameters.ContainsKey(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID]) &&
     *                      queue[i].Parameters[GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID]].Equals(item.Parameters[GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID]]) &&
     *                      queue[i].Parameters.ContainsKey(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message]) &&
     *                      item.Parameters.ContainsKey(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message]) &&
     *                      queue[i].Parameters[GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message]].Equals(item.Parameters[GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Message]]))
     *              {
     *                      stacked = true;
     *                      queue[i] = new GA_Submit.Item { AddTime = queue[i].AddTime, Parameters = queue[i].Parameters, Type = queue[i].Type, Count = Mathf.Max(2, queue[i].Count + 1) };
     *              }
     *      }
     *      if (!stacked)
     *      {
     *              queue.Add(item);
     *      }
     * }*/

    /// <summary>
    /// This is called once for every successful message submitted. We count the number of messages submitted and when
    /// we are done submitting everything in the queue we put everything in the temporary queue back into the queue
    /// </summary>
    private static void Submitted(List <GA_Submit.Item> items, bool success)
    {
        _submitCount += items.Count;

        // Update GA_Status
        if (success)
        {
            if (OnSuccess != null)
            {
                OnSuccess();
            }

                        #if UNITY_EDITOR
            GA_Tracking.EventSuccess(items);
                        #endif

            GA.SettingsGA.TotalMessagesSubmitted += items.Count;

            foreach (GA_Submit.Item it in items)
            {
                switch (it.Type)
                {
                case GA_Submit.CategoryType.GA_Event:
                    GA.SettingsGA.DesignMessagesSubmitted++;
                    break;

                /*case GA_Submit.CategoryType.GA_Log:
                 *      GA.SettingsGA.QualityMessagesSubmitted++;
                 *      break;*/
                case GA_Submit.CategoryType.GA_Error:
                    GA.SettingsGA.ErrorMessagesSubmitted++;
                    break;

                case GA_Submit.CategoryType.GA_Purchase:
                    GA.SettingsGA.BusinessMessagesSubmitted++;
                    break;

                case GA_Submit.CategoryType.GA_User:
                    GA.SettingsGA.UserMessagesSubmitted++;
                    break;
                }
            }

            if (!_userEventSuccess)
            {
                _userEventSuccess = true;

                                #if !UNITY_EDITOR
                // User event has gone through; start the queue
                GA.RunCoroutine(GA_Queue.SubmitQueue());
                GA.Log("GameAnalytics: Submission queue started.");
                                #endif
            }
        }

        /* When all items have either been submitted successfully or errors have been stored in the error queue,
         * we can return to collecting new events normally */
        if (_submitCount >= _queue.Count)
        {
            if (GA.SettingsGA.DebugMode)
            {
                GA.Log("GA: Queue submit over");
            }

            //If we were told to quit after this submit then quit
            if (QUITONSUBMIT)
            {
                Application.Quit();
            }

            //Put the items collected while we were submitting in to the queue and clear the temporary queue
            _queue     = _tempQueue;
            _tempQueue = new List <GA_Submit.Item>();

            //Do not attempt to re-submit errored messages until a message has been submitted successfully
            if (success)
            {
                _queue.AddRange(_errorQueue);
                _errorQueue = new List <GA_Submit.Item>();
            }

            //Reset counters and go back to normal event collection
            _submitCount    = 0;
            _submittingData = false;
        }
    }
Example #6
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        GA_Inspector.CheckForUpdates();

        GA_Tracking.Setup();
    }