123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- 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<ServerData> callback)
- {
- ServerData sd = new ServerData();
- sd.serverList = new List<ServerRoomData>();
- 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<LineChartData> callback,int type)
- {
- LineChartData data = new LineChartData();
- data.xdata = new List<string>();
- data.sdata = new List<LineChartSeriesData>();
- 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<float>();
- 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<ServerData> callback)
- {
- ServerData sd = new ServerData();
- sd.serverList = new List<ServerRoomData>();
- 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<ServerJiLongData>();
- for (int j = 0; j < i; j++)
- {
- ServerJiLongData jilong = new ServerJiLongData();
- jilong.id = j;
- jilong.name = i + "_" + j;
- jilong.jiguilist = new List<ServerjiguiData>();
- 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<ServerData> callback)
- {
- ServerData sd = new ServerData();
- sd.serverList = new List<ServerRoomData>();
- 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<ServerJiLongData>();
- for (int j = 0; j < i; j++)
- {
- ServerJiLongData jilong = new ServerJiLongData();
- jilong.id = j;
- jilong.name = i + "_" + j;
- jilong.jiguilist = new List<ServerjiguiData>();
- 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<ServerData> callback)
- {
- ServerData sd = new ServerData();
- sd.serverList = new List<ServerRoomData>();
- for (int i = 0; i < 8; i++)
- {
- ServerRoomData srd = new ServerRoomData();
- srd.id = i;
- srd.videolist = new List<ServerVideoData>();
- ServerVideoData svd = new ServerVideoData();
- svd.id = 1;
- svd.name = "机房摄像头";
- svd.url = new List<string>();
- 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<string>();
- 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<TongSuanData> callback)
- {
- TongSuanData jdata = new TongSuanData();
- jdata.devct = 123;
- jdata.serverct = 123;
- jdata.zhiji = 123;
- callback.Invoke(jdata);
- }
- public void GetJianKongPt(Action<JianKongPtData> callback)
- {
- JianKongPtData jdata = new JianKongPtData();
- jdata.shijianct = 123;
- jdata.zhixingct = 123;
- jdata.gaojingct = 123;
- callback.Invoke(jdata);
- }
- public void GetSixServer(Action<List<PieChartData>> callback)
- {
- List<PieChartData> lp = new List<PieChartData>();
- for (int i = 0; i < 6; i++)
- {
- PieChartData p = new PieChartData();
- p.title = i.ToString();
- p.value = 1000000;
- p.items = new List<PieChartItemData>();
- 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<List<RingValueData>> callback)
- {
- List<RingValueData> rvs = new List<RingValueData>();
- 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<LineChartData> callback)
- {
- LineChartData data = new LineChartData();
- data.xdata = new List<string>();
- data.sdata = new List<LineChartSeriesData>();
- for (int i = 0; i < 10; i++)
- {
- data.xdata.Add("xdata_" + i);
- }
- LineChartSeriesData lc = new LineChartSeriesData();
- lc.name = "数据1";
- lc.values = new List<float>();
- 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<float>();
- 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<LineChartData> callback)
- {
- LineChartData data = new LineChartData();
- data.xdata = new List<string>();
- data.sdata = new List<LineChartSeriesData>();
- for (int i = 0; i < 20; i++)
- {
- data.xdata.Add("xdata_" + i);
- }
- LineChartSeriesData lc = new LineChartSeriesData();
- lc.name = "数据1";
- lc.values = new List<float>();
- 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<float>();
- 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<float>();
- 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<GaoJingListData> callback)
- {
- GaoJingListData gjl = new GaoJingListData();
- gjl.list = new List<GaoJingItemData>();
- 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);
- }
- }
|