com.typhoon.unitysdk 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/Editor/AddressableSupport.cs +269 -0
  2. package/Editor/AddressableSupport.cs.meta +11 -0
  3. package/Editor/ApplyTool.cs +315 -0
  4. package/Editor/ApplyTool.cs.meta +11 -0
  5. package/Editor/EditorIcons.cs +113 -0
  6. package/Editor/EditorIcons.cs.meta +11 -0
  7. package/Editor/ExportModule.cs +218 -0
  8. package/Editor/ExportModule.cs.meta +11 -0
  9. package/Editor/InstallModule.cs +38 -0
  10. package/Editor/InstallModule.cs.meta +11 -0
  11. package/Editor/Interactive/SDKInteractiveUI.prefab +3026 -0
  12. package/Editor/Interactive/SDKInteractiveUI.prefab.meta +7 -0
  13. package/Editor/Interactive/sdk_banner.png +0 -0
  14. package/Editor/Interactive/sdk_banner.png.meta +144 -0
  15. package/Editor/Interactive/sdk_close.png +0 -0
  16. package/Editor/Interactive/sdk_close.png.meta +120 -0
  17. package/Editor/Interactive/sdk_inters.png +0 -0
  18. package/Editor/Interactive/sdk_inters.png.meta +120 -0
  19. package/Editor/Interactive/sdk_white_4x4.png +0 -0
  20. package/Editor/Interactive/sdk_white_4x4.png.meta +120 -0
  21. package/Editor/Interactive/sdk_/345/244/261/350/264/245/350/277/224/345/233/236.png +0 -0
  22. package/Editor/Interactive/sdk_/345/244/261/350/264/245/350/277/224/345/233/236.png.meta +120 -0
  23. package/Editor/Interactive/sdk_/346/202/254/346/265/256/345/271/277/345/221/212.png +0 -0
  24. package/Editor/Interactive/sdk_/346/202/254/346/265/256/345/271/277/345/221/212.png.meta +120 -0
  25. package/Editor/Interactive/sdk_/346/210/220/345/212/237/350/277/224/345/233/236.png +0 -0
  26. package/Editor/Interactive/sdk_/346/210/220/345/212/237/350/277/224/345/233/236.png.meta +120 -0
  27. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/345/216/237/347/224/237/346/250/241/346/235/277.png +0 -0
  28. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/345/216/237/347/224/237/346/250/241/346/235/277.png.meta +120 -0
  29. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/346/217/222/351/241/265/345/271/277/345/221/212.png +0 -0
  30. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/346/217/222/351/241/265/345/271/277/345/221/212.png.meta +120 -0
  31. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/350/247/206/351/242/221/345/271/277/345/221/212.png +0 -0
  32. package/Editor/Interactive/sdk_/350/277/231/346/230/257/344/270/200/344/270/252/350/247/206/351/242/221/345/271/277/345/221/212.png.meta +120 -0
  33. package/Editor/Interactive.meta +8 -0
  34. package/Editor/OnApplyProcessor.cs +22 -0
  35. package/Editor/OnApplyProcessor.cs.meta +11 -0
  36. package/Editor/OnBuildAAProcessor.cs +12 -0
  37. package/Editor/OnBuildAAProcessor.cs.meta +11 -0
  38. package/Editor/OnPublicProcessor.cs +12 -0
  39. package/Editor/OnPublicProcessor.cs.meta +11 -0
  40. package/Editor/OriginalStyles.cs +708 -0
  41. package/Editor/OriginalStyles.cs.meta +11 -0
  42. package/Editor/Preferences.cs +43 -0
  43. package/Editor/Preferences.cs.meta +11 -0
  44. package/Editor/PreferencesWindow.cs +178 -0
  45. package/Editor/PreferencesWindow.cs.meta +11 -0
  46. package/Editor/PropertyInspectorEditor.cs +6 -0
  47. package/Editor/PropertyInspectorEditor.cs.meta +11 -0
  48. package/Editor/PublishProcess.cs +13 -0
  49. package/Editor/PublishProcess.cs.meta +11 -0
  50. package/Editor/PublishResult.cs +17 -0
  51. package/Editor/PublishResult.cs.meta +11 -0
  52. package/Editor/PublishSetting.cs +111 -0
  53. package/Editor/PublishSetting.cs.meta +11 -0
  54. package/Editor/PublishSettingGUIDrawer.cs +412 -0
  55. package/Editor/PublishSettingGUIDrawer.cs.meta +11 -0
  56. package/Editor/PublishSettingInspector.cs +29 -0
  57. package/Editor/PublishSettingInspector.cs.meta +11 -0
  58. package/Editor/PublishTool.cs +137 -0
  59. package/Editor/PublishTool.cs.meta +11 -0
  60. package/Editor/PublishVivoBatSetting.cs +62 -0
  61. package/Editor/PublishVivoBatSetting.cs.meta +11 -0
  62. package/Editor/PublishVivoBatSettingInspector.cs +371 -0
  63. package/Editor/PublishVivoBatSettingInspector.cs.meta +11 -0
  64. package/Editor/PublishVivoBatSettingWindow.cs +69 -0
  65. package/Editor/PublishVivoBatSettingWindow.cs.meta +11 -0
  66. package/Editor/PublishWindow.cs +364 -0
  67. package/Editor/PublishWindow.cs.meta +11 -0
  68. package/Editor/SdkFont.otf +0 -0
  69. package/Editor/SdkFont.otf.meta +21 -0
  70. package/Editor/SdkTestInUnityEditor.cs +20 -0
  71. package/Editor/SdkTestInUnityEditor.cs.meta +11 -0
  72. package/Editor/SdkTestInUnityWindow.cs +37 -0
  73. package/Editor/SdkTestInUnityWindow.cs.meta +11 -0
  74. package/Editor/Skin.guiskin +2673 -0
  75. package/Editor/Skin.guiskin.meta +8 -0
  76. package/Editor/Skins.cs +26 -0
  77. package/Editor/Skins.cs.meta +11 -0
  78. package/Editor/StyleEditorWindow.cs +23 -0
  79. package/Editor/StyleEditorWindow.cs.meta +11 -0
  80. package/Editor/Styles.cs +52 -0
  81. package/Editor/Styles.cs.meta +11 -0
  82. package/Editor/StylesExtension.cs +25 -0
  83. package/Editor/StylesExtension.cs.meta +11 -0
  84. package/Editor/Texture/btn_active.png +0 -0
  85. package/Editor/Texture/btn_active.png.meta +120 -0
  86. package/Editor/Texture/btn_blue_active.png +0 -0
  87. package/Editor/Texture/btn_blue_active.png.meta +120 -0
  88. package/Editor/Texture/btn_blue_hover.png +0 -0
  89. package/Editor/Texture/btn_blue_hover.png.meta +120 -0
  90. package/Editor/Texture/btn_blue_normal.png +0 -0
  91. package/Editor/Texture/btn_blue_normal.png.meta +120 -0
  92. package/Editor/Texture/btn_green_active.png +0 -0
  93. package/Editor/Texture/btn_green_active.png.meta +120 -0
  94. package/Editor/Texture/btn_green_hover.png +0 -0
  95. package/Editor/Texture/btn_green_hover.png.meta +120 -0
  96. package/Editor/Texture/btn_green_normal.png +0 -0
  97. package/Editor/Texture/btn_green_normal.png.meta +120 -0
  98. package/Editor/Texture/btn_hover.png +0 -0
  99. package/Editor/Texture/btn_hover.png.meta +120 -0
  100. package/Editor/Texture/btn_normal.png +0 -0
  101. package/Editor/Texture/btn_normal.png.meta +120 -0
  102. package/Editor/Texture/btn_yellow_active.png +0 -0
  103. package/Editor/Texture/btn_yellow_active.png.meta +120 -0
  104. package/Editor/Texture/btn_yellow_hover.png +0 -0
  105. package/Editor/Texture/btn_yellow_hover.png.meta +120 -0
  106. package/Editor/Texture/btn_yellow_normal.png +0 -0
  107. package/Editor/Texture/btn_yellow_normal.png.meta +120 -0
  108. package/Editor/Texture/icon_android.png +0 -0
  109. package/Editor/Texture/icon_android.png.meta +120 -0
  110. package/Editor/Texture/icon_douyin.png +0 -0
  111. package/Editor/Texture/icon_douyin.png.meta +120 -0
  112. package/Editor/Texture/icon_download.png +0 -0
  113. package/Editor/Texture/icon_download.png.meta +120 -0
  114. package/Editor/Texture/icon_error.png +0 -0
  115. package/Editor/Texture/icon_error.png.meta +144 -0
  116. package/Editor/Texture/icon_extension.png +0 -0
  117. package/Editor/Texture/icon_extension.png.meta +120 -0
  118. package/Editor/Texture/icon_googleplay.png +0 -0
  119. package/Editor/Texture/icon_googleplay.png.meta +120 -0
  120. package/Editor/Texture/icon_html5.png +0 -0
  121. package/Editor/Texture/icon_html5.png.meta +120 -0
  122. package/Editor/Texture/icon_import.png +0 -0
  123. package/Editor/Texture/icon_import.png.meta +144 -0
  124. package/Editor/Texture/icon_ios.png +0 -0
  125. package/Editor/Texture/icon_ios.png.meta +120 -0
  126. package/Editor/Texture/icon_oppo.png +0 -0
  127. package/Editor/Texture/icon_oppo.png.meta +120 -0
  128. package/Editor/Texture/icon_refresh.png +0 -0
  129. package/Editor/Texture/icon_refresh.png.meta +120 -0
  130. package/Editor/Texture/icon_save.png +0 -0
  131. package/Editor/Texture/icon_save.png.meta +120 -0
  132. package/Editor/Texture/icon_success.png +0 -0
  133. package/Editor/Texture/icon_success.png.meta +144 -0
  134. package/Editor/Texture/icon_vivo.png +0 -0
  135. package/Editor/Texture/icon_vivo.png.meta +120 -0
  136. package/Editor/Texture/icon_wechat.png +0 -0
  137. package/Editor/Texture/icon_wechat.png.meta +120 -0
  138. package/Editor/Texture/tex_select.png +0 -0
  139. package/Editor/Texture/tex_select.png.meta +120 -0
  140. package/Editor/Texture.meta +8 -0
  141. package/Editor/UniEditor.cs +451 -0
  142. package/Editor/UniEditor.cs.meta +11 -0
  143. package/Editor/com.typhoon.unitysdk.editor.asmdef +20 -0
  144. package/Editor/com.typhoon.unitysdk.editor.asmdef.meta +7 -0
  145. package/Editor.meta +8 -0
  146. package/Runtime/AndroidInstance.cs +125 -0
  147. package/Runtime/AndroidInstance.cs.meta +11 -0
  148. package/Runtime/AppChannel.cs +55 -0
  149. package/Runtime/AppChannel.cs.meta +11 -0
  150. package/Runtime/AppConfig.cs +28 -0
  151. package/Runtime/AppConfig.cs.meta +11 -0
  152. package/Runtime/AppConfigAsset.cs +50 -0
  153. package/Runtime/AppConfigAsset.cs.meta +11 -0
  154. package/Runtime/BannerPosition.cs +11 -0
  155. package/Runtime/BannerPosition.cs.meta +11 -0
  156. package/Runtime/BaseSdk.cs +78 -0
  157. package/Runtime/BaseSdk.cs.meta +11 -0
  158. package/Runtime/Extension.cs +58 -0
  159. package/Runtime/Extension.cs.meta +11 -0
  160. package/Runtime/Interface.cs +115 -0
  161. package/Runtime/Interface.cs.meta +11 -0
  162. package/Runtime/MonoSingleton.cs +76 -0
  163. package/Runtime/MonoSingleton.cs.meta +11 -0
  164. package/Runtime/Resources/TYPHOON_SDK_TEST.prefab +45 -0
  165. package/Runtime/Resources/TYPHOON_SDK_TEST.prefab.meta +7 -0
  166. package/Runtime/Resources.meta +8 -0
  167. package/Runtime/SDKInteractiveUI.cs +353 -0
  168. package/Runtime/SDKInteractiveUI.cs.meta +11 -0
  169. package/Runtime/SdkDebug.cs +23 -0
  170. package/Runtime/SdkDebug.cs.meta +11 -0
  171. package/Runtime/SdkTestInUnity.cs +45 -0
  172. package/Runtime/SdkTestInUnity.cs.meta +11 -0
  173. package/Runtime/SessionItem.cs +72 -0
  174. package/Runtime/SessionItem.cs.meta +11 -0
  175. package/Runtime/SimpleMap.cs +11 -0
  176. package/Runtime/SimpleMap.cs.meta +11 -0
  177. package/Runtime/TestSdk.cs +22 -0
  178. package/Runtime/TestSdk.cs.meta +11 -0
  179. package/Runtime/TyphoonSdk.cs +407 -0
  180. package/Runtime/TyphoonSdk.cs.meta +11 -0
  181. package/Runtime/TyphoonSdkCallback.cs +48 -0
  182. package/Runtime/TyphoonSdkCallback.cs.meta +11 -0
  183. package/Runtime/VersionType.cs +33 -0
  184. package/Runtime/VersionType.cs.meta +11 -0
  185. package/Runtime/com.typhoon.unitysdk.asmdef +3 -0
  186. package/Runtime/com.typhoon.unitysdk.asmdef.meta +7 -0
  187. package/Runtime.meta +8 -0
  188. package/Sources~/ChinaAndroid/Assets/Plugins/Android/AndroidManifest.xml +18 -0
  189. package/Sources~/ChinaAndroid/Assets/Plugins/Android/AndroidManifest.xml.meta +7 -0
  190. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/sdk_plug-release.aar +0 -0
  191. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/sdk_plug-release.aar.meta +32 -0
  192. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_app-release.aar +0 -0
  193. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_app-release.aar.meta +32 -0
  194. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_launcher-release.aar +0 -0
  195. package/Sources~/ChinaAndroid/Assets/Plugins/Android/libs/unity_launcher-release.aar.meta +32 -0
  196. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs +154 -0
  197. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/ChinaAndroidSdk.cs.meta +11 -0
  198. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor/PublishChinaAndroidAAR.cs +56 -0
  199. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor/PublishChinaAndroidAAR.cs.meta +11 -0
  200. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Editor.meta +8 -0
  201. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources/TYPHOON_SDK_CHINA_ANDROID.prefab +45 -0
  202. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources/TYPHOON_SDK_CHINA_ANDROID.prefab.meta +7 -0
  203. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid/Resources.meta +8 -0
  204. package/Sources~/ChinaAndroid/Assets/Typhoon_Gen/TyphoonSDK/Runtime/ChinaAndroid.meta +8 -0
  205. package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
  206. package/package.json +1 -0
  207. package/package.json.meta +7 -0
@@ -0,0 +1,371 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.IO;
4
+ using System.Linq;
5
+ using System.Text;
6
+ using System.Text.RegularExpressions;
7
+ using UnityEditor;
8
+ using UnityEngine;
9
+
10
+ namespace TyphoonUnitySDK
11
+ {
12
+ [CustomEditor(typeof(PublishVivoBatSetting))]
13
+ public class PublishVivoBatSettingInspector : Editor
14
+ {
15
+ public static string build_garde_template = @"import java.text.SimpleDateFormat
16
+
17
+ apply plugin: 'com.android.application'
18
+
19
+ android {
20
+ compileSdkVersion 32
21
+ buildToolsVersion '30.0.3'
22
+
23
+ compileOptions {
24
+ sourceCompatibility JavaVersion.VERSION_1_8
25
+ targetCompatibility JavaVersion.VERSION_1_8
26
+ }
27
+
28
+ /*签名配置*/
29
+ signingConfigs {
30
+ release {
31
+ def signDir = rootProject.file('sign')
32
+ keyAlias 'xiqi'
33
+ keyPassword '1314woaini'
34
+ storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
35
+ storePassword '1314woaini'
36
+ }
37
+
38
+ debug {
39
+ def signDir = rootProject.file('sign')
40
+ keyAlias 'xiqi'
41
+ keyPassword '1314woaini'
42
+ storeFile file(signDir.getAbsolutePath() + '/xiqi.jks')
43
+ storePassword '1314woaini'
44
+ }
45
+ }
46
+
47
+
48
+ defaultConfig {
49
+ minSdkVersion 21
50
+ targetSdkVersion 32
51
+ applicationId '$APPLICATION_ID'
52
+ ndk {
53
+ abiFilters 'armeabi-v7a', 'arm64-v8a'
54
+ }
55
+ versionCode $VERSION_CODE
56
+ versionName '$VERSION_NAME'
57
+ }
58
+
59
+ //发布的包名
60
+ applicationVariants.all { variant ->
61
+ variant.outputs.all {
62
+ def formattedDate = new SimpleDateFormat(""yyyyMMdd_HHmmss"").format(new Date())
63
+ def versionName = variant.versionName
64
+ def buildType = variant.buildType.name
65
+ def appName = variant.applicationId
66
+ outputFileName = ""${appName}_v${versionName}_${buildType}_${formattedDate}.apk""
67
+ }
68
+ }
69
+
70
+
71
+ sourceSets {
72
+ main {
73
+ jniLibs.srcDirs = ['libs']
74
+ }
75
+ }
76
+
77
+ aaptOptions {
78
+ noCompress = ['.unity3d', '.ress', '.resource', '.obb', 'aa/catalog.json', 'aa/settings.json', 'aa/AddressablesLink/link.xml', '.bundle']
79
+ ignoreAssetsPattern = ""!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~""
80
+ }
81
+
82
+ lintOptions {
83
+ abortOnError false
84
+ }
85
+
86
+ buildTypes {
87
+ debug {
88
+ minifyEnabled false
89
+ useProguard false
90
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
91
+ signingConfig signingConfigs.debug
92
+ jniDebuggable true
93
+ }
94
+ release {
95
+ minifyEnabled false
96
+ useProguard false
97
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
98
+ signingConfig signingConfigs.release
99
+
100
+ }
101
+ }
102
+
103
+ packagingOptions {
104
+ doNotStrip '*/armeabi-v7a/*.so'
105
+ doNotStrip '*/arm64-v8a/*.so'
106
+ }
107
+
108
+ bundle {
109
+ language {
110
+ enableSplit = false
111
+ }
112
+ density {
113
+ enableSplit = false
114
+ }
115
+ abi {
116
+ enableSplit = true
117
+ }
118
+ }
119
+
120
+
121
+ }
122
+
123
+ dependencies {
124
+ implementation fileTree(includes: ['*.jar', '*.aar'], dir: 'libs')
125
+ implementation project(':unity_app')
126
+ implementation project(':vivo_union')
127
+ implementation project(':test_demo')
128
+ implementation project(':sdk_plug')
129
+ }";
130
+
131
+ public PublishVivoBatSetting Target => target as PublishVivoBatSetting;
132
+
133
+ public override void OnInspectorGUI()
134
+ {
135
+ base.OnInspectorGUI();
136
+ // if (GUILayout.Button("自动版本号", GUILayout.Height(32)))
137
+ // {
138
+ // Target.Version = AutoVersionSting(Target.Version);
139
+ // Target.Save();
140
+ // }
141
+
142
+ var publish = GUILayout.Button("发布vivo", GUILayout.Height(32));
143
+ if (publish)
144
+ {
145
+ Publish(Target);
146
+ }
147
+ }
148
+
149
+ public static string AutoVersionSting(string version)
150
+ {
151
+ if (string.IsNullOrEmpty(version))
152
+ {
153
+ return "1.0.0";
154
+ }
155
+
156
+ var strs = version.Split('.');
157
+ try
158
+ {
159
+ var current = int.Parse(strs.Last());
160
+ current += 1;
161
+ var sb = new StringBuilder();
162
+ for (int i = 0; i < strs.Length - 1; i++)
163
+ {
164
+ if (i != 0)
165
+ {
166
+ sb.Append(".");
167
+ }
168
+
169
+ sb.Append(strs[i]);
170
+ }
171
+
172
+ sb.Append($".{current}");
173
+ return sb.ToString();
174
+ }
175
+ catch (Exception e)
176
+ {
177
+ Debug.LogError("无法识别版本号格式");
178
+ }
179
+
180
+ return version;
181
+ }
182
+
183
+
184
+ public static void Publish(PublishVivoBatSetting setting)
185
+ {
186
+ if (!Directory.Exists(setting.AndroidPublishProj))
187
+ {
188
+ throw new Exception($"找不到{setting.AndroidPublishProj}");
189
+ }
190
+
191
+ var unityProj = GetMatchChinaAndroidProj();
192
+ if (unityProj == null)
193
+ {
194
+ throw new Exception($"找不到unity导出工程");
195
+ }
196
+
197
+ //修改游戏名
198
+ Debug.Log("修改游戏名");
199
+ var publishProj = setting.AndroidPublishProj;
200
+ {
201
+ var strings_xml = $"{publishProj}/publish_unity_vivo_union/src/main/res/values/strings.xml";
202
+ var input =
203
+ $"<?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>";
204
+ File.WriteAllText(strings_xml, input);
205
+ }
206
+ {
207
+ //复制icon
208
+ Debug.Log("更换icon");
209
+ var iconPath = AssetDatabase.GetAssetPath(setting.Icon);
210
+ File.Copy(iconPath,
211
+ $"{publishProj}\\publish_unity_vivo_union\\src\\main\\res\\mipmap-mdpi\\app_icon.png", true);
212
+ }
213
+
214
+
215
+ {
216
+ Debug.Log("更换包名等信息");
217
+ var build_gardle = $"{publishProj}/publish_unity_vivo_union/build.gradle";
218
+ var code = build_garde_template;
219
+ var str = setting.Version.Split('.');
220
+ var sb = new StringBuilder();
221
+ var index = 0;
222
+ foreach (var s in str)
223
+ {
224
+ if (index != 0)
225
+ {
226
+ sb.Append(s.PadLeft(2, '0'));
227
+ }
228
+ else
229
+ {
230
+ sb.Append(s);
231
+ }
232
+
233
+ index += 1;
234
+ }
235
+
236
+
237
+ code = code.Replace("$APPLICATION_ID", setting.PackageName);
238
+ code = code.Replace("$VERSION_CODE", sb.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 input =
255
+ $"package com.typhoon.vivo_union;\n\n/*打包配置*/\npublic class Config {{\n /*Debug 模式开关*/\n public static boolean DEBUG_MODE=false;\n /*隐藏政策URL*/\n public static String PRIVACY_POLICY_URL=\"{setting.PrivacyPolicyYNoteUrl}\";\n /*VIVO-联运 参数*/\n public static String APP_ID = \"{setting.AppId}\";//appid(看后台)\n /*VIVO-广告联盟 参数*/\n public static String MEDIA_ID = \"{setting.MediaID}\";//Media ID\n public static String INTER_UNIT_ID = \"{setting.IntersID}\"; //插页广告\n public static String VIDEO_UNIT_ID = \"{setting.VideoID}\"; //视频广告\n public static String SPLASH_UNIT_ID = \"{setting.SplashID}\";//开屏广告\n public static String FLOAT_ICON_UNIT_ID = \"{setting.FloatIconID}\"; //悬浮icon\n public static String NATIVE_UNIT_ID = \"{setting.NativeID}\";//原生广告\n public static String BANNER_UNIT_ID = \"{setting.BannerID}\";//banner广告\n\n}}\n";
256
+ File.WriteAllText(config, input);
257
+ }
258
+ {
259
+ Debug.Log("修改unity manifest");
260
+
261
+ var manifest = $"{unityProj}/unityLibrary/src/main/AndroidManifest.xml";
262
+ var xml = File.ReadAllText(manifest);
263
+ // string pattern = @"(?s)<intent-filter\b[^>]*>(.*?)<\/intent-filter>";
264
+ // string result = Regex.Replace(xml, pattern, "");
265
+ xml = xml.Replace("<intent-filter>", "");
266
+ xml = xml.Replace("<action android:name=\"android.intent.action.MAIN\" />", "");
267
+ xml = xml.Replace("<category android:name=\"android.intent.category.LAUNCHER\" />", "");
268
+ xml = xml.Replace("</intent-filter>", "");
269
+ File.WriteAllText(manifest, xml);
270
+
271
+ //复制unitylib
272
+ Debug.Log("复制unitylib");
273
+ var from = $"{unityProj}/unityLibrary";
274
+ var to = $"{publishProj}/unityLibrary";
275
+ UniEditor.TryDeleteFolder(to);
276
+ UniEditor.CopyFolder(from, to);
277
+ }
278
+ Debug.Log("处理完毕!");
279
+ }
280
+
281
+
282
+ /// <summary>
283
+ /// 正则表达式更换
284
+ /// </summary>
285
+ public static void RegexReplace(string file, string pattern, string replacement)
286
+ {
287
+ var txt = File.ReadAllText(file);
288
+ Regex.Replace(txt, pattern, replacement);
289
+ File.WriteAllText(file, txt);
290
+ }
291
+
292
+ public static void RegexReplace(string file, params PatternReplacement[] replacements)
293
+ {
294
+ var txt = File.ReadAllText(file);
295
+ foreach (var e in replacements)
296
+ {
297
+ txt = Regex.Replace(txt, e.Pattern, e.Replacement);
298
+ }
299
+
300
+ File.WriteAllText(file, txt);
301
+ }
302
+
303
+
304
+ public class PatternReplacement
305
+ {
306
+ public string Pattern;
307
+ public string Replacement;
308
+
309
+ public PatternReplacement(string pattern, string replacement)
310
+ {
311
+ Pattern = pattern;
312
+ Replacement = replacement;
313
+ }
314
+ }
315
+
316
+ public class ReplacementFileSettings
317
+ {
318
+ public string FilePath;
319
+ public PatternReplacement Replacement;
320
+
321
+ public ReplacementFileSettings(string filePath, string pattern, string replacement)
322
+ {
323
+ FilePath = filePath;
324
+ Replacement = new PatternReplacement(pattern, replacement);
325
+ }
326
+ }
327
+
328
+
329
+ public class ProjInfo
330
+ {
331
+ public string Path;
332
+ public long ExportTime;
333
+
334
+ public ProjInfo(string path, long exportTime)
335
+ {
336
+ Path = path;
337
+ ExportTime = exportTime;
338
+ }
339
+ }
340
+
341
+ //获取最匹配的导出文件夹
342
+ private static string GetMatchChinaAndroidProj()
343
+ {
344
+ var china_android_proj = $".typhoonoutput";
345
+ if (!Directory.Exists(china_android_proj))
346
+ {
347
+ throw new Exception($"找不到{china_android_proj}");
348
+ }
349
+
350
+ var dir = Directory.GetDirectories(china_android_proj);
351
+ var match = new List<ProjInfo>();
352
+ foreach (var item in dir)
353
+ {
354
+ var folderName = Path.GetFileName(item);
355
+ if (folderName.StartsWith("china_android_"))
356
+ {
357
+ var time = long.Parse(folderName.Replace("china_android_", ""));
358
+ match.Add(new ProjInfo(item, time));
359
+ }
360
+ }
361
+
362
+ match.Sort((a, b) => { return b.ExportTime.CompareTo(a.ExportTime); });
363
+ if (match.Count > 0)
364
+ {
365
+ return match.First().Path;
366
+ }
367
+
368
+ return null;
369
+ }
370
+ }
371
+ }
@@ -0,0 +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:
@@ -0,0 +1,69 @@
1
+ using UnityEditor;
2
+ using UnityEngine;
3
+
4
+ namespace TyphoonUnitySDK
5
+ {
6
+ public class PublishVivoBatSettingWindow : StyleEditorWindow
7
+ {
8
+ [MenuItem("临时发布vivo/发布", priority = 10000)]
9
+ public static void Open()
10
+ {
11
+ var win = GetWindow<PublishVivoBatSettingWindow>();
12
+ win.titleContent = new GUIContent("临时发布vivo");
13
+ win.minSize = new Vector2(650, 500);
14
+ win.Show();
15
+ }
16
+
17
+ private Editor _editor;
18
+
19
+ public Editor Editor
20
+ {
21
+ get
22
+ {
23
+ if (_editor != null && _editor.target != PublishVivoBatSetting.Default)
24
+ {
25
+ DestroyImmediate(_editor);
26
+ }
27
+
28
+ if (_editor == null)
29
+ {
30
+ _editor = Editor.CreateEditor(PublishVivoBatSetting.Default,
31
+ typeof(PublishVivoBatSettingInspector));
32
+ }
33
+
34
+ return _editor;
35
+ }
36
+ }
37
+
38
+
39
+ protected override void OnDrawGUI()
40
+ {
41
+ base.OnDrawGUI();
42
+ var rect = new Rect(0, 0, position.width, position.height);
43
+ var area = rect;
44
+ area.height -= 8;
45
+ area.width -= 12;
46
+ area.center = rect.center;
47
+ GUILayout.BeginArea(area);
48
+ var rectSave = new Rect(0, 0, area.width, area.height);
49
+ rectSave.width = 100;
50
+ rectSave.height = 32;
51
+ rectSave.x = area.width - rectSave.width;
52
+ rectSave.x -= 4;
53
+ rectSave.y += 10;
54
+
55
+
56
+ Editor.OnInspectorGUI();
57
+
58
+ if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save), Styles.rbutton_green))
59
+ {
60
+ EditorUtility.SetDirty(PublishVivoBatSetting.Default);
61
+ AssetDatabase.SaveAssets();
62
+ Debug.Log("保存完毕");
63
+ }
64
+
65
+ GUILayout.EndArea();
66
+ Repaint();
67
+ }
68
+ }
69
+ }
@@ -0,0 +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: