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.
283 lines
11 KiB
283 lines
11 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
using UnityEngine.EventSystems;
|
||
|
using System;
|
||
|
|
||
|
public class EndBuildingFloor : MonoBehaviour {
|
||
|
|
||
|
private int floor;
|
||
|
public BuildType buildType = BuildType.TypeA;
|
||
|
public int Louceng = 0;
|
||
|
public static EndBuildingFloor Instance;
|
||
|
//public static BuildType buildTYPE;
|
||
|
void Awake()
|
||
|
{
|
||
|
if (Instance == null)
|
||
|
{
|
||
|
Instance = this;
|
||
|
}
|
||
|
string floorStr = gameObject.name.Substring(4);
|
||
|
floor = int.Parse(floorStr);
|
||
|
Louceng = floor + 1;
|
||
|
|
||
|
MessageDispatcher.AddListener("RECORD",RecordBuild);
|
||
|
MessageDispatcher.AddListener("ChangeFloor", ChangeFloor);
|
||
|
MessageDispatcher.AddListener("Y", Y);
|
||
|
MessageDispatcher.AddListener("GoStairMess", GoStairMess);
|
||
|
MessageDispatcher.AddListener("RESETSMOKE", RESETSMOKE);
|
||
|
}
|
||
|
public void GoStairMess(IMessage mes)
|
||
|
{
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("11"))//处理超高层
|
||
|
{
|
||
|
if (((string)mes.Data).Equals(name))
|
||
|
{
|
||
|
BuildItem build = new BuildItem();
|
||
|
build.buildType = buildType;
|
||
|
build.floor = floor;
|
||
|
MessageDispatcher.SendMessage("ChangeFloor", build);
|
||
|
|
||
|
//PageType = buildType;
|
||
|
//PageNum = floor;
|
||
|
|
||
|
if (!LoadManager.Instance.IsPlayBacking)
|
||
|
{
|
||
|
//切换楼层屏蔽实例化对象操作
|
||
|
InstantiationCar.Instance.isCarSelect = true;
|
||
|
InstantiationTool.Instance.isRLineSelect = true;
|
||
|
//EndBuildingFloor.Louceng = floor;
|
||
|
//EndBuildingFloor.buildTYPE = buildType;
|
||
|
|
||
|
MessageDispatcher.SendMessage(buildType, "SELECTFLOOR_EVENT", (object)floor);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("11"))//处理超高层
|
||
|
{
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
Trager.transform.localPosition = new Vector3(Trager.transform.position.x, this.transform.position.y, Trager.transform.position.z);
|
||
|
}
|
||
|
if (RecordManager.Instance.IsRecording)//记录切换楼层事件
|
||
|
{
|
||
|
EventRecordItem_two EventAttribute = new EventRecordItem_two();
|
||
|
EventAttribute.eventType = eventTypeRecord.SwitchingFloor;
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("1") || MySceneManager.GetActiveScene().name.Equals("3"))//处理城市综合体超高层
|
||
|
{
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("3"))
|
||
|
{
|
||
|
CameraAttribute camAttribute = MouseFollowRotation.Instance.CameraAttri;
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
camAttribute.CameraTargetPos = Trager.transform.localPosition;
|
||
|
EventAttribute.camAttributeList.Add(camAttribute);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (GameObject.Find("YueTanShangSha"))
|
||
|
{
|
||
|
CameraAttribute camAttribute = MouseFollowRotation.Instance.CameraAttri;
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
camAttribute.CameraTargetPos = Trager.transform.localPosition;
|
||
|
EventAttribute.camAttributeList.Add(camAttribute);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("11"))
|
||
|
{
|
||
|
CameraAttribute camAttribute = MouseFollowRotation.Instance.CameraAttri;
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
camAttribute.CameraTargetPos = Trager.transform.localPosition;
|
||
|
EventAttribute.camAttributeList.Add(camAttribute);
|
||
|
}
|
||
|
|
||
|
ObjAttribute Attri = new ObjAttribute();
|
||
|
for (int i = 0; i < InputManager.Instance_.GetSelectedCharacters().Count; i++)
|
||
|
{
|
||
|
if (InputManager.Instance_.GetSelectedCharacters()[i].gameObject.name.Contains("xiaofangyuan"))
|
||
|
{
|
||
|
Attri.AllMembers.Add(InputManager.Instance_.GetSelectedCharacters()[i].gameObject.name + "(Node)");
|
||
|
}
|
||
|
}
|
||
|
EventAttribute.objAttriList.Add(Attri);
|
||
|
RecordManager.Instance.RecordBasicEventAttri(ref EventAttribute);
|
||
|
EventAttribute.TheFloor = floor;
|
||
|
EventAttribute.BuildTYPE = buildType;
|
||
|
RecordManager.Instance.AddToRecordEventList(EventAttribute);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void RESETSMOKE(IMessage msg)
|
||
|
{
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("2"))//针对天津地下建筑烟雾显示问题,只处理原始火
|
||
|
{
|
||
|
var smokeParent = GameObject.Find("TianJinZhan/Smoke").transform;//查找烟雾的位置
|
||
|
foreach (Transform smoke in smokeParent)
|
||
|
{
|
||
|
smoke.gameObject.SetActive(false);
|
||
|
smoke.GetComponent<SmokeControl>().ShouldShowSmoke = false;
|
||
|
}
|
||
|
showFlag = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool showFlag = false;
|
||
|
|
||
|
private void Y(IMessage msg)
|
||
|
{
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("2"))//针对天津地下建筑烟雾显示问题,只处理原始火
|
||
|
{
|
||
|
if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.ExamineMode)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
showFlag = !showFlag;
|
||
|
var smoke = "nei" + Louceng + "_smoke";
|
||
|
var smokeParent = GameObject.Find("TianJinZhan/Smoke").transform;//查找烟雾的位置
|
||
|
if (showFlag)
|
||
|
{
|
||
|
ShowSmoke(smoke);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
foreach(Transform so in smokeParent)
|
||
|
{
|
||
|
so.GetComponent<SmokeControl>().ShouldShowSmoke = false;
|
||
|
so.gameObject.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
private void ShowSmoke(string smoke)
|
||
|
{
|
||
|
var smokeParent = GameObject.Find("TianJinZhan/Smoke").transform;//查找烟雾的位置
|
||
|
var pfire = GameObject.Find("pfire").transform;
|
||
|
var hasFire = false;
|
||
|
foreach (Transform fire in pfire)
|
||
|
{
|
||
|
if (fire.GetComponent<CengID>().cengID == floor)
|
||
|
{
|
||
|
hasFire = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
var flag = smokeParent.Find(smoke).GetComponent<SmokeControl>().ShouldShowSmoke;
|
||
|
if (flag || hasFire)
|
||
|
{
|
||
|
smokeParent.Find(smoke).gameObject.SetActive(true);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
private void ChangeFloor(IMessage message)
|
||
|
{
|
||
|
var build = (BuildItem)message.Data;
|
||
|
if(build.buildType== buildType)
|
||
|
{
|
||
|
Louceng = build.floor;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void RecordBuild(IMessage message)
|
||
|
{
|
||
|
BuildItem build = new BuildItem();
|
||
|
build.floor = Louceng;
|
||
|
build.buildType = buildType;
|
||
|
if (message.Data == null)
|
||
|
{
|
||
|
RecordManager.Instance.record.BuildItemList.Add(build);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
RecordManager.Instance.BuildItemList.Add(build);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("RECORD",RecordBuild);
|
||
|
MessageDispatcher.RemoveListener("ChangeFloor", ChangeFloor);
|
||
|
MessageDispatcher.RemoveListener("Y", Y);
|
||
|
MessageDispatcher.AddListener("RESETSMOKE", RESETSMOKE);
|
||
|
MessageDispatcher.RemoveListener("GoStairMess", GoStairMess);
|
||
|
|
||
|
}
|
||
|
public bool Control = true;
|
||
|
void OnMouseDown()
|
||
|
{
|
||
|
FloorSelect.PageType = buildType;
|
||
|
FloorSelect.PageNum = floor;
|
||
|
|
||
|
if (!LoadManager.Instance.IsPlayBacking && !EventSystem.current.IsPointerOverGameObject()&&!UITaskWin.Instance.shield)
|
||
|
{
|
||
|
|
||
|
InstantiationCar.Instance.isCarSelect = true;
|
||
|
InstantiationTool.Instance.isRLineSelect = true;
|
||
|
if (Control)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage(buildType, "SELECTFLOOR_EVENT", (object)floor);
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("2"))
|
||
|
{
|
||
|
FloorSelect.PageNum = -1;
|
||
|
}
|
||
|
if (RecordManager.Instance.IsRecording)//记录切换楼层事件
|
||
|
{
|
||
|
EventRecordItem_two EventAttribute = new EventRecordItem_two();
|
||
|
EventAttribute.eventType = eventTypeRecord.SwitchingFloor;
|
||
|
ObjAttribute Attri = new ObjAttribute();
|
||
|
for (int i = 0; i < InputManager.Instance_.GetSelectedCharacters().Count; i++)
|
||
|
{
|
||
|
Attri.AllMembers.Add(InputManager.Instance_.GetSelectedCharacters()[i].gameObject.name + "(Node)");
|
||
|
}
|
||
|
EventAttribute.objAttriList.Add(Attri);
|
||
|
RecordManager.Instance.RecordBasicEventAttri(ref EventAttribute);
|
||
|
EventAttribute.TheFloor = floor;
|
||
|
EventAttribute.BuildTYPE = buildType;
|
||
|
RecordManager.Instance.AddToRecordEventList(EventAttribute);
|
||
|
|
||
|
}
|
||
|
Control = false;
|
||
|
Louceng = floor;
|
||
|
// buildTYPE = buildType;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageDispatcher.SendMessage(buildType, "SELECTFLOOR_EVENT", (object)(floor + 1));
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("2"))
|
||
|
{
|
||
|
|
||
|
FloorSelect.PageNum = 0;
|
||
|
|
||
|
}
|
||
|
if (RecordManager.Instance.IsRecording)//记录切换楼层事件
|
||
|
{
|
||
|
EventRecordItem_two EventAttribute = new EventRecordItem_two();
|
||
|
EventAttribute.eventType = eventTypeRecord.SwitchingFloor;
|
||
|
ObjAttribute Attri = new ObjAttribute();
|
||
|
for (int i = 0; i < InputManager.Instance_.GetSelectedCharacters().Count; i++)
|
||
|
{
|
||
|
Attri.AllMembers.Add(InputManager.Instance_.GetSelectedCharacters()[i].gameObject.name + "(Node)");
|
||
|
}
|
||
|
EventAttribute.objAttriList.Add(Attri);
|
||
|
RecordManager.Instance.RecordBasicEventAttri(ref EventAttribute);
|
||
|
EventAttribute.TheFloor = floor+1;
|
||
|
EventAttribute.BuildTYPE = buildType;
|
||
|
RecordManager.Instance.AddToRecordEventList(EventAttribute);
|
||
|
|
||
|
}
|
||
|
Control = true;
|
||
|
Louceng = floor + 1;
|
||
|
//buildTYPE = buildType;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|