Inheritance: EditorWindow
    private static void OpenUpdateWindow()
    {
        GA_UpdateWindow updateWindow = ScriptableObject.CreateInstance <GA_UpdateWindow> ();

        updateWindow.ShowUtility();
        updateWindow.position = new Rect(150, 150, 420, 340);
    }
    private static IEnumerator <WWW> CheckWebUpdate(WWW www)
    {
        yield return(www);

        try {
            Hashtable returnParam = (Hashtable)GA_MiniJSON.JsonDecode(www.text);
            string    newVersion  = ((Hashtable)returnParam["unity"])["version"].ToString();

            GA_UpdateWindow.SetNewVersion(newVersion);
            if (newVersion != GA_Settings.VERSION)
            {
                GetUpdateChanges();
            }
        }
        catch {}
    }
    private static IEnumerator <WWW> CheckWebChanges(WWW www)
    {
        yield return(www);

        try {
            GA_UpdateWindow.SetChanges(www.text);

            string skippedVersion = EditorPrefs.GetString("ga_skip_version", "");

            if (!skippedVersion.Equals(GA_UpdateWindow.GetNewVersion()))
            {
                OpenUpdateWindow();
            }
        }
        catch {}
    }
    private static IEnumerator <WWW> CheckWebChanges(WWW www)
    {
        yield return(www);

        try {
            Hashtable returnParam = (Hashtable)GA_MiniJSON.JsonDecode(www.text);

            ArrayList unity = ((ArrayList)returnParam["unity"]);
            for (int i = 0; i < unity.Count; i++)
            {
                Hashtable unityHash = (Hashtable)unity[i];
                if (unityHash["version"].ToString() == GA_UpdateWindow.GetNewVersion())
                {
                    i = unity.Count;
                    ArrayList changes    = ((ArrayList)unityHash["changes"]);
                    string    newChanges = "";
                    for (int u = 0; u < changes.Count; u++)
                    {
                        if (string.IsNullOrEmpty(newChanges))
                        {
                            newChanges = "- " + changes[u].ToString();
                        }
                        else
                        {
                            newChanges += "\n- " + changes[u].ToString();
                        }
                    }

                    GA_UpdateWindow.SetChanges(newChanges);
                    string skippedVersion = EditorPrefs.GetString("ga_skip_version", "");

                    if (!skippedVersion.Equals(GA_UpdateWindow.GetNewVersion()))
                    {
                        OpenUpdateWindow();
                    }
                }
            }
        }
        catch {}
    }
Example #5
0
	private static IEnumerator<WWW> CheckWebUpdate (WWW www)
	{
		yield return www;
		
		try {
			if (string.IsNullOrEmpty(www.error))
			{
				Hashtable returnParam = (Hashtable)GA_MiniJSON.JsonDecode(www.text);
				string newVersion = ((Hashtable)returnParam["unity"])["version"].ToString();
				
				GA_UpdateWindow.SetNewVersion(newVersion);

				int newV = int.Parse(newVersion.Replace(".",""));
				int oldV = int.Parse(GA_Settings.VERSION.Replace(".",""));

				if (newV > oldV)
				{
					GetUpdateChanges();
				}
			}
		}
		catch {}
	}
    override public void OnInspectorGUI()
    {
        GA_Settings ga = target as GA_Settings;


        EditorGUI.indentLevel = 1;
        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();


        GUILayout.Label(ga.Logo);

        GUILayout.BeginVertical();

        GUILayout.Label("GameAnalytics Unity SDK v." + GA_Settings.VERSION);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button(_myPageLink, GUILayout.MaxWidth(75)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/LoginGA");
        }
        if (GUILayout.Button(_documentationLink, GUILayout.MaxWidth(75)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/SupportDocu");
        }
        if (GUILayout.Button(_checkForUpdates, GUILayout.MaxWidth(75)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/DownloadSetup");
        }

        GUILayout.EndHorizontal();

        string updateStatus = GA_UpdateWindow.UpdateStatus(GA_Settings.VERSION);

        GUILayout.Space(5);
        GUILayout.BeginHorizontal();

        if (!updateStatus.Equals(string.Empty))
        {
            if (_orangeUpdateLabelStyle == null)
            {
                _orangeUpdateLabelStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
                _orangeUpdateLabelStyle.normal.textColor = new Color(0.875f, 0.309f, 0.094f);
            }
            if (_orangeUpdateIconStyle == null)
            {
                _orangeUpdateIconStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
            }

            if (GUILayout.Button(ga.UpdateIcon, _orangeUpdateIconStyle, GUILayout.MaxWidth(17)))
            {
                OpenUpdateWindow();
            }

            GUILayout.Label(updateStatus, _orangeUpdateLabelStyle);
        }
        else
        {
            GUILayout.Label("");
        }

        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.EndHorizontal();


        //Hints

        /*ga.DisplayHints = EditorGUILayout.Foldout(ga.DisplayHints,"Show Hints");
         * if (ga.DisplayHints)
         * {
         *      ga.DisplayHintsScrollState = GUILayout.BeginScrollView(ga.DisplayHintsScrollState, GUILayout.Height (100));
         *
         *      List<GA_Settings.HelpInfo> helpInfos = ga.GetHelpMessageList();
         *      foreach(GA_Settings.HelpInfo info in helpInfos)
         *      {
         *              MessageType msgType = ConvertMessageType(info.MsgType);
         *              EditorGUILayout.HelpBox(info.Message, msgType);
         *      }
         *
         *      GUILayout.EndScrollView();
         * }*/

        //Tabs
        GUILayout.BeginHorizontal();

        GUIStyle activeTabStyle      = new GUIStyle(EditorStyles.miniButtonMid);
        GUIStyle activeTabStyleLeft  = new GUIStyle(EditorStyles.miniButtonLeft);
        GUIStyle activeTabStyleRight = new GUIStyle(EditorStyles.miniButtonRight);

        activeTabStyle.normal      = EditorStyles.miniButtonMid.active;
        activeTabStyleLeft.normal  = EditorStyles.miniButtonLeft.active;
        activeTabStyleRight.normal = EditorStyles.miniButtonRight.active;

        GUIStyle inactiveTabStyle      = new GUIStyle(EditorStyles.miniButtonMid);
        GUIStyle inactiveTabStyleLeft  = new GUIStyle(EditorStyles.miniButtonLeft);
        GUIStyle inactiveTabStyleRight = new GUIStyle(EditorStyles.miniButtonRight);

        if (GUILayout.Button(_basic, ga.CurrentInspectorState == GA_Settings.InspectorStates.Basic?activeTabStyleLeft:inactiveTabStyleLeft))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Basic;
        }

        if (GUILayout.Button(_debug, ga.CurrentInspectorState == GA_Settings.InspectorStates.Debugging?activeTabStyle:inactiveTabStyle))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Debugging;
        }
        if (GUILayout.Button(_preferences, ga.CurrentInspectorState == GA_Settings.InspectorStates.Pref?activeTabStyleRight:inactiveTabStyleRight))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Pref;
        }
        GUILayout.EndHorizontal();

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Basic)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_publicKeyLabel, GUILayout.Width(75));
            ga.GameKey = EditorGUILayout.TextField("", ga.GameKey);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_privateKeyLabel, GUILayout.Width(75));
            ga.SecretKey = EditorGUILayout.TextField("", ga.SecretKey);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_build, GUILayout.Width(75));
            ga.Build = EditorGUILayout.TextField("", ga.Build);
            GUILayout.EndHorizontal();

            /*GUILayout.BeginHorizontal();
             * GUILayout.Label("", GUILayout.Width(7));
             * GUILayout.Label(_useBundleVersion, GUILayout.Width(150));
             * ga.UseBundleVersion = EditorGUILayout.Toggle("", ga.UseBundleVersion);
             * GUILayout.EndHorizontal();*/
        }

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Debugging)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_debugMode, GUILayout.Width(150));
            ga.DebugMode = EditorGUILayout.Toggle("", ga.DebugMode);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_debugAddEvent, GUILayout.Width(150));
            ga.DebugAddEvent = EditorGUILayout.Toggle("", ga.DebugAddEvent);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_runInEditor, GUILayout.Width(150));
            ga.RunInEditorPlayMode = EditorGUILayout.Toggle("", ga.RunInEditorPlayMode);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_sendExampleToMyGame, GUILayout.Width(150));
            ga.SendExampleGameDataToMyGame = EditorGUILayout.Toggle("", ga.SendExampleGameDataToMyGame);
            GUILayout.EndHorizontal();
        }

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Pref)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_apiKeyLabel, GUILayout.Width(75));
            ga.ApiKey = EditorGUILayout.TextField("", ga.ApiKey);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_heatmapSizeLabel, GUILayout.Width(150));
            GUILayout.EndHorizontal();

                        #if UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0
            GUILayout.Space(-15);
                        #endif

            ga.HeatmapGridSize = EditorGUILayout.Vector3Field("", ga.HeatmapGridSize);
            if (ga.HeatmapGridSize != Vector3.one)
            {
                EditorGUILayout.HelpBox("Editing the heatmap grid size must be done BEFORE data is submitted, and you must use the same grid size when setting up your heatmaps. Otherwise the heatmap data will be incorrectly displayed.", MessageType.Warning);
            }

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_interval, GUILayout.Width(150));

            int tmpTimer = 0;
            if (int.TryParse(EditorGUILayout.TextField(ga.SubmitInterval.ToString(), GUILayout.Width(38)), out tmpTimer))
            {
                ga.SubmitInterval = Mathf.Max(Mathf.Min(tmpTimer, 999), 1);
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_customUserID, GUILayout.Width(150));
            ga.CustomUserID = EditorGUILayout.Toggle("", ga.CustomUserID);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_archiveData, GUILayout.Width(150));
            ga.ArchiveData = EditorGUILayout.Toggle("", ga.ArchiveData, GUILayout.Width(36));
            GUI.enabled    = ga.ArchiveData;
            GUILayout.Label(_archiveMaxSize, GUILayout.Width(40));

            int tmpMaxArchiveSize = 0;
            if (int.TryParse(EditorGUILayout.TextField(ga.ArchiveMaxFileSize.ToString(), GUILayout.Width(48)), out tmpMaxArchiveSize))
            {
                ga.ArchiveMaxFileSize = Mathf.Max(Mathf.Min(tmpMaxArchiveSize, 2000), 0);
            }

            GUI.enabled = true;
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_allowRoaming, GUILayout.Width(150));
            ga.AllowRoaming = EditorGUILayout.Toggle("", ga.AllowRoaming);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_newSessionOnResume, GUILayout.Width(150));
            ga.NewSessionOnResume = EditorGUILayout.Toggle("", ga.NewSessionOnResume);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_autoSubmitUserInfo, GUILayout.Width(150));
            ga.AutoSubmitUserInfo = EditorGUILayout.Toggle("", ga.AutoSubmitUserInfo);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(ga);
        }
    }
Example #7
0
    override public void OnInspectorGUI()
    {
        GA_Settings ga = target as GA_Settings;


        EditorGUI.indentLevel = 1;
        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();


        GUILayout.Label(ga.Logo);

        GUILayout.BeginVertical();

        GUILayout.Label("GameAnalytics Unity SDK v." + GA_Settings.VERSION);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button(_myPageLink, GUILayout.MaxWidth(75)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/LoginGA");
        }
        if (GUILayout.Button(_documentationLink, GUILayout.MaxWidth(75)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/SupportDocu");
        }
        if (GUILayout.Button(_checkForUpdates, GUILayout.MaxWidth(75)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/DownloadSetup");
        }

        GUILayout.EndHorizontal();

        string updateStatus = GA_UpdateWindow.UpdateStatus(GA_Settings.VERSION);

        GUILayout.Space(5);
        GUILayout.BeginHorizontal();

        if (!updateStatus.Equals(string.Empty))
        {
            if (_orangeUpdateLabelStyle == null)
            {
                _orangeUpdateLabelStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
                _orangeUpdateLabelStyle.normal.textColor = new Color(0.875f, 0.309f, 0.094f);
            }
            if (_orangeUpdateIconStyle == null)
            {
                _orangeUpdateIconStyle = new GUIStyle(EditorStyles.wordWrappedLabel);
            }

            if (GUILayout.Button(ga.UpdateIcon, _orangeUpdateIconStyle, GUILayout.MaxWidth(17)))
            {
                OpenUpdateWindow();
            }

            GUILayout.Label(updateStatus, _orangeUpdateLabelStyle);
        }
        else
        {
            GUILayout.Label("");
        }

        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.EndHorizontal();


        //Hints

        /*ga.DisplayHints = EditorGUILayout.Foldout(ga.DisplayHints,"Show Hints");
         * if (ga.DisplayHints)
         * {
         *      ga.DisplayHintsScrollState = GUILayout.BeginScrollView(ga.DisplayHintsScrollState, GUILayout.Height (100));
         *
         *      List<GA_Settings.HelpInfo> helpInfos = ga.GetHelpMessageList();
         *      foreach(GA_Settings.HelpInfo info in helpInfos)
         *      {
         *              MessageType msgType = ConvertMessageType(info.MsgType);
         *              EditorGUILayout.HelpBox(info.Message, msgType);
         *      }
         *
         *      GUILayout.EndScrollView();
         * }*/

        //Tabs
        GUILayout.BeginHorizontal();

        GUIStyle activeTabStyle      = new GUIStyle(EditorStyles.miniButtonMid);
        GUIStyle activeTabStyleLeft  = new GUIStyle(EditorStyles.miniButtonLeft);
        GUIStyle activeTabStyleRight = new GUIStyle(EditorStyles.miniButtonRight);

        activeTabStyle.normal      = EditorStyles.miniButtonMid.active;
        activeTabStyleLeft.normal  = EditorStyles.miniButtonLeft.active;
        activeTabStyleRight.normal = EditorStyles.miniButtonRight.active;

        GUIStyle inactiveTabStyle      = new GUIStyle(EditorStyles.miniButtonMid);
        GUIStyle inactiveTabStyleLeft  = new GUIStyle(EditorStyles.miniButtonLeft);
        GUIStyle inactiveTabStyleRight = new GUIStyle(EditorStyles.miniButtonRight);

        if (GUILayout.Button(_basic, ga.CurrentInspectorState == GA_Settings.InspectorStates.Basic?activeTabStyleLeft:inactiveTabStyleLeft))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Basic;
        }

        if (GUILayout.Button(_debug, ga.CurrentInspectorState == GA_Settings.InspectorStates.Debugging?activeTabStyle:inactiveTabStyle))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Debugging;
        }

        if (GUILayout.Button(_preferences, ga.CurrentInspectorState == GA_Settings.InspectorStates.Pref?activeTabStyle:inactiveTabStyle))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Pref;
        }

        if (GUILayout.Button(_ads, ga.CurrentInspectorState == GA_Settings.InspectorStates.Ads?activeTabStyleRight:inactiveTabStyleRight))
        {
            ga.CurrentInspectorState = GA_Settings.InspectorStates.Ads;
        }

        GUILayout.EndHorizontal();

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Basic)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_publicKeyLabel, GUILayout.Width(75));
            ga.GameKey = EditorGUILayout.TextField("", ga.GameKey);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_privateKeyLabel, GUILayout.Width(75));
            ga.SecretKey = EditorGUILayout.TextField("", ga.SecretKey);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_build, GUILayout.Width(75));
            ga.Build = EditorGUILayout.TextField("", ga.Build);
            GUILayout.EndHorizontal();

                        #if UNITY_ANDROID
            EditorGUILayout.Space();

            if (ga.CB_enabled)
            {
                EditorGUILayout.HelpBox("Ads are enabled (see the Ad Support tab).", MessageType.Info);
            }
                        #endif

                        #if UNITY_IPHONE
            EditorGUILayout.Space();

            EditorGUILayout.HelpBox("Please refer to the iOS_Readme in the GameAnalytics/Plugins/iOS folder for information on how to setup the GA Unity SDK for iOS.", MessageType.Info);

            if (ga.IAD_enabled || ga.CB_enabled)
            {
                EditorGUILayout.HelpBox("Ads are enabled (see the Ad Support tab).", MessageType.Info);
            }
                        #endif

            /*GUILayout.BeginHorizontal();
             * GUILayout.Label("", GUILayout.Width(7));
             * GUILayout.Label(_useBundleVersion, GUILayout.Width(150));
             * ga.UseBundleVersion = EditorGUILayout.Toggle("", ga.UseBundleVersion);
             * GUILayout.EndHorizontal();*/
        }

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Debugging)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_debugMode, GUILayout.Width(150));
            ga.DebugMode = EditorGUILayout.Toggle("", ga.DebugMode);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_debugAddEvent, GUILayout.Width(150));
            ga.DebugAddEvent = EditorGUILayout.Toggle("", ga.DebugAddEvent);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_runInEditor, GUILayout.Width(150));
            ga.RunInEditorPlayMode = EditorGUILayout.Toggle("", ga.RunInEditorPlayMode);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_sendExampleToMyGame, GUILayout.Width(150));
            ga.SendExampleGameDataToMyGame = EditorGUILayout.Toggle("", ga.SendExampleGameDataToMyGame);
            GUILayout.EndHorizontal();
        }

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Pref)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_apiKeyLabel, GUILayout.Width(75));
            ga.ApiKey = EditorGUILayout.TextField("", ga.ApiKey);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_heatmapSizeLabel, GUILayout.Width(150));
            GUILayout.EndHorizontal();

                        #if UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0
            GUILayout.Space(-15);
                        #endif

            ga.HeatmapGridSize = EditorGUILayout.Vector3Field("", ga.HeatmapGridSize);
            if (ga.HeatmapGridSize != Vector3.one)
            {
                EditorGUILayout.HelpBox("Editing the heatmap grid size must be done BEFORE data is submitted, and you must use the same grid size when setting up your heatmaps. Otherwise the heatmap data will be incorrectly displayed.", MessageType.Warning);
            }

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_interval, GUILayout.Width(150));

            int tmpTimer = 0;
            if (int.TryParse(EditorGUILayout.TextField(ga.SubmitInterval.ToString(), GUILayout.Width(38)), out tmpTimer))
            {
                ga.SubmitInterval = Mathf.Max(Mathf.Min(tmpTimer, 999), 1);
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_customUserID, GUILayout.Width(150));
            ga.CustomUserID = EditorGUILayout.Toggle("", ga.CustomUserID);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_archiveData, GUILayout.Width(150));
            ga.ArchiveData = EditorGUILayout.Toggle("", ga.ArchiveData, GUILayout.Width(36));
            GUI.enabled    = ga.ArchiveData;
            GUILayout.Label(_archiveMaxSize, GUILayout.Width(40));

            int tmpMaxArchiveSize = 0;
            if (int.TryParse(EditorGUILayout.TextField(ga.ArchiveMaxFileSize.ToString(), GUILayout.Width(48)), out tmpMaxArchiveSize))
            {
                ga.ArchiveMaxFileSize = Mathf.Max(Mathf.Min(tmpMaxArchiveSize, 2000), 0);
            }

            GUI.enabled = true;
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_allowRoaming, GUILayout.Width(150));
            ga.AllowRoaming = EditorGUILayout.Toggle("", ga.AllowRoaming);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_newSessionOnResume, GUILayout.Width(150));
            ga.NewSessionOnResume = EditorGUILayout.Toggle("", ga.NewSessionOnResume);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_autoSubmitUserInfo, GUILayout.Width(150));
            ga.AutoSubmitUserInfo = EditorGUILayout.Toggle("", ga.AutoSubmitUserInfo);
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();
        }

        if (ga.CurrentInspectorState == GA_Settings.InspectorStates.Ads)
        {
            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label("GameAnalytics Ad Support", EditorStyles.largeLabel);
            if (GUILayout.Button(_documentationLink, GUILayout.MaxWidth(60)))
            {
                Application.OpenURL("http://support.gameanalytics.com/hc/en-us/articles/200841376-The-GA-Settings-object#ad");
            }
            GUILayout.EndHorizontal();

            GUILayout.Label("GameAnalytics Ad Support helps you show ads from different ad networks in your mobile games.", EditorStyles.miniLabel);

            EditorGUILayout.Space();
            Splitter(new Color(0.35f, 0.35f, 0.35f));

            //ga.IAD_foldout = EditorGUILayout.Foldout(ga.IAD_foldout, _iAd);

            GUILayout.BeginHorizontal();
            //GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label("", GUILayout.Width(-18));
            ga.IAD_enabled = EditorGUILayout.Toggle("", ga.IAD_enabled, GUILayout.Width(27));
            GUILayout.Label(_iAdenabled, GUILayout.Width(150));
            GUILayout.EndHorizontal();

            if (ga.IAD_enabled)
            {
                /*GUILayout.BeginHorizontal();
                 * GUILayout.Label("", GUILayout.Width(7));
                 * GUILayout.Label(_iAdenabled, GUILayout.Width(150));
                 * ga.IAD_enabled = EditorGUILayout.Toggle("", ga.IAD_enabled);
                 * GUILayout.EndHorizontal();
                 *
                 * GUI.enabled = ga.IAD_enabled;*/

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(7));
                GUILayout.Label(_iAdDuration, GUILayout.Width(150));
                ga.IAD_Duration = EditorGUILayout.FloatField(ga.IAD_Duration, GUILayout.Width(60));
                ga.IAD_Duration = Mathf.Max(0, ga.IAD_Duration);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(7));
                GUILayout.Label(_iAdtype, GUILayout.Width(150));
                ga.IAD_type = (ADBannerView.Type)EditorGUILayout.EnumPopup(ga.IAD_type, GUILayout.Width(125));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(7));
                GUILayout.Label(_iAdlayout, GUILayout.Width(150));
                ga.IAD_layout = (ADBannerView.Layout)EditorGUILayout.EnumPopup(ga.IAD_layout, GUILayout.Width(125));
                GUILayout.EndHorizontal();

                GUI.enabled = ga.IAD_enabled && ga.IAD_layout == ADBannerView.Layout.Manual;

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(7));
                GUILayout.Label(_iAdposition, GUILayout.Width(150));
                ga.IAD_position = EditorGUILayout.Vector2Field("", ga.IAD_position, GUILayout.Width(125));
                GUILayout.EndHorizontal();

                GUI.enabled = true;
            }

            Splitter(new Color(0.35f, 0.35f, 0.35f));

            //ga.CB_foldout = EditorGUILayout.Foldout(ga.CB_foldout, _CB);

            bool cb_status = ga.CB_enabled;

            GUILayout.BeginHorizontal();
            //GUILayout.Label("", GUILayout.Width(27));
            GUILayout.Label("", GUILayout.Width(-18));
            ga.CB_enabled = EditorGUILayout.Toggle("", ga.CB_enabled, GUILayout.Width(27));
            GUILayout.Label(_CBenabled, GUILayout.Width(150));
            GUILayout.EndHorizontal();

            if (cb_status != ga.CB_enabled)
            {
                if (ga.CB_enabled != ToggleCB())
                {
                    ga.CB_enabled = cb_status;
                }
            }

            if (ga.CB_enabled)
            {
                //GUI.enabled = ga.CB_enabled;

                                #if UNITY_ANDROID
                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(-5));
                EditorGUILayout.HelpBox("To setup Chartboost on Android please add your App ID and App Signature to the strings.xml file found in Plugins/Android/res/values/.", MessageType.Info);
                GUILayout.EndHorizontal();
                                #else
                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(7));
                GUILayout.Label(_CBappID, GUILayout.Width(150));
                ga.CB_appID = EditorGUILayout.TextField(ga.CB_appID);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(7));
                GUILayout.Label(_CBappSig, GUILayout.Width(150));
                ga.CB_appSig = EditorGUILayout.TextField(ga.CB_appSig);
                GUILayout.EndHorizontal();
                                #endif

                //GUI.enabled = true;
            }

            Splitter(new Color(0.35f, 0.35f, 0.35f));

            GUILayout.BeginHorizontal();
            GUILayout.Label(_startShowingAds, EditorStyles.largeLabel);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_startAlwaysShowAds, GUILayout.Width(150));
            ga.Start_AlwaysShowAds = EditorGUILayout.Toggle("", ga.Start_AlwaysShowAds);
            GUILayout.EndHorizontal();

            GUI.enabled = !ga.Start_AlwaysShowAds;

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_startTimePlayed, GUILayout.Width(150));
            ga.Start_TimePlayed = EditorGUILayout.Toggle("", ga.Start_TimePlayed, GUILayout.Width(27));
            GUILayout.Label("", GUILayout.Width(5));
            GUILayout.Label(_startTime, GUILayout.Width(55));
            ga.TimePlayed = EditorGUILayout.IntField(ga.TimePlayed, GUILayout.Width(60));
            ga.TimePlayed = Mathf.Max(0, ga.TimePlayed);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_startSessions, GUILayout.Width(150));
            ga.Start_Sessions = EditorGUILayout.Toggle("", ga.Start_Sessions, GUILayout.Width(27));
            GUILayout.Label("", GUILayout.Width(5));
            GUILayout.Label(_startSes, GUILayout.Width(55));
            ga.Sessions = EditorGUILayout.IntField(ga.Sessions, GUILayout.Width(60));
            ga.Sessions = Mathf.Max(0, ga.Sessions);
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label(_autoTriggers, EditorStyles.largeLabel);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_triggerAdsEnabled, GUILayout.Width(150));
            ga.Trigger_AdsEnabled = EditorGUILayout.Toggle("", ga.Trigger_AdsEnabled, GUILayout.Width(27));
            GUI.enabled           = ga.Trigger_AdsEnabled;
            GUILayout.Label("", GUILayout.Width(1));
            GUILayout.Label(_triggerAdNetwork, GUILayout.Width(55));
            if (ga.IAD_enabled && ga.CB_enabled)
            {
                ga.Trigger_AdsEnabled_network = (GA_AdSupport.GAAdNetwork)EditorGUILayout.EnumPopup(ga.Trigger_AdsEnabled_network, GUILayout.Width(80));
            }
            else
            {
                if (ga.IAD_enabled)
                {
                    ga.Trigger_AdsEnabled_network = GA_AdSupport.GAAdNetwork.iAd;
                }
                else if (ga.CB_enabled)
                {
                    ga.Trigger_AdsEnabled_network = GA_AdSupport.GAAdNetwork.Chartboost;
                }
                else
                {
                    ga.Trigger_AdsEnabled_network = GA_AdSupport.GAAdNetwork.Any;
                }

                GUILayout.Label("", GUILayout.Width(10));
                GUILayout.Label(ga.Trigger_AdsEnabled_network.ToString());
            }
            //GUILayout.Label("", GUILayout.Width(4));
            //CheckAdNetwork(ga, ga.Trigger_AdsEnabled_network);
            GUI.enabled = true;
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            GUILayout.Label(_triggerSceneChange, GUILayout.Width(150));
            ga.Trigger_SceneChange = EditorGUILayout.Toggle("", ga.Trigger_SceneChange, GUILayout.Width(27));
            GUI.enabled            = ga.Trigger_SceneChange;
            GUILayout.Label("", GUILayout.Width(1));
            GUILayout.Label(_triggerAdNetwork, GUILayout.Width(55));
            if (ga.IAD_enabled && ga.CB_enabled)
            {
                ga.Trigger_SceneChange_network = (GA_AdSupport.GAAdNetwork)EditorGUILayout.EnumPopup(ga.Trigger_SceneChange_network, GUILayout.Width(80));
            }
            else
            {
                if (ga.IAD_enabled)
                {
                    ga.Trigger_SceneChange_network = GA_AdSupport.GAAdNetwork.iAd;
                }
                else if (ga.CB_enabled)
                {
                    ga.Trigger_SceneChange_network = GA_AdSupport.GAAdNetwork.Chartboost;
                }
                else
                {
                    ga.Trigger_SceneChange_network = GA_AdSupport.GAAdNetwork.Any;
                }

                GUILayout.Label("", GUILayout.Width(10));
                GUILayout.Label(ga.Trigger_SceneChange_network.ToString());
            }
            //GUILayout.Label("", GUILayout.Width(4));
            //CheckAdNetwork(ga, ga.Trigger_SceneChange_network);
            GUI.enabled = true;
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.BeginHorizontal();
            GUILayout.Label(_customTriggers, EditorStyles.largeLabel);
            GUILayout.EndHorizontal();

            List <GA_CustomAdTrigger> triggersToRemove = new List <GA_CustomAdTrigger>();

            foreach (GA_CustomAdTrigger trigger in ga.CustomAdTriggers)
            {
                if (trigger != null)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("", GUILayout.Width(7));
                    if (GUILayout.Button("x", GUILayout.Width(19), GUILayout.Height(15)))
                    {
                        triggersToRemove.Add(trigger);
                    }
                    //GUILayout.Label("", GUILayout.Width(7));
                    GUILayout.Label(_triggerCustomID, GUILayout.Width(55));
                    trigger.eventID = EditorGUILayout.TextField(trigger.eventID);                    //, GUILayout.Width(125));
                    GUILayout.Label("", GUILayout.Width(1));
                    GUILayout.Label(_triggerCustomCat, GUILayout.Width(60));
                    trigger.eventCat = (GA_AdSupport.GAEventCat)EditorGUILayout.EnumPopup(trigger.eventCat, GUILayout.Width(80));
                    GUILayout.Label("", GUILayout.Width(1));
                    GUILayout.Label(_triggerAdNetwork, GUILayout.Width(55));
                    if (ga.IAD_enabled && ga.CB_enabled)
                    {
                        trigger.AdNetwork = (GA_AdSupport.GAAdNetwork)EditorGUILayout.EnumPopup(trigger.AdNetwork, GUILayout.Width(80));
                    }
                    else
                    {
                        if (ga.IAD_enabled)
                        {
                            trigger.AdNetwork = GA_AdSupport.GAAdNetwork.iAd;
                        }
                        else if (ga.CB_enabled)
                        {
                            trigger.AdNetwork = GA_AdSupport.GAAdNetwork.Chartboost;
                        }
                        else
                        {
                            trigger.AdNetwork = GA_AdSupport.GAAdNetwork.Any;
                        }

                        GUILayout.Label("", GUILayout.Width(10));
                        GUILayout.Label(trigger.AdNetwork.ToString());
                    }
                    //GUILayout.Label("", GUILayout.Width(4));
                    //CheckAdNetwork(ga, trigger.AdNetwork);
                    GUILayout.EndHorizontal();
                }
            }

            foreach (GA_CustomAdTrigger trigger in triggersToRemove)
            {
                ga.CustomAdTriggers.Remove(trigger);
                //ScriptableObject.DestroyImmediate(trigger);
            }

            GUILayout.Space(2);

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(7));
            if (GUILayout.Button("Add Trigger", GUILayout.Width(85)))
            {
                ga.CustomAdTriggers.Add(new GA_CustomAdTrigger());
                //ga.CustomAdTriggers.Add(ScriptableObject.CreateInstance<GA_CustomAdTrigger>());
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.Space();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(ga);
        }
    }