47 lines
883 B
C#
47 lines
883 B
C#
using Godot;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using BITFactory;
|
|
|
|
namespace BITKit;
|
|
[GlobalClass]
|
|
public partial class ExampleFormResource : FormResource
|
|
{
|
|
public ExampleFormResource(){}
|
|
public ExampleFormResource(string name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
public struct FormField : IFormField
|
|
{
|
|
public int FieldCount => 2;
|
|
public string[] FieldNames => new[] {"Filed 1", "Field 2"};
|
|
public string[] FieldTypes=> new[] {"string", "int"};
|
|
public string[] DefaultValues=> new[] {"null", "0"};
|
|
}
|
|
|
|
[Export] private string name;
|
|
|
|
public override string Name
|
|
{
|
|
get => name;
|
|
set => name = value;
|
|
}
|
|
|
|
public override IFormField[] Fields
|
|
{
|
|
get
|
|
{
|
|
var list = new List<IFormField>();
|
|
for (var i = 0; i < GD.RandRange(1, 6); i++)
|
|
{
|
|
list.Add(new FormField());
|
|
}
|
|
|
|
return list.ToArray();
|
|
}
|
|
set => throw new NotImplementedException();
|
|
}
|
|
}
|