public void OnSuccessDownloadInfo(GA_Request.RequestType requestType, Hashtable jsonList, GA_Request.SubmitErrorHandler errorEvent)
    {
        GA.Log("Succesful index downloaded");
        CurrentAreaIndex  = 0;
        CurrentTypeIndex  = 0;
        CurrentBuildIndex = 0;
        StartDateTime     = DateTime.Now.AddDays(-14);
        EndDateTime       = DateTime.Now;
        AvailableEvents   = new List <string>();
        CurrentEventFlag  = new List <bool>();
        AvailableAreas    = new List <string>();
        AvailableBuilds   = new List <string>();
        IgnoreDates       = true;

        ArrayList jsonArrayEventID = (ArrayList)jsonList["event_id"];

        for (int i = 0; i < jsonArrayEventID.Count; i++)
        {
            try
            {
                string name;
                name = jsonArrayEventID[i].ToString();
                AvailableEvents.Add(name);
                CurrentEventFlag.Add(false);
            }
            catch
            {
                // JSON format error
                GA.LogError("GameAnalytics: Error in parsing JSON data from server");
            }
        }

        ArrayList jsonArrayArea = (ArrayList)jsonList["area"];

        for (int j = 0; j < jsonArrayArea.Count; j++)
        {
            try
            {
                string name;
                name = jsonArrayArea[j].ToString();
                AvailableAreas.Add(name);
            }
            catch
            {
                // JSON format error
                GA.LogError("GameAnalytics: Error in parsing JSON data from server");
            }
        }

        ArrayList jsonArrayBuild = (ArrayList)jsonList["build"];

        for (int k = 0; k < jsonArrayBuild.Count; k++)
        {
            try
            {
                string name;
                name = jsonArrayBuild[k].ToString();
                AvailableBuilds.Add(name);
            }
            catch
            {
                // JSON format error
                GA.LogError("GameAnalytics: Error in parsing JSON data from server");
            }
        }
    }
    public void OnSuccessDownload(GA_Request.RequestType requestType, Hashtable jsonList, GA_Request.SubmitErrorHandler errorEvent)
    {
        DownloadingData = false;
        BuildingHeatmap = true;

        if (DataContainer == null)
        {
            var dataContainerObject = new GameObject("GA_Data");
            dataContainerObject.transform.parent = transform;
            DataContainer = dataContainerObject.AddComponent <GA_HeatmapData>();

            DataContainer.Data = new List <GA_DataPoint>();
            GA.Log(DataContainer);
        }
        else if (_combineType == CombineHeatmapType.None)
        {
            DataContainer.Data.Clear();
        }

        List <GA_DataPoint> DPsToDelete = new List <GA_DataPoint>();

        ArrayList jsonArrayX     = (ArrayList)jsonList["x"];
        ArrayList jsonArrayY     = (ArrayList)jsonList["y"];
        ArrayList jsonArrayZ     = (ArrayList)jsonList["z"];
        ArrayList jsonArrayValue = (ArrayList)jsonList["value"];

        for (int i = 0; i < jsonArrayX.Count; i++)
        {
            try
            {
                bool done = false;
                if (_combineType == CombineHeatmapType.Add)
                {
                    Vector3 position = new Vector3(float.Parse(jsonArrayX[i].ToString()) / GA.SettingsGA.HeatmapGridSize.x, float.Parse(jsonArrayY[i].ToString()) / GA.SettingsGA.HeatmapGridSize.y, float.Parse(jsonArrayZ[i].ToString()) / GA.SettingsGA.HeatmapGridSize.z);
                    int     count    = int.Parse(jsonArrayValue[i].ToString());

                    for (int u = 0; u < DataContainer.Data.Count; u++)
                    {
                        if (DataContainer.Data[u].position == position)
                        {
                            DataContainer.Data[u].count += count;
                            done = true;
                            u    = DataContainer.Data.Count;
                        }
                    }
                }
                else if (_combineType == CombineHeatmapType.Subtract)
                {
                    Vector3 position = new Vector3(float.Parse(jsonArrayX[i].ToString()) / GA.SettingsGA.HeatmapGridSize.x, float.Parse(jsonArrayY[i].ToString()) / GA.SettingsGA.HeatmapGridSize.y, float.Parse(jsonArrayZ[i].ToString()) / GA.SettingsGA.HeatmapGridSize.z);
                    int     count    = int.Parse(jsonArrayValue[i].ToString());

                    for (int u = 0; u < DataContainer.Data.Count; u++)
                    {
                        if (DataContainer.Data[u].position == position)
                        {
                            DataContainer.Data[u].count = DataContainer.Data[u].count - count;

                            u    = DataContainer.Data.Count;
                            done = true;
                        }
                    }
                }
                else if (_combineType == CombineHeatmapType.SubtractZero)
                {
                    done = true;

                    Vector3 position = new Vector3(float.Parse(jsonArrayX[i].ToString()) / GA.SettingsGA.HeatmapGridSize.x, float.Parse(jsonArrayY[i].ToString()) / GA.SettingsGA.HeatmapGridSize.y, float.Parse(jsonArrayZ[i].ToString()) / GA.SettingsGA.HeatmapGridSize.z);
                    int     count    = int.Parse(jsonArrayValue[i].ToString());

                    for (int u = 0; u < DataContainer.Data.Count; u++)
                    {
                        if (DataContainer.Data[u].position == position)
                        {
                            DataContainer.Data[u].count = Mathf.Max(DataContainer.Data[u].count - count, 0);

                            if (DataContainer.Data[u].count == 0)
                            {
                                DPsToDelete.Add(DataContainer.Data[u]);
                            }

                            u = DataContainer.Data.Count;
                        }
                    }
                }

                if (_combineType == CombineHeatmapType.Subtract && !done)
                {
                    GA_DataPoint p = new GA_DataPoint();
                    p.position = new Vector3(float.Parse(jsonArrayX[i].ToString()) / GA.SettingsGA.HeatmapGridSize.x, float.Parse(jsonArrayY[i].ToString()) / GA.SettingsGA.HeatmapGridSize.y, float.Parse(jsonArrayZ[i].ToString()) / GA.SettingsGA.HeatmapGridSize.z);
                    p.count    = -(int.Parse(jsonArrayValue[i].ToString()));
                    DataContainer.Data.Add(p);
                }
                else if (_combineType != CombineHeatmapType.Subtract && (_combineType == CombineHeatmapType.None || !done))
                {
                    GA_DataPoint p = new GA_DataPoint();
                    p.position = new Vector3(float.Parse(jsonArrayX[i].ToString()) / GA.SettingsGA.HeatmapGridSize.x, float.Parse(jsonArrayY[i].ToString()) / GA.SettingsGA.HeatmapGridSize.y, float.Parse(jsonArrayZ[i].ToString()) / GA.SettingsGA.HeatmapGridSize.z);
                    p.count    = int.Parse(jsonArrayValue[i].ToString());
                    DataContainer.Data.Add(p);
                }
            }
            catch (Exception e)
            {
                // JSON format error
                GA.LogError("GameAnalytics: Error in parsing JSON data from server - " + e.Message);
            }
            BuildHeatmapPercentage = (i * 100) / jsonArrayX.Count;
        }
        foreach (GA_DataPoint dp in DPsToDelete)
        {
            DataContainer.Data.Remove(dp);
        }

        BuildingHeatmap        = false;
        BuildHeatmapPercentage = 0;

        NormalizeDataPoints(DataContainer.Data);

        GetComponent <GA_HeatMapRenderer>().OnDataUpdate();
        Loading = false;
    }