Exemple #1
0
        /// <summary>Adds the given loader to the global set.</summary>
        private static void Add(Type type)
        {
            if (All == null)
            {
                All = new Dictionary <int, TextureNodeMeta>();
            }

            // Create an instance to pull TypeID and any other settings from:
            TextureNode node = Activator.CreateInstance(type) as TextureNode;

            int id = node.TypeID;

            if (id == -1)
            {
                return;
            }

            // Create the meta:
            TextureNodeMeta meta = new TextureNodeMeta();

            meta.Type = type;
            meta.ID   = id;
            meta.Name = type.Name;

            // Push to set:
            All[id] = meta;
        }
        public TextureNode ReadTextureNode()
        {
            // Get the type:
            int type = (int)ReadCompressed();

            if (type == 0)
            {
                return(null);
            }


            // Get the node meta:
            TextureNodeMeta meta = TextureNodes.Get(type);

            // Instance it:
            TextureNode instance = meta.GetInstance();

            // Load now:
            instance.Read(this);

            return(instance);
        }
 /// <summary>Gets hold of the selected node and figures out the approximate file name.</summary>
 private static void LoadSelected()
 {
     // Get the node:
     SelectedNode = Instances[SelectedIndex];
 }