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

【UpmGitTool】更新数据管理;

上级 be50f4b8
此差异已折叠。
此差异已折叠。
此差异已折叠。
using Newtonsoft.Json;
using System.Collections.Generic;
namespace UpmGitTool
{
......@@ -13,6 +14,7 @@ namespace UpmGitTool
{
unityManifes = JsonConvert.DeserializeObject<UnityManifes>(jsonStr);
unityManifes.OnSerialized();
OnManifesLoaded();
}
/// <summary>
......@@ -25,5 +27,40 @@ namespace UpmGitTool
/// </summary>
public static string Path_FetchJsCmd;
#region 拉取Git的结果
private static Dictionary<string, UPackage> DictPackages = new Dictionary<string, UPackage>();
private static void OnManifesLoaded()
{
DictPackages.Clear();
var L = unityManifes.ListPackageItems;
int length = L.Count;
for (int i = 0; i < length; i++)
{
var item = L[i];
if (!item.IsGitUrl) continue;
UPackage pkg = new UPackage(item);
DictPackages.Add(pkg.Key, pkg);
}
}
public static UPackage FindPackage(FetchResult fetchRet)
{
if (fetchRet == null) return null;
UPackage pkg;
var key = fetchRet.url;
if (!DictPackages.TryGetValue(key, out pkg))
{
pkg = new UPackage(fetchRet);
DictPackages.Add(key, pkg);
}
pkg.SetData(fetchRet);
return pkg;
}
#endregion
}
}
\ No newline at end of file
/*
*Copyright(C) 2023 by Cocklebur All rights reserved.
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2022-12-26
*模块说明:模板信息
*版本: 1.0
*/
namespace UpmGitTool
{
/// <summary>
/// Unity Package ,这里统一管理
/// </summary>
public class UPackage
{
public FetchResult FetchResult { get; private set; }
public PackageItem PackageItem { get; private set; }
public string Key { get; private set; }
public UPackage(PackageItem item)
{
PackageItem = item;
Key = item.GitPath;
}
public void SetData(FetchResult fetch)
{
FetchResult = fetch;
}
public UPackage(FetchResult fetch)
{
SetData(fetch);
Key = fetch.url;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 9f2a374308be7b744902354ff1951be2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -45,8 +45,6 @@ namespace UpmGitTool.UI
BtnCopy.onClick.AddListener(CopyGitUrl);
}
private void OpenDocumentationUrl()
{
if (UpmVersion == null) return;
......@@ -71,9 +69,12 @@ namespace UpmGitTool.UI
public UpmPackageVersion UpmVersion;
public void InitData(UpmPackageVersion version)
public void InitData(FetchResult fetchResult, UpmPackageVersion version)
{
UpmVersion = version;
if (fetchResult == null || version == null) return;
GitPath.SetText(fetchResult.url);
DescripeLabel.SetText(version.Description);
}
......
Build from CHIEF at 2022/12/26 17:55:19
\ No newline at end of file
Build from CHIEF at 2022/12/26 18:22:42
\ No newline at end of file
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册