12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System.Collections.Generic;
- using Godot;
- namespace TBL.GodotSharp.Content
- {
- /// <summary>
- /// 资源包节点
- /// </summary>
- public abstract partial class PackageNode : Node
- {
- /// <summary>
- /// 自身信息
- /// </summary>
- public abstract Info SelfInfo { get; }
- /// <summary>
- /// 依赖项信息集
- /// </summary>
- public abstract IEnumerable<DependencyInfo> Dependencies { get; }
- public override void _Ready()
- {
- Name = SelfInfo.ToString();
- }
- public override void _EnterTree()
- {
- if (SelfFileSystem != null && GetParent() is PackageContainer packageContainer)
- {
- packageContainer.FileSystem.AddFileSystem(SelfFileSystem);
- }
- }
- public override void _ExitTree()
- {
- if (SelfFileSystem != null && GetParent() is PackageContainer packageContainer)
- {
- packageContainer.FileSystem.RemoveFileSystem(SelfFileSystem);
- SelfFileSystem.Dispose();
- }
- }
- }
- }
|