-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# This .gitignore file should be placed at the root of your Unity project directory | ||
# | ||
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore | ||
# | ||
/[Ll]ibrary/ | ||
/[Tt]emp/ | ||
/[Oo]bj/ | ||
/[Bb]uild/ | ||
/[Bb]uilds/ | ||
/[Ll]ogs/ | ||
/[Mm]emoryCaptures/ | ||
|
||
# Asset meta data should only be ignored when the corresponding asset is also ignored | ||
!/[Aa]ssets/**/*.meta | ||
|
||
# Uncomment this line if you wish to ignore the asset store tools plugin | ||
# /[Aa]ssets/AssetStoreTools* | ||
|
||
# Autogenerated Jetbrains Rider plugin | ||
[Aa]ssets/Plugins/Editor/JetBrains* | ||
|
||
# Visual Studio cache directory | ||
.vs/ | ||
|
||
# Gradle cache directory | ||
.gradle/ | ||
|
||
# Autogenerated VS/MD/Consulo solution and project files | ||
ExportedObj/ | ||
.consulo/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
*.pdb | ||
*.mdb | ||
*.opendb | ||
*.VC.db | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
*.pdb.meta | ||
*.mdb.meta | ||
|
||
# Unity3D generated file on crash reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.unitypackage | ||
|
||
# Crashlytics generated file | ||
crashlytics-build.properties | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using UnityEngine.UIElements; | ||
|
||
namespace Sonic853.UpmGithubManager | ||
{ | ||
class DragLine | ||
{ | ||
public static VisualElement CreateDragLine(VisualElement obj, SquareResizer.Direction direction = SquareResizer.Direction.Horizontal, SquareResizer.PanelFloat panelfloat = SquareResizer.PanelFloat.Left, float minSize = 100) | ||
{ | ||
// dragLineAnchor | ||
VisualElement dragLineAnchor = new VisualElement(); | ||
dragLineAnchor.name = "unity-debugger-splitter-dragline-anchor"; | ||
dragLineAnchor.AddToClassList(direction == SquareResizer.Direction.Horizontal ? "horizontal" : "vertical"); | ||
// dragLine | ||
VisualElement dragLine = new VisualElement(); | ||
dragLine.name = "unity-debugger-splitter-dragline"; | ||
dragLine.AddManipulator(new SquareResizer(obj, direction, panelfloat, minSize)); | ||
dragLineAnchor.Add(dragLine); | ||
return dragLineAnchor; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
using UnityEngine; | ||
using UnityEngine.Networking; | ||
|
||
namespace Sonic853.UpmGithubManager | ||
{ | ||
class GithubAPI | ||
{ | ||
/// <summary> | ||
/// 查询用的 Token,如果不填写,每小时只能查询 60 次 | ||
/// </summary> | ||
public static string Token; | ||
/// <summary> | ||
/// 获取所有 Tag | ||
/// </summary> | ||
/// <param name="url"></param> | ||
/// <returns></returns> | ||
public static async Task<string[]> GetTags(string url) | ||
{ | ||
// url = https://github.com/Username/Repo.git | ||
// 从 url 获取 Username/Repo,去掉 .git | ||
string[] urlSplit = url.Split('/'); | ||
string repo = urlSplit[urlSplit.Length - 1]; | ||
if (repo.EndsWith(".git")) | ||
{ | ||
repo = repo.Substring(0, repo.Length - 4); | ||
} | ||
string username = urlSplit[urlSplit.Length - 2]; | ||
// https://api.github.com/repos/Username/Repo/tags | ||
string apiUrl = "https://api.github.com/repos/" + username + "/" + repo + "/tags"; | ||
UnityWebRequest www = UnityWebRequest.Get(apiUrl); | ||
if (Token != null) | ||
{ | ||
www.SetRequestHeader("Authorization", "Bearer " + Token); | ||
} | ||
await www.SendWebRequest(); | ||
if (www.isNetworkError || www.isHttpError) | ||
{ | ||
Debug.LogError(www.error); | ||
return new string[0]; | ||
} | ||
else | ||
{ | ||
var _result = JsonConvert.DeserializeObject<GithubAPITag[]>(www.downloadHandler.text); | ||
string[] tags = new string[_result.Length]; | ||
for (int i = 0; i < _result.Length; i++) | ||
{ | ||
tags[i] = _result[i].name; | ||
} | ||
return tags; | ||
} | ||
} | ||
public static async Task<string[]> GetBranches(string url) | ||
{ | ||
// url = https://github.com/Username/Repo.git | ||
// 从 url 获取 Username/Repo,去掉 .git | ||
string[] urlSplit = url.Split('/'); | ||
string repo = urlSplit[urlSplit.Length - 1]; | ||
if (repo.EndsWith(".git")) | ||
{ | ||
repo = repo.Substring(0, repo.Length - 4); | ||
} | ||
string username = urlSplit[urlSplit.Length - 2]; | ||
// https://api.github.com/repos/Username/Repo/branches | ||
string apiUrl = "https://api.github.com/repos/" + username + "/" + repo + "/branches"; | ||
UnityWebRequest www = UnityWebRequest.Get(apiUrl); | ||
if (Token != null) | ||
{ | ||
www.SetRequestHeader("Authorization", "Bearer " + Token); | ||
} | ||
await www.SendWebRequest(); | ||
if (www.isNetworkError || www.isHttpError) | ||
{ | ||
Debug.LogError(www.error); | ||
return new string[0]; | ||
} | ||
else | ||
{ | ||
var _result = JsonConvert.DeserializeObject<GithubAPIBranche[]>(www.downloadHandler.text); | ||
string[] branches = new string[_result.Length]; | ||
for (int i = 0; i < _result.Length; i++) | ||
{ | ||
branches[i] = _result[i].name; | ||
} | ||
return branches; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Sonic853.UpmGithubManager | ||
{ | ||
class GithubAPIBranche | ||
{ | ||
public string name; | ||
public GithubAPICommit commit; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Sonic853.UpmGithubManager | ||
{ | ||
class GithubAPICommit | ||
{ | ||
public string sha; | ||
public string url; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Sonic853.UpmGithubManager | ||
{ | ||
class GithubAPITag | ||
{ | ||
public string name; | ||
public string zipball_url; | ||
public string tarball_url; | ||
public GithubAPICommit commit; | ||
public string node_id; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Sonic853.UpmGithubManager | ||
{ | ||
class GithubItem | ||
{ | ||
/// <summary> | ||
/// 包名 | ||
/// </summary> | ||
public string name; | ||
string _url; | ||
/// <summary> | ||
/// URL | ||
/// </summary> | ||
// url = https://github.com/Username/Repo.git?path=/Packages/com.your.package#6.6.6 | ||
public string url | ||
{ | ||
get | ||
{ | ||
return _url + "?path=" + path + (version == "#latest#" ? "" : ("#" + version)); | ||
} | ||
set | ||
{ | ||
oldUrl = value; | ||
string[] urlSplit = value.Split('#'); | ||
if (urlSplit.Length > 1) | ||
{ | ||
version = urlSplit[1]; | ||
} | ||
else | ||
{ | ||
version = "#latest#"; | ||
} | ||
// args | ||
string[] argsSplit = urlSplit[0].Split('?'); | ||
args.Clear(); | ||
path = ""; | ||
_url = argsSplit[0]; | ||
if (argsSplit.Length > 1) | ||
{ | ||
string[] argList = argsSplit[1].Split('&'); | ||
foreach (string arg in argList) | ||
{ | ||
string[] argSplit = arg.Split('='); | ||
if (argSplit.Length > 1) | ||
{ | ||
args.Add(argSplit[0], argSplit[1]); | ||
if (argSplit[0] == "path") | ||
{ | ||
path = argSplit[1]; | ||
} | ||
} | ||
else | ||
{ | ||
args.Add(argSplit[0], ""); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
public string sourceUrl | ||
{ | ||
get | ||
{ | ||
return _url; | ||
} | ||
} | ||
public string oldUrl; | ||
public bool customVersion; | ||
public string version; | ||
public string[] tags; | ||
public string[] branches; | ||
/// <summary> | ||
/// 参数 | ||
/// </summary> | ||
Dictionary<string, string> args = new Dictionary<string, string>(); | ||
/// <summary> | ||
/// 路径 | ||
/// </summary> | ||
public string path; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.