com.typhoon.unitysdk 1.0.18 → 1.0.20
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 +66 -10
- package/Editor/EditorIcons.cs +8 -0
- package/Editor/ExportModule.cs +24 -6
- package/Editor/GUIDrawer.cs +82 -0
- package/Editor/GUIDrawer.cs.meta +11 -0
- package/Editor/Preferences.cs +3 -0
- package/Editor/PreferencesWindow.cs +84 -88
- package/Editor/PublishProcess.cs +1 -0
- package/Editor/PublishResult.cs +5 -0
- package/Editor/PublishSetting.cs +18 -4
- package/Editor/PublishSettingGUIDrawer.cs +166 -7
- package/Editor/PublishTool.cs +3 -5
- package/Editor/PublishVivoBatSettingInspector.cs +0 -1
- package/Editor/PublishWindow.cs +14 -5
- package/Editor/Texture/black_32x32.png +0 -0
- package/Editor/Texture/black_32x32.png.meta +144 -0
- package/Editor/Texture/icon_arrow_right.png +0 -0
- package/Editor/Texture/icon_arrow_right.png.meta +144 -0
- package/Editor/Texture/icon_variable.png +0 -0
- package/Editor/Texture/icon_variable.png.meta +144 -0
- package/Editor/UniEditor.cs +22 -0
- package/Editor/VariablePreset.cs +160 -0
- package/Editor/VariablePreset.cs.meta +11 -0
- package/Editor/VariablePresetWindow.cs +153 -0
- package/Editor/VariablePresetWindow.cs.meta +11 -0
- package/Editor/WxMiniConfig.cs +285 -0
- package/Editor/WxMiniConfig.cs.meta +11 -0
- package/Editor/WxMiniConfigWindow.cs +58 -0
- package/Editor/WxMiniConfigWindow.cs.meta +11 -0
- package/Runtime/TyphoonSdk.cs +2 -0
- package/Runtime/UnityToJs.cs +64 -0
- package/Runtime/UnityToJs.cs.meta +11 -0
- package/Runtime/WxMiniTouchInputSupport.cs +33 -0
- package/Runtime/WxMiniTouchInputSupport.cs.meta +11 -0
- package/Sources~/Package/WxMini.unitypackage +0 -0
- package/Sources~/Package/WxMini.unitypackage.manifest +395 -0
- package/package.json +1 -1
package/Editor/ApplyTool.cs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.Collections;
|
|
3
2
|
using System.Collections.Generic;
|
|
4
3
|
using System.IO;
|
|
5
4
|
using UnityEditor;
|
|
6
|
-
using UnityEditor.VersionControl;
|
|
7
5
|
using UnityEngine;
|
|
8
6
|
|
|
9
7
|
namespace TyphoonUnitySDK
|
|
@@ -25,6 +23,8 @@ namespace TyphoonUnitySDK
|
|
|
25
23
|
public static Dictionary<AppChannel, IApply> Applies = new Dictionary<AppChannel, IApply>()
|
|
26
24
|
{
|
|
27
25
|
{ AppChannel.ChinaAndroid, new ApplyChinaAndroid() },
|
|
26
|
+
{ AppChannel.Test, new ApplyTest() },
|
|
27
|
+
{ AppChannel.WxMini, new ApplyWxMini() },
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
|
|
@@ -64,13 +64,15 @@ namespace TyphoonUnitySDK
|
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
//保存所有配置
|
|
68
|
+
setting.Save();
|
|
69
|
+
WxMiniConfig.Default.Save();
|
|
67
70
|
InvokeOnApplyStart(setting);
|
|
68
71
|
if (!Applies.TryGetValue(setting.Channel, out var match))
|
|
69
72
|
{
|
|
70
73
|
Debug.LogError($"未处理Apply:{setting.Channel}");
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
|
|
74
76
|
match.Apply(setting);
|
|
75
77
|
InvokeOnApplyEnd(setting);
|
|
76
78
|
}
|
|
@@ -294,8 +296,7 @@ namespace TyphoonUnitySDK
|
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
|
|
297
|
-
|
|
298
|
-
//引入模块
|
|
299
|
+
/*引入模块*/
|
|
299
300
|
public static void ImportModule(string module)
|
|
300
301
|
{
|
|
301
302
|
var from = $"{UniEditor.PathRoot}/Sources~/{module}/Assets";
|
|
@@ -303,6 +304,7 @@ namespace TyphoonUnitySDK
|
|
|
303
304
|
}
|
|
304
305
|
|
|
305
306
|
|
|
307
|
+
/*导入unity package*/
|
|
306
308
|
public static void ImportUnityPackage(string package)
|
|
307
309
|
{
|
|
308
310
|
AssetDatabase.ImportPackage(package, false);
|
|
@@ -331,11 +333,14 @@ namespace TyphoonUnitySDK
|
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
|
|
334
|
-
|
|
335
|
-
/// 清理文件夹,保留文件
|
|
336
|
-
/// </summary>
|
|
336
|
+
/*清理文件夹,保留文件*/
|
|
337
337
|
public static void ClearFilesInDirectory(string folder, HashSet<string> keep)
|
|
338
338
|
{
|
|
339
|
+
if (keep == null)
|
|
340
|
+
{
|
|
341
|
+
keep = new HashSet<string>();
|
|
342
|
+
}
|
|
343
|
+
|
|
339
344
|
if (Directory.Exists(folder))
|
|
340
345
|
{
|
|
341
346
|
var files = Directory.GetFiles(folder, "*", SearchOption.AllDirectories);
|
|
@@ -352,6 +357,17 @@ namespace TyphoonUnitySDK
|
|
|
352
357
|
}
|
|
353
358
|
}
|
|
354
359
|
|
|
360
|
+
//可能出现的文件夹
|
|
361
|
+
public static string[] MaybeFolder = new[]
|
|
362
|
+
{
|
|
363
|
+
"Assets/Plugins/Android",
|
|
364
|
+
"Assets/Typhoon_Gen/TyphoonSDK/Runtime",
|
|
365
|
+
"Assets/WX-WASM-SDK-V2",
|
|
366
|
+
"Assets/WebGLTemplates",
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
/*应用ChinaAndroid*/
|
|
355
371
|
public class ApplyChinaAndroid : IApply
|
|
356
372
|
{
|
|
357
373
|
public void Apply(PublishSetting setting)
|
|
@@ -362,8 +378,48 @@ namespace TyphoonUnitySDK
|
|
|
362
378
|
Debug.Log($"读取资源清单...{manifest_path}");
|
|
363
379
|
var manifest = ReadManifest(manifest_path);
|
|
364
380
|
Debug.Log($"清理多余文件...");
|
|
365
|
-
|
|
366
|
-
|
|
381
|
+
foreach (var folder in MaybeFolder)
|
|
382
|
+
{
|
|
383
|
+
ClearFilesInDirectory(folder, manifest);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
AssetDatabase.Refresh();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
/*应用Test*/
|
|
392
|
+
public class ApplyTest : IApply
|
|
393
|
+
{
|
|
394
|
+
public void Apply(PublishSetting setting)
|
|
395
|
+
{
|
|
396
|
+
Debug.Log($"清理多余文件...");
|
|
397
|
+
foreach (var folder in MaybeFolder)
|
|
398
|
+
{
|
|
399
|
+
ClearFilesInDirectory(folder, default);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
AssetDatabase.Refresh();
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
/*应用WxMini*/
|
|
408
|
+
public class ApplyWxMini : IApply
|
|
409
|
+
{
|
|
410
|
+
public void Apply(PublishSetting setting)
|
|
411
|
+
{
|
|
412
|
+
Debug.Log($"导入... {UniEditor.PackagePath_WxMini}");
|
|
413
|
+
ImportUnityPackage(UniEditor.PackagePath_WxMini);
|
|
414
|
+
var manifest_path = $"{UniEditor.PackagePath_WxMini}.manifest";
|
|
415
|
+
Debug.Log($"读取资源清单...{manifest_path}");
|
|
416
|
+
var manifest = ReadManifest(manifest_path);
|
|
417
|
+
Debug.Log($"清理多余文件...");
|
|
418
|
+
foreach (var folder in MaybeFolder)
|
|
419
|
+
{
|
|
420
|
+
ClearFilesInDirectory(folder, manifest);
|
|
421
|
+
}
|
|
422
|
+
|
|
367
423
|
AssetDatabase.Refresh();
|
|
368
424
|
}
|
|
369
425
|
}
|
package/Editor/EditorIcons.cs
CHANGED
|
@@ -22,6 +22,10 @@ namespace TyphoonUnitySDK
|
|
|
22
22
|
public static Texture icon_android =>
|
|
23
23
|
__icon_android
|
|
24
24
|
?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_android.png");
|
|
25
|
+
private static Texture __icon_arrow_right = null;
|
|
26
|
+
public static Texture icon_arrow_right =>
|
|
27
|
+
__icon_arrow_right
|
|
28
|
+
?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_arrow_right.png");
|
|
25
29
|
private static Texture __icon_douyin = null;
|
|
26
30
|
public static Texture icon_douyin =>
|
|
27
31
|
__icon_douyin
|
|
@@ -73,6 +77,10 @@ namespace TyphoonUnitySDK
|
|
|
73
77
|
public static Texture icon_success =>
|
|
74
78
|
__icon_success
|
|
75
79
|
?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_success.png");
|
|
80
|
+
private static Texture __icon_variable = null;
|
|
81
|
+
public static Texture icon_variable =>
|
|
82
|
+
__icon_variable
|
|
83
|
+
?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_variable.png");
|
|
76
84
|
private static Texture __icon_vivo = null;
|
|
77
85
|
public static Texture icon_vivo =>
|
|
78
86
|
__icon_vivo ?? AssetDatabase.LoadAssetAtPath<Texture>($"{FolderPath}/icon_vivo.png");
|
package/Editor/ExportModule.cs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.Collections;
|
|
3
2
|
using System.Collections.Generic;
|
|
4
3
|
using System.IO;
|
|
5
4
|
using System.Text;
|
|
6
|
-
using Sirenix.Utilities.Editor;
|
|
7
5
|
using UnityEditor;
|
|
8
6
|
using UnityEngine;
|
|
9
7
|
|
|
@@ -14,9 +12,7 @@ namespace TyphoonUnitySDK
|
|
|
14
12
|
/// </summary>
|
|
15
13
|
public class ExportModule
|
|
16
14
|
{
|
|
17
|
-
|
|
18
|
-
/// 导出ChinaAndroid模块
|
|
19
|
-
/// </summary>
|
|
15
|
+
/*导出ChinaAndroid模块*/
|
|
20
16
|
[MenuItem("TyphoonSDK/开发者/导出-ChinaAndroid.unitypackage")]
|
|
21
17
|
public static void ExportChinaAndroid()
|
|
22
18
|
{
|
|
@@ -42,6 +38,28 @@ namespace TyphoonUnitySDK
|
|
|
42
38
|
ExportUnityPackage(manifest, UniEditor.PackagePath_ChinaAndroid, out var detail);
|
|
43
39
|
}
|
|
44
40
|
|
|
41
|
+
/*导出ChinaAndroid模块*/
|
|
42
|
+
[MenuItem("TyphoonSDK/开发者/导出-WxMini.unitypackage")]
|
|
43
|
+
public static void ExportWxMini()
|
|
44
|
+
{
|
|
45
|
+
var manifest = new List<string>()
|
|
46
|
+
{
|
|
47
|
+
"Assets/WebGLTemplates",
|
|
48
|
+
"Assets/WX-WASM-SDK-V2",
|
|
49
|
+
"Assets/Typhoon_Gen/TyphoonSDK/Runtime/WxMini",
|
|
50
|
+
};
|
|
51
|
+
if (!MakeSureExport(manifest))
|
|
52
|
+
{
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!CheckMissFiles(manifest))
|
|
57
|
+
{
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ExportUnityPackage(manifest, UniEditor.PackagePath_WxMini, out var detail);
|
|
62
|
+
}
|
|
45
63
|
|
|
46
64
|
/// <summary>
|
|
47
65
|
/// 导出清单文件到模块
|
|
@@ -273,6 +291,7 @@ namespace TyphoonUnitySDK
|
|
|
273
291
|
{
|
|
274
292
|
sb.AppendLine(element);
|
|
275
293
|
}
|
|
294
|
+
|
|
276
295
|
File.WriteAllText(manifestPath, sb.ToString());
|
|
277
296
|
AssetDatabase.Refresh();
|
|
278
297
|
if (File.Exists(savePath))
|
|
@@ -282,7 +301,6 @@ namespace TyphoonUnitySDK
|
|
|
282
301
|
}
|
|
283
302
|
}
|
|
284
303
|
|
|
285
|
-
|
|
286
304
|
public static string ToUnityPath(string path)
|
|
287
305
|
{
|
|
288
306
|
return UniEditor.FullPathToAssetPath(path);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using Object = UnityEngine.Object;
|
|
7
|
+
|
|
8
|
+
namespace TyphoonUnitySDK
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// GUI绘制器
|
|
12
|
+
/// </summary>
|
|
13
|
+
public static class GUIDrawer
|
|
14
|
+
{
|
|
15
|
+
private static GUIStyle _styleTooltip = null;
|
|
16
|
+
|
|
17
|
+
private static GUIStyle StyleTooltip
|
|
18
|
+
{
|
|
19
|
+
get
|
|
20
|
+
{
|
|
21
|
+
if (_styleTooltip == null)
|
|
22
|
+
{
|
|
23
|
+
_styleTooltip = new GUIStyle(Styles.rlabel_italic);
|
|
24
|
+
_styleTooltip.normal.textColor = new Color(0.47f, 0.8f, 1f, 1f);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return _styleTooltip;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// 绘制GUI属性
|
|
34
|
+
/// </summary>
|
|
35
|
+
public static void DrawProperty(Object target, Func<string, bool> ignoreFunc)
|
|
36
|
+
{
|
|
37
|
+
var obj = new SerializedObject(target);
|
|
38
|
+
EditorGUI.BeginChangeCheck();
|
|
39
|
+
obj.UpdateIfRequiredOrScript();
|
|
40
|
+
SerializedProperty iterator = obj.GetIterator();
|
|
41
|
+
for (var enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
|
|
42
|
+
{
|
|
43
|
+
using (new EditorGUI.DisabledScope("m_Script" == iterator.propertyPath))
|
|
44
|
+
{
|
|
45
|
+
var cover = ignoreFunc.Invoke(iterator.propertyPath);
|
|
46
|
+
if (!cover)
|
|
47
|
+
{
|
|
48
|
+
EditorGUILayout.PropertyField(iterator, true);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
obj.ApplyModifiedProperties();
|
|
54
|
+
EditorGUI.EndChangeCheck();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// 绘制Foldout
|
|
59
|
+
/// </summary>
|
|
60
|
+
public static bool DrawFoldout(string content, bool foldout, params GUILayoutOption[] option)
|
|
61
|
+
{
|
|
62
|
+
var click = GUILayout.Button(
|
|
63
|
+
new GUIContent($"{content}", foldout ? EditorIcons.icon_drop_arrow : EditorIcons.icon_arrow_right),
|
|
64
|
+
Styles.rbutton_left, option);
|
|
65
|
+
if (click)
|
|
66
|
+
{
|
|
67
|
+
return !foldout;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return foldout;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
/// 绘制关键提示
|
|
76
|
+
/// </summary>
|
|
77
|
+
public static void DrawKeynotes(string content, params GUILayoutOption[] option)
|
|
78
|
+
{
|
|
79
|
+
GUILayout.TextArea(content, StyleTooltip, option);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
package/Editor/Preferences.cs
CHANGED
|
@@ -9,16 +9,12 @@ namespace TyphoonUnitySDK
|
|
|
9
9
|
{
|
|
10
10
|
public class PreferencesWindow : EditorWindow
|
|
11
11
|
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
new Dictionary<string, Func<Preferences, bool>>()
|
|
17
|
-
{
|
|
18
|
-
{ "m_Script", (s) => true },
|
|
19
|
-
{ nameof(Preferences.GradlePath), DrawProperty_GradlePath },
|
|
20
|
-
};
|
|
12
|
+
private static bool _preferenceFoldout = false;
|
|
13
|
+
|
|
14
|
+
private static bool _wxMiniConfigFoldout = false;
|
|
15
|
+
|
|
21
16
|
|
|
17
|
+
private static Vector2 _scroll;
|
|
22
18
|
|
|
23
19
|
[MenuItem("TyphoonSDK/选项", priority = 10000)]
|
|
24
20
|
public static void Open()
|
|
@@ -29,60 +25,77 @@ namespace TyphoonUnitySDK
|
|
|
29
25
|
win.Show();
|
|
30
26
|
}
|
|
31
27
|
|
|
32
|
-
private Editor _editor;
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
protected void OnGUI()
|
|
35
30
|
{
|
|
36
|
-
|
|
31
|
+
var rect = new Rect(0, 0, position.width, position.height);
|
|
32
|
+
var rectTitle = rect;
|
|
33
|
+
rectTitle.y += 4;
|
|
34
|
+
rectTitle.x += 4;
|
|
35
|
+
rectTitle.width -= 8;
|
|
36
|
+
rectTitle.height = 32;
|
|
37
|
+
EditorGUI.DrawRect(rectTitle, Skins.PublishWindowTitleBgColor);
|
|
38
|
+
GUI.Label(rectTitle, "选项", Styles.rbold_title);
|
|
39
|
+
|
|
40
|
+
var rectSave = rectTitle;
|
|
41
|
+
rectSave.width = 90;
|
|
42
|
+
rectSave.x = rectTitle.xMax - rectSave.width - 4;
|
|
43
|
+
var center = rectSave.center;
|
|
44
|
+
rectSave.height -= 8;
|
|
45
|
+
rectSave.center = center;
|
|
46
|
+
if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save)))
|
|
37
47
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
EditorUtility.SetDirty(Preferences.Default);
|
|
49
|
+
WxMiniConfig.Default.Save();
|
|
50
|
+
AssetDatabase.SaveAssets();
|
|
51
|
+
Debug.Log("保存完毕");
|
|
52
|
+
}
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
var area = rectTitle;
|
|
55
|
+
area.y = rectTitle.yMax;
|
|
56
|
+
area.y += 4;
|
|
57
|
+
area.width -= 8;
|
|
58
|
+
area.x += 4;
|
|
59
|
+
area.height = rect.yMax - area.yMin - 4;
|
|
60
|
+
GUILayout.BeginArea(area);
|
|
47
61
|
|
|
48
|
-
|
|
62
|
+
_scroll = GUILayout.BeginScrollView(_scroll);
|
|
63
|
+
_preferenceFoldout = GUIDrawer.DrawFoldout("偏好设置", _preferenceFoldout, GUILayout.Height(26));
|
|
64
|
+
if (_preferenceFoldout)
|
|
65
|
+
{
|
|
66
|
+
DrawPreferencesPropertyGUI(Preferences.Default);
|
|
49
67
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
68
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var area = rect;
|
|
57
|
-
area.height -= 8;
|
|
58
|
-
area.width -= 12;
|
|
59
|
-
area.center = rect.center;
|
|
60
|
-
GUILayout.BeginArea(area);
|
|
61
|
-
var rectSave = new Rect(0, 0, area.width, area.height);
|
|
62
|
-
rectSave.width = 100;
|
|
63
|
-
rectSave.height = 32;
|
|
64
|
-
rectSave.x = area.width - rectSave.width;
|
|
65
|
-
rectSave.x -= 4;
|
|
66
|
-
rectSave.y += 4;
|
|
67
|
-
if (GUI.Button(rectSave, new GUIContent("保存配置", EditorIcons.icon_save), Styles.rbutton))
|
|
69
|
+
GUILayout.Space(10);
|
|
70
|
+
_wxMiniConfigFoldout = GUIDrawer.DrawFoldout("微信小游戏", _wxMiniConfigFoldout, GUILayout.Height(26));
|
|
71
|
+
if (_wxMiniConfigFoldout)
|
|
68
72
|
{
|
|
69
|
-
|
|
70
|
-
AssetDatabase.SaveAssets();
|
|
71
|
-
Debug.Log("保存完毕");
|
|
73
|
+
WxMiniConfigGUIDrawer.DrawWxMiniConfig();
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
GUILayout.EndScrollView();
|
|
75
77
|
GUILayout.EndArea();
|
|
76
78
|
Repaint();
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
|
|
82
|
+
#region 偏好设置
|
|
83
|
+
|
|
84
|
+
public static Dictionary<string, Func<Preferences, bool>> OverrideDrawGUIPreferences =
|
|
85
|
+
new Dictionary<string, Func<Preferences, bool>>()
|
|
86
|
+
{
|
|
87
|
+
{ "m_Script", (s) => true },
|
|
88
|
+
{ nameof(Preferences.CheckInstallAddressablePlug), DrawProperty_CheckInstallAddressablePlug },
|
|
89
|
+
{ nameof(Preferences.GradlePath), DrawProperty_GradlePath },
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
|
|
80
93
|
/*绘制GUI*/
|
|
81
|
-
public static void
|
|
94
|
+
public static void DrawPreferencesPropertyGUI(Preferences preferences)
|
|
82
95
|
{
|
|
83
|
-
DrawProperty(preferences, (property) =>
|
|
96
|
+
GUIDrawer.DrawProperty(preferences, (property) =>
|
|
84
97
|
{
|
|
85
|
-
if (
|
|
98
|
+
if (OverrideDrawGUIPreferences.TryGetValue(property, out var match))
|
|
86
99
|
{
|
|
87
100
|
return match.Invoke(preferences);
|
|
88
101
|
}
|
|
@@ -91,60 +104,38 @@ namespace TyphoonUnitySDK
|
|
|
91
104
|
});
|
|
92
105
|
}
|
|
93
106
|
|
|
94
|
-
|
|
95
|
-
/*绘制属性*/
|
|
96
|
-
public static void DrawProperty(Object target, Func<string, bool> ignoreFunc)
|
|
107
|
+
private static bool DrawProperty_CheckInstallAddressablePlug(Preferences arg)
|
|
97
108
|
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
SerializedProperty iterator = obj.GetIterator();
|
|
102
|
-
for (var enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
|
|
103
|
-
{
|
|
104
|
-
using (new EditorGUI.DisabledScope("m_Script" == iterator.propertyPath))
|
|
105
|
-
{
|
|
106
|
-
var cover = ignoreFunc.Invoke(iterator.propertyPath);
|
|
107
|
-
if (!cover)
|
|
108
|
-
{
|
|
109
|
-
EditorGUILayout.PropertyField(iterator, true);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
obj.ApplyModifiedProperties();
|
|
115
|
-
EditorGUI.EndChangeCheck();
|
|
109
|
+
arg.CheckInstallAddressablePlug =
|
|
110
|
+
GUILayout.Toggle(arg.CheckInstallAddressablePlug, "自动检查Addressabled Supoort");
|
|
111
|
+
return true;
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
|
|
119
115
|
private static bool DrawProperty_GradlePath(Preferences preferences)
|
|
120
116
|
{
|
|
121
|
-
GUILayout.Space(10);
|
|
122
|
-
var error = false;
|
|
123
|
-
var color = GUI.color;
|
|
124
117
|
if (!UniEditor.GradleIsMatch())
|
|
125
118
|
{
|
|
119
|
+
GUILayout.BeginHorizontal();
|
|
126
120
|
GUILayout.Label(new GUIContent("未配置gradle路径", EditorIcons.icon_error), Styles.rbold_label,
|
|
127
|
-
GUILayout.Height(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
GUILayout.Height(22));
|
|
122
|
+
if (GUILayout.Button("指引", GUILayout.Width(60)))
|
|
123
|
+
{
|
|
124
|
+
UniEditor.ShowMessageBox(
|
|
125
|
+
"目录选到bin的文件夹即可\n例如:C:\\Users\\Jan\\.gradle\\wrapper\\dists\\gradle-6.8-bin\\1jblhjyydfkclfzx1agp92nyl\\gradle-6.8\\bin",
|
|
126
|
+
null);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
GUILayout.EndHorizontal();
|
|
134
130
|
}
|
|
135
131
|
else
|
|
136
132
|
{
|
|
137
|
-
GUILayout.Label(
|
|
138
|
-
GUILayout.Height(24));
|
|
133
|
+
GUILayout.Label("gradle路径", Styles.rbold_label, GUILayout.Height(22));
|
|
139
134
|
}
|
|
140
135
|
|
|
141
136
|
GUILayout.BeginHorizontal();
|
|
142
|
-
GUILayout.Label("目录:", Styles.rbold_title, GUILayout.Width(40),GUILayout.Height(44));
|
|
143
|
-
color = GUI.color;
|
|
144
|
-
GUI.color = error ? Color.red*0.7f : color;
|
|
145
137
|
preferences.GradlePath = GUILayout.TextArea(preferences.GradlePath, GUILayout.Height(44));
|
|
146
|
-
|
|
147
|
-
if (GUILayout.Button("选择", GUILayout.Width(60),GUILayout.Height(44)))
|
|
138
|
+
if (GUILayout.Button("选择", GUILayout.Width(60), GUILayout.Height(44)))
|
|
148
139
|
{
|
|
149
140
|
// 获取当前用户的 Windows 用户文件夹路径
|
|
150
141
|
var userFolder = UniEditor.GetWindowUserFolder();
|
|
@@ -159,12 +150,15 @@ namespace TyphoonUnitySDK
|
|
|
159
150
|
}
|
|
160
151
|
|
|
161
152
|
var select = EditorUtility.OpenFolderPanel("请选择Gradle目录", fastPath, "");
|
|
162
|
-
|
|
163
|
-
EditorUtility.SetDirty(preferences);
|
|
164
|
-
var check = $"{select}/gradle";
|
|
165
|
-
if (!File.Exists(check))
|
|
153
|
+
if (!string.IsNullOrEmpty(select))
|
|
166
154
|
{
|
|
167
|
-
|
|
155
|
+
preferences.GradlePath = select;
|
|
156
|
+
EditorUtility.SetDirty(preferences);
|
|
157
|
+
var check = $"{select}/gradle";
|
|
158
|
+
if (!File.Exists(check))
|
|
159
|
+
{
|
|
160
|
+
UniEditor.ShowMessageBox($"gardle目录不匹配,找不到:{check}", null);
|
|
161
|
+
}
|
|
168
162
|
}
|
|
169
163
|
|
|
170
164
|
GUI.FocusControl("");
|
|
@@ -173,5 +167,7 @@ namespace TyphoonUnitySDK
|
|
|
173
167
|
GUILayout.EndHorizontal();
|
|
174
168
|
return true;
|
|
175
169
|
}
|
|
170
|
+
|
|
171
|
+
#endregion
|
|
176
172
|
}
|
|
177
173
|
}
|
package/Editor/PublishProcess.cs
CHANGED
package/Editor/PublishResult.cs
CHANGED
package/Editor/PublishSetting.cs
CHANGED
|
@@ -8,15 +8,15 @@ using UnityEngine.Serialization;
|
|
|
8
8
|
namespace TyphoonUnitySDK
|
|
9
9
|
{
|
|
10
10
|
/// <summary>
|
|
11
|
-
///
|
|
11
|
+
/// 参数修改
|
|
12
12
|
/// </summary>
|
|
13
13
|
[Serializable]
|
|
14
|
-
public class
|
|
14
|
+
public class VariableModify
|
|
15
15
|
{
|
|
16
16
|
public string VariableName;
|
|
17
17
|
public string VariableValue;
|
|
18
18
|
|
|
19
|
-
public
|
|
19
|
+
public VariableModify(string variableName, string variableValue)
|
|
20
20
|
{
|
|
21
21
|
VariableName = variableName;
|
|
22
22
|
VariableValue = variableValue;
|
|
@@ -84,7 +84,14 @@ public AndroidSdkVersions MinApiVersion = AndroidSdkVersions.AndroidApiLevel22;
|
|
|
84
84
|
[FormerlySerializedAs("AddressableUseProfile")]
|
|
85
85
|
public string AAUseProfile = "";
|
|
86
86
|
|
|
87
|
-
public List<
|
|
87
|
+
public List<VariableModify> AAVariableModify = new List<VariableModify>();
|
|
88
|
+
|
|
89
|
+
/*自定义参数修改*/
|
|
90
|
+
public bool PresetModifyEnable = false;
|
|
91
|
+
public List<VariableModify> PresetModify = new List<VariableModify>();
|
|
92
|
+
|
|
93
|
+
/*微信拓展配置*/
|
|
94
|
+
public bool WxMiniGUIFoldout = true;
|
|
88
95
|
|
|
89
96
|
|
|
90
97
|
//使用配置
|
|
@@ -107,5 +114,12 @@ public AndroidSdkVersions MinApiVersion = AndroidSdkVersions.AndroidApiLevel22;
|
|
|
107
114
|
{
|
|
108
115
|
return UniEditor.HasAddressableSupport() & AASupportEnable;
|
|
109
116
|
}
|
|
117
|
+
|
|
118
|
+
/*保存*/
|
|
119
|
+
public void Save()
|
|
120
|
+
{
|
|
121
|
+
EditorUtility.SetDirty(this);
|
|
122
|
+
AssetDatabase.SaveAssets();
|
|
123
|
+
}
|
|
110
124
|
}
|
|
111
125
|
}
|