com.taptap.sdk.core 4.8.4-beta.0 → 4.8.4-beta.2
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.
- package/Editor/TapSDKCoreCompile.cs +4 -4
- package/Editor/TapSDKCoreIOSProcessor.cs +3 -30
- package/Mobile/Editor/NativeDependencies.xml +3 -3
- package/Mobile/Editor/TapCommonMobileProcessBuild.cs +20 -20
- package/Mobile/Runtime/BridgeIOS.cs +13 -2
- package/Runtime/Internal/Utils/UrlUtils.cs +33 -33
- package/Runtime/Public/TapTapSDK.cs +1 -1
- package/Runtime/TapSDK.Core.Runtime.asmdef +3 -3
- package/Standalone/Editor/TapCoreStandaloneProcessBuild.cs +19 -19
- package/Standalone/Runtime/Internal/DeviceInfo.cs +136 -136
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogWrapper.cs +2 -0
- package/Standalone/Runtime/Public/TapClientStandalone.cs +9 -0
- package/Standalone/Runtime/TapSDK.Core.Standalone.Runtime.asmdef +0 -1
- package/package.json +6 -9
- package/link.xml +0 -4
- package/link.xml.meta +0 -7
|
@@ -95,7 +95,7 @@ namespace TapSDK.Core.Editor
|
|
|
95
95
|
|
|
96
96
|
public static bool HandlerIOSSetting(string path, string appDataPath, string resourceName,
|
|
97
97
|
string modulePackageName,
|
|
98
|
-
string moduleName, string[] bundleNames, string target, string projPath, PBXProject proj
|
|
98
|
+
string moduleName, string[] bundleNames, string target, string projPath, PBXProject proj)
|
|
99
99
|
{
|
|
100
100
|
|
|
101
101
|
var resourcePath = Path.Combine(path, resourceName);
|
|
@@ -109,11 +109,11 @@ namespace TapSDK.Core.Editor
|
|
|
109
109
|
Directory.Delete(resourcePath, true);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
var podSpecPath = Path.Combine(path + "/Pods",
|
|
112
|
+
var podSpecPath = Path.Combine(path + "/Pods", "TapTapSDK");
|
|
113
113
|
//使用 cocospod 远程依赖
|
|
114
|
-
if (
|
|
114
|
+
if (Directory.Exists(podSpecPath))
|
|
115
115
|
{
|
|
116
|
-
resourcePath = Path.Combine(path + "/Pods",
|
|
116
|
+
resourcePath = Path.Combine(path + "/Pods", "TapTapSDK/Frameworks");
|
|
117
117
|
UnityEngine.Debug.Log($"Find {moduleName} use pods resourcePath:{resourcePath}");
|
|
118
118
|
}
|
|
119
119
|
else
|
|
@@ -34,12 +34,12 @@ namespace TapSDK.Core.Editor
|
|
|
34
34
|
// proj.AddBuildProperty(unityFrameworkTarget, "OTHER_LDFLAGS", "-ObjC");
|
|
35
35
|
|
|
36
36
|
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
|
37
|
-
|
|
37
|
+
proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
|
38
38
|
proj.SetBuildProperty(target, "SWIFT_VERSION", "5.0");
|
|
39
39
|
proj.SetBuildProperty(target, "CLANG_ENABLE_MODULES", "YES");
|
|
40
40
|
|
|
41
41
|
proj.SetBuildProperty(unityFrameworkTarget, "ENABLE_BITCODE", "NO");
|
|
42
|
-
|
|
42
|
+
proj.SetBuildProperty(unityFrameworkTarget, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
|
43
43
|
proj.SetBuildProperty(unityFrameworkTarget, "BUILD_LIBRARY_FOR_DISTRIBUTION", "YES");
|
|
44
44
|
|
|
45
45
|
proj.SetBuildProperty(unityFrameworkTarget, "SWIFT_VERSION", "5.0");
|
|
@@ -50,7 +50,6 @@ namespace TapSDK.Core.Editor
|
|
|
50
50
|
proj.AddFrameworkToProject(unityFrameworkTarget, "Security.framework", false);
|
|
51
51
|
proj.AddFrameworkToProject(unityFrameworkTarget, "SystemConfiguration.framework", false);
|
|
52
52
|
proj.AddFrameworkToProject(unityFrameworkTarget, "CoreTelephony.framework", false);
|
|
53
|
-
proj.AddFrameworkToProject(unityFrameworkTarget, "SystemConfiguration.framework", false);
|
|
54
53
|
|
|
55
54
|
proj.AddFileToBuild(unityFrameworkTarget,
|
|
56
55
|
proj.AddFile("usr/lib/libc++.tbd", "libc++.tbd", PBXSourceTree.Sdk));
|
|
@@ -59,7 +58,6 @@ namespace TapSDK.Core.Editor
|
|
|
59
58
|
proj.AddFile("usr/lib/libsqlite3.tbd", "libsqlite3.tbd", PBXSourceTree.Sdk));
|
|
60
59
|
|
|
61
60
|
proj.WriteToFile(projPath);
|
|
62
|
-
// PodFile 使用动态库
|
|
63
61
|
string podfilePath = Path.Combine(path, "Podfile");
|
|
64
62
|
if (!File.Exists(podfilePath))
|
|
65
63
|
{
|
|
@@ -68,35 +66,10 @@ namespace TapSDK.Core.Editor
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
string podfileContent = File.ReadAllText(podfilePath);
|
|
71
|
-
|
|
72
|
-
// // 替换 use_frameworks! 的设置(默认是 static)
|
|
73
|
-
// if (podfileContent.Contains("use_frameworks! :linkage => :static"))
|
|
74
|
-
// {
|
|
75
|
-
// podfileContent = podfileContent.Replace("use_frameworks! :linkage => :static", "use_frameworks! :linkage => :dynamic");
|
|
76
|
-
// }
|
|
77
|
-
// else if (!podfileContent.Contains("use_frameworks!"))
|
|
78
|
-
// {
|
|
79
|
-
// // 插入 use_frameworks! 如果没有
|
|
80
|
-
// podfileContent = podfileContent.Replace("platform :ios, '13.0'", "platform :ios, '13.0'\nuse_frameworks!");
|
|
81
|
-
// }
|
|
82
69
|
podfileContent += "\ninstall! 'cocoapods', :warn_for_unused_master_specs_repo => false";
|
|
83
70
|
|
|
84
71
|
File.WriteAllText(podfilePath, podfileContent);
|
|
85
|
-
Debug.Log("Podfile modified to use dynamic frameworks.");
|
|
86
|
-
// if (TapSDKCoreCompile.HandlerIOSSetting(path,
|
|
87
|
-
// Application.dataPath,
|
|
88
|
-
// "TapCommonResource",
|
|
89
|
-
// "com.taptap.sdk.core",
|
|
90
|
-
// "TapSDKCore",
|
|
91
|
-
// new[] {"TapCommonResource.bundle"},
|
|
92
|
-
// target, projPath, proj))
|
|
93
|
-
// {
|
|
94
|
-
// Debug.Log("TapCommon add Bundle Success!");
|
|
95
|
-
// return;
|
|
96
|
-
// }
|
|
97
|
-
|
|
98
|
-
// Debug.LogError("TapCommon add Bundle Failed!");
|
|
99
72
|
}
|
|
100
73
|
}
|
|
101
74
|
#endif
|
|
102
|
-
}
|
|
75
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
2
2
|
<dependencies>
|
|
3
3
|
<androidPackages>
|
|
4
4
|
<repositories>
|
|
5
5
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
6
|
</repositories>
|
|
7
|
-
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.8.4
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.8.4" />
|
|
8
8
|
</androidPackages>
|
|
9
9
|
<iosPods>
|
|
10
10
|
<sources>
|
|
11
11
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
12
12
|
</sources>
|
|
13
|
-
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="
|
|
13
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/Core" version="4.8.4" />
|
|
14
14
|
</iosPods>
|
|
15
15
|
</dependencies>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using UnityEditor.Build.Reporting;
|
|
3
|
-
using TapSDK.Core.Editor;
|
|
4
|
-
|
|
5
|
-
namespace TapSDK.Core.Mobile.Editor {
|
|
6
|
-
public class TapCommonMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
-
public override int callbackOrder => 0;
|
|
8
|
-
|
|
9
|
-
public override string LinkPath => "TapSDK/Core/link.xml";
|
|
10
|
-
|
|
11
|
-
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
-
new LinkedAssembly { Fullname = "TapSDK.Core.Runtime" },
|
|
13
|
-
new LinkedAssembly { Fullname = "TapSDK.Core.Mobile.Runtime" }
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
-
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEditor.Build.Reporting;
|
|
3
|
+
using TapSDK.Core.Editor;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.Core.Mobile.Editor {
|
|
6
|
+
public class TapCommonMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 0;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "TapSDK/Core/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "TapSDK.Core.Runtime" },
|
|
13
|
+
new LinkedAssembly { Fullname = "TapSDK.Core.Mobile.Runtime" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
+
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -38,7 +38,8 @@ namespace TapSDK.Core
|
|
|
38
38
|
|
|
39
39
|
Action<Result> action = null;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
// 修复:检查callbackId是否为null或空,防止ArgumentNullException
|
|
42
|
+
if (actionDic != null && !string.IsNullOrEmpty(result.callbackId) && actionDic.ContainsKey(result.callbackId))
|
|
42
43
|
{
|
|
43
44
|
action = actionDic[result.callbackId];
|
|
44
45
|
}
|
|
@@ -46,12 +47,22 @@ namespace TapSDK.Core
|
|
|
46
47
|
if (action != null)
|
|
47
48
|
{
|
|
48
49
|
action(result);
|
|
49
|
-
if (result.onceTime && BridgeIOS.GetInstance().GetConcurrentDictionary()
|
|
50
|
+
if (result.onceTime && !string.IsNullOrEmpty(result.callbackId) && BridgeIOS.GetInstance().GetConcurrentDictionary()
|
|
50
51
|
.TryRemove(result.callbackId, out Action<Result> outAction))
|
|
51
52
|
{
|
|
52
53
|
TapLog.Log($"TapSDK resolved current Action:{result.callbackId}");
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
else if (string.IsNullOrEmpty(result.callbackId))
|
|
57
|
+
{
|
|
58
|
+
// 记录调试信息:当callbackId为空时
|
|
59
|
+
TapLog.Log($"TapSDK received result without callbackId, result: {resultJson}");
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
{
|
|
63
|
+
// 记录调试信息:当找不到对应的action时
|
|
64
|
+
TapLog.Log($"TapSDK no action found for callbackId: {result.callbackId}");
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Linq;
|
|
3
|
-
using System.Collections.Specialized;
|
|
4
|
-
|
|
5
|
-
namespace TapSDK.Core.Internal.Utils {
|
|
6
|
-
public class UrlUtils {
|
|
7
|
-
public static NameValueCollection ParseQueryString(string query) {
|
|
8
|
-
NameValueCollection nvc = new NameValueCollection();
|
|
9
|
-
|
|
10
|
-
if (query.StartsWith("?")) {
|
|
11
|
-
query = query.Substring(1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
foreach (var param in query.Split('&')) {
|
|
15
|
-
string[] pair = param.Split('=');
|
|
16
|
-
if (pair.Length == 2) {
|
|
17
|
-
string key = Uri.UnescapeDataString(pair[0]);
|
|
18
|
-
string value = Uri.UnescapeDataString(pair[1]);
|
|
19
|
-
nvc[key] = value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return nvc;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static string ToQueryString(NameValueCollection nvc) {
|
|
27
|
-
var array = (from key in nvc.AllKeys
|
|
28
|
-
from value in nvc.GetValues(key)
|
|
29
|
-
select $"{Uri.EscapeDataString(key)}={Uri.EscapeDataString(value)}"
|
|
30
|
-
).ToArray();
|
|
31
|
-
return string.Join("&", array);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using System.Linq;
|
|
3
|
+
using System.Collections.Specialized;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.Core.Internal.Utils {
|
|
6
|
+
public class UrlUtils {
|
|
7
|
+
public static NameValueCollection ParseQueryString(string query) {
|
|
8
|
+
NameValueCollection nvc = new NameValueCollection();
|
|
9
|
+
|
|
10
|
+
if (query.StartsWith("?")) {
|
|
11
|
+
query = query.Substring(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
foreach (var param in query.Split('&')) {
|
|
15
|
+
string[] pair = param.Split('=');
|
|
16
|
+
if (pair.Length == 2) {
|
|
17
|
+
string key = Uri.UnescapeDataString(pair[0]);
|
|
18
|
+
string value = Uri.UnescapeDataString(pair[1]);
|
|
19
|
+
nvc[key] = value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return nvc;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static string ToQueryString(NameValueCollection nvc) {
|
|
27
|
+
var array = (from key in nvc.AllKeys
|
|
28
|
+
from value in nvc.GetValues(key)
|
|
29
|
+
select $"{Uri.EscapeDataString(key)}={Uri.EscapeDataString(value)}"
|
|
30
|
+
).ToArray();
|
|
31
|
+
return string.Join("&", array);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
34
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "TapSDK.Core.Runtime"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "TapSDK.Core.Runtime"
|
|
3
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using UnityEditor.Build.Reporting;
|
|
3
|
-
using TapSDK.Core.Editor;
|
|
4
|
-
|
|
5
|
-
namespace TapSDK.Core.Editor {
|
|
6
|
-
public class TapCoreStandaloneProcessBuild : SDKLinkProcessBuild {
|
|
7
|
-
public override int callbackOrder => 0;
|
|
8
|
-
|
|
9
|
-
public override string LinkPath => "TapSDK/Core/link.xml";
|
|
10
|
-
|
|
11
|
-
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
-
new LinkedAssembly { Fullname = "TapSDK.Core.Runtime" },
|
|
13
|
-
new LinkedAssembly { Fullname = "TapSDK.Core.Standalone.Runtime" }
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
-
return BuildTargetUtils.IsSupportStandalone(report.summary.platform);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEditor.Build.Reporting;
|
|
3
|
+
using TapSDK.Core.Editor;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.Core.Editor {
|
|
6
|
+
public class TapCoreStandaloneProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 0;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "TapSDK/Core/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "TapSDK.Core.Runtime" },
|
|
13
|
+
new LinkedAssembly { Fullname = "TapSDK.Core.Standalone.Runtime" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
+
return BuildTargetUtils.IsSupportStandalone(report.summary.platform);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
20
|
}
|
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Runtime.InteropServices;
|
|
3
|
-
using System.Globalization;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using System.Net.NetworkInformation;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
using System.Diagnostics;
|
|
8
|
-
using TapSDK.Core.Internal.Log;
|
|
9
|
-
|
|
10
|
-
namespace TapSDK.Core.Standalone.Internal
|
|
11
|
-
{
|
|
12
|
-
public class DeviceInfo
|
|
13
|
-
{
|
|
14
|
-
|
|
15
|
-
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
|
16
|
-
[DllImport("TapDBDeviceInfo", CallingConvention = CallingConvention.Cdecl)]
|
|
17
|
-
private static extern IntPtr GetDeviceLanguage();
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
public static string GetLanguage()
|
|
21
|
-
{
|
|
22
|
-
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
|
23
|
-
return Marshal.PtrToStringAnsi(GetDeviceLanguage());
|
|
24
|
-
#else
|
|
25
|
-
return CultureInfo.CurrentUICulture.IetfLanguageTag;
|
|
26
|
-
#endif
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
|
30
|
-
[DllImport("kernel32.dll")]
|
|
31
|
-
static extern IntPtr GetCurrentProcess();
|
|
32
|
-
|
|
33
|
-
[DllImport("kernel32.dll")]
|
|
34
|
-
static extern uint GetProcessTimes(IntPtr processHandle,
|
|
35
|
-
out long creationTime,
|
|
36
|
-
out long exitTime,
|
|
37
|
-
out long kernelTime,
|
|
38
|
-
out long userTime);
|
|
39
|
-
|
|
40
|
-
static DateTime GetProcessStartTime()
|
|
41
|
-
{
|
|
42
|
-
IntPtr processHandle = GetCurrentProcess();
|
|
43
|
-
long creationTime;
|
|
44
|
-
GetProcessTimes(processHandle,
|
|
45
|
-
out creationTime,
|
|
46
|
-
out _,
|
|
47
|
-
out _,
|
|
48
|
-
out _);
|
|
49
|
-
|
|
50
|
-
return DateTime.FromFileTime(creationTime);
|
|
51
|
-
}
|
|
52
|
-
#endif
|
|
53
|
-
|
|
54
|
-
//安全组提供的设备识别 ID 算法,用于后续数据串联
|
|
55
|
-
public static string GetLaunchUniqueID()
|
|
56
|
-
{
|
|
57
|
-
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
|
58
|
-
// 获取当前进程对象
|
|
59
|
-
Process currentProcess = Process.GetCurrentProcess();
|
|
60
|
-
// 获取进程启动时间
|
|
61
|
-
DateTime startTime = GetProcessStartTime();
|
|
62
|
-
return toMd5(startTime.ToFileTime().ToString() + "-" + currentProcess.Id.ToString());
|
|
63
|
-
#else
|
|
64
|
-
return "";
|
|
65
|
-
#endif
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public static void GetMacAddress(out string macAddressList, out string firstMacAddress)
|
|
70
|
-
{
|
|
71
|
-
List<string> mac_addrs = new List<string>();
|
|
72
|
-
|
|
73
|
-
try
|
|
74
|
-
{
|
|
75
|
-
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
|
|
76
|
-
foreach (NetworkInterface adapter in nics)
|
|
77
|
-
{
|
|
78
|
-
string physicalAddress = adapter.GetPhysicalAddress().ToString();
|
|
79
|
-
if (string.IsNullOrEmpty(physicalAddress))
|
|
80
|
-
continue;
|
|
81
|
-
|
|
82
|
-
physicalAddress = $"\"{physicalAddress}\"";
|
|
83
|
-
if (mac_addrs.IndexOf(physicalAddress) == -1)
|
|
84
|
-
mac_addrs.Add(physicalAddress);
|
|
85
|
-
}
|
|
86
|
-
// sort
|
|
87
|
-
mac_addrs.Sort();
|
|
88
|
-
}
|
|
89
|
-
catch (Exception e)
|
|
90
|
-
{
|
|
91
|
-
TapLog.Log("GetMacAddress Exception " + e.Message);
|
|
92
|
-
}
|
|
93
|
-
macAddressList = $"[{string.Join(",", mac_addrs)}]";
|
|
94
|
-
firstMacAddress = mac_addrs.Count > 0 ? mac_addrs[0].Replace("\"", "") : string.Empty;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private static string toMd5(string data)
|
|
98
|
-
{
|
|
99
|
-
byte[] buffer = System.Text.Encoding.Default.GetBytes(data);
|
|
100
|
-
try
|
|
101
|
-
{
|
|
102
|
-
System.Security.Cryptography.MD5CryptoServiceProvider chk = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
|
103
|
-
byte[] some = chk.ComputeHash(buffer);
|
|
104
|
-
string ret = "";
|
|
105
|
-
foreach (byte a in some)
|
|
106
|
-
{
|
|
107
|
-
if (a < 16)
|
|
108
|
-
ret += "0" + a.ToString("X");
|
|
109
|
-
else
|
|
110
|
-
ret += a.ToString("X");
|
|
111
|
-
}
|
|
112
|
-
return ret.ToLower();
|
|
113
|
-
}
|
|
114
|
-
catch
|
|
115
|
-
{
|
|
116
|
-
throw;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public static string RAM
|
|
121
|
-
{
|
|
122
|
-
get
|
|
123
|
-
{
|
|
124
|
-
return (SystemInfo.systemMemorySize * 1024L * 1024L).ToString();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
public static string Local
|
|
130
|
-
{
|
|
131
|
-
get
|
|
132
|
-
{
|
|
133
|
-
return CultureInfo.CurrentCulture.Name.Replace('-', '_');
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using System.Runtime.InteropServices;
|
|
3
|
+
using System.Globalization;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Net.NetworkInformation;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
using System.Diagnostics;
|
|
8
|
+
using TapSDK.Core.Internal.Log;
|
|
9
|
+
|
|
10
|
+
namespace TapSDK.Core.Standalone.Internal
|
|
11
|
+
{
|
|
12
|
+
public class DeviceInfo
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
|
16
|
+
[DllImport("TapDBDeviceInfo", CallingConvention = CallingConvention.Cdecl)]
|
|
17
|
+
private static extern IntPtr GetDeviceLanguage();
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
public static string GetLanguage()
|
|
21
|
+
{
|
|
22
|
+
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
|
23
|
+
return Marshal.PtrToStringAnsi(GetDeviceLanguage());
|
|
24
|
+
#else
|
|
25
|
+
return CultureInfo.CurrentUICulture.IetfLanguageTag;
|
|
26
|
+
#endif
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
|
30
|
+
[DllImport("kernel32.dll")]
|
|
31
|
+
static extern IntPtr GetCurrentProcess();
|
|
32
|
+
|
|
33
|
+
[DllImport("kernel32.dll")]
|
|
34
|
+
static extern uint GetProcessTimes(IntPtr processHandle,
|
|
35
|
+
out long creationTime,
|
|
36
|
+
out long exitTime,
|
|
37
|
+
out long kernelTime,
|
|
38
|
+
out long userTime);
|
|
39
|
+
|
|
40
|
+
static DateTime GetProcessStartTime()
|
|
41
|
+
{
|
|
42
|
+
IntPtr processHandle = GetCurrentProcess();
|
|
43
|
+
long creationTime;
|
|
44
|
+
GetProcessTimes(processHandle,
|
|
45
|
+
out creationTime,
|
|
46
|
+
out _,
|
|
47
|
+
out _,
|
|
48
|
+
out _);
|
|
49
|
+
|
|
50
|
+
return DateTime.FromFileTime(creationTime);
|
|
51
|
+
}
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
//安全组提供的设备识别 ID 算法,用于后续数据串联
|
|
55
|
+
public static string GetLaunchUniqueID()
|
|
56
|
+
{
|
|
57
|
+
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
|
|
58
|
+
// 获取当前进程对象
|
|
59
|
+
Process currentProcess = Process.GetCurrentProcess();
|
|
60
|
+
// 获取进程启动时间
|
|
61
|
+
DateTime startTime = GetProcessStartTime();
|
|
62
|
+
return toMd5(startTime.ToFileTime().ToString() + "-" + currentProcess.Id.ToString());
|
|
63
|
+
#else
|
|
64
|
+
return "";
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public static void GetMacAddress(out string macAddressList, out string firstMacAddress)
|
|
70
|
+
{
|
|
71
|
+
List<string> mac_addrs = new List<string>();
|
|
72
|
+
|
|
73
|
+
try
|
|
74
|
+
{
|
|
75
|
+
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
|
|
76
|
+
foreach (NetworkInterface adapter in nics)
|
|
77
|
+
{
|
|
78
|
+
string physicalAddress = adapter.GetPhysicalAddress().ToString();
|
|
79
|
+
if (string.IsNullOrEmpty(physicalAddress))
|
|
80
|
+
continue;
|
|
81
|
+
|
|
82
|
+
physicalAddress = $"\"{physicalAddress}\"";
|
|
83
|
+
if (mac_addrs.IndexOf(physicalAddress) == -1)
|
|
84
|
+
mac_addrs.Add(physicalAddress);
|
|
85
|
+
}
|
|
86
|
+
// sort
|
|
87
|
+
mac_addrs.Sort();
|
|
88
|
+
}
|
|
89
|
+
catch (Exception e)
|
|
90
|
+
{
|
|
91
|
+
TapLog.Log("GetMacAddress Exception " + e.Message);
|
|
92
|
+
}
|
|
93
|
+
macAddressList = $"[{string.Join(",", mac_addrs)}]";
|
|
94
|
+
firstMacAddress = mac_addrs.Count > 0 ? mac_addrs[0].Replace("\"", "") : string.Empty;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private static string toMd5(string data)
|
|
98
|
+
{
|
|
99
|
+
byte[] buffer = System.Text.Encoding.Default.GetBytes(data);
|
|
100
|
+
try
|
|
101
|
+
{
|
|
102
|
+
System.Security.Cryptography.MD5CryptoServiceProvider chk = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
|
103
|
+
byte[] some = chk.ComputeHash(buffer);
|
|
104
|
+
string ret = "";
|
|
105
|
+
foreach (byte a in some)
|
|
106
|
+
{
|
|
107
|
+
if (a < 16)
|
|
108
|
+
ret += "0" + a.ToString("X");
|
|
109
|
+
else
|
|
110
|
+
ret += a.ToString("X");
|
|
111
|
+
}
|
|
112
|
+
return ret.ToLower();
|
|
113
|
+
}
|
|
114
|
+
catch
|
|
115
|
+
{
|
|
116
|
+
throw;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public static string RAM
|
|
121
|
+
{
|
|
122
|
+
get
|
|
123
|
+
{
|
|
124
|
+
return (SystemInfo.systemMemorySize * 1024L * 1024L).ToString();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
public static string Local
|
|
130
|
+
{
|
|
131
|
+
get
|
|
132
|
+
{
|
|
133
|
+
return CultureInfo.CurrentCulture.Name.Replace('-', '_');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
137
|
}
|
|
@@ -10,6 +10,8 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
10
10
|
internal const string DllName = "tapsdkcore";
|
|
11
11
|
#elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
|
|
12
12
|
internal const string DllName = "libtapsdkcorecpp";
|
|
13
|
+
#elif UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
|
|
14
|
+
internal const string DllName = "libtapsdkcorecpp";
|
|
13
15
|
#endif
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -8,6 +8,7 @@ using System.Runtime.InteropServices;
|
|
|
8
8
|
using TapSDK.Core.Standalone.Internal.Openlog;
|
|
9
9
|
using System.Threading;
|
|
10
10
|
using TapSDK.Core.Internal.Log;
|
|
11
|
+
using UnityEditor;
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
@@ -77,7 +78,15 @@ namespace TapSDK.Core.Standalone
|
|
|
77
78
|
lastIsLaunchedFromTapTapPCResult = 0;
|
|
78
79
|
TapCoreTracker.Instance.TrackSuccess(TapCoreTracker.METHOD_LAUNCHER, sessionId, TapCoreTracker.SUCCESS_TYPE_RESTART);
|
|
79
80
|
TapLog.Log("IsLaunchedFromTapTapPC Quit game");
|
|
81
|
+
#if UNITY_EDITOR
|
|
82
|
+
TapLog.Log(
|
|
83
|
+
$"本地测试文件配置错误,请确保 taptap_client_id.txt 文件拷贝到 {EditorApplication.applicationPath} 同级目录下"
|
|
84
|
+
);
|
|
85
|
+
EditorApplication.ExitPlaymode();
|
|
86
|
+
#else
|
|
80
87
|
Application.Quit();
|
|
88
|
+
#endif
|
|
89
|
+
|
|
81
90
|
return false;
|
|
82
91
|
}
|
|
83
92
|
else
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"com.google.external-dependency-manager": "1.2.179"
|
|
10
|
-
}
|
|
2
|
+
"name": "com.taptap.sdk.core",
|
|
3
|
+
"displayName": "TapTapSDK Core",
|
|
4
|
+
"description": "TapTapSDK Core",
|
|
5
|
+
"version": "4.8.4-beta.2",
|
|
6
|
+
"unity": "2020.3.0f1",
|
|
7
|
+
"license": "MIT"
|
|
11
8
|
}
|
package/link.xml
DELETED