This commit is contained in:
Sinai 2021-04-30 23:12:18 +10:00
parent 2378925a8b
commit 74ff1d8f01
14 changed files with 97 additions and 259 deletions

View File

@ -72,7 +72,7 @@ namespace UnityExplorer.UI.Inspectors.CacheObject
// On parent destroying this // On parent destroying this
public virtual void OnDestroyed() public virtual void ReleasePooledObjects()
{ {
// TODO release IValue / Evaluate back to pool, etc // TODO release IValue / Evaluate back to pool, etc
ReleaseIValue(); ReleaseIValue();
@ -237,6 +237,7 @@ namespace UnityExplorer.UI.Inspectors.CacheObject
if (this.IValue == null) if (this.IValue == null)
{ {
IValue = (InteractiveValue)Pool.Borrow(typeof(InteractiveValue)); IValue = (InteractiveValue)Pool.Borrow(typeof(InteractiveValue));
CurrentIValueType = IValue.GetType();
IValue.SetOwner(this); IValue.SetOwner(this);
IValue.UIRoot.transform.SetParent(CellView.SubContentHolder.transform, false); IValue.UIRoot.transform.SetParent(CellView.SubContentHolder.transform, false);
CellView.SubContentHolder.SetActive(true); CellView.SubContentHolder.SetActive(true);

View File

@ -10,7 +10,7 @@ namespace UnityExplorer.UI.Inspectors.CacheObject.Views
{ {
public class CacheMemberCell : CacheObjectCell public class CacheMemberCell : CacheObjectCell
{ {
public ReflectionInspector CurrentOwner { get; set; } public ReflectionInspector Owner { get; set; }
public CacheMember MemberOccupant => Occupant as CacheMember; public CacheMember MemberOccupant => Occupant as CacheMember;
@ -24,15 +24,6 @@ namespace UnityExplorer.UI.Inspectors.CacheObject.Views
// TODO // TODO
} }
public override void OnReturnToPool()
{
base.OnReturnToPool();
// TODO ?
CurrentOwner = null;
}
protected override void ConstructEvaluateHolder(GameObject parent) protected override void ConstructEvaluateHolder(GameObject parent)
{ {
// Evaluate vert group // Evaluate vert group

View File

@ -59,18 +59,6 @@ namespace UnityExplorer.UI.Inspectors.CacheObject.Views
public GameObject SubContentHolder; public GameObject SubContentHolder;
public virtual void OnReturnToPool()
{
if (Occupant != null)
{
// TODO ?
SubContentHolder.SetActive(false);
Occupant = null;
}
}
protected virtual void ApplyClicked() protected virtual void ApplyClicked()
{ {
Occupant.OnCellApplyClicked(); Occupant.OnCellApplyClicked();

View File

@ -49,7 +49,7 @@ namespace UnityExplorer.UI.Inspectors
TransformTree.Rebuild(); TransformTree.Rebuild();
ComponentList.ScrollPool.Rebuild(); ComponentList.ScrollPool.Refresh(true, true);
UpdateComponents(); UpdateComponents();
} }
@ -57,12 +57,12 @@ namespace UnityExplorer.UI.Inspectors
{ {
base.OnReturnToPool(); base.OnReturnToPool();
// release component and transform lists //// release component and transform lists
this.TransformTree.ScrollPool.ReturnCells(); //this.TransformTree.ScrollPool.ReleaseCells();
this.TransformTree.ScrollPool.SetUninitialized(); //this.TransformTree.ScrollPool.SetUninitialized();
//
this.ComponentList.ScrollPool.ReturnCells(); //this.ComponentList.ScrollPool.ReleaseCells();
this.ComponentList.ScrollPool.SetUninitialized(); //this.ComponentList.ScrollPool.SetUninitialized();
} }
private float timeOfLastUpdate; private float timeOfLastUpdate;
@ -150,7 +150,7 @@ namespace UnityExplorer.UI.Inspectors
_componentEntries.Add(comp); _componentEntries.Add(comp);
ComponentList.RefreshData(); ComponentList.RefreshData();
ComponentList.ScrollPool.RefreshCells(true); ComponentList.ScrollPool.Refresh(true);
} }
protected override void OnCloseClicked() protected override void OnCloseClicked()

View File

@ -46,7 +46,8 @@ namespace UnityExplorer.UI.Inspectors
SetTitleLayouts(); SetTitleLayouts();
SetTarget(target); SetTarget(target);
MemberScrollPool.Initialize(this); // MemberScrollPool.SetDataSource(this);
MemberScrollPool.Refresh(true, true);
RuntimeProvider.Instance.StartCoroutine(InitCoroutine()); RuntimeProvider.Instance.StartCoroutine(InitCoroutine());
} }
@ -60,11 +61,7 @@ namespace UnityExplorer.UI.Inspectors
public override void OnReturnToPool() public override void OnReturnToPool()
{ {
foreach (var member in members) foreach (var member in members)
member.OnDestroyed(); member.ReleasePooledObjects();
// release all cachememberviews
MemberScrollPool.ReturnCells();
MemberScrollPool.SetUninitialized();
members.Clear(); members.Clear();
filteredMembers.Clear(); filteredMembers.Clear();
@ -173,7 +170,7 @@ namespace UnityExplorer.UI.Inspectors
} }
if (shouldRefresh) if (shouldRefresh)
MemberScrollPool.RefreshCells(false); MemberScrollPool.Refresh(false);
} }
// Member cells // Member cells
@ -182,12 +179,7 @@ namespace UnityExplorer.UI.Inspectors
public void OnCellBorrowed(CacheMemberCell cell) public void OnCellBorrowed(CacheMemberCell cell)
{ {
cell.CurrentOwner = this; cell.Owner = this;
}
public void OnCellReturned(CacheMemberCell cell)
{
cell.OnReturnToPool();
} }
public void SetCell(CacheMemberCell cell, int index) public void SetCell(CacheMemberCell cell, int index)
@ -315,6 +307,7 @@ namespace UnityExplorer.UI.Inspectors
MemberScrollPool = UIFactory.CreateScrollPool<CacheMemberCell>(uiRoot, "MemberList", out GameObject scrollObj, MemberScrollPool = UIFactory.CreateScrollPool<CacheMemberCell>(uiRoot, "MemberList", out GameObject scrollObj,
out GameObject _, new Color(0.09f, 0.09f, 0.09f)); out GameObject _, new Color(0.09f, 0.09f, 0.09f));
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999); UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
MemberScrollPool.Initialize(this);
//InspectorPanel.Instance.UIRoot.GetComponent<Mask>().enabled = false; //InspectorPanel.Instance.UIRoot.GetComponent<Mask>().enabled = false;
//MemberScrollPool.Viewport.GetComponent<Mask>().enabled = false; //MemberScrollPool.Viewport.GetComponent<Mask>().enabled = false;

View File

@ -83,7 +83,7 @@ namespace UnityExplorer.UI.Panels
} }
dataHandler.RefreshData(); dataHandler.RefreshData();
resultsScrollPool.RefreshCells(true); resultsScrollPool.Refresh(true);
resultsLabel.text = $"{currentResults.Count} results"; resultsLabel.text = $"{currentResults.Count} results";
} }
@ -212,7 +212,7 @@ namespace UnityExplorer.UI.Panels
//if (!Pool<ButtonCell>.PrototypeObject) //if (!Pool<ButtonCell>.PrototypeObject)
// Pool<ButtonCell>.PrototypeObject = ButtonCell.CreatePrototypeCell(Pool<ButtonCell>.InactiveHolder).gameObject; // Pool<ButtonCell>.PrototypeObject = ButtonCell.CreatePrototypeCell(Pool<ButtonCell>.InactiveHolder).gameObject;
resultsScrollPool.Initialize(dataHandler);//, ButtonCell.CreatePrototypeCell(uiRoot)); resultsScrollPool.Initialize(dataHandler);
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999); UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
} }
} }

View File

@ -116,7 +116,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
UIRoot.SetActive(true); UIRoot.SetActive(true);
UIRoot.transform.SetAsLastSibling(); UIRoot.transform.SetAsLastSibling();
dataHandler.RefreshData(); dataHandler.RefreshData();
scrollPool.RefreshAndJumpToTop(); scrollPool.Refresh(true, true);
} }
} }

View File

@ -65,7 +65,7 @@ namespace UnityExplorer.UI.Widgets
cell.OnClick += OnCellClicked; cell.OnClick += OnCellClicked;
} }
public void OnCellReturned(ButtonCell cell) public void ReleaseCell(ButtonCell cell)
{ {
cell.OnClick -= OnCellClicked; cell.OnClick -= OnCellClicked;
} }

View File

@ -1,83 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using UnityEngine;
//using UnityEngine.UI;
//namespace UnityExplorer.UI.Widgets
//{
// public class CellViewHolder : ICell
// {
// public CellViewHolder(GameObject uiRoot)
// {
// this.UIRoot = uiRoot;
// this.Rect = uiRoot.GetComponent<RectTransform>();
// m_enabled = uiRoot.activeSelf;
// }
// public bool Enabled => m_enabled;
// private bool m_enabled;
// public GameObject UIRoot { get; }
// public RectTransform Rect { get; }
// private GameObject m_content;
// public GameObject SetContent(GameObject newContent)
// {
// var ret = m_content;
// if (ret && newContent && ret.ReferenceEqual(newContent))
// return null;
// newContent.transform.SetParent(this.UIRoot.transform, false);
// (this as ICell).Enable();
// m_content = newContent;
// return ret;
// }
// public GameObject DisableContent()
// {
// var ret = m_content;
// (this as ICell).Disable();
// return ret;
// }
// void ICell.Enable()
// {
// m_enabled = true;
// UIRoot.SetActive(true);
// }
// void ICell.Disable()
// {
// m_enabled = false;
// UIRoot.SetActive(false);
// }
// public static RectTransform CreatePrototypeCell(GameObject parent)
// {
// // using an image on the cell view holder is fine, we only need to make about 20-50 of these per pool.
// var prototype = UIFactory.CreateVerticalGroup(parent, "PrototypeCell", true, true, true, true, 0, new Vector4(0, 0, 0, 0),
// new Color(0.11f, 0.11f, 0.11f), TextAnchor.MiddleCenter);
// var rect = prototype.GetComponent<RectTransform>();
// rect.anchorMin = new Vector2(0, 1);
// rect.anchorMax = new Vector2(0, 1);
// rect.pivot = new Vector2(0.5f, 1);
// rect.sizeDelta = new Vector2(100, 30);
// prototype.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
// var sepObj = UIFactory.CreateUIObject("separator", prototype);
// sepObj.AddComponent<Image>().color = Color.black;
// UIFactory.SetLayoutElement(sepObj, minHeight: 1, preferredHeight: 1, flexibleHeight: 0);
// prototype.SetActive(false);
// return rect;
// }
// }
//}

View File

@ -11,7 +11,7 @@ namespace UnityExplorer.UI.Widgets
int ItemCount { get; } int ItemCount { get; }
void OnCellBorrowed(T cell); void OnCellBorrowed(T cell);
void OnCellReturned(T cell); //void ReleaseCell(T cell);
void SetCell(T cell, int index); void SetCell(T cell, int index);
//void DisableCell(T cell, int index); //void DisableCell(T cell, int index);

View File

@ -35,9 +35,7 @@ namespace UnityExplorer.UI.Widgets
public float PrototypeHeight => _protoHeight ?? (float)(_protoHeight = Pool<T>.Instance.DefaultHeight); public float PrototypeHeight => _protoHeight ?? (float)(_protoHeight = Pool<T>.Instance.DefaultHeight);
private float? _protoHeight; private float? _protoHeight;
//private float PrototypeHeight => DefaultHeight.rect.height; public int ExtraPoolCells => 6;
public int ExtraPoolCells => 10;
public float RecycleThreshold => PrototypeHeight * ExtraPoolCells; public float RecycleThreshold => PrototypeHeight * ExtraPoolCells;
public float HalfThreshold => RecycleThreshold * 0.5f; public float HalfThreshold => RecycleThreshold * 0.5f;
@ -70,6 +68,7 @@ namespace UnityExplorer.UI.Widgets
/// </summary> /// </summary>
private int bottomDataIndex; private int bottomDataIndex;
private int TopDataIndex => Math.Max(0, bottomDataIndex - CellPool.Count + 1); private int TopDataIndex => Math.Max(0, bottomDataIndex - CellPool.Count + 1);
private int CurrentDataCount => bottomDataIndex + 1;
private float TotalDataHeight => HeightCache.TotalHeight + contentLayout.padding.top + contentLayout.padding.bottom; private float TotalDataHeight => HeightCache.TotalHeight + contentLayout.padding.top + contentLayout.padding.bottom;
@ -78,8 +77,6 @@ namespace UnityExplorer.UI.Widgets
/// </summary> /// </summary>
private int topPoolIndex, bottomPoolIndex; private int topPoolIndex, bottomPoolIndex;
private int CurrentDataCount => bottomDataIndex + 1;
private Vector2 prevAnchoredPos; private Vector2 prevAnchoredPos;
private float prevViewportHeight; private float prevViewportHeight;
@ -102,14 +99,9 @@ namespace UnityExplorer.UI.Widgets
private float prevContentHeight = 1.0f; private float prevContentHeight = 1.0f;
public void SetUninitialized()
{
m_initialized = false;
}
public override void Update() public override void Update()
{ {
if (!m_initialized || !ScrollRect || DataSource == null) if (!ScrollRect || DataSource == null)
return; return;
if (writingLocked && timeofLastWriteLock < Time.time) if (writingLocked && timeofLastWriteLock < Time.time)
@ -129,65 +121,38 @@ namespace UnityExplorer.UI.Widgets
// Public methods // Public methods
public void Rebuild() public void Refresh(bool setCellData, bool jumpToTop = false)
{ {
HeightCache = new DataHeightCache<T>(this); if (jumpToTop)
{
bottomDataIndex = CellPool.Count - 1;
Content.anchoredPosition = Vector2.zero;
}
SetRecycleViewBounds(false); RefreshCells(setCellData, true);
SetScrollBounds();
CheckExtendCellPool();
writingLocked = false;
Content.anchoredPosition = Vector2.zero;
UpdateSliderHandle(true);
m_initialized = true;
}
public void RefreshAndJumpToTop()
{
bottomDataIndex = CellPool.Count - 1;
RefreshCells(true);
Content.anchoredPosition = Vector2.zero;
UpdateSliderHandle(true);
}
public void RecreateHeightCache()
{
HeightCache = new DataHeightCache<T>(this);
CheckDataSourceCountChange(out _);
}
public void RefreshCells(bool reloadData)
{
RefreshCells(reloadData, true);
} }
// Initialize // Initialize
private bool m_doneFirstInit; //private bool Initialized;
private bool m_initialized;
/// <summary>Should be called only once, when the scroll pool is created.</summary>
public void Initialize(IPoolDataSource<T> dataSource) public void Initialize(IPoolDataSource<T> dataSource)
{ {
this.DataSource = dataSource;
HeightCache = new DataHeightCache<T>(this);
// Ensure the pool for the cell type is initialized. // Ensure the pool for the cell type is initialized.
Pool<T>.GetPool(); Pool<T>.GetPool();
HeightCache = new DataHeightCache<T>(this); this.contentLayout = ScrollRect.content.GetComponent<VerticalLayoutGroup>();
DataSource = dataSource; this.slider = ScrollRect.GetComponentInChildren<Slider>();
slider.onValueChanged.AddListener(OnSliderValueChanged);
if (!m_doneFirstInit) ScrollRect.vertical = true;
{ ScrollRect.horizontal = false;
m_doneFirstInit = true;
this.contentLayout = ScrollRect.content.GetComponent<VerticalLayoutGroup>();
this.slider = ScrollRect.GetComponentInChildren<Slider>();
slider.onValueChanged.AddListener(OnSliderValueChanged);
ScrollRect.vertical = true; //ScrollRect.onValueChanged.RemoveListener(OnValueChangedListener);
ScrollRect.horizontal = false;
}
ScrollRect.onValueChanged.RemoveListener(OnValueChangedListener);
RuntimeProvider.Instance.StartCoroutine(InitCoroutine()); RuntimeProvider.Instance.StartCoroutine(InitCoroutine());
} }
@ -196,6 +161,8 @@ namespace UnityExplorer.UI.Widgets
ScrollRect.content.anchoredPosition = Vector2.zero; ScrollRect.content.anchoredPosition = Vector2.zero;
yield return null; yield return null;
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
// set intial bounds // set intial bounds
prevAnchoredPos = Content.anchoredPosition; prevAnchoredPos = Content.anchoredPosition;
SetRecycleViewBounds(false); SetRecycleViewBounds(false);
@ -203,14 +170,18 @@ namespace UnityExplorer.UI.Widgets
// create initial cell pool and set cells // create initial cell pool and set cells
CreateCellPool(); CreateCellPool();
var enumerator = GetPoolEnumerator();
while (enumerator.MoveNext())
SetCell(CellPool[enumerator.Current.cellIndex], enumerator.Current.dataIndex);
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
// update slider // update slider
SetScrollBounds(); SetScrollBounds();
UpdateSliderHandle(); UpdateSliderHandle();
// add onValueChanged listener after setup // add onValueChanged listener after setup
ScrollRect.onValueChanged.AddListener(OnValueChangedListener); ScrollRect.onValueChanged.AddListener(OnValueChangedListener);
m_initialized = true;
} }
private void SetScrollBounds() private void SetScrollBounds()
@ -218,28 +189,43 @@ namespace UnityExplorer.UI.Widgets
NormalizedScrollBounds = new Vector2(Viewport.rect.height * 0.5f, TotalDataHeight - (Viewport.rect.height * 0.5f)); NormalizedScrollBounds = new Vector2(Viewport.rect.height * 0.5f, TotalDataHeight - (Viewport.rect.height * 0.5f));
} }
private void SetRecycleViewBounds(bool extendPoolIfGrown)
{
RecycleViewBounds = new Vector2(Viewport.MinY() + HalfThreshold, Viewport.MaxY() - HalfThreshold);
if (extendPoolIfGrown && prevViewportHeight < Viewport.rect.height && prevViewportHeight != 0.0f)
CheckExtendCellPool();
prevViewportHeight = Viewport.rect.height;
}
// Cell pool // Cell pool
public void ReturnCells() private CellInfo _cellInfo = new CellInfo();
{
if (CellPool.Any())
{
foreach (var cell in CellPool)
{
DataSource.OnCellReturned(cell);
Pool<T>.Return(cell);
}
CellPool.Clear();
}
bottomDataIndex = -1; public IEnumerator<CellInfo> GetPoolEnumerator()
topPoolIndex = 0; {
bottomPoolIndex = 0; int cellIdx = topPoolIndex;
int dataIndex = TopDataIndex;
int iterated = 0;
while (iterated < CellPool.Count)
{
_cellInfo.cellIndex = cellIdx;
_cellInfo.dataIndex = dataIndex;
yield return _cellInfo;
cellIdx++;
if (cellIdx >= CellPool.Count)
cellIdx = 0;
dataIndex++;
iterated++;
}
} }
private void CreateCellPool() private void CreateCellPool()
{ {
ReturnCells(); //ReleaseCells();
CheckDataSourceCountChange(out _); CheckDataSourceCountChange(out _);
@ -256,8 +242,8 @@ namespace UnityExplorer.UI.Widgets
bottomPoolIndex++; bottomPoolIndex++;
var cell = Pool<T>.Borrow(); var cell = Pool<T>.Borrow();
DataSource.OnCellBorrowed(cell);
CellPool.Add(cell); CellPool.Add(cell);
DataSource.OnCellBorrowed(cell);
cell.Rect.SetParent(ScrollRect.content, false); cell.Rect.SetParent(ScrollRect.content, false);
currentPoolCoverage += PrototypeHeight; currentPoolCoverage += PrototypeHeight;
@ -266,26 +252,11 @@ namespace UnityExplorer.UI.Widgets
bottomDataIndex = CellPool.Count - 1; bottomDataIndex = CellPool.Count - 1;
LayoutRebuilder.ForceRebuildLayoutImmediate(Content); LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
// after creating pool, set displayed cells.
var enumerator = GetPoolEnumerator();
while (enumerator.MoveNext())
SetCell(CellPool[enumerator.Current.cellIndex], enumerator.Current.dataIndex);
}
private void SetRecycleViewBounds(bool extendPoolIfGrown)
{
RecycleViewBounds = new Vector2(Viewport.MinY() + HalfThreshold, Viewport.MaxY() - HalfThreshold);
if (extendPoolIfGrown && prevViewportHeight < Viewport.rect.height && prevViewportHeight != 0.0f)
CheckExtendCellPool();
prevViewportHeight = Viewport.rect.height;
} }
private bool CheckExtendCellPool() private bool CheckExtendCellPool()
{ {
CheckDataSourceCountChange(out _); CheckDataSourceCountChange();
var requiredCoverage = Math.Abs(RecycleViewBounds.y - RecycleViewBounds.x); var requiredCoverage = Math.Abs(RecycleViewBounds.y - RecycleViewBounds.x);
var currentCoverage = CellPool.Count * PrototypeHeight; var currentCoverage = CellPool.Count * PrototypeHeight;
@ -317,7 +288,7 @@ namespace UnityExplorer.UI.Widgets
} }
} }
RefreshCells(true); RefreshCells(true, true);
//ExplorerCore.Log("Anchor: " + Content.localPosition.y + ", prev: " + prevAnchor); //ExplorerCore.Log("Anchor: " + Content.localPosition.y + ", prev: " + prevAnchor);
//ExplorerCore.Log("Height: " + Content.rect.height + ", prev:" + prevHeight); //ExplorerCore.Log("Height: " + Content.rect.height + ", prev:" + prevHeight);
@ -343,27 +314,7 @@ namespace UnityExplorer.UI.Widgets
// Refresh methods // Refresh methods
private CellInfo _cellInfo = new CellInfo(); private bool CheckDataSourceCountChange() => CheckDataSourceCountChange(out _);
public IEnumerator<CellInfo> GetPoolEnumerator()
{
int cellIdx = topPoolIndex;
int dataIndex = TopDataIndex;
int iterated = 0;
while (iterated < CellPool.Count)
{
_cellInfo.cellIndex = cellIdx;
_cellInfo.dataIndex = dataIndex;
yield return _cellInfo;
cellIdx++;
if (cellIdx >= CellPool.Count)
cellIdx = 0;
dataIndex++;
iterated++;
}
}
private bool CheckDataSourceCountChange(out bool shouldJumpToBottom) private bool CheckDataSourceCountChange(out bool shouldJumpToBottom)
{ {
@ -428,7 +379,9 @@ namespace UnityExplorer.UI.Widgets
Content.anchoredPosition += Vector2.up * diff; Content.anchoredPosition += Vector2.up * diff;
} }
LayoutRebuilder.ForceRebuildLayoutImmediate(Content); if (andReloadFromDataSource)
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
SetScrollBounds(); SetScrollBounds();
ScrollRect.UpdatePrevData(); ScrollRect.UpdatePrevData();
} }
@ -456,7 +409,7 @@ namespace UnityExplorer.UI.Widgets
private void OnValueChangedListener(Vector2 val) private void OnValueChangedListener(Vector2 val)
{ {
if (WritingLocked || !m_initialized) if (WritingLocked || DataSource == null)
return; return;
if (InputManager.MouseScrollDelta != Vector2.zero) if (InputManager.MouseScrollDelta != Vector2.zero)
@ -529,8 +482,6 @@ namespace UnityExplorer.UI.Widgets
topPoolIndex = (topPoolIndex + 1) % CellPool.Count; topPoolIndex = (topPoolIndex + 1) % CellPool.Count;
} }
//LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
return -recycledheight; return -recycledheight;
} }
@ -572,8 +523,6 @@ namespace UnityExplorer.UI.Widgets
bottomPoolIndex = (bottomPoolIndex - 1 + CellPool.Count) % CellPool.Count; bottomPoolIndex = (bottomPoolIndex - 1 + CellPool.Count) % CellPool.Count;
} }
//LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
return recycledheight; return recycledheight;
} }
@ -624,7 +573,7 @@ namespace UnityExplorer.UI.Widgets
private void OnSliderValueChanged(float val) private void OnSliderValueChanged(float val)
{ {
if (this.WritingLocked || !m_initialized) if (this.WritingLocked || DataSource == null)
return; return;
this.WritingLocked = true; this.WritingLocked = true;

View File

@ -72,7 +72,7 @@ namespace UnityExplorer.UI.Widgets
RefreshData(true, true); RefreshData(true, true);
} }
public void RefreshData(bool andReload = false, bool hardReload = false) public void RefreshData(bool andReload = false, bool jumpToTop = false)
{ {
displayedObjects.Clear(); displayedObjects.Clear();
@ -86,10 +86,10 @@ namespace UnityExplorer.UI.Widgets
if (andReload) if (andReload)
{ {
if (!hardReload) if (!jumpToTop)
ScrollPool.RefreshCells(true); ScrollPool.Refresh(true);
else else
ScrollPool.Rebuild(); ScrollPool.Refresh(true, true);
} }
} }
@ -172,7 +172,7 @@ namespace UnityExplorer.UI.Widgets
cell.OnExpandToggled += ToggleExpandCell; cell.OnExpandToggled += ToggleExpandCell;
} }
public void OnCellReturned(TransformCell cell) public void ReleaseCell(TransformCell cell)
{ {
cell.OnExpandToggled -= ToggleExpandCell; cell.OnExpandToggled -= ToggleExpandCell;
} }

View File

@ -321,10 +321,9 @@
<Compile Include="Inspectors_OLD\InteractiveValues\InteractiveString.cs" /> <Compile Include="Inspectors_OLD\InteractiveValues\InteractiveString.cs" />
<Compile Include="Inspectors_OLD\InteractiveValues\InteractiveValue.cs" /> <Compile Include="Inspectors_OLD\InteractiveValues\InteractiveValue.cs" />
<Compile Include="UI\Widgets\ButtonRef.cs" /> <Compile Include="UI\Widgets\ButtonRef.cs" />
<Compile Include="UI\Panels\ObjectExplorer\ObjectSearch.cs" /> <Compile Include="UI\ObjectExplorer\ObjectSearch.cs" />
<Compile Include="UI\Panels\ObjectExplorer\SceneExplorer.cs" /> <Compile Include="UI\ObjectExplorer\SceneExplorer.cs" />
<Compile Include="UI\Widgets\ScrollPool\DataHeightCache.cs" /> <Compile Include="UI\Widgets\ScrollPool\DataHeightCache.cs" />
<Compile Include="UI\Widgets\ScrollPool\CellViewHolder.cs" />
<Compile Include="UI\Widgets\ScrollPool\ICell.cs" /> <Compile Include="UI\Widgets\ScrollPool\ICell.cs" />
<Compile Include="UI\Widgets\ScrollPool\IPoolDataSource.cs" /> <Compile Include="UI\Widgets\ScrollPool\IPoolDataSource.cs" />
<Compile Include="UI\Widgets\ScrollPool\ScrollPool.cs" /> <Compile Include="UI\Widgets\ScrollPool\ScrollPool.cs" />