1
Fork 0
mirror of https://github.com/RYGhub/kei.git synced 2024-12-04 22:14:29 +00:00
This commit is contained in:
Steffo 2019-12-10 02:02:36 +01:00
parent e2f11b23c0
commit 835d968956
5 changed files with 13 additions and 6 deletions

View file

@ -18,6 +18,7 @@ public class Network : MonoBehaviour
public string url = "https://ryg.steffo.eu/api/kei"; public string url = "https://ryg.steffo.eu/api/kei";
public string kpid; public string kpid;
public string convid; public string convid;
public string previous = "";
private Sender sender; private Sender sender;
@ -31,7 +32,7 @@ public class Network : MonoBehaviour
kpid = System.Guid.NewGuid().ToString(); kpid = System.Guid.NewGuid().ToString();
PlayerPrefs.SetString("kpid", kpid); PlayerPrefs.SetString("kpid", kpid);
} }
convid = kpid = System.Guid.NewGuid().ToString(); convid = System.Guid.NewGuid().ToString();
StartCoroutine(PostRequest("", "true")); StartCoroutine(PostRequest("", "true"));
} }
@ -41,6 +42,7 @@ public class Network : MonoBehaviour
form.AddField("convid", convid); form.AddField("convid", convid);
form.AddField("message", message); form.AddField("message", message);
form.AddField("first", first); form.AddField("first", first);
form.AddField("previous", previous);
UnityWebRequest request = UnityWebRequest.Post(url, form); UnityWebRequest request = UnityWebRequest.Post(url, form);
yield return request.SendWebRequest(); yield return request.SendWebRequest();
@ -51,9 +53,10 @@ public class Network : MonoBehaviour
else { else {
try { try {
KeiResponse kr = JsonUtility.FromJson<KeiResponse>(request.downloadHandler.text); KeiResponse kr = JsonUtility.FromJson<KeiResponse>(request.downloadHandler.text);
previous = kr.text;
sender.Change(kr.text, kr.emotion); sender.Change(kr.text, kr.emotion);
} }
catch (System.ArgumentException e) { catch (System.ArgumentException) {
Debug.LogError(request.downloadHandler.text); Debug.LogError(request.downloadHandler.text);
} }
} }

View file

@ -34,7 +34,6 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}

View file

@ -120,7 +120,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 23.12 bundleVersion: 23.12.2
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0

View file

@ -3,10 +3,15 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Kei</title> <style>
body {
background-color: black;
}
</style>
<title>Kei</title>
<script src="Build/9b952195ab79ef94f0feaae8cbb8d8ac.js"></script> <script src="Build/9b952195ab79ef94f0feaae8cbb8d8ac.js"></script>
<script> <script>
UnityLoader.instantiate("unityContainer", "Build/09d4f44b8e4f8af02a070032f8a71d94.json"); UnityLoader.instantiate("unityContainer", "Build/8bc04d0c5fddea9b7f70edca255942d1.json");
</script> </script>
</head> </head>
<body> <body>