public override void SetBasicPropertyValues() { //PBXDevice的Key值由CTIType,DeviceType,MonitorMode和DeviceName共同决定 string strKey = string.Format("{0}-{1}-{2}-{3}", CTIType, DeviceType, MonitorMode, DeviceName); base.SetBasicPropertyValues(); ResourceProperty propertyValue; for (int i = 0; i < ListProperties.Count; i++) { propertyValue = ListProperties[i]; switch (propertyValue.PropertyID) { case S1110Consts.PROPERTYID_XMLKEY: propertyValue.Value = strKey; break; case PRO_CTITYPE: propertyValue.Value = CTIType.ToString(); break; case PRO_DEVICETYPE: propertyValue.Value = DeviceType.ToString(); break; case PRO_MONITORMODE: propertyValue.Value = MonitorMode.ToString(); break; case PRO_DEVICENAME: propertyValue.Value = DeviceName; break; } } }
/// <summary> /// This is provided on a cooldown to prevent the loading of video assets on every update of settings values /// </summary> /// <param name="_afterCooldown"></param> void SetupCTI(bool _afterCooldown = false) { // If the CTI isn't enabled in the config, disable ourselves and exit out. if (!CallToInteractConfig.Config.Enabled) { loadedType = CTIType.None; return; } if (!_afterCooldown) { setupCooldown = 0.5f; return; } PrepareCTIAsset(); if (loadedType == CTIType.Video) { InitVideoPlayer(); } OnAllHandsExit(); }
public override void GetBasicPropertyValues() { base.GetBasicPropertyValues(); ResourceProperty propertyValue; int intValue; for (int i = 0; i < ListProperties.Count; i++) { propertyValue = ListProperties[i]; switch (propertyValue.PropertyID) { case PRO_CTITYPE: if (int.TryParse(propertyValue.Value, out intValue)) { CTIType = intValue; StrCTIType = CTIType.ToString(); if (ListAllBasicInfos != null) { var info = ListAllBasicInfos.FirstOrDefault( b => b.InfoID == S1110Consts.SOURCEID_CTITYPE && b.Value == CTIType.ToString()); if (info != null) { StrCTIType = CurrentApp.GetLanguageInfo( string.Format("BID{0}{1}", S1110Consts.SOURCEID_CTITYPE, info.SortID.ToString("000")), info.Icon); } } } break; case PRO_DEVICETYPE: if (int.TryParse(propertyValue.Value, out intValue)) { DeviceType = intValue; StrDeviceType = DeviceType.ToString(); if (ListAllBasicInfos != null) { var info = ListAllBasicInfos.FirstOrDefault( b => b.InfoID == S1110Consts.SOURCEID_PBX_DEVICETYPE && b.Value == DeviceType.ToString()); if (info != null) { StrDeviceType = CurrentApp.GetLanguageInfo( string.Format("BID{0}{1}", S1110Consts.SOURCEID_PBX_DEVICETYPE, info.SortID.ToString("000")), info.Icon); } } } break; case PRO_MONITORMODE: if (int.TryParse(propertyValue.Value, out intValue)) { MonitorMode = intValue; StrMonitorMode = MonitorMode.ToString(); if (ListAllBasicInfos != null) { var info = ListAllBasicInfos.FirstOrDefault( b => b.InfoID == S1110Consts.SOURCEID_PBX_MONITORMODE && b.Value == MonitorMode.ToString()); if (info != null) { StrMonitorMode = CurrentApp.GetLanguageInfo( string.Format("BID{0}{1}", S1110Consts.SOURCEID_PBX_MONITORMODE, info.SortID.ToString("000")), info.Icon); } } } break; case PRO_DEVICENAME: DeviceName = propertyValue.Value; break; } } GetNameAndDescription(); }
public override void GetNameAndDescription() { base.GetNameAndDescription(); Name = string.Format("[{0}] {1} {2}", ID, CTIType, DeviceName); Description = string.Format("{0}({1})", Name, ObjectID); if (ListAllBasicInfos == null) { return; } BasicInfoData info = ListAllBasicInfos.FirstOrDefault(b => b.InfoID == S1110Consts.SOURCEID_CTITYPE && b.Value == CTIType.ToString()); if (info == null) { return; } Name = string.Format("[{0}] {1} {2}", ID, CurrentApp.GetLanguageInfo(string.Format("BID{0}{1}", S1110Consts.SOURCEID_CTITYPE, CTIType.ToString("000")), info.Icon), DeviceName); Description = string.Format("{0}({1})", Name, ObjectID); }
void PrepareCTIAsset() { loadedType = CTIType.None; if (Directory.Exists(CTI_PATH)) { if (!File.Exists(currentCTIfileName)) { // if the file does not exist, see if there is a usable one and use that var fileNames = GetCTIFileNames(); if (fileNames != null && fileNames.Length > 0) { currentCTIfileName = Path.Combine(CTI_PATH, fileNames[0]); } } if (File.Exists(currentCTIfileName)) { CTIType ctiType = CTIType.None; foreach (var extension in CTI_VIDEO_EXTENSIONS) { if (currentCTIfileName.Contains(extension)) { ctiType = CTIType.Video; break; } } if (ctiType == CTIType.None) { foreach (var extension in CTI_IMAGE_EXTENSIONS) { if (currentCTIfileName.Contains(extension)) { ctiType = CTIType.Image; break; } } } if (ctiType == CTIType.Image) { // image time CTIImage.enabled = false; byte[] pngBytes = File.ReadAllBytes(currentCTIfileName); Texture2D tex = new Texture2D(2, 2, TextureFormat.RGBA32, false); tex.LoadImage(pngBytes); tex.Apply(false, true); CTIImage.texture = tex; loadedType = CTIType.Image; } else if (ctiType == CTIType.Video) { // video time CTIVideoImage.enabled = false; VideoPlayer.source = VideoSource.Url; VideoPlayer.url = currentCTIfileName; VideoPlayer.Prepare(); loadedType = CTIType.Video; } } } if (loadedType == CTIType.None) { Debug.Log($"Could not find any CTI assets to load at {CTI_PATH}"); } }