mac
2023-11-06 54c202bd4867092fca2bc6f96bec0cfd1056a46a
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -98,6 +98,7 @@
        public void LoadPage(Action backRefresh)
        {
             //DB_ResidenceData.Instance.sceneChooseRoomId
            new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh);
            initPage();
        }
@@ -432,11 +433,20 @@
                    var pack = pm.GetSceneInfo(scene.userSceneId);
                    if (pack.Code == StateCode.SUCCESS)
                    {
                        var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                        var tempScene = sceneList.Find((obj) => obj.userSceneId == scene.userSceneId);
                        if (tempScene != null)
                        if (pack.Data != null)
                        {
                            scene = tempScene;
                            var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                            if (sceneList != null)
                            {
                                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(() =>
                        {
@@ -478,6 +488,33 @@
                    scene.functions.Remove(scenefunction);
                    continue;
                }
                try
                {
                    //将spk实体里面的min 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++;
                var row = new RowLayout()
                {
@@ -567,7 +604,10 @@
                };
                btnFunctionName.MouseUpEventHandler = skipEvent;
                btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
                btnFunctionDelayInfo.MouseUpEventHandler = skipEvent;
                btnFunctionInfo.MouseUpEventHandler = skipEvent;
                btnRight.MouseUpEventHandler = skipEvent;
                row.MouseUpEventHandler = skipEvent;
                Button btnDelSceneFunction = new Button() {
                    BackgroundColor = CSS_Color.WarningColor,
@@ -839,6 +879,12 @@
            UploadImage(selectImagePath, addSceneImageView, scene, uploadSuccessAction);
        }
        public override void RemoveFromParent()
        {
            backAction();
            base.RemoveFromParent();
        }
        /// <summary>
        /// 完成按钮点击事件
        /// </summary>
@@ -868,7 +914,7 @@
                    }
                    scene.EditScene();
                    FunctionList.List.scenes.Add(scene);
                    backAction();
                    //backAction();
                    this.RemoveFromParent();
                }
                if (btnComplete.TextID == StringId.Del)
@@ -876,7 +922,7 @@
                    Action action = () =>
                    {
                        FunctionList.List.DeleteScene(scene,true);
                        backAction();
                        //backAction();
                        this.RemoveFromParent();
                    };
                    new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DeleteSceneTip, action);