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

【UpmGitTool】手动拉取Git包的方法;

上级 83f7f1d7
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
namespace UpmGitTool
{
......@@ -18,7 +17,7 @@ namespace UpmGitTool
{
var name = version.Name;
var gitPath = version.GitUrl;
AppState.unityManifes?.InstallVersion(name,gitPath);
AppState.unityManifes?.InstallVersion(name, gitPath);
}
public static void InstallVersion(this DependencyInfo depency)
......@@ -111,7 +110,7 @@ namespace UpmGitTool
/// <param name="targetVer">目标版本</param>
public static bool IsCurrentVersionNewer(string curVer, string targetVer)
{
var cV= SemVersion.Parse(curVer);
var cV = SemVersion.Parse(curVer);
var tV = SemVersion.Parse(targetVer);
return cV >= tV;
}
......@@ -154,12 +153,16 @@ namespace UpmGitTool
{
if (pkg == null) return;
var gitUrl = pkg.PackageUrl;
pkg.FetchReq = StartFetchGitUrl(gitUrl);
}
public static GitFetchReq StartFetchGitUrl(string gitUrl)
{
GitFetchReq req = new GitFetchReq(gitUrl);
pkg.FetchReq = req;
QueueGitFetchReq.Enqueue(req);
req.State = E_FetchState.Waitting;
GYEventsCenter.PostNotification(Lib.ON_ADD_GIT_FETCH_REQ, QueueGitFetchReq);
return req;
}
/// <summary>
......
/*
*Copyright(C) 2023 by Cocklebur All rights reserved.
*Unity版本:2022.2.1f1c1
*作者:Chief
*创建日期: 2023-01-12
*模块说明:模板信息
*版本: 1.0
*/
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace UpmGitTool.UI
{
/// <summary>
/// 手动拉取控件
/// </summary>
public class UICtrl_ManualFetch : MonoBehaviour
{
[LabelText("打开按钮")]
public Button BtnOpen;
[LabelText("关闭按钮")]
public Button BtnClose;
[LabelText("拉取按钮")]
public Button BtnFetch;
[LabelText("Git拉取地址输入框")]
public TMP_InputField GitPathInputFiled;
private void Start()
{
BtnOpen.onClick.AddListener(Open);
BtnClose.onClick.AddListener(Close);
BtnFetch.onClick.AddListener(Fetch);
GitPathInputFiled.onEndEdit.AddListener(CheckGitPath);
Close();
}
private void Open()
{
SetActive(true);
CheckGitPath(GitPathInputFiled.text);
}
private void Close()
{
SetActive(false);
GitPathInputFiled.text = string.Empty;
}
private void SetActive(bool active)
{
BtnOpen.gameObject.SetActive(!active);
BtnClose.gameObject.SetActive(active);
BtnFetch.gameObject.SetActive(active);
GitPathInputFiled.gameObject.SetActive(active);
}
private void CheckGitPath(string path)
{
bool pathError = IsGitPathError(path);
BtnFetch.interactable = !pathError;
}
private bool IsGitPathError(string path)
{
if (string.IsNullOrEmpty(path)) return true;
if (string.IsNullOrWhiteSpace(path)) return true;
if (!path.Contains("git")) return false;
return false;
}
private void Fetch()
{
string path = GitPathInputFiled.text;
if (IsGitPathError(path)) return;
//从Git上拉取所有包;
CoreFunction.StartFetchGitUrl(path);
Close();
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: c133d8fb396b41547a0b13a337da2d33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册