attempt at auto-increasing pool size, not quite working properly

This commit is contained in:
Sinai
2021-04-21 21:04:26 +10:00
parent b32675e3b1
commit 0a9639f8a9
8 changed files with 157 additions and 101 deletions

View File

@ -86,8 +86,8 @@ namespace UnityExplorer.UI.Panels
var test = new DynamicListTest(scrollPool, this);
test.Init();
var prototype = DynamicCell.CreatePrototypeCell(scrollContent);
scrollPool.PrototypeCell = prototype.GetComponent<RectTransform>();
//var prototype = DynamicCell.CreatePrototypeCell(scrollContent);
//scrollPool.PrototypeCell = prototype.GetComponent<RectTransform>();
dummyContentHolder = new GameObject("DummyHolder");
dummyContentHolder.SetActive(false);
@ -170,9 +170,10 @@ namespace UnityExplorer.UI.Panels
public void Init()
{
var prototype = DynamicCell.CreatePrototypeCell(Scroller.UIRoot);
Scroller.DataSource = this;
Scroller.Initialize(this);
Scroller.Initialize(this, prototype);
}
public ICell CreateCell(RectTransform cellTransform) => new DynamicCell(cellTransform.gameObject);

View File

@ -223,6 +223,8 @@ namespace UnityExplorer.UI.Panels
refreshRow.SetActive(false);
// Transform Tree
//var prototype = TransformCell.CreatePrototypeCell(scrollContent);
var infiniteScroll = UIFactory.CreateScrollPool(content, "TransformTree", out GameObject scrollObj,
out GameObject scrollContent, new Color(0.15f, 0.15f, 0.15f));
@ -230,13 +232,10 @@ namespace UnityExplorer.UI.Panels
UIFactory.SetLayoutElement(scrollContent, flexibleHeight: 9999);
// Prototype tree cell
var prototype = TransformCell.CreatePrototypeCell(scrollContent);
infiniteScroll.PrototypeCell = prototype.GetComponent<RectTransform>();
//infiniteScroll.PrototypeCell = prototype.GetComponent<RectTransform>();
Tree = new TransformTree(infiniteScroll)
{
GetRootEntriesMethod = GetRootEntries
};
Tree = new TransformTree(infiniteScroll) { GetRootEntriesMethod = GetRootEntries };
Tree.Init();
// some references