From 54c202bd4867092fca2bc6f96bec0cfd1056a46a Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 06 十一月 2023 11:24:20 +0800
Subject: [PATCH] 2023年11月06日11:23:46

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs |   45 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
index a85c1ea..4373932 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -436,13 +436,16 @@
                         if (pack.Data != null)
                         {
                             var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
-                            var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId);
-                            if (tempScene != null)
+                            if (sceneList != null)
                             {
-                                scene.name = tempScene.name;
-                                scene.delay = tempScene.delay;
-                                scene.roomIds = tempScene.roomIds;
-                                scene.functions = tempScene.functions;
+                                var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId);
+                                if (tempScene != null)
+                                {
+                                    scene.name = tempScene.name;
+                                    scene.delay = tempScene.delay;
+                                    scene.roomIds = tempScene.roomIds;
+                                    scene.functions = tempScene.functions;
+                                }
                             }
                         }
                         Application.RunOnMainThread(() =>
@@ -485,11 +488,31 @@
                     scene.functions.Remove(scenefunction);
                     continue;
                 }
-                //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45
-                foreach (var tt in scenefunction.status) {
-                    tt.min = scenefunction.localFunction.GetAttribute(tt.key).min;
-                    tt.max = scenefunction.localFunction.GetAttribute(tt.key).max;
-                    tt.valueList = scenefunction.localFunction.GetAttribute(tt.key).value;
+                try
+                {
+                    //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45
+                    foreach (var tt in scenefunction.status)
+                    {
+                        var attr = scenefunction.localFunction.GetAttribute(tt.key);
+                        if(attr == null)
+                        {
+                            continue;
+                        }
+                        tt.min = attr.min;
+                        tt.max = attr.max;
+                        tt.valueList = attr.value;
+                        if(tt.key == FunctionAttributeKey.SetTemp)
+                        {
+                            var tempType = scenefunction.localFunction.GetAttribute(FunctionAttributeKey.TempType);
+                            if(tempType != null)
+                            {
+                                tt.UintString = tempType.unit;
+                            }
+                        }
+                    }
+                }catch(Exception ex)
+                {
+                    MainPage.Log($"鍦烘櫙鍔犺浇鍔熻兘鍒楄〃寮傚父:{ex.Message}");
                 }
 
                 i++;

--
Gitblit v1.8.0