public void JsonDeserializeSchemaProject() { TextAsset jsonProject = TestJsonLoader.LoadJson(BASIC_PROJECT); Assert.NotNull(jsonProject, "Unsuccessful acquirement of json text asset"); //attempt deserializing entire project LdtkJson project = LdtkJson.FromJson(jsonProject.text); }
public void GetLevelBounds() { const string lvlName = "Level"; TextAsset jsonProject = TestJsonLoader.LoadGenericProject(); LdtkJson project = LdtkJson.FromJson(jsonProject.text); Level level = project.Levels.FirstOrDefault(p => p.Identifier == lvlName); LayerInstance layer = level.LayerInstances.FirstOrDefault(p => p.IsIntGridLayer); Rect levelBounds = level.UnityWorldSpaceBounds((int)layer.GridSize); Debug.Log(levelBounds); }
static void Main(string[] args) { string text = File.ReadAllText("Entities.ldtk"); LdtkJson ldtkJson = LdtkJson.FromJson(text); LdtkGeneratorContext ctx = new LdtkGeneratorContext(); ctx.TypeConverter = new LdtkTypeConverter(); ctx.CodeSettings.Namespace = "MyNamespace.Test"; SingleFileOutput fOut = new SingleFileOutput(); fOut.OutputDir = "src-gen"; fOut.Filename = "MyFileCode.cs"; LdtkCodeGenerator cg = new LdtkCodeGenerator(); cg.GenerateCode(ldtkJson, ctx, fOut); }