com.typhoon.unitysdk 1.0.34 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/ApplyTool.cs +42 -8
- package/Editor/ExportModule.cs +23 -0
- package/Editor/GUIDrawer.cs +38 -0
- package/Editor/MD5Tool.cs +53 -0
- package/Editor/MD5Tool.cs.meta +11 -0
- package/Editor/Orientation.cs +18 -0
- package/Editor/Orientation.cs.meta +11 -0
- package/Editor/PluginModuleInstaller.cs +452 -0
- package/Editor/PluginModuleInstaller.cs.meta +11 -0
- package/Editor/PreferencesWindow.cs +1 -1
- package/Editor/PublishProcess.cs +5 -4
- package/Editor/PublishSetting.cs +3 -0
- package/Editor/PublishSettingGUIDrawer.cs +20 -2
- package/Editor/PublishTool.cs +3 -3
- package/Editor/PublishWindow.cs +2 -4
- package/Editor/UniEditor.cs +249 -13
- package/Editor/VivoMiniConfig.cs +436 -0
- package/Editor/VivoMiniConfig.cs.meta +11 -0
- package/Editor/WxMiniConfig.cs +9 -22
- package/Editor/ZipTool.cs +78 -0
- package/Editor/ZipTool.cs.meta +11 -0
- package/Editor/bats/create-sign.bat +13 -0
- package/Editor/bats/create-sign.bat.meta +7 -0
- package/Editor/bats.meta +8 -0
- package/Editor/dll/AlphaFS.dll +0 -0
- package/Editor/dll/AlphaFS.dll.meta +33 -0
- package/Editor/dll/XGameDotNetZip.dll +0 -0
- package/Editor/dll/XGameDotNetZip.dll.meta +33 -0
- package/Editor/dll.meta +8 -0
- package/Runtime/AndroidInstance.cs +1 -1
- package/Runtime/BaseSdk.cs +64 -0
- package/Runtime/Extension.cs +8 -2
- package/Runtime/HttpGetSuccessResult.cs +23 -0
- package/Runtime/HttpGetSuccessResult.cs.meta +11 -0
- package/Runtime/HttpPostSuccessResult.cs +30 -0
- package/Runtime/HttpPostSuccessResult.cs.meta +11 -0
- package/Runtime/Interface.cs +21 -2
- package/Runtime/SDKHttpClient.cs +119 -0
- package/Runtime/SDKHttpClient.cs.meta +11 -0
- package/Runtime/TyphoonSdk.cs +43 -0
- package/Runtime/TyphoonSdkCallback.cs +11 -5
- package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
- package/Sources~/Package/Douyin.unitypackage +0 -0
- package/Sources~/Package/GooglePlay.unitypackage +0 -0
- package/Sources~/Package/VivoMini.unitypackage +0 -0
- package/Sources~/Package/VivoMini.unitypackage.manifest +261 -0
- package/Sources~/Package/WxMini.unitypackage +0 -0
- package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.ComponentModel;
|
|
3
|
+
using System.Diagnostics;
|
|
4
|
+
using System.IO;
|
|
5
|
+
using System.Net;
|
|
6
|
+
using System.Net.Http;
|
|
7
|
+
using System.Threading;
|
|
8
|
+
using System.Threading.Tasks;
|
|
9
|
+
using UnityEditor;
|
|
10
|
+
using Debug = UnityEngine.Debug;
|
|
11
|
+
|
|
12
|
+
namespace TyphoonUnitySDK
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// 插件模块安装器
|
|
16
|
+
/// </summary>
|
|
17
|
+
public class PluginModuleInstaller
|
|
18
|
+
{
|
|
19
|
+
//插件名
|
|
20
|
+
public enum PluginNames
|
|
21
|
+
{
|
|
22
|
+
NodeJsV10_13,
|
|
23
|
+
NodeJsV15,
|
|
24
|
+
Openssl,
|
|
25
|
+
QGToolKit, //快应用工具
|
|
26
|
+
VivoNodeModule, //vivo小游戏Node模块
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//插件信息
|
|
30
|
+
public class PluginInfo
|
|
31
|
+
{
|
|
32
|
+
public PluginNames PluginName;
|
|
33
|
+
public string Url;
|
|
34
|
+
public string MD5Code;
|
|
35
|
+
public string FolderName; //模块文件名
|
|
36
|
+
|
|
37
|
+
public PluginInfo(PluginNames pluginName, string url, string md5Code, string folderName)
|
|
38
|
+
{
|
|
39
|
+
PluginName = pluginName;
|
|
40
|
+
Url = url;
|
|
41
|
+
MD5Code = md5Code;
|
|
42
|
+
FolderName = folderName;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// 模块文件夹
|
|
47
|
+
/// </summary>
|
|
48
|
+
public string RootPath => $"{GetPluginsFolder()}/{FolderName}";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 插件清单
|
|
52
|
+
public static PluginInfo[] PluginsManifest = new PluginInfo[]
|
|
53
|
+
{
|
|
54
|
+
new PluginInfo(PluginNames.NodeJsV10_13, "https://mecha.nthreecats.com/plugins/node-v10.13.0.zip",
|
|
55
|
+
"4fec379039bda31dd4f5d7dee27c8f84", "node-v10.13.0"),
|
|
56
|
+
new PluginInfo(PluginNames.NodeJsV15, "https://mecha.nthreecats.com/plugins/node-v15.14.0-win-x64.zip",
|
|
57
|
+
"40d03c7c1eed5c6943cc618086adfdf6", "node-v15.14.0-win-x64"),
|
|
58
|
+
new PluginInfo(PluginNames.Openssl, "https://mecha.nthreecats.com/plugins/openssl.zip",
|
|
59
|
+
"bfeb2896c357fdeea87a16ee913e8a65", "openssl"),
|
|
60
|
+
new PluginInfo(PluginNames.QGToolKit, "https://mecha.nthreecats.com/plugins/quickgame-toolkit-unity.zip",
|
|
61
|
+
"a11318f47be10876439a88baf2776b78", ""),
|
|
62
|
+
new PluginInfo(PluginNames.VivoNodeModule,
|
|
63
|
+
"https://mecha.nthreecats.com/plugins/vivo_node_modules_v1.zip",
|
|
64
|
+
"c6ee54d0fa3dae6eca0ad6613f6c15e0", "vivo_node_modules"),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//获取插件信息
|
|
68
|
+
public static PluginInfo GetPluginInfo(PluginNames pluginName)
|
|
69
|
+
{
|
|
70
|
+
foreach (var info in PluginsManifest)
|
|
71
|
+
{
|
|
72
|
+
if (info.PluginName == pluginName)
|
|
73
|
+
{
|
|
74
|
+
return info;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
throw new Exception($"找不到PluginInfo:{pluginName}");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// <summary>
|
|
82
|
+
/// 获取插件根目录
|
|
83
|
+
/// </summary>
|
|
84
|
+
public static string GetPluginRootPath(PluginNames plugin)
|
|
85
|
+
{
|
|
86
|
+
return $"{GetPluginsFolder()}/{GetPluginInfo(plugin).FolderName}";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
public static string GetPluginsFolder()
|
|
91
|
+
{
|
|
92
|
+
return $"{UniEditor.GetWindowsUserFolder()}/.typhoonunitysdk/plugins";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// 是否安装了NodeV13
|
|
97
|
+
/// </summary>
|
|
98
|
+
public static bool IsInstallNodeV13()
|
|
99
|
+
{
|
|
100
|
+
var root = $"{GetPluginRootPath(PluginNames.NodeJsV10_13)}";
|
|
101
|
+
var check = new[] { $"{root}/node_modules", $"{root}/node.exe", $"{root}/npm.cmd", };
|
|
102
|
+
return CheckFilesOrDirectoryExists(check);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/// <summary>
|
|
106
|
+
/// 安装NodeV13
|
|
107
|
+
/// </summary>
|
|
108
|
+
public static async void InstallNodeV13Async(Action complete = null)
|
|
109
|
+
{
|
|
110
|
+
await InstallModule(PluginNames.NodeJsV10_13, complete);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/// <summary>
|
|
115
|
+
/// 是否安装openssl
|
|
116
|
+
/// </summary>
|
|
117
|
+
public static bool IsInstallOpenssl()
|
|
118
|
+
{
|
|
119
|
+
var root = GetPluginRootPath(PluginNames.Openssl);
|
|
120
|
+
var check = new[] { $"{root}/bin/openssl.exe" };
|
|
121
|
+
return CheckFilesOrDirectoryExists(check);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// <summary>
|
|
125
|
+
/// 安装openssl
|
|
126
|
+
/// </summary>
|
|
127
|
+
public static async void InstallOpensslAsync(Action complete = null)
|
|
128
|
+
{
|
|
129
|
+
await InstallModule(PluginNames.Openssl, complete);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/// <summary>
|
|
133
|
+
/// 是否安装了vivo_node_modules
|
|
134
|
+
/// </summary>
|
|
135
|
+
public static bool IsInstallVivoNodeModule()
|
|
136
|
+
{
|
|
137
|
+
var root = $"{GetPluginRootPath(PluginNames.VivoNodeModule)}";
|
|
138
|
+
var check = new[] { $"{root}/node_modules/.bin", $"{root}/node_modules/ylru" };
|
|
139
|
+
return CheckFilesOrDirectoryExists(check);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/// <summary>
|
|
143
|
+
/// 安装vivo_node_modules
|
|
144
|
+
/// </summary>
|
|
145
|
+
public static async void InstallVivoNodeModuleAsync(Action complete = null)
|
|
146
|
+
{
|
|
147
|
+
await InstallModule(PluginNames.VivoNodeModule, complete);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
public static async Task InstallModule(PluginNames pluginName, Action complete)
|
|
152
|
+
{
|
|
153
|
+
var pluginInfo = GetPluginInfo(pluginName);
|
|
154
|
+
var url = pluginInfo.Url;
|
|
155
|
+
var fileName = Path.GetFileName(url);
|
|
156
|
+
//判断是否存在安装包
|
|
157
|
+
var zip = $"{UniEditor.GetWindowsUserFolder()}/.typhoonunitysdk/download/{fileName}";
|
|
158
|
+
//创建文件夹
|
|
159
|
+
var folder = Path.GetDirectoryName(zip);
|
|
160
|
+
if (!Directory.Exists(folder))
|
|
161
|
+
{
|
|
162
|
+
Directory.CreateDirectory(folder);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (File.Exists(zip))
|
|
166
|
+
{
|
|
167
|
+
var md5 = MD5Tool.GetMD5HashCodeFromFile(zip);
|
|
168
|
+
if (md5 != pluginInfo.MD5Code)
|
|
169
|
+
{
|
|
170
|
+
Debug.Log($"MD5不匹配,删除{zip}");
|
|
171
|
+
File.Delete(zip);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!File.Exists(zip))
|
|
176
|
+
{
|
|
177
|
+
var process = 0d;
|
|
178
|
+
var cts = new CancellationTokenSource();
|
|
179
|
+
var task = DownloadFile(url, zip, (p) => { process = p; }, cts.Token);
|
|
180
|
+
var cancel = false;
|
|
181
|
+
while (!task.IsCompleted)
|
|
182
|
+
{
|
|
183
|
+
await Task.Delay(100);
|
|
184
|
+
if (EditorUtility.DisplayCancelableProgressBar($"下载...{fileName}", $"请稍等...{process}%",
|
|
185
|
+
(float)process * 0.01f))
|
|
186
|
+
{
|
|
187
|
+
cancel = true;
|
|
188
|
+
//中断下载
|
|
189
|
+
cts.Cancel();
|
|
190
|
+
//跳出循环
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
EditorUtility.ClearProgressBar();
|
|
196
|
+
if (cancel)
|
|
197
|
+
{
|
|
198
|
+
Debug.LogError("已取消,安装失败");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (File.Exists(zip))
|
|
204
|
+
{
|
|
205
|
+
var md5 = MD5Tool.GetMD5HashCodeFromFile(zip);
|
|
206
|
+
if (md5 != pluginInfo.MD5Code)
|
|
207
|
+
{
|
|
208
|
+
File.Delete(zip);
|
|
209
|
+
Debug.LogError($"安装失败,文件MD5不匹配:{zip}");
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (!File.Exists(zip))
|
|
215
|
+
{
|
|
216
|
+
Debug.LogError($"安装失败,找不到:{zip}");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var zipName = Path.GetFileName(zip);
|
|
221
|
+
var step = 0f;
|
|
222
|
+
var unzipTo = GetPluginsFolder();
|
|
223
|
+
ZipTool.UnZip(zip, unzipTo, () =>
|
|
224
|
+
{
|
|
225
|
+
EditorUtility.ClearProgressBar();
|
|
226
|
+
Debug.Log($"安装完毕:{zipName}");
|
|
227
|
+
if (Directory.Exists(pluginInfo.RootPath))
|
|
228
|
+
{
|
|
229
|
+
Explorer(pluginInfo.RootPath);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
complete?.Invoke();
|
|
233
|
+
},
|
|
234
|
+
(p) =>
|
|
235
|
+
{
|
|
236
|
+
if (p > step)
|
|
237
|
+
{
|
|
238
|
+
step = p + 0.01f;
|
|
239
|
+
EditorUtility.DisplayProgressBar($"解压...{zipName}", $"请稍等...{(p * 100).ToString("F1")}%", p);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
public static async Task<bool> DownloadFileAsync(string url, string fileName, Action<double> progress = default,
|
|
246
|
+
CancellationToken cancelationToken = default)
|
|
247
|
+
{
|
|
248
|
+
try
|
|
249
|
+
{
|
|
250
|
+
// 使用HttpClient类创建一个HTTP客户端,指定不使用代理,并设置一个 CookieContainer
|
|
251
|
+
using (var httpClient = new HttpClient(new HttpClientHandler()
|
|
252
|
+
{ CookieContainer = new CookieContainer(), UseProxy = false }))
|
|
253
|
+
{
|
|
254
|
+
// 发送GET请求,并等待响应
|
|
255
|
+
var response = await httpClient.GetAsync(new Uri(url),
|
|
256
|
+
HttpCompletionOption.ResponseHeadersRead);
|
|
257
|
+
// 判断请求是否成功,如果失败则返回 false
|
|
258
|
+
if (!response.IsSuccessStatusCode)
|
|
259
|
+
{
|
|
260
|
+
return (false);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// 获取响应内容长度
|
|
264
|
+
long contentLength = response.Content.Headers.ContentLength ?? 0;
|
|
265
|
+
// 创建一个文件流,并将响应内容写入文件流
|
|
266
|
+
using (var fs = File.Open(fileName, FileMode.Create,
|
|
267
|
+
FileAccess.ReadWrite, FileShare.Read))
|
|
268
|
+
{
|
|
269
|
+
// 创建一个缓冲区,大小为64KB
|
|
270
|
+
byte[] buffer = new byte[65536];
|
|
271
|
+
// 获取响应流
|
|
272
|
+
var httpStream = await response.Content.ReadAsStreamAsync();
|
|
273
|
+
// 定义变量,用于记录每次读取的字节数
|
|
274
|
+
int readLength = 0;
|
|
275
|
+
// 循环异步读取响应流的内容,直到读取完毕
|
|
276
|
+
while ((readLength = await httpStream.ReadAsync(buffer, 0, buffer.Length, cancelationToken)) >
|
|
277
|
+
0)
|
|
278
|
+
{
|
|
279
|
+
// 检查是否已经取消了任务
|
|
280
|
+
if (cancelationToken.IsCancellationRequested)
|
|
281
|
+
{
|
|
282
|
+
// 如果任务已经取消,关闭文件流,并删除已经下载的文件
|
|
283
|
+
fs.Close();
|
|
284
|
+
File.Delete(fileName);
|
|
285
|
+
return (false);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 将读取到的内容写入文件流,并调用进度回调函数
|
|
289
|
+
await fs.WriteAsync(buffer, 0, readLength, cancelationToken);
|
|
290
|
+
progress?.Invoke(Math.Round((double)fs.Length / contentLength * 100, 2));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// 返回true表示文件下载成功
|
|
296
|
+
return (true);
|
|
297
|
+
}
|
|
298
|
+
catch (Exception e)
|
|
299
|
+
{
|
|
300
|
+
Debug.LogError($"下载失败:{e}");
|
|
301
|
+
// 返回false表示文件下载失败
|
|
302
|
+
return (false);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/// <summary>
|
|
307
|
+
/// 下载安装包到本地
|
|
308
|
+
/// </summary>
|
|
309
|
+
private static async Task DownloadAsync(string url, string filePath, Action<int> onProgress,
|
|
310
|
+
CancellationToken cancelationToken = default)
|
|
311
|
+
{
|
|
312
|
+
using (HttpClient client = new HttpClient(new HttpClientHandler()
|
|
313
|
+
{ CookieContainer = new CookieContainer(), UseProxy = false }))
|
|
314
|
+
{
|
|
315
|
+
try
|
|
316
|
+
{
|
|
317
|
+
HttpResponseMessage
|
|
318
|
+
response = await client.GetAsync(url,
|
|
319
|
+
HttpCompletionOption.ResponseHeadersRead); // 使用ResponseHeadersRead选项获取响应头
|
|
320
|
+
|
|
321
|
+
if (response.IsSuccessStatusCode)
|
|
322
|
+
{
|
|
323
|
+
long totalLength = response.Content.Headers.ContentLength ?? -1; // 获取文件总长度(如果可用)
|
|
324
|
+
using (var stream = await response.Content.ReadAsStreamAsync()) // 异步读取响应流
|
|
325
|
+
{
|
|
326
|
+
using (var fileStream =
|
|
327
|
+
new FileStream(filePath, FileMode.Create, FileAccess.Write)) // 创建文件流
|
|
328
|
+
{
|
|
329
|
+
byte[] buffer = new byte[4096]; // 缓冲区大小
|
|
330
|
+
long downloadedBytes = 0; // 已下载字节数
|
|
331
|
+
|
|
332
|
+
int bytesRead;
|
|
333
|
+
while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
|
334
|
+
{
|
|
335
|
+
await fileStream.WriteAsync(buffer, 0, bytesRead); // 将数据写入文件
|
|
336
|
+
|
|
337
|
+
downloadedBytes += bytesRead;
|
|
338
|
+
double progress = (double)downloadedBytes / totalLength * 100; // 计算下载进度
|
|
339
|
+
onProgress?.Invoke((int)progress); // 调用进度回调
|
|
340
|
+
|
|
341
|
+
// 继续处理已下载的数据...
|
|
342
|
+
if (cancelationToken.IsCancellationRequested)
|
|
343
|
+
{
|
|
344
|
+
// 如果任务已经取消,关闭文件流,并删除已经下载的文件
|
|
345
|
+
fileStream.Close();
|
|
346
|
+
File.Delete(filePath);
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (cancelationToken.IsCancellationRequested)
|
|
354
|
+
{
|
|
355
|
+
Debug.LogError("取消下载");
|
|
356
|
+
}
|
|
357
|
+
else
|
|
358
|
+
{
|
|
359
|
+
Debug.Log("下载完成");
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
else
|
|
363
|
+
{
|
|
364
|
+
Debug.LogError("下载失败:" + response.StatusCode);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (Exception ex)
|
|
368
|
+
{
|
|
369
|
+
Debug.LogError("下载出错:" + ex.Message);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
protected static async Task DownloadFile(string url, string savePath, Action<int> onProgress,
|
|
376
|
+
CancellationToken cancelationToken = default)
|
|
377
|
+
{
|
|
378
|
+
using (WebClient webClient = new WebClient())
|
|
379
|
+
{
|
|
380
|
+
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(
|
|
381
|
+
delegate(object sender, DownloadProgressChangedEventArgs e)
|
|
382
|
+
{
|
|
383
|
+
try
|
|
384
|
+
{
|
|
385
|
+
onProgress?.Invoke(e.ProgressPercentage);
|
|
386
|
+
}
|
|
387
|
+
catch (Exception exception)
|
|
388
|
+
{
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (cancelationToken.IsCancellationRequested)
|
|
392
|
+
{
|
|
393
|
+
webClient.CancelAsync();
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler
|
|
398
|
+
(delegate(object sender, AsyncCompletedEventArgs e)
|
|
399
|
+
{
|
|
400
|
+
if (e.Error == null && !e.Cancelled)
|
|
401
|
+
{
|
|
402
|
+
try
|
|
403
|
+
{
|
|
404
|
+
if (File.Exists(savePath))
|
|
405
|
+
{
|
|
406
|
+
Debug.Log("下载成功!");
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch (Exception exception)
|
|
410
|
+
{
|
|
411
|
+
Debug.LogError($"下载失败:{exception}");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (e.Cancelled)
|
|
416
|
+
{
|
|
417
|
+
Debug.LogError($"取消下载");
|
|
418
|
+
if (File.Exists(savePath))
|
|
419
|
+
{
|
|
420
|
+
File.Delete(savePath);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
await webClient.DownloadFileTaskAsync(new Uri(url), savePath);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
//检查清单
|
|
429
|
+
public static bool CheckFilesOrDirectoryExists(params string[] path)
|
|
430
|
+
{
|
|
431
|
+
foreach (var element in path)
|
|
432
|
+
{
|
|
433
|
+
if (!File.Exists(element) && !Directory.Exists(element))
|
|
434
|
+
{
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
//预览文件夹或文件
|
|
443
|
+
private static void Explorer(string path)
|
|
444
|
+
{
|
|
445
|
+
var fullPath = Path.GetFullPath(path);
|
|
446
|
+
Debug.Log(fullPath);
|
|
447
|
+
using (Process.Start($"explorer", $"\"{fullPath}\""))
|
|
448
|
+
{
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
@@ -39,7 +39,7 @@ namespace TyphoonUnitySDK
|
|
|
39
39
|
if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save)))
|
|
40
40
|
{
|
|
41
41
|
EditorUtility.SetDirty(Preferences.Default);
|
|
42
|
-
|
|
42
|
+
ApplyTool.SaveAllChannelConfig();
|
|
43
43
|
AssetDatabase.SaveAssets();
|
|
44
44
|
Debug.Log("保存完毕");
|
|
45
45
|
}
|
package/Editor/PublishProcess.cs
CHANGED
|
@@ -8,10 +8,11 @@ namespace TyphoonUnitySDK
|
|
|
8
8
|
Apk,
|
|
9
9
|
IOS,
|
|
10
10
|
Webgl,
|
|
11
|
-
ChinaAndroidAAR
|
|
11
|
+
ChinaAndroidAAR, //国内android
|
|
12
12
|
WxMini, //微信小游戏
|
|
13
|
-
DouyinAndroid
|
|
14
|
-
DouyinIOS
|
|
15
|
-
GooglePlay
|
|
13
|
+
DouyinAndroid, //抖音android
|
|
14
|
+
DouyinIOS, //抖音ios
|
|
15
|
+
GooglePlay, //google play
|
|
16
|
+
VivoMini, //vivo小游戏
|
|
16
17
|
}
|
|
17
18
|
}
|
package/Editor/PublishSetting.cs
CHANGED
|
@@ -49,8 +49,26 @@ namespace TyphoonUnitySDK
|
|
|
49
49
|
{ nameof(PublishSetting.PresetModify), DrawProperty_PresetModify },
|
|
50
50
|
{ nameof(PublishSetting.WxMiniGUIFoldout), DrawProperty_WxMiniGUIFoldout },
|
|
51
51
|
{ nameof(PublishSetting.DouyinGUIFoldout), DrawProperty_DouyinGUIFoldout },
|
|
52
|
+
{ nameof(PublishSetting.VivoMiniGUIFoldout), DrawProperty_VivoMiniGUIFoldout },
|
|
52
53
|
};
|
|
53
54
|
|
|
55
|
+
private static bool DrawProperty_VivoMiniGUIFoldout(PublishSetting arg)
|
|
56
|
+
{
|
|
57
|
+
if (arg.Channel != AppChannel.VivoMini)
|
|
58
|
+
{
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
GUILayout.Space(10);
|
|
63
|
+
arg.DouyinGUIFoldout = GUIDrawer.DrawFoldout("vivo小游戏", arg.DouyinGUIFoldout, GUILayout.Height(26));
|
|
64
|
+
if (arg.DouyinGUIFoldout)
|
|
65
|
+
{
|
|
66
|
+
VivoMiniConfigGUIDrawer.DrawGUI();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
/*绘制抖音小游戏GUI*/
|
|
55
73
|
private static bool DrawProperty_DouyinGUIFoldout(PublishSetting arg)
|
|
56
74
|
{
|
|
@@ -81,7 +99,7 @@ namespace TyphoonUnitySDK
|
|
|
81
99
|
arg.WxMiniGUIFoldout = GUIDrawer.DrawFoldout("微信小游戏", arg.WxMiniGUIFoldout, GUILayout.Height(26));
|
|
82
100
|
if (arg.WxMiniGUIFoldout)
|
|
83
101
|
{
|
|
84
|
-
WxMiniConfigGUIDrawer.
|
|
102
|
+
WxMiniConfigGUIDrawer.DrawGUI();
|
|
85
103
|
}
|
|
86
104
|
|
|
87
105
|
return true;
|
|
@@ -510,13 +528,13 @@ namespace TyphoonUnitySDK
|
|
|
510
528
|
modify.VariableValue = GUILayout.TextField(modify.VariableValue);
|
|
511
529
|
if (tem != modify.VariableValue)
|
|
512
530
|
{
|
|
513
|
-
//修改自定义变量
|
|
514
531
|
VariablePreset.Default.Modify(modify.VariableName, modify.VariableValue);
|
|
515
532
|
}
|
|
516
533
|
|
|
517
534
|
GUILayout.EndHorizontal();
|
|
518
535
|
}
|
|
519
536
|
|
|
537
|
+
|
|
520
538
|
/*删除*/
|
|
521
539
|
if (_cachePresetDelete != null)
|
|
522
540
|
{
|
package/Editor/PublishTool.cs
CHANGED
|
@@ -11,7 +11,7 @@ namespace TyphoonUnitySDK
|
|
|
11
11
|
/// </summary>
|
|
12
12
|
public interface IPublish
|
|
13
13
|
{
|
|
14
|
-
|
|
14
|
+
void Publish(PublishSetting setting);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
public class PublishTool
|
|
@@ -25,8 +25,8 @@ namespace TyphoonUnitySDK
|
|
|
25
25
|
{ PublishProcess.WxMini, "TyphoonUnitySDK.PublishWxMini" },
|
|
26
26
|
{ PublishProcess.DouyinAndroid, "TyphoonUnitySDK.PublishDouyinAndroid" },
|
|
27
27
|
{ PublishProcess.DouyinIOS, "TyphoonUnitySDK.PublishDouyinIOS" },
|
|
28
|
-
{ PublishProcess.GooglePlay, "TyphoonUnitySDK.PublishGooglePlay" }
|
|
29
|
-
|
|
28
|
+
{ PublishProcess.GooglePlay, "TyphoonUnitySDK.PublishGooglePlay" },
|
|
29
|
+
{ PublishProcess.VivoMini, "TyphoonUnitySDK.PublishVivoMini" },
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/// <summary>
|
package/Editor/PublishWindow.cs
CHANGED
|
@@ -14,7 +14,7 @@ namespace TyphoonUnitySDK
|
|
|
14
14
|
// AppChannel.GooglePlay,
|
|
15
15
|
AppChannel.SeaIOS,
|
|
16
16
|
// AppChannel.WxMini,
|
|
17
|
-
AppChannel.VivoMini,
|
|
17
|
+
// AppChannel.VivoMini,
|
|
18
18
|
AppChannel.OppoMini,
|
|
19
19
|
// AppChannel.DouyinAndroid,
|
|
20
20
|
// AppChannel.DouyinIOS,
|
|
@@ -289,9 +289,7 @@ namespace TyphoonUnitySDK
|
|
|
289
289
|
if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save)))
|
|
290
290
|
{
|
|
291
291
|
EditorUtility.SetDirty(_select);
|
|
292
|
-
|
|
293
|
-
WxMiniConfig.Default.Save();
|
|
294
|
-
DouyinConfig.Default.Save();
|
|
292
|
+
ApplyTool.SaveAllChannelConfig();
|
|
295
293
|
AssetDatabase.SaveAssets();
|
|
296
294
|
}
|
|
297
295
|
|