天津23维预案
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.
 
 
 
 
 
 

150 lines
7.1 KiB

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using AX.MessageSystem;
using AX.TrackRecord;
using System.Collections.Generic;
public class StairUIChild : MonoBehaviour {
/// <summary>
/// 点击楼层按钮
/// </summary>
private Button ChildBtn;
void Start()
{
ChildBtn = this.gameObject.GetComponent<Button>();
ChildBtn.onClick.AddListener(LetsGo);
}
float Y;
GameObject Floor;
string CubeCengName = "";
public int triggerMode;
public void LetsGo() //点击给选中的消防员置位置
{
bool Has = false;
if (InputManager.Instance_.GetSelectedCharacters().Count==0)
{
MessageDispatcher.SendMessage("Operatinghints", (object)"请选择人员");
return;
}
if (InputManager.Instance_.GetSelectedCharacters().Count != 0)
{
for (int i = 0; i < StairCanGo.Instance.CanGoFloor.Count; i++)
{
string Name = StairCanGo.Instance.CanGoFloor[i].name;
if (this.name.Equals(Name))
{
foreach (Transform child in StairCanGo.Instance.CanGoFloor[i].transform)
{
if (child.name.Contains("TriggerEvent"))
{
Y = child.transform.position.y;
CubeCengName = child.GetComponent<ControlStair>().TheName;
Floor = child.gameObject;
Debug.Log(StairCanGo.Instance.CanGoFloor[i].name + "--" + child.transform.position.y);
}
}
}
}
var neededRemoveList = new List<GameObject>();
for (int j = InputManager.Instance_.GetSelectedCharacters().Count - 1; j >= 0; j--)
{
if (InputManager.Instance_.GetSelectedCharacters()[j].name.Contains("xiaofangyuan") && InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<CengID>().cengID != 0)
{
if (InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<CengID>().cengID
!= Floor.GetComponent<ControlStair>().cengID)
{
if (!InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<ObjMessage>().SQ.gameObject.activeInHierarchy)
{
float x = InputManager.Instance_.GetSelectedCharacters()[j].transform.position.x;
float z = InputManager.Instance_.GetSelectedCharacters()[j].transform.position.z;
InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<UnityEngine.AI.NavMeshAgent>().enabled = false;
InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<FineTuningControl>().DonotRecordFlag = true;
if (InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<CengID>().cengID
< Floor.GetComponent<ControlStair>().cengID)
{
InputManager.Instance_.GetSelectedCharacters()[j].gameObject.SetActive(false);
}
else
{
InputManager.Instance_.GetSelectedCharacters()[j].gameObject.SetActive(true);
}
if (Floor.gameObject.activeInHierarchy)
{
InputManager.Instance_.GetSelectedCharacters()[j].gameObject.SetActive(true);
}
int k = Floor.GetComponent<ControlStair>().cengID;
InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<CengID>().cengID = k;
if (MySceneManager.GetActiveScene().name.Equals("1"))//处理城市综合体
{
InputManager.Instance_.GetSelectedCharacters()[j].transform.position = new Vector3(x, Y, z);
}
else if (MySceneManager.GetActiveScene().name.Equals("3"))//超高层
{
if (triggerMode == 1) //消防电梯
{
InputManager.Instance_.GetSelectedCharacters()[j].transform.position = new Vector3(0.64f, Y, 15f);
}
else if (triggerMode == 2)//楼梯
{
InputManager.Instance_.GetSelectedCharacters()[j].transform.position = new Vector3(0.64f, Y, 15f);
}
}
else if (MySceneManager.GetActiveScene().name.Equals("7"))//土坯房
{
InputManager.Instance_.GetSelectedCharacters()[j].transform.position = new Vector3(x, Y, z);
}
else
{
InputManager.Instance_.GetSelectedCharacters()[j].transform.position = new Vector3(x, Y, z);
}
InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<RLineControl>().LineList_GameObject.Clear();
InputManager.Instance_.GetSelectedCharacters()[j].GetComponent<FineTuningControl>().DonotRecordFlag = false;
}
else
{
Has = true;
neededRemoveList.Add(InputManager.Instance_.GetSelectedCharacters()[j]);
}
}
}
}
foreach(var obj in neededRemoveList)
{
InputManager.Instance_.GetSelectedCharacters()[0].GetComponent<AgentRecord>().xfyList.Remove(obj);
InputManager.Instance_.removeItem(obj);
}
if (RecordManager.Instance.IsRecording)
{
string str1 = this.name.Substring(0, this.name.Length- 1);
string Intro = this.transform.Find("intro").GetComponent<Text>().text;
TrackRecordHelpClass.RecordGoStairEvent(this.name, Intro);
//MessageDispatcher.SendMessage(InputManager.Instance_.GetSelectedCharacters()[0].name, "RecordPathFindingEvent",
//new PathFindingAttri { Navto = InputManager.Instance_.GetSelectedCharacters()[0].transform.position, timer = RecordManager.Instance.RecordTimer },Time.deltaTime*2);
}
if (Has)
{
MessageDispatcher.SendMessage("Operatinghints", (object)"有人员连接管线");
}
//Time.timeScale = 1;
StairUI.Instance.gameObject.SetActive(false);
MessageDispatcher.SendMessage("GoStairMess", (object)CubeCengName);
}
}
}