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.
111 lines
3.2 KiB
111 lines
3.2 KiB
using UnityEngine; |
|
using System.Collections; |
|
using UnityEngine.UI; |
|
using AX.TrackRecord; |
|
using System.Collections.Generic; |
|
using System; |
|
|
|
public class InstanceRecord : MonoBehaviour { |
|
|
|
public static InstanceRecord instance_; |
|
void Awake () { |
|
if (instance_ == null) |
|
{ |
|
instance_ = this; |
|
} |
|
} |
|
public Transform Father; |
|
public GameObject Item; |
|
private List<EventRecordItem_two> MyRecord; |
|
|
|
public void DestroyItem() |
|
{ |
|
foreach (Transform child in Father) |
|
{ |
|
Destroy(child.gameObject); |
|
} |
|
} |
|
public void InstanceItem(List<EventRecordItem_two> recordlist) |
|
{ |
|
DestroyItem(); |
|
MyRecord = new List<EventRecordItem_two>(); |
|
MyRecord = recordlist; |
|
for (int i = 0; i < MyRecord.Count;i++) |
|
{ |
|
|
|
EventRecordItem_two Record = MyRecord[i] as EventRecordItem_two; |
|
if (Record.eventType == eventTypeRecord.TaskChange) |
|
{ |
|
GameObject checkBox = Instantiate(Item) as GameObject; |
|
checkBox.transform.SetParent(Father.transform); |
|
string str = Record.objAttriList[0].TopName.ToString(); |
|
string[] name = str.Split('-'); |
|
//checkBox.transform.FindChild("name").GetComponent<Text>().text = name[0]; |
|
if (Record.objAttriList[0].ObjName.Contains("xiaofangyuan")) |
|
{ |
|
checkBox.transform.Find("name").GetComponent<Text>().text = name[0] + "-" + "消防员-" + name[1]; |
|
} |
|
else if (Record.objAttriList[0].ObjName.Contains("xiaofangche")) |
|
{ |
|
string CarName = GetName(Record.objAttriList[0].ObjName); |
|
checkBox.transform.Find("name").GetComponent<Text>().text = name[0] + "-" + CarName + "消防车-" +name[1]; |
|
} |
|
checkBox.transform.Find("time").GetComponent<Text>().text = Record.time.ToString(); |
|
checkBox.transform.Find("work").GetComponent<Text>().text = Record.objAttriList[0].TaskName.ToString(); |
|
|
|
} |
|
} |
|
|
|
} |
|
String GetName(String str) |
|
{ |
|
if (str.Contains("SGC")) |
|
{ |
|
return "水罐车"; |
|
} |
|
else if (str.Contains("PMC")) |
|
{ |
|
return "泡沫车"; |
|
} |
|
else if (str.Contains("DGC")) |
|
{ |
|
return "举高车"; |
|
} |
|
|
|
else if (str.Contains("GPC")) |
|
{ |
|
return "高喷车"; |
|
} |
|
|
|
else if (str.Contains("YTC")) |
|
{ |
|
return "云梯车"; |
|
} |
|
else if (str.Contains("ZMC")) |
|
{ |
|
return "照明车"; |
|
} |
|
else if (str.Contains("QCC")) |
|
{ |
|
return "器材车"; |
|
} |
|
else if (str.Contains("QXC")) |
|
{ |
|
return "抢险车"; |
|
} |
|
else if (str.Contains("PYC")) |
|
{ |
|
return "排烟车"; |
|
} |
|
else if (str.Contains("ZHC")) |
|
{ |
|
return "照明车"; |
|
} |
|
else |
|
{ |
|
return ""; |
|
} |
|
|
|
} |
|
|
|
}
|
|
|