com.typhoon.unitysdk 1.0.52 → 1.0.54

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,21 @@
1
1
  # 更新日志
2
- ## [1.0.52] - 2023-12-10
2
+ ## [1.0.54] - 2023-12-10
3
3
 
4
4
  ### 修复
5
+ * 修正Latest配置的发布时间
6
+ * 更新时写入manifest出错
7
+ * 更新时的日志改为log
8
+
9
+
10
+ ## [1.0.53] - 2023-12-10
11
+
12
+ ### 修复
13
+ * 拉取最新版本信息时GET请求避免本地缓存问题
14
+
15
+
16
+ ## [1.0.52] - 2023-12-10
17
+
18
+ ### 修复
5
19
  * 安装更新报错问题
6
20
 
7
21
 
@@ -58,6 +58,16 @@ namespace TyphoonUnitySDK
58
58
  {
59
59
  Latest = latest;
60
60
  AllVersions = all;
61
+ foreach (var info in AllVersions)
62
+ {
63
+ if (Latest.Version == info.Version)
64
+ {
65
+ //修正发布时间
66
+ Latest.PublishTimeStamp = info.PublishTimeStamp;
67
+ break;
68
+ }
69
+ }
70
+
61
71
  Save();
62
72
  }
63
73
 
@@ -6,6 +6,7 @@ using System.IO;
6
6
  using System.Linq;
7
7
  using System.Net.Http;
8
8
  using System.Text;
9
+ using System.Text.RegularExpressions;
9
10
  using System.Threading.Tasks;
10
11
  using UnityEditor;
11
12
  using UnityEngine;
@@ -786,7 +787,7 @@ namespace TyphoonUnitySDK
786
787
  public static async Task<(PackageVersionInfo info, string state)> RequestLatestInfo()
787
788
  {
788
789
  //从镜像地址中检查
789
- var url = "https://registry.npmmirror.com/com.typhoon.unitysdk/latest";
790
+ var url = $"https://registry.npmmirror.com/com.typhoon.unitysdk/latest?{Guid.NewGuid().ToString()}";
790
791
  PackageVersionInfo latest = null;
791
792
  var req = await HttpGet(url);
792
793
  if (req.state)
@@ -1040,7 +1041,7 @@ namespace TyphoonUnitySDK
1040
1041
  //获取所有版本信息
1041
1042
  public static async Task<(List<PackageVersionInfo> infos, string state)> RequestAllVersionInfo()
1042
1043
  {
1043
- var url = "https://registry.npmmirror.com/com.typhoon.unitysdk";
1044
+ var url = $"https://registry.npmmirror.com/com.typhoon.unitysdk?{Guid.NewGuid().ToString()}";
1044
1045
  var req = await HttpGet(url);
1045
1046
  var versionInfos = new List<PackageVersionInfo>();
1046
1047
  if (req.state)
@@ -1147,21 +1148,18 @@ namespace TyphoonUnitySDK
1147
1148
  {
1148
1149
  var package = $"Packages/manifest.json";
1149
1150
  var json = File.ReadAllText(package);
1150
- var map = json.ToXObject<Dictionary<string, object>>();
1151
- var dependencies = map["dependencies"].ToString();
1152
- var depMap = dependencies.ToXObject<Dictionary<string, string>>();
1153
- foreach (var pair in depMap)
1151
+ var pattern = $"\"com.typhoon.unitysdk\"[\\s]*:[\\s]*\"{current.Version}\"";
1152
+ if (Regex.IsMatch(json, pattern))
1154
1153
  {
1155
- Debug.Log($"{pair.Key},{pair.Value}");
1154
+ json = Regex.Replace(json, pattern, $"\"com.typhoon.unitysdk\": \"{versionInfo.Version}\"");
1155
+ File.WriteAllText(package, json);
1156
+ Debug.Log($"更改成功,刷新工程...");
1157
+ AssetDatabase.Refresh();
1158
+ }
1159
+ else
1160
+ {
1161
+ Debug.LogError($"找不到com.typhoon.unitysdk条目");
1156
1162
  }
1157
-
1158
- //修改版本号
1159
- depMap["com.typhoon.unitysdk"] = $"{versionInfo.Version}";
1160
- map["dependencies"] = depMap.ToXJson();
1161
- var final = map.ToXJson();
1162
- File.WriteAllText(package, final);
1163
- Debug.LogError($"更改成功,刷新工程...");
1164
- AssetDatabase.Refresh();
1165
1163
  }
1166
1164
  catch (Exception e)
1167
1165
  {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.52","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.0.52] - 2023-12-10\r\n\r\n### 修复\n* 安装更新报错问题\r\n\r\n","major_flag":true,"write_time_stamp":1702190819000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}
1
+ {"name":"com.typhoon.unitysdk","displayName":"typhoon unity sdk","version":"1.0.54","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.0.54] - 2023-12-10\r\n\r\n### 修复\n* 修正Latest配置的发布时间\r\n* 更新时写入manifest出错\r\n* 更新时的日志改为log\r\n\r\n","major_flag":true,"write_time_stamp":1702192601000,"others":{"items":[]},"dependencies":{"com.unity.nuget.newtonsoft-json":"2.0.0"}}