BaseManager.cs 530 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace AdonFramework
  5. {
  6. /// <summary>
  7. /// 基础管理器单例模式
  8. /// </summary>
  9. /// <typeparam name="T"></typeparam>
  10. public class BaseManager<T> where T : new()
  11. {
  12. private static T instance;
  13. public static T Instance
  14. {
  15. get
  16. {
  17. if (instance == null)
  18. instance = new T();
  19. return instance;
  20. }
  21. }
  22. }
  23. }