|
|
@ -14,8 +14,9 @@ public class InfoWnd : MonoBehaviour
|
|
|
|
public Button roadInfoCloseBtn;
|
|
|
|
public Button roadInfoCloseBtn;
|
|
|
|
|
|
|
|
|
|
|
|
//路况检测窗口
|
|
|
|
//路况检测窗口
|
|
|
|
public GameObject RoadInfoWnd;
|
|
|
|
public GameObject roadInfoWnd;
|
|
|
|
public GameObject colorTitle;
|
|
|
|
public GameObject colorTitle;
|
|
|
|
|
|
|
|
public Transform roadInfoGroup;
|
|
|
|
|
|
|
|
|
|
|
|
public string date;
|
|
|
|
public string date;
|
|
|
|
|
|
|
|
|
|
|
@ -24,7 +25,7 @@ public class InfoWnd : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
public void Init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (RoadInfoWnd.activeSelf)
|
|
|
|
if (roadInfoWnd.activeSelf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetRoadInfoActive(false);
|
|
|
|
SetRoadInfoActive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -36,23 +37,44 @@ public class InfoWnd : MonoBehaviour
|
|
|
|
//初始化路况字典
|
|
|
|
//初始化路况字典
|
|
|
|
private void InitRoadDict()
|
|
|
|
private void InitRoadDict()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GameObject roadGroup= GameObject.FindGameObjectWithTag("RoadInfoGroup");
|
|
|
|
|
|
|
|
for (int i = 0; i < roadGroup.transform.childCount; i++)
|
|
|
|
for (int i = 0; i < roadInfoGroup.childCount; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RoadInfo info = new RoadInfo();
|
|
|
|
RoadInfo info = new RoadInfo();
|
|
|
|
info.roadName = roadGroup.transform.GetChild(i).name;
|
|
|
|
Text txt = roadInfoGroup.transform.GetChild(i).GetComponent<Text>();
|
|
|
|
info.flowRate = 80;
|
|
|
|
info.roadName = roadInfoGroup.transform.GetChild(i).name;
|
|
|
|
info.carFlow = UnityEngine.Random.Range(15, 35);
|
|
|
|
info.flowRate = 100;
|
|
|
|
|
|
|
|
info.carFlow = 0;
|
|
|
|
info.Iswarning = false;
|
|
|
|
info.Iswarning = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
txt.text = string.Format(" ▶ "+"{0:G}"+" "+"{1:G}"+" "+ "{2:00.00}"+ "%"+" "+ "{3:G}", info.roadName,info.carFlow,info.flowRate,info.Iswarning?"是":"否");
|
|
|
|
|
|
|
|
|
|
|
|
Road_Dict.Add(info.roadName, info);
|
|
|
|
Road_Dict.Add(info.roadName, info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新路况信息方法
|
|
|
|
|
|
|
|
public void UpdateRoadDict(string roadName)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RoadInfo info = null;
|
|
|
|
|
|
|
|
if(Road_Dict.TryGetValue(roadName,out info))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Text txt= roadInfoGroup.Find(roadName).GetComponent<Text>();
|
|
|
|
|
|
|
|
txt.text = string.Format(" ▶ " + "{0:G}" + " " + "{1:G}" + " " + "{2:00.00}" + "%" + " " + "{3:G}", info.roadName, info.carFlow, info.flowRate, info.Iswarning ? "是" : "否");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODo
|
|
|
|
//TODo
|
|
|
|
public void UpdateRoadDict()
|
|
|
|
public RoadInfo GetRoadInfo(string roadName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
RoadInfo info = new RoadInfo();
|
|
|
|
|
|
|
|
if(Road_Dict.TryGetValue(roadName, out info))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetCarInText(int Addvalue)
|
|
|
|
public void SetCarInText(int Addvalue)
|
|
|
@ -102,6 +124,8 @@ public class InfoWnd : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
public void SetRoadInfoActive(bool t)
|
|
|
|
public void SetRoadInfoActive(bool t)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RoadInfoWnd.SetActive(t);
|
|
|
|
roadInfoWnd.SetActive(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|