From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:25:59 +0800 Subject: [PATCH] 2024年07月25日17:24:45 --- HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs | 130 +++++++++++++++++++++++++++++++++++++------ 1 files changed, 111 insertions(+), 19 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs index fdf6d44..bb89eec 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorfulSettingPage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -11,11 +12,17 @@ Action<uint> backAction; public uint curColor = 0; - - public ColorfulSettingPage(Action<uint> action) + bool isSatrtColor = false; + byte redColor = 0; + byte greenColor = 0; + byte blueColor = 0; + Function function; + public ColorfulSettingPage(Function device, Action<uint> action,bool isStart) { bodyView = this; + function = device; backAction = action; + isSatrtColor = isStart; } public void LoadPage(string curColorString) @@ -24,14 +31,12 @@ bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView(()=> { - backAction?.Invoke(curColor) ; }); - var contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64+34), - Height = Application.GetRealHeight(500), + Height = Application.GetRealHeight(570), ScrollEnabled = false, }; bodyView.AddChidren(contentView); @@ -97,7 +102,6 @@ #endregion - #region 鎺ㄨ崘 var recommendView = new FrameLayout() { @@ -154,7 +158,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - BackgroundColor = 0xFF00ab11, + BackgroundColor = 0xFFFEF267, Radius = (uint)Application.GetRealWidth(14), }; recommendColorView.AddChidren(btnRecommenColor3); @@ -166,7 +170,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - BackgroundColor = 0xFF28952e, + BackgroundColor = 0xFF73FD7B, Radius = (uint)Application.GetRealWidth(14), }; recommendColorView.AddChidren(btnRecommenColor4); @@ -177,7 +181,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - BackgroundColor = 0xFF45b7fd, + BackgroundColor = 0xFF45B7FD, Radius = (uint)Application.GetRealWidth(14), }; recommendColorView.AddChidren(btnRecommenColor5); @@ -189,7 +193,7 @@ Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - BackgroundColor = 0xFF794efc, + BackgroundColor = 0xFF5558fd, Radius = (uint)Application.GetRealWidth(14), }; recommendColorView.AddChidren(btnRecommenColor6); @@ -200,14 +204,13 @@ Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), - BackgroundColor = 0xFFFFFFFF, + BackgroundColor = 0xFF962eff, Radius = (uint)Application.GetRealWidth(14), }; recommendColorView.AddChidren(btnRecommenColor7); #endregion - #region 褰撳墠棰滆壊 var curColorView = new FrameLayout() @@ -308,11 +311,78 @@ #endregion + contentView.AddChidren(new Button() + { + Height = Application.GetRealHeight(12) + }); + if (isSatrtColor) + { + var btnSelectColorTip = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(35), + Width = Application.GetRealWidth(300), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 12, + TextColor = 0x21000000, + TextID = StringId.ColorfulSetTip,// = "鎻愮ず锛氳捣濮嬮鑹查�夋嫨瓒婇潬杩戣壊鐜竟缂橈紝鐐僵鏁堟灉瓒婃槑鏄俱�傝秺闈犺繎鐧借壊涓績锛岀偒褰╂晥鏋滆秺涓嶆槑鏄俱��", + IsMoreLines = true, + }; + contentView.AddChidren(btnSelectColorTip); + + contentView.AddChidren(new Button() + { + Height = Application.GetRealHeight(12) + }); + } + #region 淇濆瓨 + var btnConfrim = new Button() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(44), + Radius = (uint)Application.GetRealHeight(22), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + BackgroundColor = CSS_Color.MainColor, + TextID = StringId.Save, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + contentView.AddChidren(btnConfrim); + btnConfrim.MouseUpEventHandler = (sender, e) => + { + backAction?.Invoke(curColor) ; + var d = new System.Collections.Generic.Dictionary<string, string>(); + if (isSatrtColor) + { + d.Add(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor); + function.SetAttrState(FunctionAttributeKey.ColorfulBegin, redColor + "," + greenColor + "," + blueColor); + //var color = function.GetAttrState(FunctionAttributeKey.ColorfulEnd).Split(","); + //var sendColorString = color[0] + "," + color[1] + "," + color[2]; + //d.Add(FunctionAttributeKey.ColorfulEnd, sendColorString); + //d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); + } + else + { + //var color = function.GetAttrState(FunctionAttributeKey.ColorfulBegin).Split(","); + //var sendColorString = color[0] + "," + color[1] + "," + color[2]; + //d.Add(FunctionAttributeKey.ColorfulBegin, sendColorString); + //d.Add(FunctionAttributeKey.ColorfulTime, function.GetAttrState(FunctionAttributeKey.ColorfulTime)); + d.Add(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor); + function.SetAttrState(FunctionAttributeKey.ColorfulEnd, redColor + "," + greenColor + "," + blueColor); + } + //d.Add(FunctionAttributeKey.Colorful, "off"); + Control.Ins.SendWriteCommand(function, d); + this.RemoveFromParent(); + }; + + + #endregion colorPicker.ColorChaged += (sender2, color) => { - byte redColor = color[0]; - byte greenColor = color[1]; - byte blueColor = color[2]; + redColor = color[0]; + greenColor = color[1]; + blueColor = color[2]; int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor; @@ -322,30 +392,52 @@ btnRecommenColor1.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor1.BackgroundColor; etCurColorHexInfo.Text = "FC4645"; + redColor = 252; + greenColor = 70; + blueColor = 69; + }; btnRecommenColor2.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor2.BackgroundColor; etCurColorHexInfo.Text = "FD834D"; + redColor = 253; + greenColor = 131; + blueColor = 77; }; btnRecommenColor3.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor3.BackgroundColor; - etCurColorHexInfo.Text = "00AB11"; + etCurColorHexInfo.Text = "FEF267"; + redColor = 254; + greenColor = 242; + blueColor = 103; }; btnRecommenColor4.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor4.BackgroundColor; - etCurColorHexInfo.Text = "28952E"; + etCurColorHexInfo.Text = "73FD7B"; + redColor = 115; + greenColor = 253; + blueColor = 123; }; btnRecommenColor5.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor5.BackgroundColor; etCurColorHexInfo.Text = "45B7FD"; + redColor = 69; + greenColor = 183; + blueColor = 253; }; btnRecommenColor6.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor6.BackgroundColor; - etCurColorHexInfo.Text = "794EFC"; + etCurColorHexInfo.Text = "5558fd"; + redColor = 85; + greenColor = 88; + blueColor = 253; }; btnRecommenColor7.MouseUpEventHandler = (sender, e) => { curColor = btnCurColor.BackgroundColor = btnRecommenColor7.BackgroundColor; - etCurColorHexInfo.Text = "FFFFFF"; + etCurColorHexInfo.Text = "962eff"; + redColor = 150; + greenColor = 26; + blueColor = 255; }; } -- Gitblit v1.8.0