PackageNode.cs 884 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections.Generic;
  2. using Godot;
  3. namespace TBL.GodotSharp.Content;
  4. /// <summary>
  5. /// 资源包节点
  6. /// </summary>
  7. public abstract partial class PackageNode : Node
  8. {
  9. /// <summary>
  10. /// 自身信息
  11. /// </summary>
  12. public abstract Info SelfInfo { get; }
  13. /// <summary>
  14. /// 依赖项信息集
  15. /// </summary>
  16. public abstract ICollection<DependencyInfo> Dependencies { get; }
  17. public override void _Ready()
  18. {
  19. Name = SelfInfo.ToString();
  20. }
  21. public override void _EnterTree()
  22. {
  23. if (SelfFileSystem != null)
  24. {
  25. Content.FileSystem.AddFileSystem(SelfFileSystem);
  26. }
  27. }
  28. public override void _ExitTree()
  29. {
  30. if (SelfFileSystem != null)
  31. {
  32. Content.FileSystem.RemoveFileSystem(SelfFileSystem);
  33. SelfFileSystem.Dispose();
  34. }
  35. }
  36. }