using AX.MessageSystem; using UnityEngine; using UnityEngine.AddressableAssets; public class MainMenu : MonoSingleton { public MainMenuMode MenuMode; public BuildingType BuildType; public FloorViewMode ViewMode; //防火分区 public static bool ShowFireCompartments; //防火门 public static bool ShowFireDoors; //防火卷帘 public static bool ShowFireShutters; //室内消火栓 public static bool ShowIndoorHydrants; private void Awake() { GameManager.Instance.Initialize(); } #region MainMenu public void OnHome() { UIManager.Instance.Show(); switch (MenuMode) { case MainMenuMode.单位简介: UIManager.Instance.GetView().PlaneToggle.isOn = false; UIManager.Instance.GetView().PlaneToggle.gameObject.SetActive(false); UIManager.Instance.Hide(); break; case MainMenuMode.消控室: MessageDispatcher.SendMessage("FIRECONTROL", false, "FireControlRoom"); MessageDispatcher.SendMessage("FIRECONTROLCENTERCOLOR", false); EquipmentManager.Instance.CreationType = EquipmentType.None; UIManager.Instance.Hide(); break; case MainMenuMode.防火设计: UIManager.Instance.Hide(); break; case MainMenuMode.防排烟系统: UIManager.Instance.Hide(); break; case MainMenuMode.供水系统: UIManager.Instance.Hide(); break; case MainMenuMode.疏散系统: UIManager.Instance.Hide(); AssetManager.Instance.ZhuTi.SetActive(true); AssetManager.Instance.ShiNei.SetActive(true); AssetManager.Instance.Transparent.SetActive(false); UIManager.Instance.Show(); break; case MainMenuMode.体验漫游: AssetManager.Instance.MainCamera.SetActive(true); UIManager.Instance.Show(); AssetManager.Instance.RoamingAssets.SetActive(false); //卸载全景图 EquipmentManager.Instance.UnLoadAsset(); UIManager.Instance.Hide(); SelectionManager.Instance.Sets.Clear(); break; case MainMenuMode.周边水源: UIManager.Instance.Hide(); switch (BuildType) { case BuildingType.单体: UIManager.Instance.Show(); break; case BuildingType.群楼: break; } AssetManager.Instance.MainCamera.SetActive(true); //AssetManager.Instance.WaterSourceAssets.SetActive(false); WaterSource.Instance.Hide(); break; case MainMenuMode.行车路线: UIManager.Instance.Hide(); switch (BuildType) { case BuildingType.单体: UIManager.Instance.Show(); break; case BuildingType.群楼: break; } AssetManager.Instance.MainCamera.SetActive(true); DriveRoute.Instance.Hide(); //AssetManager.Instance.RouteMapAssets.SetActive(false); break; case MainMenuMode.态势标绘: PowerManager.Instance.ClearAll(); UIManager.Instance.Hide(); UIManager.Instance.Hide(); PowerManager.Instance.Hide(); break; } UIManager.Instance.Hide(); } //单位简介 public void OnIntroduction() { MenuMode = MainMenuMode.单位简介; UIManager.Instance.Hide(); UIManager.Instance.GetView().PlaneToggle.gameObject.SetActive(true); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); } //消控室 public void OnFireControlRoom() { if (AssetManager.Instance.DeviceList.XiaoKongShi.Value) { OnInterialClose(); OnResetCamera(); MenuMode = MainMenuMode.消控室; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); EquipmentManager.Instance.CreationType = EquipmentType.FireControlRoom; MessageDispatcher.SendMessage("FIRECONTROL", true, "FireControlRoom"); MessageDispatcher.SendMessage("FIRECONTROLCENTERCOLOR", true); } else { MessageBox.Show(AssetManager.Instance.DeviceList.XiaoKongShi.Describe, Color.white, 1f); } } //防火设计 public void OnFireDesign() { MenuMode = MainMenuMode.防火设计; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); } //防排烟系统 public void OnSmokeControl() { MenuMode = MainMenuMode.防排烟系统; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); } //供水系统 public void OnWaterSystem() { MenuMode = MainMenuMode.供水系统; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); } //疏散系统 public void OnEvacuationSystem() { MenuMode = MainMenuMode.疏散系统; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); AssetManager.Instance.ZhuTi.SetActive(false); AssetManager.Instance.ShiNei.SetActive(false); UIManager.Instance.Hide(); if (AssetManager.Instance.Transparent) AssetManager.Instance.Transparent.SetActive(true); else AssetManager.Instance.GetTransparent(); } //体验漫游 public void OnRoaming() { MenuMode = MainMenuMode.体验漫游; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); AssetManager.Instance.MainCamera.SetActive(false); UIManager.Instance.Hide(); if (AssetManager.Instance.RoamingAssets == null) { AssetManager.Instance.SetLoadingPanel(true); Addressables.InstantiateAsync("RoamingAssets").Completed += Loaded=> { AssetManager.Instance.RoamingAssets = Loaded.Result; AssetManager.Instance.SetLoadingPanel(false); }; } else { AssetManager.Instance.RoamingAssets.SetActive(true); } //加载全景图 //EquipmentManager.Instance.CreationType = EquipmentType.ImageMarked; //EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllImageMarkers; //EquipmentManager.Instance.LoadData(EquipmentManager.Instance.Equipments.Find(go => go.name == "ImageMarked"), false); } //周边水源 public void OnWaterSource() { MenuMode = MainMenuMode.周边水源; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); switch (BuildType) { case BuildingType.单体: UIManager.Instance.Hide(); break; case BuildingType.群楼: break; } //AssetManager.Instance.WaterSourceAssets.SetActive(true); WaterSource.Instance.Show(); UIManager.Instance.GetView().GetComponent().localEulerAngles = new Vector3(0, 0, 180); AssetManager.Instance.MainCamera.SetActive(false); } //行车路线 public void OnRouteMap() { MenuMode = MainMenuMode.行车路线; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); switch (BuildType) { case BuildingType.单体: UIManager.Instance.Hide(); break; case BuildingType.群楼: break; } AssetManager.Instance.MainCamera.SetActive(false); DriveRoute.Instance.Show(); UIManager.Instance.GetView().GetComponent().localEulerAngles = new Vector3(0, 0, 180); } //态势标绘 public void OnSituationPlotting() { MenuMode = MainMenuMode.态势标绘; UIManager.Instance.Hide(); UIManager.Instance.Show(OnSecondMenuLoaded); UIManager.Instance.Show(); UIManager.Instance.Show(); PowerManager.Instance.Show(); } private void OnSecondMenuLoaded() { UIManager.Instance.GetView().MainText.text = MenuMode.ToString(); } #endregion #region SubMenu //基本信息 public void OnInformation(bool isOn) { if (isOn) { UIManager.Instance.Show(); UIManager.Instance.GetView().PlaneToggle.isOn = false; } else { UIManager.Instance.Hide(); } } //建筑特点 public void OnBuildingFeature(bool isOn) { if (isOn) { UIManager.Instance.Show(); UIManager.Instance.GetView().PlaneToggle.isOn = false; } else { UIManager.Instance.Hide(); } } //高度 public void OnHeight(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; OnInterialClose(); string url = HttpManager.Instance.GetHeightLocation; HttpManager.Instance.Get(url, data => { Camera.main.transform.position = data.Position; Camera.main.transform.eulerAngles = data.Rotation; Camera.main.GetComponent().distance = data.Distance; Camera.main.GetComponent().x = data.Xy.x; Camera.main.GetComponent().y = data.Xy.y; Camera.main.GetComponent().target.position = data.Pivot; }); } MessageDispatcher.SendMessage("HEIGHT", isOn); } //毗邻 public void OnAdjacent(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; OnInterialClose(); string url = HttpManager.Instance.GetAdjacentLocation; HttpManager.Instance.Get(url, data => { Camera.main.transform.position = data.Position; Camera.main.transform.eulerAngles = data.Rotation; Camera.main.GetComponent().distance = data.Distance; Camera.main.GetComponent().x = data.Xy.x; Camera.main.GetComponent().y = data.Xy.y; Camera.main.GetComponent().target.position = data.Pivot; }); UIManager.Instance.Show(AdjacentGetInfos); } else { UIManager.Instance.Hide(); UIManager.Instance.Hide(); } MessageDispatcher.SendMessage("ADJACENT", isOn); MessageDispatcher.SendMessage("ADJACENTCONTROLLER", isOn); } private void AdjacentGetInfos() { var Parent = AssetManager.Instance.transform.Find("Adjacent"); foreach(GameObject go in Parent.GetComponent().Adjectnts) { go.GetComponent().GetInfos(); } } //登高作业面 public void OnFireClimbingSurface(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllFireClimbingSites; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllFireClimbingSites; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.FireClimbingSite; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("FireClimbingSurface", true); } else { if(EquipmentManager.Instance.CreationType== EquipmentType.FireClimbingSite) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //危险源 public void OnHazardSource(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllHazardSources; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllHazardSources; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.HazardSource; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("HazardSource", true); } else { EquipmentManager.Instance.UnLoadAsset(); UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //禁停区 public void OnNoParking(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllNoParkingAreas; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllNoParkingAreas; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.NoParking; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("NoParking", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.NoParking) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //重点提示 public void OnKeyPoint(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllImportantLocations; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllImportantLocations; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.KeyArea; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("KeyArea", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.KeyArea) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //图片标注 public void OnImageMarked(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllImageMarkers; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllImageMarkers; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.ImageMarked; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("ImageMarked", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.ImageMarked) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //逃生窗 public void OnEscapeWindow(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllEscapeWins; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllEscapeWins; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.EscapeWin; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("EscapeWindow", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.EscapeWin) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //破拆点 public void OnBreakPoint(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllBreakPoints; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllBreakPoints; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.BreakPoint; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("BreakPoint", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.BreakPoint) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } } //微型消防站 public void OnFireStation(bool isOn) { if (isOn) { UIManager.Instance.GetView().PlaneToggle.isOn = false; UIManager.Instance.Show(); } else { UIManager.Instance.Hide(); } } //避难层 public void OnRefugeFloor(bool isOn) { if (AssetManager.Instance.DeviceList.BiNanCeng.Value) { MessageDispatcher.SendMessage("REFUGEFLOOR", isOn); if (isOn) { OnInterialClose(); OnResetCamera(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.BiNanCeng.Describe, Color.white, 1f); } } //防火分区 public void OnFireCompartment(bool isOn) { if (AssetManager.Instance.DeviceList.FangHuoFenQu.Value) { ShowFireCompartments = isOn; MessageDispatcher.SendMessage("FIRECOMPANTMENT", isOn); if (isOn) { OnInterialClose(); OnResetCamera(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.FangHuoFenQu.Describe, Color.white, 1f); } } //防火门 public void OnFireDoor(bool isOn) { if (AssetManager.Instance.DeviceList.FangHuoMen.Value) { ShowFireDoors = isOn; MessageDispatcher.SendMessage("FIREDOOR", isOn); if (isOn) { OnInterialClose(); OnResetCamera(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.FangHuoMen.Describe, Color.white, 1f); } } //防火卷帘 public void OnFireShutters(bool isOn) { if (AssetManager.Instance.DeviceList.FangHuoJuanLian.Value) { ShowFireShutters = isOn; MessageDispatcher.SendMessage("FIRESHUTTER", isOn); if (isOn) { OnInterialClose(); OnResetCamera(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.FangHuoJuanLian.Describe, Color.white, 1f); } } //送风机 public void OnForcedDraftFan(bool isOn) { if (isOn) { EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllForcedDraftFans; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllForcedDraftFans; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.ForcedDraftFan; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("ForcedDraftFan", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.ForcedDraftFan) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); } } //送风口 public void OnAirVent(bool isOn) { if (isOn) { EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllAirVents; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllAirVents; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.AirVent; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("AirVent", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.AirVent) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); } } //排烟风机 public void OnSmokeExtractionFan(bool isOn) { if (isOn) { EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllSmokeExtractionFans; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllSmokeExtractionFans; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.SmokeExtractionFan; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("SmokeExtractionFan", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.SmokeExtractionFan) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); UIManager.Instance.Hide(); } } //排烟口 public void OnSmokeVent(bool isOn) { if (isOn) { EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllSmokeVents; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllSmokeVents; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.SmokeVent; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); EquipmentManager.Instance.LoadData("SmokeVent", true); } else { if (EquipmentManager.Instance.CreationType == EquipmentType.SmokeVent) { EquipmentManager.Instance.UnLoadAsset(); } UIManager.Instance.Hide(); } } //泵房水箱 public void OnPumpRoom(bool isOn) { if (AssetManager.Instance.DeviceList.BengFang.Value) { if (isOn) { OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.PumpRoomAndWaterTank; } else { EquipmentManager.Instance.CreationType = EquipmentType.None; UIManager.Instance.Hide(); } MessageDispatcher.SendMessage("PUMPROOM", isOn, "PumpRoomAndWaterTank"); MessageDispatcher.SendMessage("BENGFANGSHUIXIANG", isOn); MessageDispatcher.SendMessage("SETS", isOn,EquipmentType.Pump.ToString()); } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.BengFang.Describe, Color.white, 1f); } } //室内消火栓 public void OnIndoorHydrant(bool isOn) { if (AssetManager.Instance.DeviceList.ShiNeiXiaoHuoShuan.Value) { ShowIndoorHydrants = isOn; MessageDispatcher.SendMessage("INTERIALHYDRANT", isOn); if (isOn) { OnInterialClose(); OnResetCamera(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.ShiNeiXiaoHuoShuan.Describe, Color.white, 1f); } } //室外消火栓 public void OnOutdoorHydrant(bool isOn) { if (isOn) { EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllOutdoorFireHydrants; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllOutdoorFireHydrants; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.OutdoorHydrant; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); } else { UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } MessageDispatcher.SendMessage("ICON", isOn, EquipmentManager.Instance.CreationType.ToString()); MessageDispatcher.SendMessage("SETS", isOn, EquipmentManager.Instance.CreationType.ToString()); MessageDispatcher.SendMessage("DRAG", isOn, EquipmentManager.Instance.CreationType.ToString()); } //水泵接合器 public void OnSiameseConnection(bool isOn) { if (isOn) { EquipmentManager.Instance.GetAllUrl = HttpManager.Instance.GetAllSiameseConnections; EquipmentManager.Instance.PostAllUrl = HttpManager.Instance.PostAllSiameseConnections; OnInterialClose(); OnResetCamera(); EquipmentManager.Instance.CreationType = EquipmentType.SiameseConnection; SelectionManager.Instance.Sets.Clear(); UIManager.Instance.Show(); } else { UIManager.Instance.Hide(); UIManager.Instance.Hide(); SelectionManager.Instance.ClearSelection(); } MessageDispatcher.SendMessage("ICON", isOn, EquipmentManager.Instance.CreationType.ToString()); MessageDispatcher.SendMessage("SETS", isOn, EquipmentManager.Instance.CreationType.ToString()); MessageDispatcher.SendMessage("DRAG", isOn, EquipmentManager.Instance.CreationType.ToString()); } //供水关系图 public void OnDiagram(bool isOn) { if (isOn) { UIManager.Instance.Show(); } else { UIManager.Instance.Hide(); } } //安全出口 public void OnFireEscape(bool isOn) { if (AssetManager.Instance.DeviceList.AnQuanChuKou.Value) { MessageDispatcher.SendMessage("ICON", isOn, EquipmentType.FireEscape.ToString()); MessageDispatcher.SendMessage("SETS", isOn, EquipmentType.FireEscape.ToString()); MessageDispatcher.SendMessage("LUMOS", isOn, EquipmentType.FireEscape.ToString()); if (isOn) { OnInterialClose(); OnResetCamera(); } else { SelectionManager.Instance.ClearSelection(); UIManager.Instance.Hide(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.AnQuanChuKou.Describe, Color.white, 1f); } } //疏散楼梯 public void OnEscapeStiar(bool isOn) { if (AssetManager.Instance.DeviceList.ShuSanLouTi.Value) { MessageDispatcher.SendMessage("SETS", isOn, EquipmentType.EscapeStair.ToString()); MessageDispatcher.SendMessage("LUMOS", isOn, EquipmentType.EscapeStair.ToString()); if (isOn) { OnInterialClose(); OnResetCamera(); } else { SelectionManager.Instance.ClearSelection(); UIManager.Instance.Hide(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.ShuSanLouTi.Describe, Color.white, 1f); } } //消防电梯 public void OnFireElevator(bool isOn) { if (AssetManager.Instance.DeviceList.XiaoFangDianTi.Value) { MessageDispatcher.SendMessage("SETS", isOn, EquipmentType.FireElevator.ToString()); MessageDispatcher.SendMessage("LUMOS", isOn, EquipmentType.FireElevator.ToString()); if (isOn) { OnInterialClose(); OnResetCamera(); } else { SelectionManager.Instance.ClearSelection(); UIManager.Instance.Hide(); } } else { if (isOn) MessageBox.Show(AssetManager.Instance.DeviceList.XiaoFangDianTi.Describe, Color.white, 1f); } } #endregion public void OnInterialClose() { MessageDispatcher.SendMessage("INTERIALCOLSED"); } public void OnResetCamera() { AssetManager.Instance.MainCamera.GetComponent().ResetCamera(); } public Vector2 GetMousePosition(GameObject go) { var canvas = UIManager.GetCanvas().GetComponent(); RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, Input.mousePosition, canvas.worldCamera, out Vector2 pos); float texWidth = go.GetComponent().sizeDelta.x; float texHeight = go.GetComponent().sizeDelta.y; if (Screen.width - pos.x < Screen.width) { pos.x -= texWidth; } if (Screen.height - pos.y > Screen.height) { pos.y += texHeight; } return pos; } }