Browse Source

load JSON files directly instead of embedding in XML.

master
Colin McMillen 4 years ago
parent
commit
654bb7fe97
  1. 8
      Shared/ExtensionMethods.cs
  2. 2
      Shared/Sprites.cs

8
Shared/ExtensionMethods.cs

@ -1,11 +1,19 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
// All extension methods on built-in types (of C# or MonoGame) go in this file.
// Methods are ordered alphabetically by type name.
namespace SemiColinGames {
static class ExtensionMethods {
// ContentManager
public static string LoadString(this ContentManager content, string path) {
string fullPath = Path.Combine(content.RootDirectory, path);
return File.ReadAllText(fullPath);
}
// Point
public static void Deconstruct(this Point point, out int x, out int y) =>
(x, y) = (point.X, point.Y);

2
Shared/Sprites.cs

@ -83,7 +83,7 @@ namespace SemiColinGames {
public static void Load(ContentManager content) {
Executioner = new Sprite(
Textures.Executioner, content.Load<string>("sprites/ccg/executioner_female_json"));
Textures.Executioner, content.LoadString("sprites/ccg/executioner_female.json"));
}
}
}
Loading…
Cancel
Save