12/20提交 #1
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,7 @@ public class ChemicalStorageController : MonoBehaviour,HttpController
|
|||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
|
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
dataView = transform;
|
dataView = transform;
|
||||||
httpRequestHandler = gameObject.AddComponent<HttpRequestHandler>();
|
httpRequestHandler = gameObject.AddComponent<HttpRequestHandler>();
|
||||||
|
|||||||
69
Assets/Scripts/Data/Controller/HumitureTrend_Controller.cs
Normal file
69
Assets/Scripts/Data/Controller/HumitureTrend_Controller.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using XCharts.Runtime;
|
||||||
|
|
||||||
|
// 温湿度趋势图
|
||||||
|
public class HumitureTrend_Controller : MonoBehaviour
|
||||||
|
{
|
||||||
|
private LineChart lineChart;
|
||||||
|
private EMIMS_Data emimsData;
|
||||||
|
|
||||||
|
|
||||||
|
void OnEnable()
|
||||||
|
{
|
||||||
|
lineChart = gameObject.GetComponent<LineChart>();
|
||||||
|
emimsData = new EMIMS_Data();
|
||||||
|
List<EM_Data> list = new List<EM_Data>
|
||||||
|
{
|
||||||
|
new EM_Data {ID = "1", Name = "温度一天前", DataType = "float", Value = 14.5f},
|
||||||
|
new EM_Data {ID = "2", Name = "温度两天前", DataType = "float", Value = 26.2f},
|
||||||
|
new EM_Data {ID = "3", Name = "温度三天前", DataType = "float", Value = 18.7f},
|
||||||
|
new EM_Data {ID = "4", Name = "温度四天前", DataType = "float", Value = 22.1f},
|
||||||
|
new EM_Data {ID = "5", Name = "温度五天前", DataType = "float", Value = 16.9f},
|
||||||
|
new EM_Data {ID = "6", Name = "温度六天前", DataType = "float", Value = 20.3f},
|
||||||
|
new EM_Data {ID = "7", Name = "温度七天前", DataType = "float", Value = 19.8f},
|
||||||
|
|
||||||
|
new EM_Data {ID = "8", Name = "湿度一天前", DataType = "float", Value = 41.2f},
|
||||||
|
new EM_Data {ID = "9", Name = "湿度两天前", DataType = "float", Value = 54.5f},
|
||||||
|
new EM_Data {ID = "10", Name = "湿度三天前", DataType = "float", Value = 22.8f},
|
||||||
|
new EM_Data {ID = "11", Name = "湿度四天前", DataType = "float", Value = 43.1f},
|
||||||
|
new EM_Data {ID = "12", Name = "湿度五天前", DataType = "float", Value = 21.9f},
|
||||||
|
new EM_Data {ID = "13", Name = "湿度六天前", DataType = "float", Value = 42.3f},
|
||||||
|
new EM_Data {ID = "14", Name = "湿度七天前", DataType = "float", Value = 50.8f},
|
||||||
|
};
|
||||||
|
emimsData.Tags = list;
|
||||||
|
|
||||||
|
StartCoroutine(UpdateDataSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerator UpdateDataSource()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
emimsData.Tags[Random.Range(0,7)].Value = Random.Range(10f,40f);
|
||||||
|
emimsData.Tags[Random.Range(7,14)].Value = Random.Range(30f,80f);
|
||||||
|
UpdateDataView();
|
||||||
|
yield return new WaitForSeconds(4f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新填充数据
|
||||||
|
private void UpdateDataView()
|
||||||
|
{
|
||||||
|
lineChart.ClearSerieData();
|
||||||
|
|
||||||
|
for (int i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
|
lineChart.series[0].AddData(i, (float)emimsData.Tags[i].Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 7; i < 14; i++)
|
||||||
|
{
|
||||||
|
lineChart.series[1].AddData(i, (float)emimsData.Tags[i].Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
48
Assets/Scripts/Data/Controller/VoltageMonitor_Controller.cs
Normal file
48
Assets/Scripts/Data/Controller/VoltageMonitor_Controller.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
// 电压压差监测
|
||||||
|
public class VoltageMonitor_Controller : MonoBehaviour
|
||||||
|
{
|
||||||
|
private Transform dataView; // 显示对象
|
||||||
|
private EMIMS_Data emimsData;
|
||||||
|
|
||||||
|
void OnEnable()
|
||||||
|
{
|
||||||
|
dataView = this.transform;
|
||||||
|
emimsData = new EMIMS_Data();
|
||||||
|
List<EM_Data> list = new List<EM_Data>
|
||||||
|
{
|
||||||
|
new EM_Data {ID = "1", Name = "压差", DataType = "float", Value = 1.5f},
|
||||||
|
new EM_Data {ID = "2", Name = "压差", DataType = "float", Value = 2.5f},
|
||||||
|
new EM_Data {ID = "3", Name = "压差", DataType = "float", Value = 3.5f},
|
||||||
|
new EM_Data {ID = "4", Name = "压差", DataType = "float", Value = 0.5f},
|
||||||
|
new EM_Data {ID = "5", Name = "压差", DataType = "float", Value = -2.5f},
|
||||||
|
new EM_Data {ID = "6", Name = "压差", DataType = "float", Value = 1.5f},
|
||||||
|
};
|
||||||
|
emimsData.Tags = list;
|
||||||
|
|
||||||
|
StartCoroutine(UpdateDataSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerator UpdateDataSource()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
UpdateDataView();
|
||||||
|
yield return new WaitForSeconds(4f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新填充数据
|
||||||
|
private void UpdateDataView()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < dataView.childCount; i++)
|
||||||
|
{
|
||||||
|
dataView.GetChild(i).GetChild(1).GetComponent<TextMeshProUGUI>().text =
|
||||||
|
emimsData.Tags[i].Value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
Assets/Scripts/Data/Entity/AlarmData.cs
Normal file
45
Assets/Scripts/Data/Entity/AlarmData.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
// 警报数据
|
||||||
|
public class AlarmData
|
||||||
|
{
|
||||||
|
[SerializeField] private string tagName; // 报警信息
|
||||||
|
[SerializeField] private string value; // 报警值
|
||||||
|
[SerializeField] private string createTime; // 报警时间
|
||||||
|
|
||||||
|
public string TagName
|
||||||
|
{
|
||||||
|
get => tagName;
|
||||||
|
set => tagName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get => value;
|
||||||
|
set => this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CreateTime
|
||||||
|
{
|
||||||
|
get => createTime;
|
||||||
|
set => createTime = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重写 ToString 方法以及equals方法
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"TagName: {TagName}, Value: {Value}, CreateTime: {CreateTime}";
|
||||||
|
}
|
||||||
|
public bool Equals(AlarmData other)
|
||||||
|
{
|
||||||
|
if (other == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return TagName == other.TagName && Value == other.Value && CreateTime == other.CreateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,7 +7,9 @@ using UnityEngine.Networking;
|
|||||||
// http请求处理类
|
// http请求处理类
|
||||||
public class HttpRequestHandler : MonoBehaviour
|
public class HttpRequestHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static string httpIp ="http://192.168.101.210:8080";
|
// "http://interface.nglab.cn";
|
||||||
|
// "http://192.168.101.210:8080";
|
||||||
|
public static string httpIp ="http://interface.nglab.cn";
|
||||||
|
|
||||||
// GET 请求
|
// GET 请求
|
||||||
public IEnumerator GetRequest(string url, System.Action<string> onSuccess, System.Action<string> onError)
|
public IEnumerator GetRequest(string url, System.Action<string> onSuccess, System.Action<string> onError)
|
||||||
|
|||||||
@ -28,4 +28,15 @@ public class TextFormat
|
|||||||
DateTime date = DateTime.Parse(dateTime);
|
DateTime date = DateTime.Parse(dateTime);
|
||||||
return date.ToString("HH:mm");
|
return date.ToString("HH:mm");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string DateTimeFormat3(string dateTime)
|
||||||
|
{
|
||||||
|
DateTime date = DateTime.Parse(dateTime);
|
||||||
|
return date.ToString("HH:mm:ss");
|
||||||
|
}
|
||||||
|
public static string DateTimeFormat4(string dateTime)
|
||||||
|
{
|
||||||
|
DateTime date = DateTime.Parse(dateTime);
|
||||||
|
return date.ToString("yyyy年MM月dd日");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,8 @@ public class EllipticalMovement : MonoBehaviour
|
|||||||
private int temp1 = -1;
|
private int temp1 = -1;
|
||||||
|
|
||||||
private float timer = 0f;
|
private float timer = 0f;
|
||||||
void OnEnable()
|
|
||||||
|
private void Awake()
|
||||||
{
|
{
|
||||||
Resolution deviceResolution = Screen.currentResolution;
|
Resolution deviceResolution = Screen.currentResolution;
|
||||||
|
|
||||||
@ -32,10 +33,15 @@ public class EllipticalMovement : MonoBehaviour
|
|||||||
orbitCenter.y *= xiShu;
|
orbitCenter.y *= xiShu;
|
||||||
orbitCenter.z *= xiShu;
|
orbitCenter.z *= xiShu;
|
||||||
semiMajorAxis *= xiShu;
|
semiMajorAxis *= xiShu;
|
||||||
semiMinorAxis*= xiShu;
|
semiMinorAxis *= xiShu;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnEnable()
|
||||||
|
{
|
||||||
|
|
||||||
// min*=xiShu;
|
// min*=xiShu;
|
||||||
// 启动协程来控制旋转
|
// 启动协程来控制旋转
|
||||||
|
timer = 0f;
|
||||||
|
|
||||||
StartCoroutine(RotateAndPause());
|
StartCoroutine(RotateAndPause());
|
||||||
}
|
}
|
||||||
@ -79,15 +85,15 @@ public class EllipticalMovement : MonoBehaviour
|
|||||||
// 将图片的位置设置为相对 orbitCenter 的位置
|
// 将图片的位置设置为相对 orbitCenter 的位置
|
||||||
images[i].position = new Vector3(x, y, 0f) + orbitCenter;
|
images[i].position = new Vector3(x, y, 0f) + orbitCenter;
|
||||||
// print(images[i].position.y+" "+images[i].name);
|
// print(images[i].position.y+" "+images[i].name);
|
||||||
/*if (images[i].localPosition.y<min&&i!=temp1)
|
if (images[i].localPosition.y < min && i != temp1)
|
||||||
{
|
{
|
||||||
if (timer<1f)
|
if (timer < 1f)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp1 = i;
|
temp1 = i;
|
||||||
print(images[i].position.y+" "+images[i].name);
|
print(images[i].position.y + " " + images[i].name);
|
||||||
ShowHidden showHidden = images[i].gameObject.GetComponent<ShowHidden>();
|
ShowHidden showHidden = images[i].gameObject.GetComponent<ShowHidden>();
|
||||||
if (showHidden != null)
|
if (showHidden != null)
|
||||||
{
|
{
|
||||||
@ -100,7 +106,7 @@ public class EllipticalMovement : MonoBehaviour
|
|||||||
autoImage.CutImage();
|
autoImage.CutImage();
|
||||||
}
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
yield return new WaitForSeconds(5f);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,18 +19,30 @@ public class AutoMoveCamera : MonoBehaviour
|
|||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
// StartCoroutine(autoMove());
|
StartCoroutine(autoMove());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator autoMove()
|
private IEnumerator autoMove()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
|
{
|
||||||
|
if (runState == 1)
|
||||||
{
|
{
|
||||||
// 平滑移动
|
// 平滑移动
|
||||||
camera.transform.position = Vector3.Lerp(camera.transform.position, parentTarget.transform.GetChild(schedule).position, 0.05f );
|
// camera.transform.position = Vector3.Lerp(camera.transform.position, parentTarget.transform.GetChild(schedule).position, 0.01f );
|
||||||
|
|
||||||
|
// 目标位置
|
||||||
|
Vector3 targetPosition = parentTarget.transform.GetChild(schedule).position;
|
||||||
|
|
||||||
|
// 计算每帧的匀速移动
|
||||||
|
float speed = 5f; // 设定你希望摄像机的匀速速度(单位:每秒的移动距离)
|
||||||
|
camera.transform.position = Vector3.MoveTowards(camera.transform.position, targetPosition, speed * Time.deltaTime);
|
||||||
|
|
||||||
// 平滑旋转
|
// 平滑旋转
|
||||||
camera.transform.rotation = Quaternion.Slerp(camera.transform.rotation, parentTarget.transform.GetChild(schedule).rotation, 0.1f);
|
// camera.transform.rotation = Quaternion.Slerp(camera.transform.rotation, parentTarget.transform.GetChild(schedule).rotation, 0.01f);
|
||||||
|
|
||||||
|
float rotationSpeed = 30f; // 旋转速度
|
||||||
|
camera.transform.rotation = Quaternion.RotateTowards(camera.transform.rotation, parentTarget.transform.GetChild(schedule).rotation, rotationSpeed * Time.deltaTime);
|
||||||
|
|
||||||
// 检查是否接近目标位置和旋转
|
// 检查是否接近目标位置和旋转
|
||||||
if (Vector3.Distance(camera.transform.position, parentTarget.transform.GetChild(schedule).position) < 0.1f &&
|
if (Vector3.Distance(camera.transform.position, parentTarget.transform.GetChild(schedule).position) < 0.1f &&
|
||||||
@ -39,20 +51,29 @@ public class AutoMoveCamera : MonoBehaviour
|
|||||||
camera.transform.position = parentTarget.transform.GetChild(schedule).position;
|
camera.transform.position = parentTarget.transform.GetChild(schedule).position;
|
||||||
camera.transform.rotation = parentTarget.transform.GetChild(schedule).rotation;
|
camera.transform.rotation = parentTarget.transform.GetChild(schedule).rotation;
|
||||||
schedule++;
|
schedule++;
|
||||||
|
yield return new WaitForSeconds(2f);
|
||||||
if (schedule==parentTarget.transform.childCount)
|
if (schedule==parentTarget.transform.childCount)
|
||||||
{
|
{
|
||||||
schedule = 0;
|
schedule = 0;
|
||||||
}
|
runState = 2;
|
||||||
yield return new WaitForSeconds(2f); // 等待两秒
|
|
||||||
|
foreach (GameObject showTarget in showTargets)
|
||||||
|
{
|
||||||
|
showTarget.SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// yield return new WaitForSeconds(2f); // 等待两秒
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (runState == 1)
|
/*if (runState == 1)
|
||||||
{
|
{
|
||||||
// 平滑移动
|
// 平滑移动
|
||||||
// camera.transform.position = Vector3.Lerp(camera.transform.position, parentTarget.transform.GetChild(schedule).position, 0.01f );
|
// camera.transform.position = Vector3.Lerp(camera.transform.position, parentTarget.transform.GetChild(schedule).position, 0.01f );
|
||||||
@ -89,7 +110,7 @@ public class AutoMoveCamera : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user