提交 fd9f671d 编写于 作者: 魔术师Dix's avatar 魔术师Dix

不需要Unity内部的修改;

上级 f204560d
...@@ -52,7 +52,7 @@ namespace Cocklebur ...@@ -52,7 +52,7 @@ namespace Cocklebur
compatibleVersions.Add(curVersion.version.ToString()); compatibleVersions.Add(curVersion.version.ToString());
verified = curVersion.version.ToString(); verified = curVersion.version.ToString();
} }
VersionsInfo versionsInfo = new VersionsInfo(allVersions, compatibleVersions, verified, null); VersionsInfo versionsInfo = new VersionsInfo(allVersions, compatibleVersions, verified);
for (int i = versions.Count - 1; i >= 0; i--) for (int i = versions.Count - 1; i >= 0; i--)
{ {
......
#if UNITY_2020_3_41|| UNITY_2021_3_12
#define UPM_GIT_NEW
#else
#undef UPM_GIT_NEW
#endif
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
...@@ -27,7 +33,9 @@ namespace Cocklebur ...@@ -27,7 +33,9 @@ namespace Cocklebur
public UpmPackageVersionEx(UpmPackageVersion packageVersion) : base(packageVersion.GetPackageInfo(), packageVersion.isInstalled, packageVersion.isUnityPackage) public UpmPackageVersionEx(UpmPackageVersion packageVersion) : base(packageVersion.GetPackageInfo(), packageVersion.isInstalled, packageVersion.isUnityPackage)
{ {
#if UPM_GIT_NEW
packageInfo = packageVersion.GetPackageInfo(); packageInfo = packageVersion.GetPackageInfo();
#endif
m_MinimumUnityVersion = UnityVersionToSemver(Application.unityVersion).ToString(); m_MinimumUnityVersion = UnityVersionToSemver(Application.unityVersion).ToString();
OnAfterDeserialize(); OnAfterDeserialize();
} }
...@@ -44,9 +52,10 @@ namespace Cocklebur ...@@ -44,9 +52,10 @@ namespace Cocklebur
public string fullVersionString { get; private set; } public string fullVersionString { get; private set; }
public SemVersion semVersion { get; private set; } public SemVersion semVersion { get; private set; }
#if UPM_GIT_NEW
[SerializeField] [SerializeField]
internal UnityEditor.PackageManager.PackageInfo packageInfo; internal UnityEditor.PackageManager.PackageInfo packageInfo;
#endif
[SerializeField] [SerializeField]
private string m_MinimumUnityVersion; private string m_MinimumUnityVersion;
......
#if UNITY_2020_3_41 || UNITY_2021_3_12
#define UPM_GIT_NEW
#else
#undef UPM_GIT_NEW
#endif
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using UnityEditor; using UnityEditor;
...@@ -143,7 +149,7 @@ namespace Cocklebur ...@@ -143,7 +149,7 @@ namespace Cocklebur
internal static bool IsError(this UpmAddOperation op) internal static bool IsError(this UpmAddOperation op)
{ {
if (op == null) return false; if (op == null) return false;
return op.logErrorInConsole; return op.error != null;
} }
#endregion #endregion
...@@ -161,11 +167,12 @@ namespace Cocklebur ...@@ -161,11 +167,12 @@ namespace Cocklebur
internal static PackageInfo GetPackageInfo(this IPackageVersion version) internal static PackageInfo GetPackageInfo(this IPackageVersion version)
{ {
#if UPM_GIT_NEW
if (version == null) return null; if (version == null) return null;
PackageInfo info; PackageInfo info;
string key = version.uniqueId; string key = version.uniqueId;
if (dictCachePackageInfo.TryGetValue(key, out info)) return info; if (dictCachePackageInfo.TryGetValue(key, out info)) return info;
var allPkg = PackageInfo.GetAllRegisteredPackages(); var allPkg = PackageInfo.GetAll();
foreach (var pkg in allPkg) foreach (var pkg in allPkg)
{ {
SetCachePackageInfo(pkg.packageId, pkg); SetCachePackageInfo(pkg.packageId, pkg);
...@@ -178,6 +185,9 @@ namespace Cocklebur ...@@ -178,6 +185,9 @@ namespace Cocklebur
//To Do : 重新按照地址下载 PkgInfo ? //To Do : 重新按照地址下载 PkgInfo ?
#endif #endif
return null; return null;
#else
return version.packageInfo;
#endif
} }
private static void AddPackageInfo(UpmPackageVersionEx version) private static void AddPackageInfo(UpmPackageVersionEx version)
...@@ -218,13 +228,22 @@ namespace Cocklebur ...@@ -218,13 +228,22 @@ namespace Cocklebur
EditorUtility.DisplayDialog(L10n.Tr("Unity Package Manager"), message, L10n.Tr("OK")); EditorUtility.DisplayDialog(L10n.Tr("Unity Package Manager"), message, L10n.Tr("OK"));
} }
internal static bool IsGit(this IPackageVersion version) { return version.HasTag(PackageTag.Git); } internal static bool IsGit(this IPackageVersion version)
{
#if UPM_GIT_NEW
return version.HasTag(PackageTag.Git);
#else
return version.packageInfo.source == UnityEditor.PackageManager.PackageSource.Git;
#endif
}
internal static void UpdateVersions(UpmPackage upmPackage, IEnumerable<UpmPackageVersion> newVersions) internal static void UpdateVersions(UpmPackage upmPackage, IEnumerable<UpmPackageVersion> newVersions)
{ {
//upmPackage.UpdateVersions(newVersions); #if UPM_GIT_NEW
//(upmPackage.versions as UpmVersionList).GetUpdateTarget upmPackage.UpdateVersions(newVersions, 0);
#else
upmPackage.UpdateVersions(newVersions);
#endif
} }
#endregion #endregion
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
"dependencies": { "dependencies": {
"com.unity.services.core": "1.0.1" "com.unity.services.core": "1.0.1"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ext.nunit": { "com.unity.ext.nunit": {
"version": "1.0.6", "version": "1.0.6",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ide.visualstudio": { "com.unity.ide.visualstudio": {
"version": "2.0.16", "version": "2.0.16",
...@@ -23,32 +23,23 @@ ...@@ -23,32 +23,23 @@
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.1.9" "com.unity.test-framework": "1.1.9"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.ide.vscode": { "com.unity.ide.vscode": {
"version": "1.2.5", "version": "1.2.5",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
},
"com.unity.nuget.newtonsoft-json": {
"version": "3.0.2",
"depth": 2,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
}, },
"com.unity.services.core": { "com.unity.services.core": {
"version": "1.5.2", "version": "1.0.1",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0"
"com.unity.nuget.newtonsoft-json": "3.0.2",
"com.unity.modules.androidjni": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.33", "version": "1.1.33",
...@@ -59,7 +50,7 @@ ...@@ -59,7 +50,7 @@
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.timeline": { "com.unity.timeline": {
"version": "1.6.4", "version": "1.6.4",
...@@ -71,7 +62,7 @@ ...@@ -71,7 +62,7 @@
"com.unity.modules.audio": "1.0.0", "com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0" "com.unity.modules.particlesystem": "1.0.0"
}, },
"url": "https://packages.unity.com" "url": "https://packages.unity.cn"
}, },
"com.unity.modules.ai": { "com.unity.modules.ai": {
"version": "1.0.0", "version": "1.0.0",
...@@ -218,6 +209,17 @@ ...@@ -218,6 +209,17 @@
"version": "1.0.0", "version": "1.0.0",
"depth": 0, "depth": 0,
"source": "builtin", "source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.uielementsnative": "1.0.0"
}
},
"com.unity.modules.uielementsnative": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": { "dependencies": {
"com.unity.modules.ui": "1.0.0", "com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
......
...@@ -13,24 +13,23 @@ MonoBehaviour: ...@@ -13,24 +13,23 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_EnablePreReleasePackages: 0 m_EnablePreReleasePackages: 0
m_EnablePackageDependencies: 1
m_AdvancedSettingsExpanded: 1 m_AdvancedSettingsExpanded: 1
m_ScopedRegistriesSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1
m_SeeAllPackageVersions: 0 m_SeeAllPackageVersions: 1
m_DismissPreviewPackagesInUse: 0
oneTimeWarningShown: 1 oneTimeWarningShown: 1
m_Registries: m_Registries:
- m_Id: main - m_Id: main
m_Name: m_Name:
m_Url: https://packages.unity.com m_Url: https://packages.unity.cn
m_Scopes: [] m_Scopes: []
m_IsDefault: 1 m_IsDefault: 1
m_Capabilities: 7 m_Capabilities: 7
m_ConfigSource: 0
m_UserSelectedRegistryName: m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0 m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft: m_RegistryInfoDraft:
m_Modified: 0 m_Modified: 0
m_ErrorMessage: m_ErrorMessage:
m_UserModificationsInstanceId: -842 m_UserModificationsInstanceId: -826
m_OriginalInstanceId: -844 m_OriginalInstanceId: -828
m_LoadAssets: 0 m_LoadAssets: 0
m_EditorVersion: 2022.2.0b14 m_EditorVersion: 2020.3.41f1c1
m_EditorVersionWithRevision: 2022.2.0b14 (0220fa099330) m_EditorVersionWithRevision: 2020.3.41f1c1 (148a17cb7d64)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册