コード例 #1
0
        void DrawResultList()
        {
            StringBuilder sb = new StringBuilder();

            foreach (var gameObject in _results)
            {
                if (string.IsNullOrEmpty(gameObject.scene.name))
                {
                    continue;
                }

                sb.Length = 0;
                List <GameObject> objectTree = GetGameObjectTree(gameObject.transform);
                for (int i = 0; i < objectTree.Count; i++)
                {
                    sb.Append(objectTree[i].name);
                    if (i != objectTree.Count - 1)
                    {
                        sb.Append("/");
                    }
                }

                string          foundGOSearchText = GetFoundSearchText(sb.ToString(), _searchData);
                GenericNodeView node = AddButton(gameObject.name, "cube", OnSelectGameObject, _resultNode);
                node.overrideDisplayText = foundGOSearchText;
                node.data        = gameObject;
                node.iconColor   = Color_FoundGOColor;
                node.iconColor.a = gameObject.activeInHierarchy ? Float_ActiveGOAlpha : Float_DeactiveGOAlpha;
                node.resizable   = true;
            }
        }
コード例 #2
0
        void Search(GenericNodeView nodeView)
        {
            if (string.IsNullOrEmpty(_searchData.keyword))
            {
                return;
            }

            if (_resultNode != null)
            {
                _resultNode.RemoveFromParent();
            }
            _resultNode = CreateCategory("Result - " + DateTime.Now.ToString("[hh:mm:ss.ff]"));

            SearchGameObjects();
            // Add no result cell
            if (_results == null || _results.Count == 0)
            {
                DrawNoResultFound();
            }
            else
            {
                if (_searchData.showHierarchy)
                {
                    DrawResultTree();
                }
                else
                {
                    DrawResultList();
                }
            }

            // Update new data as the node tree has changed
            Rebuild();
        }
コード例 #3
0
        void OnSelectGameObject(GenericNodeView nodeView)
        {
            // Magic here, need to cast data to GameObject before checking null, otherwise it won't work
            GameObject selectGO = (GameObject)nodeView.data;

            if (selectGO != null)
            {
                _detailViewBuilder.SetGameObject(selectGO);
                LogConsole.PushSubView(_detailViewBuilder);
            }
            else
            {
                // Check if all game object inside result is destroyed
                foreach (GenericNodeView node in GetAllChildrenOfNode(_resultNode))
                {
                    GameObject go = (GameObject)node.data;
                    if (go == null)
                    {
                        node.overrideDisplayText = "<s>" + node.overrideDisplayText;
                    }
                }

                RefreshUI();
            }
        }
コード例 #4
0
 void SaveAll(GenericNodeView nodeView)
 {
     PlayerPrefs.Save();
     FetchData();
     DrawResults();
     Rebuild();
 }
コード例 #5
0
        void ShareAllFiles(GenericNodeView nodeView)
        {
            if (_filePaths == null)
            {
                _filePaths = Directory.GetFiles(Application.persistentDataPath, "*", SearchOption.AllDirectories);
            }

            if (_filePaths.Length > 0)
            {
                NativeShare.ShareMultiple("", _filePaths);
            }
        }
コード例 #6
0
        void RefreshLocalFiles(GenericNodeView nodeView)
        {
            if (_resultNode != null)
            {
                _resultNode.RemoveFromParent();
            }
            _resultNode = CreateCategory("Persistent Data");
            _resultNode.overrideDisplayText = "Persistent Data - " + DateTime.Now.ToString("[hh:mm:ss.ff]");

            _filePaths = Directory.GetFiles(Application.persistentDataPath, "*", SearchOption.AllDirectories);
            DrawHierarchy(_filePaths);
            CategoryPlayerPrefs.LoadCategoryStates(_rootNode, ClassName);

            Rebuild();
        }
コード例 #7
0
        void DeleteAllKeys(GenericNodeView nodeView)
        {
            PlayerPrefs.DeleteAll();

            // Re-save command info
            foreach (var command in LogConsole.GetCommands())
            {
                command.SaveAllFieldInfos();
            }
            PlayerPrefs.Save();

            FetchData();
            DrawResults();
            Rebuild();
        }
コード例 #8
0
        void DeleteAllFiles(GenericNodeView nodeView)
        {
            if (_filePaths.Length == 0)
            {
                return;
            }

            DirectoryInfo dir = new DirectoryInfo(Application.persistentDataPath);

            foreach (var file in dir.GetFiles())
            {
                file.Delete();
            }

            foreach (var directory in dir.GetDirectories())
            {
                directory.Delete(true);
            }

            RefreshLocalFiles(null);
        }
コード例 #9
0
 void InspectFile(GenericNodeView nodeView)
 {
     try
     {
         FileInfo fileInfo = (FileInfo)nodeView.data;
         if (fileInfo.Extension == ".png" || fileInfo.Extension == ".jpg")
         {
             _imageInspectorViewBuilder.SetContent(fileInfo);
             LogConsole.PushSubView(_imageInspectorViewBuilder);
         }
         else
         {
             _textInspectorViewBuilder.SetContent(fileInfo);
             LogConsole.PushSubView(_textInspectorViewBuilder);
         }
     }
     catch (Exception e)
     {
         Debug.LogError(e.Message);
     }
 }
コード例 #10
0
        void DrawResultTree()
        {
            foreach (var gameObject in _results)
            {
                Node currentNode             = _resultNode;
                List <GameObject> objectTree = GetGameObjectTree(gameObject.transform);
                for (int i = 0; i < objectTree.Count; i++)
                {
                    // Ignore all prefab/asset here
                    if (string.IsNullOrEmpty(objectTree[i].scene.name))
                    {
                        continue;
                    }

                    GenericNodeView node = (GenericNodeView)currentNode.children.Find(n => (GameObject)n.data == objectTree[i]);
                    if (node == null)
                    {
                        bool   isActive          = objectTree[i].activeInHierarchy;
                        bool   isTarget          = _results.Contains(objectTree[i]);
                        bool   isRoot            = (i == 0);
                        string foundGOSearchText = string.Format("{0}{1}",
                                                                 objectTree[i].name,
                                                                 isRoot ? string.Format(" ({0})", objectTree[i].scene.name) : string.Empty);

                        foundGOSearchText = GetFoundSearchText(foundGOSearchText, _searchData);
                        node = AddButton(objectTree[i].name, "cube", OnSelectGameObject, objectTree[i].GetInstanceID().ToString(), currentNode);
                        node.overrideDisplayText = foundGOSearchText;
                        node.data = objectTree[i];

                        // Adjust icon color
                        node.iconColor   = isTarget ? Color_FoundGOColor : Color_NormalGOColor;
                        node.iconColor.a = isActive ? Float_ActiveGOAlpha : Float_DeactiveGOAlpha;
                    }
                    currentNode = node;
                }
            }
        }
コード例 #11
0
 protected override void OnCategoryToggled(GenericNodeView nodeView)
 {
     base.OnCategoryToggled(nodeView);
     CategoryPlayerPrefs.SaveCategoryState(nodeView, ClassName);
 }
コード例 #12
0
 void RefreshData(GenericNodeView nodeView)
 {
     FetchData();
     DrawResults();
     Rebuild();
 }