diff --git a/Platformer_001/Assets/Scenes (Level)/MenuSystem/Bestenliste.unity b/Platformer_001/Assets/Scenes (Level)/MenuSystem/Bestenliste.unity index 8cfa064..4b148c8 100644 --- a/Platformer_001/Assets/Scenes (Level)/MenuSystem/Bestenliste.unity +++ b/Platformer_001/Assets/Scenes (Level)/MenuSystem/Bestenliste.unity @@ -1155,12 +1155,12 @@ Prefab: - target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d, type: 2} propertyPath: m_AnchoredPosition.x - value: 158.38164 + value: 159.62134 objectReference: {fileID: 0} - target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d, type: 2} propertyPath: m_AnchoredPosition.y - value: 0 + value: -216.5 objectReference: {fileID: 0} - target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d, type: 2} @@ -1882,12 +1882,12 @@ Prefab: - target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d, type: 2} propertyPath: m_AnchoredPosition.x - value: 158.38164 + value: 159.62134 objectReference: {fileID: 0} - target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d, type: 2} propertyPath: m_AnchoredPosition.y - value: 0 + value: -141.5 objectReference: {fileID: 0} - target: {fileID: 224902029835350780, guid: f6748a010e46d4334a2b9717aa34b24d, type: 2} diff --git a/Platformer_001/Assets/Scripts/Bestenliste/Bestenliste.cs b/Platformer_001/Assets/Scripts/Bestenliste/Bestenliste.cs index fdf7a9a..b734e75 100644 --- a/Platformer_001/Assets/Scripts/Bestenliste/Bestenliste.cs +++ b/Platformer_001/Assets/Scripts/Bestenliste/Bestenliste.cs @@ -1,6 +1,4 @@ -using System; using System.Collections; -using System.Runtime.InteropServices.ComTypes; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; @@ -33,17 +31,28 @@ private void Start() StartCoroutine(GetRank()); } - public IEnumerator Submit() + public void Submit() { - // TODO: Implement submitting score + btnSubmit.interactable = false; + btnSubmit.GetComponentInChildren().text = "..."; + StartCoroutine(SubmitNow()); + } + + public IEnumerator SubmitNow() + { + btnSubmit.interactable = false; + btnSubmit.GetComponentInChildren().text = "..."; + print("Submitting score: " + score + " (" + nameInput.text + ")"); - WWWForm form = new WWWForm(); + var form = new WWWForm(); form.AddField("name", nameInput.text); form.AddField("score", score); form.AddField("scoreConfirmationString", scoreConfirmation); var myWr = UnityWebRequest.Post(serverAdress + "/" + submitAdress, form); yield return myWr.Send(); + + Debug.Log("Submiting."); if (myWr.isError) { @@ -51,8 +60,11 @@ public IEnumerator Submit() } else { + print(myWr.responseCode); + print(myWr.downloadHandler.text); PlayerPrefs.SetInt("maxSubmitedEndlosweite", score); CheckSubmitable(); + StartCoroutine(SetupBestenliste()); } }