AppSettings.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. [UnityEngine.Scripting.APIUpdating.MovedFrom(true, sourceNamespace: "", sourceAssembly: "AppRuntimes", sourceClassName: "AppSettings")]
  3. public sealed class AppSettings : ScriptableObject
  4. {
  5. public string AppAddress = string.Empty;
  6. public string AppChannel = string.Empty;
  7. public string PrivacyUrl = string.Empty;
  8. [Tooltip("Absolute HTTP(S) URL of the hot patch resource directory or manifest.json")]
  9. public string DownloadUrl = string.Empty;
  10. [HideInInspector] public bool UseLocalHotPatchResources;
  11. [Tooltip("Hot patch assembly name, saved after selecting an asmdef in the AppSettings window")]
  12. public string HotPatchAssemblyName = string.Empty;
  13. [Tooltip("Game scene to open after loading the hot patch. Built as a separate scene AssetBundle and excluded from the Player scene list.")]
  14. public string GameSceneName = string.Empty;
  15. public static string RequireGameSceneName()
  16. {
  17. var settings = Resources.Load<AppSettings>("AppSettings");
  18. if (settings == null || string.IsNullOrWhiteSpace(settings.GameSceneName))
  19. throw new System.InvalidOperationException("Enter the game scene name in AppSettings and click Save.");
  20. return settings.GameSceneName.Trim();
  21. }
  22. public static string RequireHotPatchAssemblyName()
  23. {
  24. var settings = Resources.Load<AppSettings>("AppSettings");
  25. if (settings == null || string.IsNullOrWhiteSpace(settings.HotPatchAssemblyName))
  26. throw new System.InvalidOperationException("Select the hot patch assembly in AppSettings and click Save.");
  27. return settings.HotPatchAssemblyName;
  28. }
  29. }