mac
2023-11-06 54c202bd4867092fca2bc6f96bec0cfd1056a46a
HDL_ON/Entity/Function/Scene.cs
@@ -95,7 +95,7 @@
        /// <summary>
        /// 云端oss存储图片的路径
        /// </summary>
        public string image = "";
        public string image = "Intelligence/Gallery/scenebg1.png";
        ///// <summary>
        ///// 场景背景
@@ -112,6 +112,10 @@
                //{
                //    return image;
                //}
                if(image == "")
                {
                    image = "Intelligence/Gallery/scenebg1.png";
                }
                if (image.Contains("Intelligence/Gallery/scenebg"))
                {
@@ -119,15 +123,12 @@
                }
                else
                {
                    var sceneImageInfo = OssSceneImages.Find((obj) => obj.defaultIconName == image);
                    var sceneImageInfo = OssSceneImages.Find((obj) => obj.defaultIconUrl == image);
                    if (sceneImageInfo != null)
                    {
                        return sceneImageInfo.defaultIconName;
                        return sceneImageInfo.localUrl;
                    }
                    else
                    {
                        return "Intelligence/Gallery/scenebg1.png";
                    }
                    return image;
                }
            }
            set
@@ -150,56 +151,67 @@
        /// 配合豆豆修改云端数据
        /// 调试宝、on pro和平台对应
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public List<SceneImageInfo> OssSceneImages = new List<SceneImageInfo>()
        {
            new SceneImageInfo
            {
                defaultIconName = "scenebg1",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/781c397f-611a-48a2-a3ed-2520ffb971bb.png"
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/781c397f-611a-48a2-a3ed-2520ffb971bb.png",
                localUrl = "Intelligence/Gallery/scenebg1.png",
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg2",
                localUrl = "Intelligence/Gallery/scenebg2.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/be2a7c63-a6c0-427a-bb6d-f5c06f5b2f05.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg3",
                localUrl = "Intelligence/Gallery/scenebg3.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/5d801aca-03fb-4ef3-88ec-75ade3aa1c94.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg4",
                localUrl = "Intelligence/Gallery/scenebg4.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/a205306c-4fcd-4ea1-8e88-e84282dc0d54.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg5",
                localUrl = "Intelligence/Gallery/scenebg5.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/93a0acdc-14be-4776-a9fd-e0fc6f13c909.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg6",
                localUrl = "Intelligence/Gallery/scenebg6.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/45074923-2227-422a-be33-e37e6c3f9d23.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg7",
                localUrl = "Intelligence/Gallery/scenebg7.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/28b3e459-041e-4ea1-9ff9-57053c5357f4.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg8",
                localUrl = "Intelligence/Gallery/scenebg8.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/d470b979-cc06-4701-a2bd-7301856c9195.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg9",
                localUrl = "Intelligence/Gallery/scenebg9.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/1a130d03-86b2-4174-b986-6f6c312a959f.png"
            },
            new SceneImageInfo
            {
                defaultIconName = "scenebg10",
                localUrl = "Intelligence/Gallery/scenebg10.png",
                defaultIconUrl = "http://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2022/07/54c1c7ab-9b63-4487-a77d-d5d3dadd9801.png"
            }
        };
@@ -419,6 +431,7 @@
                {
                    var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
                    Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
                    return revPack.Code;
                }
                var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString());
                var tempScene = scenes.Find((obj) => obj.sid == sid);
@@ -549,6 +562,10 @@
        private Function ConvertFunctionObject()
        {
            var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid);
            if(localFunction == null)
            {
                localFunction = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
            }
            return localFunction;
        }
@@ -575,14 +592,19 @@
            var modeState = status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
            var tempState = status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
            var fanState = status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
            ////海信电视状态
            //var hisenseTvState = status.Find((obj) => obj.key == "wol");
            //if(hisenseTvState != null)
            //{
            //}
            if (modeState != null)
            {
                sceneFunctionInfo += modeState.GetValueText() + " ";
            }
            if (tempState != null)
            {
                sceneFunctionInfo += tempState.GetValueText() + " ";
                sceneFunctionInfo += tempState.GetUintString();
                sceneFunctionInfo += tempState.GetValueText();
                sceneFunctionInfo += tempState.GetUintString() + " ";
            }
            if (fanState != null)
            {
@@ -613,12 +635,43 @@
            var perAngle = status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
            if (perAngle != null)
            {
                sceneFunctionInfo += " " + perState.value + "°";
                sceneFunctionInfo += " " + perAngle.value + "°";
            }
            var perSetVolume = status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
            if (perSetVolume != null)
            {
                sceneFunctionInfo += " " + perSetVolume.value;
            }
            var perSignal = status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
            if (perSignal != null)
            {
                var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
                string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
                sceneFunctionInfo += " " + key;
            }
            var perVolume =status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
            if (perVolume != null)
            {
                sceneFunctionInfo += " " + perVolume.value;
            }
            var perSongName =status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
            if (perSongName != null)
            {
                sceneFunctionInfo += " " + perSongName.value;
            }
            return sceneFunctionInfo;
        }
        /// <summary>
        /// 设备
        /// 场景 =scene
        /// 群控=5
        /// </summary>
        public string type = "0";
    }
    /// <summary>
@@ -652,7 +705,7 @@
                    text = Language.StringByID(StringId.Brightness);
                    break;
                case FunctionAttributeKey.RGB:
                    text = Language.StringByID(StringId.ColorValue);
                    text = "RGB";// Language.StringByID(StringId.ColorValue);
                    break;
                case FunctionAttributeKey.Mode:
                    text = Language.StringByID(StringId.Mode);
@@ -681,22 +734,38 @@
                case "angle":
                    text = Language.StringByID(StringId.Angle);
                    break;
                case "security":
                    text = Language.StringByID(StringId.DeploymentStatus);
                    break;
                case FunctionAttributeKey.SetVolume:
                    text = Language.StringByID(StringId.yinliang);
                    break;
                case FunctionAttributeKey.Signal:
                    text = Language.StringByID(StringId.xinhaoyuan);
                    break;
                case FunctionAttributeKey.Volume:
                    text = Language.StringByID(StringId.yinliang);
                    break;
                case FunctionAttributeKey.SongName:
                    text = Language.StringByID(StringId.tishiyin);
                    break;
            }
            return text;
        }
        public string UintString = "";
        /// <summary>
        /// 属性值单位
        /// </summary>
        public string GetUintString(string inputKey = "")
        public string GetUintString()
        {
            if (!string.IsNullOrEmpty(UintString) && UintString != "{}")
            {
                return UintString;
            }
            var us = "";
            var swithchString = key;
            if (!string.IsNullOrEmpty(inputKey))
            {
                swithchString = inputKey;
            }
            switch (swithchString)
            {
                case FunctionAttributeKey.SetTemp:
@@ -732,13 +801,18 @@
            string text = "";
            switch (key)
            {
                case FunctionAttributeKey.Security:
                    text = catchString == "true" ? Language.StringByID(StringId.Defense) : Language.StringByID(StringId.Undefense);
                    break;
                case FunctionAttributeKey.OnOff:
                case FunctionAttributeKey.Colorful:
                    text = catchString == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF);
                    break;
                case FunctionAttributeKey.SetTemp:
                case FunctionAttributeKey.RoomTemp:
                case FunctionAttributeKey.Brightness:
                case FunctionAttributeKey.Percent:
                case FunctionAttributeKey.CCT:
                case FunctionAttributeKey.Angle:
                    int outT = 0;
                    int.TryParse(catchString, out outT);
@@ -820,6 +894,20 @@
                case "auto":
                    text = Language.StringByID(StringId.Auto);
                    break;
                case FunctionAttributeKey.Signal:
                    var p = new UI.UI2.Intelligence.Automation.PublicInterface();
                    var dic = p.GetHisenseSignalSourceDic();
                    text = p.GetKey(dic, value);
                    break;
                case FunctionAttributeKey.SetVolume:
                    text = value;
                    break;
                case FunctionAttributeKey.Volume:
                    text = value;
                    break;
                case FunctionAttributeKey.SongName:
                    text = value;
                    break;
            }
            return text;
        }
@@ -865,6 +953,7 @@
    {
        public string defaultIconName;
        public string defaultIconUrl;
        public string localUrl;
    }