From ff423b88a0dc521932305b5bd44b1786d3e42722 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 10 八月 2023 18:48:02 +0800 Subject: [PATCH] 2023年08月10日18:47:45 --- HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs | 135 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 105 insertions(+), 30 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs index 63c868a..25a64f5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs @@ -25,10 +25,6 @@ private int mListCount; public Action<KeypadEntity> selectAction = null; - /// <summary> - /// 褰撳墠閫夋嫨鐨勭储寮�(鍐呴儴浣跨敤) - /// </summary> - private int CurrnetSelectIndex = -1; /// <summary> @@ -76,8 +72,13 @@ /// </summary> /// <param name="mList">鍒楄〃</param> /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> - public void LoadButtonPage(List<KeypadEntity> mList, int mRowNumber) + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadButtonPage(List<KeypadEntity> mList, int mRowNumber, int defaultIndex = -1) { + if (mList == null || mList.Count == 0) + { + return; + } if (mRowNumber == 0) { return; @@ -116,15 +117,18 @@ } buttonFram.SetClickListener((fl, btnIcon, btnName) => { - if (buttonFram.Tag != null) + if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); - //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //if (defaultIndex != -1 && defaultIndex == i) //{ - // selectAction?.Invoke((int)buttonFram.Tag); + // if (buttonFram.Tag != null && buttonFram.Tag is KeypadEntity) + // { + // selectAction?.Invoke((KeypadEntity)buttonFram.Tag); + // } //} @@ -136,9 +140,13 @@ /// </summary> /// <param name="mList">鍒楄〃</param> /// <param name="list">鍒楄〃涓储寮�,琛ㄧず鏌愪竴鏉″搴﹀姞瀹�</param> - public void LoadButtonPage(List<KeypadEntity> mList, List<int> list) + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadButtonPage(List<KeypadEntity> mList, List<int> list,int defaultIndex=-1) { - + if (mList == null || mList.Count == 0) + { + return; + } int currnetheightValue = 0; int currnetWidthValue = 0; //鑾峰彇鐩稿涓�涓含搴﹀�� @@ -190,15 +198,18 @@ buttonFram.SetClickListener((fl, btnIcon, btnName) => { - if (buttonFram.Tag != null) + if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)buttonFram.Tag); } }); - //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //if (defaultIndex != -1 && defaultIndex == i) //{ - // selectAction?.Invoke((int)buttonFram.Tag); + // if (buttonFram.Tag != null && buttonFram.Tag is KeypadEntity) + // { + // selectAction?.Invoke((KeypadEntity)buttonFram.Tag); + // } //} } } @@ -206,9 +217,14 @@ /// <summary> ///鍔ㄦ�佸姞杞芥暟瀛楁寜閿晫闈� /// </summary> + /// <param name="mList">鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> public void LoadNumberButtonPage(List<KeypadEntity> mList) { - + if (mList == null || mList.Count == 0) + { + return; + } int currnetheightValue = 0; int currnetWidthValue = 0; int heightMaxValue = 84; @@ -216,9 +232,9 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); - for (int i = 1; i <= mList.Count; i++) + for (int i = 0; i <mList.Count; i++) { - var keypad = mList[i - 1]; + var keypad = mList[i]; Button button = new Button { Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue), @@ -256,7 +272,7 @@ button.IsSelected = false; }; - //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i) + //if (defaultIndex != -1 && defaultIndex == i) //{ // selectAction?.Invoke((int)buttonFram.Tag); //} @@ -265,9 +281,16 @@ /// <summary> /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// 褰辩墖甯冨眬 /// </summary> - public void LoadImagePage(List<KeypadEntity> mList) + /// <param name="mList">鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadImagePage(List<MovieLibrary> mList) { + if (mList == null || mList.Count == 0) + { + return; + } int currnetheightValue = 0; int currnetWidthValue = 0; int heightMaxValue = ImageFramlayout.heightFrameLayout; @@ -275,15 +298,17 @@ //鑾峰彇鐩稿涓�涓含搴﹀�� int heightDimensionValue = this.Height - Application.GetRealHeight(this.topMargin) - Application.GetRealHeight(this.bottomMargin) - Application.GetRealHeight(heightMaxValue / 2); int widthDimensionValue = this.Width - Application.GetRealWidth(this.leftMargin) - Application.GetRealWidth(this.rightMargin) - Application.GetRealHeight(widthMaxValue / 2); - for (int i = 1; i <= mList.Count; i++) + for (int i = 0; i < mList.Count; i++) { - var keypad = mList[i - 1]; + var movieLibrary = mList[i]; ImageFramlayout imageFram = new ImageFramlayout(); imageFram.AddView(this); - imageFram.Tag = keypad; + imageFram.Tag = movieLibrary; imageFram.Y = Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue); imageFram.X = Application.GetRealWidth(currnetWidthValue); - imageFram.btnName.Text = keypad.name; + imageFram.btnName.Text = movieLibrary.name; + imageFram.btnImage.ImageBytes = movieLibrary.imageBytes; + imageFram.btnScore.Text = movieLibrary.rating; currnetWidthValue += (widthMaxValue + 8);//8鏄殧闂村�� if (widthDimensionValue < Application.GetRealWidth(currnetWidthValue)) { @@ -293,7 +318,7 @@ imageFram.SetClickListener((fl) => { - if (imageFram.Tag != null) + if (imageFram.Tag != null&& imageFram.Tag is KeypadEntity) { selectAction?.Invoke((KeypadEntity)imageFram.Tag); } @@ -306,11 +331,16 @@ } /// <summary> /// 鍔ㄦ�佸姞杞藉浘鐗囩晫闈� + /// 褰辩墖甯冨眬 /// </summary> /// <param name="mRowNumber">涓�琛屽灏戜釜鍏冪礌</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> public void LoadImagePage(List<KeypadEntity> mList, int mRowNumber) { - + if (mList == null || mList.Count == 0) + { + return; + } if (mRowNumber == 0) { return; @@ -352,16 +382,61 @@ } } - /// <summary> - /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) + /// <summary> + /// 姘村钩婊戝姩甯冨眬 /// </summary> - /// <param name="index">浠庡垪琛�0寮�濮嬭绠楃涓�涓厓绱�,璁剧疆瓒呰繃鍒楄〃鏈�澶�(new List().count-1)鍊艰涓烘棤鏁�</param> - public void SetIndex(int index = -1) + /// <param name="mList">鍒楄〃</param> + /// <param name="defaultIndex">榛樿鍊肩储寮曡寖鍥碵0,mList.count-1],澶т簬鑼冨洿,璇ュ�艰涓烘棤鏁�</param> + public void LoadHorizontalPage(List<FilterCategoryEntity> mList, int defaultIndex = -1) { - if (index == -1) { return; } - this.CurrnetSelectIndex = index; + if (mList == null || mList.Count == 0) + { + return; + } + for (int i = 0; i < mList.Count; i++) + { + var filterCategory = mList[i]; + BaseFramLayout horizontalFL = new BaseFramLayout + { + Y = Application.GetRealHeight(i * 75), + Height = Application.GetRealHeight(75), + Width = this.Width, + }; + this.AddChidren(horizontalFL); + Button btnTitleType = new Button + { + X = Application.GetRealWidth(16), + Y = Application.GetRealHeight(16), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(200), + Text = filterCategory.name, + TextSize = TextSize.Text16, + TextColor = MusicColor.TextColor, + TextAlignment = TextAlignment.CenterLeft, + IsBold = true, + Tag = filterCategory, + }; + horizontalFL.AddChidren(btnTitleType); + + HorizontalFramLayout horizontal = new HorizontalFramLayout(375 - 16, 28); + horizontalFL.AddChidren(horizontal); + horizontal.Y = btnTitleType.Bottom + Application.GetRealHeight(8); + horizontal.X = Application.GetRealWidth(16); + horizontal.SelectTypeEvent += (filters) => + { + KeypadEntity keypad = new KeypadEntity(); + keypad.category = filters.category; + keypad.filterValue = filters.filterValue; + keypad.filterName = filters.filterName; + selectAction?.Invoke(keypad); + }; + horizontal.InitControl(filterCategory.filters, defaultIndex); + + + } } + /// <summary> /// 鏈�鍚庝竴琛� /// </summary> -- Gitblit v1.8.0