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

【UpmGitTool】启动时拉一个协程自动读取已下载的包,并调整界面显示;

上级 95812b3a
......@@ -253,7 +253,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 2.2.4 (UpmGitExtension)
m_text: 2.2.4 (UpmGitExtension)............
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 6713738f712c7ac459acc1cd37b85c45, type: 2}
m_sharedMaterial: {fileID: -953019786661498290, guid: 6713738f712c7ac459acc1cd37b85c45, type: 2}
......@@ -298,7 +298,7 @@ MonoBehaviour:
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_overflowMode: 1
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
......
......@@ -5885,7 +5885,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: -152.56996, y: 0}
m_AnchoredPosition: {x: -152.56996, y: 0.00047928447}
m_SizeDelta: {x: 305.14, y: 400.68}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1245554590
......@@ -6547,7 +6547,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 202069241}
m_Direction: 2
m_Value: 0
m_Size: 1
m_Size: 0.9999631
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
......@@ -7184,8 +7184,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 202.05, y: 133.518}
m_SizeDelta: {x: 864.21, y: 58.53}
m_AnchoredPosition: {x: 186.45, y: 132.68}
m_SizeDelta: {x: 833.02, y: 93.66}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1519007851
MonoBehaviour:
......@@ -7207,7 +7207,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: https://gitcode.net/.........
m_text: https://gitcode.net/.........https://gi
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 6713738f712c7ac459acc1cd37b85c45, type: 2}
m_sharedMaterial: {fileID: -953019786661498290, guid: 6713738f712c7ac459acc1cd37b85c45, type: 2}
......@@ -7252,7 +7252,7 @@ MonoBehaviour:
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_overflowMode: 1
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
......
......@@ -12,7 +12,6 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UpmGitTool.UI;
namespace UpmGitTool
{
......@@ -28,6 +27,8 @@ namespace UpmGitTool
AppState.Path_WorkingDirectory = WorkingDirectory;
AppState.Path_NodeJsExe = NodeJsPath;
GYEventsCenter.RegisterEventMsg(Lib.ON_ADD_GIT_FETCH_REQ, OnAddGitFetchReq);
StartCoroutine(AutoReadFeatchResult());
}
......@@ -53,19 +54,24 @@ namespace UpmGitTool
[FolderPath(AbsolutePath = true)]
public string WorkingDirectory;
[Button]
public void ReadFetchResult()
private IEnumerator AutoReadFeatchResult()
{
string url = "https://e.coding.net/Cyf649669121/unitypackage/UnityPackage.git#GYGame_GYEcs";
string lastName = url.GetGitLastName();
Logger.LogError(lastName);
string resultDir = $"{WorkingDirectory}/Results-2.0.0";
string resultDir = $"{AppState.Path_WorkingDirectory}/Results-2.0.0";
var files = Directory.GetFiles(resultDir, $"*.json");
foreach (var file in Directory.GetFiles(resultDir, $"*{lastName}.json"))
Debug.LogError(file);
foreach (var file in files)
{
if (!File.Exists(file)) continue;
var text = File.ReadAllText(file, System.Text.Encoding.UTF8);
yield return null;
var result = JsonUtility.FromJson<FetchResult>(text);
yield return null;
AppState.SetFetchResult(result);
yield return null;
}
}
private void OnAddGitFetchReq(string msgId, object data)
{
if (reqCorotinue != null) return;
......
......@@ -69,13 +69,14 @@ namespace UpmGitTool
private static void AddPackage(PackageItem item)
{
UPackage pkg;
if (DictAllPackages.TryGetValue(item.PackageId, out pkg))
string key = item.Name;
if (DictAllPackages.TryGetValue(key, out pkg))
{
pkg.UpdateData(item);
pkg.OnDataRefresh();
}
else
DictAllPackages.Add(item.Name, new UPackage(item));
DictAllPackages.Add(key, new UPackage(item));
}
public static void SetFetchResult(FetchResult fetchRet)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册