IObjectCollector.cs 760 B

123456789101112131415161718192021222324252627
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. namespace XGame.Framework.ObjectCollection
  4. {
  5. /// <summary>
  6. /// 可序列化对象收集器
  7. /// </summary>
  8. public interface IObjectCollector
  9. {
  10. Object this[string key] { get; }
  11. List<string> Keys { get; }
  12. List<Object> Objects { get; }
  13. /// <summary>
  14. /// 必须确保序列化的是GameObject才可用
  15. /// </summary>
  16. /// <param name="key"></param>
  17. /// <returns></returns>
  18. GameObject GetGameObject(string key);
  19. /// <summary>
  20. /// 必须确保序列化的是GameObject才可用
  21. /// </summary>
  22. /// <param name="key"></param>
  23. /// <returns></returns>
  24. T GetComponent<T>(string key) where T : Component;
  25. }
  26. }