public TextureCollection LoadFromLoadList(Objects.Graphics.Misc.TextureLoadList list)
        {
            if (!_systemReady)
            {
                throw new EngineException("System not ready for creation", true);
            }
            TextureCollection collection = new TextureCollection();

            foreach (var kvp in list.Entries)
            {
                switch (kvp.Value[1].ToString())
                {
                case "Atlas":
                    var atlas = new TextureAtlas(kvp.Key, kvp.Value[0].ToString(), kvp.Value[2]);
                    _textures[atlas.Name] = atlas;
                    collection.Add(atlas.Name, atlas);
                    break;

                case "Texture":
                    var texture = new TextureObject(kvp.Key, kvp.Value[0].ToString());
                    _textures[texture.Name] = texture;
                    collection.Add(texture.Name, texture);
                    break;

                case "Target":
                    var target = CreateTargetObject(kvp.Key, (int)((int[])kvp.Value[2])[0], (int)((int[])kvp.Value[2])[1]);
                    _textures[target.Name] = target;
                    collection.Add(target.Name, target);
                    break;
                }
            }
            LoadTextures();
            return(collection);
        }
예제 #2
0
        private static void LoadDff()
        {
            using (new Timing("Loading DFFs into scene"))
                using (new MemoryCounter()) {
                    var itemDefinitions   = new DefinitionCollection();
                    var modelCollection   = new ModelCollection();
                    var textureCollection = new TextureCollection(true);

                    foreach (var obj in Selection.objects)
                    {
                        var objPath = AssetDatabase.GetAssetPath(obj);

                        if (objPath.EndsWith(".dff", StringComparison.OrdinalIgnoreCase))
                        {
                            var dff = new DffFile(objPath);

                            modelCollection.Add(dff);
                            itemDefinitions.Add(new ItemDefinition(dff.FileNameWithoutExtension));
                        }
                        else if (objPath.EndsWith(".txd", StringComparison.OrdinalIgnoreCase))
                        {
                            textureCollection.Add(new TxdFile(objPath));
                        }
                    }

                    using (new Loader(itemDefinitions, modelCollection, textureCollection))
                        foreach (var definition in itemDefinitions)
                        {
                            definition.GetObject(true);
                        }
                }
        }
 public TextureCollection LoadFromLoadList(Objects.Graphics.Misc.TextureLoadList list)
 {
     if (!_systemReady)
         throw new EngineException("System not ready for creation", true);
     TextureCollection collection = new TextureCollection();
     foreach (var kvp in list.Entries)
     {
         switch(kvp.Value[1].ToString())
         {
             case"Atlas":
                 var atlas = new TextureAtlas(kvp.Key, kvp.Value[0].ToString(),kvp.Value[2]);
                 _textures[atlas.Name] = atlas;
                 collection.Add(atlas.Name, atlas);
                 break;
             case"Texture":
                 var texture = new TextureObject(kvp.Key, kvp.Value[0].ToString());
                 _textures[texture.Name] = texture;
                 collection.Add(texture.Name, texture);
                 break;
             case "Target":
                 var target = CreateTargetObject(kvp.Key, (int)((int[])kvp.Value[2])[0], (int)((int[])kvp.Value[2])[1]);
                 _textures[target.Name] = target;
                 collection.Add(target.Name, target);
                 break;
         }
     }
     LoadTextures();
     return collection;
 }