|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using System;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
@ -18,6 +20,7 @@ public class EducoderText : MonoBehaviour
|
|
|
|
|
public string userName = "";
|
|
|
|
|
public string url = "https://data.educoder.net/api/users/get_user_info.json?objective_type=shixun&objective_id=xolfhc7f&school=1";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
@ -53,9 +56,53 @@ public class EducoderText : MonoBehaviour
|
|
|
|
|
decryptedText = Decrypt(encryptedText, shiftValue);
|
|
|
|
|
Debug.Log("Encrypted text: " + decryptedText);
|
|
|
|
|
|
|
|
|
|
StartCoroutine(SendGetRequest());
|
|
|
|
|
// StartCoroutine(SendGetRequest());
|
|
|
|
|
SendRequest();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SendRequest()
|
|
|
|
|
{
|
|
|
|
|
//发送请求并接收
|
|
|
|
|
EduCoderTool.WebConnecter.Singleton.SendMsg("type", "getTaskData");
|
|
|
|
|
//解析
|
|
|
|
|
string jsonstr = text.text;
|
|
|
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(jsonstr);
|
|
|
|
|
if (jo == null)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("获取用户信息失败");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string userLogin = jo["user"]["login"].ToString();
|
|
|
|
|
Debug.Log("Login"+userLogin);
|
|
|
|
|
|
|
|
|
|
if (userLogin.Contains(decryptedText))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (GameManager.Instance.succeed)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
GameManager.Instance.OverWnd.SetActive(true);
|
|
|
|
|
EduCoderTool.WebConnecter.Singleton.SendResultToWeb(true);
|
|
|
|
|
Debug.Log("yes");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GameManager.Instance.FailWnd.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GameManager.Instance.FailWnd.SetActive(true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator SendGetRequest()
|
|
|
|
|
{
|
|
|
|
|
using (UnityWebRequest request = UnityWebRequest.Get(url))
|
|
|
|
|