com.typhoon.unitysdk 1.0.7 → 1.0.9

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.
@@ -1,8 +1,8 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
  using UnityEditor;
4
- using UnityEditor.AddressableAssets.Build;
5
4
  #if TYPHOON_ADDRESSABLE
5
+ using UnityEditor.AddressableAssets.Build;
6
6
  using UnityEditor.AddressableAssets;
7
7
  using UnityEditor.AddressableAssets.Settings;
8
8
  using UnityEngine;
@@ -27,7 +27,11 @@ namespace TyphoonUnitySDK
27
27
  public string FloatIconID;
28
28
  public string NativeID;
29
29
  public string BannerID;
30
-
30
+
31
+ [Header("友盟")]
32
+ public string UMAppKey;
33
+
34
+
31
35
  [Header("版本号")] public string Version = "1.0.0.0";
32
36
  public int VersionCode = 1000000;
33
37
  private static string PATH = "Assets/Editor/PublishVivoBatSetting.asset";
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: d420ea4990245a64bb058105d44f2664
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: d420ea4990245a64bb058105d44f2664
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -12,302 +12,477 @@ namespace TyphoonUnitySDK
12
12
  [CustomEditor(typeof(PublishVivoBatSetting))]
13
13
  public class PublishVivoBatSettingInspector : Editor
14
14
  {
15
- public static string build_garde_template = @"import java.text.SimpleDateFormat
15
+ public PublishVivoBatSetting Setting => target as PublishVivoBatSetting;
16
+
17
+ /*Config.java*/
18
+ public string GetConfigJavaPath()
19
+ {
20
+ return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\java\com\typhoon\vivo_union\Config.java";
21
+ }
22
+
23
+ /*build gradle*/
24
+ public string GetBuildGradle()
25
+ {
26
+ return $@"{Setting.AndroidPublishProj}\vivo_union\build.gradle";
27
+ }
28
+
29
+ /*AndroidManifest.xml*/
30
+ public string GetAndroidManifestXml()
31
+ {
32
+ return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\AndroidManifest.xml";
33
+ }
34
+
35
+ /*supplierconfig.json*/
36
+ public string GetSupplierConfigJson()
37
+ {
38
+ return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\assets\supplierconfig.json";
39
+ }
40
+
41
+
42
+ /*strings.xml*/
43
+ public string GetStringsXml()
44
+ {
45
+ return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\res\values\strings.xml";
46
+ }
47
+
48
+
49
+ /*unitylibrary*/
50
+ public string GetUnityLibrary()
51
+ {
52
+ return $@"{Setting.AndroidPublishProj}\unityLibrary";
53
+ }
54
+
55
+ /*unitylibrary AndroidManifest.xml*/
56
+ public string GetUnityLibraryAndroidManifestXml()
57
+ {
58
+ return $@"{Setting.AndroidPublishProj}\unityLibrary\src\main\AndroidManifest.xml";
59
+ }
60
+
61
+
62
+ /*icon*/
63
+ public string GetIconPath()
64
+ {
65
+ return $@"{Setting.AndroidPublishProj}\vivo_union\src\main\res\mipmap-mdpi\app_icon.png";
66
+ }
67
+
68
+
69
+ public PublishVivoBatSetting Target => target as PublishVivoBatSetting;
70
+
71
+ public override void OnInspectorGUI()
72
+ {
73
+ base.OnInspectorGUI();
74
+ // if (GUILayout.Button("自动版本号", GUILayout.Height(32)))
75
+ // {
76
+ // Target.Version = AutoVersionSting(Target.Version);
77
+ // Target.Save();
78
+ // }
79
+
80
+ var publish = GUILayout.Button("发布vivo", GUILayout.Height(32));
81
+
82
+ if (publish)
83
+ {
84
+ var sure = EditorUtility.DisplayDialog("提示", "发布?", "是");
85
+ if (sure)
86
+ {
87
+ Publish(Target);
88
+ }
89
+ }
90
+ }
91
+
92
+ public void Publish(PublishVivoBatSetting setting)
93
+ {
94
+ if (!Directory.Exists(setting.AndroidPublishProj))
95
+ {
96
+ throw new Exception($"找不到{setting.AndroidPublishProj}");
97
+ }
98
+
99
+ WriteUnityLibrary();
100
+ WriteIcon();
101
+ WriteBuildGradle();
102
+ WriteStringsXml();
103
+ WriteConfigJava();
104
+ WriteAndroidManifestXml();
105
+ WriteSupplierConfigJson();
106
+
107
+ // {
108
+ // Debug.Log("修改unity manifest");
109
+ //
110
+ // var manifest = $"{unityProj}/unityLibrary/src/main/AndroidManifest.xml";
111
+ // var xml = File.ReadAllText(manifest);
112
+ // // string pattern = @"(?s)<intent-filter\b[^>]*>(.*?)<\/intent-filter>";
113
+ // // string result = Regex.Replace(xml, pattern, "");f
114
+ // xml = xml.Replace("<intent-filter>", "");
115
+ // xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
116
+ // xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
117
+ // xml = xml.Replace("</intent-filter>", "");
118
+ // File.WriteAllText(manifest, xml);
119
+ //
120
+ // //复制unitylib
121
+ // Debug.Log("复制unitylib");
122
+ // var from = $"{unityProj}/unityLibrary";
123
+ // var to = $"{publishProj}/unityLibrary";
124
+ // UniEditor.TryDeleteFolder(to);
125
+ // UniEditor.CopyFolder(from, to);
126
+ // }
127
+ Debug.Log("处理完毕!");
128
+ }
129
+
130
+
131
+ /*修改config.java*/
132
+ public void WriteConfigJava()
133
+ {
134
+ var config =
135
+ $@"package com.typhoon.vivo_union;
136
+
137
+ /*打包配置*/
138
+ public class Config {{
139
+
140
+ /*启动进入demo测试页/游戏场景*/
141
+ public static boolean LAUNCHER_DEMO=false;
142
+
143
+ /*Debug 模式开关*/
144
+ public static boolean DEBUG_MODE = {Setting.DebugMode.ToString().ToLower()};
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}");
182
+ }
183
+
184
+ /*写入build.gradle*/
185
+ public void WriteBuildGradle()
186
+ {
187
+ var gradle = $@"import java.text.SimpleDateFormat
16
188
 
17
189
  apply plugin: 'com.android.application'
18
190
 
19
- android {
191
+ android {{
20
192
  compileSdkVersion 30
21
193
  buildToolsVersion '30.0.3'
22
194
 
23
195
 
24
- compileOptions {
196
+ compileOptions {{
25
197
  sourceCompatibility JavaVersion.VERSION_1_8
26
198
  targetCompatibility JavaVersion.VERSION_1_8
27
- }
199
+ }}
28
200
 
29
201
  /*签名配置*/
30
- signingConfigs {
31
- release {
202
+ signingConfigs {{
203
+ release {{
32
204
  def signDir = rootProject.file('sign')
33
205
  keyAlias 'xiqi'
34
206
  keyPassword '1314woaini'
35
207
  storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
36
208
  storePassword '1314woaini'
37
- }
209
+ }}
38
210
 
39
- debug {
211
+ debug {{
40
212
  def signDir = rootProject.file('sign')
41
213
  keyAlias 'xiqi'
42
214
  keyPassword '1314woaini'
43
215
  storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
44
216
  storePassword '1314woaini'
45
- }
46
- }
217
+ }}
218
+ }}
47
219
 
48
220
 
49
- defaultConfig {
221
+ defaultConfig {{
50
222
  minSdkVersion 21
51
223
  targetSdkVersion 30
52
- versionCode $VERSION_CODE
53
- versionName '$VERSION_NAME'
54
- applicationId '$APPLICATION_ID'
224
+ versionCode {Setting.VersionCode}
225
+ versionName '{Setting.Version}'
226
+ applicationId '{Setting.PackageName}'
55
227
  consumerProguardFiles ""consumer-rules.pro""
56
- ndk {
228
+ ndk {{
57
229
  abiFilters 'armeabi-v7a', 'arm64-v8a'
58
- }
59
- }
230
+ }}
231
+ }}
60
232
 
61
233
 
62
234
  //发布的包名
63
- applicationVariants.all { variant ->
64
- variant.outputs.all {
235
+ applicationVariants.all {{ variant ->
236
+ variant.outputs.all {{
65
237
  def formattedDate = new SimpleDateFormat(""yyyyMMdd_HHmmss"").format(new Date())
66
238
  def versionName = variant.versionName
67
239
  def buildType = variant.buildType.name
68
240
  def appName = variant.applicationId
69
- outputFileName = ""${appName}_v${versionName}_${buildType}_${formattedDate}.apk""
70
- }
71
- }
241
+ outputFileName = ""${{appName}}_v${{versionName}}_${{buildType}}_${{formattedDate}}.apk""
242
+ }}
243
+ }}
72
244
 
73
245
 
74
246
 
75
- sourceSets {
76
- main {
247
+ sourceSets {{
248
+ main {{
77
249
  jniLibs.srcDirs = ['libs']
78
- }
79
- }
250
+ }}
251
+ }}
80
252
 
81
- aaptOptions {
253
+ aaptOptions {{
82
254
  noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'aa/catalog.json', 'aa/settings.json', 'aa/AddressablesLink/link.xml', '.bundle']
83
255
  ignoreAssetsPattern = ""!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~""
84
- }
256
+ }}
85
257
 
86
- lintOptions {
258
+ lintOptions {{
87
259
  abortOnError false
88
- }
260
+ }}
89
261
 
90
- buildTypes {
91
- debug {
262
+ buildTypes {{
263
+ debug {{
92
264
  minifyEnabled false
93
265
  useProguard false
94
266
  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',getDefaultProguardFile('proguard-android-optimize.txt')
95
267
  signingConfig signingConfigs.debug
96
268
  jniDebuggable true
97
- }
98
- release {
269
+ }}
270
+ release {{
99
271
  minifyEnabled false
100
272
  useProguard false
101
273
  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',getDefaultProguardFile('proguard-android-optimize.txt')
102
274
  signingConfig signingConfigs.release
103
275
 
104
- }
105
- }
276
+ }}
277
+ }}
106
278
 
107
- packagingOptions {
279
+ packagingOptions {{
108
280
  doNotStrip '*/armeabi-v7a/*.so'
109
281
  doNotStrip '*/arm64-v8a/*.so'
110
- }
111
- packagingOptions { doNotStrip ""*/armeabi/libvsecbox.so"" }
112
- packagingOptions { doNotStrip ""*/armeabi-v7a/libvsecbox.so"" }
113
- packagingOptions { doNotStrip ""*/arm64-v8a/libvsecbox.so"" }
282
+ }}
283
+ packagingOptions {{ doNotStrip ""*/armeabi/libvsecbox.so"" }}
284
+ packagingOptions {{ doNotStrip ""*/armeabi-v7a/libvsecbox.so"" }}
285
+ packagingOptions {{ doNotStrip ""*/arm64-v8a/libvsecbox.so"" }}
114
286
 
115
- bundle {
116
- language {
287
+ bundle {{
288
+ language {{
117
289
  enableSplit = false
118
- }
119
- density {
290
+ }}
291
+ density {{
120
292
  enableSplit = false
121
- }
122
- abi {
293
+ }}
294
+ abi {{
123
295
  enableSplit = true
124
- }
125
- }
296
+ }}
297
+ }}
126
298
 
127
- }
299
+ }}
128
300
 
129
- dependencies {
301
+ dependencies {{
130
302
  api ""com.android.support:support-v4:28.0.0""
131
303
  api ""com.android.support:recyclerview-v7:28.0.0""
132
304
  api ""com.android.support:appcompat-v7:28.0.0""
133
305
  api fileTree(includes: ['*.jar', '*.aar'], dir: 'libs')
134
306
  api project(':sdk_plug')
135
307
  api project(':unity_app')
308
+ api project(':umeng_support')
136
309
 
137
310
 
138
311
 
139
- }";
140
-
141
- public PublishVivoBatSetting Target => target as PublishVivoBatSetting;
312
+ }}";
313
+ var path = GetBuildGradle();
314
+ File.WriteAllText(path, gradle);
315
+ Debug.Log($"写入:{path}");
316
+ }
142
317
 
143
- public override void OnInspectorGUI()
318
+ /*写入AndroidManifest.xml*/
319
+ private void WriteAndroidManifestXml()
144
320
  {
145
- base.OnInspectorGUI();
146
- // if (GUILayout.Button("自动版本号", GUILayout.Height(32)))
147
- // {
148
- // Target.Version = AutoVersionSting(Target.Version);
149
- // Target.Save();
150
- // }
151
-
152
- var publish = GUILayout.Button("发布vivo", GUILayout.Height(32));
153
-
154
- if (publish)
155
- {
156
- var sure = EditorUtility.DisplayDialog("提示", "发布?", "是");
157
- if (sure)
158
- {
159
- Publish(Target);
160
- }
161
- }
321
+ 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
+ var path = GetAndroidManifestXml();
412
+ File.WriteAllText(path, xml);
413
+ Debug.Log($"写入:{path}");
162
414
  }
163
415
 
164
- public static string AutoVersionSting(string version)
416
+ /*写入supplierconfig.json*/
417
+ private void WriteSupplierConfigJson()
165
418
  {
166
- if (string.IsNullOrEmpty(version))
167
- {
168
- return "1.0.0";
169
- }
419
+ var json = $@"{{
420
+ ""supplier"":{{
421
+ ""vivo"":{{
422
+ ""appid"":""{Setting.AppId}""
423
+ }},
424
+ ""xiaomi"":{{
170
425
 
171
- var strs = version.Split('.');
172
- try
173
- {
174
- var current = int.Parse(strs.Last());
175
- current += 1;
176
- var sb = new StringBuilder();
177
- for (int i = 0; i < strs.Length - 1; i++)
178
- {
179
- if (i != 0)
180
- {
181
- sb.Append(".");
182
- }
426
+ }},
427
+ ""huawei"":{{
183
428
 
184
- sb.Append(strs[i]);
185
- }
429
+ }},
430
+ ""oppo"":{{
186
431
 
187
- sb.Append($".{current}");
188
- return sb.ToString();
189
- }
190
- catch (Exception e)
191
- {
192
- Debug.LogError("无法识别版本号格式");
193
- }
432
+ }}
433
+ }}
194
434
 
195
- return version;
196
- }
435
+ }}
436
+ ";
197
437
 
438
+ var path = GetSupplierConfigJson();
439
+ File.WriteAllText(path, json);
440
+ Debug.Log($"写入:{path}");
441
+ }
198
442
 
199
- public static void Publish(PublishVivoBatSetting setting)
443
+ /*写入strings.xml*/
444
+ private void WriteStringsXml()
200
445
  {
201
- if (!Directory.Exists(setting.AndroidPublishProj))
202
- {
203
- throw new Exception($"找不到{setting.AndroidPublishProj}");
204
- }
446
+ var path = GetStringsXml();
447
+ var xml = $@"<?xml version=""1.0"" encoding=""utf-8""?>
448
+ <resources>
449
+ <string name=""app_name"">{Setting.GameName}</string>
450
+ <string name=""game_view_content_description"">Game view</string>
451
+ </resources>";
452
+ File.WriteAllText(path, xml);
453
+ Debug.Log($"写入:{path}");
454
+ }
205
455
 
456
+ /*写入untiylibrary.xml*/
457
+ private void WriteUnityLibrary()
458
+ {
459
+ var path = GetUnityLibrary();
206
460
  var unityProj = GetMatchChinaAndroidProj();
207
461
  if (unityProj == null)
208
462
  {
209
463
  throw new Exception($"找不到unity导出工程");
210
464
  }
465
+ UniEditor.TryDeleteFolder(path);
466
+ UniEditor.CopyFolder($@"{unityProj}\unityLibrary", path);
467
+ Debug.Log($"写入:{path} ");
468
+
469
+ var xmlPath = GetUnityLibraryAndroidManifestXml();
470
+ var xml = File.ReadAllText(xmlPath);
471
+ xml = xml.Replace("<intent-filter>", "");
472
+ xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
473
+ xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
474
+ xml = xml.Replace("</intent-filter>", "");
475
+ File.WriteAllText(xmlPath, xml);
476
+ Debug.Log($"写入:{xmlPath}");
477
+ }
211
478
 
212
- //修改游戏名
213
- Debug.Log("修改游戏名");
214
- var publishProj = setting.AndroidPublishProj;
215
- {
216
- //
217
-
218
- var strings_xml = $@"{publishProj}\vivo_union\src\main\res\values\strings.xml";
219
- var input =
220
- $"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <string name=\"app_name\">{setting.GameName}</string>\n <string name=\"game_view_content_description\">Game view</string>\n</resources>";
221
- File.WriteAllText(strings_xml, input);
222
- }
223
- {
224
- //复制icon
225
- Debug.Log("更换icon");
226
- var iconPath = AssetDatabase.GetAssetPath(setting.Icon);
227
- File.Copy(iconPath,
228
- $@"{publishProj}\vivo_union\src\main\res\mipmap-mdpi\app_icon.png", true);
229
- }
230
-
231
-
232
- {
233
- Debug.Log("更换包名等信息");
234
- var build_gardle = $"{publishProj}/vivo_union/build.gradle";
235
- var code = build_garde_template;
236
-
237
- code = code.Replace("$APPLICATION_ID", setting.PackageName);
238
- code = code.Replace("$VERSION_CODE", setting.VersionCode.ToString());
239
- code = code.Replace("$VERSION_NAME", setting.Version);
240
- File.WriteAllText(build_gardle, code);
241
- }
242
-
243
- {
244
- Debug.Log("更换AppId");
245
- var supplierconfig = $"{publishProj}/vivo_union/src/main/assets/supplierconfig.json";
246
- var input =
247
- $"{{\n \"supplier\":{{\n \"vivo\":{{\n \"appid\":\"{setting.AppId}\"\n }},\n \"xiaomi\":{{\n\n }},\n \"huawei\":{{\n\n }},\n \"oppo\":{{\n\n }}\n }}\n\n}}\n";
248
- File.WriteAllText(supplierconfig, input);
249
- }
250
-
251
- {
252
- Debug.Log("更换代码参数");
253
- var config = $@"{publishProj}\vivo_union\src\main\java\com\typhoon\vivo_union\Config.java";
254
- var debugMode = setting.DebugMode ? "true" : "false";
255
- var orientation = setting.Portrait ? "true" : "false";
256
- var input =
257
- $@"package com.typhoon.vivo_union;
258
-
259
- /*打包配置*/
260
- public class Config {{
261
- /*Debug 模式开关*/
262
- public static boolean DEBUG_MODE = {debugMode};
263
-
264
- /*竖屏模式为true,横屏模式为false*/
265
- public static boolean ORIENTATION_PORTRAIT = {orientation};
266
-
267
- /*隐藏政策URL*/
268
- public static String PRIVACY_POLICY_URL = ""{setting.PrivacyPolicyYNoteUrl}"";
269
- /*VIVO-联运 参数*/
270
- public static String APP_ID = ""{setting.AppId}"";//appid(看后台)
271
- /*VIVO-广告联盟 参数*/
272
- public static String MEDIA_ID = ""{setting.MediaID}"";//Media ID
273
- public static String VIDEO_UNIT_ID = ""{setting.VideoID}""; //视频广告
274
- public static String SPLASH_UNIT_ID = ""{setting.SplashID}"";//开屏广告
275
- public static String INTER_IMAGE_UNIT_ID = ""{setting.IntersID}""; //图片类插页广告
276
- public static String INTER_VIDEO_UNIT_ID = """"; //视频类插页广告
277
- public static String FLOAT_ICON_UNIT_ID = ""{setting.FloatIconID}""; //悬浮icon
278
- public static String NATIVE_UNIT_ID = ""{setting.NativeID}"";//原生广告
279
- public static String BANNER_UNIT_ID = ""{setting.BannerID}"";//banner广告
280
- public static String WX_APP_ID = """";//后台申请的媒体微信APPID
281
- public static int SPLASH_FETCH_TIMEOUT = 3000;//开屏广告拉取最大超时时间,单位毫秒
282
- public static int SPLASH_FLOOR_PRICE=-1;//开屏广告底价,-1为不设定
283
- public static int INTERS_IMAGE_FLOOR_PRICE=-1;//图片类插屏广告底价,-1为不设定
284
- public static int INTERS_VIDEO_FLOOR_PRICE=-1;//视频类插屏广告底价,-1为不设定
285
-
286
- }}
287
- ";
288
- File.WriteAllText(config, input);
289
- }
290
- {
291
- Debug.Log("修改unity manifest");
292
-
293
- var manifest = $"{unityProj}/unityLibrary/src/main/AndroidManifest.xml";
294
- var xml = File.ReadAllText(manifest);
295
- // string pattern = @"(?s)<intent-filter\b[^>]*>(.*?)<\/intent-filter>";
296
- // string result = Regex.Replace(xml, pattern, "");f
297
- xml = xml.Replace("<intent-filter>", "");
298
- xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
299
- xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
300
- xml = xml.Replace("</intent-filter>", "");
301
- File.WriteAllText(manifest, xml);
302
-
303
- //复制unitylib
304
- Debug.Log("复制unitylib");
305
- var from = $"{unityProj}/unityLibrary";
306
- var to = $"{publishProj}/unityLibrary";
307
- UniEditor.TryDeleteFolder(to);
308
- UniEditor.CopyFolder(from, to);
309
- }
310
- Debug.Log("处理完毕!");
479
+ /*写入icon*/
480
+ private void WriteIcon()
481
+ {
482
+ var path = GetIconPath();
483
+ var iconPath = AssetDatabase.GetAssetPath(Setting.Icon);
484
+ File.Copy(iconPath, path, true);
485
+ Debug.Log($"写入:{path}");
311
486
  }
312
487
 
313
488
 
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 2ced1019463ecff4c86da9f5170d4392
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 2ced1019463ecff4c86da9f5170d4392
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -5,7 +5,7 @@ namespace TyphoonUnitySDK
5
5
  {
6
6
  public class PublishVivoBatSettingWindow : StyleEditorWindow
7
7
  {
8
- [MenuItem("临时发布vivo/发布", priority = 10000)]
8
+ [MenuItem("临时发布/发布vivo", priority = 10000)]
9
9
  public static void Open()
10
10
  {
11
11
  var win = GetWindow<PublishVivoBatSettingWindow>();
@@ -50,11 +50,8 @@ namespace TyphoonUnitySDK
50
50
  rectSave.height = 32;
51
51
  rectSave.x = area.width - rectSave.width;
52
52
  rectSave.x -= 4;
53
- rectSave.y += 10;
54
-
55
-
53
+ GUILayout.Space(36);
56
54
  Editor.OnInspectorGUI();
57
-
58
55
  if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save), Styles.rbutton_green))
59
56
  {
60
57
  EditorUtility.SetDirty(PublishVivoBatSetting.Default);
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: de86258d70e00c74baf389df00c998ef
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: de86258d70e00c74baf389df00c998ef
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.7","description":"unity端个汇总渠道的sdk,统一接口,一键发布","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"}],"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
1
+ {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.9","description":"unity端个汇总渠道的sdk,统一接口,一键发布","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"}],"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
Binary file
@@ -1,21 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: cc71c8df38c4cbc488bf89567ae58dc9
3
- TrueTypeFontImporter:
4
- externalObjects: {}
5
- serializedVersion: 4
6
- fontSize: 16
7
- forceTextureCase: -2
8
- characterSpacing: 0
9
- characterPadding: 1
10
- includeFontData: 1
11
- fontNames:
12
- - ZiZhiQuXiMaiTi
13
- fallbackFontReferences: []
14
- customCharacters:
15
- fontRenderingMode: 0
16
- ascentCalculationMode: 1
17
- useLegacyBoundsCalculation: 0
18
- shouldRoundAdvanceValue: 1
19
- userData:
20
- assetBundleName:
21
- assetBundleVariant: