| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918 | 
							- using System.Collections;
 
- using System.Collections.Generic;
 
- using UnityEngine;
 
- using UnityEngine.UI;
 
- using InfraredManager;
 
- using ZIM;
 
- using System.Linq;
 
- using SLAMUVC;
 
- using System;
 
- using SmartBowSDK;
 
- using ZIM.Unity;
 
- using o0InfraredLocate.ZIM;
 
- public class InfraredDemo : JCUnityLib.ViewBase
 
- {
 
-     public static bool DebugInEditor = true;
 
-     public static InfraredDemo _ins;
 
-     [SerializeField]
 
-     RectTransform canvasRectTransform;
 
-     public Button mBtnSee;
 
-     Reporter reporter;
 
-     public Text FPSText;
 
-     public static void Create()
 
-     {
 
-         if (_ins) return;
 
-         GameObject o = Instantiate(Resources.Load<GameObject>("InfraredDemo"));
 
-         DontDestroyOnLoad(o);
 
-         _ins = o.GetComponent<InfraredDemo>();
 
-         //添加一个父物体
 
-         o.transform.SetParent(ViewMgr.Instance.transform.Find("1").transform);
 
-         CanvasScaler canvasScaler = o.GetComponent<CanvasScaler>();
 
-         if (canvasScaler != null)
 
-         {
 
-             Destroy(canvasScaler);
 
-         }
 
-         RectTransform rectTransform = o.GetComponent<RectTransform>();
 
-         rectTransform.anchorMin = Vector2.zero;      // 左下角对齐父级
 
-         rectTransform.anchorMax = Vector2.one;       // 右上角对齐父级
 
-         rectTransform.offsetMin = Vector2.zero;      // 移除左下角偏移
 
-         rectTransform.offsetMax = Vector2.zero;      // 移除右上角偏移
 
-         rectTransform.localScale = Vector3.one;      // 确保缩放为 1
 
-         //直接初始化一次
 
-         _ins.InitInfraredCamera();
 
-     }
 
-     void Start()
 
-     {
 
-         //生成一个控制台
 
-         GameObject obj = UserPlayer.InitReturnLogReporter() as GameObject;
 
-         if (obj != null) {
 
-             reporter = obj.GetComponent<Reporter>();
 
-             Application.logMessageReceived += HandleLog;
 
-             // 模拟错误日志
 
-             // Debug.LogError("Test Error: This is a simulated error message.");
 
-             // 模拟异常日志
 
-             // Debug.LogException(new System.Exception("Test Exception: This is a simulated exception."));
 
-         }
 
-         if (Application.platform != RuntimePlatform.WindowsEditor) DebugInEditor = false;
 
-         SetVisiable(false);
 
-         InitDebugScreenPoint();
 
-         // gameObject.AddComponent<FPSTester>();
 
-         if (CommonConfig.StandaloneModeOrPlatformB)
 
-         {
 
-             mBtnSee.gameObject.SetActive(false);
 
-         }
 
-         else {
 
-             mBtnSee.interactable = false;
 
-             mBtnSee.transform.Find("Text").GetComponent<Text>().text = TextAutoLanguage2.GetTextByKey("WaitingForInitialization"); // "等待初始化..";
 
-         }
 
-         //直接初始化一次
 
-         //InitInfraredCamera();
 
-         Debug.Log("[InfraredDemo] Start Function!");
 
-         initToggle();
 
-         initExport();
 
-         InitFullScreen();
 
- #if UNITY_STANDALONE_WIN 
 
-         _calibrationFixedText.transform.parent.gameObject.SetActive(false);
 
- #endif
 
-     }
 
-     void OnDestroy()
 
-     {
 
-         if(reporter!= null) Application.logMessageReceived -= HandleLog;
 
-     }
 
-     void Update()
 
-     {
 
-         UpdateInfraredCamera();
 
-         //UpdateDebugScreenPoint();
 
-         if(reporter!=null) FPSText.text = "FPS:" + reporter.fps;
 
-     }
 
-     public void OnClick_See()
 
-     {
 
-         SetVisiable(!_visiable);
 
-     }
 
-     //初始化一次 initScreenLocateManual
 
-     bool hasCalled = false;
 
-     bool _visiable;
 
-     void SetVisiable(bool value)
 
-     {
 
-         _visiable = value;
 
-         transform.Find("Background").gameObject.SetActive(value);
 
-         transform.Find("InfraredCamera").gameObject.SetActive(value);
 
-         //如果是b端,控制这里按钮显示
 
-         if (CommonConfig.StandaloneModeOrPlatformB)
 
-         {
 
-             mBtnSee.gameObject.SetActive(value);
 
-         }
 
-         updateBtnSee();
 
-         Action<Text> onApplyToNext = (t) => {
 
-             updateBtnSee();
 
-         };
 
-         mBtnSee.GetComponentInChildren<TextAutoLanguage2>().onApplyToNext += onApplyToNext;
 
-         //if (value) InitInfraredCamera();
 
-         //刷新翻译的Dropdown
 
-         if (value) {
 
-             UpdateLanguage(); 
 
-             updateDropdownResolution2();
 
-         }
 
-         //if (!hasCalled && value)
 
-         //{
 
-         //    hasCalled = true;
 
-         //    //如果本地有记录,初始化一次
 
-         //    StartCoroutine(initScreenLocateManual());
 
-         //    Debug.Log("[InfraredDemo] SetVisiable Function!");
 
-         //}
 
-     }
 
-     void updateBtnSee() {
 
-         mBtnSee.GetComponentInChildren<Text>().text = _visiable ? TextAutoLanguage2.GetTextByKey("HideInterface") : TextAutoLanguage2.GetTextByKey("DebugInfrared");//"隐藏界面" : "调试红外";
 
-     }
 
-     
 
-     Text _spText;
 
-     Vector2 _screenPoint;
 
-     void InitDebugScreenPoint()
 
-     {
 
-         _spText = transform.Find("SPText").GetComponent<Text>();
 
-         //_spText.gameObject.SetActive(DebugInEditor);
 
-         _spText.gameObject.SetActive(false);
 
-     }
 
-     void UpdateDebugScreenPoint()
 
-     {
 
-         if (!DebugInEditor) return;
 
-         if (infraredCameraHelper == null) return;
 
-         _screenPoint.x = Mathf.Clamp(
 
-             _screenPoint.x + Input.GetAxis("Horizontal") * Screen.width / 400f,
 
-             0, Screen.width);
 
-         _screenPoint.y = Mathf.Clamp(
 
-             _screenPoint.y + Input.GetAxis("Vertical") * Screen.height / 400f,
 
-             0, Screen.height);
 
-         infraredCameraHelper.InvokeOnPositionUpdate(_screenPoint);
 
-         _spText.text = _screenPoint.ToString();
 
-     }
 
-     #region 红外摄像
 
-     [SerializeField] RawImage _cameraRender;
 
-     [SerializeField] RawImage _cameraRender2;
 
-     /// <summary>
 
-     /// 测试texture
 
-     /// </summary>
 
-     public RawImage MyCameraRender2
 
-     {
 
-         get { return _cameraRender2; }
 
-         set { _cameraRender2 = value; }
 
-     }
 
-     //[SerializeField] MaintainAspectRatio _MaintainAspectRatio;
 
-     [SerializeField] List<RectTransform> _crosshairsInCamera;
 
-     [SerializeField] Slider _sliderShakeFilter;
 
-     [SerializeField] Button _btnReset;
 
-     [SerializeField] Button _btnScreenLocateManual;
 
-     [SerializeField] Button _btnScreenLocateManualAuto;
 
-     [SerializeField] Slider _sliderCapture;
 
-     [SerializeField] Slider _sliderDelay;
 
-     [SerializeField] Dropdown _dropdownResolution;
 
-     [SerializeField] Dropdown _dropdownResolution2;
 
-     [SerializeField] Slider _sliderLineWidth;
 
-     [SerializeField] Slider _fanWidth;
 
-     //红外线阈值
 
-     [SerializeField] Slider _infraredFilter;
 
-     //调试UVC参数
 
-     [SerializeField] GameObject _cameraParameterPanel;
 
-     [SerializeField] Button _btnAdjusting;
 
-     //野鸭选择
 
-     [SerializeField] Dropdown _duckLevelDropdown;
 
-     //Dictionary<string, ParamFloatValue> dUVCParameters = new Dictionary<string, ParamFloatValue>();
 
-     //public ParamFloatValue brightness = new ParamFloatValue("ic_brightness", 1.0f);
 
-     //public ParamFloatValue saturation = new ParamFloatValue("ic_saturation", 1.0f);
 
-     //public ParamFloatValue contrast = new ParamFloatValue("ic_contrast", 1.0f);
 
- #if UNITY_ANDROID
 
-     //初始化纹理-1280*720,index = 0
 
-     // public ParamFloatValue resoution = new ParamFloatValue("ic_resoution2", 0);
 
-     //摄像机分辨率 -320*240,index = 10
 
-     public ParamFloatValue resoutionNew = new ParamFloatValue("ic_resoutionNew", 10);
 
-     //摄像机分辨率 -只处理高低分辨率情况
 
-     public ParamFloatValue resoution = new ParamFloatValue("ic_resoution", 0);
 
-     //string[] resolutions = { "高分辨率", "低分辨率" };
 
- #endif
 
-     //抖动过滤值 - 6.0
 
-     public ParamFloatValue shakeFilterValue = new ParamFloatValue("ic_shakeFilterValue2", 6.0f);
 
-     //亮度过滤阈值  - 0.8
 
-     public ParamFloatValue infraredFileterValue = new ParamFloatValue("ic_infraredFileterValue", 0.8f);
 
-     //准心的偏移值
 
-     public ParamVector2Value cameraLocationValue = new ParamVector2Value("ic_cameraLocation", Vector2.zero);
 
-     public ParamVector2Value screenUVValue = new ParamVector2Value("ic_screenUV", Vector2.zero);
 
-     
 
-     //线段宽度阈值
 
-     public ParamFloatValue lineWidth = new ParamFloatValue("ic_lineWidth", 4.0f);
 
-     //扇形宽度
 
-     public ParamFloatValue fanWidth = new ParamFloatValue("ic_fanWidth", 90.0f);
 
-     public ParamFloatValue captureValue = new ParamFloatValue("ic_captureValue", 30.0f);
 
-     public ParamFloatValue delayValue = new ParamFloatValue("ic_delayValue", 30.0f);
 
-     //红外准心,默认打开吧
 
-     public ParamFloatValue crosshairValue = new ParamFloatValue("ic_crosshairValue", 1);
 
-     //野鸭测试存储
 
-     public ParamFloatValue duckHunterLevel = new ParamFloatValue("test_duckHunterLevelValue", 1);
 
-     //存储滑块信息。camera
 
-     public Dictionary<string ,ParamFloatValue> ParamFloatValueCameraSlider = new Dictionary<string, ParamFloatValue>();
 
-     public static InfraredCameraHelper infraredCameraHelper;
 
-     public static bool running { get => infraredCameraHelper != null; }
 
-     private bool _inited;
 
-     #region 参数控制
 
-     public GameObject togglePrefab; // 拖入一个Toggle预设体
 
-     public GameObject sliderPrefab; // 拖入一个Slider预设体
 
-     public GameObject spawnPoint;
 
-     //自动曝光
 
-     bool bAutoAE = false;
 
-     Toggle CTRLAEToggle;
 
-     Slider CTRLAEABSSlider;
 
-     string[] sliderNameArray = new string[]{
 
-         "自动曝光模式",
 
-         "曝光时间(绝对)",
 
-         "亮度", //
 
-         "对比度",
 
-         "色调",
 
-         "饱和度",
 
-         "锐度",
 
-         "伽玛",
 
-         //"白平衡温度",
 
-         //"白平衡分量",
 
-         "背光补偿",
 
-         "增益" };
 
-     string[] sliderStrArray = new string[]{
 
-         "CTRL_AE",
 
-         "CTRL_AE_ABS",
 
-         "PU_BRIGHTNESS",
 
-         "PU_CONTRAST",
 
-         "PU_HUE",
 
-         "PU_SATURATION",
 
-         "PU_SHARPNESS",
 
-         "PU_GAMMA",
 
-         //"PU_WB_TEMP",
 
-         //"PU_WB_COMPO",
 
-         "PU_BACKLIGHT",
 
-         "PU_GAIN" };
 
-     UVCManager.CameraInfo currentCameraInfo;
 
-     //初始化相机参数
 
-     public void initSlider(UVCManager.CameraInfo cameraInfo)
 
-     {
 
-         if (currentCameraInfo != null) return;
 
-         currentCameraInfo = cameraInfo;
 
-         string[] sliderNameArrayKey = new string[] {
 
-             "AutoExposureMode",          // "自动曝光模式"
 
-             "ExposureTimeAbsolute",      // "曝光时间(绝对)"
 
-             "Brightness",                // "亮度"
 
-             "Contrast",                  // "对比度"
 
-             "Hue",                       // "色调"
 
-             "Saturation",                // "饱和度"
 
-             "Sharpness",                 // "锐度"
 
-             "Gamma",                     // "伽玛"
 
-             "BacklightCompensation",     // "背光补偿"
 
-             "Gain"                       // "增益"
 
-         };
 
-         for (int i = 0; i < sliderStrArray.Length; i++)
 
-         {
 
-             string typeStr = sliderStrArray[i];
 
-             // UInt64 _VALUE = cameraInfo.GetTypeByName(typeStr);
 
-             //不支持的,跳过
 
-             bool bContains = cameraInfo.ContainsKey(typeStr);
 
-             if (!bContains) continue;
 
-             if (typeStr == "CTRL_AE")
 
-             {
 
-                 //曝光Toggle
 
-                 GameObject toggleObject = Instantiate(togglePrefab, spawnPoint.transform);
 
-                 toggleObject.SetActive(true);
 
-                 toggleObject.name = typeStr;
 
-                 Text labelObj = toggleObject.transform.Find("Label").GetComponent<Text>();
 
-                 //labelObj.text = sliderNameArray[i];
 
-                 labelObj.gameObject.AddComponent<TextAutoLanguage2>().SetTextKey(sliderNameArrayKey[i]);
 
-                 Toggle toggle = toggleObject.GetComponent<Toggle>();
 
-                 CTRLAEToggle = toggle;
 
-                 UVCCtrlInfo _AEInfo = cameraInfo.GetInfo(typeStr);
 
-                 Debug.Log("UVCCtrlInfo:" + _AEInfo.ToString());
 
-                 int _currentValue = cameraInfo.GetValue(typeStr);
 
-                 bAutoAE = _currentValue == 8 ? true : false; //如果当前值是 8,则当前摄像机是自动曝光模式
 
-                 toggle.isOn = bAutoAE;
 
-                 //cameraInfo.SetValue(_VALUE, _currentValue!=8? 8:1);
 
-                 toggle.onValueChanged.AddListener((bool bValue) =>
 
-                 {
 
-                     //Debug.Log("Toggle value changed to: " + bValue + " from " + _VALUE);
 
-                     if (typeStr == "CTRL_AE")
 
-                     {
 
-                         //开关控制是否自动曝光
 
-                         bAutoAE = bValue;
 
-                         if (CTRLAEABSSlider) CTRLAEABSSlider.interactable = !bAutoAE;
 
-                         int _value = bValue ? 8 : 1;
 
-                         //Debug.Log("_value " + _value);
 
-                         cameraInfo.SetValue(typeStr, _value);
 
-                     }
 
-                 });
 
-             }
 
-             else
 
-             {
 
-                 //其余使用slider
 
-                 GameObject sliderObject = Instantiate(sliderPrefab, spawnPoint.transform);
 
-                 sliderObject.SetActive(true);
 
-                 sliderObject.name = typeStr;
 
-                 Slider slider = sliderObject.GetComponent<Slider>();
 
-                 Text textObj = sliderObject.transform.Find("text").GetComponent<Text>();
 
-                 Text titleTextObj = sliderObject.transform.Find("title").GetComponent<Text>();
 
-                 //titleTextObj.text = sliderNameArray[i];//类型名字
 
-                 titleTextObj.gameObject.AddComponent<TextAutoLanguage2>().SetTextKey(sliderNameArrayKey[i]);
 
-                 if (slider != null)
 
-                 {
 
-                     UVCCtrlInfo _UVCCtrlInfo = cameraInfo.GetInfo(typeStr);
 
-                     slider.minValue = _UVCCtrlInfo.min;
 
-                     slider.maxValue = _UVCCtrlInfo.max;
 
-                     slider.wholeNumbers = true;
 
-                     int _defValue = _UVCCtrlInfo.def;
 
-                     //指定默认值
 
-                     //5、UVC亮度 - 50
 
-                     //6、UVC对比度 - 50
 
-                     if (typeStr == "PU_BRIGHTNESS") {
 
-                         _defValue = 50;
 
-                     } else if (typeStr == "PU_CONTRAST") {
 
-                         _defValue = 50;
 
-                     }
 
-                     //记录一个typeStr类型的数据存储操作对象
 
-                     ParamFloatValue paramFloatValue = new ParamFloatValue("ic_uvc_" + typeStr, _defValue);
 
-                     ParamFloatValueCameraSlider.Add(typeStr, paramFloatValue);
 
-                     if (typeStr == "PU_BRIGHTNESS" || typeStr == "PU_CONTRAST")
 
-                     {
 
-                         //获取设置默认存储的值
 
-                         int _Value = (int)paramFloatValue.Get();
 
-                         cameraInfo.SetValue(typeStr, _Value);
 
-                         Debug.Log("[InfraredDemo] UVC 设置" + typeStr + "默认值:" + _Value);
 
-                         slider.value = _Value;
 
-                         textObj.text = _Value + "";
 
-                     }
 
-                     else {
 
-                         //获取设置当前值
 
-                         int _currentValue = cameraInfo.GetValue(typeStr);
 
-                         slider.value = _currentValue;
 
-                         textObj.text = _currentValue + "";
 
-                     }
 
-                     //如果是曝光slider
 
-                     if (typeStr == "CTRL_AE_ABS")
 
-                     {
 
-                         CTRLAEABSSlider = slider;
 
-                         slider.interactable = !bAutoAE;
 
-                     }
 
-                     slider.onValueChanged.AddListener((newValue) =>
 
-                     {
 
-                         var _value = Mathf.FloorToInt(newValue);
 
-                         textObj.text = _value + "";
 
-                         //Debug.Log("Slider value changed to: " + newValue + " from " + _VALUE);
 
-                         cameraInfo.SetValue(typeStr, _value);
 
-                         paramFloatValue.Set(_value);
 
-                     });
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     public void OpenUVCPanel()
 
-     {
 
-         _cameraParameterPanel.SetActive(true);
 
-     }
 
-     public void CloseUVCPanel()
 
-     {
 
-         _cameraParameterPanel.SetActive(false);
 
-     }
 
-     public void onResetUVCData()
 
-     {
 
- #if UNITY_ANDROID
 
-         resetUVCData();
 
- #endif
 
- #if UNITY_STANDALONE_WIN || UNITY_EDITOR
 
-         resetPCData();
 
- #endif
 
-     }
 
-     void resetUVCData() {
 
-         if (currentCameraInfo == null) return;
 
-         for (int i = 0; i < sliderStrArray.Length; i++)
 
-         {
 
-             string typeStr = sliderStrArray[i];
 
-             // UInt64 _VALUE = currentCameraInfo.GetTypeByName(typeStr);
 
-             bool bContains = currentCameraInfo.ContainsKey(typeStr);
 
-             if (!bContains) continue;
 
-             if (typeStr == "CTRL_AE")
 
-             {
 
-                 //toggle值不进行重置
 
-                 Debug.Log("CTRL_AE 不需要重置");
 
-             }
 
-             else if (typeStr == "CTRL_AE_ABS")
 
-             {
 
-                 if (!bAutoAE)
 
-                 {
 
-                     //如果是手动曝光,重置值
 
-                     Transform trans = _cameraParameterPanel.transform.Find(typeStr);
 
-                     Slider slider = trans.GetComponent<Slider>();
 
-                     Text textObj = trans.Find("text").GetComponent<Text>();
 
-                     UVCCtrlInfo _AEInfo = currentCameraInfo.GetInfo(typeStr);
 
-                     //获取当前值
 
-                     int _currentValue = currentCameraInfo.GetValue(typeStr);
 
-                     Debug.Log("CTRL_AE_ABS:" + _currentValue + " = " + _AEInfo.def + " = " + ",bAutoAE:" + bAutoAE);
 
-                     textObj.text = _AEInfo.def + "";
 
-                     slider.value = _AEInfo.def;
 
-                     if (_AEInfo.def != _currentValue) currentCameraInfo.SetValue(typeStr, _AEInfo.def);
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 Transform trans = _cameraParameterPanel.transform.Find(typeStr);
 
-                 Slider slider = trans.GetComponent<Slider>();
 
-                 Text textObj = trans.Find("text").GetComponent<Text>();
 
-                 UVCCtrlInfo _UVCCtrlInfo = currentCameraInfo.GetInfo(typeStr);
 
-                 ParamFloatValue paramFloatValue =  ParamFloatValueCameraSlider.GetValueOrDefault(typeStr);
 
-                 //重置的值
 
-                 int _defValue = _UVCCtrlInfo.def;
 
-                 if (typeStr == "PU_BRIGHTNESS")
 
-                 {
 
-                     _defValue = (int)paramFloatValue.GetDefault();
 
-                 }
 
-                 else if (typeStr == "PU_CONTRAST")
 
-                 {
 
-                     _defValue = (int)paramFloatValue.GetDefault();
 
-                 }
 
-                 textObj.text = _defValue + "";
 
-                 slider.value = _defValue;
 
-                 //获取当前值
 
-                 int _currentValue = currentCameraInfo.GetValue(typeStr);
 
-                 //重置存储值
 
-                 paramFloatValue.Reset();
 
-                 //存储初始值,设置一次到UVC参数
 
-                 if (_defValue != _currentValue) currentCameraInfo.SetValue(typeStr, _defValue);
 
-             }
 
-         }
 
-     }
 
-     //windows 相机
 
-     string[] sliderNameArrayPC = new string[]{
 
-         "亮度",
 
-         "对比度",};
 
-     string[] sliderNameArrayPCKey = new string[]{
 
-         "Brightness",
 
-         "Contrast",};
 
-     string[] sliderStrArrayPC = new string[]{
 
-         "PU_BRIGHTNESS",
 
-         "PU_CONTRAST"};
 
-     //记录一个typeStr类型的数据存储操作对象
 
-     ParamFloatValue pcBRIGHTNESS = new ParamFloatValue("ic_pc_PU_BRIGHTNESS", 0);
 
-     ParamFloatValue pcCONTRAST = new ParamFloatValue("ic_pc_PU_CONTRAST", 0);
 
-     public void initSliderPC()
 
-     {
 
-         for (int i = 0; i < sliderStrArrayPC.Length; i++)
 
-         {
 
-             string typeStr = sliderStrArrayPC[i];
 
-             GameObject sliderObject = Instantiate(sliderPrefab, spawnPoint.transform);
 
-             sliderObject.SetActive(true);
 
-             sliderObject.name = typeStr;
 
-             Slider slider = sliderObject.GetComponent<Slider>();
 
-             Text textObj = sliderObject.transform.Find("text").GetComponent<Text>();
 
-             Text titleTextObj = sliderObject.transform.Find("title").GetComponent<Text>();
 
-             //titleTextObj.text = TextAutoLanguage2.GetTextByKey(sliderNameArrayPCKey[i]);// sliderNameArrayPC[i];//类型名字
 
-             titleTextObj.gameObject.AddComponent<TextAutoLanguage2>().SetTextKey(sliderNameArrayPCKey[i]);
 
-             if (slider != null)
 
-             {
 
-                 slider.minValue = -1;
 
-                 slider.maxValue = 1;
 
-                 //记录一个typeStr类型的数据存储操作对象
 
-                 if (typeStr == "PU_BRIGHTNESS")
 
-                 {
 
-                     //获取设置默认存储的值
 
-                     float _Value = pcBRIGHTNESS.Get();
 
-                     infraredCameraHelper.SetBrightness(_Value);
 
-                     Debug.Log("[InfraredDemo] PC 设置 PU_BRIGHTNESS:" + typeStr + "默认值:" + _Value);
 
-                     slider.value = _Value;
 
-                     textObj.text = _Value + "";
 
-                     slider.onValueChanged.AddListener((newValue) =>
 
-                     {
 
-                         var _value = newValue;
 
-                         textObj.text = _value + "";
 
-                         infraredCameraHelper.SetBrightness(_value);
 
-                         pcBRIGHTNESS.Set(_value);
 
-                     });
 
-                 }
 
-                 else if (typeStr == "PU_CONTRAST")
 
-                 {
 
-                     //获取设置默认存储的值
 
-                     float _Value = pcCONTRAST.Get();
 
-                     infraredCameraHelper.SetContrast(_Value);
 
-                     Debug.Log("[InfraredDemo] PC 设置 PU_CONTRAST:" + typeStr + "默认值:" + _Value);
 
-                     slider.value = _Value;
 
-                     textObj.text = _Value + "";
 
-                     slider.onValueChanged.AddListener((newValue) =>
 
-                     {
 
-                         var _value = newValue;
 
-                         textObj.text = _value + "";
 
-                         infraredCameraHelper.SetContrast(_value);
 
-                         pcCONTRAST.Set(_value);
 
-                     });
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     void resetPCData() {
 
-         for (int i = 0; i < sliderStrArrayPC.Length; i++)
 
-         {
 
-             string typeStr = sliderStrArrayPC[i];
 
-             Transform trans = _cameraParameterPanel.transform.Find(typeStr);
 
-             Slider slider = trans.GetComponent<Slider>();
 
-             Text textObj = trans.Find("text").GetComponent<Text>();
 
-             //重置的值
 
-             int _defValue = 0;
 
-             if (typeStr == "PU_BRIGHTNESS")
 
-             {
 
-                 _defValue = 0;
 
-                 infraredCameraHelper.SetBrightness(_defValue);
 
-             }
 
-             else if (typeStr == "PU_CONTRAST")
 
-             {
 
-                 _defValue = 0;
 
-                 infraredCameraHelper.SetContrast(_defValue);
 
-             }
 
-             textObj.text = _defValue + "";
 
-             slider.value = _defValue;
 
-         }
 
-     }
 
-     #endregion
 
-     void InitInfraredCamera()
 
-     {
 
-         if (_inited) return;
 
-         _inited = true;
 
-         //SDK创建
 
-         if (infraredCameraHelper == null)
 
-         {
 
-             infraredCameraHelper = InfraredCameraHelper.GetInstance();
 
- #if UNITY_STANDALONE_WIN || UNITY_EDITOR
 
-             infraredCameraHelper.CreateToPc();
 
- #endif
 
- #if UNITY_ANDROID
 
-             //开始时候设置一个默认分辨率
 
-             Debug.Log("开始时候的分辨率下标:" + resoution.Get());
 
-             Vector2 resoutionVec2 = SetDefByIndex((int)resoution.Get());
 
-             infraredCameraHelper.Create((int)resoutionVec2.x, (int)resoutionVec2.y);
 
- #endif
 
-             infraredCameraHelper.OnPositionUpdate += (Vector2 point) =>
 
-             {
 
-                 //跑九轴时候,不处理这里位置
 
-                 if (AimHandler.ins && AimHandler.ins.bRuning9Axis()) return;
 
-                 if (Camera.main == null) return;
 
-                 Ray ray = Camera.main.ScreenPointToRay(point);
 
-                 Vector3 rayEndPoint = ray.GetPoint(200);
 
-                 Quaternion quat = Quaternion.LookRotation(rayEndPoint - Camera.main.transform.position);
 
-                 // 挑战场景中其相机的父级有旋转,需要换算
 
-                 if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "GameChallenge")
 
-                 {
 
-                     quat = Quaternion.AngleAxis(-180, Vector3.up) * quat;
 
-                 }
 
-                 if (CameraToLook.ins != null) CameraToLook.ins.localRotation = quat;
 
-                 if (SB_EventSystem.ins) SB_EventSystem.ins.MoveSimulateMouseByInfrared(point);
 
-                 //移动目标游戏
 
-                 if (GeneratingTarget.gm != null) GeneratingTarget.gm.shootingEvent.OnPositionUpdate(point);
 
-             };
 
-             infraredCameraHelper.OnUVCIsReady += (UVCManager.CameraInfo camera) =>
 
-             {
 
-                 //生成控制摄像机的参数滑条
 
-                 Debug.Log("初始化摄像机!");
 
-                 //可以操作按钮
 
-                 mBtnSee.interactable = true;
 
-                 //mBtnSee.transform.Find("Text").GetComponent<Text>().text = "调试红外";
 
-                 updateBtnSee();
 
-                 //延迟重新设置一次分辨率
 
-                 StartCoroutine(delayInitOhterInfo(camera));
 
-             };
 
-             //屏幕变化时候
 
-             infraredCameraHelper.OnUVCPosUpdate += (list) =>
 
-             {
 
-                 Debug.Log("OnUVCPosUpdate list.Count" + list.Count);
 
-                 SetLocatePointsToCameraRender(list, 1, 1);
 
-                 //InfraredScreenPositioningView 页面
 
-                 if (list.Count == 4)
 
-                 {
 
-                     FindObjectOfType<InfraredScreenPositioningView>()?.SyncScreenPosition();
 
-                 }
 
-                 else {
 
-                     FindObjectOfType<InfraredScreenPositioningView>()?.onReset();
 
-                 }
 
-             };
 
-         }
 
-     }
 
-     private void updateDropdownResolution2()
 
-     {
 
-         string[] resolutions = {
 
-             TextAutoLanguage2.GetTextByKey("HighResolution"),
 
-             TextAutoLanguage2.GetTextByKey("LowResolution")
 
-         };
 
-         // 清除默认选项
 
-         _dropdownResolution2.ClearOptions();
 
-         // 将分辨率字符串数组转换为 Dropdown 选项
 
-         _dropdownResolution2.AddOptions(new List<string>(resolutions));
 
-     }
 
-     /// <summary>
 
-     /// 初始化一些游戏配置
 
-     /// </summary>
 
-     /// <returns></returns>
 
-     IEnumerator delayInitOhterInfo(UVCManager.CameraInfo camera) {
 
-         //yield return new WaitForSeconds(1f);
 
-         yield return new WaitForEndOfFrame();
 
- #if UNITY_ANDROID
 
-         initSlider(camera);
 
-         camera.GetResolutionsStrs();
 
-         // 默认设置
 
-         updateDropdownResolution2();
 
-         int index = (int)resoution.Get();
 
-         _dropdownResolution2.value = index;
 
-         _dropdownResolution2.RefreshShownValue();
 
-         // 处理 Dropdown 的选择变化
 
-         _dropdownResolution2.onValueChanged.AddListener(index => { OnResolutionChanged(index); });
 
- #endif
 
- #if UNITY_STANDALONE_WIN || UNITY_EDITOR
 
-         initSliderPC();
 
-         //隐藏不需要的设置
 
-         _btnAdjusting.transform.Find("Text").GetComponent<Text>().text = "调整PC参数";
 
-         _dropdownResolution.gameObject.SetActive(false);
 
-         _dropdownResolution2.gameObject.SetActive(false);
 
- #endif
 
-         //震动阈值
 
-         SetShakeFilterValue(shakeFilterValue.Get());
 
-         _sliderShakeFilter.onValueChanged.AddListener(SetShakeFilterValue);
 
-         //功能按钮
 
-         //重置触发测试
 
-         _btnReset.onClick.AddListener(OnClick_Reset);
 
-         _btnScreenLocateManual.onClick.AddListener(OnClick_ScreenLocateManual);
 
-         _btnScreenLocateManualAuto.onClick.AddListener(OnClick_ScreenLocateManualAuto);
 
-         SetCaptureValue(captureValue.Get());
 
-         _sliderCapture.onValueChanged.AddListener(SetCaptureValue);
 
-         SetDelayValue(delayValue.Get());
 
-         _sliderDelay.onValueChanged.AddListener(SetDelayValue);
 
-         //绘制线段
 
-         SetLineWidth(lineWidth.Get());
 
-         _sliderLineWidth.onValueChanged.AddListener(SetLineWidth);
 
-         SetFanWidth(fanWidth.Get());
 
-         _fanWidth.onValueChanged.AddListener(SetFanWidth);
 
-         //检测红外亮度阈值
 
-         SetInfraredFilterValue(infraredFileterValue.Get());
 
-         _infraredFilter.onValueChanged.AddListener(SetInfraredFilterValue);
 
-         //野鸭设置初始关卡
 
-         int defLevel = (int)duckHunterLevel.Get() - 1 < 0 ? 0 : (int)duckHunterLevel.Get() - 1;
 
-         _duckLevelDropdown.SetValueWithoutNotify(defLevel);
 
-         _duckLevelDropdown.onValueChanged.AddListener(SetDuckLevelTest);
 
-         //b端设置偏移值
 
-         if (CommonConfig.StandaloneModeOrPlatformB) {
 
-             InitCenterOffset();
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// 初始化时候获取设置和存储来控制显示准心
 
-     /// </summary>
 
-     /// <returns></returns>
 
-     public bool bInitCrosshairShow() {
 
-         return UserSettings.ins.openCrossHair && getCrosshairValue() == 1 ? true : false;
 
-     }
 
-     /// <summary>
 
-     /// 获取弓箭准心存储值 
 
-     /// </summary>
 
-     /// <returns></returns>
 
-     public int getCrosshairValue() {
 
-         return (int)crosshairValue.Get();
 
-     }
 
-     public void setCrosshairValue(bool bshow) {
 
-         crosshairValue.Set(bshow ? 1 : 0);
 
-     }
 
-     public void onStartPreview()
 
-     {
 
-         infraredCameraHelper.onStartPreview();
 
-     }
 
-     public void onStopPreview()
 
-     {
 
-         infraredCameraHelper.onStopPreview();
 
-     }
 
-     /// <summary>
 
-     /// 获取并且初始化一次记录点的数据
 
-     /// </summary>
 
-     /// <returns></returns>
 
-     IEnumerator initScreenLocateManual()
 
-     {
 
-         yield return new WaitForSeconds(1f);
 
-         infraredCameraHelper.InitScreenLocateManual();
 
-     }
 
-     IEnumerator RestartOrKillApp()
 
-     {
 
-         yield return new WaitForSeconds(0.3f);
 
-         if (Application.isEditor) yield break;
 
-         if (Application.platform == RuntimePlatform.Android)
 
-         {
 
-             using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
 
-             {
 
-                 const int kIntent_FLAG_ACTIVITY_CLEAR_TASK = 0x00008000;
 
-                 const int kIntent_FLAG_ACTIVITY_NEW_TASK = 0x10000000;
 
-                 var currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
 
-                 var pm = currentActivity.Call<AndroidJavaObject>("getPackageManager");
 
-                 var intent = pm.Call<AndroidJavaObject>("getLaunchIntentForPackage", Application.identifier);
 
-                 intent.Call<AndroidJavaObject>("setFlags", kIntent_FLAG_ACTIVITY_NEW_TASK | kIntent_FLAG_ACTIVITY_CLEAR_TASK);
 
-                 currentActivity.Call("startActivity", intent);
 
-                 currentActivity.Call("finish");
 
-                 var process = new AndroidJavaClass("android.os.Process");
 
-                 int pid = process.CallStatic<int>("myPid");
 
-                 process.CallStatic("killProcess", pid);
 
-             }
 
-         }
 
-         else {
 
-             // 获取当前应用程序的可执行文件路径
 
-             string executablePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
 
-             // 重启应用程序
 
-             System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
 
-             {
 
-                 FileName = executablePath,
 
-                 UseShellExecute = false
 
-             };
 
-             System.Diagnostics.Process.Start(startInfo);
 
-             // 退出当前应用程序
 
-             Application.Quit();
 
-         };
 
-     }
 
-     void UpdateInfraredCamera()
 
-     {
 
-         if (!_visiable) return;
 
-         if (!_inited) return;
 
-         if (infraredCameraHelper == null) return;
 
-         //渲染相机画面
 
-         //_cameraRender.texture = infraredCameraHelper.GetCameraTexture();
 
-         //_cameraRender.material = infraredCameraHelper.GetCameraMaterial();
 
-         if (ScreenLocate.Main.getUVCTexture)
 
-         {
 
-             if (isFullscreen || ScreenLocate.Main.OutputTextures[4] == null)
 
-             {
 
-                 if (_cameraRender.texture == null || ScreenLocate.Main.getUVCTexture.GetNativeTexturePtr() != _cameraRender.texture.GetNativeTexturePtr())
 
-                     _cameraRender.texture = ScreenLocate.Main.getUVCTexture;
 
-                 //ScreenLocate.Main.OutputTextures[4] == null 并且 摄像机缩小的情况下。显示适配线段
 
-                 if (!isFullscreen) SetAllToggle(true);
 
-             }
 
-             else if (ScreenLocate.Main.OutputTextures[4] != null)
 
-             {
 
-                 //缩小的情况下。显示黑白色差的合成图
 
-                 if (_cameraRender.texture == null || ScreenLocate.Main.OutputTextures[4] != null && ScreenLocate.Main.OutputTextures[4].GetNativeTexturePtr() != _cameraRender.texture.GetNativeTexturePtr())
 
-                     _cameraRender.texture = ScreenLocate.Main.OutputTextures[4];
 
-                 //底图缩小的情况下。不显示适配线段,并且隐藏points
 
-                 if (!isFullscreen) {
 
-                     if (showPoints) {
 
-                         Transform pointsTF2 = _cameraRender.transform.Find("Points");
 
-                         for (int i = 0; i < pointsTF2.childCount; i++)
 
-                         {
 
-                             Transform pointTF = pointsTF2.GetChild(i);
 
-                             pointTF.gameObject.SetActive(false);
 
-                             showPoints = false;
 
-                         }
 
-                     }
 
-                     SetAllToggle(false);
 
-                 } 
 
-             }
 
-            
 
-             //_cameraRender.SetNativeSize();
 
-             // _MaintainAspectRatio.AdjustSize();
 
-         }
 
-         //在相机画面显示准心
 
-         if (ScreenLocate.Main)
 
-         {
 
-             var _sl = ScreenLocate.Main;
 
-             var buffer = _sl.infraredSpotBuffer;
 
-             if (buffer != null)
 
-             {
 
-                 for (int i = 0; i < buffer.Length; i++)
 
-                 {
 
-                     if (buffer[i].CameraLocation != null)
 
-                     {
 
-                         //添加一个偏移量,使得最后输出的准心是指向正中心
 
-                         Vector2 newPoint2 = _sl.GetOffsetCameraLocation(buffer[i].CameraLocation.Value);
 
-                         // 检测到光点 
 
-                         var pos = newPoint2.pixelToLocalPosition_AnchorCenter(_sl.mUVCCameraInfo.Size, _cameraRender.rectTransform.rect);
 
-                         _crosshairsInCamera[i].gameObject.SetActive(true);
 
-                         _crosshairsInCamera[i].anchoredPosition = pos;
 
-                     }
 
-                     else
 
-                         _crosshairsInCamera[i].gameObject.SetActive(false);
 
-                 }
 
-             }
 
-             //渲染固定摄像机分辨率
 
-             SetCalibrationFixedText(_sl.mUVCCameraInfo.CurrentCalibrationResolution);
 
-             //渲染摄像机大小
 
-             if (_sl.mUVCCameraInfo != null) SetCameraSizeText(_sl.mUVCCameraInfo.Size);
 
-             //渲染摄像机识别点位置
 
-             SetQuadUnityVectorListText(_sl.PrintVector2List(ScreenLocate.quadUnityVectorList));
 
-         }
 
-     }
 
-     bool showPoints = false;
 
-     public void SetLocatePointsToCameraRender(List<Vector2> points, float w, float h)
 
-     {
 
-         Transform pointsTF2 = _cameraRender.transform.Find("Points");
 
-         if (pointsTF2.childCount == points.Count)
 
-         {
 
-             Vector2 texSize = new Vector2(w, h);
 
-             for (int i = 0; i < pointsTF2.childCount; i++)
 
-             {
 
-                 Transform pointTF = pointsTF2.GetChild(i);
 
-                 Vector2 pos = points[i];
 
-                 pointTF.localPosition = pos.pixelToLocalPosition_AnchorCenter(texSize, _cameraRender.rectTransform.rect);
 
-                 pointTF.gameObject.SetActive(true);
 
-                 showPoints = true;
 
-             }
 
-         }
 
-         else {
 
-             for (int i = 0; i < pointsTF2.childCount; i++)
 
-             {
 
-                 Transform pointTF = pointsTF2.GetChild(i);
 
-                 pointTF.gameObject.SetActive(false);
 
-                 showPoints = false;
 
-             }
 
-         }
 
-         //绘制数据
 
-         DrawTestLine();
 
-     }
 
-     #region 测试数据绘制
 
-     [SerializeField] private Toggle curToggle;
 
-     [SerializeField] private Toggle autoToggle; // 控制 AutoUILineGenerator 的 Toggle
 
-     [SerializeField] private Toggle semiAutoToggle; // 控制 SemiAutoUILineGenerator 的 Toggle
 
-     [SerializeField] private Toggle manualToggle; // 控制 ManualUILineGenerator 的 Toggle
 
-     [SerializeField] LineGenerator CurUILineGenerator;//当前结果屏幕线条
 
-     [SerializeField] LineGenerator AutoUILineGenerator;//第一个结果屏幕线条
 
-     [SerializeField] LineGenerator SemiAutoUILineGenerator;//第二个结果屏幕线条
 
-     [SerializeField] LineGenerator ManualUILineGenerator;//第三个结果屏幕线条
 
-     [SerializeField] private Dropdown dropdown; // 引用场景中的 Dropdown 组件
 
-     [SerializeField] RawImage _cameraRenderTest5;
 
-     [SerializeField] RawImage _cameraRenderTest6;
 
-     void DrawTestLine()
 
-     {
 
-         Vector2 texSize = ScreenLocate.Main.getUVCCameraInfoSize;
 
-         // 判断 texSize 是否为有效值
 
-         if (texSize == Vector2.zero)
 
-         {
 
-             Debug.LogWarning("Texture size is zero, cannot proceed with line drawing.");
 
-             return;
 
-         }
 
-         // 设置三个屏幕四边形和线条生成器
 
-         QuadrilateralInCamera[] screenQuads = new QuadrilateralInCamera[] {
 
-             ScreenLocate.Main.ScreenIdentification?.QuadAuto,
 
-             ScreenLocate.Main.ScreenIdentification?.QuadSemiAuto,
 
-             ScreenLocate.Main.ScreenIdentification?.QuadManual
 
-         };
 
-         LineGenerator[] lineGenerators = new LineGenerator[] {
 
-             AutoUILineGenerator,
 
-             SemiAutoUILineGenerator,
 
-             ManualUILineGenerator
 
-         };
 
-         for (int i = 0; i < screenQuads.Length; i++)
 
-         {
 
-             if (screenQuads[i] == null)
 
-             {
 
-                 Debug.LogWarning($"Screen quadrilateral {i} is null, skipping this line.");
 
-                 continue;
 
-             }
 
-             if (lineGenerators[i] == null)
 
-             {
 
-                 Debug.LogWarning($"Line generator {i} is null, skipping this line.");
 
-                 continue;
 
-             }
 
-             lineGenerators[i].Points = ConvertQuadToPoints(screenQuads[i], texSize);
 
-         }
 
-         // 清除旧选项并填充新的选项
 
-         dropdown.ClearOptions();
 
-         List<string> options = new List<string>();
 
-         //for (int i = 0; i < screenQuads.Length; i++)
 
-         //{
 
-         //    options.Add($"Quad {i + 1}");
 
-         //}
 
-         //options.Add("自动识别");
 
-         //options.Add("半自动识别");
 
-         //options.Add("手动识别");
 
-         options.Add(TextAutoLanguage2.GetTextByKey("AutoRecognition"));    // "自动识别"
 
-         options.Add(TextAutoLanguage2.GetTextByKey("SemiAutoRecognition")); // "半自动识别"
 
-         options.Add(TextAutoLanguage2.GetTextByKey("ManualRecognition"));   // "手动识别"
 
-         dropdown.AddOptions(options);
 
-         // 添加监听器来处理选择事件
 
-         dropdown.onValueChanged.AddListener((index) => {
 
-             OnDropdownValueChanged(index, screenQuads);
 
-         });
 
-         if (screenQuads[0] != null || screenQuads[1] != null) 
 
-         {
 
-             Texture texImage6 = ScreenLocate.Main.OutputTextures[5];
 
-             if (texImage6 != null) _cameraRenderTest6.texture = texImage6;
 
-         }
 
-         if (ScreenLocate.quadUnityVectorList.Count == 4) {
 
-             //绘制白色线段
 
-             var lo = new Vector2(-0.5f, -0.5f);
 
-             CurUILineGenerator.Points = new Vector2[4] {
 
-                 2 * (ScreenLocate.quadUnityVectorList[0] + lo),
 
-                 2 * (ScreenLocate.quadUnityVectorList[1] + lo),
 
-                 2 * (ScreenLocate.quadUnityVectorList[3] + lo),
 
-                 2 * (ScreenLocate.quadUnityVectorList[2] + lo) };
 
-         }
 
-     }
 
-     // 当下拉框选项更改时调用的方法
 
-     private void OnDropdownValueChanged(int index, QuadrilateralInCamera[] screenQuads)
 
-     {
 
-         if (index >= 0 && index < screenQuads.Length)
 
-         {
 
-             if (screenQuads[index] != null)
 
-             {
 
-                 QuadrilateralInCamera selectedQuad = screenQuads[index];
 
-                 Debug.Log($"Selected Quad {index + 1}: {selectedQuad}");
 
-                 CurUILineGenerator.Points = ConvertQuadToPoints(selectedQuad, ScreenLocate.Main.getUVCCameraInfoSize);
 
-             }
 
-             else
 
-             {
 
-                 Debug.LogWarning($"Selected Quad {index + 1} is null.");
 
-             }
 
-         }
 
-         else
 
-         {
 
-             Debug.LogWarning("所选索引超出范围!");
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// 提取转换四边形的方法
 
-     /// </summary>
 
-     /// <param name="quad"></param>
 
-     /// <param name="texSize"></param>
 
-     /// <returns></returns>
 
-     public Vector2[] ConvertQuadToPoints(QuadrilateralInCamera quad, Vector2 texSize)
 
-     {
 
-         if (quad == null || quad.Quad == null || quad.Quad.Count < 4)
 
-         {
 
-             Debug.LogWarning("Invalid quadrilateral data provided.");
 
-             return new Vector2[0]; // 返回空数组以避免异常
 
-         }
 
-         Vector2 offset = new Vector2(-0.5f, -0.5f); // 假设 'lo' 是某个已定义的偏移量
 
-         return new Vector2[4] {
 
-         2 * (new Vector2(quad.Quad[0].x / texSize.x, quad.Quad[0].y / texSize.y) + offset),
 
-         2 * (new Vector2(quad.Quad[1].x / texSize.x, quad.Quad[1].y / texSize.y) + offset),
 
-         2 * (new Vector2(quad.Quad[3].x / texSize.x, quad.Quad[3].y / texSize.y) + offset),
 
-         2 * (new Vector2(quad.Quad[2].x / texSize.x, quad.Quad[2].y / texSize.y) + offset)
 
-          };
 
-     }
 
-     public Vector2[] ConvertPointsToCoordinates(Vector2[] points, Vector2 texSize, Vector2 pivot)
 
-     {
 
-         if (points == null || points.Length < 1)
 
-         {
 
-             Debug.LogWarning("Invalid point data provided.");
 
-             return new Vector2[0]; // 返回空数组以避免异常
 
-         }
 
-         Vector2 offset = new Vector2(-0.5f, -0.5f); // 将坐标从中心对齐到左下角对齐
 
-         List<Vector2> transformedPoints = new List<Vector2>();
 
-         // 遍历所有传入的点进行转换
 
-         foreach (var point in points)
 
-         {
 
-             // 转换每个点,考虑 texSize 和 pivot 偏移
 
-             Vector2 transformedPoint = 2 * ((point / texSize) + offset + pivot);
 
-             transformedPoints.Add(transformedPoint);
 
-         }
 
-         return transformedPoints.ToArray();
 
-     }
 
-     void initToggle()
 
-     {
 
-         // 监听 Toggle 值的变化
 
-         if (curToggle != null)
 
-             curToggle.onValueChanged.AddListener(isOn => ToggleLineGenerator(CurUILineGenerator, isOn));
 
-         // 监听 Toggle 值的变化
 
-         if (autoToggle != null)
 
-             autoToggle.onValueChanged.AddListener(isOn => ToggleLineGenerator(AutoUILineGenerator, isOn));
 
-         if (semiAutoToggle != null)
 
-             semiAutoToggle.onValueChanged.AddListener(isOn => ToggleLineGenerator(SemiAutoUILineGenerator, isOn));
 
-         if (manualToggle != null)
 
-             manualToggle.onValueChanged.AddListener(isOn => ToggleLineGenerator(ManualUILineGenerator, isOn));
 
-     }
 
-     // 控制 LineGenerator 的启用/禁用
 
-     private void ToggleLineGenerator(LineGenerator lineGenerator, bool isOn)
 
-     {
 
-         if (lineGenerator != null && lineGenerator.enabled != isOn)
 
-         {
 
-             lineGenerator.enabled = isOn;
 
-             Debug.Log($"{lineGenerator.name} is now {(isOn ? "enabled" : "disabled")}");
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// 设置全部显示
 
-     /// </summary>
 
-     /// <param name="value"></param>
 
-     private void SetAllToggle(bool value) {
 
-         ToggleLineGenerator(CurUILineGenerator, value);
 
-         ToggleLineGenerator(AutoUILineGenerator, value);
 
-         ToggleLineGenerator(SemiAutoUILineGenerator, value);
 
-         ToggleLineGenerator(ManualUILineGenerator, value);
 
-     }
 
-     /// <summary>
 
-     /// 放大时候同步一次toggle
 
-     /// </summary>
 
-     private void SyncAllToggle()
 
-     {
 
-         ToggleLineGenerator(CurUILineGenerator, curToggle.isOn);
 
-         ToggleLineGenerator(AutoUILineGenerator, autoToggle.isOn);
 
-         ToggleLineGenerator(SemiAutoUILineGenerator, semiAutoToggle.isOn);
 
-         ToggleLineGenerator(ManualUILineGenerator, manualToggle.isOn);
 
-     }
 
-     // 下拉菜单用于显示纹理名称
 
-     public Dropdown textureDropdown;
 
-     // 按钮用于导出选中的纹理
 
-     public Button exportSelectedButton;
 
-     // 按钮用于导出所有纹理
 
-     public Button exportAllButton;
 
-     // 定义纹理名称
 
-     string[] textureNames;
 
-     /// <summary>
 
-     /// 更新一下菜单
 
-     /// </summary>
 
-     public void UpdateLanguage() {
 
-         string[] _textureNames = {
 
-             TextAutoLanguage2.GetTextByKey("ScreenAOriginal"), // "A屏幕原图"
 
-             TextAutoLanguage2.GetTextByKey("SemiAutoSegmentB"), // "B半自动识别线段"
 
-             TextAutoLanguage2.GetTextByKey("BlackWhiteContrastC"), // "C黑白色差"
 
-             TextAutoLanguage2.GetTextByKey("RecognitionResultD"), // "D识别结果"
 
-             TextAutoLanguage2.GetTextByKey("ColorContrastOverlayE"), // "E色差叠加识别结果"
 
-             TextAutoLanguage2.GetTextByKey("SemiAutoAlternativeF") // "F半自动备选线段"
 
-         };
 
-         textureNames = _textureNames;
 
-         // 设置下拉菜单的选项
 
-         textureDropdown.ClearOptions();
 
-         textureDropdown.AddOptions(new System.Collections.Generic.List<string>(textureNames));
 
-     }
 
-     void initExport() {
 
-         UpdateLanguage();
 
-         // 添加导出选中纹理的按钮点击事件
 
-         exportSelectedButton.onClick.AddListener(() => SaveTextureToLocal(textureDropdown.value));
 
-         // 添加导出所有纹理的按钮点击事件
 
-         exportAllButton.onClick.AddListener(SaveAllTexturesToLocal);
 
-     }
 
-     /// <summary>
 
-     /// 导出所有纹理
 
-     /// </summary>
 
-     public void SaveAllTexturesToLocal()
 
-     {
 
-         for (int i = 0; i < textureNames.Length; i++)
 
-         {
 
-             SaveTextureToLocal(i);  // 调用之前定义的保存方法
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// 导出图片
 
-     /// </summary>
 
-     /// <param name="index"></param>
 
-     public void SaveTextureToLocal(int index)
 
-     {
 
-         Texture2D[] outputTexture2D = ScreenLocate.Main.OutputTextures;
 
-         if (outputTexture2D == null || index >= outputTexture2D.Length || outputTexture2D[index] == null)
 
-         {
 
-             Debug.LogError("Invalid texture index or texture is null.index:"+ index);
 
-             return;
 
-         }
 
-         // 定义保存路径
 
-         string time = DateTime.Now.ToString("yyyyMMdd_HHmmss");
 
-         string baseName = $"{time}_Texture_{index}";
 
-         // 检查索引是否在命名数组内
 
-         string fileName = index < textureNames.Length ? textureNames[index] : $"Texture_{index}";
 
- #if UNITY_ANDROID && !UNITY_EDITOR_WIN
 
-         string path = System.IO.Path.Combine("/storage/emulated/0/Download", $"{baseName}_{fileName}.png"); //public
 
- #else
 
-         string path = System.IO.Path.Combine(Application.persistentDataPath, $"{baseName}_{fileName}.png");
 
- #endif
 
-         // 编码纹理为 PNG 格式
 
-         byte[] bytes = outputTexture2D[index].EncodeToPNG();
 
-         // 将字节写入文件
 
-         System.IO.File.WriteAllBytes(path, bytes);
 
-         Debug.Log($"Texture saved as: {path}");
 
-     }
 
-     //下面是处理对象放大缩小
 
-     public RectTransform cameraObj1; // 拖拽你的 CameraSize1 对象到此字段
 
-     public Button toggleButton;      // 缩小时使用的按钮
 
-     private Vector2 originalSize;
 
-     private Vector2 originalAnchoredPosition; // 使用 anchoredPosition 代替 localPosition
 
-     private Vector2 originalAnchorMin;
 
-     private Vector2 originalAnchorMax;
 
-     private int originalSiblingIndex; // 保存初始的层级索引
 
-     private bool isFullscreen = false;
 
-     /// <summary>
 
-     /// 测试效果屏幕数据初始化
 
-     /// </summary>
 
-     void InitFullScreen() {
 
-         if (cameraObj1 != null)
 
-         {
 
-             // 保存初始大小、位置和层级索引
 
-             originalSize = cameraObj1.sizeDelta;
 
-             originalAnchoredPosition = cameraObj1.anchoredPosition;
 
-             originalAnchorMin = cameraObj1.anchorMin; // 记录初始 anchorMin
 
-             originalAnchorMax = cameraObj1.anchorMax; // 记录初始 anchorMax
 
-             originalSiblingIndex = cameraObj1.GetSiblingIndex();
 
-             // 为 cameraObj1 添加点击事件
 
-             cameraObj1.GetComponent<Button>().onClick.AddListener(ToggleFullscreen);
 
-             toggleButton.transform.parent.gameObject.SetActive(false);
 
-         }
 
-         if (toggleButton != null)
 
-         {
 
-             // 为按钮添加点击事件以恢复大小
 
-             toggleButton.onClick.AddListener(RestoreSize);
 
-         }
 
-     }
 
-     void ToggleFullscreen()
 
-     {
 
-         if (cameraObj1 == null) return;
 
-         if (!isFullscreen)
 
-         {
 
-             // 设置锚点为全屏,调整位置和偏移量
 
-             cameraObj1.anchorMin = Vector2.zero;
 
-             cameraObj1.anchorMax = Vector2.one;
 
-             cameraObj1.offsetMin = Vector2.zero;
 
-             cameraObj1.offsetMax = Vector2.zero;
 
-             cameraObj1.anchoredPosition = Vector3.zero;
 
-             cameraObj1.SetSiblingIndex(cameraObj1.parent.childCount - 1); // 设置为最上层
 
-             //刷新一次点
 
-             SetLocatePointsToCameraRender(ScreenLocate.quadUnityVectorList, 1, 1);
 
-             toggleButton.transform.parent.gameObject.SetActive(true);
 
-             isFullscreen = true;
 
-             //放大情况根据toggle来显示
 
-             SyncAllToggle();
 
-         }
 
-     }
 
-     void RestoreSize()
 
-     {
 
-         if (cameraObj1 == null || !isFullscreen) return;
 
-         // 恢复锚点和偏移量
 
-         cameraObj1.anchorMin = originalAnchorMin; // 使用在 Start() 中记录的初始锚点
 
-         cameraObj1.anchorMax = originalAnchorMax; // 使用在 Start() 中记录的初始锚点
 
-         cameraObj1.sizeDelta = originalSize;
 
-         cameraObj1.anchoredPosition = originalAnchoredPosition; // 恢复为初始 anchoredPosition
 
-         cameraObj1.SetSiblingIndex(originalSiblingIndex); // 恢复到原本的层级索引
 
-         //刷新一次点
 
-         SetLocatePointsToCameraRender(ScreenLocate.quadUnityVectorList, 1, 1);
 
-         toggleButton.transform.parent.gameObject.SetActive(false);
 
-         isFullscreen = false;
 
-     }
 
- #endregion
 
-     public void SetLocatePointsToCameraRenderTest(List<Vector2> points, float w, float h)
 
-     {
 
-         Transform pointsTF2 = _cameraRender.transform.Find("PointsTest");
 
-         if (pointsTF2.childCount == points.Count)
 
-         {
 
-             Vector2 texSize = new Vector2(w, h);
 
-             for (int i = 0; i < pointsTF2.childCount; i++)
 
-             {
 
-                 Transform pointTF = pointsTF2.GetChild(i);
 
-                 Vector2 pos = points[i];
 
-                 pointTF.localPosition = pos.pixelToLocalPosition_AnchorCenter(texSize, _cameraRender.rectTransform.rect);
 
-                 pointTF.gameObject.SetActive(true);
 
-             }
 
-         }
 
-         else
 
-         {
 
-             for (int i = 0; i < pointsTF2.childCount; i++)
 
-             {
 
-                 Transform pointTF = pointsTF2.GetChild(i);
 
-                 pointTF.gameObject.SetActive(false);
 
-             }
 
-         }
 
-     }
 
-     void SetShakeFilterValue(float v)
 
-     {
 
-         shakeFilterValue.Set(v);
 
-         _sliderShakeFilter.SetValueWithoutNotify(shakeFilterValue.Get());
 
-         _sliderShakeFilter.transform.Find("Value").GetComponent<Text>().text = shakeFilterValue.Get().ToString("f1");
 
-         infraredCameraHelper.SetShakeFilterValue(shakeFilterValue.Get());
 
-     }
 
-     /// <summary>
 
-     /// 重新设置分辨率
 
-     /// </summary>
 
-     /// <param name="index"></param>
 
-     public void resolutionRestartApp(int index)
 
-     {
 
- #if UNITY_ANDROID
 
-         //StartCoroutine(RestartOrKillApp());
 
-         //获取第一个分辨率设置后设置size
 
-         switch (index)
 
-         {
 
-             case 0:
 
-                 infraredCameraHelper.SetHighCameraResolution();
 
-                 resoution.Set(index);
 
-                 _dropdownResolution2.SetValueWithoutNotify(index);
 
-                 break;
 
-             case 1:
 
-                 infraredCameraHelper.SetLowCameraResolution();
 
-                 resoution.Set(index);
 
-                 _dropdownResolution2.SetValueWithoutNotify(index);
 
-                 break;
 
-         }
 
- #endif
 
-     }
 
-     /// <summary>
 
-     /// 初始化时候,设置的值
 
-     /// </summary>
 
-     /// <param name="index"></param>
 
-     public Vector2 SetDefByIndex(int index = 0)
 
-     {
 
-         //SetResolutionNew 里面对应的下标
 
-         Vector2 vec2 = new Vector2(320, 240);
 
-         switch (index)
 
-         {
 
-             case 0:
 
-                 vec2 = new Vector2(320, 240);
 
-                 break;
 
-             case 1:
 
-                 vec2 = new Vector2(160, 120);
 
-                 break;
 
-         }
 
-         return vec2;
 
-     }
 
-     /// <summary>
 
-     /// 当 Dropdown 选择变化时的处理方法
 
-     /// </summary>
 
-     /// <param name="OnResolutionChanged">320x240</param>
 
-     private void OnResolutionChanged(int index)
 
-     {
 
- #if UNITY_ANDROID
 
-         Debug.Log("Selected Resolution: " + index);
 
-         // 将选定的分辨率转换为实际的宽度和高度
 
-         // 并且需要判断是否存在最低分辨率
 
-         if (index == 1 && currentCameraInfo.ContainsResulutionKey("160x120"))
 
-         {
 
-             // 在这里你可以根据实际需要设置屏幕分辨率或进行其他操作
 
-             infraredCameraHelper.SetLowCameraResolution();
 
-             // 保存选择的分辨率到 PlayerPrefs
 
-             resoution.Set(index);
 
-         }
 
-         else if(index == 0){
 
-             //如果是0就 使用高分辨率
 
-             infraredCameraHelper.SetHighCameraResolution();
 
-             // 保存选择的分辨率到 PlayerPrefs
 
-             resoution.Set(index);
 
-         }
 
- #endif
 
-     }
 
-     /// <summary>
 
-     /// 野鸭关卡测试初始值
 
-     /// </summary>
 
-     /// <param name="optionIndex"></param>
 
-     public void SetDuckLevelTest(int optionIndex)
 
-     {
 
-         //选择下标+1
 
-         int v = optionIndex + 1;
 
-         duckHunterLevel.Set(v);
 
-         int defLevel = (int)duckHunterLevel.Get() - 1 < 0 ? 0 : (int)duckHunterLevel.Get() - 1;
 
-         _duckLevelDropdown.SetValueWithoutNotify(defLevel);
 
-         //_duckLevelDropdown.transform.Find("Value").GetComponent<Text>().text = defLevel+"";
 
-     }
 
-     void OnClick_Reset()
 
-     {
 
-         //SetBrightness(1);
 
-         //SetSaturation(1);
 
-         //SetContrast(1);
 
-         SetShakeFilterValue(6);
 
-         SetLineWidth(4);
 
-         SetFanWidth(90);
 
-         SetInfraredFilterValue(0.8f);
 
-         SetCaptureValue(30.0f);
 
-         SetDelayValue(30.0f);
 
-         //重置为第一关
 
-         SetDuckLevelTest(0);
 
-     }
 
-     public void OnClickClearAll() {
 
-         PlayerPrefs.DeleteAll();
 
-         // 保存更改
 
-         PlayerPrefs.Save();
 
-         StartCoroutine(RestartOrKillApp());
 
-     }
 
-     void OnClick_ScreenLocateManual()
 
-     {
 
-         bool bEnter = true;
 
-         if (BluetoothAim.ins && BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess)
 
-         {
 
-             if (BluetoothAim.ins.isMainConnectToInfraredDevice() || BluetoothAim.ins.isMainConnectToGun())
 
-             {
 
-                 bEnter = true;
 
-             }
 
-             else
 
-             {
 
-                 bEnter = false;
 
-                 //只有红外设备才能进行屏幕识别
 
-                 PopupMgr.ins.ShowTipTop(TextAutoLanguage2.GetTextByKey("Connect_Tip_Infrared"));
 
-             }
 
-         }
 
-         if (bEnter)
 
-         {
 
-             ViewManager2.ShowView(ViewManager2.Path_InfraredScreenPositioningView);
 
-             FindObjectOfType<InfraredScreenPositioningView>().enterFromInfraredDemo = true;
 
-         }
 
-     }
 
-     void OnClick_ScreenLocateManualAuto()
 
-     {
 
-         bool bEnter = true;
 
-         if (BluetoothAim.ins && BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess)
 
-         {
 
-             if (BluetoothAim.ins.isMainConnectToInfraredDevice() || BluetoothAim.ins.isMainConnectToGun())
 
-             {
 
-                 bEnter = true;
 
-              
 
-             }
 
-             else
 
-             {
 
-                 bEnter = false;
 
-                 //只有红外设备才能进行屏幕识别
 
-                 PopupMgr.ins.ShowTipTop(TextAutoLanguage2.GetTextByKey("Connect_Tip_Infrared"));
 
-             }
 
-         }
 
-         if (bEnter) {
 
-             ResetCenterOffset();
 
-             ResetPositioningData();
 
-             infraredCameraHelper.EnterScreenLocateManualAuto();
 
-         }
 
-      
 
-     }
 
-    public void OnClick_SetAdjustPointsOffset()
 
-     {
 
-         var _sl = ScreenLocate.Main;
 
-         var buffer = _sl.infraredSpotBuffer;
 
-         if (buffer != null)
 
-         {
 
-             for (int i = 0; i < buffer.Length; i++)
 
-             {
 
-                 if (buffer[i].CameraLocation != null)
 
-                 {
 
-                     Debug.Log("CameraLocation:"+buffer[i].CameraLocation.Value);
 
-                     var centerOffset = infraredCameraHelper.GetCenterOffset(buffer[i].CameraLocation.Value, "CameraLocation");
 
-                     Debug.Log("CenterOffset: " + centerOffset);
 
-                     cameraLocationValue.Set(centerOffset);
 
-                     var uvCenterOffset  = infraredCameraHelper.GetCenterOffset(buffer[i].ScreenUV.Value, "ScreenUV");
 
-                     Debug.Log("UvCenterOffset: " + uvCenterOffset);
 
-                     screenUVValue.Set(uvCenterOffset);
 
-                     //如果是新手教程场景里面的校准
 
-                     InfraredGuider infraredGuiderObj = FindObjectOfType<InfraredGuider>();
 
-                     if (infraredGuiderObj != null)
 
-                     {
 
-                         GameObject infraredGuiderGameObject = infraredGuiderObj.gameObject;
 
-                         infraredGuiderGameObject.GetComponent<InfraredGuider>().SetTitleAfterCalibration();
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     /// <summary>
 
-     /// 设置存储的中心偏移位置
 
-     /// </summary>
 
-     public void InitCenterOffset() {
 
-         infraredCameraHelper.SetCenterOffset(cameraLocationValue.Get(), "CameraLocation");
 
-         infraredCameraHelper.SetCenterOffset(screenUVValue.Get(), "ScreenUV");
 
-     }
 
-     /// <summary>
 
-     /// 重置中心点
 
-     /// </summary>
 
-     public void ResetCenterOffset() {
 
-         infraredCameraHelper.ResetCenterOffset();
 
-     }
 
-     /// <summary>
 
-     /// 撤销中心点
 
-     /// </summary>
 
-     public void RevokeCenterOffset()
 
-     {
 
-         infraredCameraHelper.RevokeCenterOffset();
 
-     }
 
-     /// <summary>
 
-     /// 重置定位数据
 
-     /// </summary>
 
-     public void ResetPositioningData(bool bSyncLocal = false) {
 
-         infraredCameraHelper.ClearInfraredPositioningData(bSyncLocal);
 
-     }
 
-     void SetCaptureValue(float v)
 
-     {
 
-         captureValue.Set(v);
 
-         _sliderCapture.SetValueWithoutNotify(captureValue.Get());
 
-         _sliderCapture.transform.Find("Value").GetComponent<Text>().text = captureValue.Get().ToString("f1");
 
-         infraredCameraHelper.SetCapture((int)captureValue.Get());
 
-     }
 
-     void SetDelayValue(float v)
 
-     {
 
-         delayValue.Set(v);
 
-         _sliderDelay.SetValueWithoutNotify(delayValue.Get());
 
-         _sliderDelay.transform.Find("Value").GetComponent<Text>().text = delayValue.Get().ToString("f1");
 
-         infraredCameraHelper.SetDelay((int)delayValue.Get());
 
-     }
 
- #endregion
 
- #region 相机感光度(默认修改对比度)
 
-     public void onSetSliderCustomValue(Slider _slider, float min = 0.0f, float max = 10.0f)
 
-     {
 
-         onSetSliderValue(_slider, "PU_CONTRAST", min, max);
 
-     }
 
-     public void onSliderCustomEvent(float value, float min = 0.0f, float max = 10.0f)
 
-     {
 
-         onSliderEvent(value, "PU_CONTRAST", min, max);
 
-     }
 
-     public void onSetSliderCustomBrightnessValue(Slider _slider, float min = 0.0f, float max = 10.0f)
 
-     {
 
-         onSetSliderValue(_slider, "PU_BRIGHTNESS", min, max);
 
-     }
 
-     public void onSliderCustomBrightnessEvent(float value, float min = 0.0f, float max = 10.0f)
 
-     {
 
-         onSliderEvent(value, "PU_BRIGHTNESS", min, max);
 
-     }
 
-     public void onSetSliderValue(Slider _slider,string typeStr = "PU_CONTRAST", float min = 0.0f, float max = 10.0f)
 
-     {
 
-         if (BluetoothWindows.IsWindows()) {
 
-             float v = typeStr == "PU_CONTRAST"?infraredCameraHelper.GetContrast(): infraredCameraHelper.GetBrightness();
 
-             // 目标区间 [0, 10] 的边界值
 
-             double targetMin = min;
 
-             double targetMax = max;
 
-             double originalMin = -1;
 
-             double originalMax = 1;
 
-             // 计算转换后的值
 
-             double v2 = MapValue(v, originalMin, originalMax, targetMin, targetMax);
 
-             Debug.Log("PC获取相机的感光度 "+ typeStr + " :" + v + " = " + v2);
 
-             _slider.SetValueWithoutNotify((float)v2);
 
-             return;
 
-         }
 
-         //功能也改为UVC的对比度
 
-         if (running)
 
-         {
 
-             //string typeStr = "PU_CONTRAST";//"PU_BRIGHTNESS";
 
-             //UInt64 _VALUE = currentCameraInfo.GetTypeByName(typeStr);
 
-             UVCCtrlInfo _UVCCtrlInfo = currentCameraInfo.GetInfo(typeStr);
 
-             float v = currentCameraInfo.GetValue(typeStr); // infraredCameraHelper.GetBrightness();
 
-             //float v2 = (v / _UVCCtrlInfo.max) * 10;
 
-             // 目标区间 [0, 10] 的边界值
 
-             double targetMin = min;
 
-             double targetMax = max;
 
-             double originalMin = _UVCCtrlInfo.min;
 
-             double originalMax = _UVCCtrlInfo.max;
 
-             // 计算转换后的值
 
-             double v2 = MapValue(v, originalMin, originalMax, targetMin, targetMax);
 
-             Debug.Log("获取相机的感光度" + typeStr + ": " + v + " = " + v2);
 
-             _slider.SetValueWithoutNotify((float)v2);
 
-         }
 
-         else _slider.SetValueWithoutNotify(5);
 
-     }
 
-    
 
-     public void onSliderEvent(float value, string typeStr = "PU_CONTRAST", float min = 0.0f,float max = 10.0f)
 
-     {
 
-        // string typeStr = "PU_CONTRAST";// "PU_BRIGHTNESS";
 
-         //pc
 
-         if (BluetoothWindows.IsWindows())
 
-         {
 
-             Transform trans = _cameraParameterPanel.transform.Find(typeStr);
 
-             Slider slider = trans.GetComponent<Slider>();
 
-             Text textObj = trans.Find("text").GetComponent<Text>();
 
-             // 原始区间和目标区间的边界值
 
-             double originalMin = min;
 
-             double originalMax = max;
 
-             double targetMin = -1;
 
-             double targetMax = 1;
 
-             // 计算转换后的值
 
-             double result = MapValue(value, originalMin, originalMax, targetMin, targetMax);
 
-             float _current = (float)result;
 
-             //Debug.Log("_current:" + _current + " , result:" + result);
 
-             textObj.text = _current + "";
 
-             slider.value = _current;
 
-             if (typeStr == "PU_CONTRAST")
 
-             {
 
-                 infraredCameraHelper.SetContrast(_current);
 
-                 pcCONTRAST.Set(_current);
 
-             }
 
-             else {
 
-                 infraredCameraHelper.SetBrightness(_current);
 
-                 pcBRIGHTNESS.Set(_current);
 
-             }
 
-             return;
 
-         }
 
-         //修改亮度时,调试界面的亮度也应该一起修改
 
-         //功能也改为UVC的对比度
 
-         if (running)
 
-         {
 
-             //Slider slider = transform.Find("InfraredCamera/Layout/SliderBrightness")
 
-             //    .GetComponent<Slider>();
 
-            // UInt64 _VALUE = currentCameraInfo.GetTypeByName(typeStr);
 
-             Transform trans = _cameraParameterPanel.transform.Find(typeStr);
 
-             Slider slider = trans.GetComponent<Slider>();
 
-             Text textObj = trans.Find("text").GetComponent<Text>();
 
-             UVCCtrlInfo _UVCCtrlInfo = currentCameraInfo.GetInfo(typeStr);
 
-             int _currentUVCValue = currentCameraInfo.GetValue(typeStr);
 
-             //value 0 ~ 10
 
-             // 原始区间和目标区间的边界值
 
-             double originalMin = min;
 
-             double originalMax = max;
 
-             double targetMin = _UVCCtrlInfo.min;
 
-             double targetMax = _UVCCtrlInfo.max;
 
-             // 计算转换后的值
 
-             double result = MapValue(value, originalMin, originalMax, targetMin, targetMax);
 
-             int _current = (int)(result);
 
-             Debug.Log("_current:" + value + " , result:" + result);
 
-             textObj.text = _current + "";
 
-             slider.value = _current;
 
-             //dUVCParameters.GetValueOrDefault(typeStr).Set(_current);
 
-             //存储初始值,设置一次到UVC参数
 
-             if (_currentUVCValue != _current) currentCameraInfo.SetValue(typeStr, _current);
 
-         }
 
-     }
 
-     public static double MapValue(double value, double originalMin, double originalMax, double targetMin, double targetMax)
 
-     {
 
-         // 线性插值公式
 
-         return targetMin + (value - originalMin) * (targetMax - targetMin) / (originalMax - originalMin);
 
-     }
 
- #endregion
 
- #region 绘制线段部分
 
-     public void SetLineWidth(float v)
 
-     {
 
-         lineWidth.Set(v);
 
-         _sliderLineWidth.SetValueWithoutNotify(lineWidth.Get());
 
-         _sliderLineWidth.transform.Find("Value").GetComponent<Text>().text = lineWidth.Get().ToString("f1");
 
-     }
 
-     public void SetFanWidth(float v)
 
-     {
 
-         fanWidth.Set(v);
 
-         _fanWidth.SetValueWithoutNotify(fanWidth.Get());
 
-         _fanWidth.transform.Find("Value").GetComponent<Text>().text = fanWidth.Get().ToString("f1");
 
-     }
 
-     
 
- #endregion
 
- #region 亮度检测部分
 
-     public void SetInfraredFilterValue(float v)
 
-     {
 
-         infraredFileterValue.Set(v);
 
-         _infraredFilter.SetValueWithoutNotify(infraredFileterValue.Get());
 
-         _infraredFilter.transform.Find("Value").GetComponent<Text>().text = infraredFileterValue.Get().ToString("f1");
 
-         infraredCameraHelper.SetInfraredLocateBrightnessThreshold(infraredFileterValue.Get());
 
-     }
 
- #endregion
 
-     public void resetInfraredPlayerPrefs()
 
-     {
 
-         //测试用
 
-         PlayerPrefs.DeleteKey("entry-guider-infrared-" + LoginMgr.myUserInfo.id);
 
-         PlayerPrefs.DeleteKey("hideInfraredBowAndArrow");
 
-     }
 
- #region 显示Log部分信息
 
-     [SerializeField] Text _calibrationFixedText;
 
-     [SerializeField] Text _cameraSizeText;
 
-     [SerializeField] Text _quadUnityVectorListText;
 
-     /// <summary>
 
-     /// 校准时候的固定值分辨率
 
-     /// </summary>
 
-     /// <param name="v"></param>
 
-     public void SetCalibrationFixedText(Vector2 v)
 
-     {
 
-         _calibrationFixedText.text = v.x + "*" + v.y;
 
-     }
 
-     /// <summary>
 
-     /// 渲染摄像机当前分辨率
 
-     /// </summary>
 
-     /// <param name="v"></param>
 
-     public void SetCameraSizeText(Vector2 v)
 
-     {
 
-         _cameraSizeText.text = v.x + "*" + v.y;
 
-     }
 
-     /// <summary>
 
-     /// 渲染摄像机识别点
 
-     /// </summary>
 
-     /// <param name="v"></param>
 
-     public void SetQuadUnityVectorListText(string v)
 
-     {
 
-         _quadUnityVectorListText.text = v;
 
-     }
 
- #endregion
 
-     
 
-     #region 错误日志
 
-    public  void HandleLog(string logString, string stackTrace, LogType type)
 
-     {
 
-         if (type == LogType.Exception || type == LogType.Error)
 
-         {
 
-             SaveLogToFile(logString, stackTrace);
 
-         }
 
-     }
 
-     void SaveLogToFile(string message, string stackTrace)
 
-     {
 
-         string path;
 
- #if UNITY_ANDROID && !UNITY_EDITOR_WIN
 
-         // 保存到 Android 的公共 Download 文件夹,便于用户直接查看
 
-         path = System.IO.Path.Combine("/storage/emulated/0/Download", "crash_log.txt");
 
- #else
 
-         // 其他平台使用 Application.persistentDataPath
 
-         path = System.IO.Path.Combine(Application.persistentDataPath, "crash_log.txt");
 
- #endif
 
-         // 打印路径确认
 
-         Debug.Log($"Log file saved at: {path}");
 
-         // 将日志写入到指定路径的文件中
 
-         System.IO.File.AppendAllText(path, $"{message}\n{stackTrace}\n\n");
 
-     }
 
-     #endregion
 
- }
 
- public class ParamFloatValue
 
- {
 
-     private string _saveKey;
 
-     private float _valueDefault;
 
-     private bool _valueLoaded;
 
-     private float _value;
 
-     public ParamFloatValue(string saveKey, float valueDefault)
 
-     {
 
-         _saveKey = saveKey;
 
-         _valueDefault = valueDefault;
 
-     }
 
-     public float Get()
 
-     {
 
-         if (!_valueLoaded) _value = PlayerPrefs.GetFloat(_saveKey, _valueDefault);
 
-         return _value;
 
-     }
 
-     public float GetDefault() {
 
-         return _valueDefault;
 
-     }
 
-     public string GetKey()
 
-     {
 
-         return _saveKey;
 
-     }
 
-     public void Set(float value)
 
-     {
 
-         _value = value;
 
-         PlayerPrefs.SetFloat(_saveKey, _value);
 
-         PlayerPrefs.Save();
 
-     }
 
-     /// <summary>
 
-     /// 重置成默认值
 
-     /// </summary>
 
-     public void Reset() {
 
-         PlayerPrefs.SetFloat(_saveKey, _valueDefault);
 
-         PlayerPrefs.Save();
 
-     }
 
- }
 
- /// <summary>
 
- /// 存储Vector2
 
- /// </summary>
 
- public class ParamVector2Value
 
- {
 
-     private string _saveKey;
 
-     private Vector2 _valueDefault;
 
-     private bool _valueLoaded;
 
-     private Vector2 _value;
 
-     public ParamVector2Value(string saveKey, Vector2 valueDefault)
 
-     {
 
-         _saveKey = saveKey;
 
-         _valueDefault = valueDefault;
 
-     }
 
-     public Vector2 Get()
 
-     {
 
-         if (!_valueLoaded)
 
-         {
 
-             float x = PlayerPrefs.GetFloat(_saveKey + "_x", _valueDefault.x);
 
-             float y = PlayerPrefs.GetFloat(_saveKey + "_y", _valueDefault.y);
 
-             _value = new Vector2(x, y);
 
-             _valueLoaded = true;
 
-         }
 
-         return _value;
 
-     }
 
-     public Vector2 GetDefault()
 
-     {
 
-         return _valueDefault;
 
-     }
 
-     public string GetKey()
 
-     {
 
-         return _saveKey;
 
-     }
 
-     public void Set(Vector2 value)
 
-     {
 
-         _value = value;
 
-         PlayerPrefs.SetFloat(_saveKey + "_x", _value.x);
 
-         PlayerPrefs.SetFloat(_saveKey + "_y", _value.y);
 
-         PlayerPrefs.Save();
 
-     }
 
-     /// <summary>
 
-     /// 重置成默认值
 
-     /// </summary>
 
-     public void Reset()
 
-     {
 
-         PlayerPrefs.SetFloat(_saveKey + "_x", _valueDefault.x);
 
-         PlayerPrefs.SetFloat(_saveKey + "_y", _valueDefault.y);
 
-         PlayerPrefs.Save();
 
-     }
 
- }
 
 
  |