com.typhoon.unitysdk 1.0.34 → 1.0.35
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 +29 -6
- package/Editor/ExportModule.cs +22 -0
- package/Editor/GUIDrawer.cs +22 -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 +432 -0
- package/Editor/PluginModuleInstaller.cs.meta +11 -0
- package/Editor/PublishSetting.cs +3 -0
- package/Editor/PublishSettingGUIDrawer.cs +19 -1
- package/Editor/PublishWindow.cs +1 -1
- package/Editor/UniEditor.cs +164 -7
- package/Editor/VivoMiniConfig.cs +301 -0
- package/Editor/VivoMiniConfig.cs.meta +11 -0
- package/Editor/WxMiniConfig.cs +4 -19
- package/Editor/XGameDotNetZip.dll +0 -0
- package/Editor/XGameDotNetZip.dll.meta +33 -0
- package/Editor/ZipTool.cs +78 -0
- package/Editor/ZipTool.cs.meta +11 -0
- package/Editor/bats/create-sign.bat +12 -0
- package/Editor/bats/create-sign.bat.meta +7 -0
- package/Editor/bats.meta +8 -0
- package/Runtime/BaseSdk.cs +64 -0
- 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 +42 -0
- package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
- package/Sources~/Package/VivoMini.unitypackage +0 -0
- package/Sources~/Package/VivoMini.unitypackage.manifest +17 -0
- package/package.json +1 -1
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;
|
package/Editor/PublishWindow.cs
CHANGED
package/Editor/UniEditor.cs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
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;
|
|
6
7
|
using UnityEditor;
|
|
7
8
|
using UnityEngine;
|
|
9
|
+
using Debug = UnityEngine.Debug;
|
|
8
10
|
|
|
9
11
|
namespace TyphoonUnitySDK
|
|
10
12
|
{
|
|
@@ -44,6 +46,12 @@ namespace TyphoonUnitySDK
|
|
|
44
46
|
/// </summary>
|
|
45
47
|
public static string PackagePath_GooglePlay = $"{PathRoot}/Sources~/Package/GooglePlay.unitypackage";
|
|
46
48
|
|
|
49
|
+
/// <summary>
|
|
50
|
+
/// vivo mini 资源包
|
|
51
|
+
/// </summary>
|
|
52
|
+
public static string PackagePath_VivoMini = $"{PathRoot}/Sources~/Package/VivoMini.unitypackage";
|
|
53
|
+
|
|
54
|
+
|
|
47
55
|
/// <summary>
|
|
48
56
|
/// Toast模块
|
|
49
57
|
/// </summary>
|
|
@@ -61,6 +69,23 @@ namespace TyphoonUnitySDK
|
|
|
61
69
|
public static readonly string APPLY_HISTORY = ".typhoon/typhoon_sdk_apply_history.txt";
|
|
62
70
|
|
|
63
71
|
|
|
72
|
+
/// <summary>
|
|
73
|
+
/// 获取windows用户名文件夹
|
|
74
|
+
/// </summary>
|
|
75
|
+
public static string GetWindowsUserFolder()
|
|
76
|
+
{
|
|
77
|
+
string userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
|
78
|
+
return userFolder;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// <summary>
|
|
82
|
+
/// 获取Windows用户名
|
|
83
|
+
/// </summary>
|
|
84
|
+
public static string GetWindowsUserName()
|
|
85
|
+
{
|
|
86
|
+
return Environment.UserName;
|
|
87
|
+
}
|
|
88
|
+
|
|
64
89
|
/// <summary>
|
|
65
90
|
/// 插件包根目录
|
|
66
91
|
/// </summary>
|
|
@@ -98,13 +123,6 @@ namespace TyphoonUnitySDK
|
|
|
98
123
|
AssetDatabase.ImportPackage(path, interactive);
|
|
99
124
|
}
|
|
100
125
|
|
|
101
|
-
// /// <summary>
|
|
102
|
-
// /// 日志输出
|
|
103
|
-
// /// </summary>
|
|
104
|
-
// public static void LogInfo(string content)
|
|
105
|
-
// {
|
|
106
|
-
// Debug.Log($"<color=#3ac9f3>{content}</color>");
|
|
107
|
-
// }
|
|
108
126
|
|
|
109
127
|
/// <summary>
|
|
110
128
|
/// 清理宏定义
|
|
@@ -485,5 +503,144 @@ namespace TyphoonUnitySDK
|
|
|
485
503
|
|
|
486
504
|
File.WriteAllText(path, sb.ToString());
|
|
487
505
|
}
|
|
506
|
+
|
|
507
|
+
/// <summary>
|
|
508
|
+
/// 创建openssl签名
|
|
509
|
+
/// </summary>
|
|
510
|
+
public static void CreateOpensslKeystore()
|
|
511
|
+
{
|
|
512
|
+
if (!PluginModuleInstaller.IsInstallOpenssl())
|
|
513
|
+
{
|
|
514
|
+
ShowMessageBox("缺少openssl,去安装?", () => { PluginModuleInstaller.InstallOpensslAsync(); });
|
|
515
|
+
}
|
|
516
|
+
else
|
|
517
|
+
{
|
|
518
|
+
var pluginInfo = PluginModuleInstaller.GetPluginInfo(PluginModuleInstaller.PluginNames.Openssl);
|
|
519
|
+
//删除旧签名文件
|
|
520
|
+
var private_pem = $"{pluginInfo.RootPath}/bin/private.pem";
|
|
521
|
+
var certificate_pem = $"{pluginInfo.RootPath}/bincertificate.pem";
|
|
522
|
+
if (File.Exists(private_pem))
|
|
523
|
+
{
|
|
524
|
+
File.Delete(private_pem);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (File.Exists(certificate_pem))
|
|
528
|
+
{
|
|
529
|
+
File.Delete(certificate_pem);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
//创建签名批处理执行文件
|
|
533
|
+
var bat = $"sign/create-sign.bat";
|
|
534
|
+
CreateDirIfNotExist(Path.GetDirectoryName(bat));
|
|
535
|
+
var code = File.ReadAllText($"{PathRoot}/Editor/bats/create-sign.bat");
|
|
536
|
+
var bin = $"{pluginInfo.RootPath}/bin";
|
|
537
|
+
bin = bin.Replace("/", "\\");
|
|
538
|
+
var conf = $"{pluginInfo.RootPath}/openssl.cnf";
|
|
539
|
+
conf = conf.Replace("/", "\\");
|
|
540
|
+
code = code.Replace("$OPENSSL_BIN$", bin);
|
|
541
|
+
code = code.Replace("$OPENSSL_CONF$", conf);
|
|
542
|
+
File.WriteAllText(bat, code);
|
|
543
|
+
if (!File.Exists(bat))
|
|
544
|
+
{
|
|
545
|
+
throw new Exception($"创建{bat}失败");
|
|
546
|
+
}
|
|
547
|
+
else
|
|
548
|
+
{
|
|
549
|
+
RunBat(bat);
|
|
550
|
+
// if (File.Exists(private_pem) && File.Exists(certificate_pem))
|
|
551
|
+
// {
|
|
552
|
+
// var private_pem_to = $"sign/{Path.GetFileName(private_pem)}";
|
|
553
|
+
// var certificate_pem_to = $"sign/{Path.GetFileName(certificate_pem)}";
|
|
554
|
+
// File.Copy(private_pem, private_pem_to, true);
|
|
555
|
+
// File.Copy(certificate_pem, certificate_pem_to, true);
|
|
556
|
+
// Debug.Log("生成成功");
|
|
557
|
+
// }
|
|
558
|
+
// else
|
|
559
|
+
// {
|
|
560
|
+
// throw new Exception($"生成失败,找不到:{private_pem} 或 {certificate_pem}");
|
|
561
|
+
// }
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
/// <summary>
|
|
568
|
+
/// 执行批处理
|
|
569
|
+
/// </summary>
|
|
570
|
+
public static void RunBat(string path, string args = "", Action complete = null)
|
|
571
|
+
{
|
|
572
|
+
// var bat = Path.GetFullPath(path);
|
|
573
|
+
// var dir = Path.GetDirectoryName(bat);
|
|
574
|
+
// using (Process p = new Process())
|
|
575
|
+
// {
|
|
576
|
+
// p.StartInfo.FileName = bat;
|
|
577
|
+
// p.StartInfo.Arguments = args;
|
|
578
|
+
// p.StartInfo.CreateNoWindow = false;
|
|
579
|
+
// p.StartInfo.UseShellExecute = false;
|
|
580
|
+
// p.StartInfo.RedirectStandardOutput = true;
|
|
581
|
+
// p.StartInfo.WorkingDirectory = dir;
|
|
582
|
+
// p.Start();
|
|
583
|
+
// p.WaitForExit();
|
|
584
|
+
// UnityEngine.Debug.Log(p.StandardOutput.ReadToEnd());
|
|
585
|
+
// p.Close();
|
|
586
|
+
// complete?.Invoke();
|
|
587
|
+
// }
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
using (var process = Process.Start("explorer", $"\"{Path.GetFullPath(path)}\" {args}"))
|
|
591
|
+
{
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
/// <summary>
|
|
597
|
+
/// 执行批处理
|
|
598
|
+
/// </summary>
|
|
599
|
+
public static void Run(string batPath, params string[] args)
|
|
600
|
+
{
|
|
601
|
+
//获取批处理
|
|
602
|
+
if (!File.Exists(batPath))
|
|
603
|
+
{
|
|
604
|
+
throw new Exception($"丢失 {batPath}");
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
string inputArg = string.Empty;
|
|
608
|
+
if (args != null)
|
|
609
|
+
{
|
|
610
|
+
StringBuilder sb = new StringBuilder();
|
|
611
|
+
foreach (var element in args)
|
|
612
|
+
{
|
|
613
|
+
sb.Append(element);
|
|
614
|
+
sb.Append(',');
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
inputArg = sb.ToString();
|
|
618
|
+
if (inputArg.EndsWith(","))
|
|
619
|
+
{
|
|
620
|
+
inputArg.Remove(inputArg.Length - 1, 1);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
FileInfo info = new FileInfo(batPath);
|
|
625
|
+
batPath = info.FullName;
|
|
626
|
+
try
|
|
627
|
+
{
|
|
628
|
+
using (Process proc = new Process())
|
|
629
|
+
{
|
|
630
|
+
proc.StartInfo.FileName = batPath;
|
|
631
|
+
proc.StartInfo.WorkingDirectory = info.Directory.FullName;
|
|
632
|
+
if (inputArg.Length > 0)
|
|
633
|
+
{
|
|
634
|
+
proc.StartInfo.Arguments = inputArg;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
proc.Start();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
catch (Exception ex)
|
|
641
|
+
{
|
|
642
|
+
Console.WriteLine("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
|
|
643
|
+
}
|
|
644
|
+
}
|
|
488
645
|
}
|
|
489
646
|
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using System.Text;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace TyphoonUnitySDK
|
|
10
|
+
{
|
|
11
|
+
/*微信小游戏配置GUI绘制*/
|
|
12
|
+
public static class VivoMiniConfigGUIDrawer
|
|
13
|
+
{
|
|
14
|
+
//微信小游戏进阶设置
|
|
15
|
+
private static bool _wxMiniConfigAdvanceFoldout = false;
|
|
16
|
+
|
|
17
|
+
public static Dictionary<string, Func<VivoMiniConfig, bool>> OverrideDrawGUIConfig =
|
|
18
|
+
new Dictionary<string, Func<VivoMiniConfig, bool>>()
|
|
19
|
+
{
|
|
20
|
+
{ "m_Script", DrawProperty_m_Script },
|
|
21
|
+
{ nameof(VivoMiniConfig.PackageName), DrawProperty_PackageName },
|
|
22
|
+
{ nameof(VivoMiniConfig.GameName), DrawProperty_GameName },
|
|
23
|
+
{ nameof(VivoMiniConfig.GameIcon), DrawProperty_GameIcon },
|
|
24
|
+
{ nameof(VivoMiniConfig.LoadBackground), DrawProperty_LoadBackground },
|
|
25
|
+
{ nameof(VivoMiniConfig.ScreenOrientation), DrawProperty_ScreenOrientation },
|
|
26
|
+
{ nameof(VivoMiniConfig.LimitFps), DrawProperty_LimitFps },
|
|
27
|
+
{ nameof(VivoMiniConfig.FrameRate), DrawProperty_FrameRate },
|
|
28
|
+
{ nameof(VivoMiniConfig.VersionName), DrawProperty_VersionName },
|
|
29
|
+
{ nameof(VivoMiniConfig.VersionCode), DrawProperty_VersionCode },
|
|
30
|
+
{ nameof(VivoMiniConfig.CDN), DrawProperty_CDN },
|
|
31
|
+
{ nameof(VivoMiniConfig.PrivatePem), DrawProperty_PrivatePem },
|
|
32
|
+
{ nameof(VivoMiniConfig.CertificatePem), DrawProperty_CertificatePem },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
private static bool DrawProperty_CertificatePem(VivoMiniConfig arg)
|
|
36
|
+
{
|
|
37
|
+
GUILayout.BeginHorizontal();
|
|
38
|
+
arg.CertificatePem = EditorGUILayout.TextField("certificate.pem", arg.CertificatePem);
|
|
39
|
+
if (GUILayout.Button("选择", GUILayout.Width(60)))
|
|
40
|
+
{
|
|
41
|
+
var file = EditorUtility.OpenFilePanel("请选择certificate.pem", Application.dataPath, ".pem");
|
|
42
|
+
arg.CertificatePem = file;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
GUILayout.EndHorizontal();
|
|
46
|
+
GUIDrawer.DrawKeynotes("温馨提示:签名文件记得做好备份,后续上架需要保持签名一致");
|
|
47
|
+
GUILayout.Label("", GUILayout.Height(26));
|
|
48
|
+
var last = GUILayoutUtility.GetLastRect();
|
|
49
|
+
var center = last.center;
|
|
50
|
+
var btnNewRect = last;
|
|
51
|
+
btnNewRect.width = 100;
|
|
52
|
+
btnNewRect.height -= 4;
|
|
53
|
+
btnNewRect.center = center;
|
|
54
|
+
btnNewRect.x = last.xMax - btnNewRect.width - 2;
|
|
55
|
+
if (GUI.Button(btnNewRect, "创建签名", Styles.rbutton_bold))
|
|
56
|
+
{
|
|
57
|
+
//创建openssl 签名
|
|
58
|
+
UniEditor.CreateOpensslKeystore();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private static bool DrawProperty_PrivatePem(VivoMiniConfig arg)
|
|
65
|
+
{
|
|
66
|
+
GUILayout.Space(10);
|
|
67
|
+
|
|
68
|
+
GUILayout.Label("签名", Styles.rbold_title);
|
|
69
|
+
GUILayout.BeginHorizontal();
|
|
70
|
+
arg.PrivatePem = EditorGUILayout.TextField("private.pem", arg.PrivatePem);
|
|
71
|
+
if (GUILayout.Button("选择", GUILayout.Width(60)))
|
|
72
|
+
{
|
|
73
|
+
var file = EditorUtility.OpenFilePanel("请选择private.pem", Application.dataPath, ".pem");
|
|
74
|
+
arg.PrivatePem = file;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
GUILayout.EndHorizontal();
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private static bool DrawProperty_VersionCode(VivoMiniConfig arg)
|
|
82
|
+
{
|
|
83
|
+
arg.VersionCode = EditorGUILayout.IntField("版本号", arg.VersionCode);
|
|
84
|
+
GUILayout.Label("", GUILayout.Height(24));
|
|
85
|
+
var last = GUILayoutUtility.GetLastRect();
|
|
86
|
+
var rectBtn = last;
|
|
87
|
+
rectBtn.width = 120;
|
|
88
|
+
rectBtn.y += 2;
|
|
89
|
+
rectBtn.x = last.xMax - rectBtn.width;
|
|
90
|
+
rectBtn.x -= 2;
|
|
91
|
+
if (GUI.Button(rectBtn, "自动版本号", Styles.rbutton_bold))
|
|
92
|
+
{
|
|
93
|
+
arg.VersionCode += 1;
|
|
94
|
+
try
|
|
95
|
+
{
|
|
96
|
+
var elements = arg.VersionName.Split('.').ToList();
|
|
97
|
+
var num = int.Parse(elements.Last());
|
|
98
|
+
num += 1;
|
|
99
|
+
elements[elements.Count - 1] = num.ToString();
|
|
100
|
+
var versionName = new StringBuilder();
|
|
101
|
+
for (var i = 0; i < elements.Count; i++)
|
|
102
|
+
{
|
|
103
|
+
var e = elements[i];
|
|
104
|
+
versionName.Append(e);
|
|
105
|
+
if (i != elements.Count - 1)
|
|
106
|
+
{
|
|
107
|
+
versionName.Append(".");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
arg.VersionName = versionName.ToString();
|
|
112
|
+
}
|
|
113
|
+
catch (Exception e)
|
|
114
|
+
{
|
|
115
|
+
arg.VersionName = "0.0.1";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
GUI.FocusControl("");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private static bool DrawProperty_VersionName(VivoMiniConfig arg)
|
|
125
|
+
{
|
|
126
|
+
GUILayout.Space(10);
|
|
127
|
+
GUILayout.Label("版本信息", Styles.rbold_title);
|
|
128
|
+
arg.VersionName = EditorGUILayout.TextField("版本名", arg.VersionName);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private static bool DrawProperty_FrameRate(VivoMiniConfig arg)
|
|
133
|
+
{
|
|
134
|
+
if (!arg.LimitFps)
|
|
135
|
+
{
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
arg.FrameRate = EditorGUILayout.IntSlider("目标FPS", arg.FrameRate, 30, 60);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private static bool DrawProperty_LimitFps(VivoMiniConfig arg)
|
|
144
|
+
{
|
|
145
|
+
GUILayout.BeginHorizontal();
|
|
146
|
+
GUILayout.Label("限制帧率(偶发动画抖动可降低帧率到30)", GUILayout.Width(260));
|
|
147
|
+
GUIDrawer.DrawPopUpToggle(arg.LimitFps, (b) => { arg.LimitFps = b; });
|
|
148
|
+
GUILayout.EndHorizontal();
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private static bool DrawProperty_LoadBackground(VivoMiniConfig arg)
|
|
153
|
+
{
|
|
154
|
+
arg.LoadBackground =
|
|
155
|
+
(Texture)EditorGUILayout.ObjectField("加载背景(可选)", arg.LoadBackground, typeof(Texture), false);
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private static bool DrawProperty_GameIcon(VivoMiniConfig arg)
|
|
160
|
+
{
|
|
161
|
+
arg.GameIcon =
|
|
162
|
+
(Texture)EditorGUILayout.ObjectField("游戏ICON (<100K)(可选)", arg.GameIcon, typeof(Texture), false);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private static bool DrawProperty_GameName(VivoMiniConfig arg)
|
|
167
|
+
{
|
|
168
|
+
arg.GameName = EditorGUILayout.TextField("游戏名 (问运营)", arg.GameName);
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private static bool DrawProperty_PackageName(VivoMiniConfig arg)
|
|
173
|
+
{
|
|
174
|
+
arg.PackageName = EditorGUILayout.TextField("包名 (问运营)", arg.PackageName);
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private static bool DrawProperty_m_Script(VivoMiniConfig arg)
|
|
179
|
+
{
|
|
180
|
+
var tmpEnable = GUI.enabled;
|
|
181
|
+
GUI.enabled = true;
|
|
182
|
+
GUILayout.Space(6);
|
|
183
|
+
GUIDrawer.DrawKeynotes("①支持Unity版本:2019,2020,2021(推荐,支持ASTC压缩,坑最少)");
|
|
184
|
+
GUIDrawer.DrawKeynotes("②需要隐私协议,适龄提醒,详情问运营同学");
|
|
185
|
+
GUIDrawer.DrawKeynotes("③webgl不支持多线程,修改代码进行适配");
|
|
186
|
+
GUILayout.Space(6);
|
|
187
|
+
GUI.enabled = tmpEnable;
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
private static bool DrawProperty_CDN(VivoMiniConfig arg)
|
|
192
|
+
{
|
|
193
|
+
GUILayout.Space(10);
|
|
194
|
+
GUILayout.BeginHorizontal();
|
|
195
|
+
arg.CDN = EditorGUILayout.TextField("CDN地址 (后台配白名单)", arg.CDN);
|
|
196
|
+
GUILayout.EndHorizontal();
|
|
197
|
+
GUIDrawer.DrawKeynotes("支持与自定义变量,版本号拼接,填入'[版本号]'或'[变量名]'使用");
|
|
198
|
+
GUIDrawer.DrawKeynotes($"最终地址:{arg.GetFinalCDN()}");
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private static bool DrawProperty_ScreenOrientation(VivoMiniConfig arg)
|
|
203
|
+
{
|
|
204
|
+
GUILayout.BeginHorizontal();
|
|
205
|
+
GUILayout.Label("屏幕朝向", GUILayout.Width(146));
|
|
206
|
+
if (GUILayout.Button(arg.ScreenOrientation == Orientation.Portrait ? "竖屏" : "横屏", "PopUp"))
|
|
207
|
+
{
|
|
208
|
+
var menu = new GenericMenu();
|
|
209
|
+
menu.AddItem(new GUIContent("竖屏"), false, () =>
|
|
210
|
+
{
|
|
211
|
+
arg.ScreenOrientation = Orientation.Portrait;
|
|
212
|
+
arg.Save();
|
|
213
|
+
});
|
|
214
|
+
menu.AddItem(new GUIContent("横屏"), false, () =>
|
|
215
|
+
{
|
|
216
|
+
arg.ScreenOrientation = Orientation.Landscape;
|
|
217
|
+
arg.Save();
|
|
218
|
+
});
|
|
219
|
+
menu.ShowAsContext();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
GUILayout.EndHorizontal();
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
public static void DrawGUI()
|
|
227
|
+
{
|
|
228
|
+
var config = VivoMiniConfig.Default;
|
|
229
|
+
GUIDrawer.DrawProperty(config, (property) =>
|
|
230
|
+
{
|
|
231
|
+
if (OverrideDrawGUIConfig.TryGetValue(property, out var match))
|
|
232
|
+
{
|
|
233
|
+
return match.Invoke(config);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return false;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/// <summary>
|
|
242
|
+
/// vivo mini 参数
|
|
243
|
+
/// </summary>
|
|
244
|
+
public class VivoMiniConfig : ScriptableObject
|
|
245
|
+
{
|
|
246
|
+
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/VivoMiniConfig.asset";
|
|
247
|
+
|
|
248
|
+
private static VivoMiniConfig _instance = null;
|
|
249
|
+
|
|
250
|
+
public static VivoMiniConfig Default
|
|
251
|
+
{
|
|
252
|
+
get
|
|
253
|
+
{
|
|
254
|
+
if (_instance == null)
|
|
255
|
+
{
|
|
256
|
+
_instance = AssetDatabase.LoadAssetAtPath<VivoMiniConfig>(ConfigPath);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (_instance == null)
|
|
260
|
+
{
|
|
261
|
+
_instance = CreateInstance<VivoMiniConfig>();
|
|
262
|
+
var folder = Path.GetDirectoryName(ConfigPath);
|
|
263
|
+
if (!Directory.Exists(folder))
|
|
264
|
+
{
|
|
265
|
+
Directory.CreateDirectory(folder);
|
|
266
|
+
AssetDatabase.Refresh();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
AssetDatabase.CreateAsset(_instance, ConfigPath);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return _instance;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
public string PackageName = ""; //包名
|
|
277
|
+
public string GameName = ""; //游戏名
|
|
278
|
+
public Texture GameIcon; //logo
|
|
279
|
+
public Texture LoadBackground; //加载背景
|
|
280
|
+
public Orientation ScreenOrientation = Orientation.Portrait; //屏幕朝向
|
|
281
|
+
public bool LimitFps = false;
|
|
282
|
+
public int FrameRate = 60;
|
|
283
|
+
public string PrivatePem = "";
|
|
284
|
+
public string CertificatePem = "";
|
|
285
|
+
public string VersionName = "0.0.1"; //版本名
|
|
286
|
+
public int VersionCode = 1; //版本号
|
|
287
|
+
public string CDN = "https://xxx.xx.xx";
|
|
288
|
+
|
|
289
|
+
public string GetFinalCDN()
|
|
290
|
+
{
|
|
291
|
+
var result = CDN.Replace("[版本号]", VersionCode.ToString());
|
|
292
|
+
return VariablePreset.Default.ParserToString(result);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public void Save()
|
|
296
|
+
{
|
|
297
|
+
EditorUtility.SetDirty(this);
|
|
298
|
+
AssetDatabase.SaveAssets();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
package/Editor/WxMiniConfig.cs
CHANGED
|
@@ -128,17 +128,17 @@ namespace TyphoonUnitySDK
|
|
|
128
128
|
{
|
|
129
129
|
GUILayout.BeginHorizontal();
|
|
130
130
|
GUILayout.Label("屏幕朝向", GUILayout.Width(146));
|
|
131
|
-
if (GUILayout.Button(arg.ScreenOrientation ==
|
|
131
|
+
if (GUILayout.Button(arg.ScreenOrientation == Orientation.Portrait ? "竖屏" : "横屏", "PopUp"))
|
|
132
132
|
{
|
|
133
133
|
var menu = new GenericMenu();
|
|
134
134
|
menu.AddItem(new GUIContent("竖屏"), false, () =>
|
|
135
135
|
{
|
|
136
|
-
arg.ScreenOrientation =
|
|
136
|
+
arg.ScreenOrientation = Orientation.Portrait;
|
|
137
137
|
arg.Save();
|
|
138
138
|
});
|
|
139
139
|
menu.AddItem(new GUIContent("横屏"), false, () =>
|
|
140
140
|
{
|
|
141
|
-
arg.ScreenOrientation =
|
|
141
|
+
arg.ScreenOrientation = Orientation.Landscape;
|
|
142
142
|
arg.Save();
|
|
143
143
|
});
|
|
144
144
|
menu.ShowAsContext();
|
|
@@ -161,7 +161,7 @@ namespace TyphoonUnitySDK
|
|
|
161
161
|
return true;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
public static void
|
|
164
|
+
public static void DrawGUI()
|
|
165
165
|
{
|
|
166
166
|
var config = WxMiniConfig.Default;
|
|
167
167
|
GUIDrawer.DrawProperty(config, (property) =>
|
|
@@ -236,21 +236,6 @@ namespace TyphoonUnitySDK
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
|
|
239
|
-
/// <summary>
|
|
240
|
-
/// 朝向
|
|
241
|
-
/// </summary>
|
|
242
|
-
public enum Orientation
|
|
243
|
-
{
|
|
244
|
-
//横屏
|
|
245
|
-
Portrait,
|
|
246
|
-
|
|
247
|
-
//竖屏
|
|
248
|
-
Landscape,
|
|
249
|
-
|
|
250
|
-
LandscapeLeft,
|
|
251
|
-
LandscapeRight,
|
|
252
|
-
}
|
|
253
|
-
|
|
254
239
|
[Header("基础设置")] public string AppId = "";
|
|
255
240
|
public string ProjectName = "";
|
|
256
241
|
[Header("广告参数(不填不开启)")] public string BannerAdUnit = "";
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 9fb5c535314e7c5469ecbc923f1b27b4
|
|
3
|
+
PluginImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
iconMap: {}
|
|
7
|
+
executionOrder: {}
|
|
8
|
+
defineConstraints: []
|
|
9
|
+
isPreloaded: 0
|
|
10
|
+
isOverridable: 0
|
|
11
|
+
isExplicitlyReferenced: 0
|
|
12
|
+
validateReferences: 1
|
|
13
|
+
platformData:
|
|
14
|
+
- first:
|
|
15
|
+
Any:
|
|
16
|
+
second:
|
|
17
|
+
enabled: 0
|
|
18
|
+
settings: {}
|
|
19
|
+
- first:
|
|
20
|
+
Editor: Editor
|
|
21
|
+
second:
|
|
22
|
+
enabled: 1
|
|
23
|
+
settings:
|
|
24
|
+
DefaultValueInitialized: true
|
|
25
|
+
- first:
|
|
26
|
+
Windows Store Apps: WindowsStoreApps
|
|
27
|
+
second:
|
|
28
|
+
enabled: 0
|
|
29
|
+
settings:
|
|
30
|
+
CPU: AnyCPU
|
|
31
|
+
userData:
|
|
32
|
+
assetBundleName:
|
|
33
|
+
assetBundleVariant:
|