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.
430 lines
17 KiB
430 lines
17 KiB
3 years ago
|
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
using UnityEngine.EventSystems;
|
||
|
using System;
|
||
|
public class LineamentEvent : MonoBehaviour
|
||
|
{
|
||
|
private EditForceName edit;
|
||
|
public static string ObjectName = "";
|
||
|
public static GameObject gameobj;
|
||
|
public static bool IsDrawLine = false;
|
||
|
[HideInInspector]
|
||
|
public bool ControlJuBi = false;
|
||
|
[HideInInspector]
|
||
|
public string TeamName;
|
||
|
private GameObject TheCarControl;
|
||
|
private GameObject TaskWin;
|
||
|
private GameObject TaskListWin;
|
||
|
private DateTime t1, t2;
|
||
|
private GameObject InsiderWin;
|
||
|
private GameObject ChuLiWin;
|
||
|
[HideInInspector]
|
||
|
public bool ControlShuiPao = false;
|
||
|
|
||
|
[HideInInspector]
|
||
|
public bool isConnectCar = false;//是否连接消防车
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
edit = GameObject.Find("Canvas").gameObject.transform.Find("TeamNameWin").GetComponent<EditForceName>();
|
||
|
TheCarControl = GameObject.Find("Canvas").transform.Find("控制举臂").gameObject;
|
||
|
InsiderWin = GameObject.Find("Canvas").transform.Find("InsiderWind").gameObject;
|
||
|
ChuLiWin = GameObject.Find("Canvas").transform.Find("杂物清理界面").gameObject;
|
||
|
TaskWin = GameObject.Find("Canvas").transform.Find("TaskWind").gameObject;
|
||
|
TaskListWin = GameObject.Find("Canvas").transform.Find("TaskList").gameObject;
|
||
|
MessageDispatcher.AddListener("TeamSelect", LineamentControl);
|
||
|
MessageDispatcher.AddListener("SelectControl", SelectControl);
|
||
|
MessageDispatcher.AddListener("SelectCharactersControl", SelectCharacters);
|
||
|
MessageDispatcher.AddListener("RemoveCharactersControl", RemoveCharacters);
|
||
|
}
|
||
|
//void OnEnable()
|
||
|
//{
|
||
|
// MessageDispatcher.AddListener("TeamSelect", LineamentControl);
|
||
|
// MessageDispatcher.AddListener("SelectControl", SelectControl);
|
||
|
// MessageDispatcher.AddListener("SelectCharactersControl", SelectCharacters);
|
||
|
//}
|
||
|
private void SelectCharacters(IMessage message)
|
||
|
{
|
||
|
if (gameObject == null)
|
||
|
return;
|
||
|
if ((string)message.Data == gameObject.name)
|
||
|
{
|
||
|
ShowLineament(8);
|
||
|
}
|
||
|
}
|
||
|
private void RemoveCharacters(IMessage message)
|
||
|
{
|
||
|
if (gameObject == null)
|
||
|
return;
|
||
|
if ((string)message.Data == gameObject.name)
|
||
|
{
|
||
|
ShowLineament(0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void SelectControl(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == gameObject.name)
|
||
|
{
|
||
|
ShowLineament(8);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
ShowLineament(0);
|
||
|
}
|
||
|
var name = (string)message.Data;
|
||
|
if (!name.Contains("rguanxian"))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("CLOSE_LINELENGTH");
|
||
|
}
|
||
|
}
|
||
|
//public void RecordTaskChange()
|
||
|
//{
|
||
|
// StartCoroutine(Countine());
|
||
|
//}
|
||
|
//IEnumerator Countine()
|
||
|
//{
|
||
|
// yield return new WaitForSeconds(0.1f);
|
||
|
// MessageDispatcher.SendMessage("RecordTaskChangeEvent", (object)LineamentEvent.gameobj.name);
|
||
|
//}
|
||
|
void LineamentControl(IMessage message)
|
||
|
{
|
||
|
|
||
|
|
||
|
if (TeamName == "")
|
||
|
return;
|
||
|
TeamName = transform.Find("info/Name").GetComponent<TextMesh>().text;
|
||
|
string[] topName= TeamName.Split('-');
|
||
|
if (topName[0].Equals((string)message.Data))
|
||
|
{
|
||
|
ShowLineament(8);
|
||
|
StartCoroutine(xietong());
|
||
|
}
|
||
|
}
|
||
|
IEnumerator xietong()
|
||
|
{
|
||
|
|
||
|
yield return new WaitForSeconds(5f);
|
||
|
ShowLineament(0);
|
||
|
|
||
|
}
|
||
|
public void ShowLineament(int layerid)
|
||
|
{
|
||
|
if (this.transform.Find("info/Name") && layerid == 8)
|
||
|
{
|
||
|
if (this.gameObject.name.Contains("anquanshao"))
|
||
|
{
|
||
|
this.transform.Find("info/Name").GetComponent<TextMesh>().color = Color.red;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.transform.Find("info/Name").GetComponent<TextMesh>().color = Color.green;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (this.transform.Find("info/Name"))
|
||
|
{
|
||
|
this.transform.Find("info/Name").GetComponent<TextMesh>().color = Color.white;
|
||
|
}
|
||
|
}
|
||
|
if ((this.gameObject.name.Contains("xiaofangche") || this.gameObject.name.Contains("mb")) && this.transform.Find("info/Name"))
|
||
|
{
|
||
|
if (this.gameObject.transform.Find("polySurface3148"))
|
||
|
{
|
||
|
this.gameObject.transform.Find("polySurface3148").gameObject.layer = layerid;
|
||
|
}
|
||
|
if (this.gameObject.transform.Find("cheshen"))
|
||
|
{
|
||
|
this.gameObject.transform.Find("cheshen").gameObject.layer = layerid;
|
||
|
}
|
||
|
|
||
|
if (this.gameObject.transform.Find("CHeSHen"))
|
||
|
{
|
||
|
this.gameObject.transform.Find("CHeSHen").gameObject.layer = layerid;
|
||
|
}
|
||
|
|
||
|
|
||
|
//else
|
||
|
//{
|
||
|
// this.gameObject.transform.Find("polySurface3148").gameObject.layer = layerid;
|
||
|
//}
|
||
|
|
||
|
}
|
||
|
else if (this.gameObject.name.Contains("xfy_path"))
|
||
|
{
|
||
|
var bodylist = GetComponentsInChildren<SkinnedMeshRenderer>();
|
||
|
foreach (var body in bodylist)
|
||
|
{
|
||
|
if (body.gameObject.activeInHierarchy)
|
||
|
{
|
||
|
if (layerid > 0)
|
||
|
{
|
||
|
body.gameObject.layer = layerid;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
body.gameObject.layer = gameObject.layer;
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else if (this.gameObject.name.Contains("bhf") && this.transform.Find("info/Name"))
|
||
|
{
|
||
|
|
||
|
this.gameObject.transform.Find("BHF_Body").gameObject.layer = layerid;
|
||
|
}
|
||
|
else if (this.gameObject.name.Contains("fhf") && this.transform.Find("info/Name"))
|
||
|
{
|
||
|
|
||
|
this.gameObject.transform.Find("FHF_Body").gameObject.layer = layerid;
|
||
|
}
|
||
|
else if (this.gameObject.name.Contains("grf") && this.transform.Find("info/Name"))
|
||
|
{
|
||
|
|
||
|
this.gameObject.transform.Find("GHF_Body").gameObject.layer = layerid;
|
||
|
}
|
||
|
else if ((this.gameObject.name.Contains("zdf")|| this.gameObject.name.Contains("xfy_path"))
|
||
|
&& this.transform.Find("info/Name"))
|
||
|
{
|
||
|
|
||
|
this.gameObject.transform.Find("XiaoFangYuan_Body").gameObject.layer = layerid;
|
||
|
}
|
||
|
else if (this.gameObject.name.Contains("jyf") && this.transform.Find("info/Name"))
|
||
|
{
|
||
|
|
||
|
this.gameObject.transform.Find("XiaoFangYuan_Body").gameObject.layer = layerid;
|
||
|
}
|
||
|
else if (this.gameObject.name.Contains("XF_SP"))
|
||
|
{
|
||
|
if (transform.Find("ShuiPao09"))
|
||
|
{
|
||
|
transform.Find("ShuiPao09").gameObject.layer = layerid;
|
||
|
}
|
||
|
this.gameObject.transform.Find("XF_SP_").gameObject.layer = layerid;
|
||
|
this.gameObject.transform.Find("XF_SP_/XF_SP").gameObject.layer = layerid;
|
||
|
}
|
||
|
else if(this.gameObject.name.Contains("fire"))
|
||
|
{
|
||
|
//火不处理
|
||
|
//if (layerid > 0)
|
||
|
//{
|
||
|
// gameObject.layer = layerid;
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// gameObject.layer = 30;
|
||
|
//}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.gameObject.layer = layerid;
|
||
|
}
|
||
|
if (this.gameObject.name.Contains("jijiequ"))
|
||
|
{
|
||
|
gameObject.layer = 25;
|
||
|
}
|
||
|
if (this.gameObject.name.Contains("XHSScene"))
|
||
|
{
|
||
|
gameObject.layer = 27;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("TeamSelect", LineamentControl);
|
||
|
MessageDispatcher.RemoveListener("SelectControl", SelectControl);
|
||
|
MessageDispatcher.RemoveListener("SelectCharactersControl", SelectCharacters);
|
||
|
MessageDispatcher.RemoveListener("RemoveCharactersControl", RemoveCharacters);
|
||
|
}
|
||
|
public static GameObject LastObj;
|
||
|
void OnMouseDown()
|
||
|
{
|
||
|
if (!EventSystem.current.IsPointerOverGameObject())
|
||
|
{
|
||
|
|
||
|
if (TrackRecordHelpClass.CheckIfCanControl())
|
||
|
{
|
||
|
//点击物体的显示功能
|
||
|
//if (this.gameObject.name.Contains("jijiequ") && InstantiationCar.Instance.CarName != "")
|
||
|
//{
|
||
|
// return;
|
||
|
//}
|
||
|
if (gameObject.name.Contains("rguanxian"))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("SHOW_LINELENGTH", gameObject);
|
||
|
}
|
||
|
if (gameObject.name.Contains("jingong")|| gameObject.name.Contains("chetui")|| gameObject.name.Contains("fengexian")|| gameObject.name.Contains("dujiexian"))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("SHOW_JIANTOUEDITOR", gameObject);
|
||
|
}
|
||
|
if (gameObject.name.Contains("Polygon"))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("ControlPolygonTrue", (object)gameObject.name);
|
||
|
}
|
||
|
|
||
|
gameobj = gameObject;
|
||
|
|
||
|
if ((gameObject.name.Contains("xiaofangche-pchcdgc") || gameObject.name.Contains("xiaofangche-dgc") || gameObject.name.Contains("xiaofangche-gpc") || gameObject.name.Contains("xiaofangche-ytc")) && ControlJuBi)
|
||
|
{
|
||
|
TheCarControl.SetActive(true);
|
||
|
}
|
||
|
if (gameObject.name != ObjectName)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("CLOSE", (object)"PromptWindow", "CUBE");
|
||
|
TheCarControl.SetActive(false);
|
||
|
if (gameObject.name.Contains("sy"))
|
||
|
{
|
||
|
gameObject.GetComponent<WoundedControl>().isfage = false;
|
||
|
}
|
||
|
if (GameObject.Find("TheTipWindow"))//防止营救页面点击别的物体出现营救面板
|
||
|
{
|
||
|
Destroy(GameObject.Find("TheTipWindow").gameObject);
|
||
|
}
|
||
|
}
|
||
|
//三种举高车显示控制举臂的页面
|
||
|
if (TheCarControl.activeInHierarchy && RecordManager.Instance.IsRecording)
|
||
|
{
|
||
|
if (gameObject.name.Contains("dgc") || gameObject.name.Contains("gpc") || gameObject.name.Contains("ytc"))
|
||
|
{
|
||
|
if (gameObject.name != ObjectName)
|
||
|
{
|
||
|
|
||
|
TheCarControl.GetComponent<ControlRiseCar>().ToggleChange(false);
|
||
|
TheCarControl.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
TheCarControl.SetActive(false);
|
||
|
TheCarControl.GetComponent<ControlRiseCar>().ToggleChange(false);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (gameObject.name != ObjectName)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("CLOSE", (object)TaskWin.name, "CUBE");
|
||
|
MessageDispatcher.SendMessage("CLOSE", (object)TaskListWin.name, "CUBE");
|
||
|
}
|
||
|
ObjectName = gameObject.name;
|
||
|
|
||
|
if (ObjectName.Contains("xiaofang"))
|
||
|
{
|
||
|
LastObj = gameObject;
|
||
|
InputManager.Instance_.SetChoseObj(gameObject);//单选时将物体加到选中数组中
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (!gameObject.name.Contains("pcd"))
|
||
|
{
|
||
|
LastObj = null;
|
||
|
}
|
||
|
InputManager.Instance_.ClearSelectedCharacters();
|
||
|
}
|
||
|
|
||
|
|
||
|
InstantiationCar.Instance.isCarSelect = true;
|
||
|
|
||
|
MessageDispatcher.SendMessage("SelectControl", (object)gameobj.name);
|
||
|
//限制连接管线的种类
|
||
|
if (gameObject.name.Contains("sgc") || gameObject.name.Contains("pmc") || gameObject.name.Contains("dgc") || gameObject.name.Contains("gpc") || gameObject.name.Contains("ytc")
|
||
|
|| gameObject.name.Contains("xiaofangyuan") || gameObject.name.Contains("mb")|| gameObject.name.Contains("XHS"))
|
||
|
{
|
||
|
InstantiationTool.Instance.isRLineSelect = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
InstantiationTool.Instance.isRLineSelect = true;
|
||
|
}
|
||
|
if (gameObject.name.Contains("jijiequ"))
|
||
|
{
|
||
|
InstantiationTool.Instance.isRLineSelect = false;
|
||
|
InstantiationCar.Instance.isCarSelect = false;
|
||
|
}
|
||
|
}
|
||
|
t2 = DateTime.Now;
|
||
|
|
||
|
if (t2 - t1 < new TimeSpan(0, 0, 0, 0, 400) && !EventSystem.current.IsPointerOverGameObject() && !LoadManager.Instance.IsPlayBacking && !UITaskWin.Instance.shield)
|
||
|
{
|
||
|
if (gameObject.name.Contains("zqr")) //知情人UI显示
|
||
|
{
|
||
|
if (ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.CreatQuestion
|
||
|
&& ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.EditQuestion
|
||
|
&& ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.CopyQuestion)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)InsiderWin.name, "CUBE");
|
||
|
InsiderControl.Instance.StarterWin();
|
||
|
}
|
||
|
}
|
||
|
if (gameObject.name.Contains("jijiequ"))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)"JiJieQuUI", "CUBE");
|
||
|
SetJiJieQu.instance.GetGame(gameObject);
|
||
|
}
|
||
|
|
||
|
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.PATHFINDING &&
|
||
|
(gameObject.name.Contains("zwd") || gameObject.name.Contains("wxp"))) //显示杂物清理方式UI
|
||
|
{
|
||
|
if (ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.CreatQuestion
|
||
|
&& ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.EditQuestion
|
||
|
&& ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.CopyQuestion)
|
||
|
{
|
||
|
bool Has = false;
|
||
|
foreach (Transform child in GameObject.Find("pxiaofangyuan").transform)
|
||
|
{
|
||
|
float distance = Vector3.Distance(child.transform.position,
|
||
|
this.gameObject.transform.position);
|
||
|
if (distance < 4f)
|
||
|
{
|
||
|
Has = true;
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)ChuLiWin.name, "CUBE");
|
||
|
ZaWuQingLiUI.instance.GetMessage(this.gameObject);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (!Has)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("Operatinghints", (object)"请消防员靠近清除");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.SANDTABLE &&
|
||
|
(gameObject.name.Contains("zwd") || gameObject.name.Contains("wxp")))
|
||
|
{
|
||
|
if (ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.CreatQuestion
|
||
|
&& ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.EditQuestion
|
||
|
&& ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.CopyQuestion)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)ChuLiWin.name, "CUBE");
|
||
|
ZaWuQingLiUI.instance.GetMessage(this.gameObject);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.PATHFINDING &&
|
||
|
(gameObject.name.Contains("Polygon")))
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)"AreaAttributeSetting", "CUBE");
|
||
|
SetAreaAttribute.Instance.SetObjArea(gameObject);
|
||
|
gameObject.GetComponent<PolygonController>().Editable = false;
|
||
|
}
|
||
|
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.PATHFINDING &&
|
||
|
(gameObject.name.Contains("nametext")))
|
||
|
{
|
||
|
|
||
|
MessageDispatcher.SendMessage("OPEN", (object)"NameTextSetting", "CUBE");
|
||
|
SetNameTextUI.instance.SetNameArea(gameObject);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
t1 = t2;
|
||
|
}
|
||
|
}
|
||
|
}
|