diff --git a/Packages/UITool/Runtime/ModuleUIPanel/UIScrollList.cs b/Packages/UITool/Runtime/ModuleUIPanel/UIScrollList.cs new file mode 100644 index 0000000..a6a12f8 --- /dev/null +++ b/Packages/UITool/Runtime/ModuleUIPanel/UIScrollList.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UIElements; + +namespace MuHua { + /// + /// 滚动列表 + /// + public class UIScrollList : UIScrollView where T : ModuleUIItem { + + private ModuleUIItems Items;// UI项容器 + + public UIScrollList(VisualElement element, VisualElement canvas, VisualTreeAsset templateAsset, Func generate, + UIDirection direction = UIDirection.HorizontalAndVertical, + UIDirection sh = UIDirection.FromLeftToRight, + UIDirection sv = UIDirection.FromTopToBottom) : base(element, canvas, direction, sh, sv) { + Items = new ModuleUIItems(Container, templateAsset, generate); + } + /// 释放资源 + public void Release() => Items.Release(); + /// 创建UI项 + public void Create(List datas) => Items.Create(datas); + } +} diff --git a/Packages/UITool/Runtime/ModuleUIPanel/UIScrollList.cs.meta b/Packages/UITool/Runtime/ModuleUIPanel/UIScrollList.cs.meta new file mode 100644 index 0000000..2bc1ec8 --- /dev/null +++ b/Packages/UITool/Runtime/ModuleUIPanel/UIScrollList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2fb9b587b7ce5d4295f1bb0da1c8d70 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/UITool/Runtime/ModuleUIPanel/UIScrollView.cs b/Packages/UITool/Runtime/ModuleUIPanel/UIScrollView.cs index 5dc94e5..02f437d 100644 --- a/Packages/UITool/Runtime/ModuleUIPanel/UIScrollView.cs +++ b/Packages/UITool/Runtime/ModuleUIPanel/UIScrollView.cs @@ -29,8 +29,10 @@ namespace MuHua { public VisualElement ScrollerHorizontal => Q("ScrollerHorizontal"); public VisualElement ScrollerVertical => Q("ScrollerVertical"); - public UIScrollView(VisualElement element, VisualElement canvas, UIDirection direction = UIDirection.HorizontalAndVertical, - UIDirection sh = UIDirection.FromLeftToRight, UIDirection sv = UIDirection.FromTopToBottom) : base(element) { + public UIScrollView(VisualElement element, VisualElement canvas, + UIDirection direction = UIDirection.HorizontalAndVertical, + UIDirection sh = UIDirection.FromLeftToRight, + UIDirection sv = UIDirection.FromTopToBottom) : base(element) { this.canvas = canvas; this.direction = direction; @@ -79,7 +81,7 @@ namespace MuHua { } /// 更新状态 - public void Update() { + public virtual void Update() { horizontal.Update(); vertical.Update();