2021-04-15 20:18:03 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
2021-04-16 02:48:49 +10:00
|
|
|
|
using UnityExplorer.UI.Models;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-16 21:07:32 +10:00
|
|
|
|
namespace UnityExplorer.UI.Widgets
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-18 21:38:09 +10:00
|
|
|
|
/// <summary>
|
2021-04-20 21:09:07 +10:00
|
|
|
|
/// An object-pooled ScrollRect, attempts to support content of any size and provide a scrollbar for it.
|
2021-04-18 21:38:09 +10:00
|
|
|
|
/// </summary>
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public class ScrollPool : UIBehaviourModel
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// Some helper classes to make managing the complex parts of this a bit easier.
|
|
|
|
|
|
|
|
|
|
public class CachedHeight
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
public int dataIndex;
|
|
|
|
|
public float height, startPosition;
|
|
|
|
|
|
|
|
|
|
public static implicit operator float(CachedHeight ch) => ch.height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DataHeightManager
|
|
|
|
|
{
|
|
|
|
|
private readonly List<CachedHeight> heightCache = new List<CachedHeight>();
|
|
|
|
|
|
|
|
|
|
public int Count => heightCache.Count;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
|
|
|
|
public float TotalHeight => totalHeight;
|
|
|
|
|
private float totalHeight;
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
public float DefaultHeight => 25f;
|
|
|
|
|
|
|
|
|
|
// for efficient lookup of "which index is at this range"
|
|
|
|
|
// list index: DefaultHeight * index from top of data
|
|
|
|
|
// list value: the data index at this position
|
|
|
|
|
private readonly List<int> rangeToDataIndexCache = new List<int>();
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
public CachedHeight this[int index]
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
|
|
|
|
get => heightCache[index];
|
2021-04-20 21:09:07 +10:00
|
|
|
|
set => SetIndex(index, value);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
private float currentEndPosition;
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public void Add(float value)
|
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
heightCache.Add(new CachedHeight()
|
|
|
|
|
{
|
|
|
|
|
height = 0f,
|
|
|
|
|
startPosition = currentEndPosition
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
currentEndPosition += value;
|
|
|
|
|
SetIndex(heightCache.Count - 1, value);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Clear()
|
|
|
|
|
{
|
|
|
|
|
heightCache.Clear();
|
|
|
|
|
totalHeight = 0f;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
public void SetIndex(int dataIndex, float value)
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
if (dataIndex >= heightCache.Count)
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
while (dataIndex > heightCache.Count)
|
|
|
|
|
Add(DefaultHeight);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
Add(value);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
var curr = heightCache[dataIndex];
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (curr.Equals(value))
|
|
|
|
|
return;
|
2021-04-20 21:09:07 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
var diff = value - curr;
|
|
|
|
|
totalHeight += diff;
|
2021-04-20 21:09:07 +10:00
|
|
|
|
|
|
|
|
|
var cache = heightCache[dataIndex];
|
|
|
|
|
cache.height = value;
|
|
|
|
|
|
|
|
|
|
if (dataIndex > 0)
|
|
|
|
|
{
|
|
|
|
|
var prev = heightCache[dataIndex - 1];
|
|
|
|
|
cache.startPosition = prev.startPosition + prev.height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (heightCache.Count > dataIndex + 1)
|
|
|
|
|
heightCache[dataIndex + 1].startPosition += diff;
|
|
|
|
|
|
|
|
|
|
// Update the range cache
|
|
|
|
|
|
|
|
|
|
// If we are setting an index outside of our cached range we need to naively fill the gap
|
|
|
|
|
int rangeIndex = (int)Math.Floor((decimal)cache.startPosition / (decimal)DefaultHeight);
|
|
|
|
|
if (rangeToDataIndexCache.Count <= rangeIndex)
|
|
|
|
|
{
|
|
|
|
|
if (!rangeToDataIndexCache.Any())
|
|
|
|
|
rangeToDataIndexCache.Add(dataIndex);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int lastCurrIndex = rangeToDataIndexCache[rangeToDataIndexCache.Count - 1];
|
|
|
|
|
while (rangeToDataIndexCache.Count <= rangeIndex)
|
|
|
|
|
{
|
|
|
|
|
rangeToDataIndexCache.Add(lastCurrIndex);
|
|
|
|
|
if (lastCurrIndex < dataIndex - 1)
|
|
|
|
|
lastCurrIndex++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set the starting 'index' of the cell
|
|
|
|
|
rangeToDataIndexCache[rangeIndex] = dataIndex;
|
|
|
|
|
|
|
|
|
|
// if the cell spreads over multiple range indices, then set those too.
|
|
|
|
|
int spread = (int)Math.Floor((decimal)value / (decimal)25f);
|
|
|
|
|
if (spread > 1)
|
|
|
|
|
{
|
|
|
|
|
for (int i = rangeIndex + 1; i < rangeIndex + spread - 1; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i > rangeToDataIndexCache.Count)
|
|
|
|
|
rangeToDataIndexCache.Add(dataIndex);
|
|
|
|
|
else
|
|
|
|
|
rangeToDataIndexCache[i] = dataIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetDataIndexAtStartPosition(float desiredHeight)
|
|
|
|
|
=> GetDataIndexAtStartPosition(desiredHeight, out _);
|
|
|
|
|
|
|
|
|
|
public int GetDataIndexAtStartPosition(float desiredHeight, out CachedHeight cache)
|
|
|
|
|
{
|
|
|
|
|
cache = null;
|
|
|
|
|
|
|
|
|
|
//desiredHeight = Math.Max(0, desiredHeight);
|
|
|
|
|
//desiredHeight = Math.Min(TotalHeight, desiredHeight);
|
|
|
|
|
|
|
|
|
|
int rangeIndex = (int)Math.Floor((decimal)desiredHeight / (decimal)DefaultHeight);
|
|
|
|
|
|
|
|
|
|
if (rangeToDataIndexCache.Count <= rangeIndex)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
int dataIndex = rangeToDataIndexCache[rangeIndex];
|
|
|
|
|
cache = heightCache[dataIndex];
|
|
|
|
|
|
|
|
|
|
return dataIndex;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// internal class used to track and manage cell views
|
|
|
|
|
public class CachedCell
|
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
public ScrollPool Pool { get; }
|
|
|
|
|
public RectTransform Rect { get; }
|
|
|
|
|
public ICell Cell { get; }
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
|
|
|
|
public CachedCell(ScrollPool pool, RectTransform rect, ICell cell)
|
|
|
|
|
{
|
|
|
|
|
this.Pool = pool;
|
|
|
|
|
this.Rect = rect;
|
|
|
|
|
this.Cell = cell;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-17 04:11:45 +10:00
|
|
|
|
public ScrollPool(ScrollRect scrollRect)
|
2021-04-16 02:48:49 +10:00
|
|
|
|
{
|
|
|
|
|
this.scrollRect = scrollRect;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public float ExtraPoolCoverageRatio = 1.3f;
|
|
|
|
|
|
2021-04-17 04:11:45 +10:00
|
|
|
|
public IPoolDataSource DataSource;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public RectTransform PrototypeCell;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// UI
|
2021-04-16 02:48:49 +10:00
|
|
|
|
|
|
|
|
|
public override GameObject UIRoot => scrollRect.gameObject;
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public RectTransform Viewport => scrollRect.viewport;
|
|
|
|
|
public RectTransform Content => scrollRect.content;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
internal Slider slider;
|
2021-04-16 02:48:49 +10:00
|
|
|
|
internal ScrollRect scrollRect;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
internal VerticalLayoutGroup contentLayout;
|
2021-04-16 02:48:49 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// Cache / tracking
|
2021-04-18 21:38:09 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
/// <summary>Extra clearance height relative to Viewport height, based on <see cref="ExtraPoolCoverageRatio"/>.</summary>
|
|
|
|
|
private Vector2 RecycleViewBounds;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
private DataHeightManager HeightCache;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The first and last pooled indices relative to the DataSource's list
|
|
|
|
|
/// </summary>
|
|
|
|
|
private int bottomDataIndex;
|
|
|
|
|
private int TopDataIndex => bottomDataIndex - CellPool.Count + 1;
|
|
|
|
|
|
|
|
|
|
private readonly List<CachedCell> CellPool = new List<CachedCell>();
|
|
|
|
|
|
|
|
|
|
public float AdjustedTotalCellHeight => TotalCellHeight + (contentLayout.spacing * (CellPool.Count - 1));
|
|
|
|
|
internal float TotalCellHeight
|
|
|
|
|
{
|
|
|
|
|
get => m_totalCellHeight;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (TotalCellHeight.Equals(value))
|
|
|
|
|
return;
|
|
|
|
|
m_totalCellHeight = value;
|
2021-04-19 23:47:25 +10:00
|
|
|
|
//SetContentHeight();
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private float m_totalCellHeight;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-16 17:49:05 +10:00
|
|
|
|
/// <summary>
|
2021-04-19 20:08:07 +10:00
|
|
|
|
/// The first and last indices of our CellPool in the transform heirarchy
|
2021-04-16 17:49:05 +10:00
|
|
|
|
/// </summary>
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private int topPoolCellIndex, bottomPoolIndex;
|
|
|
|
|
|
|
|
|
|
private int CurrentDataCount => bottomDataIndex + 1;
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-15 20:18:03 +10:00
|
|
|
|
private Vector2 _prevAnchoredPos;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private Vector2 _prevViewportSize; // TODO track viewport height and rebuild on change
|
|
|
|
|
|
2021-04-19 23:47:25 +10:00
|
|
|
|
#region Internal set tracking and update
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 23:47:25 +10:00
|
|
|
|
// A sanity check so only one thing is setting the value per frame.
|
|
|
|
|
public bool WritingLocked
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
get => writingLocked;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
internal set
|
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
if (writingLocked == value)
|
2021-04-15 20:18:03 +10:00
|
|
|
|
return;
|
2021-04-19 23:47:25 +10:00
|
|
|
|
timeofLastWriteLock = Time.time;
|
|
|
|
|
writingLocked = value;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-19 23:47:25 +10:00
|
|
|
|
private bool writingLocked;
|
|
|
|
|
private float timeofLastWriteLock;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-16 02:48:49 +10:00
|
|
|
|
public override void Update()
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
if (writingLocked && timeofLastWriteLock < Time.time)
|
|
|
|
|
writingLocked = false;
|
2021-04-16 02:48:49 +10:00
|
|
|
|
}
|
2021-04-19 20:08:07 +10:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// Initialize
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public void Rebuild()
|
2021-04-16 02:48:49 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
Initialize(DataSource);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
public void Initialize(IPoolDataSource dataSource)
|
2021-04-16 17:49:05 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
HeightCache = new DataHeightManager();
|
2021-04-19 20:08:07 +10:00
|
|
|
|
DataSource = dataSource;
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
this.contentLayout = scrollRect.content.GetComponent<VerticalLayoutGroup>();
|
|
|
|
|
this.slider = scrollRect.GetComponentInChildren<Slider>();
|
|
|
|
|
slider.onValueChanged.AddListener(OnSliderValueChanged);
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
scrollRect.vertical = true;
|
|
|
|
|
scrollRect.horizontal = false;
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
scrollRect.onValueChanged.RemoveListener(OnValueChangedListener);
|
|
|
|
|
RuntimeProvider.Instance.StartCoroutine(InitCoroutine());
|
2021-04-16 17:49:05 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private IEnumerator InitCoroutine()
|
2021-04-16 17:49:05 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
scrollRect.content.anchoredPosition = Vector2.zero;
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
yield return null;
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
_prevAnchoredPos = scrollRect.content.anchoredPosition;
|
|
|
|
|
_prevViewportSize = new Vector2(scrollRect.viewport.rect.width, scrollRect.viewport.rect.height);
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
SetRecycleViewBounds();
|
2021-04-16 17:49:05 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
ExplorerCore.Log("Creating cell pool");
|
|
|
|
|
float start = Time.realtimeSinceStartup;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
CreateCellPool();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
SetSliderPositionAndSize();
|
|
|
|
|
ExplorerCore.Log("Done");
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
scrollRect.onValueChanged.AddListener(OnValueChangedListener);
|
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private void SetRecycleViewBounds()
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
var extra = (Viewport.rect.height * ExtraPoolCoverageRatio) - Viewport.rect.height;
|
|
|
|
|
extra *= 0.5f;
|
|
|
|
|
RecycleViewBounds = new Vector2(Viewport.MinY() + extra, Viewport.MaxY() - extra);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// Refresh methods
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private struct CellInfo { public int cellIndex, dataIndex; }
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private IEnumerator<CellInfo> GetPoolEnumerator()
|
|
|
|
|
{
|
|
|
|
|
int cellIdx = topPoolCellIndex;
|
|
|
|
|
int dataIndex = TopDataIndex;
|
|
|
|
|
int iterated = 0;
|
|
|
|
|
while (iterated < CellPool.Count)
|
|
|
|
|
{
|
|
|
|
|
yield return new CellInfo()
|
|
|
|
|
{
|
|
|
|
|
cellIndex = cellIdx,
|
|
|
|
|
dataIndex = dataIndex
|
|
|
|
|
};
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
cellIdx++;
|
|
|
|
|
if (cellIdx >= CellPool.Count)
|
|
|
|
|
cellIdx = 0;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
dataIndex++;
|
|
|
|
|
iterated++;
|
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
public void RefreshCells(bool andReloadFromDataSource = false, bool setSlider = true)
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
|
|
|
|
if (!CellPool.Any()) return;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
SetRecycleViewBounds();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
bool jumpToBottom = false;
|
|
|
|
|
if (andReloadFromDataSource)
|
|
|
|
|
{
|
|
|
|
|
int count = DataSource.ItemCount;
|
|
|
|
|
if (bottomDataIndex > count)
|
|
|
|
|
{
|
|
|
|
|
bottomDataIndex = Math.Max(count - 1, CellPool.Count - 1);
|
|
|
|
|
jumpToBottom = true;
|
|
|
|
|
}
|
2021-04-20 21:09:07 +10:00
|
|
|
|
else if (HeightCache.Count < count)
|
|
|
|
|
HeightCache.SetIndex(count - 1, PrototypeCell?.rect.height ?? 25f);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// update date height cache, and set cells if 'andReload'
|
2021-04-19 20:08:07 +10:00
|
|
|
|
var enumerator = GetPoolEnumerator();
|
|
|
|
|
while (enumerator.MoveNext())
|
|
|
|
|
{
|
|
|
|
|
var curr = enumerator.Current;
|
|
|
|
|
var cell = CellPool[curr.cellIndex];
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (andReloadFromDataSource)
|
|
|
|
|
SetCell(cell, curr.dataIndex);
|
|
|
|
|
else
|
2021-04-20 21:09:07 +10:00
|
|
|
|
HeightCache.SetIndex(curr.dataIndex, cell.Rect.rect.height);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
SetRecycleViewBounds();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// force check recycles
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (andReloadFromDataSource)
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
RecycleBottomToTop();
|
|
|
|
|
RecycleTopToBottom();
|
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
if (setSlider)
|
|
|
|
|
SetSliderPositionAndSize();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (jumpToBottom)
|
|
|
|
|
{
|
|
|
|
|
var diff = Viewport.MaxY() - CellPool[bottomPoolIndex].Rect.MaxY();
|
|
|
|
|
Content.anchoredPosition += Vector2.up * diff;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private void SetCell(CachedCell cachedCell, int dataIndex)
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
cachedCell.Cell.Enable();
|
|
|
|
|
DataSource.SetCell(cachedCell.Cell, dataIndex);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(cachedCell.Rect);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
HeightCache.SetIndex(dataIndex, cachedCell.Cell.Enabled ? cachedCell.Rect.rect.height : 0f);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// Cell pool
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
|
|
|
|
private void CreateCellPool()
|
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (CellPool.Any())
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
foreach (var cell in CellPool)
|
|
|
|
|
GameObject.Destroy(cell.Rect.gameObject);
|
|
|
|
|
CellPool.Clear();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
|
|
|
|
if (!PrototypeCell)
|
2021-04-19 23:47:25 +10:00
|
|
|
|
throw new Exception("No prototype cell set, cannot initialize");
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
|
|
|
|
//Set the prototype cell active and set cell anchor as top
|
|
|
|
|
PrototypeCell.gameObject.SetActive(true);
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
float currentPoolCoverage = 0f;
|
|
|
|
|
float requiredCoverage = scrollRect.viewport.rect.height * ExtraPoolCoverageRatio;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
topPoolCellIndex = 0;
|
|
|
|
|
bottomPoolIndex = -1;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// create cells until the Pool area is covered.
|
|
|
|
|
// use minimum default height so that maximum pool count is reached.
|
2021-04-15 20:18:03 +10:00
|
|
|
|
while (currentPoolCoverage < requiredCoverage)
|
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
bottomPoolIndex++;
|
|
|
|
|
|
2021-04-15 20:18:03 +10:00
|
|
|
|
//Instantiate and add to Pool
|
2021-04-19 20:08:07 +10:00
|
|
|
|
RectTransform rect = GameObject.Instantiate(PrototypeCell.gameObject).GetComponent<RectTransform>();
|
|
|
|
|
rect.name = $"Cell_{CellPool.Count + 1}";
|
|
|
|
|
var cell = DataSource.CreateCell(rect);
|
|
|
|
|
CellPool.Add(new CachedCell(this, rect, cell));
|
|
|
|
|
rect.SetParent(scrollRect.content, false);
|
|
|
|
|
|
2021-04-19 23:47:25 +10:00
|
|
|
|
cell.Disable();
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
currentPoolCoverage += rect.rect.height + this.contentLayout.spacing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bottomDataIndex = bottomPoolIndex;
|
|
|
|
|
|
|
|
|
|
// after creating pool, set displayed cells.
|
|
|
|
|
for (int i = 0; i < CellPool.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var cell = CellPool[i];
|
|
|
|
|
SetCell(cell, i);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
|
|
|
|
|
2021-04-15 20:18:03 +10:00
|
|
|
|
//Deactivate prototype cell if it is not a prefab(i.e it's present in scene)
|
|
|
|
|
if (PrototypeCell.gameObject.scene.IsValid())
|
|
|
|
|
PrototypeCell.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// Value change processor
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private void OnValueChangedListener(Vector2 val)
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
if (WritingLocked)
|
2021-04-19 20:08:07 +10:00
|
|
|
|
return;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
SetRecycleViewBounds();
|
|
|
|
|
RefreshCells();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
float yChange = (scrollRect.content.anchoredPosition - _prevAnchoredPos).y;
|
|
|
|
|
float adjust = 0f;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (yChange > 0) // Scrolling down
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (ShouldRecycleTop)
|
|
|
|
|
adjust = RecycleTopToBottom();
|
|
|
|
|
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
2021-04-19 20:08:07 +10:00
|
|
|
|
else if (yChange < 0) // Scrolling up
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
if (ShouldRecycleBottom)
|
|
|
|
|
adjust = RecycleBottomToTop();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
var vector = new Vector2(0, adjust);
|
|
|
|
|
scrollRect.m_ContentStartPosition += vector;
|
|
|
|
|
scrollRect.m_PrevPosition += vector;
|
|
|
|
|
|
|
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
|
|
|
|
_prevAnchoredPos = scrollRect.content.anchoredPosition;
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
SetSliderPositionAndSize();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private bool ShouldRecycleTop => GetCellExtent(CellPool[topPoolCellIndex]) >= RecycleViewBounds.x
|
|
|
|
|
&& CellPool[bottomPoolIndex].Rect.position.y > RecycleViewBounds.y;
|
|
|
|
|
|
|
|
|
|
private bool ShouldRecycleBottom => GetCellExtent(CellPool[bottomPoolIndex]) < RecycleViewBounds.y
|
|
|
|
|
&& CellPool[topPoolCellIndex].Rect.position.y < RecycleViewBounds.x;
|
|
|
|
|
|
|
|
|
|
private float GetCellExtent(CachedCell cell) => cell.Rect.MaxY() - contentLayout.spacing;
|
|
|
|
|
|
|
|
|
|
private float RecycleTopToBottom()
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
WritingLocked = true;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
float recycledheight = 0f;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
while (ShouldRecycleTop && CurrentDataCount < DataSource.ItemCount)
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 20:08:07 +10:00
|
|
|
|
var cell = CellPool[topPoolCellIndex];
|
|
|
|
|
|
2021-04-15 20:18:03 +10:00
|
|
|
|
//Move top cell to bottom
|
2021-04-19 20:08:07 +10:00
|
|
|
|
cell.Rect.SetAsLastSibling();
|
|
|
|
|
var prevHeight = cell.Rect.rect.height;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// update content position
|
|
|
|
|
Content.anchoredPosition -= Vector2.up * prevHeight;
|
|
|
|
|
recycledheight += prevHeight + contentLayout.spacing;
|
|
|
|
|
|
|
|
|
|
//set Cell
|
|
|
|
|
SetCell(cell, CurrentDataCount);
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
|
|
|
|
//set new indices
|
2021-04-19 20:08:07 +10:00
|
|
|
|
bottomDataIndex++;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
bottomPoolIndex = topPoolCellIndex;
|
|
|
|
|
topPoolCellIndex = (topPoolCellIndex + 1) % CellPool.Count;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
return -recycledheight;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private float RecycleBottomToTop()
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
WritingLocked = true;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
float recycledheight = 0f;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
while (ShouldRecycleBottom && CurrentDataCount > CellPool.Count)
|
|
|
|
|
{
|
|
|
|
|
var cell = CellPool[bottomPoolIndex];
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
//Move bottom cell to top
|
|
|
|
|
cell.Rect.SetAsFirstSibling();
|
|
|
|
|
var prevHeight = cell.Rect.rect.height;
|
|
|
|
|
|
|
|
|
|
// update content position
|
|
|
|
|
Content.anchoredPosition += Vector2.up * prevHeight;
|
|
|
|
|
recycledheight += prevHeight + contentLayout.spacing;
|
|
|
|
|
|
|
|
|
|
//set new index
|
|
|
|
|
bottomDataIndex--;
|
|
|
|
|
|
|
|
|
|
//set Cell
|
|
|
|
|
SetCell(cell, TopDataIndex);
|
|
|
|
|
|
|
|
|
|
// move content again for new cell size
|
|
|
|
|
var newHeight = cell.Rect.rect.height;
|
|
|
|
|
var diff = newHeight - prevHeight;
|
|
|
|
|
if (diff != 0.0f)
|
|
|
|
|
{
|
|
|
|
|
Content.anchoredPosition += Vector2.up * diff;
|
|
|
|
|
recycledheight += diff;
|
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
|
|
|
|
//set new indices
|
2021-04-19 20:08:07 +10:00
|
|
|
|
topPoolCellIndex = bottomPoolIndex;
|
|
|
|
|
bottomPoolIndex = (bottomPoolIndex - 1 + CellPool.Count) % CellPool.Count;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
return recycledheight;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
// Slider
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
private void SetSliderPositionAndSize()
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
var dataHeight = HeightCache.TotalHeight;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// calculate handle size based on viewport / total data height
|
|
|
|
|
var viewportHeight = Viewport.rect.height;
|
|
|
|
|
var handleHeight = viewportHeight * Math.Min(1, viewportHeight / dataHeight);
|
|
|
|
|
handleHeight = Math.Max(15f, handleHeight);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// resize the handle container area for the size of the handle (bigger handle = smaller container)
|
|
|
|
|
var container = slider.m_HandleContainerRect;
|
|
|
|
|
container.offsetMax = new Vector2(container.offsetMax.x, -(handleHeight * 0.5f));
|
|
|
|
|
container.offsetMin = new Vector2(container.offsetMin.x, handleHeight * 0.5f);
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// set handle size
|
|
|
|
|
slider.handleRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, handleHeight);
|
|
|
|
|
|
|
|
|
|
// if slider is 100% height then make it not interactable
|
|
|
|
|
slider.interactable = !Mathf.Approximately(handleHeight, viewportHeight);
|
|
|
|
|
|
|
|
|
|
GetDisplayedCellLimits(out CellInfo? topVisibleCell, out _);
|
|
|
|
|
if (topVisibleCell != null)
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
var topCell = CellPool[topVisibleCell.Value.cellIndex];
|
|
|
|
|
|
|
|
|
|
// get the starting height of the top displayed cell
|
|
|
|
|
float startHeight = contentLayout.padding.top;
|
|
|
|
|
int dataIndex = topVisibleCell.Value.dataIndex;
|
|
|
|
|
for (int i = 0; i < dataIndex; i++)
|
|
|
|
|
startHeight += HeightCache[i];
|
|
|
|
|
startHeight += topCell.Rect.MinY() - Viewport.MinY(); // add the amount above the viewport min it is
|
|
|
|
|
|
|
|
|
|
// set the value of the slider
|
|
|
|
|
WritingLocked = true;
|
|
|
|
|
slider.value = (float)((decimal)startHeight / (decimal)(HeightCache.TotalHeight - Viewport.rect.height));
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
2021-04-20 21:09:07 +10:00
|
|
|
|
else
|
2021-04-19 20:08:07 +10:00
|
|
|
|
{
|
2021-04-20 21:09:07 +10:00
|
|
|
|
slider.value = 0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
private void GetDisplayedCellLimits(out CellInfo? top, out CellInfo? bottom)
|
|
|
|
|
{
|
|
|
|
|
// get the index of the top displayed cell
|
|
|
|
|
top = null;
|
|
|
|
|
bottom = null;
|
|
|
|
|
var enumerator = GetPoolEnumerator();
|
|
|
|
|
while (enumerator.MoveNext())
|
|
|
|
|
{
|
|
|
|
|
var curr = enumerator.Current;
|
|
|
|
|
var cell = CellPool[curr.cellIndex];
|
|
|
|
|
// if cell bottom is below viewport top
|
|
|
|
|
if (cell.Rect.MaxY() < Viewport.MinY())
|
|
|
|
|
{
|
|
|
|
|
// and if this is the top-most displayed cell
|
|
|
|
|
if (top == null || CellPool[top.Value.cellIndex].Rect.position.y < cell.Rect.position.y)
|
|
|
|
|
top = curr;
|
|
|
|
|
}
|
|
|
|
|
// if cell top is above viewport bottom
|
|
|
|
|
if (cell.Rect.MinY() > Viewport.MaxY())
|
|
|
|
|
{
|
|
|
|
|
// and if this is the bottom-most displayed cell
|
|
|
|
|
if (bottom == null || CellPool[bottom.Value.cellIndex].Rect.position.y > cell.Rect.position.y)
|
|
|
|
|
bottom = curr;
|
|
|
|
|
}
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
2021-04-20 21:09:07 +10:00
|
|
|
|
|
|
|
|
|
return;
|
2021-04-19 20:08:07 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// Mostly works, just little bit jumpy and jittery, needs some refining.
|
|
|
|
|
|
2021-04-19 20:08:07 +10:00
|
|
|
|
private void OnSliderValueChanged(float val)
|
2021-04-15 20:18:03 +10:00
|
|
|
|
{
|
2021-04-19 23:47:25 +10:00
|
|
|
|
if (this.WritingLocked)
|
2021-04-19 20:08:07 +10:00
|
|
|
|
return;
|
2021-04-19 23:47:25 +10:00
|
|
|
|
this.WritingLocked = true;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
var desiredPosition = val * HeightCache.TotalHeight;
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
// add the top and bottom extra area for recycle bounds
|
|
|
|
|
var recycleExtra = Viewport.rect.height * ExtraPoolCoverageRatio - Viewport.rect.height;
|
|
|
|
|
var realMin = Math.Max(0f, desiredPosition - recycleExtra);
|
|
|
|
|
realMin = Math.Min(realMin, HeightCache.TotalHeight - Viewport.rect.height);
|
|
|
|
|
|
|
|
|
|
var realBottomIndex = HeightCache.GetDataIndexAtStartPosition(realMin);
|
|
|
|
|
if (realBottomIndex == -1)
|
|
|
|
|
realBottomIndex = DataSource.ItemCount - 1;
|
|
|
|
|
// calculate which data index should be at bottom of pool
|
|
|
|
|
bottomDataIndex = realBottomIndex + CellPool.Count - 1;
|
|
|
|
|
bottomDataIndex = Math.Min(bottomDataIndex, DataSource.ItemCount - 1);
|
|
|
|
|
|
|
|
|
|
ExplorerCore.Log("set bottom data index to " + bottomDataIndex);
|
|
|
|
|
RefreshCells(true, false);
|
|
|
|
|
|
|
|
|
|
var realDesiredIndex = HeightCache.GetDataIndexAtStartPosition(desiredPosition);
|
|
|
|
|
|
|
|
|
|
GetDisplayedCellLimits(out CellInfo? top, out CellInfo? bottom);
|
|
|
|
|
|
|
|
|
|
// TODO this is not quite right, I think this is causing the jittery jumpiness
|
|
|
|
|
|
|
|
|
|
// calculate how much we need to move up. use height cache for indices above top displayed, move that much.
|
|
|
|
|
float move = 0f;
|
|
|
|
|
if (realDesiredIndex < top.Value.dataIndex)
|
|
|
|
|
{
|
|
|
|
|
ExplorerCore.Log("desired cell is above viewport");
|
|
|
|
|
var enumerator = GetPoolEnumerator();
|
|
|
|
|
while (enumerator.MoveNext())
|
|
|
|
|
{
|
|
|
|
|
var curr = enumerator.Current;
|
|
|
|
|
if (curr.dataIndex == realDesiredIndex)
|
|
|
|
|
{
|
|
|
|
|
var cell = CellPool[curr.cellIndex];
|
|
|
|
|
move = Viewport.MinY() - cell.Rect.MinY();
|
|
|
|
|
ExplorerCore.Log("desired index is " + move + " above the viewport min");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (realDesiredIndex > bottom.Value.dataIndex)
|
|
|
|
|
{
|
|
|
|
|
ExplorerCore.Log("desired cell is below viewport");
|
|
|
|
|
var enumerator = GetPoolEnumerator();
|
|
|
|
|
while (enumerator.MoveNext())
|
|
|
|
|
{
|
|
|
|
|
var curr = enumerator.Current;
|
|
|
|
|
if (curr.dataIndex == realDesiredIndex)
|
|
|
|
|
{
|
|
|
|
|
var cell = CellPool[curr.cellIndex];
|
|
|
|
|
move = Viewport.MaxY() - cell.Rect.MaxY();
|
|
|
|
|
ExplorerCore.Log("desired index is " + move + " below the viewport min");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO move should account for desired actual position, otherwise we just snap to cells.
|
|
|
|
|
|
|
|
|
|
if (move != 0.0f)
|
|
|
|
|
{
|
|
|
|
|
ExplorerCore.Log("Content should move " + move);
|
|
|
|
|
Content.anchoredPosition += Vector2.up * move;
|
|
|
|
|
scrollRect.m_PrevPosition += Vector2.up * move;
|
|
|
|
|
}
|
2021-04-15 20:18:03 +10:00
|
|
|
|
|
2021-04-20 21:09:07 +10:00
|
|
|
|
SetSliderPositionAndSize();
|
|
|
|
|
}
|
2021-04-19 20:08:07 +10:00
|
|
|
|
|
|
|
|
|
/// <summary>Use <see cref="UIFactory.CreateScrollPool"/></summary>
|
|
|
|
|
public override void ConstructUI(GameObject parent) => throw new NotImplementedException();
|
2021-04-15 20:18:03 +10:00
|
|
|
|
}
|
|
|
|
|
}
|