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,436 @@
|
|
|
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
|
+
{ nameof(VivoMiniConfig.BannerEnable), DrawProperty_BannerEnable },
|
|
34
|
+
{ nameof(VivoMiniConfig.BannerPosId), DrawProperty_BannerPosId },
|
|
35
|
+
{ nameof(VivoMiniConfig.BannerInterval), DrawProperty_BannerInterval },
|
|
36
|
+
{ nameof(VivoMiniConfig.BannerBottom), DrawProperty_BannerBottom },
|
|
37
|
+
{ nameof(VivoMiniConfig.IntersEnable), DrawProperty_IntersEnable },
|
|
38
|
+
{ nameof(VivoMiniConfig.IntersPosId), DrawProperty_IntersPosId },
|
|
39
|
+
{ nameof(VivoMiniConfig.IntersInterval), DrawProperty_IntersInterval },
|
|
40
|
+
{ nameof(VivoMiniConfig.VideoEnable), DrawProperty_VideoEnable },
|
|
41
|
+
{ nameof(VivoMiniConfig.VideoPosId), DrawProperty_VideoPosId },
|
|
42
|
+
{ nameof(VivoMiniConfig.VideoResetIntersCool), DrawProperty_VideoResetIntersCool },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
private static bool DrawProperty_VideoResetIntersCool(VivoMiniConfig arg)
|
|
46
|
+
{
|
|
47
|
+
if (!arg.VideoEnable)
|
|
48
|
+
{
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
arg.VideoResetIntersCool = EditorGUILayout.IntField("激励后x秒不弹插页(-1不控制)", arg.VideoResetIntersCool);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private static bool DrawProperty_VideoPosId(VivoMiniConfig arg)
|
|
57
|
+
{
|
|
58
|
+
if (!arg.VideoEnable)
|
|
59
|
+
{
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
arg.VideoPosId = EditorGUILayout.TextField("激励视频 PosId", arg.VideoPosId);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private static bool DrawProperty_VideoEnable(VivoMiniConfig arg)
|
|
68
|
+
{
|
|
69
|
+
GUILayout.Space(5);
|
|
70
|
+
GUILayout.BeginHorizontal();
|
|
71
|
+
GUILayout.Label("激励视频开关", GUILayout.Width(146));
|
|
72
|
+
GUIDrawer.DrawPopUpToggle(arg.VideoEnable, (v) => arg.VideoEnable = v);
|
|
73
|
+
GUILayout.EndHorizontal();
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private static bool DrawProperty_IntersInterval(VivoMiniConfig arg)
|
|
78
|
+
{
|
|
79
|
+
if (!arg.IntersEnable)
|
|
80
|
+
{
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
arg.IntersInterval = EditorGUILayout.IntField("插页冷却间隔(秒)", arg.IntersInterval);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private static bool DrawProperty_IntersPosId(VivoMiniConfig arg)
|
|
89
|
+
{
|
|
90
|
+
if (!arg.IntersEnable)
|
|
91
|
+
{
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
arg.IntersPosId = EditorGUILayout.TextField("插页 PosId", arg.IntersPosId);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private static bool DrawProperty_IntersEnable(VivoMiniConfig arg)
|
|
100
|
+
{
|
|
101
|
+
GUILayout.Space(5);
|
|
102
|
+
GUILayout.BeginHorizontal();
|
|
103
|
+
GUILayout.Label("插页开关", GUILayout.Width(146));
|
|
104
|
+
GUIDrawer.DrawPopUpToggle(arg.IntersEnable, (v) => arg.IntersEnable = v);
|
|
105
|
+
GUILayout.EndHorizontal();
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private static bool DrawProperty_BannerBottom(VivoMiniConfig arg)
|
|
110
|
+
{
|
|
111
|
+
if (!arg.BannerEnable)
|
|
112
|
+
{
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
GUILayout.BeginHorizontal();
|
|
117
|
+
GUILayout.Label("Banner样式", GUILayout.Width(146));
|
|
118
|
+
GUIDrawer.DrawPopUpToggleCustomTxt(arg.BannerBottom, (v) => arg.BannerBottom = v, "底部", "顶部");
|
|
119
|
+
GUILayout.EndHorizontal();
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private static bool DrawProperty_BannerInterval(VivoMiniConfig arg)
|
|
124
|
+
{
|
|
125
|
+
if (!arg.BannerEnable)
|
|
126
|
+
{
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
arg.BannerInterval = EditorGUILayout.IntSlider("Banner刷新间隔(秒)", arg.BannerInterval, 30, 120);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private static bool DrawProperty_BannerPosId(VivoMiniConfig arg)
|
|
135
|
+
{
|
|
136
|
+
if (!arg.BannerEnable)
|
|
137
|
+
{
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
arg.BannerPosId = EditorGUILayout.TextField("Banner PosId", arg.BannerPosId);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private static bool DrawProperty_BannerEnable(VivoMiniConfig arg)
|
|
146
|
+
{
|
|
147
|
+
GUILayout.Space(10);
|
|
148
|
+
GUILayout.Label("广告参数", Styles.rbold_title);
|
|
149
|
+
GUILayout.BeginHorizontal();
|
|
150
|
+
GUILayout.Label("Banner开关", GUILayout.Width(146));
|
|
151
|
+
GUIDrawer.DrawPopUpToggle(arg.BannerEnable, (v) => arg.BannerEnable = v);
|
|
152
|
+
GUILayout.EndHorizontal();
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private static bool DrawProperty_CertificatePem(VivoMiniConfig arg)
|
|
157
|
+
{
|
|
158
|
+
GUILayout.BeginHorizontal();
|
|
159
|
+
arg.CertificatePem = EditorGUILayout.TextField("certificate.pem", arg.CertificatePem);
|
|
160
|
+
if (GUILayout.Button("选择", GUILayout.Width(60)))
|
|
161
|
+
{
|
|
162
|
+
var file = EditorUtility.OpenFilePanel("请选择certificate.pem", Application.dataPath, "pem");
|
|
163
|
+
arg.CertificatePem = UniEditor.ToUnityRelativePath(file);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
GUILayout.EndHorizontal();
|
|
167
|
+
GUIDrawer.DrawKeynotes("温馨提示:签名文件记得做好备份,后续上架需要保持签名一致");
|
|
168
|
+
GUILayout.Label("", GUILayout.Height(26));
|
|
169
|
+
var last = GUILayoutUtility.GetLastRect();
|
|
170
|
+
var center = last.center;
|
|
171
|
+
var btnNewRect = last;
|
|
172
|
+
btnNewRect.width = 100;
|
|
173
|
+
btnNewRect.height -= 4;
|
|
174
|
+
btnNewRect.center = center;
|
|
175
|
+
btnNewRect.x = last.xMax - btnNewRect.width - 2;
|
|
176
|
+
if (GUI.Button(btnNewRect, "创建签名", Styles.rbutton_bold))
|
|
177
|
+
{
|
|
178
|
+
//创建openssl 签名
|
|
179
|
+
UniEditor.CreateOpensslKeystore();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private static bool DrawProperty_PrivatePem(VivoMiniConfig arg)
|
|
186
|
+
{
|
|
187
|
+
GUILayout.Space(10);
|
|
188
|
+
|
|
189
|
+
GUILayout.Label("签名", Styles.rbold_title);
|
|
190
|
+
GUILayout.BeginHorizontal();
|
|
191
|
+
arg.PrivatePem = EditorGUILayout.TextField("private.pem", arg.PrivatePem);
|
|
192
|
+
if (GUILayout.Button("选择", GUILayout.Width(60)))
|
|
193
|
+
{
|
|
194
|
+
var file = EditorUtility.OpenFilePanel("请选择private.pem", Application.dataPath, "pem");
|
|
195
|
+
//尝试转成相对路径
|
|
196
|
+
arg.PrivatePem = UniEditor.ToUnityRelativePath(file);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
GUILayout.EndHorizontal();
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private static bool DrawProperty_VersionCode(VivoMiniConfig arg)
|
|
204
|
+
{
|
|
205
|
+
arg.VersionCode = EditorGUILayout.IntField("版本号", arg.VersionCode);
|
|
206
|
+
GUILayout.Label("", GUILayout.Height(24));
|
|
207
|
+
var last = GUILayoutUtility.GetLastRect();
|
|
208
|
+
var rectBtn = last;
|
|
209
|
+
rectBtn.width = 120;
|
|
210
|
+
rectBtn.y += 2;
|
|
211
|
+
rectBtn.x = last.xMax - rectBtn.width;
|
|
212
|
+
rectBtn.x -= 2;
|
|
213
|
+
if (GUI.Button(rectBtn, "自动版本号", Styles.rbutton_bold))
|
|
214
|
+
{
|
|
215
|
+
arg.VersionCode += 1;
|
|
216
|
+
try
|
|
217
|
+
{
|
|
218
|
+
var elements = arg.VersionName.Split('.').ToList();
|
|
219
|
+
var num = int.Parse(elements.Last());
|
|
220
|
+
num += 1;
|
|
221
|
+
elements[elements.Count - 1] = num.ToString();
|
|
222
|
+
var versionName = new StringBuilder();
|
|
223
|
+
for (var i = 0; i < elements.Count; i++)
|
|
224
|
+
{
|
|
225
|
+
var e = elements[i];
|
|
226
|
+
versionName.Append(e);
|
|
227
|
+
if (i != elements.Count - 1)
|
|
228
|
+
{
|
|
229
|
+
versionName.Append(".");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
arg.VersionName = versionName.ToString();
|
|
234
|
+
}
|
|
235
|
+
catch (Exception e)
|
|
236
|
+
{
|
|
237
|
+
arg.VersionName = "0.0.1";
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
GUI.FocusControl("");
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private static bool DrawProperty_VersionName(VivoMiniConfig arg)
|
|
247
|
+
{
|
|
248
|
+
GUILayout.Space(10);
|
|
249
|
+
GUILayout.Label("版本信息", Styles.rbold_title);
|
|
250
|
+
arg.VersionName = EditorGUILayout.TextField("版本名", arg.VersionName);
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private static bool DrawProperty_FrameRate(VivoMiniConfig arg)
|
|
255
|
+
{
|
|
256
|
+
if (!arg.LimitFps)
|
|
257
|
+
{
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
arg.FrameRate = EditorGUILayout.IntSlider("目标FPS", arg.FrameRate, 30, 60);
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private static bool DrawProperty_LimitFps(VivoMiniConfig arg)
|
|
266
|
+
{
|
|
267
|
+
GUILayout.BeginHorizontal();
|
|
268
|
+
GUILayout.Label("限制帧率(偶发动画抖动可降低帧率到30)", GUILayout.Width(260));
|
|
269
|
+
GUIDrawer.DrawPopUpToggle(arg.LimitFps, (b) => { arg.LimitFps = b; });
|
|
270
|
+
GUILayout.EndHorizontal();
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private static bool DrawProperty_LoadBackground(VivoMiniConfig arg)
|
|
275
|
+
{
|
|
276
|
+
arg.LoadBackground =
|
|
277
|
+
(Texture)EditorGUILayout.ObjectField("加载背景(可选,默认纯黑)", arg.LoadBackground, typeof(Texture), false);
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private static bool DrawProperty_GameIcon(VivoMiniConfig arg)
|
|
282
|
+
{
|
|
283
|
+
arg.GameIcon =
|
|
284
|
+
(Texture)EditorGUILayout.ObjectField("游戏ICON (<100K)(可选)", arg.GameIcon, typeof(Texture), false);
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private static bool DrawProperty_GameName(VivoMiniConfig arg)
|
|
289
|
+
{
|
|
290
|
+
arg.GameName = EditorGUILayout.TextField("游戏名 (问运营)", arg.GameName);
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
private static bool DrawProperty_PackageName(VivoMiniConfig arg)
|
|
295
|
+
{
|
|
296
|
+
arg.PackageName = EditorGUILayout.TextField("包名 (问运营)", arg.PackageName);
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private static bool DrawProperty_m_Script(VivoMiniConfig arg)
|
|
301
|
+
{
|
|
302
|
+
var tmpEnable = GUI.enabled;
|
|
303
|
+
GUI.enabled = true;
|
|
304
|
+
GUILayout.Space(6);
|
|
305
|
+
GUIDrawer.DrawKeynotes("①支持Unity版本:2019,2020,2021(推荐,支持ASTC压缩,坑最少)");
|
|
306
|
+
GUIDrawer.DrawKeynotes("②需要隐私协议,适龄提醒,详情问运营同学");
|
|
307
|
+
GUIDrawer.DrawKeynotes("③webgl不支持多线程,修改代码进行适配");
|
|
308
|
+
GUILayout.Space(6);
|
|
309
|
+
GUI.enabled = tmpEnable;
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private static bool DrawProperty_CDN(VivoMiniConfig arg)
|
|
314
|
+
{
|
|
315
|
+
GUILayout.Space(10);
|
|
316
|
+
GUILayout.BeginHorizontal();
|
|
317
|
+
arg.CDN = EditorGUILayout.TextField("CDN地址 (后台配白名单)", arg.CDN);
|
|
318
|
+
GUILayout.EndHorizontal();
|
|
319
|
+
GUIDrawer.DrawKeynotes("支持与自定义变量,版本号拼接,填入'[版本号]'或'[变量名]'使用");
|
|
320
|
+
GUIDrawer.DrawKeynotes($"最终地址:{arg.GetFinalCDN()}");
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
private static bool DrawProperty_ScreenOrientation(VivoMiniConfig arg)
|
|
325
|
+
{
|
|
326
|
+
GUILayout.BeginHorizontal();
|
|
327
|
+
GUILayout.Label("屏幕朝向", GUILayout.Width(146));
|
|
328
|
+
if (GUILayout.Button(arg.ScreenOrientation == Orientation.Portrait ? "竖屏" : "横屏", "PopUp"))
|
|
329
|
+
{
|
|
330
|
+
var menu = new GenericMenu();
|
|
331
|
+
menu.AddItem(new GUIContent("竖屏"), false, () =>
|
|
332
|
+
{
|
|
333
|
+
arg.ScreenOrientation = Orientation.Portrait;
|
|
334
|
+
arg.Save();
|
|
335
|
+
});
|
|
336
|
+
menu.AddItem(new GUIContent("横屏"), false, () =>
|
|
337
|
+
{
|
|
338
|
+
arg.ScreenOrientation = Orientation.Landscape;
|
|
339
|
+
arg.Save();
|
|
340
|
+
});
|
|
341
|
+
menu.ShowAsContext();
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
GUILayout.EndHorizontal();
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
public static void DrawGUI()
|
|
349
|
+
{
|
|
350
|
+
var config = VivoMiniConfig.Default;
|
|
351
|
+
GUIDrawer.DrawProperty(config, (property) =>
|
|
352
|
+
{
|
|
353
|
+
if (OverrideDrawGUIConfig.TryGetValue(property, out var match))
|
|
354
|
+
{
|
|
355
|
+
return match.Invoke(config);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return false;
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/// <summary>
|
|
364
|
+
/// vivo mini 参数
|
|
365
|
+
/// </summary>
|
|
366
|
+
public class VivoMiniConfig : ScriptableObject
|
|
367
|
+
{
|
|
368
|
+
private static string ConfigPath = "Assets/Typhoon_Gen/TyphoonSDK/Editor/VivoMiniConfig.asset";
|
|
369
|
+
|
|
370
|
+
private static VivoMiniConfig _instance = null;
|
|
371
|
+
|
|
372
|
+
public static VivoMiniConfig Default
|
|
373
|
+
{
|
|
374
|
+
get
|
|
375
|
+
{
|
|
376
|
+
if (_instance == null)
|
|
377
|
+
{
|
|
378
|
+
_instance = AssetDatabase.LoadAssetAtPath<VivoMiniConfig>(ConfigPath);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (_instance == null)
|
|
382
|
+
{
|
|
383
|
+
_instance = CreateInstance<VivoMiniConfig>();
|
|
384
|
+
var folder = Path.GetDirectoryName(ConfigPath);
|
|
385
|
+
if (!Directory.Exists(folder))
|
|
386
|
+
{
|
|
387
|
+
Directory.CreateDirectory(folder);
|
|
388
|
+
AssetDatabase.Refresh();
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
AssetDatabase.CreateAsset(_instance, ConfigPath);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return _instance;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
public string PackageName = ""; //包名
|
|
399
|
+
public string GameName = ""; //游戏名
|
|
400
|
+
public Texture GameIcon; //logo
|
|
401
|
+
public Texture LoadBackground; //加载背景
|
|
402
|
+
public Orientation ScreenOrientation = Orientation.Portrait; //屏幕朝向
|
|
403
|
+
public bool LimitFps = false;
|
|
404
|
+
public int FrameRate = 60;
|
|
405
|
+
public string PrivatePem = "";
|
|
406
|
+
public string CertificatePem = "";
|
|
407
|
+
public string VersionName = "0.0.1"; //版本名
|
|
408
|
+
public int VersionCode = 1; //版本号
|
|
409
|
+
public string CDN = "https://xxx.xx.xx";
|
|
410
|
+
|
|
411
|
+
[Header("广告参数")] public bool BannerEnable = false; //开关,[bool]
|
|
412
|
+
public int BannerInterval = 30; //刷新间隔(单位秒)不小于30s[number]
|
|
413
|
+
public string BannerPosId = ""; //banner广告位ID,[string]
|
|
414
|
+
public bool BannerBottom = true; //1表示底部banner,0表示顶部banner[number]
|
|
415
|
+
|
|
416
|
+
public bool IntersEnable = false; //开关[bool]
|
|
417
|
+
public int IntersInterval = 30; //插屏冷却时间(单位秒)[number]
|
|
418
|
+
public string IntersPosId = ""; //插屏广告位ID[string]
|
|
419
|
+
|
|
420
|
+
public bool VideoEnable = false; //开关[bool]
|
|
421
|
+
public int VideoResetIntersCool = 40; //播放视频广告后x秒后不弹出插页广告,-1为不控制[number]
|
|
422
|
+
public string VideoPosId = ""; //插屏广告位ID[string]
|
|
423
|
+
|
|
424
|
+
public string GetFinalCDN()
|
|
425
|
+
{
|
|
426
|
+
var result = CDN.Replace("[版本号]", VersionCode.ToString());
|
|
427
|
+
return VariablePreset.Default.ParserToString(result);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
public void Save()
|
|
431
|
+
{
|
|
432
|
+
EditorUtility.SetDirty(this);
|
|
433
|
+
AssetDatabase.SaveAssets();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
package/Editor/WxMiniConfig.cs
CHANGED
|
@@ -70,9 +70,11 @@ namespace TyphoonUnitySDK
|
|
|
70
70
|
GUILayout.BeginHorizontal();
|
|
71
71
|
arg.CDN = EditorGUILayout.TextField("CDN地址 (后台配白名单)", arg.CDN);
|
|
72
72
|
GUILayout.EndHorizontal();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
GUIDrawer.DrawKeynotes($"支持与自定义变量组合,[变量名]作为占位符\n最终地址:{VariablePreset.Default.ParserToString(arg.CDN)}");
|
|
74
|
+
// GUILayout.TextArea($"支持与自定义变量组合,[变量名]作为占位符\n最终地址:{VariablePreset.Default.ParserToString(arg.CDN)}",
|
|
75
|
+
// "helpBox",
|
|
76
|
+
// GUILayout.Height(44));
|
|
77
|
+
GUILayout.Space(5);
|
|
76
78
|
return true;
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -128,17 +130,17 @@ namespace TyphoonUnitySDK
|
|
|
128
130
|
{
|
|
129
131
|
GUILayout.BeginHorizontal();
|
|
130
132
|
GUILayout.Label("屏幕朝向", GUILayout.Width(146));
|
|
131
|
-
if (GUILayout.Button(arg.ScreenOrientation ==
|
|
133
|
+
if (GUILayout.Button(arg.ScreenOrientation == Orientation.Portrait ? "竖屏" : "横屏", "PopUp"))
|
|
132
134
|
{
|
|
133
135
|
var menu = new GenericMenu();
|
|
134
136
|
menu.AddItem(new GUIContent("竖屏"), false, () =>
|
|
135
137
|
{
|
|
136
|
-
arg.ScreenOrientation =
|
|
138
|
+
arg.ScreenOrientation = Orientation.Portrait;
|
|
137
139
|
arg.Save();
|
|
138
140
|
});
|
|
139
141
|
menu.AddItem(new GUIContent("横屏"), false, () =>
|
|
140
142
|
{
|
|
141
|
-
arg.ScreenOrientation =
|
|
143
|
+
arg.ScreenOrientation = Orientation.Landscape;
|
|
142
144
|
arg.Save();
|
|
143
145
|
});
|
|
144
146
|
menu.ShowAsContext();
|
|
@@ -161,7 +163,7 @@ namespace TyphoonUnitySDK
|
|
|
161
163
|
return true;
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
public static void
|
|
166
|
+
public static void DrawGUI()
|
|
165
167
|
{
|
|
166
168
|
var config = WxMiniConfig.Default;
|
|
167
169
|
GUIDrawer.DrawProperty(config, (property) =>
|
|
@@ -236,21 +238,6 @@ namespace TyphoonUnitySDK
|
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
|
|
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
241
|
[Header("基础设置")] public string AppId = "";
|
|
255
242
|
public string ProjectName = "";
|
|
256
243
|
[Header("广告参数(不填不开启)")] public string BannerAdUnit = "";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.IO;
|
|
4
|
+
using System.Text;
|
|
5
|
+
using xgame.Zip;
|
|
6
|
+
using xgame.Zlib;
|
|
7
|
+
|
|
8
|
+
namespace TyphoonUnitySDK
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// zip工具
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class ZipTool
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// 压缩成zip
|
|
17
|
+
/// </summary>
|
|
18
|
+
/// <param name="outputZipFile">xx.zip保存位置</param>
|
|
19
|
+
/// <param name="manifest">压缩成zip的清单,key:源文件,value:zip中的相对路径(填null或""表示不处理)</param>
|
|
20
|
+
public static void Zip(string outputZipFile, Dictionary<string, string> manifest)
|
|
21
|
+
{
|
|
22
|
+
using (ZipFile zip = new ZipFile(outputZipFile, Encoding.Default))
|
|
23
|
+
{
|
|
24
|
+
foreach (var kv in manifest)
|
|
25
|
+
{
|
|
26
|
+
var from = kv.Key;
|
|
27
|
+
var inside = kv.Value ?? "";
|
|
28
|
+
zip.AddItem(from, inside);
|
|
29
|
+
}
|
|
30
|
+
#if !UNITY_2021_1_OR_NEWER
|
|
31
|
+
zip.CompressionLevel = CompressionLevel.BestCompression;
|
|
32
|
+
#endif
|
|
33
|
+
zip.Save();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// 解压zip到指定文件夹
|
|
39
|
+
/// </summary>
|
|
40
|
+
/// <param name="zipFile">zip文件路径</param>
|
|
41
|
+
/// <param name="output">解压zip内容到指定目录(不会补充zip文件名作为目录)</param>
|
|
42
|
+
/// <param name="complete">完成回调</param>
|
|
43
|
+
/// <param name="onProcess">解压进度</param>
|
|
44
|
+
/// <exception cref="Exception"></exception>
|
|
45
|
+
public static void UnZip(string zipFile, string output, Action complete, Action<float> onProcess = null)
|
|
46
|
+
{
|
|
47
|
+
if (!zipFile.EndsWith(".zip"))
|
|
48
|
+
{
|
|
49
|
+
throw new Exception($"只支持.zip文件");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!File.Exists(zipFile))
|
|
53
|
+
{
|
|
54
|
+
throw new Exception($"找不到文件:{zipFile}");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//解压文件到目录
|
|
58
|
+
using (ZipFile zip = ZipFile.Read(Path.GetFullPath(zipFile)))
|
|
59
|
+
{
|
|
60
|
+
var totalFiles = zip.Count;
|
|
61
|
+
var filesExtracted = 0;
|
|
62
|
+
zip.ExtractProgress += (a, e) =>
|
|
63
|
+
{
|
|
64
|
+
if (e.EventType != ZipProgressEventType.Extracting_BeforeExtractEntry)
|
|
65
|
+
return;
|
|
66
|
+
filesExtracted++;
|
|
67
|
+
var progress = (float)filesExtracted / totalFiles;
|
|
68
|
+
onProcess?.Invoke(progress);
|
|
69
|
+
if (filesExtracted >= totalFiles)
|
|
70
|
+
{
|
|
71
|
+
complete?.Invoke();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
zip.ExtractAll(output, ExtractExistingFileAction.OverwriteSilently);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
cd /d "$OPENSSL_BIN$"
|
|
2
|
+
call openssl req -newkey rsa:2048 -nodes -keyout private.pem -x509 -config "$OPENSSL_CONF$" -out certificate.pem
|
|
3
|
+
|
|
4
|
+
if %errorlevel% equ 0 (
|
|
5
|
+
echo Build completed successfully.
|
|
6
|
+
copy "$OPENSSL_BIN$\private.pem" "$SIGN$\private.pem"
|
|
7
|
+
copy "$OPENSSL_BIN$\certificate.pem" "$SIGN$\certificate.pem"
|
|
8
|
+
call explorer "$SIGN$"
|
|
9
|
+
exit
|
|
10
|
+
) else (
|
|
11
|
+
echo Build encountered an error.
|
|
12
|
+
pause
|
|
13
|
+
)
|
package/Editor/bats.meta
ADDED
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 845273eba6f914b45a62bc13382629a6
|
|
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:
|
|
Binary file
|