示例#1
0
 public static void CopyTree(AkWwiseTreeViewItem sourceRoot, AkWwiseTreeViewItem destRoot)
 {
     for (int i = 0; i < sourceRoot.children.Count(); i++)
     {
         var currItem = sourceRoot.children[i];
         var newItem  = new AkWwiseTreeViewItem(currItem as AkWwiseTreeViewItem);
         CopyTree(currItem as AkWwiseTreeViewItem, newItem);
         destRoot.AddWwiseItemChild(newItem);
     }
 }
    public override AkWwiseTreeViewItem GetComponentDataRoot(WwiseObjectType objectType)
    {
        if (!wwiseObjectFolders.ContainsKey(objectType))
        {
            ProjectRoot.AddWwiseItemChild(BuildObjectTypeTree(objectType));
        }

        var tempProjectRoot = new AkWwiseTreeViewItem(ProjectRoot);

        tempProjectRoot.AddWwiseItemChild(wwiseObjectFolders[objectType]);
        return(tempProjectRoot);
    }
 public override void UpdateSearchResults(string searchString, WwiseObjectType objectType)
 {
     SearchRoot = new AkWwiseTreeViewItem(ProjectRoot);
     if (objectType != WwiseObjectType.None)
     {
         SearchRoot = new AkWwiseTreeViewItem(ProjectRoot);
         var objectRoot = new AkWwiseTreeViewItem(wwiseObjectFolders[objectType]);
         TreeUtility.CopyTree(wwiseObjectFolders[objectType], objectRoot);
         SearchRoot.AddWwiseItemChild(objectRoot);
     }
     else
     {
         TreeUtility.CopyTree(ProjectRoot, SearchRoot);
     }
     FilterTree(SearchRoot, searchString);
 }
    private void AddItemToSearch(AkWwiseTreeViewItem sourceItem)
    {
        var matchItem = new AkWwiseTreeViewItem(sourceItem);

        SearchItems.Add(matchItem);

        var sourceParent = sourceItem.parent as AkWwiseTreeViewItem;
        var parentCopy   = Find(SearchItems, sourceParent.objectGuid);

        if (parentCopy != null)
        {
            parentCopy.AddWwiseItemChild(matchItem);
            return;
        }
        else
        {
            parentCopy = new AkWwiseTreeViewItem(sourceParent);
            parentCopy.AddWwiseItemChild(matchItem);
            SearchItems.Add(parentCopy);

            var nextParent = sourceParent.parent as AkWwiseTreeViewItem;
            while (nextParent != null)
            {
                var parentInSearchItems = Find(SearchItems, nextParent.objectGuid);
                if (parentInSearchItems != null)
                {
                    parentInSearchItems.AddWwiseItemChild(parentCopy);
                    break;
                }
                parentInSearchItems = new AkWwiseTreeViewItem(nextParent);
                parentInSearchItems.AddWwiseItemChild(parentCopy);
                SearchItems.Add(parentInSearchItems);
                parentCopy = parentInSearchItems;
                nextParent = nextParent.parent as AkWwiseTreeViewItem;
            }
        }
    }