UIUtility.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //-----------------------------------------------------------------------------
  2. // UIUtilty.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. namespace CardsFramework
  11. {
  12. public static class UIUtility
  13. {
  14. /// <summary>
  15. /// Indicates if the game is running on a mobile platform.
  16. /// </summary>
  17. public readonly static bool IsMobile = OperatingSystem.IsAndroid() || OperatingSystem.IsIOS();
  18. /// <summary>
  19. /// Indicates if the game is running on a desktop platform.
  20. /// </summary>
  21. public readonly static bool IsDesktop = OperatingSystem.IsMacOS() || OperatingSystem.IsLinux() || OperatingSystem.IsWindows();
  22. /// <summary>
  23. /// Gets the name of a card asset.
  24. /// </summary>
  25. /// <param name="card">The card type for which to get the asset name.</param>
  26. /// <returns>The card's asset name.</returns>
  27. public static string GetCardAssetName(TraditionalCard card)
  28. {
  29. return string.Format("{0}{1}",
  30. ((card.Value | CardValue.FirstJoker) ==
  31. CardValue.FirstJoker ||
  32. (card.Value | CardValue.SecondJoker) ==
  33. CardValue.SecondJoker) ?
  34. "" : card.Type.ToString(), card.Value);
  35. }
  36. }
  37. }