修改连线bug、图形表显示问题

This commit is contained in:
lujiajian 2026-03-10 16:47:59 +08:00
parent 95c7d92d3b
commit e2827cf013
22 changed files with 2825 additions and 137 deletions

View File

@ -302,6 +302,7 @@ RectTransform:
m_Children:
- {fileID: 4499122912846823943}
- {fileID: 4377687358363293253}
- {fileID: 5311454092380190010}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -330,6 +331,8 @@ MonoBehaviour:
UI_TeacherStudentPanel: {fileID: 6919760414214887237, guid: 8374b93723115b64c99d8d5cb7e41885, type: 3}
TeacherAnswerObj: {fileID: 3675123598479809495, guid: 0785fe133ccf307488c2591ab4f0bd63, type: 3}
DataBtn: {fileID: 0}
ContentTrans: {fileID: 8404470364145622164}
LineTips: {fileID: 9038525972232528669}
--- !u!1 &2191928868238950237
GameObject:
m_ObjectHideFlags: 0
@ -1032,6 +1035,141 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &5068804390091419467
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1171546986935099143}
- component: {fileID: 1097103042514336636}
- component: {fileID: 760023989100677563}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1171546986935099143
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5068804390091419467}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5311454092380190010}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.3496, y: -0.2782}
m_SizeDelta: {x: 222.0991, y: 137.4551}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1097103042514336636
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5068804390091419467}
m_CullTransparentMesh: 1
--- !u!114 &760023989100677563
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5068804390091419467}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u63D0\u793A\uFF1A \u8FD4\u56DE\u6216\u9000\u51FA\u7A0B\u5E8F\u540E\u4F1A\u4FDD\u5B58\u8FDE\u7EBF\uFF0C\u5982\u679C\u4E0D\u9700\u8981\u4FDD\u5B58\u8FDE\u7EBF\uFF0C\u8BF7\u5728\u8FDE\u5B8C\u7EBF\u540E\uFF0C\u6309\u4E0B\u9F20\u6807\u4E2D\u952E\uFF08\u6216\u5207\u6362\u8BFE\u7A0B\uFF09\u5220\u9664\u4FDD\u5B58\u7684\u8FDE\u7EBF\u3002"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 3cee325aec3da104caa0494ae88f026d, type: 2}
m_sharedMaterial: {fileID: 1716905042458031195, guid: 3cee325aec3da104caa0494ae88f026d, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4280344831
m_fontColor: {r: 1, g: 0.87745, b: 0.1273585, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 16
m_fontSizeBase: 16
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &5481693042208734551
GameObject:
m_ObjectHideFlags: 0
@ -1717,3 +1855,80 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &9038525972232528669
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5311454092380190010}
- component: {fileID: 1598233547813555746}
- component: {fileID: 6692345761169356743}
m_Layer: 5
m_Name: "\u80CC\u666F\u63D0\u793A"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5311454092380190010
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9038525972232528669}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1171546986935099143}
m_Father: {fileID: 8404470364145622164}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 1787, y: -177.8277}
m_SizeDelta: {x: 232, y: 155.6554}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1598233547813555746
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9038525972232528669}
m_CullTransparentMesh: 1
--- !u!114 &6692345761169356743
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9038525972232528669}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 63396a898c2034348981445554e55294, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

File diff suppressed because it is too large Load Diff

View File

@ -13053,6 +13053,7 @@ MonoBehaviour:
LineName:
Addtime: 0
Laboratorycourse: K=1
UI_TopTipPanel: {fileID: 941678283662640096, guid: 986fe8f151fcd2542a24c11381b9b685, type: 3}
--- !u!114 &140014612
MonoBehaviour:
m_ObjectHideFlags: 0
@ -77589,7 +77590,7 @@ GameObject:
m_Component:
- component: {fileID: 915982564}
m_Layer: 0
m_Name: "_1uF_star\u8FDEIN3_200K"
m_Name: "_1uF_end\u8FDEIN3_200K"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -93146,7 +93147,7 @@ GameObject:
m_Component:
- component: {fileID: 1137665131}
m_Layer: 0
m_Name: "_1uF_end\u8FDEIN1"
m_Name: "_1uF_star\u8FDEIN1"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -0,0 +1,25 @@
using System.Diagnostics;
using System.IO;
using UnityEngine;
public class ExeLauncher : MonoBehaviour
{
void Start()
{
OpenExe("td2.bat");
}
void OpenExe(string pathname)
{
string batPath = Path.Combine(Application.streamingAssetsPath, pathname);
if (!File.Exists(batPath)) return;
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = batPath,
UseShellExecute = true,
WorkingDirectory = Path.GetDirectoryName(batPath)
};
Process.Start(psi);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2dd00a60c75d89848b76c52d8f94290c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,55 @@
using Unity.Collections;
using UnityEditor;
/// <summary>
/// 内存泄露检测模式
/// </summary>
public class LeakDetectionMode
{
[MenuItem("Jobs/内存泄漏检测/显示当前模式")]
static void ShowLeakDetection()
{
string message = string.Format("当前模式: {0}", NativeLeakDetection.Mode.ToString());
EditorUtility.DisplayDialog("内存泄漏检测模式", message, "OK");
}
[MenuItem("Jobs/内存泄漏检测/禁用")]
static void LeakDetectionDisable()
{
NativeLeakDetection.Mode = NativeLeakDetectionMode.Disabled;
}
// 验证方法会在正式方法前执行,通不过就会置灰
[MenuItem("Jobs/内存泄漏检测/禁用", true)]
static bool ValidateLeakDetectionDisable()
{
return NativeLeakDetection.Mode != NativeLeakDetectionMode.Disabled;
}
[MenuItem("Jobs/内存泄漏检测/启用")]
static void LeakDetectionEnabled()
{
NativeLeakDetection.Mode = NativeLeakDetectionMode.Enabled;
}
[MenuItem("Jobs/内存泄漏检测/启用", true)]
static bool ValidateLeakDetectionEnabled()
{
return NativeLeakDetection.Mode != NativeLeakDetectionMode.Enabled;
}
[MenuItem("Jobs/内存泄漏检测/启用堆栈跟踪")]
static void LeakDetectionEnabledWithStackTrace()
{
NativeLeakDetection.Mode = NativeLeakDetectionMode.EnabledWithStackTrace;
}
[MenuItem("Jobs/内存泄漏检测/启用堆栈跟踪", true)]
static bool ValidateLeakDetectionEnabledWithStackTrace()
{
return NativeLeakDetection.Mode != NativeLeakDetectionMode.EnabledWithStackTrace;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e09de9ef3bc47e3499e708ebbe10f027
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -65,6 +65,10 @@ public class LineManager : SerializedMonoBehaviour
public float Addtime = 0;
public string Laboratorycourse = "";
public UI_TopTipPanel UI_TopTipPanel;
UI_TopTipPanel conut;
/// <summary>
/// 是否是初始化
/// </summary>
@ -77,7 +81,7 @@ public class LineManager : SerializedMonoBehaviour
public void ResetLine()
{
#region 线
#region 线
if (PlayerPrefs.GetString("LineData") != "" && PlayerPrefs.GetString("LineData") != null)
{
@ -134,8 +138,10 @@ public class LineManager : SerializedMonoBehaviour
//UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
Highlights[0].highlighted = true;
Highlights[0].GetComponent<BoxCollider>().enabled = true;
ChooseClass(index);
}
Initialization(PlayerPrefs.GetInt("classnum"));
#endregion
}
void Start()
@ -156,7 +162,6 @@ public class LineManager : SerializedMonoBehaviour
{
ComputerPanel.gameObject.SetActive(false);
}
allline = 0;
Highlights_Backup.ForEach((x) => { x.highlighted = false; });
HighlightInit("", ExperimentNumber);
for (int i = 0; i < Highlights.Count; i++)
@ -182,6 +187,9 @@ public class LineManager : SerializedMonoBehaviour
bool isshow;
void Update()
{
Debug.Log("课程:" + PlayerPrefs.GetInt("classnum"));
// Debug.Log("获取面板:" + Bootstrap.Instance.uiManager.GetPanel<UI_TopTipPanel>()?.isActiveAndEnabled);
//Debug.Log("isInit:" + isInit);
//Debug.Log("面板是否显示:" + Bootstrap.Instance.uiManager.GetPanel<UI_RoamingPanel>().gameObject.activeInHierarchy);
if (Input.GetMouseButtonDown(2))
@ -191,7 +199,7 @@ public class LineManager : SerializedMonoBehaviour
PlayerPrefs.SetString("LineData", "");
PlayerPrefs.SetInt("classnum", 511);
}
Debug.Log(allline);
//Debug.Log(allline);
if (allline >= Models.Count && !isshow && !Bootstrap.Instance.uiManager.GetPanel<UI_RoamingPanel>().gameObject.activeInHierarchy)
{
isshow = true;
@ -205,7 +213,7 @@ public class LineManager : SerializedMonoBehaviour
StartCoroutine(WaitHide(Tips));
UI_TopTitlePanel.instance.SubitBtn.gameObject.SetActive(true);
Highlights = Highlights_Backup.ToList();
Bootstrap.Instance.uiManager.HidePanel<UI_TopTipPanel>();
//Bootstrap.Instance.uiManager.HidePanel<UI_TopTipPanel>();
}
Addtime += 0.05f;
}
@ -216,6 +224,7 @@ public class LineManager : SerializedMonoBehaviour
{
if (LineShowModel.Instance.currentState == DrawingState.Idle)
{
allline = 0;
//先重置高亮,再重置模型,否则初始化无法正确显示高亮
Highlights = highlightsdic[indext].ToList();
Highlights_Backup = highlightsdic[indext].ToList();
@ -277,7 +286,7 @@ public class LineManager : SerializedMonoBehaviour
material.color = UnityEngine.Color.red;
point.DORotateQuaternion(Quaternion.Euler(-50f, 0, 0), 0.5f);
}
HighlightInit(point.name);
HighlightInit(point.name, PlayerPrefs.GetInt("classnum"));
}
public IEnumerator Checkconnection(Transform transform, Transform transform2)
@ -444,73 +453,88 @@ public class LineManager : SerializedMonoBehaviour
}
if (hightindext < Highlights.Count)
{
LineName = Highlights[hightindext].GetComponent<LineConnect>().interfaceType.ToString();
//LineName = Highlights[hightindext].GetComponent<LineConnect>().interfaceType.ToString();
Highlights[hightindext].highlighted = true;
Highlights[hightindext].GetComponent<BoxCollider>().enabled = true;
}
LightPanel.highlighted = false;
Devices.highlighted = false;
Bootstrap.Instance.uiManager.ShowPanel<UI_TopTipPanel>(this, E_UI_Layer.Top,
(panel) =>
{
panel.Init("提示:" + "当前实验是比例P环节K=1", ",请点击" + LineName + "。");
if (classnum != 0)
{
switch (classnum)
{
case 511:
Laboratorycourse = "比例P环节K=1";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[0];
break;
case 512:
Laboratorycourse = "比例P环节K=2";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[1];
break;
case 521:
Laboratorycourse = "积分I环节T=1S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[2];
break;
case 522:
Laboratorycourse = "积分I环节T=0.1S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[3];
break;
case 531:
Laboratorycourse = "比例积分PI环节T=1S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[2];
break;
case 532:
Laboratorycourse = "比例积分PI环节T=0.1S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 541:
Laboratorycourse = "比例微分PD环节T=1S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 542:
Laboratorycourse = "比例微分PD环节T=2S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 551:
Laboratorycourse = "惯性环节T=1S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 552:
Laboratorycourse = "惯性环节T=2S";
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
}
}
});
//conut.Init();
//conut.Init("提示:" + "当前实验是比例P环节K=1", ",请点击" + LineName + "。");
ChooseClass(classnum);
// Bootstrap.Instance.uiManager.ShowPanel<UI_TopTipPanel>(this, E_UI_Layer.Top,
// (panel) =>
// {
// conut.Init("提示:" + "当前实验是比例P环节K=1", ",请点击" + LineName + "。");
// });
//}
}
void ChooseClass(int classnum)
{
if (conut == null)
{
conut = Instantiate(UI_TopTipPanel, UI_TopTitlePanel.instance.ContentTrans);
}
if (Highlights.Count >= 1)
{
LineName = Highlights[0].GetComponent<LineConnect>().interfaceType.ToString();
}
Debug.Log("高亮物体数量:" + Highlights.Count);
switch (classnum)
{
case 511:
Laboratorycourse = "比例P环节K=1";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[0];
break;
case 512:
Laboratorycourse = "比例P环节K=2";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[1];
break;
case 521:
Laboratorycourse = "积分I环节T=1S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[2];
break;
case 522:
Laboratorycourse = "积分I环节T=0.1S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[3];
break;
case 531:
Laboratorycourse = "比例积分PI环节T=1S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[2];
break;
case 532:
Laboratorycourse = "比例积分PI环节T=0.1S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 541:
Laboratorycourse = "比例微分PD环节T=1S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 542:
Laboratorycourse = "比例微分PD环节T=2S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 551:
Laboratorycourse = "惯性环节T=1S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
case 552:
Laboratorycourse = "惯性环节T=2S";
conut.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
ComputerPanel.sprite = Experimentalresults[5];
break;
}
}
}

View File

@ -55,10 +55,17 @@ public class ChartControl : MonoBehaviour
/// 选择通道
/// </summary>
public TMP_Dropdown TdDrop;
public TMP_InputField inputField1;
public TMP_InputField inputField2;
public Button bt1;
bool IsGetData;
void Start()
{
Start_.onClick.AddListener(() =>
{
IsGetData = true;
Start_.interactable = false;
if (togglename.Count == 1)
{
@ -86,16 +93,23 @@ public class ChartControl : MonoBehaviour
Stop_.onClick.AddListener(() =>
{
Start_.interactable = true;
IsGetData = false;
});
EnterTd.onClick.AddListener(() =>
{
fondname = TdDrop.captionText.text;
});
//bt1.onClick.AddListener(() =>
//{
// from =int.Parse( inputField1.text);
// to =int.Parse( inputField2.text);
//});
streaming = Application.streamingAssetsPath;
}
public string tempstr = "";
public int from = 0;
public int to = 200;
// 初始化:从 StreamingAssets 复制到 persistentDataPath
IEnumerator InitializeFile(string fileName)
{
@ -108,56 +122,77 @@ public class ChartControl : MonoBehaviour
if (request.result == UnityWebRequest.Result.Success)
{
chart.ClearData();
// 写入到可读写目录
var str = request.downloadHandler.text.Split('\n');
if (fileName == "cmd1.ini")
int x = 0;
while (IsGetData)
{
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 str = request.downloadHandler.text.Split('\n');
if (fileName == "cmd1.ini")
{
var data = txtdata.Split('@');
for (int i = 0; i < data.Length - 1; i++)
serie = chart.GetSerie<Serie>();
str[1] = "td=" + togglename[0];
fondname = "td" + togglename[0];
if (chart.series[0].serieName != fondname)
{
var datas = data[i].Split(',');
chart.AddXAxisData(datas[0]);
serie.AddYData(double.Parse(datas[1]));
chart.series[0].serieName = "td" + togglename[0];
}
}, "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 =>
//chart.series[0].serieName = "td" + togglename[0];
string ini = string.Concat(str[0], "\n", str[1], "\n", str[2]);
File.WriteAllText(streaming + "/" + fileName, ini);
StartCoroutine(GetConfig(b =>
{
var data = txtdata.Split('@');
if (data.Length > 1000)
{
x = data.Length - 1000;
}
for (int i = x; i < data.Length - 1; i++)
{
var datas = data[i].Split(',');
chart.AddXAxisData(datas[0]);
serie.AddYData(double.Parse(datas[1]));
}
}, "data1.txt"));
}
else if (fileName == "cmd2.ini")
{
var data = txtdata.Split('@');
for (int i = 0; i < data.Length - 1; i++)
TdDrop.ClearOptions();
chart.series[0].serieName = "td" + togglename[0];
chart.series[1].serieName = "td" + 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 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"));
var data = txtdata.Split('@');
if (data.Length > 1000)
{
x = data.Length - 1000;
}
for (int i = x; 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"));
}
chart.ClearData();
yield return new WaitForSeconds(1.25f);
}
}
else
@ -166,6 +201,18 @@ public class ChartControl : MonoBehaviour
}
}
}
public string[] RemoveRangeFromArray(string[] arr, int a, int b)
{
if (arr == null || a < 0 || b >= arr.Length || a > b)
{
Debug.LogError("参数错误或越界");
return null;
}
List<string> list = new List<string>(arr);
list.RemoveRange(a, b - a + 1); // 删除从 a 开始的 (b-a+1) 个元素
return list.ToArray();
}
private void Awake()
{
serie = chart.GetSerie<Serie>();
@ -174,6 +221,7 @@ public class ChartControl : MonoBehaviour
void Update()
{
for (int i = 0; i < toggles.Count; i++)
{
if (toggles[i].isOn)
@ -201,10 +249,9 @@ public class ChartControl : MonoBehaviour
Start_.interactable = true;
Stop_.interactable = true;
}
Debug.Log("数据:" + serie.context.pointerItemDataIndex);
if (serie.context.pointerItemDataIndex >= 0 && isclick)
{
SerieData series = chart.GetSerie(fondname).GetSerieData(serie.context.pointerItemDataIndex);
Debug.Log("鼠标点击的数据:" + series.data[1]);
XAxis Xaxis = chart.GetChartComponent<XAxis>();
@ -224,6 +271,7 @@ public class ChartControl : MonoBehaviour
y1.text = "Y1 = " + str1[1];
y2.text = "Y2 = " + str2[1];
Sy1.text = "▲Y = " + MathF.Abs(float.Parse(str1[1]) - float.Parse(str2[1])).ToString();
Sx1.text = "▲X = " + MathF.Abs(float.Parse(str1[0]) - float.Parse(str2[0])).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>();
@ -233,6 +281,7 @@ public class ChartControl : MonoBehaviour
{
if (!isclick)
{
isclick = true;
}
}

View File

@ -125,12 +125,13 @@ public class TeaAnswerManager : SingletonMono<TeaAnswerManager>
if (request.result == UnityWebRequest.Result.Success)
{
Debug.Log("发送成功!后端返回:" + request.downloadHandler.text);
Debug.Log( request.downloadHandler.text.ToString()+"------------------");
Debug.Log(request.downloadHandler.text.ToString() + "------------------");
answerRoot = JsonConvert.DeserializeObject<AnswerRoot>(request.downloadHandler.text);
}
else
{
Debug.LogError("发送失败:" + request.error);
}
request.Dispose();
}
}

View File

@ -7,7 +7,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class UI_TopTipPanel : BasePanel
public class UI_TopTipPanel : BaseItem
{
public Image bg;
public TextMeshProUGUI text_Content;

View File

@ -14,6 +14,8 @@ public class UI_TopTitlePanel : BasePanel
public UI_TeacherStudentPanel UI_TeacherStudentPanel; //问答面板
public UI_TeacherAnswer TeacherAnswerObj;//老师回答生成面板
public Button DataBtn; //数据面板按钮
public Transform ContentTrans; //生成父物体坐标
public GameObject LineTips;//连线提示
protected override void Awake()
{
@ -42,6 +44,7 @@ public class UI_TopTitlePanel : BasePanel
AskBtn.gameObject.SetActive(true);
ReturnBtn.gameObject.SetActive(true);
DataBtn.gameObject.SetActive(true);
LineTips.SetActive(true);
SubitBtn.gameObject.SetActive(false);
ExitBtn.gameObject.SetActive(false);
NameText.text = LoginManager.Instance.loginRespons.data.login_name;
@ -51,6 +54,7 @@ public class UI_TopTitlePanel : BasePanel
{
ExitBtn.gameObject.SetActive(true);
AskBtn.gameObject.SetActive(false);
LineTips.SetActive(false);
ReturnBtn.gameObject.SetActive(false);
DataBtn.gameObject.SetActive(false);
SubitBtn.gameObject.SetActive(false);
@ -79,6 +83,11 @@ public class UI_TopTitlePanel : BasePanel
});
break;
case "返回":
if (UI_TopTipPanel.instance != null)
{
DestroyImmediate(UI_TopTipPanel.instance.gameObject);
}
ReturnScene();
break;
case "数据按钮":
@ -120,10 +129,11 @@ public class UI_TopTitlePanel : BasePanel
{
//Bootstrap.Instance.uiManager.ShowPanel<UI_TopTitlePanel>(this, E_UI_Layer.Top, (panel) =>
//{
Bootstrap.Instance.uiManager.HidePanel<UI_LoginPanel>();
Bootstrap.Instance.uiManager.HidePanel<UI_TopTipPanel>();
Bootstrap.Instance.uiManager.HidePanel<UI_ExperimentChooesPanel>();
Debug.Log("场景加载成功");
Bootstrap.Instance.uiManager.HidePanel<UI_LoginPanel>();
//Bootstrap.Instance.uiManager.HidePanel<UI_TopTipPanel>();
Bootstrap.Instance.uiManager.HidePanel<UI_ExperimentChooesPanel>();
ShowMe();
Debug.Log("场景加载成功");
//});
});
}

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
@echo off
echo hello word
pause

View File

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

View File

@ -0,0 +1,3 @@
@echo off
echo hello word td2
pause

View File

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

File diff suppressed because one or more lines are too long