Files
XCharts/Scripts/Runtime/Utility/XChartsMgr.cs
2019-10-22 13:02:37 +08:00

57 lines
1.5 KiB
C#

using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
namespace XCharts
{
public class XChartsMgr : MonoBehaviour
{
[SerializeField] private string m_Version;
[SerializeField] private string m_Date;
private XChartsMgr m_XCharts;
public XChartsMgr Instance
{
get
{
if (m_XCharts == null)
{
var go = new GameObject();
go.name = "_xcharts_";
m_XCharts = go.AddComponent<XChartsMgr>();
CheckVersion();
}
return m_XCharts;
}
}
private XChartsMgr() { }
private void Awake()
{
CheckVersion();
}
public void CheckVersion()
{
//StartCoroutine(GetVersion());
}
IEnumerator GetVersion()
{
var url = "https://raw.githubusercontent.com/monitor1394/unity-ugui-XCharts/master/README.md";
var web = new UnityWebRequest(url);
Debug.LogError(web.url);
yield return web.SendWebRequest();
if (web.isHttpError || web.isNetworkError)
Debug.LogError(web.error);
else
{
Debug.LogError(web.downloadedBytes);
Debug.LogError(web.downloadHandler.text);
web.Dispose();
}
}
}
}