Exemple #1
0
        public static TodoData LoadData()
        {
            string serializedData = EditorPrefs.GetString("PHL.ToDo.Data." + Application.dataPath, "");

            TodoData todoData = new TodoData();

            todoData.autoScan = true;

            if (!string.IsNullOrEmpty(serializedData))
            {
                EditorJsonUtility.FromJsonOverwrite(serializedData, todoData);
            }

            return(todoData);
        }
Exemple #2
0
        private void RefreshFiles()
        {
            if (_data == null)
            {
                _data = new TodoData();
            }

            _data.entries = new List <TodoEntry>();

            var assetsDir = new DirectoryInfo(Application.dataPath);

            _files =
                assetsDir.GetFiles("*.cs", SearchOption.AllDirectories)
                .Concat(assetsDir.GetFiles("*.js", SearchOption.AllDirectories))
                .ToArray();
        }
Exemple #3
0
        private void OnGUI()
        {
            if (_data == null)
            {
                _data = new TodoData();
                GUILayout.Label("No data loaded", EditorStyles.centeredGreyMiniLabel);
                return;
            }

            Toolbar();

            using (new HorizontalBlock())
            {
                Sidebar();
                MainArea();
            }
        }
Exemple #4
0
        private void OnEnable()
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                return;
            }

            RefreshFiles();

            _data = LoadData();
            RefreshEntriesToShow();

            if (_data.autoScan)
            {
                _watcher          = new FileSystemWatcher(Application.dataPath, "*.cs");
                _watcher.Changed += OnChanged;
                _watcher.Deleted += OnDeleted;
                _watcher.Renamed += OnRenamed;
                _watcher.Created += OnCreated;

                _watcher.EnableRaisingEvents   = true;
                _watcher.IncludeSubdirectories = true;
            }
        }
Exemple #5
0
 public static void SaveData(TodoData data)
 {
     EditorPrefs.SetString("PHL.ToDo.Data." + Application.dataPath, EditorJsonUtility.ToJson(data));
 }