From a0ff1e2375ea0ad8ea127341e04799be8123bd54 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 02 八月 2023 20:29:57 +0800 Subject: [PATCH] 2023年08月02日20:29:54 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs | 102 +++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 86 insertions(+), 16 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs index eb902d3..2d3b075 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs @@ -10,26 +10,40 @@ /// </summary> public class CornerFramLayout : BaseFramLayout { - public const int cornerValue = 17; private int topMargin; private int leftMargin; private int bottomMargin; private int rightMargin; - + /// <summary> + /// 涓�琛屽嚑涓厓绱� + /// </summary> private int mRowNumber; private List<int> mList; - public CornerFramLayout(int width, int height) + public Action<int> selectAction = null; + /// <summary> + /// 褰撳墠閫夋嫨鐨勭储寮�(鍐呴儴浣跨敤) + /// </summary> + private int CurrnetSelectIndex = -1; + /// <summary> + /// + /// </summary> + /// <param name="width">瀹瑰櫒瀹藉害</param> + /// <param name="height">瀹瑰櫒楂樺害</param> + ///<param name="rowNumber">涓�琛屽嚑涓厓绱�</param> + ///<param name="rowNumber">鍦嗚鍊�</param> + public CornerFramLayout(int width, int height, int rowNumber,int radius=0) { this.BackgroundColor = MusicColor.WhiteColor; this.Width = Application.GetRealWidth(width); this.Height = Application.GetRealHeight(height); - this.Radius = (uint)Application.GetRealHeight(cornerValue); + this.Radius = (uint)Application.GetRealHeight(radius); + this.mRowNumber = rowNumber; } /// <summary> - /// 璁剧疆杈硅窛 + /// 璁剧疆鍐呰竟璺� /// </summary> /// <param name="top">涓婅竟璺�</param> /// <param name="bottom">涓嬭竟璺�</param> @@ -44,7 +58,7 @@ } /// <summary> - /// 璁剧疆鍒楄〃鏁版嵁 + /// 璁剧疆鍒楄〃鏁版嵁(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) /// </summary> /// <param name="list"></param> public void SetList(List<int> list) @@ -70,22 +84,19 @@ } /// <summary> - /// 鍔犺浇鎸夐敭鐣岄潰 + /// 鍔ㄦ�佸姞杞芥寜閿晫闈� /// </summary> - /// <param name="rowNumber">涓�琛屽嚑涓厓绱�</param> - /// <param name="action">鍥炶皟</param> - public void LoadButtonPage(int rowNumber, Action<int> action) + public void LoadButtonPage() { - if (rowNumber == 0) + if (this.mRowNumber == 0) { return; } - this.mRowNumber = rowNumber; int line = 0; int xCount = 0; for (int i = 1; i <= this.mList.Count; i++) { - ButtonFramLayout buttonFram = new ButtonFramLayout(); + ButtonFramLayout buttonFram = new ButtonFramLayout(); this.AddChidren(buttonFram); buttonFram.Tag = i - 1; buttonFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(ButtonFramLayout.heightFrameLayout * line); @@ -103,7 +114,7 @@ buttonFram.GetNameButton().Text = i.ToString(); xCount++; - if (i % rowNumber == 0) + if (i % this.mRowNumber == 0) { line++; @@ -111,14 +122,73 @@ } buttonFram.SetClickListener((fl, btnIcon, btnName) => { - action.Invoke((int)buttonFram.Tag); + selectAction?.Invoke((int)buttonFram.Tag); }); + + //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //{ + // selectAction?.Invoke((int)buttonFram.Tag); + //} } - //this.AdjustRealHeight(this.bottomMargin); } + + /// <summary> + /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// </summary> + public void LoadImagePage() + { + if (this.mRowNumber == 0) + { + return; + } + int line = 0; + int xCount = 0; + for (int i = 1; i <= this.mList.Count; i++) + { + ImageFramlayout imageFram = new ImageFramlayout(); + imageFram.AddView(this); + //this.AddChidren(imageFram); + imageFram.Tag = i - 1; + imageFram.Y = Application.GetRealHeight(this.topMargin)+ Application.GetRealHeight((ImageFramlayout.heightFrameLayout + 20) * line); + imageFram.X = Application.GetRealWidth((ImageFramlayout.widthFrameLayout + 8) * xCount); + //imageFram.AddImageView(); + //imageFram.AddScoreButton(); + //imageFram.AddNameButton(); + imageFram.btnName.Text = i.ToString(); + + xCount++; + if (i % this.mRowNumber == 0) + { + + line++; + xCount = 0; + } + imageFram.SetClickListener((fl) => + { + selectAction?.Invoke((int)imageFram.Tag); + }); + + //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //{ + // selectAction?.Invoke((int)imageFram.Tag); + //} + + + } + } + /// <summary> + /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) + /// </summary> + /// <param name="index">浠庡垪琛�0寮�濮嬭绠楃涓�涓厓绱�,璁剧疆瓒呰繃鍒楄〃鏈�澶�(new List().count-1)鍊艰涓烘棤鏁�</param> + public void SetIndex(int index = -1) + { + if (index == -1) { return; } + this.CurrnetSelectIndex = index; + + } /// <summary> /// 鏈�鍚庝竴琛� /// </summary> -- Gitblit v1.8.0