Beispiel #1
0
        public static bool LoadSprite(string key, string path)
        {
            if (!Assets.SpriteExists($"{path}.png"))
            {
                ModEntry.MONITOR.Log($"Could not find file asset: \"{path}.png\"", LogLevel.Error);
            }
            else
            {
                // If the value is not already in the Dictionary
                if (!Assets.ASSETS.TryGetValue(key, out Texture2D assets) || assets == null)
                {
                    // Load the texture
                    assets = ModEntry.MOD_HELPER.Content.Load <Texture2D>(Assets.ModAsset($"{path}.png"), ContentSource.ModFolder);

                    // Store the texture for future loading
                    Assets.ASSETS[key] = assets;
                }
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 public static string ModLocal(string file) => Path.Combine(ModEntry.MOD_HELPER.DirectoryPath, Assets.ModAsset(file));