com.taptap.sdk.core 4.9.3 → 4.9.4
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/Mobile/Editor/NativeDependencies.xml +3 -3
- package/Mobile/Runtime/TapCoreMobile.cs +68 -25
- package/Resources/Fonts/tapsdk_shader.shader +127 -0
- package/Resources/Fonts/tapsdk_shader.shader.meta +10 -0
- package/Resources/Fonts/tapsdk_text_material.mat +97 -0
- package/Resources/Fonts/tapsdk_text_material.mat.meta +8 -0
- package/Runtime/Internal/Platform/ITapCorePlatform.cs +14 -4
- package/Runtime/Internal/Utils/TapLoom.cs +27 -27
- package/Runtime/Public/DataStorage.cs +8 -0
- package/Runtime/Public/TapTapSDK.cs +36 -0
- package/Runtime/Public/TapTapSdkOptions.cs +24 -0
- package/Standalone/Runtime/Internal/DeviceInfo.cs +17 -0
- package/Standalone/Runtime/Internal/Http/TapHttp.cs +4 -41
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogStandalone.cs +102 -50
- package/Standalone/Runtime/Internal/Openlog/TapOpenlogWrapper.cs +4 -2
- package/Standalone/Runtime/Public/TapCoreStandalone.cs +11 -1
- package/link.xml +4 -0
- package/link.xml.meta +7 -0
- package/package.json +6 -9
|
@@ -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.9.
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.9.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="TapTapSDK/Core" version="4.9.
|
|
13
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/Core" version="4.9.4" />
|
|
14
14
|
</iosPods>
|
|
15
15
|
</dependencies>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.
|
|
2
|
+
using System.Collections.Generic;
|
|
3
3
|
using System.Linq;
|
|
4
4
|
using System.Runtime.InteropServices;
|
|
5
|
+
using System.Threading.Tasks;
|
|
6
|
+
using Newtonsoft.Json;
|
|
5
7
|
using TapSDK.Core.Internal;
|
|
8
|
+
using TapSDK.Core.Internal.Log;
|
|
6
9
|
using TapSDK.Core.Internal.Utils;
|
|
7
|
-
using System.Collections.Generic;
|
|
8
10
|
using UnityEngine;
|
|
9
|
-
using Newtonsoft.Json;
|
|
10
|
-
using TapSDK.Core.Internal.Log;
|
|
11
11
|
|
|
12
12
|
namespace TapSDK.Core.Mobile
|
|
13
13
|
{
|
|
@@ -44,32 +44,48 @@ namespace TapSDK.Core.Mobile
|
|
|
44
44
|
TapLog.Log("TapCoreMobile SDK inited");
|
|
45
45
|
SetPlatformAndVersion(TapTapSDK.SDKPlatform, TapTapSDK.Version);
|
|
46
46
|
string coreOptionsJson = JsonUtility.ToJson(coreOption);
|
|
47
|
-
string[] otherOptionsJson = otherOptions
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
string[] otherOptionsJson = otherOptions
|
|
48
|
+
.Select(option => JsonConvert.SerializeObject(option))
|
|
49
|
+
.ToArray();
|
|
50
|
+
Bridge.CallHandler(
|
|
51
|
+
EngineBridgeInitializer
|
|
52
|
+
.GetBridgeServer()
|
|
53
|
+
.Method("init")
|
|
54
|
+
.Args("coreOption", coreOptionsJson)
|
|
55
|
+
.Args("otherOptions", otherOptionsJson)
|
|
56
|
+
.CommandBuilder()
|
|
57
|
+
);
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
private void SetPlatformAndVersion(string platform, string version)
|
|
56
61
|
{
|
|
57
|
-
TapLog.Log(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
TapLog.Log(
|
|
63
|
+
"TapCoreMobile SetPlatformAndVersion called with platform: "
|
|
64
|
+
+ platform
|
|
65
|
+
+ " and version: "
|
|
66
|
+
+ version
|
|
67
|
+
);
|
|
68
|
+
Bridge.CallHandler(
|
|
69
|
+
EngineBridgeInitializer
|
|
70
|
+
.GetBridgeServer()
|
|
71
|
+
.Method("setPlatformAndVersion")
|
|
72
|
+
.Args("platform", TapTapSDK.SDKPlatform)
|
|
73
|
+
.Args("version", TapTapSDK.Version)
|
|
74
|
+
.CommandBuilder()
|
|
75
|
+
);
|
|
63
76
|
SetSDKArtifact("Unity");
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
private void SetSDKArtifact(string value)
|
|
67
80
|
{
|
|
68
81
|
TapLog.Log("TapCoreMobile SetSDKArtifact called with value: " + value);
|
|
69
|
-
Bridge.CallHandler(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
Bridge.CallHandler(
|
|
83
|
+
EngineBridgeInitializer
|
|
84
|
+
.GetBridgeServer()
|
|
85
|
+
.Method("setSDKArtifact")
|
|
86
|
+
.Args("artifact", "Unity")
|
|
87
|
+
.CommandBuilder()
|
|
88
|
+
);
|
|
73
89
|
}
|
|
74
90
|
|
|
75
91
|
public void Init(TapTapSdkOptions coreOption)
|
|
@@ -80,15 +96,42 @@ namespace TapSDK.Core.Mobile
|
|
|
80
96
|
public void UpdateLanguage(TapTapLanguageType language)
|
|
81
97
|
{
|
|
82
98
|
TapLog.Log("TapCoreMobile UpdateLanguage language: " + language);
|
|
83
|
-
Bridge.CallHandler(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
Bridge.CallHandler(
|
|
100
|
+
EngineBridgeInitializer
|
|
101
|
+
.GetBridgeServer()
|
|
102
|
+
.Method("updateLanguage")
|
|
103
|
+
.Args("language", (int)language)
|
|
104
|
+
.CommandBuilder()
|
|
105
|
+
);
|
|
87
106
|
}
|
|
88
107
|
|
|
89
108
|
public Task<bool> IsLaunchedFromTapTapPC()
|
|
90
109
|
{
|
|
91
110
|
return Task.FromResult(false);
|
|
92
111
|
}
|
|
112
|
+
|
|
113
|
+
public void SendOpenLog(
|
|
114
|
+
string project,
|
|
115
|
+
string version,
|
|
116
|
+
string action,
|
|
117
|
+
Dictionary<string, string> properties
|
|
118
|
+
)
|
|
119
|
+
{
|
|
120
|
+
if (properties == null)
|
|
121
|
+
{
|
|
122
|
+
properties = new Dictionary<string, string>();
|
|
123
|
+
}
|
|
124
|
+
string propertiesJson = JsonConvert.SerializeObject(properties);
|
|
125
|
+
Bridge.CallHandler(
|
|
126
|
+
EngineBridgeInitializer
|
|
127
|
+
.GetBridgeServer()
|
|
128
|
+
.Method("sendOpenLog")
|
|
129
|
+
.Args("project", project)
|
|
130
|
+
.Args("version", version)
|
|
131
|
+
.Args("action", action)
|
|
132
|
+
.Args("properties", propertiesJson)
|
|
133
|
+
.CommandBuilder()
|
|
134
|
+
);
|
|
135
|
+
}
|
|
93
136
|
}
|
|
94
|
-
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
|
|
2
|
+
|
|
3
|
+
Shader "TapSDK/Default"
|
|
4
|
+
{
|
|
5
|
+
Properties
|
|
6
|
+
{
|
|
7
|
+
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
|
|
8
|
+
_Color ("Tint", Color) = (1,1,1,1)
|
|
9
|
+
|
|
10
|
+
_StencilComp ("Stencil Comparison", Float) = 8
|
|
11
|
+
_Stencil ("Stencil ID", Float) = 0
|
|
12
|
+
_StencilOp ("Stencil Operation", Float) = 0
|
|
13
|
+
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
|
14
|
+
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
|
15
|
+
|
|
16
|
+
_ColorMask ("Color Mask", Float) = 15
|
|
17
|
+
|
|
18
|
+
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
SubShader
|
|
22
|
+
{
|
|
23
|
+
Tags
|
|
24
|
+
{
|
|
25
|
+
"Queue"="Transparent"
|
|
26
|
+
"IgnoreProjector"="True"
|
|
27
|
+
"RenderType"="Transparent"
|
|
28
|
+
"PreviewType"="Plane"
|
|
29
|
+
"CanUseSpriteAtlas"="True"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Stencil
|
|
33
|
+
{
|
|
34
|
+
Ref [_Stencil]
|
|
35
|
+
Comp [_StencilComp]
|
|
36
|
+
Pass [_StencilOp]
|
|
37
|
+
ReadMask [_StencilReadMask]
|
|
38
|
+
WriteMask [_StencilWriteMask]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
Cull Off
|
|
42
|
+
Lighting Off
|
|
43
|
+
ZWrite Off
|
|
44
|
+
ZTest [unity_GUIZTestMode]
|
|
45
|
+
Blend SrcAlpha OneMinusSrcAlpha
|
|
46
|
+
ColorMask [_ColorMask]
|
|
47
|
+
|
|
48
|
+
Pass
|
|
49
|
+
{
|
|
50
|
+
Name "Default"
|
|
51
|
+
CGPROGRAM
|
|
52
|
+
#pragma vertex vert
|
|
53
|
+
#pragma fragment frag
|
|
54
|
+
#pragma target 2.0
|
|
55
|
+
|
|
56
|
+
#include "UnityCG.cginc"
|
|
57
|
+
#include "UnityUI.cginc"
|
|
58
|
+
|
|
59
|
+
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
|
|
60
|
+
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
|
|
61
|
+
|
|
62
|
+
struct appdata_t
|
|
63
|
+
{
|
|
64
|
+
float4 vertex : POSITION;
|
|
65
|
+
float4 color : COLOR;
|
|
66
|
+
float2 texcoord : TEXCOORD0;
|
|
67
|
+
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
struct v2f
|
|
71
|
+
{
|
|
72
|
+
float4 vertex : SV_POSITION;
|
|
73
|
+
fixed4 color : COLOR;
|
|
74
|
+
float2 texcoord : TEXCOORD0;
|
|
75
|
+
float4 worldPosition : TEXCOORD1;
|
|
76
|
+
float4 mask : TEXCOORD2;
|
|
77
|
+
UNITY_VERTEX_OUTPUT_STEREO
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
sampler2D _MainTex;
|
|
81
|
+
fixed4 _Color;
|
|
82
|
+
fixed4 _TextureSampleAdd;
|
|
83
|
+
float4 _ClipRect;
|
|
84
|
+
float4 _MainTex_ST;
|
|
85
|
+
float _UIMaskSoftnessX;
|
|
86
|
+
float _UIMaskSoftnessY;
|
|
87
|
+
|
|
88
|
+
v2f vert(appdata_t v)
|
|
89
|
+
{
|
|
90
|
+
v2f OUT;
|
|
91
|
+
UNITY_SETUP_INSTANCE_ID(v);
|
|
92
|
+
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
|
|
93
|
+
float4 vPosition = UnityObjectToClipPos(v.vertex);
|
|
94
|
+
OUT.worldPosition = v.vertex;
|
|
95
|
+
OUT.vertex = vPosition;
|
|
96
|
+
|
|
97
|
+
float2 pixelSize = vPosition.w;
|
|
98
|
+
pixelSize /= float2(1, 1) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
|
|
99
|
+
|
|
100
|
+
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
|
|
101
|
+
float2 maskUV = (v.vertex.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
|
|
102
|
+
OUT.texcoord = TRANSFORM_TEX(v.texcoord.xy, _MainTex);
|
|
103
|
+
OUT.mask = float4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy)));
|
|
104
|
+
|
|
105
|
+
OUT.color = v.color * _Color;
|
|
106
|
+
return OUT;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
fixed4 frag(v2f IN) : SV_Target
|
|
110
|
+
{
|
|
111
|
+
half4 color = IN.color * (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd);
|
|
112
|
+
|
|
113
|
+
#ifdef UNITY_UI_CLIP_RECT
|
|
114
|
+
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
|
|
115
|
+
color.a *= m.x * m.y;
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
#ifdef UNITY_UI_ALPHACLIP
|
|
119
|
+
clip (color.a - 0.001);
|
|
120
|
+
#endif
|
|
121
|
+
|
|
122
|
+
return color;
|
|
123
|
+
}
|
|
124
|
+
ENDCG
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!21 &2100000
|
|
4
|
+
Material:
|
|
5
|
+
serializedVersion: 6
|
|
6
|
+
m_ObjectHideFlags: 0
|
|
7
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
8
|
+
m_PrefabInstance: {fileID: 0}
|
|
9
|
+
m_PrefabAsset: {fileID: 0}
|
|
10
|
+
m_Name: tapsdk_text_material
|
|
11
|
+
m_Shader: {fileID: 4800000, guid: b3c067c0e17de4e4c877649ed2d40608, type: 3}
|
|
12
|
+
m_ShaderKeywords:
|
|
13
|
+
m_LightmapFlags: 4
|
|
14
|
+
m_EnableInstancingVariants: 0
|
|
15
|
+
m_DoubleSidedGI: 0
|
|
16
|
+
m_CustomRenderQueue: -1
|
|
17
|
+
stringTagMap: {}
|
|
18
|
+
disabledShaderPasses: []
|
|
19
|
+
m_SavedProperties:
|
|
20
|
+
serializedVersion: 3
|
|
21
|
+
m_TexEnvs:
|
|
22
|
+
- _BumpMap:
|
|
23
|
+
m_Texture: {fileID: 0}
|
|
24
|
+
m_Scale: {x: 1, y: 1}
|
|
25
|
+
m_Offset: {x: 0, y: 0}
|
|
26
|
+
- _DetailAlbedoMap:
|
|
27
|
+
m_Texture: {fileID: 0}
|
|
28
|
+
m_Scale: {x: 1, y: 1}
|
|
29
|
+
m_Offset: {x: 0, y: 0}
|
|
30
|
+
- _DetailMask:
|
|
31
|
+
m_Texture: {fileID: 0}
|
|
32
|
+
m_Scale: {x: 1, y: 1}
|
|
33
|
+
m_Offset: {x: 0, y: 0}
|
|
34
|
+
- _DetailNormalMap:
|
|
35
|
+
m_Texture: {fileID: 0}
|
|
36
|
+
m_Scale: {x: 1, y: 1}
|
|
37
|
+
m_Offset: {x: 0, y: 0}
|
|
38
|
+
- _EmissionMap:
|
|
39
|
+
m_Texture: {fileID: 0}
|
|
40
|
+
m_Scale: {x: 1, y: 1}
|
|
41
|
+
m_Offset: {x: 0, y: 0}
|
|
42
|
+
- _FaceTex:
|
|
43
|
+
m_Texture: {fileID: 0}
|
|
44
|
+
m_Scale: {x: 1, y: 1}
|
|
45
|
+
m_Offset: {x: 0, y: 0}
|
|
46
|
+
- _MainTex:
|
|
47
|
+
m_Texture: {fileID: 0}
|
|
48
|
+
m_Scale: {x: 1, y: 1}
|
|
49
|
+
m_Offset: {x: 0, y: 0}
|
|
50
|
+
- _MetallicGlossMap:
|
|
51
|
+
m_Texture: {fileID: 0}
|
|
52
|
+
m_Scale: {x: 1, y: 1}
|
|
53
|
+
m_Offset: {x: 0, y: 0}
|
|
54
|
+
- _OcclusionMap:
|
|
55
|
+
m_Texture: {fileID: 0}
|
|
56
|
+
m_Scale: {x: 1, y: 1}
|
|
57
|
+
m_Offset: {x: 0, y: 0}
|
|
58
|
+
- _ParallaxMap:
|
|
59
|
+
m_Texture: {fileID: 0}
|
|
60
|
+
m_Scale: {x: 1, y: 1}
|
|
61
|
+
m_Offset: {x: 0, y: 0}
|
|
62
|
+
m_Floats:
|
|
63
|
+
- _BumpScale: 1
|
|
64
|
+
- _ColorMask: 15
|
|
65
|
+
- _CullMode: 0
|
|
66
|
+
- _Cutoff: 0.5
|
|
67
|
+
- _DetailNormalMapScale: 1
|
|
68
|
+
- _DiffusePower: 1
|
|
69
|
+
- _DstBlend: 0
|
|
70
|
+
- _GlossMapScale: 1
|
|
71
|
+
- _Glossiness: 0.5
|
|
72
|
+
- _GlossyReflections: 1
|
|
73
|
+
- _MaskSoftnessX: 0
|
|
74
|
+
- _MaskSoftnessY: 0
|
|
75
|
+
- _Metallic: 0
|
|
76
|
+
- _Mode: 0
|
|
77
|
+
- _OcclusionStrength: 1
|
|
78
|
+
- _Parallax: 0.02
|
|
79
|
+
- _SmoothnessTextureChannel: 0
|
|
80
|
+
- _SpecularHighlights: 1
|
|
81
|
+
- _SrcBlend: 1
|
|
82
|
+
- _Stencil: 0
|
|
83
|
+
- _StencilComp: 8
|
|
84
|
+
- _StencilOp: 0
|
|
85
|
+
- _StencilReadMask: 255
|
|
86
|
+
- _StencilWriteMask: 255
|
|
87
|
+
- _UVSec: 0
|
|
88
|
+
- _UseUIAlphaClip: 0
|
|
89
|
+
- _VertexOffsetX: 0
|
|
90
|
+
- _VertexOffsetY: 0
|
|
91
|
+
- _ZWrite: 1
|
|
92
|
+
m_Colors:
|
|
93
|
+
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
|
94
|
+
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
|
95
|
+
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
|
96
|
+
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
|
97
|
+
m_BuildTextureStacks: []
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
2
3
|
using System.Threading.Tasks;
|
|
3
4
|
|
|
4
|
-
namespace TapSDK.Core.Internal
|
|
5
|
-
|
|
5
|
+
namespace TapSDK.Core.Internal
|
|
6
|
+
{
|
|
7
|
+
public interface ITapCorePlatform
|
|
8
|
+
{
|
|
6
9
|
void Init(TapTapSdkOptions config);
|
|
7
10
|
|
|
8
11
|
void Init(TapTapSdkOptions coreOption, TapTapSdkBaseOptions[] otherOptions);
|
|
9
|
-
|
|
12
|
+
|
|
10
13
|
void UpdateLanguage(TapTapLanguageType language);
|
|
11
14
|
|
|
12
15
|
Task<bool> IsLaunchedFromTapTapPC();
|
|
16
|
+
|
|
17
|
+
void SendOpenLog(
|
|
18
|
+
string project,
|
|
19
|
+
string version,
|
|
20
|
+
string action,
|
|
21
|
+
Dictionary<string, string> properties
|
|
22
|
+
);
|
|
13
23
|
}
|
|
14
|
-
}
|
|
24
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
using
|
|
1
|
+
using System;
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
|
-
using System;
|
|
5
|
-
using System.Threading;
|
|
6
4
|
using System.Linq;
|
|
5
|
+
using System.Threading;
|
|
6
|
+
using UnityEngine;
|
|
7
7
|
|
|
8
8
|
namespace TapSDK.Core.Internal.Utils
|
|
9
9
|
{
|
|
@@ -42,7 +42,6 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
42
42
|
{
|
|
43
43
|
if (!initialized)
|
|
44
44
|
{
|
|
45
|
-
|
|
46
45
|
if (!Application.isPlaying)
|
|
47
46
|
return;
|
|
48
47
|
initialized = true;
|
|
@@ -50,15 +49,16 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
50
49
|
DontDestroyOnLoad(g);
|
|
51
50
|
_current = g.AddComponent<TapLoom>();
|
|
52
51
|
}
|
|
53
|
-
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
private List<Action> _actions = new List<Action>();
|
|
55
|
+
|
|
57
56
|
public struct DelayedQueueItem
|
|
58
57
|
{
|
|
59
58
|
public float time;
|
|
60
59
|
public Action action;
|
|
61
60
|
}
|
|
61
|
+
|
|
62
62
|
private List<DelayedQueueItem> _delayed = new List<DelayedQueueItem>();
|
|
63
63
|
|
|
64
64
|
List<DelayedQueueItem> _currentDelayed = new List<DelayedQueueItem>();
|
|
@@ -67,20 +67,26 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
67
67
|
{
|
|
68
68
|
QueueOnMainThread(action, 0f);
|
|
69
69
|
}
|
|
70
|
+
|
|
70
71
|
public static void QueueOnMainThread(Action action, float time)
|
|
71
72
|
{
|
|
72
73
|
if (time != 0)
|
|
73
74
|
{
|
|
74
75
|
lock (Current._delayed)
|
|
75
76
|
{
|
|
76
|
-
Current._delayed.Add(
|
|
77
|
+
Current._delayed.Add(
|
|
78
|
+
new DelayedQueueItem { time = Time.time, action = action }
|
|
79
|
+
);
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
else
|
|
80
83
|
{
|
|
81
|
-
|
|
84
|
+
if (Current != null && Current._actions != null)
|
|
82
85
|
{
|
|
83
|
-
Current._actions
|
|
86
|
+
lock (Current._actions)
|
|
87
|
+
{
|
|
88
|
+
Current._actions.Add(action);
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
}
|
|
@@ -167,37 +173,27 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
167
173
|
{
|
|
168
174
|
((Action)action)();
|
|
169
175
|
}
|
|
170
|
-
catch
|
|
171
|
-
{
|
|
172
|
-
}
|
|
176
|
+
catch { }
|
|
173
177
|
finally
|
|
174
178
|
{
|
|
175
179
|
Interlocked.Decrement(ref numThreads);
|
|
176
180
|
}
|
|
177
|
-
|
|
178
181
|
}
|
|
179
182
|
|
|
180
|
-
|
|
181
183
|
void OnDisable()
|
|
182
184
|
{
|
|
183
185
|
if (_current == this)
|
|
184
186
|
{
|
|
185
|
-
|
|
186
187
|
_current = null;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// Use this for initialization
|
|
193
|
-
void Start()
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
}
|
|
191
|
+
// Use this for initialization
|
|
192
|
+
void Start() { }
|
|
197
193
|
|
|
198
194
|
List<Action> _currentActions = new List<Action>();
|
|
199
195
|
|
|
200
|
-
// Update is called once per frame
|
|
196
|
+
// Update is called once per frame
|
|
201
197
|
void Update()
|
|
202
198
|
{
|
|
203
199
|
lock (_actions)
|
|
@@ -223,19 +219,23 @@ namespace TapSDK.Core.Internal.Utils
|
|
|
223
219
|
}
|
|
224
220
|
}
|
|
225
221
|
|
|
226
|
-
private void OnApplicationPause(bool pauseStatus)
|
|
227
|
-
|
|
222
|
+
private void OnApplicationPause(bool pauseStatus)
|
|
223
|
+
{
|
|
224
|
+
if (pauseStatus && isPause == false)
|
|
225
|
+
{
|
|
228
226
|
isPause = true;
|
|
229
227
|
EventManager.TriggerEvent(EventManager.OnApplicationPause, true);
|
|
230
228
|
}
|
|
231
|
-
else if (!pauseStatus && isPause)
|
|
229
|
+
else if (!pauseStatus && isPause)
|
|
230
|
+
{
|
|
232
231
|
isPause = false;
|
|
233
232
|
EventManager.TriggerEvent(EventManager.OnApplicationPause, false);
|
|
234
233
|
}
|
|
235
234
|
}
|
|
236
235
|
|
|
237
|
-
|
|
236
|
+
private void OnApplicationQuit()
|
|
237
|
+
{
|
|
238
238
|
EventManager.TriggerEvent(EventManager.OnApplicationQuit, true);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
}
|
|
241
|
+
}
|
|
@@ -13,6 +13,9 @@ namespace TapSDK.Core
|
|
|
13
13
|
{
|
|
14
14
|
private static Dictionary<string, string> dataCache;
|
|
15
15
|
private static byte[] Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
|
|
16
|
+
|
|
17
|
+
// 缓存 MacAddress,避免多次获取
|
|
18
|
+
private static string cachedMacAddress;
|
|
16
19
|
public static void SaveString(string key, string value)
|
|
17
20
|
{
|
|
18
21
|
string storageKey = GenerateStorageKey(key);
|
|
@@ -135,6 +138,10 @@ namespace TapSDK.Core
|
|
|
135
138
|
|
|
136
139
|
private static string GetMacAddress()
|
|
137
140
|
{
|
|
141
|
+
if (!string.IsNullOrEmpty(cachedMacAddress))
|
|
142
|
+
{
|
|
143
|
+
return cachedMacAddress;
|
|
144
|
+
}
|
|
138
145
|
string physicalAddress = "FFFFFFFFFFFF";
|
|
139
146
|
if (Platform.IsAndroid() || Platform.IsIOS())
|
|
140
147
|
{
|
|
@@ -159,6 +166,7 @@ namespace TapSDK.Core
|
|
|
159
166
|
};
|
|
160
167
|
}
|
|
161
168
|
}
|
|
169
|
+
cachedMacAddress = physicalAddress;
|
|
162
170
|
return physicalAddress;
|
|
163
171
|
}
|
|
164
172
|
|
|
@@ -119,8 +119,34 @@ namespace TapSDK.Core {
|
|
|
119
119
|
tapEventOptions.enableAutoIAPEvent = coreOption.enableAutoIAPEvent;
|
|
120
120
|
tapEventOptions.overrideBuiltInParameters = coreOption.overrideBuiltInParameters;
|
|
121
121
|
tapEventOptions.propertiesJson = coreOption.propertiesJson;
|
|
122
|
+
tapEventOptions.caid = coreOption.caid;
|
|
123
|
+
tapEventOptions.enableAdvertiserIDCollection = coreOption.enableAdvertiserIDCollection;
|
|
124
|
+
tapEventOptions.oaidCert = coreOption.oaidCert;
|
|
125
|
+
tapEventOptions.disableReflectionOAID = coreOption.disableReflectionOAID;
|
|
122
126
|
}
|
|
123
127
|
}
|
|
128
|
+
else
|
|
129
|
+
{
|
|
130
|
+
if (
|
|
131
|
+
string.IsNullOrEmpty(tapEventOptions.caid)
|
|
132
|
+
&& !string.IsNullOrEmpty(coreOption.caid)
|
|
133
|
+
)
|
|
134
|
+
{
|
|
135
|
+
tapEventOptions.caid = coreOption.caid;
|
|
136
|
+
}
|
|
137
|
+
tapEventOptions.enableAdvertiserIDCollection =
|
|
138
|
+
tapEventOptions.enableAdvertiserIDCollection || coreOption.enableAdvertiserIDCollection;
|
|
139
|
+
|
|
140
|
+
if (
|
|
141
|
+
string.IsNullOrEmpty(tapEventOptions.oaidCert)
|
|
142
|
+
&& !string.IsNullOrEmpty(coreOption.oaidCert)
|
|
143
|
+
)
|
|
144
|
+
{
|
|
145
|
+
tapEventOptions.oaidCert = coreOption.oaidCert;
|
|
146
|
+
}
|
|
147
|
+
tapEventOptions.disableReflectionOAID =
|
|
148
|
+
tapEventOptions.disableReflectionOAID && coreOption.disableReflectionOAID;
|
|
149
|
+
}
|
|
124
150
|
return tapEventOptions;
|
|
125
151
|
}
|
|
126
152
|
|
|
@@ -146,5 +172,15 @@ namespace TapSDK.Core {
|
|
|
146
172
|
return initTaskTypes;
|
|
147
173
|
}
|
|
148
174
|
|
|
175
|
+
public static void SendOpenLog(
|
|
176
|
+
string project,
|
|
177
|
+
string version,
|
|
178
|
+
string action,
|
|
179
|
+
Dictionary<string, string> properties = null
|
|
180
|
+
)
|
|
181
|
+
{
|
|
182
|
+
platformWrapper.SendOpenLog(project, version, action, properties);
|
|
183
|
+
}
|
|
184
|
+
|
|
149
185
|
}
|
|
150
186
|
}
|
|
@@ -74,6 +74,7 @@ namespace TapSDK.Core
|
|
|
74
74
|
/// <summary>
|
|
75
75
|
/// CAID,仅国内 iOS
|
|
76
76
|
/// </summary>
|
|
77
|
+
[Obsolete("该属性已废弃,请在 TapTapEventOptions 设置对应属性")]
|
|
77
78
|
public string caid = null;
|
|
78
79
|
/// <summary>
|
|
79
80
|
/// 是否能够覆盖内置参数,默认为 false
|
|
@@ -83,6 +84,7 @@ namespace TapSDK.Core
|
|
|
83
84
|
/// <summary>
|
|
84
85
|
/// 是否开启广告商 ID 收集,默认为 false
|
|
85
86
|
/// </summary>
|
|
87
|
+
[Obsolete("该属性已废弃,请在 TapTapEventOptions 设置对应属性")]
|
|
86
88
|
public bool enableAdvertiserIDCollection = false;
|
|
87
89
|
/// <summary>
|
|
88
90
|
/// 是否开启自动上报 IAP 事件
|
|
@@ -92,6 +94,7 @@ namespace TapSDK.Core
|
|
|
92
94
|
/// <summary>
|
|
93
95
|
/// OAID证书, 仅 Android,用于上报 OAID 仅 [TapTapRegion.CN] 生效
|
|
94
96
|
/// </summary>
|
|
97
|
+
[Obsolete("该属性已废弃,请在 TapTapEventOptions 设置对应属性")]
|
|
95
98
|
public string oaidCert = null;
|
|
96
99
|
/// <summary>
|
|
97
100
|
/// 是否开启日志,Release 版本请设置为 false
|
|
@@ -101,6 +104,7 @@ namespace TapSDK.Core
|
|
|
101
104
|
/// <summary>
|
|
102
105
|
/// 是否禁用 OAID 反射
|
|
103
106
|
/// </summary>
|
|
107
|
+
[Obsolete("该属性已废弃,请在 TapTapEventOptions 设置对应属性")]
|
|
104
108
|
public bool disableReflectionOAID = true;
|
|
105
109
|
|
|
106
110
|
/// <summary>
|
|
@@ -156,6 +160,26 @@ namespace TapSDK.Core
|
|
|
156
160
|
/// </summary>
|
|
157
161
|
public bool disableAutoLogDeviceLogin = false;
|
|
158
162
|
|
|
163
|
+
/// <summary>
|
|
164
|
+
/// CAID,仅国内 iOS
|
|
165
|
+
/// </summary>
|
|
166
|
+
public string caid = null;
|
|
167
|
+
|
|
168
|
+
/// <summary>
|
|
169
|
+
/// 是否开启广告商 ID 收集,默认为 false
|
|
170
|
+
/// </summary>
|
|
171
|
+
public bool enableAdvertiserIDCollection = false;
|
|
172
|
+
|
|
173
|
+
/// <summary>
|
|
174
|
+
/// OAID证书, 仅 Android,用于上报 OAID 仅 [TapTapRegion.CN] 生效
|
|
175
|
+
/// </summary>
|
|
176
|
+
public string oaidCert = null;
|
|
177
|
+
|
|
178
|
+
/// <summary>
|
|
179
|
+
/// 是否禁用 OAID 反射
|
|
180
|
+
/// </summary>
|
|
181
|
+
public bool disableReflectionOAID = true;
|
|
182
|
+
|
|
159
183
|
[JsonProperty("moduleName")]
|
|
160
184
|
private string _moduleName = "TapTapEvent";
|
|
161
185
|
[JsonIgnore]
|
|
@@ -11,6 +11,11 @@ namespace TapSDK.Core.Standalone.Internal
|
|
|
11
11
|
{
|
|
12
12
|
public class DeviceInfo
|
|
13
13
|
{
|
|
14
|
+
// 缓存网卡地址列表,避免多次调用
|
|
15
|
+
private static string cachedMacAddressList;
|
|
16
|
+
|
|
17
|
+
// 缓存网卡地址,避免多次调用
|
|
18
|
+
private static string cachedFristMacAddress;
|
|
14
19
|
|
|
15
20
|
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
|
|
16
21
|
[DllImport("TapDBDeviceInfo", CallingConvention = CallingConvention.Cdecl)]
|
|
@@ -68,6 +73,15 @@ namespace TapSDK.Core.Standalone.Internal
|
|
|
68
73
|
|
|
69
74
|
public static void GetMacAddress(out string macAddressList, out string firstMacAddress)
|
|
70
75
|
{
|
|
76
|
+
if (
|
|
77
|
+
!string.IsNullOrEmpty(cachedMacAddressList)
|
|
78
|
+
&& !string.IsNullOrEmpty(cachedFristMacAddress)
|
|
79
|
+
)
|
|
80
|
+
{
|
|
81
|
+
macAddressList = cachedMacAddressList;
|
|
82
|
+
firstMacAddress = cachedFristMacAddress;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
71
85
|
List<string> mac_addrs = new List<string>();
|
|
72
86
|
|
|
73
87
|
try
|
|
@@ -92,6 +106,9 @@ namespace TapSDK.Core.Standalone.Internal
|
|
|
92
106
|
}
|
|
93
107
|
macAddressList = $"[{string.Join(",", mac_addrs)}]";
|
|
94
108
|
firstMacAddress = mac_addrs.Count > 0 ? mac_addrs[0].Replace("\"", "") : string.Empty;
|
|
109
|
+
|
|
110
|
+
cachedMacAddressList = macAddressList;
|
|
111
|
+
cachedFristMacAddress = firstMacAddress;
|
|
95
112
|
}
|
|
96
113
|
|
|
97
114
|
private static string toMd5(string data)
|
|
@@ -11,6 +11,7 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
11
11
|
using System.Threading.Tasks;
|
|
12
12
|
using Newtonsoft.Json;
|
|
13
13
|
using TapSDK.Core.Internal.Log;
|
|
14
|
+
using UnityEngine;
|
|
14
15
|
|
|
15
16
|
public class TapHttp
|
|
16
17
|
{
|
|
@@ -391,47 +392,9 @@ namespace TapSDK.Core.Standalone.Internal.Http
|
|
|
391
392
|
}
|
|
392
393
|
|
|
393
394
|
// 判断网络连接状态
|
|
394
|
-
private bool CheckNetworkConnection()
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
foreach (var netInterface in networkInterfaces)
|
|
399
|
-
{
|
|
400
|
-
// 忽略虚拟网卡
|
|
401
|
-
if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Loopback ||
|
|
402
|
-
netInterface.NetworkInterfaceType == NetworkInterfaceType.Tunnel)
|
|
403
|
-
{
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// 检查是否有网络连接
|
|
408
|
-
if (netInterface.OperationalStatus == OperationalStatus.Up)
|
|
409
|
-
{
|
|
410
|
-
// 检查是否有有效的 IPv4 地址
|
|
411
|
-
var ipProperties = netInterface.GetIPProperties();
|
|
412
|
-
var ipv4Address = ipProperties.UnicastAddresses.FirstOrDefault(ip => ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
|
|
413
|
-
|
|
414
|
-
if (ipv4Address != null)
|
|
415
|
-
{
|
|
416
|
-
// 有有效的 IP 地址,则说明已连接到网络
|
|
417
|
-
if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
|
|
418
|
-
{
|
|
419
|
-
return true; // 有线连接
|
|
420
|
-
}
|
|
421
|
-
else if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
|
|
422
|
-
{
|
|
423
|
-
return true; // 无线连接
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
return false; // 无连接
|
|
430
|
-
}catch(Exception e){
|
|
431
|
-
TapLog.Log("checkout network connected error = " + e);
|
|
432
|
-
// 发生异常时,当做有网处理
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
395
|
+
private bool CheckNetworkConnection()
|
|
396
|
+
{
|
|
397
|
+
return Application.internetReachability != NetworkReachability.NotReachable;
|
|
435
398
|
}
|
|
436
399
|
}
|
|
437
400
|
}
|
|
@@ -17,16 +17,20 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
17
17
|
public class TapOpenlogStandalone
|
|
18
18
|
{
|
|
19
19
|
public static string openid = "";
|
|
20
|
-
private static readonly Dictionary<string, string> generalParameter =
|
|
21
|
-
|
|
20
|
+
private static readonly Dictionary<string, string> generalParameter =
|
|
21
|
+
new Dictionary<string, string>();
|
|
22
|
+
private static readonly Dictionary<string, System.Object> openlogStartParameter =
|
|
23
|
+
new Dictionary<string, System.Object>();
|
|
22
24
|
private readonly string sdkProjectName;
|
|
23
25
|
private readonly string sdkProjectVersion;
|
|
24
26
|
private static readonly bool isRND = false;
|
|
25
27
|
private static readonly TapLog log = new TapLog(module: "Openlog");
|
|
26
28
|
#if UNITY_STANDALONE
|
|
27
|
-
private static readonly CommonVariablesGetter commonVariablesGetter =
|
|
29
|
+
private static readonly CommonVariablesGetter commonVariablesGetter =
|
|
30
|
+
new CommonVariablesGetter(GetCommonVariables);
|
|
28
31
|
private static readonly FreeStringCallback freeString = new FreeStringCallback(FreeString);
|
|
29
32
|
#endif
|
|
33
|
+
|
|
30
34
|
public static void Init()
|
|
31
35
|
{
|
|
32
36
|
#if UNITY_STANDALONE
|
|
@@ -58,28 +62,37 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
58
62
|
private static void BindWindowChange()
|
|
59
63
|
{
|
|
60
64
|
#if UNITY_STANDALONE
|
|
61
|
-
EventManager.AddListener(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
EventManager.AddListener(
|
|
66
|
+
EventManager.OnApplicationPause,
|
|
67
|
+
(isPause) =>
|
|
68
|
+
{
|
|
69
|
+
var isPauseBool = (bool)isPause;
|
|
70
|
+
if (isPauseBool)
|
|
71
|
+
{
|
|
72
|
+
TdkOnBackground();
|
|
73
|
+
}
|
|
74
|
+
else
|
|
75
|
+
{
|
|
76
|
+
TdkOnForeground();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
EventManager.AddListener(
|
|
82
|
+
EventManager.OnApplicationQuit,
|
|
83
|
+
(quit) =>
|
|
65
84
|
{
|
|
66
|
-
|
|
85
|
+
TdkOnAppStopped();
|
|
67
86
|
}
|
|
68
|
-
|
|
87
|
+
);
|
|
88
|
+
EventManager.AddListener(
|
|
89
|
+
EventManager.OnComplianceUserChanged,
|
|
90
|
+
(userInfo) =>
|
|
69
91
|
{
|
|
70
|
-
|
|
92
|
+
TdkSetExtraAppDurationParams(userInfo.ToString());
|
|
71
93
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
EventManager.AddListener(EventManager.OnApplicationQuit, (quit) =>
|
|
75
|
-
{
|
|
76
|
-
TdkOnAppStopped();
|
|
77
|
-
});
|
|
78
|
-
EventManager.AddListener(EventManager.OnComplianceUserChanged, (userInfo) =>
|
|
79
|
-
{
|
|
80
|
-
TdkSetExtraAppDurationParams(userInfo.ToString());
|
|
81
|
-
});
|
|
82
|
-
#endif
|
|
94
|
+
);
|
|
95
|
+
#endif
|
|
83
96
|
}
|
|
84
97
|
|
|
85
98
|
public TapOpenlogStandalone(string sdkProjectName, string sdkProjectVersion)
|
|
@@ -88,10 +101,7 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
88
101
|
this.sdkProjectVersion = sdkProjectVersion;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
|
-
public void LogBusiness(
|
|
92
|
-
string action,
|
|
93
|
-
Dictionary<string, string> properties = null
|
|
94
|
-
)
|
|
104
|
+
public void LogBusiness(string action, Dictionary<string, string> properties = null)
|
|
95
105
|
{
|
|
96
106
|
#if UNITY_STANDALONE
|
|
97
107
|
if (properties == null)
|
|
@@ -106,13 +116,13 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
106
116
|
#endif
|
|
107
117
|
}
|
|
108
118
|
|
|
109
|
-
public void LogTechnology(
|
|
110
|
-
string action,
|
|
111
|
-
Dictionary<string, string> properties = null
|
|
112
|
-
)
|
|
119
|
+
public void LogTechnology(string action, Dictionary<string, string> properties = null)
|
|
113
120
|
{
|
|
114
121
|
#if UNITY_STANDALONE
|
|
115
|
-
if (
|
|
122
|
+
if (
|
|
123
|
+
TapCoreStandalone.coreOptions.region == TapTapRegionType.CN
|
|
124
|
+
&& !"TapPayment".Equals(sdkProjectName)
|
|
125
|
+
)
|
|
116
126
|
{
|
|
117
127
|
// 国内非支付SDK不上报技术日志
|
|
118
128
|
return;
|
|
@@ -138,16 +148,26 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
138
148
|
}
|
|
139
149
|
else
|
|
140
150
|
{
|
|
141
|
-
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_REGION] =
|
|
151
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_REGION] =
|
|
152
|
+
TapCoreStandalone.coreOptions.region;
|
|
142
153
|
}
|
|
143
154
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_LOG_TO_CONSOLE] = 1;
|
|
144
155
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_LOG_LEVEL] = 1;
|
|
145
156
|
string openLogDirPath = Path.Combine(Application.persistentDataPath, "OpenlogData");
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
if (
|
|
158
|
+
TapTapSDK.taptapSdkOptions != null
|
|
159
|
+
&& !string.IsNullOrEmpty(TapTapSDK.taptapSdkOptions.clientId)
|
|
160
|
+
)
|
|
161
|
+
{
|
|
162
|
+
openLogDirPath = Path.Combine(
|
|
163
|
+
Application.persistentDataPath,
|
|
164
|
+
"OpenlogData_" + TapTapSDK.taptapSdkOptions.clientId
|
|
165
|
+
);
|
|
166
|
+
if (!Directory.Exists(openLogDirPath))
|
|
167
|
+
{
|
|
149
168
|
string oldPath = Path.Combine(Application.persistentDataPath, "OpenlogData");
|
|
150
|
-
if(Directory.Exists(oldPath))
|
|
169
|
+
if (Directory.Exists(oldPath))
|
|
170
|
+
{
|
|
151
171
|
Directory.Move(oldPath, openLogDirPath);
|
|
152
172
|
}
|
|
153
173
|
}
|
|
@@ -155,20 +175,26 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
155
175
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_DATA_DIR] = openLogDirPath;
|
|
156
176
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_ENV] = "local";
|
|
157
177
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_PLATFORM] = "PC";
|
|
158
|
-
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_UA] =
|
|
159
|
-
|
|
160
|
-
openlogStartParameter[TapOpenlogStartParamConstants.
|
|
178
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_UA] =
|
|
179
|
+
TapHttpUtils.GenerateUserAgent();
|
|
180
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_CLIENT_ID] = TapCoreStandalone
|
|
181
|
+
.coreOptions
|
|
182
|
+
.clientId;
|
|
183
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_CLIENT_TOKEN] =
|
|
184
|
+
TapCoreStandalone.coreOptions.clientToken;
|
|
161
185
|
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_COMMON] = generalParameter;
|
|
162
|
-
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_APP_DURATION] =
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
186
|
+
openlogStartParameter[TapOpenlogStartParamConstants.PARAM_APP_DURATION] =
|
|
187
|
+
new Dictionary<string, string>()
|
|
188
|
+
{
|
|
189
|
+
{ TapOpenlogParamConstants.PARAM_TAPSDK_VERSION, TapTapSDK.Version },
|
|
190
|
+
};
|
|
166
191
|
}
|
|
167
192
|
|
|
168
193
|
private static void InitGeneralParameter()
|
|
169
194
|
{
|
|
170
195
|
// 应用包名
|
|
171
|
-
generalParameter[TapOpenlogParamConstants.PARAM_APP_PACKAGE_NAME] =
|
|
196
|
+
generalParameter[TapOpenlogParamConstants.PARAM_APP_PACKAGE_NAME] =
|
|
197
|
+
Application.identifier;
|
|
172
198
|
// 应用版本字符串
|
|
173
199
|
generalParameter[TapOpenlogParamConstants.PARAM_APP_VERSION] = Application.version;
|
|
174
200
|
// 应用版本(数字)
|
|
@@ -176,7 +202,8 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
176
202
|
// 固定一个枚举值: TapSDK
|
|
177
203
|
generalParameter[TapOpenlogParamConstants.PARAM_PN] = "TapSDK";
|
|
178
204
|
// SDK生成的设备唯一标识
|
|
179
|
-
generalParameter[TapOpenlogParamConstants.PARAM_DEVICE_ID] =
|
|
205
|
+
generalParameter[TapOpenlogParamConstants.PARAM_DEVICE_ID] =
|
|
206
|
+
SystemInfo.deviceUniqueIdentifier;
|
|
180
207
|
// SDK生成的设备一次安装的唯一标识
|
|
181
208
|
generalParameter[TapOpenlogParamConstants.PARAM_INSTALL_UUID] = Identity.InstallationId;
|
|
182
209
|
// 设备品牌,eg: Xiaomi
|
|
@@ -188,13 +215,16 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
188
215
|
// 支持 CPU 架构,eg:arm64-v8a
|
|
189
216
|
generalParameter[TapOpenlogParamConstants.PARAM_CPU_ABIS] = "";
|
|
190
217
|
// 设备操作系统
|
|
191
|
-
generalParameter[TapOpenlogParamConstants.PARAM_OS] =
|
|
218
|
+
generalParameter[TapOpenlogParamConstants.PARAM_OS] =
|
|
219
|
+
SystemInfo.operatingSystemFamily.ToString();
|
|
192
220
|
// 设备操作系统版本
|
|
193
221
|
generalParameter[TapOpenlogParamConstants.PARAM_SV] = SystemInfo.operatingSystem;
|
|
194
222
|
// 物理设备真实屏幕分辨率宽
|
|
195
|
-
generalParameter[TapOpenlogParamConstants.PARAM_WIDTH] =
|
|
223
|
+
generalParameter[TapOpenlogParamConstants.PARAM_WIDTH] =
|
|
224
|
+
Screen.currentResolution.width.ToString();
|
|
196
225
|
// 物理设备真实屏幕分辨率高
|
|
197
|
-
generalParameter[TapOpenlogParamConstants.PARAM_HEIGHT] =
|
|
226
|
+
generalParameter[TapOpenlogParamConstants.PARAM_HEIGHT] =
|
|
227
|
+
Screen.currentResolution.height.ToString();
|
|
198
228
|
// 设备总存储空间(磁盘),单位B
|
|
199
229
|
generalParameter[TapOpenlogParamConstants.PARAM_TOTAL_ROM] = "";
|
|
200
230
|
// 设备总内存,单位B
|
|
@@ -202,7 +232,8 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
202
232
|
// 芯片型号,eg:Qualcomm Technologies, Inc SM7250
|
|
203
233
|
generalParameter[TapOpenlogParamConstants.PARAM_HARDWARE] = SystemInfo.processorType;
|
|
204
234
|
// SDK设置的地区,例如 zh_CN
|
|
205
|
-
generalParameter[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
235
|
+
generalParameter[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
236
|
+
TapLocalizeManager.GetCurrentLanguageString();
|
|
206
237
|
// taptap的用户ID的外显ID(加密)
|
|
207
238
|
generalParameter[TapOpenlogParamConstants.PARAM_OPEN_ID] = openid;
|
|
208
239
|
}
|
|
@@ -227,8 +258,29 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
227
258
|
// 网络类型,eg:wifi, mobile
|
|
228
259
|
props[TapOpenlogParamConstants.PARAM_NETWORK_TYPE] = "";
|
|
229
260
|
// SDK设置的地区,例如 zh_CN
|
|
230
|
-
props[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
261
|
+
props[TapOpenlogParamConstants.PARAM_SDK_LOCALE] =
|
|
262
|
+
TapLocalizeManager.GetCurrentLanguageString();
|
|
231
263
|
return props;
|
|
232
264
|
}
|
|
265
|
+
|
|
266
|
+
internal static void LogBusiness(
|
|
267
|
+
string sdkProjectName,
|
|
268
|
+
string sdkProjectVersion,
|
|
269
|
+
string action,
|
|
270
|
+
Dictionary<string, string> properties = null
|
|
271
|
+
)
|
|
272
|
+
{
|
|
273
|
+
#if UNITY_STANDALONE
|
|
274
|
+
if (properties == null)
|
|
275
|
+
{
|
|
276
|
+
properties = new Dictionary<string, string>();
|
|
277
|
+
}
|
|
278
|
+
properties[TapOpenlogParamConstants.PARAM_TAPSDK_PROJECT] = sdkProjectName;
|
|
279
|
+
properties[TapOpenlogParamConstants.PARAM_TAPSDK_VERSION] = sdkProjectVersion;
|
|
280
|
+
properties[TapOpenlogParamConstants.PARAM_ACTION] = action;
|
|
281
|
+
string propertiesStr = JsonConvert.SerializeObject(properties);
|
|
282
|
+
TdkOpenLog("tapsdk", propertiesStr);
|
|
283
|
+
#endif
|
|
284
|
+
}
|
|
233
285
|
}
|
|
234
|
-
}
|
|
286
|
+
}
|
|
@@ -5,11 +5,12 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
5
5
|
{
|
|
6
6
|
internal class TapOpenlogWrapper
|
|
7
7
|
{
|
|
8
|
-
|
|
9
8
|
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
|
10
9
|
internal const string DllName = "tapsdkcore";
|
|
11
10
|
#elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
|
|
12
11
|
internal const string DllName = "libtapsdkcorecpp";
|
|
12
|
+
#elif UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
|
|
13
|
+
internal const string DllName = "libtapsdkcorecpp";
|
|
13
14
|
#endif
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -68,7 +69,8 @@ namespace TapSDK.Core.Standalone.Internal.Openlog
|
|
|
68
69
|
* 成功返回 0,失败返回 -1
|
|
69
70
|
*/
|
|
70
71
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
|
71
|
-
internal static extern int TdkOnAppStarted(string cfg, CommonVariablesGetter commonVariablesGetter,
|
|
72
|
+
internal static extern int TdkOnAppStarted(string cfg, CommonVariablesGetter commonVariablesGetter,
|
|
73
|
+
FreeStringCallback freeString);
|
|
72
74
|
|
|
73
75
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
74
76
|
internal delegate IntPtr CommonVariablesGetter();
|
|
@@ -238,7 +238,17 @@ namespace TapSDK.Core.Standalone
|
|
|
238
238
|
throw new System.NotImplementedException();
|
|
239
239
|
#endif
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
|
|
242
|
+
public void SendOpenLog(
|
|
243
|
+
string project,
|
|
244
|
+
string version,
|
|
245
|
+
string action,
|
|
246
|
+
Dictionary<string, string> properties
|
|
247
|
+
)
|
|
248
|
+
{
|
|
249
|
+
TapOpenlogStandalone.LogBusiness(project, version, action, properties);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
242
252
|
|
|
243
253
|
|
|
244
254
|
public interface IOpenIDProvider
|
package/link.xml
ADDED
package/link.xml.meta
ADDED
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.9.4",
|
|
6
|
+
"unity": "2020.3.0f1",
|
|
7
|
+
"license": "MIT"
|
|
11
8
|
}
|