Game Development Reference
In-Depth Information
Figure 22.2
The asset tree for TeapotWars.
The Asset Tree
The asset tree is the complete list of every file in the Assets directory (see Figure 22.2).
The editor will eventually package all of these files into a Zip file that will be loaded by
the game
s resource cache.
One of the components on the EditorForm is a TreeView , named TreeView_As-
sets . The editor walks the entire directory, and for each file or directory, it adds a
TreeNode . The code to do this is called when the editor is initialized.
'
private void InitializeAssetTree()
{
TreeView_Assets.Nodes.Clear();
var stack = new Stack<TreeNode>();
var rootDirectory = new DirectoryInfo(m_AssetsDirectory);
var node = new TreeNode(rootDirectory.Name) { Tag = rootDirectory };
stack.Push(node);
while (stack.Count > 0)
{
var currentNode = stack.Pop();
var directoryInfo = (DirectoryInfo)currentNode.Tag;
 
 
Search WWH ::




Custom Search