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.
254 lines
12 KiB
254 lines
12 KiB
3 years ago
|
using UnityEngine;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
using UnityEngine.EventSystems;
|
||
|
/// <summary>
|
||
|
/// 挂载在楼牌Cube触发器物体上
|
||
|
/// </summary>
|
||
|
public class FloorSelect : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
public BuildType buildType = BuildType.TypeA;
|
||
|
private int floor;
|
||
|
|
||
|
public static BuildType buildTYPE = BuildType.TypeA;
|
||
|
|
||
|
public static BuildType PageType = BuildType.None;
|
||
|
public static int PageNum = 0;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
|
||
|
string floorStr = gameObject.name.Substring(4);
|
||
|
floor = int.Parse(floorStr);
|
||
|
MessageDispatcher.AddListener("GoStairMess", GoStairMess);
|
||
|
|
||
|
}
|
||
|
public void GoStairMess(IMessage mes)
|
||
|
{
|
||
|
|
||
|
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("1"))//处理城市综合体
|
||
|
{
|
||
|
if (GameObject.Find("YueTanShangSha"))
|
||
|
{
|
||
|
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
Trager.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, this.transform.localPosition.z);
|
||
|
MouseFollowRotation.Instance.distance = 120;
|
||
|
MouseFollowRotation.Instance.y = 13f;
|
||
|
MouseFollowRotation.Instance.x = 358f;
|
||
|
}
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("7"))//处理城市综合体
|
||
|
{
|
||
|
Vector3 vet = InputManager.Instance_.GetSelectedCharacters()[0].transform.position;
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
Trager.transform.localPosition = new Vector3(vet.x, vet.y, vet.z);
|
||
|
MouseFollowRotation.Instance.distance = 25;
|
||
|
MouseFollowRotation.Instance.y = 13f;
|
||
|
MouseFollowRotation.Instance.x = 358f;
|
||
|
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("9"))//处理超高层
|
||
|
{
|
||
|
Vector3 vet = InputManager.Instance_.GetSelectedCharacters()[0].transform.position;
|
||
|
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
if (Trager.transform.parent == null)
|
||
|
{
|
||
|
Trager.transform.localPosition = new Vector3(vet.x, vet.y, vet.z);
|
||
|
MouseFollowRotation.Instance.distance = 29;
|
||
|
MouseFollowRotation.Instance.y = 28.6f;
|
||
|
MouseFollowRotation.Instance.x = 182f;
|
||
|
}
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("11"))//处理超高层
|
||
|
{
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
if (Trager.transform.parent == null)
|
||
|
{
|
||
|
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("7"))
|
||
|
{
|
||
|
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);
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("9"))
|
||
|
{
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("GoStairMess", GoStairMess);
|
||
|
}
|
||
|
void OnMouseDown()
|
||
|
{
|
||
|
Debug.Log(floor);
|
||
|
|
||
|
BuildItem build = new BuildItem();
|
||
|
build.buildType = buildType;
|
||
|
build.floor = floor;
|
||
|
MessageDispatcher.SendMessage("ChangeFloor", build);
|
||
|
|
||
|
PageType = buildType;
|
||
|
PageNum = floor;
|
||
|
|
||
|
if (!LoadManager.Instance.IsPlayBacking && !EventSystem.current.IsPointerOverGameObject() && !UITaskWin.Instance.shield)
|
||
|
{
|
||
|
//切换楼层屏蔽实例化对象操作
|
||
|
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("1"))//处理城市综合体
|
||
|
{
|
||
|
if (GameObject.Find("YueTanShangSha"))
|
||
|
{
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
Trager.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, this.transform.localPosition.z);
|
||
|
MouseFollowRotation.Instance.distance = 120;
|
||
|
MouseFollowRotation.Instance.y = 13f;
|
||
|
MouseFollowRotation.Instance.x = 358f;
|
||
|
}
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("3"))//处理超高层
|
||
|
{
|
||
|
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
Trager.transform.localPosition = new Vector3(this.transform.localPosition.x, this.transform.localPosition.y, this.transform.localPosition.z);
|
||
|
//MouseFollowRotation.Instance.distance = 29;
|
||
|
//MouseFollowRotation.Instance.y = 28.6f;
|
||
|
//MouseFollowRotation.Instance.x = 182f;
|
||
|
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("9"))//处理超高层
|
||
|
{
|
||
|
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
if (Trager.transform.parent == null)
|
||
|
{
|
||
|
Trager.transform.localPosition = new Vector3(Trager.transform.localPosition.x, this.transform.localPosition.y, Trager.transform.localPosition.z);
|
||
|
}
|
||
|
}
|
||
|
if (MySceneManager.GetActiveScene().name.Equals("11"))//处理超高层
|
||
|
{
|
||
|
|
||
|
Transform Trager = GameObject.Find("target").transform;
|
||
|
if (Trager.transform.parent == null)
|
||
|
{
|
||
|
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;
|
||
|
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|