83 lines
1.8 KiB
C#
83 lines
1.8 KiB
C#
|
|
using Godot;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
namespace Rokojori.DocGenerator
|
|
{
|
|
public class SomeArrayClass
|
|
{
|
|
public int index = 2;
|
|
public string value = "Hello World";
|
|
}
|
|
|
|
public class SomeClass
|
|
{
|
|
public float x = 0;
|
|
public float GetX()
|
|
{
|
|
return x * 2;
|
|
}
|
|
|
|
public List<SomeArrayClass> values = new List<SomeArrayClass>();
|
|
|
|
}
|
|
|
|
[GlobalClass][Tool]
|
|
public partial class CreateDoc : Node
|
|
{
|
|
[Export]
|
|
public bool testFlag;
|
|
|
|
[Export]
|
|
public bool generateFlag;
|
|
|
|
|
|
public override void _Process( double delta )
|
|
{
|
|
Test();
|
|
Generate();
|
|
|
|
}
|
|
|
|
void Test()
|
|
{
|
|
if ( ! testFlag )
|
|
{
|
|
return;
|
|
}
|
|
|
|
testFlag = false;
|
|
|
|
var obj = new SomeClass();
|
|
var sa = new SomeArrayClass();
|
|
var sb = new SomeArrayClass();
|
|
sb.value = "Huhu";
|
|
obj.values.Add( sa );
|
|
obj.values.Add( sb );
|
|
|
|
var testJSON = JSON.StringifyObject( obj );
|
|
RJLog.Log( testJSON );
|
|
}
|
|
|
|
void Generate()
|
|
{
|
|
if ( ! generateFlag )
|
|
{
|
|
return;
|
|
}
|
|
|
|
generateFlag = false;
|
|
|
|
var projectPath = "C:/rokojori/projects/rokojori-action-library/rj-action-library/rj-action-library-godot-development-project";
|
|
var libraryPath = "Scripts/Rokojori/Rokojori-Action-Library/Runtime";
|
|
var outputPath = "Scripts/Doc-Generator/Generated";
|
|
var iconPath = "C:/rokojori/projects/rokojori-action-library/rokojori-godot/rokojori-action-library/icons";
|
|
|
|
var path = FilePath.Join( projectPath, libraryPath );
|
|
var generator = new DocGenerator();
|
|
var icons = Lists.Map( FilesSync.GetFiles( iconPath, ( fp => fp.fileExtension == ".svg" ) ), fp => fp.fullFileName );
|
|
generator.Generate( path, outputPath, icons );
|
|
}
|
|
}
|
|
} |