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.
136 lines
4.0 KiB
136 lines
4.0 KiB
using UnityEngine; |
|
using System.Collections; |
|
using UnityEngine.UI; |
|
using AX.TrackRecord; |
|
using System.Collections.Generic; |
|
using System; |
|
using AX.MessageSystem; |
|
|
|
public class InstanceRecordPlane : MonoBehaviour { |
|
|
|
//实例化详细记录 时间,名称,任务的面板 |
|
|
|
public static InstanceRecordPlane instance_; |
|
void Awake () |
|
{ |
|
|
|
if (instance_ == null) |
|
{ |
|
instance_ = this; |
|
} |
|
} |
|
public Transform Father; |
|
public Transform RecordFather; |
|
public GameObject Item; |
|
private List<EventRecordItem_two> MyRecord; |
|
|
|
void Start() |
|
{ |
|
|
|
} |
|
public void DestroyItem() //销毁 |
|
{ |
|
foreach (Transform child in Father) |
|
{ |
|
Destroy(child.gameObject); |
|
} |
|
} |
|
public void OpenThisPlane() |
|
{ |
|
DestroyItem(); |
|
string filename = "Answers/" + BaseItemManager.CurQues.ID + "/" + BaseItemManager.CurQues.FilePath; |
|
Record_One_root record_Load = new Record_One_root(); |
|
record_Load = GetRecordXml.GetInstance().LoadRecord_DeserializeXMLToRecord(filename); //获取数据 |
|
if (record_Load != null) |
|
{ |
|
InstanceItem(record_Load.EventList); //把数据传输给实例化详细记录的方法生成预设 |
|
} |
|
} |
|
public void ClosePlane() |
|
{ |
|
this.gameObject.SetActive(false); |
|
} |
|
|
|
public void InstanceItem(List<EventRecordItem_two> recordlist) //实例化预设 |
|
{ |
|
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); |
|
checkBox.transform.localScale = new Vector3(1, 1, 1); |
|
string str = Record.objAttriList[0].TopName.ToString(); |
|
string[] name = str.Split('-'); |
|
checkBox.GetComponent<CheckItemRecord>().GetTheID(i, MyRecord.Count, Record);//保留三位小数 |
|
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 ""; |
|
} |
|
|
|
} |
|
|
|
}
|
|
|