From 175ace9b4dd6a166285ef8de777c412776cee467 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期一, 31 七月 2023 18:15:54 +0800 Subject: [PATCH] 2023年07月31日18:15:47 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs | 52 ++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs | 175 ++++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs | 163 ++++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs | 89 ++++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs | 196 +++++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs | 220 +++++++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs | 179 ++++++++ HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs | 17 HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs | 40 ++ HDL_ON/HDL_ON.projitems | 9 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 7 11 files changed, 1,135 insertions(+), 12 deletions(-) diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index f665f1e..f7086ec 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -565,6 +565,14 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\AksListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\AksCommonMethod.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\AksPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\ButtonFramLayout.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\CornerFramLayout.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\AksMusicPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\BaseFramLayout.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\MenuFramLayout.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\TypeSingleFramLayout.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\TypeMultiFramLayout.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\PayerFramLayout.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> @@ -595,5 +603,6 @@ <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\Face\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\CombinedDimming\" /> <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\" /> + <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Aks\CommonView\" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs index 26c55dc..5508c06 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs @@ -724,6 +724,13 @@ volView.btnText.TextID = StringId.volumeMusic; fLayout.AddChidren(volView.FLayoutView()); + //if (SPK.AvMusic == device.spk) + //{ + // //涓嶆敮鎸佺壒娈婅闊� + // volView.frameLayout.Y = Application.GetRealHeight(0); + //} + + ///璁惧寤舵椂iewv DelayView(fLayout, volView.frameLayout.Bottom); #endregion diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs new file mode 100644 index 0000000..a13003f --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksMusicPage.cs @@ -0,0 +1,220 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView; +using Shared; + +namespace HDL_ON.UI.UI2.FuntionControlView.Aks +{ + public class AksMusicPage : BaseFramLayout + { + public AksMusicPage() + { + } + + public void Show() + { + this.BackgroundColor = MusicColor.ViewColor; + Button btnTitle = new Button + { + Y = Application.GetRealHeight(16), + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(200), + TextAlignment = TextAlignment.CenterLeft, + TextColor = MusicColor.TextColor, + TextSize = TextSize.Text16, + TextID = StringId.bofangqi, + }; + this.AddChidren(btnTitle); + + CornerFramLayout cornerFram = new CornerFramLayout(343, 452); + cornerFram.X = Application.GetRealWidth(16); + cornerFram.Y = btnTitle.Bottom + Application.GetRealHeight(16); + this.AddChidren(cornerFram); + cornerFram.SetList(cornerFram.GetTestList(17)); + cornerFram.SetMargin(16, 0, 16, 0); + cornerFram.LoadButtonPage(4, (value) => + { + + }); + + FrameLayout payerFramLayout = new FrameLayout(); + payerFramLayout.Width = Application.GetRealWidth(343); + payerFramLayout.Height = Application.GetRealHeight(364); + payerFramLayout.Y = cornerFram.Bottom + Application.GetRealHeight(16); + payerFramLayout.X = Application.GetRealWidth(16); + payerFramLayout.BackgroundColor = MusicColor.WhiteColor; + payerFramLayout.Radius = (uint)Application.GetRealHeight(17); + this.AddChidren(payerFramLayout); + + + FrameLayout singleFramLayout = new FrameLayout + { + BackgroundColor = MusicColor.ViewColor, + Y = Application.GetRealHeight(24), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(101), + Height = Application.GetRealHeight(40), + Radius = (uint)Application.GetRealHeight(20), + }; + payerFramLayout.AddChidren(singleFramLayout); + + Button btnLeftImage = new Button + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/yingku.png", + Gravity = Gravity.CenterVertical, + Name = "btnLeftImage", + }; + singleFramLayout.AddChidren(btnLeftImage); + Button btnName = new Button + { + X = btnLeftImage.Right + Application.GetRealWidth(4), + Width = Application.GetRealWidth(32), + Height = Application.GetRealHeight(23), + TextID = StringId.yingku, + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterVertical, + IsMoreLines = true, + Name = "btnName", + }; + singleFramLayout.AddChidren(btnName); + Button btnRightImage = new Button + { + X = btnName.Right + Application.GetRealWidth(8), + Width = Application.GetRealWidth(5), + Height = Application.GetRealWidth(8), + UnSelectedImagePath = "AksIcon/yingkunext.png", + Gravity = Gravity.CenterVertical, + Name = "btnRightImage", + }; + singleFramLayout.AddChidren(btnRightImage); + + + MenuFramLayout menuFram = new MenuFramLayout + { + Y = singleFramLayout.Bottom + Application.GetRealHeight(32), + Gravity = Gravity.CenterHorizontal, + }; + menuFram.AddView(payerFramLayout); + + + FrameLayout multiFramLayout = new FrameLayout + { + BackgroundColor = MusicColor.ViewColor, + X=Application.GetRealWidth(16), + Y = menuFram.Bottom+Application.GetRealHeight(32), + Width = Application.GetRealWidth(311), + Height = Application.GetRealHeight(40), + Radius = (uint)Application.GetRealHeight(20), + }; + payerFramLayout.AddChidren(multiFramLayout); + + + FrameLayout leftFramLayout = new FrameLayout + { + X = Application.GetRealWidth(16), + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(139), + Height = Application.GetRealHeight(23), + Radius = (uint)Application.GetRealHeight(20), + + }; + multiFramLayout.AddChidren(leftFramLayout); + + Button btnBottonLeftImage = new Button + { + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/shixuqi.png", + Gravity = Gravity.CenterVertical, + Name = "btnBottonLeftImage", + }; + leftFramLayout.AddChidren(btnBottonLeftImage); + Button btnBottonName = new Button + { + X = btnBottonLeftImage.Right + Application.GetRealWidth(4), + Width = Application.GetRealWidth(100), + Height = Application.GetRealHeight(23), + TextID = StringId.shixuqi, + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.CenterLeft, + Gravity = Gravity.CenterVertical, + IsMoreLines = true, + Name = "btnName", + }; + leftFramLayout.AddChidren(btnBottonName); + + + FrameLayout lineFramLayout = new FrameLayout + { + BackgroundColor = MusicColor.TextColor, + X = leftFramLayout.Right, + Y =Application.GetRealHeight(10), + Width = Application.GetRealWidth(1), + Height = Application.GetRealHeight(20), + }; + multiFramLayout.AddChidren(lineFramLayout); + + + FrameLayout rightFramLayout = new FrameLayout + { + X =lineFramLayout.Right, + Gravity = Gravity.CenterVertical, + Width = Application.GetRealWidth(138), + Height = Application.GetRealHeight(23), + + }; + multiFramLayout.AddChidren(rightFramLayout); + + Button btnBottonRightImage = new Button + { + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/xuanze.png", + Gravity = Gravity.CenterRight, + Name = "btnBottonLeftImage", + }; + rightFramLayout.AddChidren(btnBottonRightImage); + + Button btnBottonRightName = new Button + { + X = btnBottonLeftImage.Right + Application.GetRealWidth(4), + Width = Application.GetRealWidth(100), + Height = Application.GetRealHeight(23), + TextID = StringId.bofangqi, + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.CenterRight, + Gravity = Gravity.CenterVertical, + IsMoreLines = true, + Name = "btnName", + }; + rightFramLayout.AddChidren(btnBottonRightName); + + + + + + + + + + //PayerFramLayout payerFramLayout = new PayerFramLayout(343, 364); + //payerFramLayout.Y = cornerFram.Bottom + Application.GetRealHeight(16); + //payerFramLayout.X = Application.GetRealWidth(16); + //payerFramLayout.LoadPage(); + //this.AddChidren(payerFramLayout); + + this.AdjustRealHeight(20); + + } + + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs index cb0dc58..21a8800 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/AksPage.cs @@ -97,22 +97,15 @@ /// </summary> private void InitMiddle() { - this.vv = new VerticalScrolViewLayout() + vv = new VerticalScrolViewLayout() { Y = topView.fLayout.Bottom, Height = Application.GetRealHeight(H_W.H - H_W.T_Height), }; - var middleFl = new FrameLayout - { - - }; - this.vv.AddChidren(middleFl); - - var whiteFl = new FrameLayout - { - - }; - middleFl.AddChidren(whiteFl); + this.AddChidren(vv); + AksMusicPage aksMusicPage = new AksMusicPage(); + this.vv.AddChidren(aksMusicPage); + aksMusicPage.Show(); } /// <summary> diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs new file mode 100644 index 0000000..fd585bb --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/BaseFramLayout.cs @@ -0,0 +1,52 @@ +锘縰sing System; +using Shared; +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + public class BaseFramLayout:FrameLayout + { + public BaseFramLayout() + { + } + + /// <summary> + /// 璋冩暣鐪熷疄楂樺害 + /// </summary> + /// <param name="bottomSpace">搴曢儴楂樺害(闈炵湡瀹炲��)</param> + public void AdjustRealHeight(int bottomSpace = 0) + { + int bottomHeight = -1; + + for (int i = 0; i < this.ChildrenCount; i++) + { + var child = this.GetChildren(i); + if (child.Bottom > bottomHeight) + { + bottomHeight = child.Bottom; + } + } + if (bottomHeight != -1) + { + this.Height = bottomHeight + Application.GetRealHeight(bottomSpace); + } + } + + /// <summary> + /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣 + /// </summary> + /// <returns></returns> + private int GetLocationMostLastViewBottom() + { + int bottomHeight = -1; + + for (int i = 0; i < this.ChildrenCount; i++) + { + var child = this.GetChildren(i); + if (child.Bottom > bottomHeight) + { + bottomHeight = child.Bottom; + } + } + return bottomHeight; + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs new file mode 100644 index 0000000..67f3228 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/ButtonFramLayout.cs @@ -0,0 +1,196 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using Shared; +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + /// <summary> + /// 鑷畾涔夋寜閿鍣� + /// </summary> + public class ButtonFramLayout : BaseFramLayout + { + + public const int widthFrameLayout = 78; + public const int heightFrameLayout = 84; + public const int lineW = 1; + public const int cornerValue = 8; + + public ButtonFramLayout(int width= widthFrameLayout, int height= heightFrameLayout) + { + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); + this.Radius = (uint)Application.GetRealHeight(cornerValue); + } + + Button btnImage = new Button + { + Y = Application.GetRealHeight(12), + Width = Application.GetRealWidth(32), + Height = Application.GetRealWidth(32), + UnSelectedImagePath = "AksIcon/kai.png", + Gravity = Gravity.CenterHorizontal, + Name = "btnImage", + }; + Button btnName = new Button + { + Y = Application.GetRealHeight(12 + 32 + 8), + Width = Application.GetRealWidth(widthFrameLayout), + Height = Application.GetRealHeight(20), + TextSize = TextSize.Text14, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterHorizontal, + Padding = new Padding(0, 20, 0, 20), + IsMoreLines = true, + Name = "btnName", + + + }; + Button btnTopLine = new Button + { + Width = Application.GetRealWidth(widthFrameLayout), + Height = Application.GetRealHeight(lineW), + BackgroundColor = MusicColor.ViewColor, + Name = "btnTopLine", + }; + Button btnBottomLine = new Button + { + Width = Application.GetRealWidth(widthFrameLayout), + Height = Application.GetRealHeight(lineW), + BackgroundColor = MusicColor.ViewColor, + Name = "btnBottomLine", + Y = Application.GetRealHeight(heightFrameLayout - 1), + }; + Button btnLeftLine = new Button + { + Width = Application.GetRealWidth(lineW), + Height = Application.GetRealHeight(heightFrameLayout), + BackgroundColor = MusicColor.ViewColor, + Name = "btnLeftLine", + + }; + Button btnRightLine = new Button + { + Width = Application.GetRealWidth(lineW), + Height = Application.GetRealHeight(heightFrameLayout), + BackgroundColor = MusicColor.ViewColor, + X = Application.GetRealWidth(widthFrameLayout - 1), + Name = "btnRightLine", + + }; + /// <summary> + /// 娣诲姞甯冨眬 + /// </summary> + /// <param name="parent"></param> + public void AddView(FrameLayout parent) + { + parent.AddChidren(this); + this.AddChidren(btnImage); + this.AddChidren(btnName); + } + + public void AddImageView() + { + this.AddChidren(btnImage); + + } + public void AddNameView() + { + this.AddChidren(btnName); + } + + /// <summary> + /// 娣诲姞宸﹁竟绾� + /// </summary> + public void AddLeftLine() + { + this.AddChidren(btnLeftLine); + } + /// <summary> + /// 娣诲姞鍙宠竟绾� + /// </summary> + public void AddRightLine() + { + this.AddChidren(btnRightLine); + } + + /// <summary> + /// 娣诲姞椤堕儴杈圭嚎 + /// </summary> + public void AddTopLine() + { + this.AddChidren(btnTopLine); + } + /// <summary> + /// 娣诲姞搴曢儴杈圭嚎 + /// </summary> + public void AddBottomLine() + { + this.AddChidren(btnBottomLine); + } + + public Button GetImageButton() + { + return this.btnImage; + } + public Button GetNameButton() + { + return btnName; + } + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄;绗簩涓槸鍥炬爣瀵硅薄;绗笁涓槸鐘舵�佸璞�</param> + public void SetClickListener(Action<FrameLayout, Button, Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + this.BackgroundColor = 0x00000000; + action?.Invoke(this, btnImage, btnName); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + this.MouseUpEventHandler += UpClick; + btnImage.MouseUpEventHandler += UpClick; + btnName.MouseUpEventHandler += UpClick; + + + //EventHandler<MouseEventArgs> MoveClick = (sender, e) => + //{ + // Console.WriteLine("绉诲姩浜嬩欢====="); + // this.BackgroundColor = 0x00000000; + // action?.Invoke(this, btnImage, btnName); + // //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + //}; + //this.MouseMoveEventHandler += MoveClick; + //btnImage.MouseMoveEventHandler += MoveClick; + //btnName.MouseMoveEventHandler += MoveClick; + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + this.BackgroundColor = 0xff454635; + }; + this.MouseDownEventHandler += DownClick; + btnImage.MouseDownEventHandler += DownClick; + btnName.MouseDownEventHandler += DownClick; + } + /// <summary> + /// 璁剧疆鍥炬爣 + /// </summary> + /// <param name="stringId"></param> + public void SetButtonImage(int stringId) + { + + switch (stringId) + { + case StringId.kai: + { + this.btnImage.UnSelectedImagePath = "AksIcon/kai.png"; + } + break; + } + } + + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs new file mode 100644 index 0000000..eb902d3 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs @@ -0,0 +1,163 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using Shared; +using System.Collections.Generic; + +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + /// <summary> + /// 鑷畾涔夊渾瑙掑鍣� + /// </summary> + public class CornerFramLayout : BaseFramLayout + { + public const int cornerValue = 17; + private int topMargin; + private int leftMargin; + private int bottomMargin; + private int rightMargin; + + private int mRowNumber; + + private List<int> mList; + + public CornerFramLayout(int width, int height) + { + this.BackgroundColor = MusicColor.WhiteColor; + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); + this.Radius = (uint)Application.GetRealHeight(cornerValue); + + } + /// <summary> + /// 璁剧疆杈硅窛 + /// </summary> + /// <param name="top">涓婅竟璺�</param> + /// <param name="bottom">涓嬭竟璺�</param> + /// <param name="left">宸﹁竟璺�</param> + /// <param name="right">鍙宠竟璺�</param> + public void SetMargin(int top, int bottom, int left, int right) + { + this.topMargin = top; + this.bottomMargin = bottom; + this.leftMargin = left; + this.rightMargin = right; + } + + /// <summary> + /// 璁剧疆鍒楄〃鏁版嵁 + /// </summary> + /// <param name="list"></param> + public void SetList(List<int> list) + { + if (list == null) + { + list = new List<int>(); + } + this.mList = list; + } + + /// <summary> + /// 鑾峰彇娴嬭瘯鍒楄〃鏁版嵁 + /// </summary> + public List<int> GetTestList(int count) + { + var list = new List<int>(); + for (int i = 1; i <= count; i++) + { + list.Add(i); + } + return list; + } + + /// <summary> + /// 鍔犺浇鎸夐敭鐣岄潰 + /// </summary> + /// <param name="rowNumber">涓�琛屽嚑涓厓绱�</param> + /// <param name="action">鍥炶皟</param> + public void LoadButtonPage(int rowNumber, Action<int> action) + { + if (rowNumber == 0) + { + return; + } + this.mRowNumber = rowNumber; + int line = 0; + int xCount = 0; + for (int i = 1; i <= this.mList.Count; i++) + { + ButtonFramLayout buttonFram = new ButtonFramLayout(); + this.AddChidren(buttonFram); + buttonFram.Tag = i - 1; + buttonFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(ButtonFramLayout.heightFrameLayout * line); + buttonFram.X = Application.GetRealWidth(this.leftMargin) + Application.GetRealWidth(ButtonFramLayout.widthFrameLayout * xCount); + buttonFram.AddImageView(); + buttonFram.AddNameView(); + if (!IsLastRight(i)) + { + buttonFram.AddRightLine(); + } + if (!IsLastColumn(i)) + { + buttonFram.AddBottomLine(); + } + buttonFram.GetNameButton().Text = i.ToString(); + + xCount++; + if (i % rowNumber == 0) + { + + line++; + xCount = 0; + } + buttonFram.SetClickListener((fl, btnIcon, btnName) => + { + action.Invoke((int)buttonFram.Tag); + }); + + + } + //this.AdjustRealHeight(this.bottomMargin); + } + + /// <summary> + /// 鏈�鍚庝竴琛� + /// </summary> + /// <param name="value"></param> + /// <returns></returns> + private bool IsLastColumn(int value) + { + int lineCount = this.mList.Count / this.mRowNumber; + int number = this.mList.Count % this.mRowNumber; + if (number != 0) + { + if (value > lineCount * this.mRowNumber) + { + return true; + } + } + else + { + if (value > lineCount-- * this.mRowNumber) + { + return true; + } + + } + return false; + + } + /// <summary> + /// 鏈�鍚庡彸杈归偅涓�涓� + /// </summary> + /// <param name="value"></param> + /// <returns></returns> + private bool IsLastRight(int value) + { + if (value % this.mRowNumber == 0) + { + return true; + }; + return false; + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs new file mode 100644 index 0000000..cc6989e --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/MenuFramLayout.cs @@ -0,0 +1,89 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using Shared; +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + public class MenuFramLayout : BaseFramLayout + { + + public const int widthFrameLayout = 180; + public const int heightFrameLayout = 180; + public const int cornerValue = 90; + + public MenuFramLayout(int width = widthFrameLayout, int height = heightFrameLayout) + { + this.Width = Application.GetMinRealAverage(width); + this.Height = Application.GetMinRealAverage(height); + this.Radius = (uint)Application.GetRealHeight(cornerValue); + this.BackgroundColor = MusicColor.ViewColor; + } + Button btnTop = new Button + { + Y = Application.GetMinRealAverage(16), + X = Application.GetMinRealAverage(78), + Width = Application.GetRealWidth(24), + Height = Application.GetRealHeight(20), + UnSelectedImagePath = "AksIcon/shang.png", + }; + Button btnBottom = new Button + { + Y = Application.GetMinRealAverage(144), + X = Application.GetMinRealAverage(78), + Width = Application.GetRealWidth(24), + Height = Application.GetRealHeight(20), + UnSelectedImagePath = "AksIcon/xia.png", + }; + Button btnLeft = new Button + { + Y = Application.GetMinRealAverage(78), + X = Application.GetMinRealAverage(16), + Width = Application.GetRealWidth(20), + Height = Application.GetRealHeight(24), + UnSelectedImagePath = "AksIcon/zuo.png", + + }; + Button btnRight = new Button + { + Y = Application.GetMinRealAverage(78), + X = Application.GetMinRealAverage(144), + Width = Application.GetRealWidth(20), + Height = Application.GetRealHeight(24), + UnSelectedImagePath = "AksIcon/you.png", + + }; + + Button btnOkbj = new Button + { + Y = Application.GetMinRealAverage(52), + X = Application.GetMinRealAverage(52), + Width = Application.GetMinRealAverage(76), + Height = Application.GetMinRealAverage(76), + Radius = (uint)Application.GetRealHeight(38), + BackgroundColor = MusicColor.WhiteColor, + + + }; + Button btnOk = new Button + { + Y = Application.GetMinRealAverage(76), + X = Application.GetMinRealAverage(76), + Width = Application.GetMinRealAverage(28), + Height = Application.GetMinRealAverage(28), + Radius = (uint)Application.GetRealHeight(14), + BackgroundColor = MusicColor.SelectedColor, + }; + + public void AddView(FrameLayout layout) + { + layout.AddChidren(this); + this.AddChidren(btnTop); + this.AddChidren(btnBottom); + this.AddChidren(btnLeft); + this.AddChidren(btnRight); + this.AddChidren(btnOkbj); + this.AddChidren(btnOk); + + + } + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs new file mode 100644 index 0000000..8d60bca --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/PayerFramLayout.cs @@ -0,0 +1,40 @@ +锘縰sing System; +using HDL_ON.UI.Music; +using Shared; +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + public class PayerFramLayout : BaseFramLayout + { + public PayerFramLayout(int width, int height) + { + this.BackgroundColor = MusicColor.WhiteColor; + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); + this.Radius = (uint)Application.GetRealHeight(17); + + } + + + public void LoadPage() + { + TypeSingleFramLayout singleFramLayout = new TypeSingleFramLayout(101, 40); + this.AddChidren(singleFramLayout); + singleFramLayout.Y = Application.GetRealHeight(24); + singleFramLayout.Gravity = Gravity.CenterHorizontal; + singleFramLayout.AddBtnLeftImage(); + singleFramLayout.AddBtnName(); + singleFramLayout.AddBtnRightImage(); + + + + MenuFramLayout menuFramLayout = new MenuFramLayout(); + menuFramLayout.Y = singleFramLayout.Bottom + Application.GetRealHeight(32); + menuFramLayout.Gravity = Gravity.CenterHorizontal; + menuFramLayout.AddView(this); + + + + } + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs new file mode 100644 index 0000000..7a34586 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeMultiFramLayout.cs @@ -0,0 +1,175 @@ +锘縰sing HDL_ON.UI.Music; +using System; +using Shared; +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + public class TypeMultiFramLayout:BaseFramLayout + { + + private uint UpBackgroundColor = 0x00000000; + private uint DownBackgroundColor = 0xff454635; + public TypeMultiFramLayout() + { + this.BackgroundColor = MusicColor.ViewColor; + this.Height = Application.GetRealHeight(40); + this.Radius = (uint)Application.GetRealHeight(20); + + } + + Button btnLeftImage = new Button + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/yingku.png", + Gravity = Gravity.CenterVertical, + Name = "btnLeftImage", + }; + Button btnName1 = new Button + { + Width = Application.GetRealWidth(32), + Height = Application.GetRealHeight(23), + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterVertical, + IsMoreLines = true, + Name = "btnName", + }; + + Button btnRightImage = new Button + { + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/yingkunext.png", + Gravity = Gravity.CenterVertical, + Name = "btnRightImage", + }; + + + public void AddBtnLeftImage() + { + this.AddChidren(btnLeftImage); + } + + public void AddBtnName(int gap = 4) + { + if (this.IsAddBtn(btnLeftImage)) + { + btnName1.X = btnLeftImage.Right + Application.GetRealWidth(gap); + } + + //if (btnName.GetTextWidth() < btnName.Width) + //{ + // btnName.Width = btnName.GetTextWidth(); + //} + this.AddChidren(btnName1); + } + + public void AddBtnRightImage(int gap = 8) + { + + if (this.IsAddBtn(btnName1)) + { + btnRightImage.X = btnName1.Right + Application.GetRealWidth(gap); + if (gap == 8) + { + btnRightImage.Width = Application.GetRealWidth(5); + btnRightImage.Height = Application.GetRealHeight(8); + } + + } + this.AddChidren(btnRightImage); + } + + + + + public Button GetBtnLeftImage() + { + return btnLeftImage; + } + + public Button GetBtnName() + { + return btnName1; + } + + public Button GetBtnRightImage() + { + return btnRightImage; + } + + public void SetClickUpBackgroundColor(uint backgroundColor) + { + this.UpBackgroundColor = backgroundColor; + + } + + public void SetClickDownBackgroundColor(uint backgroundColor) + { + this.DownBackgroundColor = backgroundColor; + } + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄;绗簩涓槸鍥炬爣瀵硅薄;绗笁涓槸鐘舵�佸璞�</param> + public void SetClickListener(Action<FrameLayout, Button, Button, Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + this.BackgroundColor = this.UpBackgroundColor; + action?.Invoke(this, btnLeftImage, btnName1, btnRightImage); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + this.MouseUpEventHandler += UpClick; + btnLeftImage.MouseUpEventHandler += UpClick; + btnName1.MouseUpEventHandler += UpClick; + btnRightImage.MouseUpEventHandler += UpClick; + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + this.BackgroundColor = this.DownBackgroundColor; + }; + this.MouseDownEventHandler += DownClick; + btnLeftImage.MouseDownEventHandler += DownClick; + btnName1.MouseDownEventHandler += DownClick; + btnRightImage.MouseDownEventHandler += DownClick; + } + /// <summary> + /// 鍦ㄧ埗甯冨眬鏌ユ壘瀛愭帶浠舵槸鍚﹀瓨鍦� + /// </summary> + /// <param name="btn">鏌ユ壘瀵硅薄</param> + /// <returns>瀛樺湪涓簍rue,鍚﹀垯涓篺alse</returns> + private bool IsAddBtn(View btn) + { + + if (this.ChildrenCount <= 0 || btn == null) + { + return false; + } + for (int i = 0; i < this.ChildrenCount; i++) + { + View view = this.GetChildren(i); + if (view == null) + { + continue; + } + if (view is Button) + { + if (view.Name == btn.Name) + { + return true; + } + } + + } + return false; + + } + + + } +} diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs new file mode 100644 index 0000000..73763f8 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/TypeSingleFramLayout.cs @@ -0,0 +1,179 @@ +锘縰sing HDL_ON.UI.Music; +using System; +using Shared; + +namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView +{ + public class TypeSingleFramLayout : BaseFramLayout + { + + private uint UpBackgroundColor = 0x00000000; + private uint DownBackgroundColor = 0xff454635; + public TypeSingleFramLayout(int width, int height) + { + this.Width = Application.GetRealWidth(width); + this.Height = Application.GetRealHeight(height); + this.Radius = (uint)Application.GetRealHeight(20); + this.BackgroundColor = MusicColor.ViewColor; + + } + + Button btnLeftImage = new Button + { + X=Application.GetRealWidth(16), + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/yingku.png", + Gravity = Gravity.CenterVertical, + Name = "btnLeftImage", + }; + Button btnName = new Button + { + Width = Application.GetRealWidth(32), + Height = Application.GetRealHeight(23), + TextID=StringId.yingku, + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.Center, + Gravity = Gravity.CenterVertical, + IsMoreLines = true, + Name = "btnName", + }; + + Button btnRightImage = new Button + { + Width = Application.GetRealWidth(16), + Height = Application.GetRealWidth(16), + UnSelectedImagePath = "AksIcon/yingkunext.png", + Gravity = Gravity.CenterVertical, + Name = "btnRightImage", + }; + + + public void AddBtnLeftImage() + { + this.AddChidren(btnLeftImage); + } + + public void AddBtnName(int gap = 4) + { + this.AddChidren(btnName); + if (this.IsAddBtn(btnLeftImage)) + { + btnName.X = btnLeftImage.Right + Application.GetRealWidth(gap); + } + + //if (btnName.GetTextWidth() < btnName.Width) + //{ + // btnName.Width = btnName.GetTextWidth(); + //} + + } + + public void AddBtnRightImage(int gap = 8) + { + this.AddChidren(btnRightImage); + if (this.IsAddBtn(btnName)) + { + btnRightImage.X = btnName.Right + Application.GetRealWidth(gap); + if (gap == 8) + { + btnRightImage.Width = Application.GetRealWidth(5); + btnRightImage.Height = Application.GetRealHeight(8); + } + + } + + } + + + + + public Button GetBtnLeftImage() + { + return btnLeftImage; + } + + public Button GetBtnName() + { + return btnName; + } + + public Button GetBtnRightImage() + { + return btnRightImage; + } + + public void SetClickUpBackgroundColor(uint backgroundColor) + { + this.UpBackgroundColor = backgroundColor; + + } + + public void SetClickDownBackgroundColor(uint backgroundColor) + { + this.DownBackgroundColor = backgroundColor; + } + + /// <summary> + /// 浜嬩欢鐩戝惉鏂规硶 + /// </summary> + /// <param name="action">鍥炶皟(绗竴涓槸鐖剁被瀵硅薄;绗簩涓槸鍥炬爣瀵硅薄;绗笁涓槸鐘舵�佸璞�</param> + public void SetClickListener(Action<FrameLayout, Button, Button, Button> action) + { + EventHandler<MouseEventArgs> UpClick = (sender, e) => + { + this.BackgroundColor = this.UpBackgroundColor; + action?.Invoke(this, btnLeftImage, btnName, btnRightImage); + //寮硅捣鏉ヨ繕鍘熻儗鏅鑹� + }; + this.MouseUpEventHandler += UpClick; + btnLeftImage.MouseUpEventHandler += UpClick; + btnName.MouseUpEventHandler += UpClick; + btnRightImage.MouseUpEventHandler += UpClick; + + EventHandler<MouseEventArgs> DownClick = (sender, e) => + { + //鎸変笅鍘绘敼鍙樿儗鏅鑹� + this.BackgroundColor = this.DownBackgroundColor; + }; + this.MouseDownEventHandler += DownClick; + btnLeftImage.MouseDownEventHandler += DownClick; + btnName.MouseDownEventHandler += DownClick; + btnRightImage.MouseDownEventHandler += DownClick; + } + /// <summary> + /// 鍦ㄧ埗甯冨眬鏌ユ壘瀛愭帶浠舵槸鍚﹀瓨鍦� + /// </summary> + /// <param name="btn">鏌ユ壘瀵硅薄</param> + /// <returns>瀛樺湪涓簍rue,鍚﹀垯涓篺alse</returns> + private bool IsAddBtn(View btn) + { + + if (this.ChildrenCount <= 0 || btn == null) + { + return false; + } + for (int i = 0; i < this.ChildrenCount; i++) + { + View view = this.GetChildren(i); + if (view == null) + { + continue; + } + if (view is Button) + { + if (view.Name == btn.Name) + { + return true; + } + } + + } + return false; + + } + + + } +} \ No newline at end of file -- Gitblit v1.8.0