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