修改问题
This commit is contained in:
parent
d48fdd1173
commit
57f818d264
|
|
@ -73,7 +73,7 @@ public class LineConnect : MonoBehaviour
|
||||||
public bool isClick = false;
|
public bool isClick = false;
|
||||||
private void OnMouseDown()
|
private void OnMouseDown()
|
||||||
{
|
{
|
||||||
if (!isClick && LineManager.instance.Addtime >= 2)
|
if (!isClick && LineManager.instance.Addtime >= 4)
|
||||||
{
|
{
|
||||||
isClick = true;
|
isClick = true;
|
||||||
Debug.Log(transform.name);
|
Debug.Log(transform.name);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
@ -80,16 +81,6 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
if (PlayerPrefs.GetString("LineData") != "")
|
if (PlayerPrefs.GetString("LineData") != "")
|
||||||
{
|
{
|
||||||
int index = PlayerPrefs.GetInt("classnum");
|
int index = PlayerPrefs.GetInt("classnum");
|
||||||
if (UI_ExperimentChooesPanel.instance != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < UI_ExperimentChooesPanel.instance.SubjectTog.Count; i++)
|
|
||||||
{
|
|
||||||
if (UI_ExperimentChooesPanel.instance.SubjectTog[i].name.Replace("-", "") == (index.ToString()))
|
|
||||||
{
|
|
||||||
UI_ExperimentChooesPanel.instance.SubjectTog[i].isOn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Models = new List<GameObject>();
|
Models = new List<GameObject>();
|
||||||
Highlights = new List<HighlightEffect>();
|
Highlights = new List<HighlightEffect>();
|
||||||
Highlights_Backup = new List<HighlightEffect>();
|
Highlights_Backup = new List<HighlightEffect>();
|
||||||
|
|
@ -108,6 +99,7 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Debug.Log(" lineData.Modelname.Count;" + lineData.Modelname.Count);
|
||||||
allline = lineData.Modelname.Count;
|
allline = lineData.Modelname.Count;
|
||||||
for (int j = 0; j < lineData.Modelname.Count; j++)
|
for (int j = 0; j < lineData.Modelname.Count; j++)
|
||||||
{
|
{
|
||||||
|
|
@ -127,16 +119,27 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
{
|
{
|
||||||
Highlights_Backup[i].highlighted = false;
|
Highlights_Backup[i].highlighted = false;
|
||||||
}
|
}
|
||||||
LineName = Highlights[0].GetComponent<LineConnect>().interfaceType.ToString();
|
//LineName = Highlights[0].GetComponent<LineConnect>().interfaceType.ToString();
|
||||||
UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
|
//UI_TopTipPanel.instance.Init("提示:" + "当前实验是" + Laboratorycourse, ",请点击" + LineName + "。");
|
||||||
Highlights[0].highlighted = true;
|
Highlights[0].highlighted = true;
|
||||||
Highlights[0].GetComponent<BoxCollider>().enabled = true;
|
Highlights[0].GetComponent<BoxCollider>().enabled = true;
|
||||||
}
|
}
|
||||||
|
if (UI_ExperimentChooesPanel.instance != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < UI_ExperimentChooesPanel.instance.SubjectTog.Count; i++)
|
||||||
|
{
|
||||||
|
if (UI_ExperimentChooesPanel.instance.SubjectTog[i].name.Replace("-", "") == (PlayerPrefs.GetInt("classnum").ToString()))
|
||||||
|
{
|
||||||
|
UI_ExperimentChooesPanel.instance.SubjectTog[i].SetIsOnWithoutNotify(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Initialization(PlayerPrefs.GetInt("classnum"));
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
Initialization();
|
|
||||||
//ResetLine();
|
//ResetLine();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -154,7 +157,7 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
}
|
}
|
||||||
allline = 0;
|
allline = 0;
|
||||||
Highlights_Backup.ForEach((x) => { x.highlighted = false; });
|
Highlights_Backup.ForEach((x) => { x.highlighted = false; });
|
||||||
HighlightInit("");
|
HighlightInit("", ExperimentNumber);
|
||||||
for (int i = 0; i < Highlights.Count; i++)
|
for (int i = 0; i < Highlights.Count; i++)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
|
|
@ -174,70 +177,20 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
isshow = false;
|
isshow = false;
|
||||||
LightPanel.highlighted = true;
|
LightPanel.highlighted = true;
|
||||||
Devices.highlighted = true;
|
Devices.highlighted = true;
|
||||||
switch (ExperimentNumber)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bool isshow;
|
bool isshow;
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
//Debug.Log("isInit:" + isInit);
|
||||||
//Debug.Log("面板是否显示:" + Bootstrap.Instance.uiManager.GetPanel<UI_RoamingPanel>().gameObject.activeInHierarchy);
|
//Debug.Log("面板是否显示:" + Bootstrap.Instance.uiManager.GetPanel<UI_RoamingPanel>().gameObject.activeInHierarchy);
|
||||||
if (Input.GetMouseButtonDown(2))
|
if (Input.GetMouseButtonDown(2))
|
||||||
{
|
{
|
||||||
point1 = null;
|
point1 = null;
|
||||||
point2 = null;
|
point2 = null;
|
||||||
PlayerPrefs.SetString("LineData", "");
|
PlayerPrefs.SetString("LineData", "");
|
||||||
|
PlayerPrefs.SetInt("classnum", 511);
|
||||||
}
|
}
|
||||||
|
Debug.Log(allline);
|
||||||
if (allline >= Models.Count && !isshow && !Bootstrap.Instance.uiManager.GetPanel<UI_RoamingPanel>().gameObject.activeInHierarchy)
|
if (allline >= Models.Count && !isshow && !Bootstrap.Instance.uiManager.GetPanel<UI_RoamingPanel>().gameObject.activeInHierarchy)
|
||||||
{
|
{
|
||||||
isshow = true;
|
isshow = true;
|
||||||
|
|
@ -265,15 +218,12 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
//先重置高亮,再重置模型,否则初始化无法正确显示高亮
|
//先重置高亮,再重置模型,否则初始化无法正确显示高亮
|
||||||
Highlights = highlightsdic[indext].ToList();
|
Highlights = highlightsdic[indext].ToList();
|
||||||
Highlights_Backup = highlightsdic[indext].ToList();
|
Highlights_Backup = highlightsdic[indext].ToList();
|
||||||
Initialization(indext);
|
|
||||||
Models.ForEach((x) => { x.SetActive(false); });
|
Models.ForEach((x) => { x.SetActive(false); });
|
||||||
Models = Modeldic[indext].ToList();
|
Models = Modeldic[indext].ToList();
|
||||||
PlayerPrefs.SetInt("classnum", indext);
|
PlayerPrefs.SetInt("classnum", indext);
|
||||||
if (!isInit)//初始化不清空数据
|
PlayerPrefs.SetString("LineData", "");
|
||||||
{
|
Initialization(indext);
|
||||||
PlayerPrefs.SetString("LineData", "");
|
//isInit = false;
|
||||||
}
|
|
||||||
isInit = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -476,7 +426,7 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 高亮初始化
|
/// 高亮初始化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void HighlightInit(string point)
|
private void HighlightInit(string point, int classnum = 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Highlights.Count; i++)
|
for (int i = 0; i < Highlights.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -500,6 +450,62 @@ public class LineManager : SerializedMonoBehaviour
|
||||||
(panel) =>
|
(panel) =>
|
||||||
{
|
{
|
||||||
panel.Init("提示:" + "当前实验是比例(P)环节,K=1", ",请点击" + LineName + "。");
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ public class UIManager
|
||||||
T panel = panelObj.GetComponent<T>();
|
T panel = panelObj.GetComponent<T>();
|
||||||
panel.ShowMe();
|
panel.ShowMe();
|
||||||
action?.Invoke(panel);
|
action?.Invoke(panel);
|
||||||
|
Debug.Log("panelName"+panelName);
|
||||||
panelDic.Add(panelName, panel);
|
panelDic.Add(panelName, panel);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class UI_ExperimentChooesPanel : BasePanel
|
||||||
protected override void OnChangeToggle(string btnPath, bool isOn)
|
protected override void OnChangeToggle(string btnPath, bool isOn)
|
||||||
{
|
{
|
||||||
base.OnClick(btnPath);
|
base.OnClick(btnPath);
|
||||||
if (isOn)
|
if (isOn && LineManager.instance != null)
|
||||||
{
|
{
|
||||||
Debug.Log("当前点击的科目是" + btnPath);
|
Debug.Log("当前点击的科目是" + btnPath);
|
||||||
switch (btnPath)
|
switch (btnPath)
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ public class UI_RoamingPanel : BasePanel
|
||||||
yield return new WaitForSeconds(3.6f);
|
yield return new WaitForSeconds(3.6f);
|
||||||
LineManager.instance.ResetLine();
|
LineManager.instance.ResetLine();
|
||||||
Bootstrap.Instance.uiManager.HidePanel<UI_RoamingPanel>();
|
Bootstrap.Instance.uiManager.HidePanel<UI_RoamingPanel>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class UI_TopTipPanel : BasePanel
|
public class UI_TopTipPanel : BasePanel
|
||||||
|
|
@ -11,9 +13,10 @@ public class UI_TopTipPanel : BasePanel
|
||||||
public TextMeshProUGUI text_Content;
|
public TextMeshProUGUI text_Content;
|
||||||
public TextMeshProUGUI text_Title;
|
public TextMeshProUGUI text_Title;
|
||||||
public static UI_TopTipPanel instance;
|
public static UI_TopTipPanel instance;
|
||||||
private void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void Init(string title, string content)
|
public void Init(string title, string content)
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +27,7 @@ public class UI_TopTipPanel : BasePanel
|
||||||
text_Content.text = "<color=#00CCFF>" + content + "</color>";
|
text_Content.text = "<color=#00CCFF>" + content + "</color>";
|
||||||
TextMeshProUGUI tempText = text_Title.preferredWidth > text_Content.preferredWidth ? text_Title : text_Content;
|
TextMeshProUGUI tempText = text_Title.preferredWidth > text_Content.preferredWidth ? text_Title : text_Content;
|
||||||
AdjustImageWidth(tempText, bg.rectTransform, 30, 21);
|
AdjustImageWidth(tempText, bg.rectTransform, 30, 21);
|
||||||
// LineManager.instance.ResetLine();
|
// LineManager.instance.ResetLine();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ãæ°åÏûʧ
|
/// Ãæ°åÏûʧ
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue