上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.5 KiB

using AillieoUtils;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 人员定位面板
/// </summary>
public class PersonnelLocationPanel : UIView
{
public ScrollView alarmScrollView;
public ScrollView employeeScrollView;
public List<GameObject> locationCards = new List<GameObject>();
public List<EmployeeItem> items = new List<EmployeeItem>();
public Toggle showAll;
public override void Awake()
{
base.Awake();
showAll.onValueChanged.AddListener(v => Main.Event.EmployeeItemActive(v));
LoadTags(Config.Tags);
}
private void LoadTags(List<string> tags)
{
employeeScrollView.SetUpdateFunc((index, item) =>
{
string info = tags[index];
item.gameObject.SetActive(true);
item.name = info;
item.GetComponent<EmployeeItem>().targetNo=long.Parse(info);
item.transform.Find("CardNumber").GetComponent<Text>().text=info;
locationCards.Add(item.gameObject);
items.Add(item.GetComponent<EmployeeItem>());
item.Find("Show").GetComponent<Toggle>().onValueChanged.AddListener(v => Main.Event.EmployeeActive(long.Parse(info), v));
item.Find("Track").GetComponent<Toggle>().onValueChanged.AddListener(v => Main.LocationSimulator.GetTrackPlaybackData(v, long.Parse(info)));
});
employeeScrollView.SetItemCountFunc(() => tags.Count);
employeeScrollView.UpdateData(false);
}
}