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
package/Editor/UniEditor.cs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
|
+
using System.Diagnostics;
|
|
3
4
|
using System.IO;
|
|
4
5
|
using System.Linq;
|
|
5
6
|
using System.Text;
|
|
7
|
+
using System.Threading.Tasks;
|
|
6
8
|
using UnityEditor;
|
|
7
9
|
using UnityEngine;
|
|
10
|
+
using Debug = UnityEngine.Debug;
|
|
11
|
+
using AlphaDirectory = Alphaleonis.Win32.Filesystem.Directory;
|
|
8
12
|
|
|
9
13
|
namespace TyphoonUnitySDK
|
|
10
14
|
{
|
|
@@ -44,6 +48,12 @@ namespace TyphoonUnitySDK
|
|
|
44
48
|
/// </summary>
|
|
45
49
|
public static string PackagePath_GooglePlay = $"{PathRoot}/Sources~/Package/GooglePlay.unitypackage";
|
|
46
50
|
|
|
51
|
+
/// <summary>
|
|
52
|
+
/// vivo mini 资源包
|
|
53
|
+
/// </summary>
|
|
54
|
+
public static string PackagePath_VivoMini = $"{PathRoot}/Sources~/Package/VivoMini.unitypackage";
|
|
55
|
+
|
|
56
|
+
|
|
47
57
|
/// <summary>
|
|
48
58
|
/// Toast模块
|
|
49
59
|
/// </summary>
|
|
@@ -61,6 +71,23 @@ namespace TyphoonUnitySDK
|
|
|
61
71
|
public static readonly string APPLY_HISTORY = ".typhoon/typhoon_sdk_apply_history.txt";
|
|
62
72
|
|
|
63
73
|
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// 获取windows用户名文件夹
|
|
76
|
+
/// </summary>
|
|
77
|
+
public static string GetWindowsUserFolder()
|
|
78
|
+
{
|
|
79
|
+
string userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
|
80
|
+
return userFolder;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// <summary>
|
|
84
|
+
/// 获取Windows用户名
|
|
85
|
+
/// </summary>
|
|
86
|
+
public static string GetWindowsUserName()
|
|
87
|
+
{
|
|
88
|
+
return Environment.UserName;
|
|
89
|
+
}
|
|
90
|
+
|
|
64
91
|
/// <summary>
|
|
65
92
|
/// 插件包根目录
|
|
66
93
|
/// </summary>
|
|
@@ -98,13 +125,6 @@ namespace TyphoonUnitySDK
|
|
|
98
125
|
AssetDatabase.ImportPackage(path, interactive);
|
|
99
126
|
}
|
|
100
127
|
|
|
101
|
-
// /// <summary>
|
|
102
|
-
// /// 日志输出
|
|
103
|
-
// /// </summary>
|
|
104
|
-
// public static void LogInfo(string content)
|
|
105
|
-
// {
|
|
106
|
-
// Debug.Log($"<color=#3ac9f3>{content}</color>");
|
|
107
|
-
// }
|
|
108
128
|
|
|
109
129
|
/// <summary>
|
|
110
130
|
/// 清理宏定义
|
|
@@ -201,13 +221,11 @@ namespace TyphoonUnitySDK
|
|
|
201
221
|
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
|
202
222
|
foreach (var element in assemblies)
|
|
203
223
|
{
|
|
204
|
-
var
|
|
205
|
-
|
|
224
|
+
var type = element.GetType(typeName);
|
|
225
|
+
|
|
226
|
+
if (type != null)
|
|
206
227
|
{
|
|
207
|
-
|
|
208
|
-
{
|
|
209
|
-
return type;
|
|
210
|
-
}
|
|
228
|
+
return type;
|
|
211
229
|
}
|
|
212
230
|
}
|
|
213
231
|
|
|
@@ -394,6 +412,81 @@ namespace TyphoonUnitySDK
|
|
|
394
412
|
}
|
|
395
413
|
}
|
|
396
414
|
|
|
415
|
+
|
|
416
|
+
/// <summary>
|
|
417
|
+
/// 复制文件夹,带进度
|
|
418
|
+
/// </summary>
|
|
419
|
+
public static async Task CopyFolderWithProcess(string from, string to, Action<float> onProcess, Action complete,
|
|
420
|
+
int stepUnit = 200)
|
|
421
|
+
{
|
|
422
|
+
var dir = new HashSet<string>();
|
|
423
|
+
var files = new Dictionary<string, string>();
|
|
424
|
+
GetCopyFolderManifest(from, to, dir, files);
|
|
425
|
+
var total = dir.Count + files.Count;
|
|
426
|
+
var current = 0;
|
|
427
|
+
var step = 0;
|
|
428
|
+
if (total <= 0)
|
|
429
|
+
{
|
|
430
|
+
complete?.Invoke();
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
foreach (var element in dir)
|
|
435
|
+
{
|
|
436
|
+
current += 1;
|
|
437
|
+
step += 1;
|
|
438
|
+
if (!Directory.Exists(element))
|
|
439
|
+
{
|
|
440
|
+
Directory.CreateDirectory(element);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (step > stepUnit)
|
|
444
|
+
{
|
|
445
|
+
step = 0;
|
|
446
|
+
onProcess?.Invoke((float)current / total);
|
|
447
|
+
await Task.Yield();
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
foreach (var element in files)
|
|
452
|
+
{
|
|
453
|
+
current += 1;
|
|
454
|
+
step += 1;
|
|
455
|
+
var copyFrom = element.Key;
|
|
456
|
+
var copyTo = element.Value;
|
|
457
|
+
File.Copy(copyFrom, copyTo, true);
|
|
458
|
+
if (step > stepUnit)
|
|
459
|
+
{
|
|
460
|
+
step = 0;
|
|
461
|
+
onProcess?.Invoke((float)current / total);
|
|
462
|
+
await Task.Yield();
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
complete?.Invoke();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
private static void GetCopyFolderManifest(string from, string to, HashSet<string> dirData,
|
|
471
|
+
Dictionary<string, string> filesData)
|
|
472
|
+
{
|
|
473
|
+
dirData.Add(to);
|
|
474
|
+
var info = new DirectoryInfo(from);
|
|
475
|
+
var files = info.GetFiles("*", SearchOption.TopDirectoryOnly);
|
|
476
|
+
var dir = info.GetDirectories("*", SearchOption.TopDirectoryOnly);
|
|
477
|
+
foreach (var element in files)
|
|
478
|
+
{
|
|
479
|
+
var copyTo = $"{to}/{element.Name}";
|
|
480
|
+
filesData[element.FullName] = copyTo;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
foreach (var element in dir)
|
|
484
|
+
{
|
|
485
|
+
var copyDir = $"{to}/{element.Name}";
|
|
486
|
+
GetCopyFolderManifest(element.FullName, copyDir, dirData, filesData);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
397
490
|
/// <summary>
|
|
398
491
|
/// 尝试删除文件夹
|
|
399
492
|
/// </summary>
|
|
@@ -485,5 +578,148 @@ namespace TyphoonUnitySDK
|
|
|
485
578
|
|
|
486
579
|
File.WriteAllText(path, sb.ToString());
|
|
487
580
|
}
|
|
581
|
+
|
|
582
|
+
/// <summary>
|
|
583
|
+
/// 创建openssl签名
|
|
584
|
+
/// </summary>
|
|
585
|
+
public static void CreateOpensslKeystore()
|
|
586
|
+
{
|
|
587
|
+
if (!PluginModuleInstaller.IsInstallOpenssl())
|
|
588
|
+
{
|
|
589
|
+
ShowMessageBox("缺少openssl,去安装?", () => { PluginModuleInstaller.InstallOpensslAsync(); });
|
|
590
|
+
}
|
|
591
|
+
else
|
|
592
|
+
{
|
|
593
|
+
var pluginInfo = PluginModuleInstaller.GetPluginInfo(PluginModuleInstaller.PluginNames.Openssl);
|
|
594
|
+
//删除旧签名文件
|
|
595
|
+
var private_pem = $"{pluginInfo.RootPath}/bin/private.pem";
|
|
596
|
+
var certificate_pem = $"{pluginInfo.RootPath}/bincertificate.pem";
|
|
597
|
+
if (File.Exists(private_pem))
|
|
598
|
+
{
|
|
599
|
+
File.Delete(private_pem);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if (File.Exists(certificate_pem))
|
|
603
|
+
{
|
|
604
|
+
File.Delete(certificate_pem);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
//创建签名批处理执行文件
|
|
608
|
+
var bat = $"sign/create-sign.bat";
|
|
609
|
+
CreateDirIfNotExist(Path.GetDirectoryName(bat));
|
|
610
|
+
var code = File.ReadAllText($"{PathRoot}/Editor/bats/create-sign.bat");
|
|
611
|
+
var bin = $"{pluginInfo.RootPath}/bin";
|
|
612
|
+
bin = bin.Replace("/", "\\");
|
|
613
|
+
var conf = $"{pluginInfo.RootPath}/openssl.cnf";
|
|
614
|
+
conf = conf.Replace("/", "\\");
|
|
615
|
+
code = code.Replace("$OPENSSL_BIN$", bin);
|
|
616
|
+
code = code.Replace("$OPENSSL_CONF$", conf);
|
|
617
|
+
code = code.Replace("$SIGN$", $"{ToWindowsExplorerFullPath("sign")}");
|
|
618
|
+
File.WriteAllText(bat, code);
|
|
619
|
+
if (!File.Exists(bat))
|
|
620
|
+
{
|
|
621
|
+
throw new Exception($"创建{bat}失败");
|
|
622
|
+
}
|
|
623
|
+
else
|
|
624
|
+
{
|
|
625
|
+
RunBat(bat);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
/// <summary>
|
|
632
|
+
/// 转windows全路径
|
|
633
|
+
/// </summary>
|
|
634
|
+
public static string ToWindowsExplorerFullPath(string path)
|
|
635
|
+
{
|
|
636
|
+
return Path.GetFullPath(path).Replace("/", "\\");
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/// <summary>
|
|
640
|
+
/// 转untiy全路径
|
|
641
|
+
/// </summary>
|
|
642
|
+
public static string ToUnityRelativePath(string path)
|
|
643
|
+
{
|
|
644
|
+
return Path.GetFullPath(path).Replace("/", "\\").Replace(
|
|
645
|
+
$"{Path.GetDirectoryName(Application.dataPath)}\\", "")
|
|
646
|
+
.Replace("\\", "/");
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// /// <summary>
|
|
650
|
+
// /// 执行批处理
|
|
651
|
+
// /// </summary>
|
|
652
|
+
// public static void RunBat(string path, string args = "", Action complete = null)
|
|
653
|
+
// {
|
|
654
|
+
// using (var process = Process.Start("explorer", $"\"{Path.GetFullPath(path)}\" {args}"))
|
|
655
|
+
// {
|
|
656
|
+
// }
|
|
657
|
+
//
|
|
658
|
+
// }
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
/// <summary>
|
|
662
|
+
/// 执行批处理
|
|
663
|
+
/// </summary>
|
|
664
|
+
public static void RunBat(string batFile)
|
|
665
|
+
{
|
|
666
|
+
if (!File.Exists(batFile))
|
|
667
|
+
{
|
|
668
|
+
Debug.LogError("bat文件不存在:" + batFile);
|
|
669
|
+
}
|
|
670
|
+
else
|
|
671
|
+
{
|
|
672
|
+
var workingDir = Path.GetDirectoryName(batFile);
|
|
673
|
+
var fileName = Path.GetFileName(batFile);
|
|
674
|
+
Process proc = null;
|
|
675
|
+
try
|
|
676
|
+
{
|
|
677
|
+
proc = new Process();
|
|
678
|
+
proc.StartInfo.WorkingDirectory = workingDir;
|
|
679
|
+
proc.StartInfo.FileName = fileName;
|
|
680
|
+
// proc.StartInfo.RedirectStandardOutput = true;
|
|
681
|
+
// proc.StartInfo.UseShellExecute = false;
|
|
682
|
+
//proc.StartInfo.Arguments = args;
|
|
683
|
+
//proc.StartInfo.CreateNoWindow = true;
|
|
684
|
+
//proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//disable dos window
|
|
685
|
+
proc.Start();
|
|
686
|
+
proc.WaitForExit();
|
|
687
|
+
proc.Close();
|
|
688
|
+
// var output = proc.StandardOutput.ReadToEnd();
|
|
689
|
+
// Debug.Log(output);
|
|
690
|
+
}
|
|
691
|
+
catch (Exception ex)
|
|
692
|
+
{
|
|
693
|
+
Debug.LogFormat("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
/// <summary>
|
|
700
|
+
/// 删除文件夹适配长路径
|
|
701
|
+
/// </summary>
|
|
702
|
+
public static void DeleteFolder(string path, bool recursive = true)
|
|
703
|
+
{
|
|
704
|
+
var fullPath = Path.GetFullPath(path);
|
|
705
|
+
fullPath = fullPath.Replace("/", "\\");
|
|
706
|
+
if (Directory.Exists(fullPath))
|
|
707
|
+
{
|
|
708
|
+
AlphaDirectory.Delete(fullPath, recursive);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/// <summary>
|
|
713
|
+
/// 删除文件,适配长路径
|
|
714
|
+
/// </summary>
|
|
715
|
+
public static void DeleteFile(string path)
|
|
716
|
+
{
|
|
717
|
+
var fullPath = Path.GetFullPath(path);
|
|
718
|
+
fullPath = fullPath.Replace("/", "\\");
|
|
719
|
+
if (File.Exists(fullPath))
|
|
720
|
+
{
|
|
721
|
+
Alphaleonis.Win32.Filesystem.File.Delete(path, true);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
488
724
|
}
|
|
489
725
|
}
|