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.
52 lines
1.1 KiB
52 lines
1.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LawCheckList : MonoBehaviour
|
|
{
|
|
public static LawCheckList Instance = null;
|
|
|
|
public Text singText;
|
|
public GameObject CarIDPrefab;
|
|
public Transform ListConcect;
|
|
|
|
private List<string> _carIDList = new List<string>();
|
|
|
|
public void AddCarID(string carID,string shigu)
|
|
{
|
|
if (carID != ""&&!_carIDList.Contains(carID))
|
|
{
|
|
|
|
_carIDList.Add(carID);
|
|
}
|
|
ShowCarId(carID,shigu);
|
|
}
|
|
|
|
private void ShowCarId(string carID,string shigu)
|
|
{
|
|
|
|
//展开项
|
|
if (CarIDPrefab != null)
|
|
{
|
|
GameObject go = GameObject.Instantiate(CarIDPrefab, ListConcect);
|
|
go.GetComponent<Text>().text = carID+shigu;
|
|
}
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
private void Update()
|
|
{
|
|
//列表最新项
|
|
if (_carIDList.Count != 0)
|
|
{
|
|
singText.text = _carIDList[_carIDList.Count - 1];
|
|
}
|
|
|
|
}
|
|
|
|
}
|