com.typhoon.unitysdk 1.1.20 → 1.1.22

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/CHANGELOG.md CHANGED
@@ -1,7 +1,20 @@
1
1
  # 更新日志
2
+ ## [1.1.22] - 2025-10-25
3
+
4
+ ### 优化
5
+ * 优化gradle路径获取,取preference的gradle路径
6
+ * 优化发布名称使其更有意义
7
+
8
+
9
+ ## [1.1.21] - 2025-10-25
10
+
11
+ ### 新增
12
+ * 调整发布名称
13
+
14
+
2
15
  ## [1.1.20] - 2025-10-25
3
16
 
4
- ### 新增
17
+ ### 新增
5
18
  * 更新google play sdk
6
19
 
7
20
 
@@ -35,8 +35,10 @@ namespace TyphoonUnitySDK
35
35
  }
36
36
  }
37
37
 
38
- [Header("gradle目录")] public string GradlePath = string.Empty;
39
- [LabelOverride("有重大更新时提醒我")] public bool CheckMajor = true;
40
- [LabelOverride("自定检查更新")] public bool CheckUpdate = true;
38
+ // [Header("gradle目录")] public string GradlePath = string.Empty;
39
+ [LabelOverride("有重大更新时提醒我")]
40
+ public bool CheckMajor = true;
41
+ [LabelOverride("自定检查更新")]
42
+ public bool CheckUpdate = true;
41
43
  }
42
44
  }
@@ -64,7 +64,7 @@ namespace TyphoonUnitySDK
64
64
  new Dictionary<string, Func<Preferences, bool>>()
65
65
  {
66
66
  { "m_Script", DrawProperty_mScript },
67
- { nameof(Preferences.GradlePath), DrawProperty_GradlePath },
67
+ // { nameof(Preferences.GradlePath), DrawProperty_GradlePath },
68
68
  };
69
69
 
70
70
 
@@ -93,62 +93,62 @@ namespace TyphoonUnitySDK
93
93
  });
94
94
  }
95
95
 
96
- private static bool DrawProperty_GradlePath(Preferences preferences)
97
- {
98
- GUILayout.Space(5);
99
- if (!UniEditor.GradleIsMatch())
100
- {
101
- GUILayout.BeginHorizontal();
102
- GUILayout.Label(new GUIContent("未配置gradle路径", EditorIcons.icon_error), Styles.BoldLabel,
103
- GUILayout.Height(22));
104
- if (GUILayout.Button("指引", GUILayout.Width(60)))
105
- {
106
- UniEditor.ShowMessageBox(
107
- "目录选到bin的文件夹即可\n例如:C:\\Users\\Jan\\.gradle\\wrapper\\dists\\gradle-6.8-bin\\1jblhjyydfkclfzx1agp92nyl\\gradle-6.8\\bin",
108
- null);
109
- }
110
-
111
- GUILayout.EndHorizontal();
112
- }
113
- else
114
- {
115
- GUILayout.Label("gradle路径", Styles.BoldLabel, GUILayout.Height(22));
116
- }
117
-
118
- GUILayout.BeginHorizontal();
119
- preferences.GradlePath = GUILayout.TextArea(preferences.GradlePath, GUILayout.Height(44));
120
- if (GUILayout.Button("选择", GUILayout.Width(60), GUILayout.Height(44)))
121
- {
122
- // 获取当前用户的 Windows 用户文件夹路径
123
- var userFolder = UniEditor.GetWindowUserFolder();
124
- var fastPath = "";
125
- if (Directory.Exists(userFolder))
126
- {
127
- var maybe = $"{userFolder}/.gradle/wrapper/dists";
128
- if (Directory.Exists(maybe))
129
- {
130
- fastPath = maybe;
131
- }
132
- }
133
-
134
- var select = EditorUtility.OpenFolderPanel("请选择Gradle目录", fastPath, "");
135
- if (!string.IsNullOrEmpty(select))
136
- {
137
- preferences.GradlePath = select;
138
- EditorUtility.SetDirty(preferences);
139
- var check = $"{select}/gradle";
140
- if (!File.Exists(check))
141
- {
142
- UniEditor.ShowMessageBox($"gardle目录不匹配,找不到:{check}", null);
143
- }
144
- }
145
-
146
- GUI.FocusControl("");
147
- }
148
-
149
- GUILayout.EndHorizontal();
150
- return true;
151
- }
96
+ // private static bool DrawProperty_GradlePath(Preferences preferences)
97
+ // {
98
+ // GUILayout.Space(5);
99
+ // if (!UniEditor.GradleIsMatch())
100
+ // {
101
+ // GUILayout.BeginHorizontal();
102
+ // GUILayout.Label(new GUIContent("未配置gradle路径", EditorIcons.icon_error), Styles.BoldLabel,
103
+ // GUILayout.Height(22));
104
+ // if (GUILayout.Button("指引", GUILayout.Width(60)))
105
+ // {
106
+ // UniEditor.ShowMessageBox(
107
+ // "目录选到bin的文件夹即可\n例如:C:\\Users\\Jan\\.gradle\\wrapper\\dists\\gradle-6.8-bin\\1jblhjyydfkclfzx1agp92nyl\\gradle-6.8\\bin",
108
+ // null);
109
+ // }
110
+ //
111
+ // GUILayout.EndHorizontal();
112
+ // }
113
+ // else
114
+ // {
115
+ // GUILayout.Label("gradle路径", Styles.BoldLabel, GUILayout.Height(22));
116
+ // }
117
+ //
118
+ // GUILayout.BeginHorizontal();
119
+ // preferences.GradlePath = GUILayout.TextArea(preferences.GradlePath, GUILayout.Height(44));
120
+ // if (GUILayout.Button("选择", GUILayout.Width(60), GUILayout.Height(44)))
121
+ // {
122
+ // // 获取当前用户的 Windows 用户文件夹路径
123
+ // var userFolder = UniEditor.GetWindowUserFolder();
124
+ // var fastPath = "";
125
+ // if (Directory.Exists(userFolder))
126
+ // {
127
+ // var maybe = $"{userFolder}/.gradle/wrapper/dists";
128
+ // if (Directory.Exists(maybe))
129
+ // {
130
+ // fastPath = maybe;
131
+ // }
132
+ // }
133
+ //
134
+ // var select = EditorUtility.OpenFolderPanel("请选择Gradle目录", fastPath, "");
135
+ // if (!string.IsNullOrEmpty(select))
136
+ // {
137
+ // preferences.GradlePath = select;
138
+ // EditorUtility.SetDirty(preferences);
139
+ // var check = $"{select}/gradle";
140
+ // if (!File.Exists(check))
141
+ // {
142
+ // UniEditor.ShowMessageBox($"gardle目录不匹配,找不到:{check}", null);
143
+ // }
144
+ // }
145
+ //
146
+ // GUI.FocusControl("");
147
+ // }
148
+ //
149
+ // GUILayout.EndHorizontal();
150
+ // return true;
151
+ // }
152
152
 
153
153
  #endregion
154
154
  }
@@ -21,6 +21,7 @@ namespace TyphoonUnitySDK
21
21
  /// </summary>
22
22
  public static Dictionary<PublishProcess, string> PublicClasses = new Dictionary<PublishProcess, string>()
23
23
  {
24
+ { PublishProcess.Apk, "TyphoonUnitySDK.PublishUnityDefaultApk" },
24
25
  { PublishProcess.ChinaAndroidAAR, "TyphoonUnitySDK.PublishChinaAndroidAAR" },
25
26
  { PublishProcess.WxMini, "TyphoonUnitySDK.PublishWxMini" },
26
27
  { PublishProcess.DouyinAndroid, "TyphoonUnitySDK.PublishDouyinAndroid" },
@@ -0,0 +1,44 @@
1
+ using System;
2
+ using System.IO;
3
+ using UnityEditor;
4
+ using UnityEngine;
5
+
6
+ namespace TyphoonUnitySDK
7
+ {
8
+ public class PublishUnityDefaultApk : IPublish
9
+ {
10
+ public void Publish(PublishSetting setting)
11
+ {
12
+ PublishResult result = new PublishResult();
13
+ var dateString = DateTime.Now.ToString("yyyyMMdd_HHmmss");
14
+ var path = string.IsNullOrEmpty(setting.PackageName)
15
+ ? $".typhoonoutput/android_{dateString}.apk"
16
+ : $".typhoonoutput/{setting.PackageName}_{dateString}.apk";
17
+ if (!UniEditor.IsAsciiPath(path))
18
+ {
19
+ UniEditor.ShowMessageBox($"路径不符合要求,不支持中文路径:\n当前:{path}", null);
20
+ return;
21
+ }
22
+
23
+ PublishTool.InvokeOnPublishStart(setting);
24
+ //设置android打包为apk模式,非export project
25
+ EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
26
+ EditorUserBuildSettings.buildAppBundle = false;
27
+ EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
28
+ BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, path, BuildTarget.Android, BuildOptions.None);
29
+ if (File.Exists(path))
30
+ {
31
+ EditorUtility.RevealInFinder(path);
32
+ result.IsSuccess = true;
33
+ result.AndroidApk = path;
34
+ Debug.Log($"发布成功:{path}");
35
+ }
36
+ else
37
+ {
38
+ throw new Exception($"发布失败,生成apk失败,找不到文件:{path}");
39
+ }
40
+
41
+ PublishTool.InvokeOnPublishEnd(setting, result);
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a3435ef57101cbe42804434ff880fba4
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -85,12 +85,12 @@ namespace TyphoonUnitySDK
85
85
  /// </summary>
86
86
  public static string PackagePath_XiZhongYou = $"{PathRoot}/Sources~/Package/XiZhongYou.unitypackage";
87
87
 
88
-
88
+
89
89
  /// <summary>
90
90
  /// 华为鸿蒙 资源包
91
91
  /// </summary>
92
92
  public static string PackagePath_HuaweiHarmony = $"{PathRoot}/Sources~/Package/HuaweiHarmony.unitypackage";
93
-
93
+
94
94
 
95
95
  /// <summary>
96
96
  /// Toast模块
@@ -561,13 +561,32 @@ namespace TyphoonUnitySDK
561
561
  /// gradle是否设置成功
562
562
  /// </summary>
563
563
  /// <returns></returns>
564
- public static bool GradleIsMatch()
564
+ public static bool GradleIsMatch(out string error)
565
565
  {
566
- return !string.IsNullOrEmpty(Preferences.Default.GradlePath) &&
567
- File.Exists($"{Preferences.Default.GradlePath}/gradle");
566
+ error = string.Empty;
567
+ var gradlePath = EditorPrefs.GetString("GradlePath");
568
+ if (string.IsNullOrEmpty(gradlePath))
569
+ {
570
+ error = "未配置gradle\n注意:请不要使用unity自带的gradle,改为自定义gradle路径";
571
+ return false;
572
+ }
573
+
574
+ var gradleFile = ($"{gradlePath}/bin/gradle");
575
+ if (!File.Exists(gradleFile))
576
+ {
577
+ error =
578
+ $"{gradlePath} 不是一个有效的gradle路径,缺少:{Path.GetFullPath(gradleFile)}\n注意:请不要使用unity自带的gradle,改为自定义gradle路径";
579
+ }
580
+
581
+ return true;
568
582
  }
569
583
 
570
584
 
585
+ public static string GetGradlePath()
586
+ {
587
+ return EditorPrefs.GetString("GradlePath");
588
+ }
589
+
571
590
  /// <summary>
572
591
  /// 写入Txt
573
592
  /// </summary>
@@ -1172,5 +1191,11 @@ namespace TyphoonUnitySDK
1172
1191
 
1173
1192
  return false;
1174
1193
  }
1194
+
1195
+ public static void OpenUnityPreferencesExternalTool()
1196
+ {
1197
+ // 打开 Preferences 窗口并定位到 External Tools 页面
1198
+ SettingsService.OpenUserPreferences("Preferences/External Tools");
1199
+ }
1175
1200
  }
1176
1201
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.1.20","description":"","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"version_log":"## [1.1.20] - 2025-10-25\r\n\r\n### 新增\n* 更新google play sdk\r\n\r\n","major_flag":false,"write_time_stamp":1761377702000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
1
+ {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.1.22","description":"","unity":"2018.1","type":"tool","hideInEditor":false,"author":{"name":"Jan Zhang","email":"","url":""},"changelogUrl":"","documentationUrl":"","keywords":["typhoon"],"license":"","licensesUrl":"","customDependencies":[{"PackageName":"com.unity.nuget.newtonsoft-json","Value":"2.0.0"}],"version_log":"## [1.1.22] - 2025-10-25\r\n\r\n### 优化\n* 优化gradle路径获取,取preference的gradle路径\r\n* 优化发布名称使其更有意义\r\n\r\n","major_flag":false,"write_time_stamp":1761400545000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}