完善web平台对接
This commit is contained in:
parent
28f9c1da4e
commit
32cba06cf0
@ -1 +1 @@
|
||||
ILBJֻֽֿג05ד
†ִlֱ‡נע<D7A0>ַj@{־אה~<7E>Pj…¥טa²ֲPװ+Z}ִ„ְֲ>
|
||||
ILBJÏËÍâ05ã
†ÄlÁ’Fõ)Ÿ#°¹BȲµZ\¦‚CæX"à^9†
|
||||
@ -107,12 +107,16 @@ public class LYTWebGLHelper : MonoBehaviour
|
||||
|
||||
|
||||
|
||||
public void UpLoadData(int totalScore, List<string> stepNames, List<int> maxScore, List<int> score)
|
||||
public void UpLoadData(int totalScore, List<Expstepvtwolist> 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<Expstepvtwolist>();
|
||||
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<Expstepvtwolist>();
|
||||
//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,百分制
|
||||
|
||||
@ -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<string> stepNames = new List<string>();
|
||||
List<int> maxScore = new List<int>();
|
||||
List<int> scores = new List<int>();
|
||||
List<Expstepvtwolist> datas = new List<Expstepvtwolist>();
|
||||
|
||||
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
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user