浏览代码

修改InfraredDemo,添加识别图像和导出图片功能

slambb 11 月之前
父节点
当前提交
e01788290a

+ 394 - 27
Assets/BowArrow/InfraredCamera/InfraredDemo.cs

@@ -10,7 +10,7 @@ using System;
 using SmartBowSDK;
 using ZIM.Unity;
 
-public class InfraredDemo  : JCUnityLib.ViewBase
+public class InfraredDemo : JCUnityLib.ViewBase
 {
     public static bool DebugInEditor = true;
     public static InfraredDemo _ins;
@@ -61,11 +61,14 @@ public class InfraredDemo  : JCUnityLib.ViewBase
             mBtnSee.interactable = false;
             mBtnSee.transform.Find("Text").GetComponent<Text>().text = "等待初始化..";
         }
-   
+
         //直接初始化一次
         //InitInfraredCamera();
 
         Debug.Log("[InfraredDemo] Start Function!");
+        initToggle();
+        initExport();
+        InitFullScreen();
 
 #if UNITY_STANDALONE_WIN 
         _calibrationFixedText.transform.parent.gameObject.SetActive(false);
@@ -76,14 +79,14 @@ public class InfraredDemo  : JCUnityLib.ViewBase
     void Update()
     {
         UpdateInfraredCamera();
-       //UpdateDebugScreenPoint();
+        //UpdateDebugScreenPoint();
     }
 
     public void OnClick_See()
     {
         SetVisiable(!_visiable);
     }
-   
+
     //初始化一次 initScreenLocateManual
     bool hasCalled = false;
 
@@ -201,9 +204,9 @@ public class InfraredDemo  : JCUnityLib.ViewBase
     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 crosshairValue = new ParamFloatValue("ic_crosshairValue", 1);
 
     //野鸭测试存储
     public ParamFloatValue duckHunterLevel = new ParamFloatValue("test_duckHunterLevelValue", 1);
@@ -263,7 +266,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         for (int i = 0; i < sliderStrArray.Length; i++)
         {
             string typeStr = sliderStrArray[i];
-           // UInt64 _VALUE = cameraInfo.GetTypeByName(typeStr);
+            // UInt64 _VALUE = cameraInfo.GetTypeByName(typeStr);
             //不支持的,跳过
             bool bContains = cameraInfo.ContainsKey(typeStr);
             if (!bContains) continue;
@@ -353,14 +356,14 @@ public class InfraredDemo  : JCUnityLib.ViewBase
                         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);
@@ -405,7 +408,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         for (int i = 0; i < sliderStrArray.Length; i++)
         {
             string typeStr = sliderStrArray[i];
-           // UInt64 _VALUE = currentCameraInfo.GetTypeByName(typeStr);
+            // UInt64 _VALUE = currentCameraInfo.GetTypeByName(typeStr);
             bool bContains = currentCameraInfo.ContainsKey(typeStr);
             if (!bContains) continue;
 
@@ -462,7 +465,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
 
     //windows 相机
     string[] sliderNameArrayPC = new string[]{
-        "亮度", 
+        "亮度",
         "对比度",};
     string[] sliderStrArrayPC = new string[]{
         "PU_BRIGHTNESS",
@@ -520,7 +523,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
                         pcCONTRAST.Set(_value);
                     });
                 }
-               
+
             }
 
         }
@@ -551,7 +554,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         }
     }
 
-   #endregion
+    #endregion
     void InitInfraredCamera()
     {
         if (_inited) return;
@@ -589,7 +592,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
                 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);
+                if (GeneratingTarget.gm != null) GeneratingTarget.gm.shootingEvent.OnPositionUpdate(point);
             };
             infraredCameraHelper.OnUVCIsReady += (UVCManager.CameraInfo camera) =>
             {
@@ -600,7 +603,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
                 mBtnSee.transform.Find("Text").GetComponent<Text>().text = "调试红外";
                 //延迟重新设置一次分辨率
                 StartCoroutine(delayInitOhterInfo(camera));
-               
+
             };
 
             //屏幕变化时候
@@ -640,7 +643,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         _dropdownResolution2.value = index;
         _dropdownResolution2.RefreshShownValue();
         // 处理 Dropdown 的选择变化
-        _dropdownResolution2.onValueChanged.AddListener(index => { OnResolutionChanged(index);});
+        _dropdownResolution2.onValueChanged.AddListener(index => { OnResolutionChanged(index); });
 #endif
 
 #if UNITY_STANDALONE_WIN || UNITY_EDITOR
@@ -649,7 +652,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         _btnAdjusting.transform.Find("Text").GetComponent<Text>().text = "调整PC参数";
         _dropdownResolution.gameObject.SetActive(false);
         _dropdownResolution2.gameObject.SetActive(false);
-    
+
 #endif
 
         //震动阈值
@@ -666,7 +669,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         SetDelayValue(delayValue.Get());
         _sliderDelay.onValueChanged.AddListener(SetDelayValue);
 
-       
+
 
         //绘制线段
         SetLineWidth(lineWidth.Get());
@@ -689,7 +692,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
     /// </summary>
     /// <returns></returns>
     public bool bInitCrosshairShow() {
-       return UserSettings.ins.openCrossHair && getCrosshairValue() == 1 ? true : false;
+        return UserSettings.ins.openCrossHair && getCrosshairValue() == 1 ? true : false;
     }
 
     /// <summary>
@@ -697,11 +700,11 @@ public class InfraredDemo  : JCUnityLib.ViewBase
     /// </summary>
     /// <returns></returns>
     public int getCrosshairValue() {
-       return (int)crosshairValue.Get();
+        return (int)crosshairValue.Get();
     }
 
     public void setCrosshairValue(bool bshow) {
-        crosshairValue.Set(bshow?1:0);
+        crosshairValue.Set(bshow ? 1 : 0);
     }
 
     public void onStartPreview()
@@ -770,8 +773,35 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         //_cameraRender.material = infraredCameraHelper.GetCameraMaterial();
         if (ScreenLocate.Main.getUVCTexture)
         {
-            if(_cameraRender.texture ==null || ScreenLocate.Main.getUVCTexture.GetNativeTexturePtr() != _cameraRender.texture.GetNativeTexturePtr())
-               _cameraRender.texture = 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();
         }
@@ -801,13 +831,14 @@ public class InfraredDemo  : JCUnityLib.ViewBase
             //渲染固定摄像机分辨率
             SetCalibrationFixedText(_sl.mUVCCameraInfo.CurrentCalibrationResolution);
             //渲染摄像机大小
-            if(_sl.mUVCCameraInfo != null) SetCameraSizeText(_sl.mUVCCameraInfo.Size);
+            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");
@@ -821,6 +852,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
                 Vector2 pos = points[i];
                 pointTF.localPosition = pos.pixelToLocalPosition_AnchorCenter(texSize, _cameraRender.rectTransform.rect);
                 pointTF.gameObject.SetActive(true);
+                showPoints = true;
             }
         }
         else {
@@ -828,10 +860,345 @@ public class InfraredDemo  : JCUnityLib.ViewBase
             {
                 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("手动识别");
+        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("所选索引超出范围!");
+        }
+    }
+
+    // 提取转换四边形的方法
+    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)
+         };
+    }
+
+    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 = {
+            "A屏幕原图",
+            "B半自动识别线段",
+            "C黑白色差",
+            "D识别结果",
+            "E色差叠加识别结果",
+            "F半自动备选线段"
+        };
+    void initExport() {
+     
+        // 设置下拉菜单的选项
+        textureDropdown.ClearOptions();
+        textureDropdown.AddOptions(new System.Collections.Generic.List<string>(textureNames));
+
+        // 添加导出选中纹理的按钮点击事件
+        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");
@@ -1035,10 +1402,10 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         _sliderDelay.transform.Find("Value").GetComponent<Text>().text = delayValue.Get().ToString("f1");
         infraredCameraHelper.SetDelay((int)delayValue.Get());
     }
-    #endregion
+#endregion
 
 
-    #region 相机感光度(默认修改对比度)
+#region 相机感光度(默认修改对比度)
     public void onSetSliderCustomValue(Slider _slider, float min = 0.0f, float max = 10.0f)
     {
         onSetSliderValue(_slider, "PU_CONTRAST", min, max);
@@ -1225,7 +1592,7 @@ public class InfraredDemo  : JCUnityLib.ViewBase
     {
         _quadUnityVectorListText.text = v;
     }
-    #endregion
+#endregion
 
 }
 public class ParamFloatValue

文件差异内容过多而无法显示
+ 699 - 162
Assets/BowArrow/InfraredCamera/Resources/InfraredDemo.prefab


+ 1 - 1
Assets/BowArrow/Scripts/CommonConfig.cs

@@ -135,7 +135,7 @@ public class CommonConfig
     public static bool bInfraredApp { get; } = true;
 
     //打包App 的端,比如打包B 端就设置 B
-    public static OperatingPlatform OP { get; } = OperatingPlatform.A;
+    public static OperatingPlatform OP { get; } = OperatingPlatform.C;
 
     //是否是投币功能
     public static bool bSupportCoin { get; } = false; 

+ 1 - 1
Assets/BowArrow/Scripts/Manager/AudioMgr.cs

@@ -117,7 +117,7 @@ public class AudioMgr : MonoBehaviour
         if (name == "rabbit_injured") {
             name = "rabbit_injured2";
             audioSource.volume = 1;
-            Debug.Log("兔子音效 Volume =" + audioSource.volume);
+            //Debug.Log("兔子音效 Volume =" + audioSource.volume);
         }
         this.Play("Audios/Animal/" + name, audioSource);
     }

+ 33 - 4
Assets/SmartBow/Resources/SmartBow/Prefabs/ZIM/LineGenerator.cs

@@ -12,6 +12,12 @@ namespace ZIM
         [Tooltip("线段的粗细")]
         public float LineThickness = 2f;
         public bool Loop;
+        [Tooltip("是否绘制为虚线")]
+        public bool IsDashed = false;
+        [Tooltip("虚线每段的长度")]
+        public float DashLength = 10f;
+        [Tooltip("虚线每段的间隔")]
+        public float GapLength = 5f;
 
         [SerializeField]
         private Vector2[] _points;
@@ -49,7 +55,15 @@ namespace ZIM
                 start = new Vector2(start.x * width - pivotX, start.y * height - pivotY);
                 end = new Vector2(end.x * width - pivotX, end.y * height - pivotY);
 
-                DrawLine(vh, start, end, LineThickness);
+                // DrawLine(vh, start, end, LineThickness);
+                if (IsDashed)
+                {
+                    DrawDashedLine(vh, start, end, LineThickness, DashLength, GapLength);
+                }
+                else
+                {
+                    DrawLine(vh, start, end, LineThickness);
+                }
             }
         }
 
@@ -69,11 +83,26 @@ namespace ZIM
 
             vh.AddUIVertexQuad(verts);
         }
-
-        void Update()
+        private void DrawDashedLine(VertexHelper vh, Vector2 start, Vector2 end, float thickness, float dashLength, float gapLength)
         {
-            //SetVerticesDirty();
+            float totalLength = Vector2.Distance(start, end);
+            Vector2 direction = (end - start).normalized;
+            float drawnLength = 0;
+
+            while (drawnLength < totalLength)
+            {
+                float currentDashLength = Mathf.Min(dashLength, totalLength - drawnLength);
+                Vector2 segmentStart = start + direction * drawnLength;
+                Vector2 segmentEnd = segmentStart + direction * currentDashLength;
+
+                DrawLine(vh, segmentStart, segmentEnd, thickness);
+                drawnLength += currentDashLength + gapLength;
+            }
         }
+        //void Update()
+        //{
+        //    //SetVerticesDirty();
+        //}
 
     }
 }

部分文件因为文件数量过多而无法显示