//站台的下行屏蔽门状态设置为关闭 public void CloseXiaXingPingBiMen(DeviceType deviceType) { DeviceMgr mgr = GetDeviceMgr(deviceType); if (mgr == null) { return; } PingBiMenMgr pingBiMenMgr = (PingBiMenMgr)mgr; pingBiMenMgr.XiaXingPingBiMenIsOpen = false; }
//站台的下行屏蔽门是否打开 public bool IsOpenXiaXingPingBiMen(DeviceType deviceType) { DeviceMgr mgr = GetDeviceMgr(deviceType); if (mgr == null) { return(false); } PingBiMenMgr pingBiMenMgr = (PingBiMenMgr)mgr; return(pingBiMenMgr.XiaXingPingBiMenIsOpen); }
private static void JJJ(StationMgr stationMgr, DeviceMgr deviceMgr, Transform deviceTypeTrans, System.UInt16 stationIndex, DeviceType deviceType) { int deviceCount = deviceTypeTrans.childCount; for (int i = 0; i < deviceCount; ++i) { Transform deviceTrans = deviceTypeTrans.GetChild(i); string deviceName = deviceTrans.gameObject.name; Device deviceCom = deviceTrans.GetComponent <Device> (); if (deviceCom == null) { continue; } deviceCom.DeviceId = (int)deviceType + i + 1; deviceCom.StationIndex = stationIndex; deviceCom.DeviceType = deviceType; deviceMgr.AddDevice(deviceCom); OneStation station = TDFramework.SingletonMgr.GameGlobalInfo.StationDeviceAndPointInfo.GetStation(stationIndex); // deviceType, deviceName PointBindInfoList list = station.GetPointBindInfoList(deviceType, deviceName); int pointCount = list.m_pointBindInfoList.Count; for (int j = 0; j < pointCount; ++j) { PointBindInfo pointBindInfo = list.m_pointBindInfoList[j]; int pointStatus = (int)System.Enum.Parse(typeof(PointStatus), pointBindInfo.m_name); int queueIndex = pointBindInfo.m_queueIndex; Point point = GetFirstPoint(stationMgr, stationIndex, pointStatus, queueIndex); point.m_device = deviceCom; } #region 设备是屏蔽门,需管理上行和下行屏蔽门 if (deviceCom is PingBiMenDevice) { PingBiMenMgr pingBiMenMgr = (PingBiMenMgr)deviceMgr; PingBiMenDevice device = (PingBiMenDevice)deviceCom; if (device.PingBiMenType == PingBiMenType.Down) { //下行屏蔽门 pingBiMenMgr.AddDevice2XiaXingPingBiMenList(deviceCom); } else if (device.PingBiMenType == PingBiMenType.Up) { //上行屏蔽门 pingBiMenMgr.AddDevice2ShangXingPingBiMenList(deviceCom); } } #endregion } }
private static void HHH(StationMgr stationMgr, Station station, Transform stationTrans, System.UInt16 stationIndex) { int deviceTypeCount = stationTrans.childCount; for (int i = 0; i < deviceTypeCount; ++i) { DeviceMgr deviceMgr = null; Transform deviceTypeTrans = stationTrans.GetChild(i); DeviceType deviceType = (DeviceType)System.Enum.Parse(typeof(DeviceType), deviceTypeTrans.gameObject.name); if (deviceType == DeviceType.ZhaJi) { deviceMgr = new ZhaJiMgr(); } else if (deviceType == DeviceType.PingBiMen) { deviceMgr = new PingBiMenMgr(); } //deviceTypeTrans是闸机父容器或者屏蔽门父容器 JJJ(stationMgr, deviceMgr, deviceTypeTrans, stationIndex, deviceType); station.AddDeviceMgr(deviceMgr); } }
public override void ReceivePacket(Packet packet) { if (packet == null) { return; } //Npc控制不需要在服务器进行转发给所有的客户端 if (packet == null) { return; } NpcCtrlComplete response = new NpcCtrlComplete(packet.m_data); //站台索引 UInt16 stationIndex = response.m_stationIndex; //0上行,1下行 byte upOrDownFlag = response.m_upOrDownFlag; //0上车,1下车 byte statusFlag = response.m_statusFlag; UnityEngine.Debug.Log("接收到NpcCtrlComplete消息."); //该消息控制屏蔽门状态,因为屏蔽门状态决定了Npc行为 StationModule module = (StationModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.StationModuleName); PingBiMenMgr mgr = (PingBiMenMgr)module.GetDeviceMgr(stationIndex, DeviceType.PingBiMen); if (upOrDownFlag == 0) { //上行 mgr.ShangXingPingBiMenIsOpen = false; if (statusFlag == 0) { //上车 for (int i = 0; i < mgr.ShangXingPingBiMenList.Count; ++i) { ((PingBiMenDevice)mgr.ShangXingPingBiMenList[i]).CanUp = false; } } else if (statusFlag == 1) { //下车 for (int i = 0; i < mgr.ShangXingPingBiMenList.Count; ++i) { ((PingBiMenDevice)mgr.ShangXingPingBiMenList[i]).CanDown = false; } } } else if (upOrDownFlag == 1) { //下行 mgr.XiaXingPingBiMenIsOpen = false; if (statusFlag == 0) { //上车 for (int i = 0; i < mgr.XiaXingPingBiMenList.Count; ++i) { ((PingBiMenDevice)mgr.XiaXingPingBiMenList[i]).CanUp = false; } } else if (statusFlag == 1) { //下车 for (int i = 0; i < mgr.XiaXingPingBiMenList.Count; ++i) { ((PingBiMenDevice)mgr.XiaXingPingBiMenList[i]).CanDown = false; } } } }
void OnGUI() { if (GUILayout.Button("上行屏蔽门打开")) { StationModule module = (StationModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.StationModuleName); PingBiMenMgr mgr = (PingBiMenMgr)module.GetDeviceMgr(0, DeviceType.PingBiMen); mgr.ShangXingPingBiMenIsOpen = true; for (int i = 0; i < mgr.ShangXingPingBiMenList.Count; ++i) { mgr.ShangXingPingBiMenList[i].Open(null); } } if (GUILayout.Button("上行屏蔽门关闭")) { StationModule module = (StationModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.StationModuleName); PingBiMenMgr mgr = (PingBiMenMgr)module.GetDeviceMgr(0, DeviceType.PingBiMen); mgr.ShangXingPingBiMenIsOpen = false; for (int i = 0; i < mgr.ShangXingPingBiMenList.Count; ++i) { mgr.ShangXingPingBiMenList[i].Close(null); } } if (GUILayout.Button("下行屏蔽门打开")) { StationModule module = (StationModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.StationModuleName); PingBiMenMgr mgr = (PingBiMenMgr)module.GetDeviceMgr(0, DeviceType.PingBiMen); mgr.XiaXingPingBiMenIsOpen = true; for (int i = 0; i < mgr.XiaXingPingBiMenList.Count; ++i) { mgr.XiaXingPingBiMenList[i].Open(null); } } if (GUILayout.Button("下行屏蔽门关闭")) { StationModule module = (StationModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.StationModuleName); PingBiMenMgr mgr = (PingBiMenMgr)module.GetDeviceMgr(0, DeviceType.PingBiMen); mgr.XiaXingPingBiMenIsOpen = false; for (int i = 0; i < mgr.XiaXingPingBiMenList.Count; ++i) { mgr.XiaXingPingBiMenList[i].Close(null); } } if (GUILayout.Button("单屏")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; ScreenBindCamera screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 1, m_smallScreenIndex = 0, m_cameraIndex = 5, m_cameraName = "哈哈哈哈XXXX", m_stationIndex = 5, }; byte[] bytes = screenBindCamera.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("切割大屏")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; DivisionBigScreen divisionBigScreen = new DivisionBigScreen() { m_bigScreenXDivisionCount = 2, m_bigScreenYDivisionCount = 2 }; byte[] bytes = divisionBigScreen.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.DivisionBigScreenMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("切割小屏1")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; DivisionSmallScreen divisionSmallScreen = new DivisionSmallScreen() { m_bigScreenIndex = 1, m_smallScreenXDivisionCount = 2, m_smallScreenYDivisionCount = 2, }; byte[] bytes = divisionSmallScreen.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.DivisionSmallScreenMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("切割小屏4")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; DivisionSmallScreen divisionSmallScreen = new DivisionSmallScreen() { m_bigScreenIndex = 4, m_smallScreenXDivisionCount = 2, m_smallScreenYDivisionCount = 2, }; byte[] bytes = divisionSmallScreen.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.DivisionSmallScreenMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("绑定屏幕小屏四分屏1")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; ScreenBindCamera screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 1, m_smallScreenIndex = 1, m_cameraIndex = 1, m_cameraName = "哈哈哈哈1", m_stationIndex = 5, }; byte[] bytes = screenBindCamera.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 1, m_smallScreenIndex = 2, m_cameraIndex = 2, m_cameraName = "哈哈哈哈2", m_stationIndex = 5, }; bytes = screenBindCamera.Packet2Bytes(); sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; u3dId = 111; msgLen = (UInt16)bytes.Length; packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 1, m_smallScreenIndex = 3, m_cameraIndex = 3, m_cameraName = "哈哈哈哈3", m_stationIndex = 5, }; bytes = screenBindCamera.Packet2Bytes(); sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; u3dId = 111; msgLen = (UInt16)bytes.Length; packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 1, m_smallScreenIndex = 4, m_cameraIndex = 4, m_cameraName = "哈哈哈哈4", m_stationIndex = 5, }; bytes = screenBindCamera.Packet2Bytes(); sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; u3dId = 111; msgLen = (UInt16)bytes.Length; packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("绑定屏幕大屏2")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; ScreenBindCamera screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 2, m_smallScreenIndex = 0, m_cameraIndex = 10, m_cameraName = "哈哈哈哈XXXX", m_stationIndex = 5, }; byte[] bytes = screenBindCamera.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("绑定屏幕大屏3")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; ScreenBindCamera screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 3, m_smallScreenIndex = 0, m_cameraIndex = 14, m_cameraName = "哈哈哈哈XXXX", m_stationIndex = 5, }; byte[] bytes = screenBindCamera.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("绑定屏幕小屏四分屏4")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; ScreenBindCamera screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 4, m_smallScreenIndex = 1, m_cameraIndex = 6, m_cameraName = "哈哈哈哈1", m_stationIndex = 5, }; byte[] bytes = screenBindCamera.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 4, m_smallScreenIndex = 2, m_cameraIndex = 7, m_cameraName = "哈哈哈哈2", m_stationIndex = 5, }; bytes = screenBindCamera.Packet2Bytes(); sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; u3dId = 111; msgLen = (UInt16)bytes.Length; packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 4, m_smallScreenIndex = 3, m_cameraIndex = 8, m_cameraName = "哈哈哈哈3", m_stationIndex = 5, }; bytes = screenBindCamera.Packet2Bytes(); sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; u3dId = 111; msgLen = (UInt16)bytes.Length; packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 4, m_smallScreenIndex = 4, m_cameraIndex = 9, m_cameraName = "哈哈哈哈4", m_stationIndex = 5, }; bytes = screenBindCamera.Packet2Bytes(); sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; u3dId = 111; msgLen = (UInt16)bytes.Length; packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("切割大屏8分屏")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; DivisionBigScreen divisionBigScreen = new DivisionBigScreen() { m_bigScreenXDivisionCount = 4, m_bigScreenYDivisionCount = 2 }; byte[] bytes = divisionBigScreen.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.DivisionBigScreenMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } if (GUILayout.Button("绑定屏幕大屏1")) { NetworkModule module = (NetworkModule)SingletonMgr.ModuleMgr.GetModule(StringMgr.NetworkModuleName); if (module == null) { return; } PlayerActor u3dPlayerActor = module.GetPlayerActorByU3dId(111); if (u3dPlayerActor != null) { Agent agent = u3dPlayerActor.Agent; ScreenBindCamera screenBindCamera = new ScreenBindCamera() { m_bigScreenIndex = 1, m_smallScreenIndex = 0, m_cameraIndex = 20, m_cameraName = "哈哈哈哈XXXX", m_stationIndex = 5, }; byte[] bytes = screenBindCamera.Packet2Bytes(); UInt16 sendId = TDFramework.SingletonMgr.GameGlobalInfo.ServerInfo.Id; UInt16 u3dId = 111; UInt16 msgLen = (UInt16)bytes.Length; Packet packet = new Packet(sendId, u3dId, TDFramework.SingletonMgr.MessageIDMgr.ScreenBindCameraMessageId, msgLen, bytes); agent.SendPacket(packet.Packet2Bytes()); } } }