mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
HDL_ON/UI/UI2/FuntionControlView/Aks/CommonView/CornerFramLayout.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using HDL_ON.UI.UI2.FuntionControlView.Aks.Entity;
namespace HDL_ON.UI.UI2.FuntionControlView.Aks.CommonView
{
    /// <summary>
@@ -15,6 +16,8 @@
        private int leftMargin;
        private int bottomMargin;
        private int rightMargin;
        private int mWidth;
        private int mHeight;
        /// <summary>
        /// 一行几个元素
        /// </summary>
@@ -23,8 +26,14 @@
        /// 列表最大值
        /// </summary>
        private int mListCount;
        public Action<KeypadEntity> selectAction = null;
        /// <summary>
        /// 按键回调
        /// </summary>
        public Action<KeypadEntity> selectKeyAction = null;
        /// <summary>
        /// 影片回调
        /// </summary>
        public Action<MovieLibrary> selectImageAction = null;
        /// <summary>
@@ -39,6 +48,8 @@
            this.Width = Application.GetRealWidth(width);
            this.Height = Application.GetRealHeight(height);
            this.Radius = (uint)Application.GetRealHeight(radius);
            this.mWidth = this.Width;
            this.mHeight = this.Height;
        }
@@ -64,7 +75,7 @@
        /// </summary>
        public List<KeypadEntity> GetTestList()
        {
            return AksCommonMethod.Current.GetTYYKeypadList();
            return AksCommonMethod.Current.GetTYYKeypadList(null);
        }
        /// <summary>
@@ -72,7 +83,7 @@
        /// </summary>
        /// <param name="mList">列表</param>
        /// <param name="mRowNumber">一行多少个元素</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param>
        /// <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)
@@ -115,12 +126,21 @@
                    line++;
                    xCount = 0;
                }
                //不支持按键点击背景颜色
                if (!keypad.isClicked)
                {
                    buttonFram.GetImageButton().Alpha = 0.5f;
                    buttonFram.GetNameButton().TextColor =unBackgroundColor;
                    buttonFram.SetClick(false);
                }
                buttonFram.SetClickListener((fl, btnIcon, btnName) =>
                {
                    if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity)
                    if (buttonFram.Tag == null)
                    {
                        selectAction?.Invoke((KeypadEntity)buttonFram.Tag);
                        return;
                    }
                    selectKeyAction?.Invoke((KeypadEntity)buttonFram.Tag);
                });
                //if (defaultIndex != -1 && defaultIndex == i)
@@ -139,8 +159,8 @@
        /// 动态加载按键界面
        /// </summary>
        /// <param name="mList">列表</param>
        /// <param name="list">列表中索引,表示某一条宽度加宽</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param>
        /// <param name="list"> 列表中索引,表示某一条宽度加宽,没有默认(new List<int>)</param>
        /// <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)
@@ -195,13 +215,21 @@
                    currnetheightValue += ButtonFramLayout.heightFrameLayout;
                    currnetWidthValue = 0;
                }
                //不支持按键点击背景颜色
                if (!keypad.isClicked)
                {
                    buttonFram.GetImageButton().Alpha = 0.5f;
                    buttonFram.GetNameButton().TextColor = unBackgroundColor;
                    buttonFram.SetClick(false);
                }
                buttonFram.SetClickListener((fl, btnIcon, btnName) =>
                {
                    if (buttonFram.Tag != null&& buttonFram.Tag is KeypadEntity)
                    if (buttonFram.Tag == null)
                    {
                        selectAction?.Invoke((KeypadEntity)buttonFram.Tag);
                        return;
                    }
                    selectKeyAction?.Invoke((KeypadEntity)buttonFram.Tag);
                });
                //if (defaultIndex != -1 && defaultIndex == i)
@@ -218,7 +246,7 @@
        ///动态加载数字按键界面
        /// </summary>
        /// <param name="mList">列表</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],值超出范围视为无效</param>
        public void LoadNumberButtonPage(List<KeypadEntity> mList)
        {
            if (mList == null || mList.Count == 0)
@@ -227,12 +255,12 @@
            }
            int currnetheightValue = 0;
            int currnetWidthValue = 0;
            int heightMaxValue = 84;
            int heightMaxValue = 84 - 6;
            int widthMaxValue = 78;
            //获取相对一个纬度值
            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 = 0; i <mList.Count; i++)
            for (int i = 0; i < mList.Count; i++)
            {
                var keypad = mList[i];
                Button button = new Button
@@ -248,7 +276,9 @@
                    IsBold = true,
                    Tag = keypad,
                    BackgroundColor = MusicColor.WhiteColor,
                    SelectedBackgroundColor = 0xff454635,
                    SelectedBackgroundColor = 0xFFF2F3F7,
                    Radius = (uint)Application.GetRealHeight(8),
                    SelectedTextColor = MusicColor.TextColor,
                };
                this.AddChidren(button);
@@ -258,18 +288,22 @@
                    currnetheightValue += heightMaxValue;
                    currnetWidthValue = 0;
                }
                button.MouseDownEventHandler += (sen, e) =>
                //不支持按键点击背景颜色
                if (!keypad.isClicked)
                {
                    if (button.Tag == null || ((KeypadEntity)button.Tag).keypad == "none")
                    button.TextColor =unBackgroundColor;
                }
                button.MouseUpEventHandler += (sen, e) =>
                {
                    if (button.Tag == null || ((KeypadEntity)button.Tag).keypad == "none"|| !((KeypadEntity)button.Tag).isClicked)
                    {
                        return;
                    }
                    button.IsSelected = true;
                    selectAction?.Invoke((KeypadEntity)button.Tag);
                };
                button.MouseUpEventHandler += (sen, e) =>
                {
                    button.IsSelected = false;
                    selectKeyAction?.Invoke((KeypadEntity)button.Tag);
                    SetButtonIsSelected(button);
                };
                //if (defaultIndex != -1 && defaultIndex == i)
@@ -284,7 +318,7 @@
        /// 影片布局
        /// </summary>
        /// <param name="mList">列表</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],值超出范围视为无效</param>
        public void LoadImagePage(List<MovieLibrary> mList)
        {
            if (mList == null || mList.Count == 0)
@@ -318,14 +352,14 @@
                imageFram.SetClickListener((fl) =>
                {
                    if (imageFram.Tag != null&& imageFram.Tag is KeypadEntity)
                    if (imageFram.Tag != null&& imageFram.Tag is MovieLibrary)
                    {
                        selectAction?.Invoke((KeypadEntity)imageFram.Tag);
                        selectImageAction?.Invoke((MovieLibrary)imageFram.Tag);
                    }
                });
                //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i)
                //{
                //    selectAction?.Invoke((int)imageFram.Tag);
                //    selectImageAction?.Invoke((int)imageFram.Tag);
                //}
            }
        }
@@ -334,8 +368,8 @@
        /// 影片布局
        /// </summary>
        /// <param name="mRowNumber">一行多少个元素</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param>
        public void LoadImagePage(List<KeypadEntity> mList, int mRowNumber)
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],值超出范围视为无效</param>
        public void LoadImagePage(List<MovieLibrary> mList, int mRowNumber)
        {
            if (mList == null || mList.Count == 0)
            {
@@ -368,25 +402,77 @@
                }
                imageFram.SetClickListener((fl) =>
                {
                    if (imageFram.Tag != null)
                    if (imageFram.Tag != null && imageFram.Tag is MovieLibrary)
                    {
                        selectAction?.Invoke((KeypadEntity)imageFram.Tag);
                        selectImageAction?.Invoke((MovieLibrary)imageFram.Tag);
                    }
                });
                //if (CurrnetSelectIndex != -1 && CurrnetSelectIndex == i)
                //{
                //    selectAction?.Invoke((int)imageFram.Tag);
                //    selectImageAction?.Invoke((MovieLibrary)imageFram.Tag);
                //}
            }
        }
       private int currnetheightValue1 = 0;
       private int currnetWidthValue1 = 0;
       private int heightMaxValue1 = ImageFramlayout.heightFrameLayout;
       private int widthMaxValue1 = ImageFramlayout.widthFrameLayout;
        //获取相对一个纬度值
       private int widthDimensionValue1 = Application.GetRealWidth(343) - Application.GetRealHeight(ImageFramlayout.widthFrameLayout / 2);
        /// <summary>
        /// 加载影片列表布局
        /// (特殊布局)
        /// </summary>
        /// <param name="mList">列表</param>
        public void LoadImagePage(List<ImageFramlayout> imageFramlayoutList)
        {
            if (imageFramlayoutList==null||imageFramlayoutList.Count == 0)
            {
                return;
            }
            //int currnetheightValue = 0;
            //int currnetWidthValue = 0;
            //int heightMaxValue = ImageFramlayout.heightFrameLayout;
            //int widthMaxValue = ImageFramlayout.widthFrameLayout;
            ////获取相对一个纬度值
            //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 = 0; i < imageFramlayoutList.Count; i++)
            {
                var imageFram = imageFramlayoutList[i];
                if (imageFram == null)
                {
                    continue;
                }
                imageFram.AddView(this);
                imageFram.Y =Application.GetRealHeight(this.topMargin) + Application.GetRealHeight(currnetheightValue1);
                imageFram.X = Application.GetRealWidth(currnetWidthValue1);
                currnetWidthValue1 += (widthMaxValue1 + 8);//8是隔间值
                if (widthDimensionValue1 < Application.GetRealWidth(currnetWidthValue1))
                {
                    currnetheightValue1 += (heightMaxValue1 + 20);//20是隔间值
                    currnetWidthValue1 = 0;
                }
                imageFram.SetClickListener((fl) =>
                {
                    if (imageFram.Tag != null && imageFram.Tag is MovieLibrary)
                    {
                        selectImageAction?.Invoke((MovieLibrary)imageFram.Tag);
                    }
                });
            }
        }
        /// <summary>
        /// 水平滑动布局
        /// </summary>
        /// <param name="mList">列表</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],大于范围,该值视为无效</param>
        /// <param name="defaultIndex">默认值索引范围[0,mList.count-1],值超出范围视为无效</param>
        public void LoadHorizontalPage(List<FilterCategoryEntity> mList, int defaultIndex = -1)
        {
            if (mList == null || mList.Count == 0)
@@ -428,7 +514,7 @@
                    keypad.category = filters.category;
                    keypad.filterValue = filters.filterValue;
                    keypad.filterName = filters.filterName;
                    selectAction?.Invoke(keypad);
                    selectKeyAction?.Invoke(keypad);
                };
                horizontal.InitControl(filterCategory.filters, defaultIndex);