HotReloadState.cs 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using UnityEditor;
  2. namespace SingularityGroup.HotReload.Editor {
  3. internal static class HotReloadState {
  4. private const string ServerPortKey = "HotReloadWindow.ServerPort";
  5. private const string LastPatchIdKey = "HotReloadWindow.LastPatchId";
  6. private const string ShowingRedDotKey = "HotReloadWindow.ShowingRedDot";
  7. private const string ShowedEditorsWithoutHRKey = "HotReloadWindow.ShowedEditorWithoutHR";
  8. private const string ShowedFieldInitializerWithSideEffectsKey = "HotReloadWindow.ShowedFieldInitializerWithSideEffects";
  9. private const string ShowedAddMonobehaviourMethodsKey = "HotReloadWindow.ShowedAddMonobehaviourMethods";
  10. private const string ShowedFieldInitializerExistingInstancesEditedKey = "HotReloadWindow.ShowedFieldInitializerExistingInstancesEdited";
  11. private const string ShowedFieldInitializerExistingInstancesUneditedKey = "HotReloadWindow.ShowedFieldInitializerExistingInstancesUnedited";
  12. private const string RecompiledUnsupportedChangesOnExitPlaymodeKey = "HotReloadWindow.RecompiledUnsupportedChangesOnExitPlaymode";
  13. private const string RecompiledUnsupportedChangesInPlaymodeKey = "HotReloadWindow.RecompiledUnsupportedChangesInPlaymode";
  14. private const string EditorCodePatcherInitKey = "HotReloadWindow.EditorCodePatcherInit";
  15. private const string ShowedDebuggerCompatibilityKey = "HotReloadWindow.ShowedDebuggerCompatibility";
  16. public static int ServerPort {
  17. get { return SessionState.GetInt(ServerPortKey, RequestHelper.defaultPort); }
  18. set { SessionState.SetInt(ServerPortKey, value); }
  19. }
  20. public static string LastPatchId {
  21. get { return SessionState.GetString(LastPatchIdKey, string.Empty); }
  22. set { SessionState.SetString(LastPatchIdKey, value); }
  23. }
  24. public static bool ShowingRedDot {
  25. get { return SessionState.GetBool(ShowingRedDotKey, false); }
  26. set { SessionState.SetBool(ShowingRedDotKey, value); }
  27. }
  28. public static bool ShowedEditorsWithoutHR {
  29. get { return SessionState.GetBool(ShowedEditorsWithoutHRKey, false); }
  30. set { SessionState.SetBool(ShowedEditorsWithoutHRKey, value); }
  31. }
  32. public static bool ShowedFieldInitializerWithSideEffects {
  33. get { return SessionState.GetBool(ShowedFieldInitializerWithSideEffectsKey, false); }
  34. set { SessionState.SetBool(ShowedFieldInitializerWithSideEffectsKey, value); }
  35. }
  36. public static bool ShowedAddMonobehaviourMethods {
  37. get { return SessionState.GetBool(ShowedAddMonobehaviourMethodsKey, false); }
  38. set { SessionState.SetBool(ShowedAddMonobehaviourMethodsKey, value); }
  39. }
  40. public static bool ShowedFieldInitializerExistingInstancesEdited {
  41. get { return SessionState.GetBool(ShowedFieldInitializerExistingInstancesEditedKey, false); }
  42. set { SessionState.SetBool(ShowedFieldInitializerExistingInstancesEditedKey, value); }
  43. }
  44. public static bool ShowedFieldInitializerExistingInstancesUnedited {
  45. get { return SessionState.GetBool(ShowedFieldInitializerExistingInstancesUneditedKey, false); }
  46. set { SessionState.SetBool(ShowedFieldInitializerExistingInstancesUneditedKey, value); }
  47. }
  48. public static bool RecompiledUnsupportedChangesOnExitPlaymode {
  49. get { return SessionState.GetBool(RecompiledUnsupportedChangesOnExitPlaymodeKey, false); }
  50. set { SessionState.SetBool(RecompiledUnsupportedChangesOnExitPlaymodeKey, value); }
  51. }
  52. public static bool RecompiledUnsupportedChangesInPlaymode {
  53. get { return SessionState.GetBool(RecompiledUnsupportedChangesInPlaymodeKey, false); }
  54. set { SessionState.SetBool(RecompiledUnsupportedChangesInPlaymodeKey, value); }
  55. }
  56. public static bool EditorCodePatcherInit {
  57. get { return SessionState.GetBool(EditorCodePatcherInitKey, false); }
  58. set { SessionState.SetBool(EditorCodePatcherInitKey, value); }
  59. }
  60. public static bool ShowedDebuggerCompatibility {
  61. get { return SessionState.GetBool(ShowedDebuggerCompatibilityKey, false); }
  62. set { SessionState.SetBool(ShowedDebuggerCompatibilityKey, value); }
  63. }
  64. }
  65. }