com.typhoon.unitysdk 1.0.92 → 1.0.94
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/CHANGELOG.md +13 -1
- package/Editor/ExportModule.cs +3 -3
- package/Editor/PublishWindow.cs +1 -1
- package/Editor/TempPublish/PublishVivoBatSettingInspector.cs +53 -354
- package/Runtime/BaseSdk.cs +15 -0
- package/Runtime/Interface.cs +15 -1
- package/Runtime/SdkLite.cs +28 -1
- package/Runtime/SdkTestInUnity.cs +2 -1
- package/Runtime/TyphoonSdkCallback.cs +2 -2
- package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
- package/Sources~/Package/ChinaAndroid.unitypackage.manifest +0 -3
- package/Sources~/Package/Douyin.unitypackage +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/Editor/ExportModule.cs
CHANGED
|
@@ -18,9 +18,9 @@ namespace TyphoonUnitySDK
|
|
|
18
18
|
{
|
|
19
19
|
var manifest = new List<string>()
|
|
20
20
|
{
|
|
21
|
-
"Assets/Plugins/Android/libs/sdk_plug-release.aar",
|
|
22
|
-
"Assets/Plugins/Android/libs/unity_app-release.aar",
|
|
23
|
-
"Assets/Plugins/Android/libs/unity_launcher-release.aar",
|
|
21
|
+
// "Assets/Plugins/Android/libs/sdk_plug-release.aar",
|
|
22
|
+
// "Assets/Plugins/Android/libs/unity_app-release.aar",
|
|
23
|
+
// "Assets/Plugins/Android/libs/unity_launcher-release.aar",
|
|
24
24
|
"Assets/Plugins/Android/AndroidManifest.xml",
|
|
25
25
|
"Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid",
|
|
26
26
|
};
|
package/Editor/PublishWindow.cs
CHANGED
|
@@ -192,7 +192,7 @@ namespace TyphoonUnitySDK
|
|
|
192
192
|
|
|
193
193
|
GUILayout.Space(1);
|
|
194
194
|
if (GUILayout.Button(new GUIContent(EditorIcons.icon_refresh, "刷新"), Styles.Square.Btn,
|
|
195
|
-
GUILayout.Width(
|
|
195
|
+
GUILayout.Width(32), GUILayout.Height(20)))
|
|
196
196
|
{
|
|
197
197
|
ReloadSettings();
|
|
198
198
|
Repaint();
|
|
@@ -13,68 +13,49 @@ namespace TyphoonUnitySDK
|
|
|
13
13
|
{
|
|
14
14
|
public PublishVivoBatSetting Setting => target as PublishVivoBatSetting;
|
|
15
15
|
|
|
16
|
-
/*Config.java*/
|
|
17
|
-
public string GetConfigJavaPath()
|
|
18
|
-
{
|
|
19
|
-
return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\java\com\typhoon\vivo_union\Config.java";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
16
|
/*build gradle*/
|
|
23
17
|
public string GetBuildGradle()
|
|
24
18
|
{
|
|
25
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
19
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\build.gradle";
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
/*AndroidManifest.xml*/
|
|
29
23
|
public string GetAndroidManifestXml()
|
|
30
24
|
{
|
|
31
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
25
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\AndroidManifest.xml";
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
/*supplierconfig.json*/
|
|
35
29
|
public string GetSupplierConfigJson()
|
|
36
30
|
{
|
|
37
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
31
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\assets\supplierconfig.json";
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
|
|
41
35
|
/*strings.xml*/
|
|
42
36
|
public string GetStringsXml()
|
|
43
37
|
{
|
|
44
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/*unitylibrary*/
|
|
49
|
-
public string GetUnityLibrary()
|
|
50
|
-
{
|
|
51
|
-
return $@"{Setting.AndroidPublishProj}\unityLibrary";
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/*unitylibrary AndroidManifest.xml*/
|
|
55
|
-
public string GetUnityLibraryAndroidManifestXml()
|
|
56
|
-
{
|
|
57
|
-
return $@"{Setting.AndroidPublishProj}\unityLibrary\src\main\AndroidManifest.xml";
|
|
38
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\res\values\strings.xml";
|
|
58
39
|
}
|
|
59
40
|
|
|
60
41
|
|
|
61
42
|
/*icon*/
|
|
62
43
|
public string GetIconPath()
|
|
63
44
|
{
|
|
64
|
-
return $@"{Setting.AndroidPublishProj}\
|
|
45
|
+
return $@"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\res\mipmap-mdpi\app_icon.png";
|
|
65
46
|
}
|
|
66
47
|
|
|
48
|
+
public string GetLauncherVivoPath() => $@"{Setting.AndroidPublishProj}\proj\launcher_vivo";
|
|
49
|
+
|
|
50
|
+
public string GetBeeUnionSdkConfigJsonPath() =>
|
|
51
|
+
@$"{Setting.AndroidPublishProj}\proj\launcher_vivo\src\main\assets\bee_union_sdk_config.json";
|
|
52
|
+
|
|
67
53
|
|
|
68
54
|
public PublishVivoBatSetting Target => target as PublishVivoBatSetting;
|
|
69
55
|
|
|
70
56
|
public override void OnInspectorGUI()
|
|
71
57
|
{
|
|
72
58
|
base.OnInspectorGUI();
|
|
73
|
-
// if (GUILayout.Button("自动版本号", GUILayout.Height(32)))
|
|
74
|
-
// {
|
|
75
|
-
// Target.Version = AutoVersionSting(Target.Version);
|
|
76
|
-
// Target.Save();
|
|
77
|
-
// }
|
|
78
59
|
|
|
79
60
|
var publish = GUILayout.Button("发布vivo", GUILayout.Height(32));
|
|
80
61
|
|
|
@@ -95,222 +76,46 @@ namespace TyphoonUnitySDK
|
|
|
95
76
|
throw new Exception($"找不到{setting.AndroidPublishProj}");
|
|
96
77
|
}
|
|
97
78
|
|
|
98
|
-
|
|
79
|
+
WriteUnityLibraryAAR();
|
|
99
80
|
WriteIcon();
|
|
100
81
|
WriteBuildGradle();
|
|
101
82
|
WriteStringsXml();
|
|
102
|
-
WriteConfigJava();
|
|
103
83
|
WriteAndroidManifestXml();
|
|
104
84
|
WriteSupplierConfigJson();
|
|
105
|
-
|
|
106
|
-
// {
|
|
107
|
-
// Debug.Log("修改unity manifest");
|
|
108
|
-
//
|
|
109
|
-
// var manifest = $"{unityProj}/unityLibrary/src/main/AndroidManifest.xml";
|
|
110
|
-
// var xml = File.ReadAllText(manifest);
|
|
111
|
-
// // string pattern = @"(?s)<intent-filter\b[^>]*>(.*?)<\/intent-filter>";
|
|
112
|
-
// // string result = Regex.Replace(xml, pattern, "");f
|
|
113
|
-
// xml = xml.Replace("<intent-filter>", "");
|
|
114
|
-
// xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
|
|
115
|
-
// xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
|
|
116
|
-
// xml = xml.Replace("</intent-filter>", "");
|
|
117
|
-
// File.WriteAllText(manifest, xml);
|
|
118
|
-
//
|
|
119
|
-
// //复制unitylib
|
|
120
|
-
// Debug.Log("复制unitylib");
|
|
121
|
-
// var from = $"{unityProj}/unityLibrary";
|
|
122
|
-
// var to = $"{publishProj}/unityLibrary";
|
|
123
|
-
// UniEditor.TryDeleteFolder(to);
|
|
124
|
-
// UniEditor.CopyFolder(from, to);
|
|
125
|
-
// }
|
|
85
|
+
WriteBeeUnionSdkConfigJson();
|
|
126
86
|
Debug.Log("处理完毕!");
|
|
127
87
|
}
|
|
128
88
|
|
|
129
|
-
|
|
130
|
-
/*修改config.java*/
|
|
131
|
-
public void WriteConfigJava()
|
|
132
|
-
|
|
89
|
+
private void WriteBeeUnionSdkConfigJson()
|
|
133
90
|
{
|
|
134
|
-
var
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/*竖屏模式为true,横屏模式为false*/
|
|
147
|
-
public static boolean ORIENTATION_PORTRAIT = {Setting.Portrait.ToString().ToLower()};
|
|
148
|
-
|
|
149
|
-
/*隐藏政策URL*/
|
|
150
|
-
public static String PRIVACY_POLICY_URL = ""{Setting.PrivacyPolicyYNoteUrl}"";
|
|
151
|
-
/*VIVO-联运 参数*/
|
|
152
|
-
public static String APP_ID = ""{Setting.AppId}"";//appid(看后台)
|
|
153
|
-
/*VIVO-广告联盟 参数*/
|
|
154
|
-
public static String MEDIA_ID = ""{Setting.MediaID}"";//Media ID
|
|
155
|
-
public static String VIDEO_UNIT_ID = ""{Setting.VideoID}""; //视频广告
|
|
156
|
-
public static String SPLASH_UNIT_ID = ""{Setting.SplashID}"";//开屏广告
|
|
157
|
-
public static String INTER_IMAGE_UNIT_ID = ""{Setting.IntersID}""; //图片类插页广告
|
|
158
|
-
public static String INTER_VIDEO_UNIT_ID = """"; //视频类插页广告
|
|
159
|
-
public static String FLOAT_ICON_UNIT_ID = ""{Setting.FloatIconID}""; //悬浮icon
|
|
160
|
-
public static String NATIVE_UNIT_ID = ""{Setting.NativeID}"";//原生广告
|
|
161
|
-
public static String BANNER_UNIT_ID = ""{Setting.BannerID}"";//banner广告
|
|
162
|
-
public static String WX_APP_ID = """";//后台申请的媒体微信APPID
|
|
163
|
-
public static int SPLASH_FETCH_TIMEOUT = 3000;//开屏广告拉取最大超时时间,单位毫秒
|
|
164
|
-
public static int SPLASH_FLOOR_PRICE=-1;//开屏广告底价,-1为不设定
|
|
165
|
-
public static int INTERS_IMAGE_FLOOR_PRICE=-1;//图片类插屏广告底价,-1为不设定
|
|
166
|
-
public static int INTERS_VIDEO_FLOOR_PRICE=-1;//视频类插屏广告底价,-1为不设定
|
|
167
|
-
|
|
168
|
-
/*友盟统计*/
|
|
169
|
-
public static String UM_APP_KEY=""{Setting.UMAppKey}"";//app-key
|
|
170
|
-
public static String UM_APP_CHANNEL=""vivo_union"";//渠道名,unknown为保留,不能使用,不管大小写
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}}
|
|
177
|
-
";
|
|
178
|
-
//写到目标路径
|
|
179
|
-
var path = GetConfigJavaPath();
|
|
180
|
-
File.WriteAllText(path, config);
|
|
181
|
-
Debug.Log($"写入:{path}");
|
|
91
|
+
var path = GetBeeUnionSdkConfigJsonPath();
|
|
92
|
+
var jsonObj = new
|
|
93
|
+
{
|
|
94
|
+
privacyUrl = $"{Setting.PrivacyPolicyYNoteUrl}",
|
|
95
|
+
orientation = Setting.Portrait ? 1 : 2,
|
|
96
|
+
appId = Setting.AppId,
|
|
97
|
+
debug = 1,
|
|
98
|
+
};
|
|
99
|
+
var json = jsonObj.ToXJson();
|
|
100
|
+
File.WriteAllText(path, json);
|
|
101
|
+
Debug.Log($"写入:{path}");
|
|
182
102
|
}
|
|
183
103
|
|
|
184
|
-
|
|
104
|
+
|
|
105
|
+
//写入build.gradle
|
|
185
106
|
public void WriteBuildGradle()
|
|
186
107
|
{
|
|
187
|
-
var gradle = $@"import java.text.SimpleDateFormat
|
|
188
|
-
|
|
189
|
-
apply plugin: 'com.android.application'
|
|
190
|
-
|
|
191
|
-
android {{
|
|
192
|
-
compileSdkVersion 30
|
|
193
|
-
buildToolsVersion '30.0.3'
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
compileOptions {{
|
|
197
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
198
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
199
|
-
}}
|
|
200
|
-
|
|
201
|
-
/*签名配置*/
|
|
202
|
-
signingConfigs {{
|
|
203
|
-
release {{
|
|
204
|
-
def signDir = rootProject.file('sign')
|
|
205
|
-
keyAlias 'xiqi'
|
|
206
|
-
keyPassword '1314woaini'
|
|
207
|
-
storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
|
|
208
|
-
storePassword '1314woaini'
|
|
209
|
-
}}
|
|
210
|
-
|
|
211
|
-
debug {{
|
|
212
|
-
def signDir = rootProject.file('sign')
|
|
213
|
-
keyAlias 'xiqi'
|
|
214
|
-
keyPassword '1314woaini'
|
|
215
|
-
storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
|
|
216
|
-
storePassword '1314woaini'
|
|
217
|
-
}}
|
|
218
|
-
}}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
defaultConfig {{
|
|
222
|
-
minSdkVersion 21
|
|
223
|
-
targetSdkVersion {Setting.TargetSdkVersion}
|
|
224
|
-
versionCode {Setting.VersionCode}
|
|
225
|
-
versionName '{Setting.Version}'
|
|
226
|
-
applicationId '{Setting.PackageName}'
|
|
227
|
-
consumerProguardFiles ""consumer-rules.pro""
|
|
228
|
-
ndk {{
|
|
229
|
-
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
|
230
|
-
}}
|
|
231
|
-
}}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
//发布的包名
|
|
235
|
-
applicationVariants.all {{ variant ->
|
|
236
|
-
variant.outputs.all {{
|
|
237
|
-
def formattedDate = new SimpleDateFormat(""yyyyMMdd_HHmmss"").format(new Date())
|
|
238
|
-
def versionName = variant.versionName
|
|
239
|
-
def buildType = variant.buildType.name
|
|
240
|
-
def appName = variant.applicationId
|
|
241
|
-
outputFileName = ""${{appName}}_v${{versionName}}_${{buildType}}_${{formattedDate}}.apk""
|
|
242
|
-
}}
|
|
243
|
-
}}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
sourceSets {{
|
|
248
|
-
main {{
|
|
249
|
-
jniLibs.srcDirs = ['libs']
|
|
250
|
-
}}
|
|
251
|
-
}}
|
|
252
|
-
|
|
253
|
-
aaptOptions {{
|
|
254
|
-
noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'aa/catalog.json', 'aa/settings.json', 'aa/AddressablesLink/link.xml', '.bundle']
|
|
255
|
-
ignoreAssetsPattern = ""!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~""
|
|
256
|
-
}}
|
|
257
|
-
|
|
258
|
-
lintOptions {{
|
|
259
|
-
abortOnError false
|
|
260
|
-
}}
|
|
261
|
-
|
|
262
|
-
buildTypes {{
|
|
263
|
-
debug {{
|
|
264
|
-
minifyEnabled false
|
|
265
|
-
useProguard false
|
|
266
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',getDefaultProguardFile('proguard-android-optimize.txt')
|
|
267
|
-
signingConfig signingConfigs.debug
|
|
268
|
-
jniDebuggable true
|
|
269
|
-
}}
|
|
270
|
-
release {{
|
|
271
|
-
minifyEnabled false
|
|
272
|
-
useProguard false
|
|
273
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',getDefaultProguardFile('proguard-android-optimize.txt')
|
|
274
|
-
signingConfig signingConfigs.release
|
|
275
|
-
|
|
276
|
-
}}
|
|
277
|
-
}}
|
|
278
|
-
|
|
279
|
-
packagingOptions {{
|
|
280
|
-
doNotStrip '*/armeabi-v7a/*.so'
|
|
281
|
-
doNotStrip '*/arm64-v8a/*.so'
|
|
282
|
-
}}
|
|
283
|
-
packagingOptions {{ doNotStrip ""*/armeabi/libvsecbox.so"" }}
|
|
284
|
-
packagingOptions {{ doNotStrip ""*/armeabi-v7a/libvsecbox.so"" }}
|
|
285
|
-
packagingOptions {{ doNotStrip ""*/arm64-v8a/libvsecbox.so"" }}
|
|
286
|
-
|
|
287
|
-
bundle {{
|
|
288
|
-
language {{
|
|
289
|
-
enableSplit = false
|
|
290
|
-
}}
|
|
291
|
-
density {{
|
|
292
|
-
enableSplit = false
|
|
293
|
-
}}
|
|
294
|
-
abi {{
|
|
295
|
-
enableSplit = true
|
|
296
|
-
}}
|
|
297
|
-
}}
|
|
298
|
-
|
|
299
|
-
}}
|
|
300
|
-
|
|
301
|
-
dependencies {{
|
|
302
|
-
api ""com.android.support:support-v4:28.0.0""
|
|
303
|
-
api ""com.android.support:recyclerview-v7:28.0.0""
|
|
304
|
-
api ""com.android.support:appcompat-v7:28.0.0""
|
|
305
|
-
api fileTree(includes: ['*.jar', '*.aar'], dir: 'libs')
|
|
306
|
-
api project(':sdk_plug')
|
|
307
|
-
api project(':unity_app')
|
|
308
|
-
api project(':umeng_support')
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}}";
|
|
313
108
|
var path = GetBuildGradle();
|
|
109
|
+
var gradle = File.ReadAllText(path);
|
|
110
|
+
//替换包名,替换版本号
|
|
111
|
+
var pattern = "versionCode[\\s]*[0-9]*";
|
|
112
|
+
gradle = Regex.Replace(gradle, pattern, $"versionCode {Setting.VersionCode}");
|
|
113
|
+
pattern = "versionName[\\s]*'[0-9\\.]*'";
|
|
114
|
+
gradle = Regex.Replace(gradle, pattern, $"versionName '{Setting.Version}'");
|
|
115
|
+
pattern = "applicationId[\\s]*\\'[\\w\\.0-9]*\\'";
|
|
116
|
+
gradle = Regex.Replace(gradle, pattern, $"applicationId '{Setting.PackageName}'");
|
|
117
|
+
pattern = "targetSdkVersion[\\s]*[0-9]*";
|
|
118
|
+
gradle = Regex.Replace(gradle, pattern, $"targetSdkVersion {Setting.TargetSdkVersion}");
|
|
314
119
|
File.WriteAllText(path, gradle);
|
|
315
120
|
Debug.Log($"写入:{path}");
|
|
316
121
|
}
|
|
@@ -319,96 +124,11 @@ dependencies {{
|
|
|
319
124
|
private void WriteAndroidManifestXml()
|
|
320
125
|
{
|
|
321
126
|
var orientation = Setting.Portrait ? "portrait" : "landscape";
|
|
322
|
-
var xml = $@"<?xml version=""1.0"" encoding=""utf-8""?>
|
|
323
|
-
<manifest xmlns:android=""http://schemas.android.com/apk/res/android""
|
|
324
|
-
package=""com.typhoon.vivo_union"">
|
|
325
|
-
<supports-screens
|
|
326
|
-
android:anyDensity=""true""
|
|
327
|
-
android:largeScreens=""true""
|
|
328
|
-
android:normalScreens=""true""
|
|
329
|
-
android:smallScreens=""true""
|
|
330
|
-
android:xlargeScreens=""true"" />
|
|
331
|
-
<!-- 联运SDK跳转游戏中心 -->
|
|
332
|
-
<uses-permission android:name=""vivo.game.permission.OPEN_JUMP_INTENTS"" /> <!-- 联运SDK监听网络状态变化,在支付登录过程中做一些异常处理 -->
|
|
333
|
-
<uses-permission android:name=""android.permission.CHANGE_NETWORK_STATE"" /> <!-- 允许程序访问Wi-Fi网络状态信息 -->
|
|
334
|
-
<uses-permission android:name=""android.permission.ACCESS_WIFI_STATE"" /> <!-- 允许程序打开网络套接字 -->
|
|
335
|
-
<uses-permission android:name=""android.permission.INTERNET"" /> <!-- 允许程序访问有关GSM网络信息 -->
|
|
336
|
-
<uses-permission android:name=""android.permission.ACCESS_NETWORK_STATE"" /> <!-- 判断游戏是否是在主进程初始化,避免初始化进程错误导致功能不可用 -->
|
|
337
|
-
<uses-permission android:name=""android.permission.GET_TASKS"" /> <!-- 获取安装权限,更新安装vivo服务安全插件apk -->
|
|
338
|
-
<uses-permission android:name=""android.permission.REQUEST_INSTALL_PACKAGES"" /> <!-- android11及以上必须添加此权限才能获取vivo服务安全插件安装包的状态 -->
|
|
339
|
-
<uses-permission android:name=""android.permission.QUERY_ALL_PACKAGES"" />
|
|
340
|
-
<!-- SDK 必须的权限 -->
|
|
341
|
-
<uses-permission android:name=""android.permission.INTERNET"" />
|
|
342
|
-
<uses-permission android:name=""android.permission.ACCESS_NETWORK_STATE"" />
|
|
343
|
-
<uses-permission android:name=""android.permission.ACCESS_WIFI_STATE"" />
|
|
344
|
-
<uses-permission android:name=""android.permission.READ_PHONE_STATE"" />
|
|
345
|
-
<uses-permission android:name=""android.permission.WRITE_EXTERNAL_STORAGE"" />
|
|
346
|
-
<!-- 此权限一定要加,否则下载类广告不会进入安装流程,影响后向体验 -->
|
|
347
|
-
<uses-permission android:name=""android.permission.REQUEST_INSTALL_PACKAGES"" />
|
|
348
|
-
<!-- 如果接入了视频相关的广告, 请务必添加否则黑屏 -->
|
|
349
|
-
<uses-permission android:name=""android.permission.WAKE_LOCK"" />
|
|
350
|
-
<uses-permission android:name=""android.permission.MANAGE_EXTERNAL_STORAGE"" />
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<application
|
|
354
|
-
android:name="".App""
|
|
355
|
-
android:icon=""@mipmap/app_icon""
|
|
356
|
-
android:label=""@string/app_name""
|
|
357
|
-
android:hardwareAccelerated=""true""
|
|
358
|
-
>
|
|
359
|
-
|
|
360
|
-
<activity
|
|
361
|
-
android:name="".LauncherActivity""
|
|
362
|
-
android:exported=""true""
|
|
363
|
-
android:configChanges=""orientation|keyboardHidden|screenSize""
|
|
364
|
-
android:theme=""@android:style/Theme.Translucent.NoTitleBar""
|
|
365
|
-
>
|
|
366
|
-
<intent-filter>
|
|
367
|
-
<action android:name=""android.intent.action.MAIN"" />
|
|
368
|
-
<category android:name=""android.intent.category.LAUNCHER"" />
|
|
369
|
-
<!--友盟埋点验证,实时查看可开启-->
|
|
370
|
-
<!-- <action android:name=""android.intent.action.VIEW"" />-->
|
|
371
|
-
<!-- <category android:name=""android.intent.category.DEFAULT"" />-->
|
|
372
|
-
<!-- <category android:name=""android.intent.category.BROWSABLE"" />-->
|
|
373
|
-
<!-- <data android:scheme=""um.5fe03633345b8b53f5745d30"" />-->
|
|
374
|
-
</intent-filter>
|
|
375
|
-
</activity>
|
|
376
|
-
|
|
377
|
-
<meta-data
|
|
378
|
-
android:name=""vivo_union_sdk""
|
|
379
|
-
android:value=""4.7.4.1"" /> <!-- vivo sdk componets start -->
|
|
380
|
-
<!-- vivo sdk的Activity -->
|
|
381
|
-
<activity
|
|
382
|
-
android:name=""com.vivo.unionsdk.ui.UnionActivity""
|
|
383
|
-
android:configChanges=""orientation|keyboardHidden|navigation|screenSize""
|
|
384
|
-
android:exported=""true""
|
|
385
|
-
android:screenOrientation=""{orientation}""
|
|
386
|
-
android:theme=""@android:style/Theme.Dialog"">
|
|
387
|
-
<intent-filter>
|
|
388
|
-
<action android:name=""android.intent.action.VIEW"" />
|
|
389
|
-
|
|
390
|
-
<category android:name=""android.intent.category.DEFAULT"" />
|
|
391
|
-
<category android:name=""android.intent.category.BROWSABLE"" />
|
|
392
|
-
|
|
393
|
-
<data
|
|
394
|
-
android:host=""union.vivo.com""
|
|
395
|
-
android:path=""/openjump""
|
|
396
|
-
android:scheme=""vivounion"" />
|
|
397
|
-
</intent-filter>
|
|
398
|
-
</activity>
|
|
399
|
-
|
|
400
|
-
<activity
|
|
401
|
-
android:name="".SplashAdActivity""
|
|
402
|
-
android:hardwareAccelerated=""true""
|
|
403
|
-
android:exported=""false""
|
|
404
|
-
android:launchMode=""singleTask""
|
|
405
|
-
android:configChanges=""orientation|keyboardHidden|navigation|screenSize""
|
|
406
|
-
android:theme=""@android:style/Theme.Translucent.NoTitleBar"" />
|
|
407
|
-
</application>
|
|
408
|
-
|
|
409
|
-
</manifest>";
|
|
410
|
-
|
|
411
127
|
var path = GetAndroidManifestXml();
|
|
128
|
+
var xml = File.ReadAllText(path);
|
|
129
|
+
var pattern = "<meta-data[\\s]*android:name=\"vivoUnionAppId\"[\\s]*.*/>";
|
|
130
|
+
xml = Regex.Replace(xml, pattern,
|
|
131
|
+
$"<meta-data android:name=\"vivoUnionAppId\" android:value=\"{Setting.AppId}\"/>");
|
|
412
132
|
File.WriteAllText(path, xml);
|
|
413
133
|
Debug.Log($"写入:{path}");
|
|
414
134
|
}
|
|
@@ -444,55 +164,34 @@ dependencies {{
|
|
|
444
164
|
private void WriteStringsXml()
|
|
445
165
|
{
|
|
446
166
|
var path = GetStringsXml();
|
|
447
|
-
var xml =
|
|
448
|
-
<
|
|
449
|
-
|
|
450
|
-
<string name=""game_view_content_description"">Game view</string>
|
|
451
|
-
</resources>";
|
|
167
|
+
var xml = File.ReadAllText(path);
|
|
168
|
+
var pattern = "<string[\\s]*name=\"app_name\">.*</string>";
|
|
169
|
+
xml = Regex.Replace(xml, pattern, $"<string name=\"app_name\">{Setting.GameName}</string>");
|
|
452
170
|
File.WriteAllText(path, xml);
|
|
453
171
|
Debug.Log($"写入:{path}");
|
|
454
172
|
}
|
|
455
173
|
|
|
456
|
-
|
|
457
|
-
private void
|
|
174
|
+
//写入unityLibrary-release.aar
|
|
175
|
+
private void WriteUnityLibraryAAR()
|
|
458
176
|
{
|
|
459
|
-
var android = GetUnityLibrary();
|
|
460
177
|
var unityProj = GetMatchChinaAndroidProj();
|
|
461
178
|
if (unityProj == null)
|
|
462
179
|
{
|
|
463
180
|
throw new Exception($"找不到unity导出工程");
|
|
464
181
|
}
|
|
465
182
|
|
|
466
|
-
|
|
467
|
-
var
|
|
468
|
-
{
|
|
469
|
-
//{unityProj}\unityLibrary
|
|
470
|
-
($"{android}/libs", $"{unityLib}/libs"),
|
|
471
|
-
($"{android}/src/main/assets", $"{unityLib}/src/main/assets"),
|
|
472
|
-
($"{android}/src/main/java", $"{unityLib}/src/main/java"),
|
|
473
|
-
($"{android}/src/main/jniLibs", $"{unityLib}/src/main/jniLibs"),
|
|
474
|
-
};
|
|
183
|
+
//尝试获取unitylibrary.aar
|
|
184
|
+
var aar = $"{unityProj}/unityLibrary/build/outputs/aar/unityLibrary-release.aar";
|
|
475
185
|
|
|
476
|
-
|
|
477
|
-
var xmlUnity = $"{unityLib}/src/main/AndroidManifest.xml";
|
|
478
|
-
foreach (var e in map)
|
|
186
|
+
if (!File.Exists(aar))
|
|
479
187
|
{
|
|
480
|
-
|
|
481
|
-
UniEditor.CopyFolder(e.unityPath, e.androidPath);
|
|
482
|
-
Debug.Log($"写入:{e.androidPath} ");
|
|
188
|
+
throw new Exception($"找不到{aar}");
|
|
483
189
|
}
|
|
484
190
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
var xml = File.ReadAllText(xmlPath);
|
|
490
|
-
xml = xml.Replace("<intent-filter>", "");
|
|
491
|
-
xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
|
|
492
|
-
xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
|
|
493
|
-
xml = xml.Replace("</intent-filter>", "");
|
|
494
|
-
File.WriteAllText(xmlPath, xml);
|
|
495
|
-
Debug.Log($"写入:{xmlPath}");
|
|
191
|
+
//复制aar到指定目录
|
|
192
|
+
var to = @$"{Setting.AndroidPublishProj}\proj\unionsdk\libs\{Path.GetFileName(aar)}";
|
|
193
|
+
Debug.Log($"复制{aar}->{to}");
|
|
194
|
+
File.Copy(aar, to, true);
|
|
496
195
|
}
|
|
497
196
|
|
|
498
197
|
/*写入icon*/
|
package/Runtime/BaseSdk.cs
CHANGED
|
@@ -265,5 +265,20 @@ namespace TyphoonUnitySDK
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
#endregion
|
|
268
|
+
|
|
269
|
+
#region 退出挽留
|
|
270
|
+
|
|
271
|
+
public virtual bool IsSupportQuitWithKeep()
|
|
272
|
+
{
|
|
273
|
+
SdkDebug.Log($"[BaseSdk] IsSupportQuitWithKeep 默认不支持,返回false!");
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
public virtual void QuitWithKeep()
|
|
278
|
+
{
|
|
279
|
+
SdkDebug.Log($"[BaseSdk] QuitWithKeep 空实现!");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
#endregion
|
|
268
283
|
}
|
|
269
284
|
}
|
package/Runtime/Interface.cs
CHANGED
|
@@ -7,7 +7,7 @@ namespace TyphoonUnitySDK
|
|
|
7
7
|
/// SDK全功能接口
|
|
8
8
|
/// </summary>
|
|
9
9
|
public interface ISdk : IOnCreate, IInitSdk, ILogin, IExitGame, IBannerAD, IVideoAD, IIntersAD, IFloatIconAD,
|
|
10
|
-
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast,ITrack
|
|
10
|
+
INativeAD, IRecordGame, IHttpGet, IHttpPost, ISideBarReturn, IShowToast, ITrack,IQuitGameWithKeep
|
|
11
11
|
{
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -211,4 +211,18 @@ namespace TyphoonUnitySDK
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
#endregion
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
#region 退出挽留
|
|
217
|
+
|
|
218
|
+
public interface IQuitGameWithKeep
|
|
219
|
+
{
|
|
220
|
+
//是否支持
|
|
221
|
+
bool IsSupportQuitWithKeep();
|
|
222
|
+
|
|
223
|
+
//退出游戏
|
|
224
|
+
void QuitWithKeep();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
#endregion
|
|
214
228
|
}
|
package/Runtime/SdkLite.cs
CHANGED
|
@@ -219,7 +219,7 @@ namespace TyphoonUnitySDK
|
|
|
219
219
|
public bool IsSupportExitGame()
|
|
220
220
|
{
|
|
221
221
|
#if UNITY_EDITOR
|
|
222
|
-
return SdkTestInUnity.Instance.
|
|
222
|
+
return SdkTestInUnity.Instance.IsSupportQuitWithKeep;
|
|
223
223
|
#endif
|
|
224
224
|
return _sdk.IsSupportExitGame();
|
|
225
225
|
}
|
|
@@ -241,6 +241,33 @@ namespace TyphoonUnitySDK
|
|
|
241
241
|
|
|
242
242
|
#endregion
|
|
243
243
|
|
|
244
|
+
#region 退出挽留
|
|
245
|
+
|
|
246
|
+
/// <summary>
|
|
247
|
+
/// 是否支持退出挽留
|
|
248
|
+
/// </summary>
|
|
249
|
+
public bool IsSupportQuitWithKeep()
|
|
250
|
+
{
|
|
251
|
+
#if UNITY_EDITOR
|
|
252
|
+
return SdkTestInUnity.Instance.IsSupportQuitWithKeep;
|
|
253
|
+
#endif
|
|
254
|
+
return _sdk.IsSupportQuitWithKeep();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/// <summary>
|
|
258
|
+
/// 退出挽留
|
|
259
|
+
/// </summary>
|
|
260
|
+
public void QuitWithKeep()
|
|
261
|
+
{
|
|
262
|
+
Log("QuitWithKeep");
|
|
263
|
+
#if UNITY_EDITOR
|
|
264
|
+
return;
|
|
265
|
+
#endif
|
|
266
|
+
_sdk.QuitWithKeep();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
#endregion
|
|
270
|
+
|
|
244
271
|
#region 日志
|
|
245
272
|
|
|
246
273
|
private void Log(string log)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using System.IO;
|
|
2
2
|
using TyphoonUnitySDK;
|
|
3
3
|
using UnityEngine;
|
|
4
|
+
using UnityEngine.Serialization;
|
|
4
5
|
#if UNITY_EDITOR
|
|
5
6
|
using UnityEditor;
|
|
6
7
|
#endif
|
|
@@ -10,7 +11,7 @@ public class SdkTestInUnity : ScriptableObject
|
|
|
10
11
|
private const string ASSET_PATH = "Assets/Typhoon_Gen/TyphoonSDK/Editor/SdkTestInUnity.asset";
|
|
11
12
|
|
|
12
13
|
[LabelOverride("登录回调")] public bool LoginResult = true;
|
|
13
|
-
[LabelOverride("
|
|
14
|
+
[LabelOverride("是否支持退出挽留")] public bool IsSupportQuitWithKeep = true;
|
|
14
15
|
[LabelOverride("开启广告交互式测试")] public bool OpenInteractive = true;
|
|
15
16
|
[LabelOverride("广告交互式悬停关闭时间")] public float InteractiveHoldCloseTime = 1.2f;
|
|
16
17
|
[LabelOverride("视频广告flag")] public bool GetVideoFlagResult = true;
|
|
@@ -41,9 +41,9 @@ namespace TyphoonUnitySDK
|
|
|
41
41
|
case AppChannel.ChinaAndroid:
|
|
42
42
|
if (Input.GetKeyDown(KeyCode.Escape))
|
|
43
43
|
{
|
|
44
|
-
if (SdkLite.Instance.
|
|
44
|
+
if (SdkLite.Instance.IsSupportQuitWithKeep())
|
|
45
45
|
{
|
|
46
|
-
SdkLite.Instance.
|
|
46
|
+
SdkLite.Instance.QuitWithKeep();
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
Binary file
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
Assets/Plugins/Android/libs/sdk_plug-release.aar
|
|
2
|
-
Assets/Plugins/Android/libs/unity_app-release.aar
|
|
3
|
-
Assets/Plugins/Android/libs/unity_launcher-release.aar
|
|
4
1
|
Assets/Plugins/Android/AndroidManifest.xml
|
|
5
2
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid
|
|
6
3
|
Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.
|
|
1
|
+
{"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.94","description":"","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"version_log":"## [1.0.94] - 2024-01-25\r\n\r\n### 新增\n* 更新vivo app sdk\r\n\r\n","major_flag":false,"write_time_stamp":1706194439000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
|