public void Initialize()
        {
            EditorApplication.update += Update;

            m_Dispatcher = new AndroidLogcatDispatcher(this);
            m_Dispatcher.Initialize();

            m_Settings = AndroidLogcatSettings.Load();
        }
        public void Shutdown()
        {
            AndroidLogcatSettings.Save(m_Settings);
            m_Settings = null;

            m_Dispatcher.Shutdown();
            m_Dispatcher = null;

            EditorApplication.update -= Update;
        }
示例#3
0
        internal static void Save(AndroidLogcatSettings settings)
        {
            if (settings == null)
            {
                throw new NullReferenceException("Android logcat settings value was null");
            }

            var data = EditorJsonUtility.ToJson(settings);

            EditorPrefs.SetString(kSettingsName, data);
        }
        public virtual void Shutdown()
        {
            Closing?.Invoke();
            // ProjectSettings is accessing some information from runtime during save
            AndroidLogcatProjectSettings.Save(m_ProjectSettings, ProjectSettingsPath, this);
            SaveEditorSettings(m_Settings);

            m_Initialized     = false;
            m_Settings        = null;
            m_ProjectSettings = null;
            m_Tools           = null;
            m_Dispatcher.Shutdown();
            m_Dispatcher = null;
        }
        public virtual void Initialize()
        {
            m_Dispatcher = new AndroidLogcatDispatcher(this);
            m_Dispatcher.Initialize();

            m_Settings = LoadEditorSettings();

            Directory.CreateDirectory(Path.GetDirectoryName(ProjectSettingsPath));
            m_ProjectSettings = AndroidLogcatProjectSettings.Load(ProjectSettingsPath);
            if (m_ProjectSettings == null)
            {
                m_ProjectSettings = new AndroidLogcatProjectSettings();
                m_ProjectSettings.Reset();
            }

            m_Tools       = CreateAndroidTools();
            m_DeviceQuery = CreateDeviceQuery();

            m_Initialized = true;
        }
        internal static AndroidLogcatSettings Load()
        {
            var settings = new AndroidLogcatSettings();

            var data = EditorPrefs.GetString(kSettingsName, "");

            if (string.IsNullOrEmpty(data))
            {
                return(settings);
            }

            try
            {
                EditorJsonUtility.FromJsonOverwrite(data, settings);
            }
            catch (Exception ex)
            {
                AndroidLogcatInternalLog.Log("Load Android Logcat Settings from Json failed: " + ex.Message);
            }
            return(settings);
        }
        private void ApplySettings(AndroidLogcatSettings settings)
        {
            int fixedHeight = settings.MessageFontSize + 5;

            AndroidLogcatStyles.kLogEntryFontSize                = settings.MessageFontSize;
            AndroidLogcatStyles.kLogEntryFixedHeight             = fixedHeight;
            AndroidLogcatStyles.background.fixedHeight           = fixedHeight;
            AndroidLogcatStyles.backgroundEven.fixedHeight       = fixedHeight;
            AndroidLogcatStyles.backgroundOdd.fixedHeight        = fixedHeight;
            AndroidLogcatStyles.priorityDefaultStyle.font        = settings.MessageFont;
            AndroidLogcatStyles.priorityDefaultStyle.fontSize    = settings.MessageFontSize;
            AndroidLogcatStyles.priorityDefaultStyle.fixedHeight = fixedHeight;
            foreach (var p in (AndroidLogcat.Priority[])Enum.GetValues(typeof(AndroidLogcat.Priority)))
            {
                AndroidLogcatStyles.priorityStyles[(int)p].normal.textColor = settings.GetMessageColor(p);
                AndroidLogcatStyles.priorityStyles[(int)p].font             = settings.MessageFont;
                AndroidLogcatStyles.priorityStyles[(int)p].fontSize         = settings.MessageFontSize;
                AndroidLogcatStyles.priorityStyles[(int)p].fixedHeight      = fixedHeight;
            }
            Repaint();
        }
 protected abstract void SaveEditorSettings(AndroidLogcatSettings settings);
 private void OnSettingsChanged(AndroidLogcatSettings settings)
 {
     m_ApplySettings = true;
 }