From 6fe1c5ebeb8312edc479a4576f05d80c5051a6c6 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 19 七月 2023 19:47:00 +0800
Subject: [PATCH] 炫彩功能优化

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |  139 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 120 insertions(+), 19 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 805c245..6da1d29 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -995,6 +995,7 @@
                 switch (outputTarget.target_type)
                 {
                     case "1":
+                    case "5":
                         {
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(outputTarget.sid);
@@ -1008,6 +1009,7 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
+                               
                                 case SPK.CommonSeries:
                                     targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
                                     stateStr = GetKeyValue("on_off", dicList) == "on" ? Language.StringByID(StringId.onLogic) : Language.StringByID(StringId.offLogic);
@@ -1049,29 +1051,14 @@
                                         }
                                     }
                                     break;
+                               
+                              
                                 case SPK.LightRGB:
                                 case SPK.LightRGBW:
                                 case SPK.LightCCT:
                                 case SPK.LightDimming:
                                     {
-                                        if(device.spk == SPK.LightRGB)
-                                        {
-                                            string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList);
-                                            if (!string.IsNullOrEmpty(colorful))
-                                            {
-                                                targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
-                                                if (colorful == "on")
-                                                {
-                                                    stateStr = Language.StringByID(StringId.onLogic);
-                                                }
-                                                else if (colorful == "off")
-                                                {
-                                                    stateStr = Language.StringByID(StringId.offLogic);
-                                                }
-
-                                                break;
-                                            }
-                                        }
+                                        
                                         string on_off = GetKeyValue("on_off", dicList);
                                         string brightness = GetKeyValue("brightness", dicList);
                                         if (on_off == "on" && brightness != "")
@@ -1119,7 +1106,61 @@
 
                                     }
                                     break;
-                               
+                                case SPK.GroupControl: //缇ゆ帶
+                                    {
+                                        targetView.btnIcon.UnSelectedImagePath = "FunctionIcon/Icon/groupControl.png";
+                                        string on_off = GetKeyValue("on_off", dicList);
+                                        string brightness = GetKeyValue("brightness", dicList);
+                                        string cct = GetKeyValue(FunctionAttributeKey.CCT, dicList);
+                                        string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList);
+                                        if (on_off == "on" && brightness != "")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic) + brightness + "%";
+                                        }
+                                        else if (on_off == "on")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else if (on_off == "off")
+                                        {
+                                            stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                        else if (brightness != "")
+                                        {
+                                            stateStr = brightness + "%";
+                                        }
+                                        //鑹叉俯杩欎釜灞炴�ф墠鏈夋晥
+                                        if (!string.IsNullOrEmpty(cct))
+                                        {
+                                            stateStr += "," + Language.StringByID(StringId.ColorTemperature) + cct + "k";
+                                        }
+
+                                        if (!string.IsNullOrEmpty(colorful))
+                                        {
+                                            stateStr += "," + Language.StringByID(StringId.ColorfulFunction);
+                                            if (colorful == "on")
+                                            {
+                                                stateStr += Language.StringByID(StringId.onLogic);
+                                            }
+                                            else if (colorful == "off")
+                                            {
+                                                stateStr += Language.StringByID(StringId.offLogic);
+                                            }
+
+                                            break;
+                                        }
+
+                                        string rgb = GetKeyValue("rgb", dicList);
+                                        if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6)
+                                        {
+                                            targetView.btnStateColor.Visible = true;
+                                            targetView.btnStateColor.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(rgb);
+                                        }
+
+
+                                    }
+                                    break;
+
                                 case SPK.CurtainSwitch:
                                     {
                                         foreach (var dic in dicList)
@@ -1689,6 +1730,66 @@
                         }
                     }
                     break;
+                case SPK.GroupControl://缇ゆ帶
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            switch (dic["key"])
+                            {
+                                case "on_off":
+                                case "colorful":
+                                    {
+                                        if (value == "on")
+                                        {
+                                            button1.Text = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else
+                                        {
+                                            button1.Text = Language.StringByID(StringId.offLogic);
+                                        }
+                                    }
+                                    break;
+                                case "brightness":
+                                    {
+                                        if (button1 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button1.Text = value + "%";
+                                    }
+                                    break;
+                                case "cct":
+                                    {
+                                        if (button1 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button1.Text = value + "k";
+                                    }
+                                    break;
+                                case "rgb":
+                                    {
+                                        if (button1 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        if (!string.IsNullOrEmpty(value) && value.Length > 6)
+                                        {
+                                            button1.BackgroundColor = new LogicView.RGBColorView().GetBackgroundColor(value);
+                                            button1.Tag = value;
+                                        }
+                                    }
+                                    break;
+
+                            }
+
+                        }
+                    }
+                    break;
                 case SPK.CurtainSwitch:
                     {
                         foreach (var dic in dicList)

--
Gitblit v1.8.0