add live select pannel
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MiniJSON;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class VersionCheckerMatsurihimeAPI
|
||||
{
|
||||
private const string url = @"https://api.matsurihi.me/cgss/v1/version/latest";
|
||||
|
||||
public int version = 0;
|
||||
|
||||
public IEnumerator Check()
|
||||
{
|
||||
using (WWW www = new WWW(url))
|
||||
{
|
||||
yield return www;
|
||||
|
||||
if (!string.IsNullOrEmpty(www.error))
|
||||
{
|
||||
Debug.LogError("www Error:" + www.error);
|
||||
yield break;
|
||||
}
|
||||
Debug.Log(www.text);
|
||||
|
||||
Dictionary<string, object> dic;
|
||||
dic = Json.Deserialize(www.text) as Dictionary<string, object>;
|
||||
if (dic.ContainsKey("res"))
|
||||
{
|
||||
var res = dic["res"] as Dictionary<string, object>;
|
||||
if (res.ContainsKey("version"))
|
||||
{
|
||||
Int64 ver = (Int64)res["version"];
|
||||
version = (int)ver;
|
||||
}
|
||||
}
|
||||
Debug.Log("ResVer:" + version);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user