string returnClipName(DoorEventType type) { string clip = null; switch (type) { case DoorEventType.Close: clip = "door_close"; break; case DoorEventType.Open: if (anim.GetClip("door_open")) { clip = "door_open"; } else { clip = "gate_open"; } break; case DoorEventType.Slidedown: clip = "door_slip_down"; break; case DoorEventType.Slideup: clip = "door_slide_up"; break; default: break; } return(clip); }
void Start() { if (doorSoundsOnly == false) { if (effectOnBreak != null) { effectOnBreak.SetActive(false); } current = goToState; if (soundSource == null) { soundSource = this.GetComponent <AudioSource> (); } } }
void PlayLockedSound(DoorEventType type) { AudioClip[] selectedSounds = null; for (int i = 0; i < allDoorSounds.Length; i++) { if (allDoorSounds [i].type == type) { selectedSounds = allDoorSounds [i].sounds; break; } } if (selectedSounds != null) { soundSource.clip = selectedSounds [Random.Range(0, selectedSounds.Length)]; soundSource.Play(); } }
IEnumerator UpdateCurrentState() { yield return(new WaitForSeconds(0.1f)); if (current == goToState) { current = goBackState; } else if (current == goBackState) { current = goToState; } if (debugMode) { Debug.Log("Updated To = " + current); } }
void card_mgr_OnDoorEvent(CardReader.ICardReader reader, DoorEventType enumEventType) { Console.WriteLine(reader.ControllerID + "," + enumEventType.ToString()); foreach (KeyValuePair<string, RegisterInfo> pair in dictClientCallBacks.ToArray()) { try { if (pair.Value.IsRegistDoorEvent && pair.Value.PlaneID == reader.PlaneID) pair.Value.CallBack.SecureDoorEvent(enumEventType, reader.ToBindingData()); } catch { ;} } }
//void cardreader_OnAlarmEvent(CardReader reder, AlarmData alarmdata) //{ // if (this.OnAlarmEvent != null) // this.OnAlarmEvent(reder, alarmdata); //} void cardreader_OnDoorEvent(ICardReader reader, DoorEventType enumEventType) { if (this.OnDoorEvent != null) { try { this.OnDoorEvent(reader, enumEventType); } catch { ;} } if (enumEventType == DoorEventType.Connected) { SecureDBEntities1 db = new SecureDBEntities1(); tblControllerConfig config = db.tblControllerConfig.Where(n => n.ControlID == reader.ControllerID).FirstOrDefault(); if (config != null) config.Comm_state = 1; tblEngineRoomLog log = new tblEngineRoomLog() { ControlID = reader.ControllerID, ABA = "0", StartTime = DateTime.Now, TypeID = 8, TypeCode = 31, Result = 1 }; db.tblEngineRoomLog.Add(log); db.SaveChanges(); db.Dispose(); AlarmData data = new AlarmData() { TimeStamp = DateTime.Now, AlarmType = AlarmType.Secure, ColorString = "Green", Description = reader.ControllerID + "復線", PlaneID = reader.PlaneID, IsForkCCTVEvent = false, PlaneName = Global.GetPlaneNameByPlaneID(reader.PlaneID) // CCTVBindingData =cctv.ToBindingData( }; Program.MyServiceObject.DispatchAlarmEvent(data); this.DownloadSuperPassword(reader.ControllerID); } if (enumEventType == DoorEventType.DisConnected) { SecureDBEntities1 db = new SecureDBEntities1(); tblControllerConfig config = db.tblControllerConfig.Where(n => n.ControlID == reader.ControllerID).FirstOrDefault(); if (config != null) config.Comm_state = 0; tblEngineRoomLog log=new tblEngineRoomLog(){ ControlID=reader.ControllerID, ABA="0", StartTime=DateTime.Now, TypeID=8, TypeCode=30, Result=0}; db.tblEngineRoomLog.Add(log); db.SaveChanges(); db.Dispose(); AlarmData data = new AlarmData() { TimeStamp = DateTime.Now, AlarmType = AlarmType.Secure, ColorString = "Red", Description = reader.ControllerID + "斷線警報", PlaneID = reader.PlaneID, IsForkCCTVEvent = false, PlaneName = Global.GetPlaneNameByPlaneID(reader.PlaneID) // CCTVBindingData =cctv.ToBindingData( }; Program.MyServiceObject.DispatchAlarmEvent(data); } }
void client_OnDoorEvent(DoorEventType evttype, DoorBindingData bindingdata) { if (IsExit) return; DOOR door = Canvas.FindName("Door" + bindingdata.ControlID) as DOOR; door.DataContext = bindingdata; //throw new NotImplementedException(); }
public void SecureDoorEvent(DoorEventType evttype, DoorBindingData doorBindingData) { throw new NotImplementedException(); }