public override void OnImportAsset(AssetImportContext ctx)
        {
            TextAsset castle = new TextAsset(File.ReadAllText(ctx.assetPath));

            ctx.AddObjectToAsset("main obj", castle);
            ctx.SetMainObject(castle);

            parser = new CastleDBParser(castle);

            EditorApplication.delayCall += new EditorApplication.CallbackFunction(GenerateTypes); // Delay type generation until the asset manager has finished importing
        }
Exemple #2
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            TextAsset castle = new TextAsset(File.ReadAllText(ctx.assetPath));

            ctx.AddObjectToAsset("main obj", castle);
            ctx.SetMainObject(castle);

            CastleDBParser newCastle = new CastleDBParser(castle);

            CastleDBGenerator.GenerateTypes(newCastle.Root);
        }
Exemple #3
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            if (HasDuplicateDB(ref ctx))
            {
                Debug.LogWarning("Cannot load CastleDB database '" + ctx.assetPath + "' because a DB of the same name already exists! Please rename one of your .cdb files!"); return;
            }
            dbname = Path.GetFileNameWithoutExtension(ctx.assetPath);

            TextAsset castle = new TextAsset(File.ReadAllText(ctx.assetPath));

            ctx.AddObjectToAsset("main obj", castle);
            ctx.SetMainObject(castle);

            parser = new CastleDBParser(castle);
            EditorApplication.delayCall += new EditorApplication.CallbackFunction(GenerateTypes); // Delay type generation until the asset manager has finished importing
        }
Exemple #4
0
 private void GenerateTypes()
 {
     CastleDBGenerator.GenerateTypes(parser.Root, CastleDBConfig.Instance(), dbname);
     parser = null;
     dbname = "";
 }
 private void GenerateTypes()
 {
     CastleDBGenerator.GenerateTypes(parser.Root, GetCastleDBConfig());
     parser = null;
 }