调整了模板
This commit is contained in:
46
BITKit/Scripts/Builder/Form/Examples/ExampleFormResource.cs
Normal file
46
BITKit/Scripts/Builder/Form/Examples/ExampleFormResource.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user