|
@@ -101,7 +101,7 @@ public class ScrollList : MonoBehaviour, IScrollListContent
|
|
|
/// <param name="scrollListContent"></param>
|
|
|
/// <param name="maxSize"></param>
|
|
|
/// <param name="startIndex"></param>
|
|
|
- public async CTask Init(IScrollListContent scrollListContent, int maxSize, int startIndex = 0)
|
|
|
+ public async CTask Init(IScrollListContent scrollListContent, int maxSize, int startIndex = 0, bool t = false)
|
|
|
{
|
|
|
if (startIndex < 0)
|
|
|
{
|
|
@@ -166,7 +166,17 @@ public class ScrollList : MonoBehaviour, IScrollListContent
|
|
|
currIndex = startIndex;
|
|
|
|
|
|
// Vector2 targetSizeDelta = CalculateTargetSizeDelta(startIndex);
|
|
|
- Vector2 targetSizeDelta = CalculateBottomSizeDelta(startIndex);
|
|
|
+ Vector2 targetSizeDelta;
|
|
|
+
|
|
|
+ if (t)
|
|
|
+ {
|
|
|
+ targetSizeDelta = CalculateBottomSizeDelta(maxSize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ targetSizeDelta = CalculateBottomSizeDelta(startIndex);
|
|
|
+ }
|
|
|
+
|
|
|
targetSizeDelta += new Vector2(0, bottom);
|
|
|
lasetPos = CalculateTargetPosition(startIndex);
|
|
|
myRectTransform.sizeDelta = new Vector2(sizeData.x, targetSizeDelta.y);
|
|
@@ -229,7 +239,6 @@ public class ScrollList : MonoBehaviour, IScrollListContent
|
|
|
{
|
|
|
HindWidget();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
protected async CTask<IScorllListWidget> Cread(int index, bool isUp)
|
|
@@ -650,7 +659,7 @@ public class ScrollList : MonoBehaviour, IScrollListContent
|
|
|
float miny = pos.y - (root.rect.size.y * root.pivot.y);
|
|
|
float maxx = pos.x + (root.rect.size.x * (1 - root.pivot.x));
|
|
|
float maxy = pos.y + (root.rect.size.y * (1 - root.pivot.y));
|
|
|
-
|
|
|
+
|
|
|
Vector2 rootPos = posint;
|
|
|
|
|
|
|
|
@@ -670,10 +679,10 @@ public class ScrollList : MonoBehaviour, IScrollListContent
|
|
|
// {
|
|
|
// isHind = true;
|
|
|
// }
|
|
|
-
|
|
|
+
|
|
|
//不依赖widget尺寸大小
|
|
|
- if (p.y > miny - 200 &&
|
|
|
- p.y < maxy + 200)
|
|
|
+ if (p.y > miny - 200 &&
|
|
|
+ p.y < maxy + 200)
|
|
|
{
|
|
|
isHind = true;
|
|
|
}
|
|
@@ -842,7 +851,7 @@ public class ScrollList : MonoBehaviour, IScrollListContent
|
|
|
int visibleRows = Mathf.CeilToInt(viewportHeight / itemHeight); // 向上取整
|
|
|
|
|
|
// 计算最低端索引
|
|
|
- int bottomIndex = Mathf.Min(targetIndex + visibleRows * Page.y, _maxSize - 1);
|
|
|
+ int bottomIndex = Mathf.Min(targetIndex + visibleRows * Page.y, _maxSize );
|
|
|
int totalRows = (bottomIndex + Page.y - 1) / Page.y; // 从 0 到 bottomIndex 的行数
|
|
|
|
|
|
if (!isCustomizeHeight)
|