滚动列表

This commit is contained in:
2025-09-16 17:13:21 +08:00
parent 2558cdb560
commit 60e1b72edc
184 changed files with 41615 additions and 1908 deletions
@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using AibisDream.UI;
using UnityEngine;
using UnityEngine.UI;
public class SizeHelper2 : MonoBehaviour, ILoopScrollSizeHelper
{
// Start is called before the first frame update
void Start()
{
var ls = GetComponent<LoopScrollRect>();
ls.sizeHelper = this;
}
public Vector2 GetItemsSize(int itemsCount)
{
if (itemsCount <= 0) return new Vector2();
int count = ScrollIndexCallback2.randomWidths.Length;
Vector2 sum = new Vector2();
for (int i = 0; i < count; i++)
{
if (itemsCount <= i) break;
int t = (itemsCount - 1 - i) / count + 1;
sum.x += t * ScrollIndexCallback2.randomWidths[i];
}
return sum;
}
}