From cd70a2a8a2bdebf51259d8f39ed110a34b9be9e5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 11 四月 2023 14:50:21 +0800
Subject: [PATCH] 修改启动屏幕

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs |  126 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 116 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 5a59137..cb55326 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -25,7 +25,13 @@
             sceneFunction = fc.localFunction.ConvertSceneFunction();
             foreach(var ll in sceneFunction.status)
             {
-                ll.value = fc.status.Find((obj) => obj.key == ll.key).value;
+                try
+                {
+                    var temp = fc.status.Find((obj) => obj.key == ll.key);
+                    if (temp != null)
+                        ll.value = temp.value;
+                }
+                catch { }
             }
             //sceneFunction = fc;
             refreshAction = action;
@@ -78,6 +84,9 @@
                         break;
                     case "angle"://瑙掑害
                         LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "angle"));
+                        break;
+                    case "security"://澶у崕鎽勫儚甯冮槻鎾ら槻
+                        LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "security"));
                         break;
                 }
             }
@@ -145,15 +154,6 @@
             btnConfrim.MouseUpEventHandler = (sender, e) =>
             {
                 var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid);
-                //if (sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness) != null)
-                //{
-                //    try
-                //    {
-                //        //涓�绔彛涓嶆敮鎸佸紑鍏冲�间笌浜害鍊间竴璧峰鐞嗭紝闇�瑕佸皢寮�鍏冲�肩Щ闄ゆ帀
-                //        sceneFunction.status.Remove(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff));
-                //    }
-                //    catch { }
-                //}
                 
                 if (temp != null)
                 {
@@ -332,6 +332,9 @@
             {
                 switch (sceneStatus.key)
                 {
+                    case FunctionAttributeKey.Security:
+                        LoadEditDialog_Security(sceneStatus, btnFunctionText);
+                        break;
                     case FunctionAttributeKey.OnOff:
                         LoadEditDialog_OnOff(sceneStatus, btnFunctionText);
                         break;
@@ -583,6 +586,109 @@
 
         }
 
+
+        /// <summary>
+        /// 鍔犺浇瀹夐槻甯冮槻閫夋嫨寮圭獥
+        /// </summary>
+        /// <param name="function"></param>
+        /// <param name="btn"></param>
+        void LoadEditDialog_Security(SceneFunctionStatus trait, Button btn)
+        {
+            Dialog dialog = new Dialog();
+
+            var pView = new FrameLayout()
+            {
+                BackgroundColor = CSS_Color.DialogTransparentColor1,
+            };
+            dialog.AddChidren(pView);
+
+            var optionBaseView = new FrameLayout()
+            {
+                Y = Application.GetRealHeight(500),
+                Height = Application.GetRealHeight(160),
+                AnimateSpeed = 0.3f,
+                Animate = Animate.DownToUp,
+            };
+            pView.AddChidren(optionBaseView);
+
+            var optionView = new VerticalScrolViewLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(100),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+                ScrollEnabled = false,
+            };
+            optionBaseView.AddChidren(optionView);
+
+            var btnOn = new Button()
+            {
+                Height = Application.GetRealHeight(50),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.TextualColor,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextID = StringId.Defense,
+                IsSelected = trait.value.ToString() == "true"
+            };
+            optionView.AddChidren(btnOn);
+
+            optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
+
+            var btnOff = new Button()
+            {
+                Height = Application.GetRealHeight(50),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.TextualColor,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                TextID = StringId.Undefense,
+                IsSelected = trait.value.ToString() == "false"
+            };
+            optionView.AddChidren(btnOff);
+
+            var btnCancel = new Button()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(8) + optionView.Bottom,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(50),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+                TextID = StringId.Cancel,
+                TextColor = CSS_Color.WarningColor,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+            };
+            optionBaseView.AddChidren(btnCancel);
+
+            dialog.Show();
+
+            pView.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+            };
+
+            btnCancel.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+            };
+            btnOn.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+                trait.value = "true";
+                sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "true";
+                btn.Text = trait.GetValueText() + trait.GetUintString();
+
+            };
+            btnOff.MouseUpEventHandler = (sender, e) => {
+                dialog.Close();
+                trait.value = "false";
+                sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "false";
+                btn.Text = trait.GetValueText() + trait.GetUintString();
+
+            };
+
+        }
+
+
         /// <summary>
         /// 鍔犺浇娓╁害閫夋嫨寮圭獥
         /// </summary>

--
Gitblit v1.8.0