From 32cba06cf01fe8c1192c798321cef7bb784d1aa6 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 24 Apr 2025 16:01:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84web=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/StreamingAssets/Timer.txt | 2 +- Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs | 31 +++++++++++-------- .../_Scripts/Application/UI/ScoreDataPanel.cs | 28 ++++++++++++----- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Assets/StreamingAssets/Timer.txt b/Assets/StreamingAssets/Timer.txt index ca338a4..671004a 100644 --- a/Assets/StreamingAssets/Timer.txt +++ b/Assets/StreamingAssets/Timer.txt @@ -1 +1 @@ -ILBJ05 lj@{~PjaP+Z}> \ No newline at end of file +ILBJ05 lF)#BȲZ\CX"^9 \ No newline at end of file diff --git a/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs b/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs index 1bc743a..2ed167a 100644 --- a/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs +++ b/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs @@ -107,12 +107,16 @@ public class LYTWebGLHelper : MonoBehaviour - public void UpLoadData(int totalScore, List stepNames, List maxScore, List score) + public void UpLoadData(int totalScore, List datas) { if (string.IsNullOrEmpty(token)) { Init(); } + //if (string.IsNullOrEmpty(labData.GUID)) + //{ + // return; + //} var data = new UploadData(); data.GUID = labData.GUID; int expId = 0; @@ -121,16 +125,16 @@ public class LYTWebGLHelper : MonoBehaviour data.score = totalScore; data.flag = true; - var list = new List(); - for (int i = 0; i < stepNames.Count; i++) - { - var step = new Expstepvtwolist(); - step.ExpStepName = stepNames[i]; - step.maxScore = maxScore[i]; - step.score = score[i]; - list.Add(step); - } - data.ExpStepVTwoList = list.ToArray(); + //var list = new List(); + //for (int i = 0; i < stepNames.Count; i++) + //{ + // var step = new Expstepvtwolist(); + // step.ExpStepName = stepNames[i]; + // step.maxScore = maxScore[i]; + // step.score = score[i]; + // list.Add(step); + //} + data.ExpStepVTwoList = datas.ToArray(); StartCoroutine(SendScore(JsonConvert.SerializeObject(data))); } @@ -142,6 +146,7 @@ public class LYTWebGLHelper : MonoBehaviour Debug.LogError("ϴӿڵַ:" + uploadUrl); yield break; } + Debug.LogError("json:" + json); using (UnityWebRequest request = new UnityWebRequest(uploadUrl, "POST")) { request.SetRequestHeader("Content-Type", "application/json"); @@ -191,9 +196,9 @@ public class LYTWebGLHelper : MonoBehaviour // ʵ鲽״̬ public string StepState = ""; // ʵ鲽迪ʼʱ - public DateTime startTime = default; + public string startTime = default; // ʵ鲽ʱ - public DateTime endTime = default; + public string endTime = default; // ʵ鲽ʱλ public int expectTime = 0; // ʵ鲽֣0 ~100ٷ diff --git a/Assets/_Scripts/Application/UI/ScoreDataPanel.cs b/Assets/_Scripts/Application/UI/ScoreDataPanel.cs index d88b17a..3f651af 100644 --- a/Assets/_Scripts/Application/UI/ScoreDataPanel.cs +++ b/Assets/_Scripts/Application/UI/ScoreDataPanel.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; +using static LYTWebGLHelper; /******************************************************************************* *Create By CG *Function @@ -161,9 +162,9 @@ namespace ZXK.LouDiXvMuNiu { float totalScore = 0.0f;//ܵ÷ float actualScore = 0.0f;//ʵʵ÷ - List stepNames = new List(); - List maxScore = new List(); - List scores = new List(); + List datas = new List(); + + int seq = 1; foreach (string[] item in scoreQueue) { //WDebug.Log(item[0] + "@@@" + item[1] + "$$$" + item[2] + "%%%" + item[3]); @@ -182,9 +183,22 @@ namespace ZXK.LouDiXvMuNiu float _actualScore = float.Parse(item[3]); actualScore += _actualScore; totalScore += _totalScore; - stepNames.Add(item[0] + item[1]); - maxScore.Add((int)float.Parse(item[2])); - scores.Add((int)float.Parse(item[3])); + + var dataItem = new Expstepvtwolist(); + dataItem.ExpStepName = item[0] + item[1]; + dataItem.maxScore = (int)float.Parse(item[2]); + dataItem.score = (int)float.Parse(item[3]); + if (GameManager.Instance._DataNiuHandler.scoreTime.ContainsKey(dataItem.ExpStepName)) + { + dataItem.startTime = dataItem.endTime = GameManager.Instance._DataNiuHandler.scoreTime[dataItem.ExpStepName]; + } + else + { + dataItem.startTime = dataItem.endTime = ""; + } + dataItem.seq = seq; + datas.Add(dataItem); + seq++; } @@ -199,7 +213,7 @@ namespace ZXK.LouDiXvMuNiu _studentActualTxt.text = actualScore.ToString(); #if !UNITY_EDITOR && UNITY_WEBGL - LYTWebGLHelper.Instance.UpLoadData((int)totalScore, stepNames, maxScore, scores); + LYTWebGLHelper.Instance.UpLoadData((int)actualScore, datas); #endif } ///