com.xd.sdk.common 7.1.1 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/Editor/Android/XDCommonAndroidGradleProcessor.cs +2 -0
  2. package/Editor/XD.SDK.Common.Editor.asmdef +2 -1
  3. package/Plugins/Android/libs/XDGBridgeCommon_v7_7.2.0.aar +0 -0
  4. package/Plugins/Android/libs/XDGCommon_7.2.0.aar +0 -0
  5. package/Plugins/Android/libs/XDGTapTapWrapperInternal_7.2.0.aar +0 -0
  6. package/Plugins/Android/libs/{XDTapTapWrapper_7.1.0.aar → XDTapTapWrapper_7.2.0.aar} +0 -0
  7. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_chat.png +0 -0
  8. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_chat.png.meta +7 -0
  9. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_invite.png +0 -0
  10. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_invite.png.meta +7 -0
  11. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_unfollow.png +0 -0
  12. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark/tap_profile_unfollow.png.meta +7 -0
  13. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/dark.meta +8 -0
  14. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_chat.png +0 -0
  15. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_chat.png.meta +7 -0
  16. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_invite.png +0 -0
  17. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_invite.png.meta +7 -0
  18. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_unfollow.png +0 -0
  19. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light/tap_profile_unfollow.png.meta +7 -0
  20. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/light.meta +8 -0
  21. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement.png +0 -0
  22. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement.png.meta +7 -0
  23. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement_platinum.png +0 -0
  24. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_achievement_platinum.png.meta +7 -0
  25. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_arrow.png +0 -0
  26. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_arrow.png.meta +7 -0
  27. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_close.png +0 -0
  28. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_close.png.meta +7 -0
  29. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_default_background.png +0 -0
  30. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_default_background.png.meta +7 -0
  31. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_logo.png +0 -0
  32. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile/tap_profile_logo.png.meta +7 -0
  33. package/Plugins/iOS/Resource/TapTapLoginResource.bundle/userProfile.meta +8 -0
  34. package/Plugins/iOS/XDCommonSDK.framework/Headers/NSError+XDG.h +1 -0
  35. package/Plugins/iOS/XDCommonSDK.framework/Headers/TDSGlobalRouterSchemes.h +2 -0
  36. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDConfigManager.h +1 -1
  37. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAnnouncementConfig.h.meta +7 -0
  38. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGAnnouncementManager.h.meta +7 -0
  39. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGCloudLogHelper.h +4 -0
  40. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGConfig.h +2 -0
  41. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDGInitParam.h +5 -0
  42. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDTapTapInfo.h +7 -1
  43. package/Plugins/iOS/XDCommonSDK.framework/Headers/XDVersion.h +3 -3
  44. package/Plugins/iOS/XDCommonSDK.framework/Info.plist +0 -0
  45. package/Plugins/iOS/XDCommonSDK.framework/XDCommonSDK +0 -0
  46. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Headers/XDTapSDK4WrapperSDK-Swift.h +1 -1
  47. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Headers/XDTapSDK4WrapperSDK.h +3 -3
  48. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Info.plist +0 -0
  49. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Modules/XDTapSDK4WrapperSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  50. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Modules/XDTapSDK4WrapperSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  51. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/Modules/XDTapSDK4WrapperSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  52. package/Plugins/iOS/XDTapSDK4WrapperSDK.framework/XDTapSDK4WrapperSDK +0 -0
  53. package/Resources/Prefabs/AccountCell.prefab +24 -15
  54. package/Resources/Prefabs/AgreementOptionAll.prefab +15 -9
  55. package/Resources/Prefabs/AgreementOptionNormal.prefab +16 -10
  56. package/Resources/Prefabs/AreaCodeCell.prefab +13 -8
  57. package/Resources/Prefabs/CancelAccountAlert.prefab +23 -23
  58. package/Resources/Prefabs/CenterErrorView.prefab +8 -8
  59. package/Resources/Prefabs/ConfirmDialog.prefab +20 -20
  60. package/Resources/Prefabs/DeleteAccountAlert.prefab +48 -45
  61. package/Resources/Prefabs/DeleteCell.prefab +6 -6
  62. package/Resources/Prefabs/Dialog.prefab +24 -24
  63. package/Resources/Prefabs/DisagreeConfirmAlert.prefab +15 -15
  64. package/Resources/Prefabs/GeneralAgreementAlert.prefab +53 -31
  65. package/Resources/Prefabs/LoadFailedView.prefab +12 -12
  66. package/Resources/Prefabs/LoadingView.prefab +9 -6
  67. package/Resources/Prefabs/PayHintAlert.prefab +17 -15
  68. package/Resources/Prefabs/PayLoadFailedView.prefab +13 -13
  69. package/Resources/Prefabs/PaymentAlert.prefab +9 -5
  70. package/Resources/Prefabs/SmallLoadingView.prefab +4 -4
  71. package/Resources/Prefabs/UserCenterAlert.prefab +76 -46
  72. package/Resources/Prefabs/XDCodeUnbindAlert.prefab +56 -34
  73. package/Resources/Prefabs/XDEmailAlert.prefab +84 -49
  74. package/Resources/Prefabs/XDPhoneAlertIO.prefab +129 -65
  75. package/Resources/Prefabs/XDPhoneNumberInputAlert.prefab +46 -28
  76. package/Resources/Prefabs/XDRiskControlAlert.prefab +12 -7
  77. package/Resources/Prefabs/XDSDKUI.prefab +3 -3
  78. package/Resources/Prefabs/XDVerifyCodeInputAlert.prefab +47 -28
  79. package/Resources/Prefabs/XDWebBridgeView.prefab +11 -11
  80. package/Resources/Prefabs/XDWebViewAlert.prefab +10 -10
  81. package/Resources/Shaders/UI/UI-Default-Gamma.shader +129 -0
  82. package/Resources/Shaders/UI/UI-Default-Gamma.shader.meta +9 -0
  83. package/Resources/Shaders/UI/UI_Default-Gamma.mat +36 -0
  84. package/Resources/Shaders/UI/UI_Default-Gamma.mat.meta +8 -0
  85. package/Resources/Shaders/UI/UI_Default-Mask.mat +36 -0
  86. package/Resources/Shaders/UI/UI_Default-Mask.mat.meta +8 -0
  87. package/Resources/Shaders/UI.meta +8 -0
  88. package/Resources/Shaders.meta +8 -0
  89. package/Runtime/Internal/Events/XDGEventBus.cs +140 -17
  90. package/Runtime/Internal/Mobile/CommonFeaturesImpl.cs +11 -10
  91. package/Runtime/Internal/Mobile/Http/CommonParamsInterceptor.cs +1 -1
  92. package/Runtime/Internal/Standalone/Agreement/AgreementModule.cs +4 -4
  93. package/Runtime/Internal/Standalone/CommonFeaturesImpl.cs +7 -5
  94. package/Runtime/Internal/Standalone/Config/AppConfig.cs +3 -1
  95. package/Runtime/Internal/Standalone/Config/ConfigModule.cs +5 -2
  96. package/Runtime/Internal/Standalone/Http/Interceptor/MacAuthenticationInterceptor.cs +7 -7
  97. package/Runtime/Internal/Standalone/Http/Interceptor/StandaloneErrorHandlingInterceptor.cs +5 -5
  98. package/Runtime/Internal/Standalone/Http/XDHttpUtils.cs +39 -16
  99. package/Runtime/Internal/Standalone/IPInfo/IPInfoModule.cs +42 -20
  100. package/Runtime/Internal/Standalone/IPInfo/XDGAreaCode.cs +1 -1
  101. package/Runtime/Internal/Standalone/Persistence/Persistence.cs +42 -22
  102. package/Runtime/Internal/Standalone/Steam/SteamUtils.cs +14 -7
  103. package/Runtime/Internal/Standalone/Track/AliyunTrack.cs +41 -34
  104. package/Runtime/Internal/Standalone/UI/Base/UIManager.cs +4 -3
  105. package/Runtime/Internal/Standalone/UI/Base/XDGCommonUIResources.cs +107 -0
  106. package/Runtime/Internal/Standalone/UI/Base/XDGCommonUIResources.cs.meta +11 -0
  107. package/Runtime/Internal/Standalone/UI/Controllers/CancelAccountAlert.cs +69 -33
  108. package/Runtime/Internal/Standalone/UI/Controllers/GeneralAgreementAlert.cs +29 -22
  109. package/Runtime/Internal/Standalone/UI/Controllers/XDWebViewAlert.cs +4 -5
  110. package/Runtime/Internal/Standalone/Utils/SteamWrapper.cs +2 -2
  111. package/Runtime/Internal/Standalone/Utils/TaskDispatcher.cs +1 -1
  112. package/Runtime/Internal/Standalone/Utils/WindowsRegistryAccess.cs +7 -7
  113. package/Runtime/Internal/Standalone/Web/Function/BackgroundColorWebFunction.cs +1 -1
  114. package/Runtime/Internal/Standalone/Web/Function/ClipboardWebFunction.cs +1 -1
  115. package/Runtime/Internal/Standalone/Web/Function/CloseWebFunction.cs +13 -4
  116. package/Runtime/Internal/Standalone/Web/Function/DeviceInfoWebFunction.cs +1 -1
  117. package/Runtime/Internal/Standalone/Web/Function/GameMessageWebFunction.cs +1 -1
  118. package/Runtime/Internal/Standalone/Web/Function/GetSafeAreaWebFunction.cs +1 -1
  119. package/Runtime/Internal/Standalone/Web/Function/GetStorageWebFunction.cs +1 -1
  120. package/Runtime/Internal/Standalone/Web/Function/HttpRequestWebFunction.cs +1 -1
  121. package/Runtime/Internal/Standalone/Web/Function/LoadingWebFunction.cs +1 -1
  122. package/Runtime/Internal/Standalone/Web/Function/LogWebFunction.cs +5 -5
  123. package/Runtime/Internal/Standalone/Web/Function/NavigationWebFunction.cs +1 -1
  124. package/Runtime/Internal/Standalone/Web/Function/OpenPageWebFunction.cs +1 -1
  125. package/Runtime/Internal/Standalone/Web/Function/PutStorageWebFunction.cs +1 -1
  126. package/Runtime/Internal/Standalone/Web/Function/ToastWebFunction.cs +1 -1
  127. package/Runtime/Internal/Standalone/Web/Function/TrackEventWebFunction.cs +1 -1
  128. package/Runtime/Internal/Standalone/Web/WebBridgeController.cs +6 -7
  129. package/Runtime/Internal/Standalone/Web/WebRequest.cs +3 -3
  130. package/Runtime/Internal/Standalone/Web/XDWebBridgeView.cs +1 -1
  131. package/Runtime/Internal/XDGCommonInternal.cs +1 -1
  132. package/package.json +2 -2
  133. package/Plugins/Android/libs/XDGBridgeCommon_v7_7.1.0.aar +0 -0
  134. package/Plugins/Android/libs/XDGCommon_7.1.0.aar +0 -0
  135. package/Plugins/Android/libs/XDGTapTapWrapperInternal_7.1.0.aar +0 -0
  136. package/Runtime/Internal/Core/ReflectionUtils.cs +0 -640
  137. package/Runtime/Internal/Core/ReflectionUtils.cs.meta +0 -3
  138. /package/Plugins/Android/libs/{XDGBridgeCommon_v7_7.1.0.aar.meta → XDGBridgeCommon_v7_7.2.0.aar.meta} +0 -0
  139. /package/Plugins/Android/libs/{XDGCommon_7.1.0.aar.meta → XDGCommon_7.2.0.aar.meta} +0 -0
  140. /package/Plugins/Android/libs/{XDGTapTapWrapperInternal_7.1.0.aar.meta → XDGTapTapWrapperInternal_7.2.0.aar.meta} +0 -0
  141. /package/Plugins/Android/libs/{XDTapTapWrapper_7.1.0.aar.meta → XDTapTapWrapper_7.2.0.aar.meta} +0 -0
@@ -3,54 +3,77 @@ using System.Linq;
3
3
  using System.Text;
4
4
  using System.Net.Http;
5
5
 
6
- namespace XD.SDK.Common.Internal.Standalone {
7
- public class XDHttpUtils {
8
- public static void PrintRequest(HttpClient client, HttpRequestMessage request, string content = null) {
9
- if (XDGLogger.LogDelegate == null) {
6
+ namespace XD.SDK.Common.Internal.Standalone
7
+ {
8
+ public class XDHttpUtils
9
+ {
10
+ public static void PrintRequest(HttpClient client, HttpRequestMessage request, string content = null)
11
+ {
12
+ if (XDGLogger.LogDelegate == null)
13
+ {
10
14
  return;
11
15
  }
12
- if (client == null) {
16
+
17
+ if (client == null)
18
+ {
13
19
  return;
14
20
  }
15
- if (request == null) {
21
+
22
+ if (request == null)
23
+ {
16
24
  return;
17
25
  }
26
+
18
27
  StringBuilder sb = new StringBuilder();
19
28
  sb.AppendLine("=== HTTP Request Start ===");
20
29
  sb.AppendLine($"URL: {request.RequestUri}");
21
30
  sb.AppendLine($"Method: {request.Method}");
22
31
  sb.AppendLine($"Headers: ");
23
- foreach (var header in client.DefaultRequestHeaders) {
32
+ foreach (var header in client.DefaultRequestHeaders)
33
+ {
24
34
  sb.AppendLine($"\t{header.Key}: {string.Join(",", header.Value.ToArray())}");
25
35
  }
26
- foreach (var header in request.Headers) {
36
+
37
+ foreach (var header in request.Headers)
38
+ {
27
39
  sb.AppendLine($"\t{header.Key}: {string.Join(",", header.Value.ToArray())}");
28
40
  }
29
- if (request.Content != null) {
30
- foreach (var header in request.Content.Headers) {
41
+
42
+ if (request.Content != null)
43
+ {
44
+ foreach (var header in request.Content.Headers)
45
+ {
31
46
  sb.AppendLine($"\t{header.Key}: {string.Join(",", header.Value.ToArray())}");
32
47
  }
33
48
  }
34
- if (!string.IsNullOrEmpty(content)) {
49
+
50
+ if (!string.IsNullOrEmpty(content))
51
+ {
35
52
  sb.AppendLine($"Content: {content}");
36
53
  }
54
+
37
55
  sb.AppendLine("=== HTTP Request End ===");
38
- XDGLogger.Debug(sb.ToString());
56
+ XDGLogger.Debug(sb.ToString(), XDGLoggerTag.Http);
39
57
  }
40
58
 
41
- public static void PrintResponse(HttpResponseMessage response, string content = null) {
42
- if (XDGLogger.LogDelegate == null) {
59
+ public static void PrintResponse(HttpResponseMessage response, string content = null)
60
+ {
61
+ if (XDGLogger.LogDelegate == null)
62
+ {
43
63
  return;
44
64
  }
65
+
45
66
  StringBuilder sb = new StringBuilder();
46
67
  sb.AppendLine("=== HTTP Response Start ===");
47
68
  sb.AppendLine($"URL: {response.RequestMessage.RequestUri}");
48
69
  sb.AppendLine($"Status Code: {response.StatusCode}");
49
- if (!string.IsNullOrEmpty(content)) {
70
+ if (!string.IsNullOrEmpty(content))
71
+ {
50
72
  sb.AppendLine($"Content: {content}");
51
73
  }
74
+
52
75
  sb.AppendLine("=== HTTP Response End ===");
53
- XDGLogger.Debug(sb.ToString());
76
+ XDGLogger.Debug(sb.ToString(), XDGLoggerTag.Http);
54
77
  }
55
78
  }
56
79
  }
@@ -7,8 +7,10 @@ using System.Net.Http.Headers;
7
7
  using UnityEngine;
8
8
  using Newtonsoft.Json;
9
9
 
10
- namespace XD.SDK.Common.Internal.Standalone {
11
- public class IPInfoModule {
10
+ namespace XD.SDK.Common.Internal.Standalone
11
+ {
12
+ public class IPInfoModule
13
+ {
12
14
  //IP信息
13
15
  private readonly static string IP_INFO = "https://ip.xindong.com/myloc2";
14
16
 
@@ -20,63 +22,83 @@ namespace XD.SDK.Common.Internal.Standalone {
20
22
 
21
23
  private static HttpClient client;
22
24
 
23
- public static HttpClient Client {
24
- get {
25
- if (client == null) {
25
+ public static HttpClient Client
26
+ {
27
+ get
28
+ {
29
+ if (client == null)
30
+ {
26
31
  client = new HttpClient();
27
32
  client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
28
33
  client.Timeout = TimeSpan.FromSeconds(3);
29
34
  }
35
+
30
36
  return client;
31
37
  }
32
38
  }
33
39
 
34
- public static async Task SaveToLocal(XDGRegionInfo xdgRegionInfo) {
40
+ public static async Task SaveToLocal(XDGRegionInfo xdgRegionInfo)
41
+ {
35
42
  await persistence.Save(xdgRegionInfo);
36
43
  local = xdgRegionInfo;
37
44
  }
38
45
 
39
- public static async Task<XDGRegionInfo> GetLocalIPInfo() {
40
- if (local == null) {
46
+ public static async Task<XDGRegionInfo> GetLocalIPInfo()
47
+ {
48
+ if (local == null)
49
+ {
41
50
  local = await persistence.Load<XDGRegionInfo>();
42
51
  }
52
+
43
53
  return local;
44
54
  }
45
55
 
46
- public static XDGRegionInfo GetCachedIPInfo(){
56
+ public static XDGRegionInfo GetCachedIPInfo()
57
+ {
47
58
  return local;
48
59
  }
49
60
 
50
- public static async Task<XDGRegionInfo> RequestIpInfo() {
51
- try {
61
+ public static async Task<XDGRegionInfo> RequestIpInfo()
62
+ {
63
+ try
64
+ {
52
65
  HttpResponseMessage response = await Client.GetAsync(IP_INFO);
53
66
  string resultString = await response.Content.ReadAsStringAsync();
54
- if (response.IsSuccessStatusCode) {
67
+ if (response.IsSuccessStatusCode)
68
+ {
55
69
  XDGRegionInfo ret = JsonConvert.DeserializeObject<XDGRegionInfo>(resultString);
56
70
  return ret;
57
71
  }
72
+
58
73
  throw new XDGError((int)response.StatusCode, resultString);
59
- } catch (Exception e) {
60
- XDGLogger.Warn($"Request IP info error: {e}");
74
+ }
75
+ catch (Exception e)
76
+ {
77
+ XDGLogger.Warn($"Request IP info error: {e}", XDGLoggerTag.Http);
61
78
  throw e;
62
79
  }
63
80
  }
64
81
 
65
- public static async Task<XDGRegionInfo> GetIpInfo() {
66
- try {
82
+ public static async Task<XDGRegionInfo> GetIpInfo()
83
+ {
84
+ try
85
+ {
67
86
  XDGRegionInfo xdgRegionInfo = await RequestIpInfo();
68
87
  return xdgRegionInfo;
69
- } catch (Exception e) {
70
- XDGLogger.Warn($"Get IP error: {e}");
88
+ }
89
+ catch (Exception e)
90
+ {
91
+ XDGLogger.Warn($"Get IP error: {e}", XDGLoggerTag.Http);
71
92
  XDGRegionInfo xdgRegionInfo = await IPInfoModule.GetLocalIPInfo();
72
93
  return xdgRegionInfo;
73
94
  }
74
95
  }
75
96
 
76
- public static async void RequestIpInfoAndSave(){
97
+ public static async void RequestIpInfoAndSave()
98
+ {
77
99
  XDGRegionInfo xdgRegionInfo = await GetIpInfo();
78
100
  await SaveToLocal(xdgRegionInfo);
79
101
  }
80
102
  }
81
103
  }
82
- #endif
104
+ #endif
@@ -36,7 +36,7 @@ namespace XD.SDK.Common.Internal.Standalone
36
36
  }
37
37
  catch (Exception e)
38
38
  {
39
- XDGLogger.Warn($"拉取区号列表失败: {e}");
39
+ XDGLogger.Warn($"拉取区号列表失败: {e}", XDGLoggerTag.Common);
40
40
  var areaCodesStorage = await persistence.Load<List<AreaCodeData>>();
41
41
  if (areaCodesStorage?.Count > 0)
42
42
  {
@@ -7,72 +7,92 @@ using Newtonsoft.Json;
7
7
  using XD.SDK.Common;
8
8
  using XD.SDK.Common.Internal;
9
9
 
10
- namespace XD.SDK.Common.Internal.Standalone {
10
+ namespace XD.SDK.Common.Internal.Standalone
11
+ {
11
12
  /// <summary>
12
13
  /// 通用 JSON 序列化工具
13
14
  /// </summary>
14
- public class Persistence {
15
+ public class Persistence
16
+ {
15
17
  private readonly string filePath;
16
18
 
17
- public Persistence(string path) {
19
+ public Persistence(string path)
20
+ {
18
21
  filePath = path;
19
22
  }
20
23
 
21
- public async Task<T> Load<T>(string key = null) where T : class {
22
- if (!File.Exists(filePath)) {
24
+ public async Task<T> Load<T>(string key = null) where T : class
25
+ {
26
+ if (!File.Exists(filePath))
27
+ {
23
28
  return null;
24
29
  }
25
30
 
26
- try {
31
+ try
32
+ {
27
33
  string text;
28
- using (FileStream fs = File.OpenRead(filePath)) {
34
+ using (FileStream fs = File.OpenRead(filePath))
35
+ {
29
36
  byte[] buffer = new byte[fs.Length];
30
37
  await fs.ReadAsync(buffer, 0, (int)fs.Length);
31
38
  text = Encoding.UTF8.GetString(buffer);
32
39
 
33
- if (!string.IsNullOrEmpty(key)) {
40
+ if (!string.IsNullOrEmpty(key))
41
+ {
34
42
  text = EncryptionUtils.Decrypt(text, key);
35
43
  }
36
44
  }
45
+
37
46
  return JsonConvert.DeserializeObject<T>(text);
38
- } catch (Exception e) {
39
- XDGLogger.Warn(e.Message);
47
+ }
48
+ catch (Exception e)
49
+ {
50
+ XDGLogger.Warn(e.Message, XDGLoggerTag.Common);
40
51
  Delete();
41
52
  return null;
42
53
  }
43
54
  }
44
55
 
45
- public async Task Save<T>(T obj, string key = null) {
46
- if (obj == null) {
47
- XDGLogger.Warn("Saved object is null.");
56
+ public async Task Save<T>(T obj, string key = null)
57
+ {
58
+ if (obj == null)
59
+ {
60
+ XDGLogger.Warn("Saved object is null.", XDGLoggerTag.Common);
48
61
  return;
49
62
  }
50
63
 
51
64
  string text;
52
- try {
65
+ try
66
+ {
53
67
  text = JsonConvert.SerializeObject(obj);
54
68
 
55
- if (!string.IsNullOrEmpty(key)) {
69
+ if (!string.IsNullOrEmpty(key))
70
+ {
56
71
  text = EncryptionUtils.Encrypt(text, key);
57
72
  }
58
73
 
59
74
  string dirPath = Path.GetDirectoryName(filePath);
60
- if (!Directory.Exists(dirPath)) {
75
+ if (!Directory.Exists(dirPath))
76
+ {
61
77
  Directory.CreateDirectory(dirPath);
62
78
  }
63
79
 
64
- using (FileStream fs = File.Create(filePath)) {
80
+ using (FileStream fs = File.Create(filePath))
81
+ {
65
82
  byte[] buffer = Encoding.UTF8.GetBytes(text);
66
83
  await fs.WriteAsync(buffer, 0, buffer.Length);
67
84
  }
68
- } catch (Exception e) {
69
- XDGLogger.Warn(e.Message);
70
- return;
85
+ }
86
+ catch (Exception e)
87
+ {
88
+ XDGLogger.Error(e, XDGLoggerTag.Common);
71
89
  }
72
90
  }
73
91
 
74
- public void Delete() {
75
- if (!File.Exists(filePath)) {
92
+ public void Delete()
93
+ {
94
+ if (!File.Exists(filePath))
95
+ {
76
96
  return;
77
97
  }
78
98
 
@@ -4,11 +4,13 @@ using System.Linq;
4
4
  using System.Threading.Tasks;
5
5
  using UnityEngine;
6
6
 
7
- namespace XD.SDK.Common.Internal.Standalone {
7
+ namespace XD.SDK.Common.Internal.Standalone
8
+ {
8
9
  /// <summary>
9
10
  /// Steam SDK 封装接口
10
11
  /// </summary>
11
- public interface ISteamSDKWrapper {
12
+ public interface ISteamSDKWrapper
13
+ {
12
14
  Task<string> GetAuthTicket();
13
15
  string GetSteamId();
14
16
  string GetSteamLanguage();
@@ -16,18 +18,23 @@ namespace XD.SDK.Common.Internal.Standalone {
16
18
  string GetSteamCountry();
17
19
  }
18
20
 
19
- public class SteamUtils {
21
+ public class SteamUtils
22
+ {
20
23
  public static ISteamSDKWrapper Instance { get; private set; }
21
24
 
22
- static SteamUtils() {
25
+ static SteamUtils()
26
+ {
23
27
  Type interfaceType = typeof(ISteamSDKWrapper);
24
28
  Type steamWrapperType = AppDomain.CurrentDomain.GetAssemblies()
25
29
  .SelectMany(assembly => assembly.GetTypes())
26
30
  .FirstOrDefault(clazz => interfaceType.IsAssignableFrom(clazz) && clazz.IsClass);
27
- if (steamWrapperType != null) {
31
+ if (steamWrapperType != null)
32
+ {
28
33
  Instance = Activator.CreateInstance(steamWrapperType) as ISteamSDKWrapper;
29
- } else {
30
- XDGLogger.Warn($"No class implements {interfaceType} Type. Current Platform: {Application.platform}, if you are using Editor, please check if you have installed XDSDK pc module.");
34
+ }
35
+ else
36
+ {
37
+ XDGLogger.Warn($"No class implements {interfaceType} Type. Current Platform: {Application.platform}, if you are using Editor, please check if you have installed XDSDK pc module.", XDGLoggerTag.Common);
31
38
  }
32
39
  }
33
40
 
@@ -199,14 +199,18 @@ namespace XD.SDK.Common.Internal.Standalone
199
199
  var isInit = XDGCommon.IsInitialized();
200
200
  if (!isInit) return;
201
201
 
202
- content["device_id_in_db"] = DeviceIdInDB == null ? string.Empty : DeviceIdInDB;
202
+ content["device_id_in_db"] = DeviceIdInDB() == null ? string.Empty : DeviceIdInDB();
203
203
 
204
- var user = XDGEventBus.Publish<XDGUser>(XDGEvents.AccountGetCurrentUser);
205
- if (user == null) return;
204
+ var userResult = XDGEventBus.Publish<XDGUser>(XDGEvents.AccountGetCurrentUser);
205
+ var user = userResult.GetValueOrDefault();
206
+ if (user == null)
207
+ {
208
+ return;
209
+ }
206
210
 
207
211
  content["account"] = user.UserId;
208
212
  if (!content.ContainsKey("isLoginModule") || content["isLoginModule"] != "true")
209
- content["login_type"] = !string.IsNullOrEmpty(user.LoginTypeName) ? user.LoginTypeName : user.GetLoginType().ToString();
213
+ content["login_type"] = !string.IsNullOrEmpty(userResult.Value.LoginTypeName) ? userResult.Value.LoginTypeName : userResult.Value.GetLoginType().ToString();
210
214
  }
211
215
  else
212
216
  {
@@ -240,7 +244,7 @@ namespace XD.SDK.Common.Internal.Standalone
240
244
  }
241
245
  catch (Exception e)
242
246
  {
243
- XDGLogger.Warn($"[XD::LogEventAsync] TrackAsync Event Error! Message: {e.Message}\n{e.StackTrace}");
247
+ XDGLogger.Warn($"[XD::LogEventAsync] TrackAsync Event Error! Message: {e.Message}\n{e.StackTrace}", XDGLoggerTag.Track);
244
248
  }
245
249
  }
246
250
 
@@ -260,7 +264,7 @@ namespace XD.SDK.Common.Internal.Standalone
260
264
  string resultString = await responseMessage.Content.ReadAsStringAsync();
261
265
  var badResponse = JsonConvert.DeserializeObject<AliyunTrackBadResponse>(resultString);
262
266
  XDGLogger.Warn(string.Format(
263
- $"[XD::TrackAsync] request failed! \n statusCode: {responseMessage.StatusCode} errorCode : {badResponse?.errorCode} errorMessage : {badResponse?.errorMessage}"));
267
+ $"[XD::TrackAsync] request failed! \n statusCode: {responseMessage.StatusCode} errorCode : {badResponse?.errorCode} errorMessage : {badResponse?.errorMessage}"), XDGLoggerTag.Track);
264
268
  }
265
269
 
266
270
  responseMessage.Dispose();
@@ -268,7 +272,7 @@ namespace XD.SDK.Common.Internal.Standalone
268
272
  }
269
273
  catch (Exception e)
270
274
  {
271
- XDGLogger.Warn(string.Format($"[XD::TrackAsync] request failed! Message: {e.Message}\n {e.StackTrace}"));
275
+ XDGLogger.Warn(string.Format($"[XD::TrackAsync] request failed! Message: {e.Message}\n {e.StackTrace}"), XDGLoggerTag.Track);
272
276
  requestList.RemoveAt(0);
273
277
  }
274
278
  }
@@ -343,39 +347,42 @@ namespace XD.SDK.Common.Internal.Standalone
343
347
 
344
348
  try
345
349
  {
346
- XDGLogger.Warn($"TrackAsync Info:\n{sb}");
350
+ XDGLogger.Warn($"TrackAsync Info:\n{sb}", XDGLoggerTag.Track);
347
351
  }
348
352
  catch (Exception e)
349
353
  {
350
- XDGLogger.Error($"{e.Message}\n{e.StackTrace}");
354
+ XDGLogger.Error($"{e.Message}\n{e.StackTrace}", XDGLoggerTag.Track);
351
355
  }
352
356
  }
353
357
 
354
- private static string DeviceIdInDB =>
355
- // Type TapDBType = typeof(TapDB);
356
- // FieldInfo dbField = TapDBType.GetField("db", BindingFlags.Static | BindingFlags.NonPublic);
357
- // object db = dbField.GetValue(null);
358
- //
359
- // Type dbType = db.GetType();
360
- // FieldInfo identityField = dbType.GetField("Identity", BindingFlags.Static | BindingFlags.NonPublic);
361
- // object identity = identityField.GetValue(null);
362
- //
363
- // if (identity == null)
364
- // {
365
- // return null;
366
- // }
367
- //
368
- // Type identityType = identity.GetType();
369
- // PropertyInfo deviceIdProperty = identityType.GetProperty("DeviceId");
370
- // object deviceId = deviceIdProperty.GetValue(identity);
371
- //
372
- // if (deviceId == null)
373
- // {
374
- // return null;
375
- // }
376
- //
377
- // return deviceId as string;
378
- XDGEventBus.Publish<string>(XDGEvents.TapSDKGetDeviceID);
358
+ private static string DeviceIdInDB()
359
+ {
360
+ var deviceResult = XDGEventBus.Publish<string>(XDGEvents.TapSDKGetDeviceID);
361
+ return deviceResult.GetValueOrDefault();
362
+ }
363
+ // Type TapDBType = typeof(TapDB);
364
+ // FieldInfo dbField = TapDBType.GetField("db", BindingFlags.Static | BindingFlags.NonPublic);
365
+ // object db = dbField.GetValue(null);
366
+ //
367
+ // Type dbType = db.GetType();
368
+ // FieldInfo identityField = dbType.GetField("Identity", BindingFlags.Static | BindingFlags.NonPublic);
369
+ // object identity = identityField.GetValue(null);
370
+ //
371
+ // if (identity == null)
372
+ // {
373
+ // return null;
374
+ // }
375
+ //
376
+ // Type identityType = identity.GetType();
377
+ // PropertyInfo deviceIdProperty = identityType.GetProperty("DeviceId");
378
+ // object deviceId = deviceIdProperty.GetValue(identity);
379
+ //
380
+ // if (deviceId == null)
381
+ // {
382
+ // return null;
383
+ // }
384
+ //
385
+ // return deviceId as string;
379
386
  }
380
387
  }
381
388
 
@@ -86,6 +86,7 @@ namespace XD.SDK.Common.Internal.Standalone
86
86
  Instance.StopCoroutine(Instance.loadingTimeoutCoroutine);
87
87
  Instance.loadingTimeoutCoroutine = null;
88
88
  }
89
+
89
90
  Instance.loading.transform.SetAsLastSibling();
90
91
  Instance.loading.SetActive(true);
91
92
  Instance.UpdateMask();
@@ -136,7 +137,6 @@ namespace XD.SDK.Common.Internal.Standalone
136
137
  managerObject.AddComponent<ContainerWindow>();
137
138
 
138
139
  instance.mask = managerObject.transform.Find("Background").gameObject;
139
-
140
140
  instance.windowStack = managerObject.transform.Find("WindowStack");
141
141
 
142
142
  instance.toast = managerObject.transform.Find("Toast").gameObject;
@@ -163,7 +163,7 @@ namespace XD.SDK.Common.Internal.Standalone
163
163
  GameObject gameObj = Instantiate(Resources.Load("Prefabs/" + prefabName)) as GameObject;
164
164
  if (gameObj == null)
165
165
  {
166
- XDGLogger.Debug("没找到 prefab named: \"" + prefabName + "\"");
166
+ XDGLogger.Debug("没找到 prefab named: \"" + prefabName + "\"", XDGLoggerTag.Common);
167
167
  return null;
168
168
  }
169
169
  else
@@ -196,7 +196,8 @@ namespace XD.SDK.Common.Internal.Standalone
196
196
  {
197
197
  if (uiElements.Count == 0)
198
198
  {
199
- XDGLogger.Debug("没有 UIElement 子类可处理.");
199
+ XDGLogger.Debug("没有 UIElement 子类可处理.", XDGLoggerTag.Common);
200
+ UpdateMask();
200
201
  }
201
202
  else
202
203
  {
@@ -0,0 +1,107 @@
1
+ #if UNITY_EDITOR || UNITY_STANDALONE
2
+ using UnityEngine;
3
+
4
+ namespace XD.SDK.Common.Internal.Standalone
5
+ {
6
+ /// <summary>
7
+ /// 提供 Common 模块内部统一使用的 UI 材质访问接口。
8
+ /// 默认会优先根据当前 ColorSpace 选择对应的材质,如果找不到 Linear 版本则回退到 Gamma 版本。
9
+ /// 实际材质文件放在任意包的 Resources/Shaders/UI 目录下即可(例如 Common 或 BuildTools),
10
+ /// 但路径必须保持与常量中定义的一致。
11
+ /// </summary>
12
+ public static class XDGCommonUIResources
13
+ {
14
+ // 贴图渲染用的默认 UI 材质
15
+ private const string SpriteGammaPath = "Shaders/UI/UI_Default-Gamma";
16
+ private const string SpriteLinearPath = "Shaders/UI/UI_Default-Linear";
17
+
18
+ // 蒙版用的默认 UI 材质
19
+ private const string MaskGammaPath = "Shaders/UI/UI_Default-Mask";
20
+ private const string MaskLinearPath = "Shaders/UI/UI_Default-Mask-Linear";
21
+
22
+ private static Material spriteGamma;
23
+ private static Material spriteLinear;
24
+
25
+ private static Material maskGamma;
26
+ private static Material maskLinear;
27
+
28
+ /// <summary>
29
+ /// 获取当前 ColorSpace 下推荐使用的 UI Sprite 材质。
30
+ /// </summary>
31
+ public static Material GetDefaultSpriteMaterial()
32
+ {
33
+ if (QualitySettings.activeColorSpace == ColorSpace.Linear)
34
+ {
35
+ if (spriteLinear == null)
36
+ {
37
+ spriteLinear = LoadMaterialWithFallback(SpriteLinearPath, SpriteGammaPath, "Sprite Linear");
38
+ }
39
+
40
+ if (spriteLinear != null)
41
+ {
42
+ return spriteLinear;
43
+ }
44
+ }
45
+
46
+ if (spriteGamma == null)
47
+ {
48
+ spriteGamma = LoadMaterial(SpriteGammaPath, "Sprite Gamma");
49
+ }
50
+
51
+ return spriteGamma;
52
+ }
53
+
54
+ /// <summary>
55
+ /// 获取当前 ColorSpace 下推荐使用的 UI Mask 材质。
56
+ /// </summary>
57
+ internal static Material GetDefaultMaskMaterial()
58
+ {
59
+ if (QualitySettings.activeColorSpace == ColorSpace.Linear)
60
+ {
61
+ if (maskLinear == null)
62
+ {
63
+ maskLinear = LoadMaterialWithFallback(MaskLinearPath, MaskGammaPath, "Mask Linear");
64
+ }
65
+
66
+ if (maskLinear != null)
67
+ {
68
+ return maskLinear;
69
+ }
70
+ }
71
+
72
+ if (maskGamma == null)
73
+ {
74
+ maskGamma = LoadMaterial(MaskGammaPath, "Mask Gamma");
75
+ }
76
+
77
+ return maskGamma;
78
+ }
79
+
80
+ private static Material LoadMaterialWithFallback(string primaryPath, string fallbackPath, string label)
81
+ {
82
+ Material material = LoadMaterial(primaryPath, label);
83
+ if (material != null)
84
+ {
85
+ return material;
86
+ }
87
+
88
+ return LoadMaterial(fallbackPath, label + " Fallback");
89
+ }
90
+
91
+ private static Material LoadMaterial(string path, string label)
92
+ {
93
+ Material material = Resources.Load<Material>(path);
94
+ if (material == null)
95
+ {
96
+ Debug.LogWarning(
97
+ "[XDGCommonUIResources] 未找到 UI 材质: \"" + label +
98
+ "\",Resources 路径: \"" + path + "\"");
99
+ }
100
+
101
+ return material;
102
+ }
103
+ }
104
+ }
105
+ #endif
106
+
107
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d24f47766d743451899251cbc911baea
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: