You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
792 B

  1. using System;
  2. namespace SUISS.Core
  3. {
  4. public class PersistentManager : Attribute
  5. {
  6. public PersistentManager(bool loadAtRuntime)
  7. {
  8. this.LoadAtRuntime = loadAtRuntime;
  9. }
  10. public PersistentManager() : this(false)
  11. {
  12. }
  13. public static bool HasAttribute(Type type)
  14. {
  15. return Attribute.GetCustomAttribute(type, typeof(PersistentManager)) != null;
  16. }
  17. public static bool IsLoadAtRuntime(Type type)
  18. {
  19. if (!PersistentManager.HasAttribute(type))
  20. {
  21. return false;
  22. }
  23. PersistentManager persistentManager = (PersistentManager)Attribute.GetCustomAttribute(type, typeof(PersistentManager));
  24. return persistentManager.LoadAtRuntime;
  25. }
  26. public bool LoadAtRuntime { get; private set; }
  27. public static bool SceneWasLoaded;
  28. }
  29. }