Пример #1
0
                public CollectionGenerator(ModLoader.ModInfo mod_info, string base_dir, YAML.Collection mapping, GameObject gameobj)
                {
                    TargetGameObject = gameobj;
                    ModInfo          = mod_info;
                    Mapping          = mapping;

                    // initialize texture array and spritesheet mappings
                    Logger.Debug("Generating spritesheet->id->texture mapping");
                    var tex_list = new List <Texture2D>();

                    // first the general spritesheet, if it exists
                    if (mapping.Spritesheet != null)
                    {
                        _SpritesheetID(mapping.Spritesheet);
                        tex_list.Add(mod_info.Load <Texture2D>(Path.Combine(base_dir, mapping.Spritesheet)));
                        Logger.Debug($"New spritesheet: '{mapping.Spritesheet}', ID: {_LastSpritesheetID - 1}");
                    }

                    // ...then the clip spritesheets
                    foreach (var def in mapping.Definitions)
                    {
                        if (def.Value.Spritesheet != null)
                        {
                            _SpritesheetID(def.Value.Spritesheet);
                            tex_list.Add(mod_info.Load <Texture2D>(Path.Combine(base_dir, def.Value.Spritesheet)));
                            Logger.Debug($"New spritesheet: '{def.Value.Spritesheet}', ID: {_LastSpritesheetID - 1}");
                        }
                    }

                    // and then turn the list into an array
                    Textures = tex_list.ToArray();
                }
Пример #2
0
            public AnimatorGenerator(ModLoader.ModInfo mod_info, string base_dir, YAML.Animation mapping)
            {
                ModInfo = mod_info;
                Mapping = mapping;

                Collection = mod_info.Load <Collection>(Path.Combine(base_dir, mapping.Collection));
            }
Пример #3
0
 protected T Load <T>(string relative_path)
 {
     if (Info == null)
     {
         throw new InvalidOperationException("Tried calling Load from a Mod subclass before the mod is loaded");
     }
     return(Info.Load <T>(relative_path));
 }