No Description
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.

AppStoreExtensionMethods.cs 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using UnityEngine.Purchasing;
  4. namespace UnityEditor.Purchasing
  5. {
  6. internal static class AppStoreExtensionMethods
  7. {
  8. static readonly Dictionary<AppStore, string> AppStoreDisplayNames = new Dictionary<AppStore, string>()
  9. {
  10. {AppStore.AmazonAppStore, "Amazon Appstore"},
  11. {AppStore.AppleAppStore, "Apple App Store"},
  12. {AppStore.GooglePlay, "Google Play"},
  13. {AppStore.UDP, "Unity Distribution Portal"},
  14. {AppStore.MacAppStore, "Mac App Store"},
  15. {AppStore.WinRT, "Microsoft Store"},
  16. {AppStore.fake, "Fake App Store"}
  17. };
  18. public static string ToDisplayName(this AppStore value)
  19. {
  20. return AppStoreDisplayNames.ContainsKey(value) ? AppStoreDisplayNames[value] : "";
  21. }
  22. public static AppStore ToAppStoreFromDisplayName(this string value)
  23. {
  24. if (AppStoreDisplayNames.ContainsValue(value))
  25. {
  26. var dict = AppStoreDisplayNames;
  27. return dict.FirstOrDefault(x => x.Value == value).Key;
  28. }
  29. return AppStore.NotSpecified;
  30. }
  31. public static bool IsAndroid(this AppStore value)
  32. {
  33. return (int)value >= (int)AppStoreMeta.AndroidStoreStart &&
  34. (int)value <= (int)AppStoreMeta.AndroidStoreEnd;
  35. }
  36. }
  37. }