Exemplo n.º 1
0
    public void PopulateList(string a_directoryPath)
    {
        List <string> l_directories = new List <string>(Directory.GetDirectories(a_directoryPath));
        List <string> l_files       = new List <string>(Directory.GetFiles(a_directoryPath, "*.nrb"));

        foreach (string l_file in l_files)
        {
            FolderListNode l_newNode = Instantiate(recordPrefab).GetComponent <FolderListNode>();
            l_newNode.gameObject.transform.SetParent(gameObject.transform, false);
            i_childrenNodes.Add(l_newNode);
            l_newNode.InitializeFile(l_file, this);
        }

        foreach (string l_dir in l_directories)
        {
            FolderListNode l_newNode = Instantiate(listNodePrefab).GetComponent <FolderListNode>();
            l_newNode.gameObject.transform.SetParent(gameObject.transform, false);
            i_childrenNodes.Add(l_newNode);
            l_newNode.InitializeFile(l_dir, this);
        }

        AlignNodes();
        if (i_childrenNodes.Count > 0)
        {
            onListPopulated.Invoke(i_childrenNodes);
        }
    }
Exemplo n.º 2
0
 private void SelectionChanged(FolderListNode a_currentNode, FolderListNode a_previousNode)
 {
     a_previousNode.HighlightNode(false);
     a_currentNode.HighlightNode(true);
     i_currentNode = a_currentNode;
     //onNodeSelected.Invoke(i_currentNode);
 }
Exemplo n.º 3
0
 public void OnNodeClicked(FolderListNode a_clickedNode)
 {
     if (i_currentNode != a_clickedNode)
     {
         SelectionChanged(a_clickedNode, i_currentNode);
     }
 }
Exemplo n.º 4
0
 public void OnFolderNodeSelected(TreeNode a_treeNode)
 {
     Flush();
     i_currentTreeNode = a_treeNode;
     PopulateList(a_treeNode.path);
     if (i_childrenNodes.Count > 0)
     {
         i_currentNode = i_childrenNodes[0];
         SelectNode(i_currentNode, true);
     }
     SubscribeToChildren();
 }
Exemplo n.º 5
0
 public void OnRecordSaved()
 {
     if (i_currentTreeNode != null)
     {
         Flush();
         PopulateList(i_currentTreeNode.path);
         if (i_childrenNodes.Count > 0)
         {
             i_currentNode = i_childrenNodes[0];
             SelectNode(i_currentNode, true);
         }
         SubscribeToChildren();
     }
 }
Exemplo n.º 6
0
 public void OnPlayerButtonPressed(string a_action, FolderListNode a_listNode)
 {
     if (a_action == "play")
     {
         Load(a_listNode.filePath);
         StartPlaying();
         if (i_curNode != a_listNode)
         {
             if (i_curNode != null)
             {
                 i_curNode.playButton.GetComponent <Image>().sprite = a_listNode.playButtonPic;
             }
             i_curNode = a_listNode;
         }
     }
     else if (a_action == "stop")
     {
         StopPlaying();
     }
 }
Exemplo n.º 7
0
 void SelectNode(FolderListNode a_node, bool a_enabled)
 {
     a_node.HighlightNode(a_enabled);
 }