StdCommonParams.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using Unity.Services.Analytics.Internal;
  2. using UnityEngine;
  3. namespace Unity.Services.Analytics.Data
  4. {
  5. // http://go/UA2_Spreadsheet
  6. // but they are not a) provided by us or b) an event param.
  7. // JIRA-193 - Fetch this data!
  8. // Some of the info can be got here: https://docs.unity3d.com/ScriptReference/SystemInfo.html
  9. /// <summary>
  10. /// All the common event params that exist in all Events.
  11. /// There is other info in this spreadsheet that is common
  12. /// </summary>
  13. class StdCommonParams
  14. {
  15. internal string GameStoreID { get; set; }
  16. internal string GameBundleID { get; set; }
  17. internal string Platform { get; set; }
  18. internal string UasUserID { get; set; }
  19. internal string Idfv { get; set; }
  20. internal double? DeviceVolume { get; set; }
  21. internal double? BatteryLoad { get; set; }
  22. internal string BuildGuuid { get; set; }
  23. internal string ClientVersion { get; set; }
  24. internal string UserCountry { get; set; }
  25. internal string ProjectID { get; set; }
  26. internal void SerializeCommonEventParams(ref IBuffer buf, string callingMethodIdentifier)
  27. {
  28. if (!string.IsNullOrEmpty(GameStoreID))
  29. {
  30. // Schema: Optional
  31. buf.PushString(GameStoreID, "gameStoreID");
  32. }
  33. if (!string.IsNullOrEmpty(GameBundleID))
  34. {
  35. // Schema: Optional
  36. buf.PushString(GameBundleID, "gameBundleID");
  37. }
  38. if (!string.IsNullOrEmpty(Platform))
  39. {
  40. // Schema: Optional, IsEnum
  41. buf.PushString(Platform, "platform");
  42. }
  43. if (!string.IsNullOrEmpty(Idfv))
  44. {
  45. // Schema: Optional
  46. buf.PushString(Idfv, "idfv");
  47. }
  48. if (!string.IsNullOrEmpty(UasUserID))
  49. {
  50. // Schema: Optional
  51. buf.PushString(UasUserID, "uasUserID");
  52. }
  53. if (!string.IsNullOrEmpty(BuildGuuid))
  54. {
  55. // Schema: Optional
  56. buf.PushString(BuildGuuid, "buildGUUID");
  57. }
  58. if (!string.IsNullOrEmpty(ClientVersion))
  59. {
  60. // Schema: Required
  61. buf.PushString(ClientVersion, "clientVersion");
  62. }
  63. if (!string.IsNullOrEmpty(UserCountry))
  64. {
  65. // Schema: Optional, IsEnum
  66. buf.PushString(UserCountry, "userCountry");
  67. }
  68. if (DeviceVolume != null)
  69. {
  70. buf.PushDouble(DeviceVolume.Value, "deviceVolume"); // Schema: Optional
  71. }
  72. if (BatteryLoad != null)
  73. {
  74. buf.PushDouble(BatteryLoad.Value, "batteryLoad"); // Schema: Optional
  75. }
  76. if (!string.IsNullOrEmpty(ProjectID))
  77. {
  78. buf.PushString(ProjectID, "projectID");
  79. }
  80. // Schema: Required
  81. buf.PushString(callingMethodIdentifier, "sdkMethod");
  82. }
  83. }
  84. }