暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

StoreConfiguration.cs 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine.Purchasing;
  4. namespace UnityEngine.Purchasing
  5. {
  6. internal class StoreConfiguration
  7. {
  8. public AppStore androidStore { get; private set; }
  9. public StoreConfiguration(AppStore store)
  10. {
  11. androidStore = store;
  12. }
  13. public static string Serialize(StoreConfiguration store)
  14. {
  15. var dic = new Dictionary<string, object>() {
  16. { "androidStore", store.androidStore.ToString() }
  17. };
  18. return MiniJson.JsonEncode(dic);
  19. }
  20. /// <exception cref="ArgumentException">Thrown when parsing fails</exception>
  21. public static StoreConfiguration Deserialize(string json)
  22. {
  23. var dic = (Dictionary<string, object>)MiniJson.JsonDecode(json);
  24. AppStore store;
  25. var key = (string)dic["androidStore"];
  26. store = !Enum.IsDefined(typeof(AppStore), key)
  27. ? AppStore.GooglePlay
  28. : (AppStore)Enum.Parse(typeof(AppStore), (string)dic["androidStore"], true);
  29. return new StoreConfiguration(store);
  30. }
  31. }
  32. }