using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using static Manager; public class DataManager : MonoBehaviour { public static DataManager Instance; private void Awake() { Instance = this; } public void GetJiFang(Action callback) { ServerData sd = new ServerData(); sd.serverList = new List(); for (int i = 0; i < 8; i++) { ServerRoomData srd = new ServerRoomData(); srd.id = i; srd.name = i + "_机房"; sd.serverList.Add(srd); } callback.Invoke(sd); } public void GetDLBiao(Action callback,int type) { LineChartData data = new LineChartData(); data.xdata = new List(); data.sdata = new List(); for (int i = 0; i < 20; i++) { data.xdata.Add("xdata_" + i); } for (int i = 0; i < 8; i++) { LineChartSeriesData lc = new LineChartSeriesData(); lc.name = "数据_"+ i; lc.values = new List(); for (int j = 0; j < 20; j++) { lc.values.Add(UnityEngine.Random.Range(1, 1000)); } data.sdata.Add(lc); } callback.Invoke(data); } public void GetDL(Action callback) { ServerData sd = new ServerData(); sd.serverList = new List(); for (int i = 0; i < 8; i++) { ServerRoomData srd = new ServerRoomData(); srd.id = i; srd.name = i + "_机房"; srd.zonggonglv = UnityEngine.Random.Range(30.0f, 40.0f); srd.shangridl = UnityEngine.Random.Range(30.0f, 40.0f); srd.jilonglist = new List(); for (int j = 0; j < i; j++) { ServerJiLongData jilong = new ServerJiLongData(); jilong.id = j; jilong.name = i + "_" + j; jilong.jiguilist = new List(); int rand = UnityEngine.Random.Range(2,4)>2?4:2; for (int z = 0; z < rand; z++) { ServerjiguiData jg = new ServerjiguiData(); jg.name = i + "_" + j + "_" + z; jg.srz = 123; jg.syz = 123; jg.szz = 123; jg.zgl = 123; jilong.jiguilist.Add(jg); } srd.jilonglist.Add(jilong); } sd.serverList.Add(srd); } callback.Invoke(sd); } public void GetWSD(Action callback) { ServerData sd = new ServerData(); sd.serverList = new List(); for (int i = 0; i < 8; i++) { ServerRoomData srd = new ServerRoomData(); srd.id = i; srd.name = i + "_机房"; srd.wendu = UnityEngine.Random.Range(30.0f, 40.0f); srd.shidu = UnityEngine.Random.Range(30.0f, 40.0f); srd.jilonglist = new List(); for (int j = 0; j < i; j++) { ServerJiLongData jilong = new ServerJiLongData(); jilong.id = j; jilong.name = i + "_" + j; jilong.jiguilist = new List(); int rand = UnityEngine.Random.Range(2, 4) > 2 ? 4 : 2; for (int z = 0; z < rand; z++) { ServerjiguiData jg = new ServerjiguiData(); jg.name = i + "_" + j + "_" + z; jg.wendu = 123; jg.shidu = 123; jilong.jiguilist.Add(jg); } srd.jilonglist.Add(jilong); } sd.serverList.Add(srd); } callback.Invoke(sd); } public void GetVideo(Action callback) { ServerData sd = new ServerData(); sd.serverList = new List(); for (int i = 0; i < 8; i++) { ServerRoomData srd = new ServerRoomData(); srd.id = i; srd.videolist = new List(); ServerVideoData svd = new ServerVideoData(); svd.id = 1; svd.name = "机房摄像头"; svd.url = new List(); for (int j = 0; j < 8; j++) { svd.url.Add("https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8"); } srd.videolist.Add(svd); ServerVideoData svd2 = new ServerVideoData(); svd2.id = 1; svd2.name = "机笼摄像头"; svd2.url = new List(); for (int j = 0; j < 8; j++) { svd2.url.Add("https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8"); } srd.videolist.Add(svd2); sd.serverList.Add(srd); } callback.Invoke(sd); } public void GetTongSuan(Action callback) { TongSuanData jdata = new TongSuanData(); jdata.devct = 123; jdata.serverct = 123; jdata.zhiji = 123; callback.Invoke(jdata); } public void GetJianKongPt(Action callback) { JianKongPtData jdata = new JianKongPtData(); jdata.shijianct = 123; jdata.zhixingct = 123; jdata.gaojingct = 123; callback.Invoke(jdata); } public void GetSixServer(Action> callback) { List lp = new List(); for (int i = 0; i < 6; i++) { PieChartData p = new PieChartData(); p.title = i.ToString(); p.value = 1000000; p.items = new List(); PieChartItemData idata1 = new PieChartItemData(); idata1.name = "RUN"; idata1.value = 27; p.items.Add(idata1); PieChartItemData idata2 = new PieChartItemData(); idata2.name = "IDLE"; idata2.value = 27; p.items.Add(idata2); lp.Add(p); } callback.Invoke(lp); } public void GetK8s(Action> callback) { List rvs = new List(); for (int i = 0; i < 3; i++) { RingValueData d = new RingValueData(); d.value = "4"; d.max = "4"; rvs.Add(d); } callback.Invoke(rvs); } public void GetGPUData(Action callback) { LineChartData data = new LineChartData(); data.xdata = new List(); data.sdata = new List(); for (int i = 0; i < 10; i++) { data.xdata.Add("xdata_" + i); } LineChartSeriesData lc = new LineChartSeriesData(); lc.name = "数据1"; lc.values = new List(); for (int i = 0; i < 10; i++) { lc.values.Add(UnityEngine.Random.Range(1, 800)); } data.sdata.Add(lc); LineChartSeriesData lc2 = new LineChartSeriesData(); lc2.name = "数据2"; lc2.values = new List(); for (int i = 0; i < 10; i++) { lc2.values.Add(UnityEngine.Random.Range(1, 800)); } data.sdata.Add(lc2); callback.Invoke(data); } public void GetGaoJingData(Action callback) { LineChartData data = new LineChartData(); data.xdata = new List(); data.sdata = new List(); for (int i = 0; i < 20; i++) { data.xdata.Add("xdata_" + i); } LineChartSeriesData lc = new LineChartSeriesData(); lc.name = "数据1"; lc.values = new List(); for (int i = 0; i < 20; i++) { lc.values.Add(UnityEngine.Random.Range(1, 1000)); } data.sdata.Add(lc); LineChartSeriesData lc2 = new LineChartSeriesData(); lc2.name = "数据2"; lc2.values = new List(); for (int i = 0; i < 20; i++) { lc2.values.Add(UnityEngine.Random.Range(1, 1000)); } data.sdata.Add(lc2); LineChartSeriesData lc3 = new LineChartSeriesData(); lc3.name = "数据3"; lc3.values = new List(); for (int i = 0; i < 20; i++) { lc3.values.Add(UnityEngine.Random.Range(1, 1000)); } data.sdata.Add(lc2); callback.Invoke(data); } public void GetGaoJingJiLuData(Action callback) { GaoJingListData gjl = new GaoJingListData(); gjl.list = new List(); for (int i = 0; i < 2; i++) { GaoJingItemData gjid = new GaoJingItemData(); gjid.lv = "一般"; gjid.time = "2024-1-1 00:11"; gjid.dev = "111机房"; gjid.type = "已解决"; gjl.list.Add(gjid); } for (int i = 0; i < 2; i++) { GaoJingItemData gjid = new GaoJingItemData(); gjid.lv = "紧急"; gjid.time = "2024-1-1 00:11"; gjid.dev = "111机房"; gjid.type = "待解决"; gjl.list.Add(gjid); } for (int i = 0; i < 2; i++) { GaoJingItemData gjid = new GaoJingItemData(); gjid.lv = "严重"; gjid.time = "2024-1-1 00:11"; gjid.dev = "111机房"; gjid.type = "已解决"; gjl.list.Add(gjid); } callback.Invoke(gjl); } }