暫無描述
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.

IUtil.cs 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. namespace Uniject
  5. {
  6. /// <summary>
  7. /// An interface allowing Engine APIs to be stubbed out
  8. /// because unit tests do not have access to Engine APIs.
  9. /// </summary>
  10. internal interface IUtil
  11. {
  12. RuntimePlatform platform { get; }
  13. bool isEditor { get; }
  14. string persistentDataPath { get; }
  15. string cloudProjectId { get; }
  16. /// <summary>
  17. /// WARNING: Reading from this may require special application privileges.
  18. /// </summary>
  19. string deviceUniqueIdentifier { get; }
  20. string unityVersion { get; }
  21. string userId { get; }
  22. string gameVersion { get; }
  23. UInt64 sessionId { get; }
  24. DateTime currentTime { get; }
  25. string deviceModel { get; }
  26. string deviceName { get; }
  27. DeviceType deviceType { get; }
  28. string operatingSystem { get; }
  29. int screenWidth { get; }
  30. int screenHeight { get; }
  31. float screenDpi { get; }
  32. string screenOrientation { get; }
  33. T[] GetAnyComponentsOfType<T>() where T : class;
  34. object InitiateCoroutine(IEnumerator start);
  35. object GetWaitForSeconds(int seconds);
  36. void InitiateCoroutine(IEnumerator start, int delayInSeconds);
  37. void RunOnMainThread(Action runnable);
  38. // Have the specified action called when the app is paused or resumed.
  39. // The parameter is true if paused, false if resuming.
  40. // https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationPause.html
  41. void AddPauseListener(Action<bool> runnable);
  42. /// <summary>
  43. /// Returns true if potentialDescendant is-a potentialBase (or a subclass of potentialBase).
  44. /// </summary>
  45. /// <param name="potentialBase"></param>
  46. /// <param name="potentialDescendant"></param>
  47. /// <returns></returns>
  48. bool IsClassOrSubclass(Type potentialBase, Type potentialDescendant);
  49. }
  50. }