diff --git a/Assets/Scripts/UI/UIScore.cs b/Assets/Scripts/UI/UIScore.cs index bc346de6..69eb0643 100644 --- a/Assets/Scripts/UI/UIScore.cs +++ b/Assets/Scripts/UI/UIScore.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using System.Collections.Generic; using TMPro; using UnityEngine; @@ -87,7 +88,9 @@ namespace QFramework.Example onlyCur = mData.onlyCurModule; } - + List stepNames = new List(); + List maxScore = new List(); + List scores = new List(); if (onlyCur) { foreach (var item in ScoreController.Instance.GetCurScoreData()) @@ -99,6 +102,9 @@ namespace QFramework.Example obj.transform.Find("Score").GetComponent().text = item.Value.value.ToString(); sum += float.Parse(item.Value.sum); score += item.Value.value; + stepNames.Add(item.Value.step + item.Value.name); + maxScore.Add(int.Parse(item.Value.sum)); + scores.Add((int)item.Value.value); } } else @@ -114,6 +120,9 @@ namespace QFramework.Example obj.transform.Find("Score").GetComponent().text = item.Value.value.ToString(); sum += float.Parse(item.Value.sum); score += item.Value.value; + stepNames.Add(item.Value.step + item.Value.name); + maxScore.Add(int.Parse(item.Value.sum)); + scores.Add((int)item.Value.value); } } } @@ -122,6 +131,9 @@ namespace QFramework.Example this.Score.text = score.ToString(); this.Sum.text = sum.ToString(); +//#if UNITY_WEBGL +// LYTWebGLHelper.Instance.UpLoadData((int)score, stepNames, maxScore, scores); +//#endif } protected override void OnShow() diff --git a/Assets/WebPlatform/Scripts/WebGLHelper.cs b/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs similarity index 75% rename from Assets/WebPlatform/Scripts/WebGLHelper.cs rename to Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs index ad0d032f..1cd7c801 100644 --- a/Assets/WebPlatform/Scripts/WebGLHelper.cs +++ b/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs @@ -11,9 +11,9 @@ using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; -public class WebGLHelper : Singleton +public class LYTWebGLHelper : Singleton { - private WebGLHelper() { } + private LYTWebGLHelper() { } public class LabData { public string GUID; @@ -101,10 +101,10 @@ public class WebGLHelper : Singleton } data.ExpStepVTwoList = list.ToArray(); - + SendScore(JsonConvert.SerializeObject(data)); } - IEnumerator SendScore(string json, UnityAction action) + IEnumerator SendScore(string json, UnityAction action = null) { if (string.IsNullOrEmpty(uploadUrl)) { @@ -132,58 +132,60 @@ public class WebGLHelper : Singleton Debug.Log($"Server Response: {request.downloadHandler.text}"); Response response = JsonConvert.DeserializeObject(request.downloadHandler.text); Debug.LogError(response.msg); + action?.Invoke(response.msg); } } } + + public class UploadData + { + public string GUID { get; set; } + // 实验 ID + public int ExpID { get; set; } + // 成绩 + public int score { get; set; } + // 标志位:默认值 true + public bool flag { get; set; } + // 实验步骤列表 + public Expstepvtwolist[] ExpStepVTwoList { get; set; } + } + + public class Expstepvtwolist + { + // 实验步骤序号 + public int seq { get; set; } + // 实验步骤名称 + public string ExpStepName = ""; + // 实验步骤状态 + public string StepState = ""; + // 实验步骤开始时间 + public DateTime startTime = default; + // 实验步骤结束时间 + public DateTime endTime = default; + // 实验步骤合理用时:单位秒 + public int expectTime = 0; + // 实验步骤满分:0 ~100,百分制 + public int maxScore = 100; + // 实验步骤得分:0 ~100,百分制 + public int score = 0; + // 实验步骤操作次数 + public int repeatCount = 1; + // 步骤评价:200 字以内 + public string evaluation = ""; + // 赋分模型:200 字以内 + public string scoringModel = ""; + // 备注 + public string remarks { get; set; } + } + + public class Response + { + public string msg; + public bool success; + } } -public class UploadData -{ - public string GUID { get; set; } - // 实验 ID - public int ExpID { get; set; } - // 成绩 - public int score { get; set; } - // 标志位:默认值 true - public bool flag { get; set; } - // 实验步骤列表 - public Expstepvtwolist[] ExpStepVTwoList { get; set; } -} - -public class Expstepvtwolist -{ - // 实验步骤序号 - public int seq { get; set; } - // 实验步骤名称 - public string ExpStepName = ""; - // 实验步骤状态 - public string StepState = ""; - // 实验步骤开始时间 - public DateTime startTime = default; - // 实验步骤结束时间 - public DateTime endTime = default; - // 实验步骤合理用时:单位秒 - public int expectTime = 0; - // 实验步骤满分:0 ~100,百分制 - public int maxScore = 100; - // 实验步骤得分:0 ~100,百分制 - public int score = 0; - // 实验步骤操作次数 - public int repeatCount = 1; - // 步骤评价:200 字以内 - public string evaluation = ""; - // 赋分模型:200 字以内 - public string scoringModel = ""; - // 备注 - public string remarks { get; set; } -} - -public class Response -{ - public string msg; - public bool success; -} \ No newline at end of file diff --git a/Assets/WebPlatform/Scripts/WebGLHelper.cs.meta b/Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs.meta similarity index 100% rename from Assets/WebPlatform/Scripts/WebGLHelper.cs.meta rename to Assets/WebPlatform/LaiYiTe/LYTWebGLHelper.cs.meta diff --git a/Assets/WebPlatform/Scripts.meta b/Assets/WebPlatform/Scripts.meta deleted file mode 100644 index 978d3f73..00000000 --- a/Assets/WebPlatform/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b8dbba4c57255fc4495c422b41445cbe -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: