mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update
Update
This commit is contained in:
@@ -5,6 +5,7 @@ using UnityEditor;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using LitJson;
|
using LitJson;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
namespace TEngine.Editor
|
namespace TEngine.Editor
|
||||||
{
|
{
|
||||||
@@ -29,27 +30,27 @@ namespace TEngine.Editor
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 名称
|
/// 名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string name;
|
public string name = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 作者
|
/// 作者
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string author;
|
public string author = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 版本
|
/// 版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string version;
|
public string version = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发布日期
|
/// 发布日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string releasedDate;
|
public string releasedDate = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 简介
|
/// 简介
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string description;
|
public string description = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 依赖项
|
/// 依赖项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] dependencies;
|
public string[] dependencies = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//资源包信息列表
|
//资源包信息列表
|
||||||
@@ -240,12 +241,17 @@ namespace TEngine.Editor
|
|||||||
private IEnumerator GetPackagesInfo()
|
private IEnumerator GetPackagesInfo()
|
||||||
{
|
{
|
||||||
string url = $"{OnlineUrl}packages.json";
|
string url = $"{OnlineUrl}packages.json";
|
||||||
WWW www = new WWW(url);
|
UnityWebRequest www = UnityWebRequest.Get(url);
|
||||||
yield return www;
|
UnityWebRequestAsyncOperation request = www.SendWebRequest();
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (request.isDone)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
yield return request.isDone;
|
||||||
if (www.error == null)
|
if (www.error == null)
|
||||||
{
|
{
|
||||||
//List<object> list = JsonUtility.FromJson<List<object>>(www.text);
|
List<PackageTemplate> list = JsonMapper.ToObject<List<PackageTemplate>>(www.downloadHandler.text);
|
||||||
List<PackageTemplate> list = JsonMapper.ToObject<List<PackageTemplate>>(www.text);
|
|
||||||
|
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -276,11 +282,17 @@ namespace TEngine.Editor
|
|||||||
{
|
{
|
||||||
string url = $"{OnlineUrl}packages/{package.name}/{package.version}/{package.name}.unitypackage";
|
string url = $"{OnlineUrl}packages/{package.name}/{package.version}/{package.name}.unitypackage";
|
||||||
//Debug.Log(url);
|
//Debug.Log(url);
|
||||||
WWW www = new WWW(url);
|
UnityWebRequest www = UnityWebRequest.Get(url);
|
||||||
yield return www;
|
UnityWebRequestAsyncOperation request = www.SendWebRequest();
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (request.isDone)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
yield return request.isDone;
|
||||||
if (www.error == null)
|
if (www.error == null)
|
||||||
{
|
{
|
||||||
byte[] bytes = www.bytes;
|
byte[] bytes = www.downloadHandler.data;
|
||||||
string path = $"{Application.dataPath}/{package.name}-{package.version}.unitypackage";
|
string path = $"{Application.dataPath}/{package.name}-{package.version}.unitypackage";
|
||||||
//写入本地
|
//写入本地
|
||||||
using (FileStream fs = new FileStream(path, FileMode.Create))
|
using (FileStream fs = new FileStream(path, FileMode.Create))
|
||||||
|
@@ -77,7 +77,6 @@ namespace TEngine.UIEditor
|
|||||||
string url = $"{Application.dataPath}/TResources/{ConfigPath}";
|
string url = $"{Application.dataPath}/TResources/{ConfigPath}";
|
||||||
if (!String.IsNullOrEmpty(url))
|
if (!String.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
string finalPath;
|
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
if (url.StartsWith(Application.persistentDataPath))
|
if (url.StartsWith(Application.persistentDataPath))
|
||||||
url = $"file://{url}";
|
url = $"file://{url}";
|
||||||
|
Reference in New Issue
Block a user