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.
288 lines
12 KiB
288 lines
12 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using AX.TrackRecord;
|
||
|
using AX.MessageSystem;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class ZiDongPingPan : MonoBehaviour {
|
||
|
|
||
|
/// <summary>
|
||
|
/// 自动评判脚本
|
||
|
/// </summary>
|
||
|
public static ZiDongPingPan Instance;
|
||
|
public GameObject Prefab;
|
||
|
private GameObject Father;
|
||
|
private string Name;
|
||
|
private int Num = 0;
|
||
|
[HideInInspector]
|
||
|
public GameObject Showtext;
|
||
|
[HideInInspector]
|
||
|
public Button Surebtn;
|
||
|
private Button Closebtn;
|
||
|
[HideInInspector]
|
||
|
public GameObject PingBi;
|
||
|
void Awake()
|
||
|
{
|
||
|
if (Instance == null)
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
Father = this.gameObject.transform.Find("Scroll View/Viewport/Content").gameObject;
|
||
|
Showtext = transform.Find("Show").gameObject;
|
||
|
Surebtn = this.transform.Find("sure").GetComponent<Button>();
|
||
|
Closebtn = this.transform.Find("Close").GetComponent<Button>();
|
||
|
PingBi = this.transform.Find("PingBi").gameObject;
|
||
|
Surebtn.onClick.AddListener(SureBtn);
|
||
|
Closebtn.onClick.AddListener(CloseBtn);
|
||
|
}
|
||
|
GameObject GameOb;
|
||
|
public void GetMessage(GameObject obj)
|
||
|
{
|
||
|
Num = 0;
|
||
|
GameOb = obj;
|
||
|
Showtext.SetActive(false);
|
||
|
foreach (Transform child in Father.transform)
|
||
|
{
|
||
|
Destroy(child.gameObject);
|
||
|
}
|
||
|
for (int i = 0; i < LoadManager.Instance.record_Load.EventList.Count; i++) //遍历查找知情人
|
||
|
{
|
||
|
Name = "未询问知情人";
|
||
|
|
||
|
if (LoadManager.Instance.record_Load.EventList[i].insderUIAttriList.Count!=0 &&
|
||
|
LoadManager.Instance.record_Load.EventList[i].insderUIAttriList[0].NoChoseQuestion!="")
|
||
|
{
|
||
|
string Intro ="未询问:"+LoadManager.Instance.record_Load.EventList[i].insderUIAttriList[0].NoChoseQuestion;
|
||
|
GameObject Game = Instances(Name);
|
||
|
Game.GetComponent<ZiDongPingPanChild>().GetMessage(Intro);
|
||
|
|
||
|
for (int j = 0; j < LoadManager.Instance.record_Load.EventList.Count; j++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[j] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
if (Event.ScoreAttri.Count > 0)
|
||
|
{
|
||
|
|
||
|
for (int x = 0; x < Event.ScoreAttri[0].PinFen.Count; x++)
|
||
|
{
|
||
|
string str = Event.ScoreAttri[0].PinFen[x].Name;
|
||
|
if (Game.GetComponent<ZiDongPingPanChild>().Name.text.Equals(str))
|
||
|
{
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Fen.text = Event.ScoreAttri[0].PinFen[x].Scroe.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
for (int i = 0; i < LoadManager.Instance.record_Load.QingLi.zaWuList.Count; i++)//遍历查找错误的清理方式
|
||
|
{
|
||
|
string Str;
|
||
|
if(LoadManager.Instance.record_Load.QingLi.zaWuList[i].Trouble!="")
|
||
|
{
|
||
|
|
||
|
Str= LoadManager.Instance.record_Load.QingLi.zaWuList[i].Name;
|
||
|
if (Str.Contains("zwd"))
|
||
|
{
|
||
|
Name = "杂物堆";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Name = "危险品";
|
||
|
}
|
||
|
GameObject Game = Instances(Name);
|
||
|
string Intro = LoadManager.Instance.record_Load.QingLi.zaWuList[i].Trouble;
|
||
|
Game.GetComponent<ZiDongPingPanChild>().GetMessage(Intro);
|
||
|
for (int j = 0; j < LoadManager.Instance.record_Load.EventList.Count; j++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[j] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
if (Event.ScoreAttri.Count > 0)
|
||
|
{
|
||
|
for (int x = 0; x < Event.ScoreAttri[0].PinFen.Count; x++)
|
||
|
{
|
||
|
string str = Event.ScoreAttri[0].PinFen[x].Name;
|
||
|
if (Game.GetComponent<ZiDongPingPanChild>().Name.text.Equals(str))
|
||
|
{
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Fen.text = Event.ScoreAttri[0].PinFen[x].Scroe.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for (int i = 0; i < LoadManager.Instance.record_Load.poChaiStance.Stance.Count; i++)
|
||
|
{
|
||
|
Name = "破拆站位";
|
||
|
GameObject Game = Instances(Name);
|
||
|
string Intro = "破拆站位不正确";
|
||
|
Game.GetComponent<ZiDongPingPanChild>().GetMessage(Intro);
|
||
|
for (int j = 0; j < LoadManager.Instance.record_Load.EventList.Count; j++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[j] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
if (Event.ScoreAttri.Count > 0)
|
||
|
{
|
||
|
for (int x = 0; x < Event.ScoreAttri[0].PinFen.Count; x++)
|
||
|
{
|
||
|
string str = Event.ScoreAttri[0].PinFen[x].Name;
|
||
|
if (Game.GetComponent<ZiDongPingPanChild>().Name.text.Equals(str))
|
||
|
{
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Fen.text = Event.ScoreAttri[0].PinFen[x].Scroe.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for (int i = 0; i < LoadManager.Instance.record_Load.Noequip.Equip.Count; i++)
|
||
|
{
|
||
|
Name = "未选择装备";
|
||
|
GameObject Game = Instances(Name);
|
||
|
string Who = LoadManager.Instance.record_Load.Noequip.Equip[i].Name;
|
||
|
string Intro =Who+ "破拆前未选择装备";
|
||
|
Game.GetComponent<ZiDongPingPanChild>().GetMessage(Intro);
|
||
|
for (int j = 0; j < LoadManager.Instance.record_Load.EventList.Count; j++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[j] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
if (Event.ScoreAttri.Count > 0)
|
||
|
{
|
||
|
for (int x = 0; x < Event.ScoreAttri[0].PinFen.Count; x++)
|
||
|
{
|
||
|
string str = Event.ScoreAttri[0].PinFen[x].Name;
|
||
|
if (Game.GetComponent<ZiDongPingPanChild>().Name.text.Equals(str))
|
||
|
{
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Fen.text = Event.ScoreAttri[0].PinFen[x].Scroe.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for (int i = 0; i < LoadManager.Instance.record_Load.pochaiAttri.PoChaiList.Count; i++)//遍历查找错误的破拆方式
|
||
|
{
|
||
|
Name = "破拆点";
|
||
|
bool one = LoadManager.Instance.record_Load.pochaiAttri.PoChaiList[i].Toggle2;
|
||
|
bool two = LoadManager.Instance.record_Load.pochaiAttri.PoChaiList[i].Toggle4;
|
||
|
if (!one || !two)
|
||
|
{
|
||
|
GameObject Game = Instances(Name);
|
||
|
string Intro = "破拆方式不正确";
|
||
|
Game.GetComponent<ZiDongPingPanChild>().GetMessage(Intro);
|
||
|
for (int j = 0; j < LoadManager.Instance.record_Load.EventList.Count; j++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[j] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
if (Event.ScoreAttri.Count > 0)
|
||
|
{
|
||
|
for (int x = 0; x < Event.ScoreAttri[0].PinFen.Count; x++)
|
||
|
{
|
||
|
string str = Event.ScoreAttri[0].PinFen[x].Name;
|
||
|
if (Game.GetComponent<ZiDongPingPanChild>().Name.text.Equals(str))
|
||
|
{
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Fen.text = Event.ScoreAttri[0].PinFen[x].Scroe.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (LoadManager.Instance.record_Load.QingLi.zaWuList.Count==0)
|
||
|
{
|
||
|
string Str ="未清理";
|
||
|
GameObject Game = Instances(Str);
|
||
|
int number = LoadManager.Instance.record_Load.ZaWuCount;
|
||
|
string Intro = "还共有"+number.ToString()+"堆杂物危险品未清除";
|
||
|
Game.GetComponent<ZiDongPingPanChild>().GetMessage(Intro);
|
||
|
for (int j = 0; j < LoadManager.Instance.record_Load.EventList.Count; j++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[j] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
if (Event.ScoreAttri.Count > 0)
|
||
|
{
|
||
|
for (int x = 0; x < Event.ScoreAttri[0].PinFen.Count; x++)
|
||
|
{
|
||
|
string str = Event.ScoreAttri[0].PinFen[x].Name;
|
||
|
if (Game.GetComponent<ZiDongPingPanChild>().Name.text.Equals(str))
|
||
|
{
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Fen.text = Event.ScoreAttri[0].PinFen[x].Scroe.ToString();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public GameObject Instances(string name)
|
||
|
{
|
||
|
Num++;
|
||
|
GameObject Game = Instantiate(Prefab) as GameObject;
|
||
|
Game.transform.SetParent(Father.transform);
|
||
|
Game.transform.localScale = new Vector3(1, 1, 1);
|
||
|
Game.GetComponent<ZiDongPingPanChild>().Name.text = Num + "." + name;
|
||
|
return Game;
|
||
|
}
|
||
|
public void ShowText(string Intro)
|
||
|
{
|
||
|
Showtext.gameObject.SetActive(true);
|
||
|
Showtext.transform.Find("Text").GetComponent<Text>().text = Intro;
|
||
|
}
|
||
|
public int Score=0;
|
||
|
public void SureBtn()
|
||
|
{
|
||
|
Score = 0;
|
||
|
for (int i = 0; i < LoadManager.Instance.record_Load.EventList.Count; i++)
|
||
|
{
|
||
|
EventRecordItem_two Event = LoadManager.Instance.record_Load.EventList[i] as EventRecordItem_two;
|
||
|
if (Event.eventType == eventTypeRecord.ZongJiePingPanTag)
|
||
|
{
|
||
|
Event.ScoreAttri.Clear();
|
||
|
PingFenList list = new PingFenList();
|
||
|
Event.ScoreAttri.Add(list);
|
||
|
foreach (Transform child in Father.transform)
|
||
|
{
|
||
|
if (child.GetComponent<ZiDongPingPanChild>().Fen.text != "")
|
||
|
{
|
||
|
Score += int.Parse(child.GetComponent<ZiDongPingPanChild>().Fen.text);
|
||
|
PingFenAttri Attri = new PingFenAttri();
|
||
|
Attri.Scroe = int.Parse(child.GetComponent<ZiDongPingPanChild>().Fen.text);
|
||
|
Attri.Name = child.GetComponent<ZiDongPingPanChild>().Name.text;
|
||
|
Attri.Intro = child.GetComponent<ZiDongPingPanChild>().intro;
|
||
|
Event.ScoreAttri[0].PinFen.Add(Attri);
|
||
|
}
|
||
|
}
|
||
|
LoadManager.Instance.record_Load.EventList[i].ScoreAttri[0].AllScore = Score;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (Score == 0)
|
||
|
{
|
||
|
GameObject.Find("Canvas/时间轴/father/zidong_ZJ/Text").GetComponent<Text>().text ="";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
GameObject.Find("Canvas/时间轴/father/zidong_ZJ/Text").GetComponent<Text>().text =Score.ToString();
|
||
|
}
|
||
|
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
public void CloseBtn()
|
||
|
{
|
||
|
this.gameObject.SetActive(false);
|
||
|
}
|
||
|
}
|