Exemple #1
0
        private void AutoloadGores(IList <Type> modGores)
        {
            IList <string>             textures     = ModLoader.GetTextures(this);
            string                     goreDir      = Name + "/Gores/";
            IDictionary <string, Type> modGoreNames = new Dictionary <string, Type>();

            foreach (Type type in modGores)
            {
                string modGoreName = (type.Namespace + "." + type.Name).Replace('.', '/');
                modGoreNames[modGoreName] = type;
            }
            foreach (string texture in textures)
            {
                if (texture.IndexOf(goreDir) == 0)
                {
                    string  className = texture.Replace('/', '.');
                    ModGore modGore   = null;
                    if (modGoreNames.ContainsKey(className))
                    {
                        modGore = (ModGore)Activator.CreateInstance(modGoreNames[className]);
                    }
                    AddGore(texture, modGore);
                }
            }
        }