Commit 7025ee5e authored by nanahira's avatar nanahira

fix

parent 1763a8cc
...@@ -57,12 +57,14 @@ public class MyCardHelper { ...@@ -57,12 +57,14 @@ public class MyCardHelper {
string data_str = data.Stringify(); string data_str = data.Stringify();
UnityWebRequest www = UnityWebRequest.Post("https://api.moecube.com/accounts/signin", data_str); UnityWebRequest www = UnityWebRequest.Post("https://api.moecube.com/accounts/signin", data_str);
www.SetRequestHeader("Content-Type", "application/json"); www.SetRequestHeader("Content-Type", "application/json");
yield return www.SendWebRequest(); www.SendWebRequest();
while (!www.isDone) {
if (www.isNetworkError || www.isHttpError) if (www.isNetworkError || www.isHttpError)
{ {
fail_reason = www.error; fail_reason = www.error;
return false; return false;
} }
}
else if (www.responseCode >= 400) else if (www.responseCode >= 400)
{ {
fail_reason = "Login failed"; fail_reason = "Login failed";
...@@ -92,12 +94,14 @@ public class MyCardHelper { ...@@ -92,12 +94,14 @@ public class MyCardHelper {
string auth_str = Convert.ToBase64String(Encoding.UTF8.GetBytes(username + ":" + userid)); string auth_str = Convert.ToBase64String(Encoding.UTF8.GetBytes(username + ":" + userid));
UnityWebRequest www = UnityWebRequest.Post("https://api.mycard.moe/ygopro/match?locale=zh-CN&arena=" + match_type, new WWWForm()); UnityWebRequest www = UnityWebRequest.Post("https://api.mycard.moe/ygopro/match?locale=zh-CN&arena=" + match_type, new WWWForm());
www.SetRequestHeader("Authorization", "Basic " + auth_str); www.SetRequestHeader("Authorization", "Basic " + auth_str);
yield return www.SendWebRequest(); www.SendWebRequest();
while (!www.isDone) {
if (www.isNetworkError || www.isHttpError) if (www.isNetworkError || www.isHttpError)
{ {
fail_reason = www.error; fail_reason = www.error;
return null; return null;
} }
}
else if (www.responseCode >= 400) else if (www.responseCode >= 400)
{ {
fail_reason = "Match failed"; fail_reason = "Match failed";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment