mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 03:10:11 +00:00
处理unity版本兼容
This commit is contained in:
@@ -9,10 +9,6 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEditor.Compilation;
|
|
||||||
using System.IO;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ using UnityEngine.SceneManagement;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Compilation;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
@@ -120,20 +119,20 @@ namespace XCharts
|
|||||||
networkError = "";
|
networkError = "";
|
||||||
var url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/Assets/XCharts/package.json";
|
var url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/Assets/XCharts/package.json";
|
||||||
var web = UnityWebRequest.Get(url);
|
var web = UnityWebRequest.Get(url);
|
||||||
#if UNITY_5
|
#if UNITY_2017_3_OR_NEWER
|
||||||
yield return web.Send();
|
|
||||||
#else
|
|
||||||
yield return web.SendWebRequest();
|
yield return web.SendWebRequest();
|
||||||
|
#else
|
||||||
|
yield return web.Send();
|
||||||
#endif
|
#endif
|
||||||
CheckVersionWebRequest(web);
|
CheckVersionWebRequest(web);
|
||||||
if (isNetworkError)
|
if (isNetworkError)
|
||||||
{
|
{
|
||||||
url = "https://gitee.com/monitor1394/unity-ugui-XCharts/raw/master/Assets/XCharts/package.json";
|
url = "https://gitee.com/monitor1394/unity-ugui-XCharts/raw/master/Assets/XCharts/package.json";
|
||||||
web = UnityWebRequest.Get(url);
|
web = UnityWebRequest.Get(url);
|
||||||
#if UNITY_5
|
#if UNITY_2017_3_OR_NEWER
|
||||||
yield return web.Send();
|
yield return web.SendWebRequest();
|
||||||
#else
|
#else
|
||||||
yield return web.SendWebRequest();
|
yield return web.Send();
|
||||||
#endif
|
#endif
|
||||||
CheckVersionWebRequest(web);
|
CheckVersionWebRequest(web);
|
||||||
}
|
}
|
||||||
@@ -141,19 +140,19 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/Assets/XCharts/CHANGELOG.md";
|
url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/Assets/XCharts/CHANGELOG.md";
|
||||||
web = UnityWebRequest.Get(url);
|
web = UnityWebRequest.Get(url);
|
||||||
#if UNITY_5
|
#if UNITY_2017_3_OR_NEWER
|
||||||
yield return web.Send();
|
yield return web.SendWebRequest();
|
||||||
#else
|
#else
|
||||||
yield return web.SendWebRequest();
|
yield return web.Send();
|
||||||
#endif
|
#endif
|
||||||
if (!CheckLogWebRequest(web))
|
if (!CheckLogWebRequest(web))
|
||||||
{
|
{
|
||||||
url = "https://gitee.com/monitor1394/unity-ugui-XCharts/raw/master/Assets/XCharts/CHANGELOG.md";
|
url = "https://gitee.com/monitor1394/unity-ugui-XCharts/raw/master/Assets/XCharts/CHANGELOG.md";
|
||||||
web = UnityWebRequest.Get(url);
|
web = UnityWebRequest.Get(url);
|
||||||
#if UNITY_5
|
#if UNITY_2017_3_OR_NEWER
|
||||||
yield return web.Send();
|
yield return web.SendWebRequest();
|
||||||
#else
|
#else
|
||||||
yield return web.SendWebRequest();
|
yield return web.Send();
|
||||||
#endif
|
#endif
|
||||||
CheckLogWebRequest(web);
|
CheckLogWebRequest(web);
|
||||||
}
|
}
|
||||||
@@ -391,8 +390,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (assembly.name.Equals("Unity.TextMeshPro")) return true;
|
if (assembly.name.Equals("Unity.TextMeshPro")) return true;
|
||||||
}
|
}
|
||||||
#else
|
#elif UNITY_2017_3_OR_NEWER
|
||||||
foreach (var assembly in CompilationPipeline.GetAssemblies())
|
foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies())
|
||||||
{
|
{
|
||||||
if (assembly.name.Equals("Unity.TextMeshPro")) return true;
|
if (assembly.name.Equals("Unity.TextMeshPro")) return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user