读取数据提交

This commit is contained in:
lujiajian 2026-02-28 14:44:58 +08:00
parent 20ae0dc713
commit deb33107a6
15 changed files with 17256 additions and 144 deletions

File diff suppressed because it is too large Load Diff

View File

@ -173,7 +173,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 40, y: 232}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0, y: 0}
--- !u!222 &2775206189644597755
@ -325,7 +325,7 @@ MonoBehaviour:
AskBtn: {fileID: 0}
ReturnBtn: {fileID: 0}
ExitBtn: {fileID: 0}
TipBtn: {fileID: 0}
SubitBtn: {fileID: 0}
NameText: {fileID: 0}
UI_TeacherStudentPanel: {fileID: 6919760414214887237, guid: 8374b93723115b64c99d8d5cb7e41885, type: 3}
TeacherAnswerObj: {fileID: 3675123598479809495, guid: 0785fe133ccf307488c2591ab4f0bd63, type: 3}
@ -368,7 +368,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 40, y: 48}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0, y: 0}
--- !u!222 &7411791128860612562
@ -448,7 +448,7 @@ MonoBehaviour:
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_Interactable: 0
m_TargetGraphic: {fileID: 555986447467515265}
m_OnClick:
m_PersistentCalls:
@ -1176,6 +1176,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4377687358363293253}
- component: {fileID: 5429741907741161556}
- component: {fileID: 5204821319290877857}
m_Layer: 5
m_Name: UpBg
m_TagString: Untagged
@ -1202,10 +1204,50 @@ RectTransform:
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 1080}
m_Pivot: {x: 0.5, y: 0}
m_SizeDelta: {x: 83.8573, y: 393.4985}
m_Pivot: {x: 0, y: 0}
--- !u!114 &5429741907741161556
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6477531639293015313}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 48
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 8
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &5204821319290877857
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6477531639293015313}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 0
--- !u!1 &7388906993091369069
GameObject:
m_ObjectHideFlags: 0
@ -1500,7 +1542,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 40, y: 140}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0, y: 0}
--- !u!222 &8506850147581141538

File diff suppressed because it is too large Load Diff

View File

@ -182,8 +182,9 @@ public class LineManager : SerializedMonoBehaviour
if (Highlights.Count <= 0)
{
ComputerPanel.gameObject.SetActive(true);
TipTexts.text = "当前实验图形已显示。";
TipTexts.text = "当前实验图形已显示,请上传实验报告。";
StartCoroutine(WaitHide(Tips));
UI_TopTitlePanel.instance.SubitBtn.gameObject.SetActive(true);
Highlights = Highlights_Backup.ToList();
Bootstrap.Instance.uiManager.HidePanel<UI_TopTipPanel>();
}

View File

@ -1,9 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.UI;
using XCharts.Runtime;
public class ChartControl : MonoBehaviour
@ -21,17 +27,185 @@ public class ChartControl : MonoBehaviour
public TextMeshProUGUI y2;
public TextMeshProUGUI Sx1;
public TextMeshProUGUI Sy1;
List<string> togglename = new List<string>();
private Coroutine coroutine;
/// <summary>
/// 通道名称
/// </summary>
public string fondname;
public List<Toggle> toggles = new List<Toggle>();
private string streaming;
public Button Start_;
public Button Stop_;
/// <summary>
/// 文本的数据
/// </summary>
public string txtdata;
/// <summary>
/// 通道面板
/// </summary>
public GameObject tdbg;
/// <summary>
/// 确认选择的通道
/// </summary>
public Button EnterTd;
/// <summary>
/// 选择通道
/// </summary>
public TMP_Dropdown TdDrop;
void Start()
{
Start_.onClick.AddListener(() =>
{
Start_.interactable = false;
if (togglename.Count == 1)
{
if (chart.series.Count > 1)
{
//chart.RemoveSerie<SimplifiedLine>();
chart.series.Remove(chart.series[1]);
}
coroutine = StartCoroutine(InitializeFile("cmd1.ini"));
tdbg.SetActive(false);
}
if (togglename.Count == 2)
{
if (chart.series.Count < 2)
{
chart.AddSerie<SimplifiedLine>();
}
coroutine = StartCoroutine(InitializeFile("cmd2.ini"));
tdbg.SetActive(true);
}
});
Stop_.onClick.AddListener(() =>
{
Start_.interactable = true;
});
EnterTd.onClick.AddListener(() =>
{
fondname = TdDrop.captionText.text;
});
streaming = Application.streamingAssetsPath;
}
public string tempstr = "";
// 初始化:从 StreamingAssets 复制到 persistentDataPath
IEnumerator InitializeFile(string fileName)
{
// 从 StreamingAssets 读取
string streamingPath = Path.Combine(Application.streamingAssetsPath, fileName);
using (UnityWebRequest request = UnityWebRequest.Get(streamingPath))
{
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
chart.ClearData();
// 写入到可读写目录
var str = request.downloadHandler.text.Split('\n');
if (fileName == "cmd1.ini")
{
str[1] = "td=" + togglename[0];
fondname = "td=" + togglename[0];
chart.series[0].serieName = "通道" + togglename[0];
string ini = string.Concat(str[0], "\n", str[1], "\n", str[2]);
File.WriteAllText(streaming + "/" + fileName, ini);
// yield return new WaitForSeconds(1.5f);
StartCoroutine(GetConfig(b =>
{
var data = txtdata.Split('@');
for (int i = 0; i < data.Length - 1; i++)
{
var datas = data[i].Split(',');
chart.AddXAxisData(datas[0]);
serie.AddYData(double.Parse(datas[1]));
}
}, "data1.txt"));
}
else
{
TdDrop.ClearOptions();
chart.series[0].serieName = "通道" + togglename[0];
chart.series[1].serieName = "通道" + togglename[1];
List<string> list = new List<string>();
list.Add(chart.series[0].serieName);
list.Add(chart.series[1].serieName);
TdDrop.AddOptions(list);
fondname = TdDrop.captionText.text;
str[1] = "td=" + togglename[0];
str[2] = "td=" + togglename[1];
string ini = string.Concat(str[0], "\n", str[1], "\n", str[2], "\n", str[3]);
//yield return new WaitForSeconds(1.5f);
File.WriteAllText(streaming + "/" + fileName, ini);
Debug.Log(ini);
StartCoroutine(GetConfig(b =>
{
var data = txtdata.Split('@');
for (int i = 0; i < data.Length - 1; i++)
{
var datas = data[i].Split(',');
chart.AddXAxisData(datas[0]);
chart.series[0].AddYData(double.Parse(datas[1]));
chart.series[1].AddYData(double.Parse(datas[2]));
}
Debug.Log(data.Count());
}, "data2.txt"));
}
}
else
{
Debug.LogError($"读取失败:{request.error}");
}
}
}
private void Awake()
{
serie = chart.GetSerie<Serie>();
}
void Update()
{
for (int i = 0; i < toggles.Count; i++)
{
if (toggles[i].isOn)
{
if (!togglename.Contains(toggles[i].name))
togglename.Add(toggles[i].name);
}
else
{
if (!toggles[i].isOn)
{
if (togglename.Contains(toggles[i].name))
togglename.Remove(toggles[i].name);
}
}
}
if (togglename.Count > 2)
{
Start_.interactable = false;
Stop_.interactable = false;
Debug.Log("所选的通道超过最大限制");
}
else if (togglename.Count > 0 && togglename.Count < 3)
{
Start_.interactable = true;
Stop_.interactable = true;
}
Debug.Log("数据:" + serie.context.pointerItemDataIndex);
if (serie.context.pointerItemDataIndex >= 0 && isclick)
{
SerieData series = chart.GetSerie("数据").GetSerieData(serie.context.pointerItemDataIndex);
SerieData series = chart.GetSerie(fondname).GetSerieData(serie.context.pointerItemDataIndex);
Debug.Log("鼠标点击的数据:" + series.data[1]);
XAxis Xaxis = chart.GetChartComponent<XAxis>();
Debug.Log("X轴名称" + Xaxis.data[0]);
@ -43,14 +217,13 @@ public class ChartControl : MonoBehaviour
}
if (data.Count > 1)
{
string[] str1 = data[0].Split('|');
string[] str2 = data[1].Split('|');
x1.text = "X1 = " + str1[0];
x2.text = "X2 = " + str2[0];
y1.text = "Y1 = "+str1[1];
y2.text = "Y2 = "+ str2[1];
Sy1.text = "▲Y = "+ MathF.Abs(float.Parse(str1[1]) - float.Parse(str2[1])).ToString();
y1.text = "Y1 = " + str1[1];
y2.text = "Y2 = " + str2[1];
Sy1.text = "▲Y = " + MathF.Abs(float.Parse(str1[1]) - float.Parse(str2[1])).ToString();
//Text.text = str1[0] + "" + str1[1] + "和" + str2[0] + "" + str2[1] + "的差值为:" + MathF.Abs(float.Parse(str1[1]) - float.Parse(str2[1]));
Debug.Log(str1[0] + "" + str1[1] + "和" + str2[0] + "" + str2[1] + "的差值为:" + MathF.Abs(float.Parse(str1[1]) - float.Parse(str2[1])));
data = new List<string>();
@ -63,38 +236,26 @@ public class ChartControl : MonoBehaviour
isclick = true;
}
}
//Debug.Log(chart.GetChartComponent<Tooltip>().runtimeDataIndex.Count);
//List<int> data = new List<int>();
//data = chart.GetChartComponent<Tooltip>().runtimeDataIndex;
//for (int i = 0; data.Count > i; i++)
//{
// Debug.Log("数据:" + data[i]);
//}
//if (chart.GetChartComponent<Tooltip>().IsActive())
//{
// Debug.Log("数据:" + serie.context.pointerItemDataIndex);
// if (serie.context.pointerItemDataIndex > 0)
// {
// SerieData series = chart.GetSerie("数据").GetSerieData(serie.context.pointerItemDataIndex);
// Debug.Log("鼠标点击的数据:" + series.data[1]);
// XAxis Xaxis = chart.GetChartComponent<XAxis>();
// Debug.Log("X轴名称" + Xaxis.data[0]);
// string value = Xaxis.data[0] + "|" + series.data[1].ToString();
// if (!data.Contains(value))
// {
// data.Add(value);
// }
// }
// if (data.Count >= 2)
// {
// string[] str1 = data[0].Split('|');
// string[] str2 = data[1].Split('|');
// Debug.Log(str1[0] + "" + str1[1] + "和" + str2[0] + "" + str2[1] + "的差值为:" + MathF.Abs(float.Parse(str1[1]) - float.Parse(str2[1])));
// data = new List<string>();
// }
//}
}
/// <summary>
/// 获取配置数据
/// </summary>
/// <param name="action"></param>
/// <returns></returns>
private IEnumerator GetConfig(System.Action<bool> action, string name)
{
UnityWebRequest www = UnityWebRequest.Get(Application.streamingAssetsPath + "/" + name);
yield return www.SendWebRequest();
if ((www.result == UnityWebRequest.Result.ProtocolError) || (www.result == UnityWebRequest.Result.ConnectionError))
{
Debug.Log(www.error);
action(false);
}
else
{
Debug.Log(www.downloadHandler.text);
txtdata = www.downloadHandler.text;
action(true);
}
}
}

View File

@ -34,7 +34,7 @@ public class SubjectToggle : BaseItem, IPointerEnterHandler, IPointerExitHandler
Bootstrap.Instance.uiManager.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) =>
{
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.5f);
Bootstrap.Instance.scenesManager.LoadSceneAsyn(this, "xianchang", () =>
Bootstrap.Instance.scenesManager.LoadSceneAsyn(this, "xianchang_BF 1", () =>
{
Bootstrap.Instance.uiManager.ShowPanel<UI_TopTitlePanel>(this, E_UI_Layer.Top, (panel) =>
{

View File

@ -5,10 +5,11 @@ using UnityEngine.UI;
public class UI_TopTitlePanel : BasePanel
{
public static UI_TopTitlePanel instance;
public Button AskBtn; //问答按钮
public Button ReturnBtn; //返回按钮
public Button ExitBtn; //退出按钮
public Button TipBtn; //×ÊÁϰ´Å¥
public Button SubitBtn; //Ìá½»°´Å¥
public TextMeshProUGUI NameText; //用户名
public UI_TeacherStudentPanel UI_TeacherStudentPanel; //问答面板
public UI_TeacherAnswer TeacherAnswerObj;//老师回答生成面板
@ -16,6 +17,7 @@ public class UI_TopTitlePanel : BasePanel
protected override void Awake()
{
base.Awake();
OnInit();
}
@ -27,19 +29,20 @@ public class UI_TopTitlePanel : BasePanel
ReturnBtn = GetControl<Button>("返回");
ExitBtn = GetControl<Button>("退出按钮");
DataBtn = GetControl<Button>("数据按钮");
TipBtn = GetControl<Button>("Ìá½»°´Å¥");
SubitBtn = GetControl<Button>("Ìá½»°´Å¥");
instance = this;
}
public override void ShowMe()
{
base.ShowMe();
Scene currentScene = SceneManager.GetActiveScene();
if (currentScene.name == "xianchang")
if (currentScene.name == "xianchang_BF 1")
{
AskBtn.gameObject.SetActive(true);
ReturnBtn.gameObject.SetActive(true);
DataBtn.gameObject.SetActive(true);
TipBtn.gameObject.SetActive(true);
SubitBtn.gameObject.SetActive(false);
ExitBtn.gameObject.SetActive(false);
NameText.text = LoginManager.Instance.loginRespons.data.login_name;
@ -50,7 +53,7 @@ public class UI_TopTitlePanel : BasePanel
AskBtn.gameObject.SetActive(false);
ReturnBtn.gameObject.SetActive(false);
DataBtn.gameObject.SetActive(false);
TipBtn.gameObject.SetActive(false);
SubitBtn.gameObject.SetActive(false);
}
}
@ -71,9 +74,9 @@ public class UI_TopTitlePanel : BasePanel
Debug.Log("问答面板显示");
GameObject Player = GameObject.FindGameObjectWithTag("Player");
Player.GetComponent<FirstPersonController>().enabled = false;
panel.Answer1();
});
});
break;
case "返回":
ReturnScene();
@ -87,7 +90,7 @@ public class UI_TopTitlePanel : BasePanel
break;
case "提交按钮":
Debug.Log("提交按钮");
Bootstrap.Instance.uiManager.ShowPanel<UI_ReportUploadPanel>(this, E_UI_Layer.Top,
(panel) =>
{
@ -132,7 +135,7 @@ public class UI_TopTitlePanel : BasePanel
break;
}
}
/// <summary>
/// 退出应用
/// </summary>

View File

@ -0,0 +1,3 @@
[config]
td=1
time=20

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4eebb3dadf9ee5d49986c8cc7996aaa2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,4 @@
[config]
td=2
td=1
time=20

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 03ab8719158909f46b280bef844c4020
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
0,6.63086@150,6.63086@300,6.63574@450,6.63086@600,6.63086@750,6.63574@900,6.63574@1050,6.63574@1200,6.63086@1350,6.63574@

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ea158aa99fe42c348802a9f59e9105e9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
0,6.63574,3.30078@20,6.63574,3.30078@40,6.63574,3.30078@60,6.63574,3.30078@80,6.63574,3.30078@100,6.63574,3.30078@120,6.63574,3.30078@140,6.64063,3.30078@160,6.63574,3.30078@180,6.63574,3.30078@200,6.63574,3.30078@220,6.63574,3.30078@240,6.63574,3.30078@260,6.63574,3.30078@280,6.63574,3.30078@300,6.63574,3.30078@320,6.63574,3.30078@340,6.63574,3.30078@360,6.63574,3.30078@380,6.63086,3.30078@400,6.63574,3.30078@420,6.63574,3.30078@440,6.63574,3.30078@460,6.63574,3.30078@480,6.63574,3.30078@500,6.63574,3.30078@520,6.64063,3.30078@540,6.64063,3.30078@560,6.63574,3.30078@580,6.63574,3.30078@600,6.63574,3.30078@620,6.63574,3.30566@640,6.63574,3.30078@660,6.64063,3.30566@680,6.63574,3.30078@700,6.63574,3.30566@720,6.63574,3.30078@740,6.64063,3.30078@760,6.63086,3.30078@780,6.63574,3.30078@800,6.63574,3.30078@820,6.64063,3.30078@840,6.63574,3.30078@860,6.63574,3.30078@880,6.64063,3.30078@900,6.63574,3.30078@920,6.63574,3.30078@940,6.63574,3.30078@960,6.64063,3.30078@980,6.63574,3.30078@1000,6.63574,3.30078@1020,6.63574,3.30078@1040,6.63574,3.30078@1060,6.63574,3.30078@1080,6.63574,3.30078@1100,6.63574,3.30078@1120,6.64063,3.30078@1140,6.64063,3.30566@1160,6.63574,3.30078@1180,6.63574,3.30078@1200,6.63574,3.30078@1220,6.64063,3.30566@1240,6.63574,3.30078@1260,6.63574,3.30078@1280,6.63574,3.30078@1300,6.63574,3.30078@

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fc7d9b6f777412c4ea8a37c9a25dd249
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: