XQualityLevel.cs 1022 B

123456789101112131415161718192021222324252627282930313233343536
  1. namespace XGame.Framework.Quality
  2. {
  3. public enum XQualityLevel
  4. {
  5. UnKnow = -1,
  6. Low = 0, // 与unity的QualitySettings对应
  7. Medium = 1,
  8. High = 2,
  9. UltraHD = 3, //超高清
  10. }
  11. public static class QualityLevelExt
  12. {
  13. /// <summary>
  14. /// 判断一个QualityLevel是否可以使用LOD
  15. /// </summary>
  16. /// <param name="quality"></param>
  17. /// <returns></returns>
  18. public static bool IsLodQuality(this XQualityLevel quality)
  19. {
  20. return quality == XQualityLevel.High || quality == XQualityLevel.Low || quality == XQualityLevel.UltraHD;
  21. }
  22. public static int ShaderLodLevel(this XQualityLevel level)
  23. {
  24. switch (level)
  25. {
  26. case XQualityLevel.Low:
  27. return 1000;
  28. case XQualityLevel.Medium:
  29. return 2000;
  30. default:
  31. return int.MaxValue;
  32. }
  33. }
  34. }
  35. }