using AillieoUtils; using System.Collections; using System.Collections.Generic; using System.Security.Claims; using UnityEngine; using UnityEngine.UI; /// /// 人员定位面板 /// public class PersonnelLocationPanel : UIView { public ScrollView alarmScrollView; public ScrollView employeeScrollView; public List locationCards = new List(); public List items = new List(); public Toggle showAll; public Color chaiXieColor = Color.white; public Color diDianColor = Color.white; public Color sosColor = Color.white; public Color xinlvColor = Color.white; public Color jinruColor = Color.white; public Color likaiColor = Color.white; public Color biaoqianColor = Color.white; public Color quyuchaoyuanColor = Color.white; private string alarmUrl = ""; public Dictionary AlarmColor = new Dictionary(); public override void Awake() { base.Awake(); showAll.onValueChanged.AddListener(v => Main.Event.EmployeeItemActive(v)); LoadTags(Config.Tags); AlarmColor.Add(1, chaiXieColor); AlarmColor.Add(2, diDianColor); AlarmColor.Add(3, sosColor); AlarmColor.Add(4, xinlvColor); AlarmColor.Add(5, jinruColor); AlarmColor.Add(6, likaiColor); AlarmColor.Add(10, biaoqianColor); AlarmColor.Add(13, quyuchaoyuanColor); alarmUrl = $"{Config.AlarmServer}/prod-api/dingweiRest/apiGetAlarmDatas"; Debug.Log(alarmUrl); } private void Start() { InvokeRepeating("GetAlarmData", 0, Config.AlarmInterval); } private void GetAlarmData() { HttpManager.Instance.Post(alarmUrl, tempData => { if (tempData.ErrorCode == 1) { if (tempData.List.Count > 0) { alarmScrollView.SetUpdateFunc((index, item) => { var data = tempData.List[index]; item.gameObject.SetActive(true); item.GetComponent().Set(data, AlarmColor); item.GetComponent().alarml = data; }); alarmScrollView.SetItemCountFunc(() => tempData.List.Count); alarmScrollView.UpdateData(false); } } }); } private void LoadTags(List tags) { employeeScrollView.SetUpdateFunc((index, item) => { string info = tags[index]; item.gameObject.SetActive(true); item.name = info; item.GetComponent().targetNo=long.Parse(info); item.transform.Find("CardNumber").GetComponent().text=info; locationCards.Add(item.gameObject); items.Add(item.GetComponent()); item.Find("Show").GetComponent().onValueChanged.AddListener(v => Main.Event.EmployeeActive(long.Parse(info), v)); item.Find("Track").GetComponent().onValueChanged.AddListener(v => Main.LocationSimulator.GetTrackPlaybackData(v, long.Parse(info))); }); employeeScrollView.SetItemCountFunc(() => tags.Count); employeeScrollView.UpdateData(false); } }