Browse Source

add tree and menu

master
jkpete 4 weeks ago
parent
commit
6de064afec
  1. 35
      Example/SaveSystem/Script/ViewSaveSystem.cs
  2. 11
      addons/EGFramework/Module/GenerateTools/Templete/Code/EGSvgTempletes.cs
  3. 22
      addons/EGFramework/Module/GenerateTools/Templete/Godot/UI/EGodotMenu.cs
  4. 36
      addons/EGFramework/Module/GenerateTools/Templete/Godot/UI/EGodotTree.cs

35
Example/SaveSystem/Script/ViewSaveSystem.cs

@ -11,9 +11,36 @@ namespace EGFramework.Examples.Test { @@ -11,9 +11,36 @@ namespace EGFramework.Examples.Test {
{
public string[][] DataList { get; set; }
public string[][] DataList2 { get; set; }
Container container{ set; get; }
public override void _Ready()
{
Container container = this.GetNode<TabContainer>("TabContainer");
container = this.GetNode<TabContainer>("TabContainer");
Tree newTree = container.CreateNode<Tree>("treeTest");
TreeItem root = newTree.CreateItem();
TreeItem child1 = newTree.CreateItem(root);
TreeItem child2 = newTree.CreateItem(root);
TreeItem subchild1 = newTree.CreateItem(child1);
subchild1.SetText(0, "Subchild1");
child1.SetText(0, "child1");
child2.SetText(0, "child2");
Image image = Image.LoadFromFile("icon.svg");
ImageTexture texture = ImageTexture.CreateFromImage(image);
child2.AddButton(0, texture);
child2.SetButtonColor(0, 0, Colors.AliceBlue);
child2.SetIcon(0, texture);
child2.SetCellMode(0, TreeItem.TreeCellMode.String);
subchild1.SetIndeterminate(0, false);
child1.SetEditable(0,true);
}
public override void _ExitTree()
{
}
public void TestTable()
{
List<DataStudent> dataStudents = new List<DataStudent>();
for (int stu = 0; stu < 10; stu++)
{
@ -45,12 +72,6 @@ namespace EGFramework.Examples.Test { @@ -45,12 +72,6 @@ namespace EGFramework.Examples.Test {
// editParam.Init(new KeyValuePair<string, object>("数量",1));
}
public override void _ExitTree()
{
}
}
public struct DataStudent
{

11
addons/EGFramework/Module/GenerateTools/Templete/Code/EGSvgTempletes.cs

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
namespace EGFramework
{
public static class EGSVG16PX
{
public const string Circle = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"24\" cy=\"24\" r=\"20\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"3\"/></svg>";
public const string Rect = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M39 6H9C7.34315 6 6 7.34315 6 9V39C6 40.6569 7.34315 42 9 42H39C40.6569 42 42 40.6569 42 39V9C42 7.34315 40.6569 6 39 6Z\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"3\"/></svg>";
public const string Heart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15 8C8.92487 8 4 12.9249 4 19C4 30 17 40 24 42.3262C31 40 44 30 44 19C44 12.9249 39.0751 8 33 8C29.2797 8 25.9907 9.8469 24 12.6738C22.0093 9.8469 18.7203 8 15 8Z\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"miter\"/></svg>";
public const string Star = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M23.9986 5L17.8856 17.4776L4 19.4911L14.0589 29.3251L11.6544 43L23.9986 36.4192L36.3454 43L33.9586 29.3251L44 19.4911L30.1913 17.4776L23.9986 5Z\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"3\" stroke-linejoin=\"miter\"/></svg>";
}
}

22
addons/EGFramework/Module/GenerateTools/Templete/Godot/UI/EGodotMenu.cs

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
using System.Collections.Generic;
using Godot;
namespace EGFramework.UI
{
public partial class EGodotMenu : Control, IEGFramework
{
public IOCContainer PageContainer { set; get; }
public void RegisterPage<T>(T page) where T : Control
{
PageContainer.Register(page);
}
public void OpenPage<T>(T page) where T : Control
{
page.Visible = true;
}
}
}

36
addons/EGFramework/Module/GenerateTools/Templete/Godot/UI/EGodotTree.cs

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
using System.Collections.Generic;
using Godot;
namespace EGFramework.UI
{
public interface IEGodotTree
{
void RenderTree();
}
public partial class EGodotTree : Tree, IEGFramework,IEGodotTree
{
public void RenderTree()
{
}
}
public struct EGodotTreeItem
{
public string Name { set; get; }
/// <summary>
/// SVG Code.
/// </summary>
/// <value></value>
public string IconCode { set; get; }
public Stack<EGodotTreeItem> Parents { set; get; }
public List<EGodotTreeItem> Childs { set; get; }
public void AddChild()
{
}
}
}
Loading…
Cancel
Save