/// <summary> /// 加载机房 /// </summary> /// <param name="depNode"></param> /// <param name="isFocusRoom"></param> /// <param name="OnComplete"></param> private void RoomCreate(DepNode depNode, bool isFocusRoom, Action <FloorController> OnComplete = null) { int roomId = depNode.NodeID; Log.Info(string.Format("RoomCreate2 DepNode:{0},{1}", depNode, depNode.TopoNode != null)); GameObject roomObject = GetRoomObject(roomId); FloorController controller = roomObject.GetComponent <FloorController>(); controller.RecordPosInBuilding(depNode); //记录在大楼中的位置信息 controller.SetColliderState(false); DisplayFloor(controller);//单独展示楼层 controller.ShowFloorDev(); if (controller.TopoNode == null) { controller.SetTopoNode(depNode.TopoNode); //设置TopoNode } currentRoom = controller; if (!isFocusRoom) { SceneEvents.OnDepNodeChanged(currentRoom); if (!LocationManager.Instance.IsFocus) { //摄像头对焦完成后,开始加载设备 FocusCamera(roomObject, () => { controller.CreateFloorDev(() => { if (OnComplete != null) { OnComplete(currentRoom); } }); }); } else { controller.CreateFloorDev(() => { if (OnComplete != null) { OnComplete(currentRoom); } }); } } else { if (OnComplete != null) { OnComplete(currentRoom); } } }
/// <summary> /// 是否显示楼层设备 /// </summary> /// <param name="isShow"></param> public void ShowBuildingDev(bool isShow) { foreach (DepNode dep in ChildNodes) { FloorController floor = dep as FloorController; if (floor) { if (isShow) { floor.ShowFloorDev(); } else { floor.HideFloorDev(); } } } }