Auto-cleanup

This commit is contained in:
Sinai
2021-06-05 19:36:09 +10:00
parent 8fab9e6268
commit 16335c1bc4
57 changed files with 194 additions and 199 deletions

View File

@ -169,7 +169,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
// Setting autocomplete cell buttons
private readonly Color selectedSuggestionColor = new Color(45/255f, 75/255f, 80/255f);
private readonly Color selectedSuggestionColor = new Color(45 / 255f, 75 / 255f, 80 / 255f);
private readonly Color inactiveSuggestionColor = new Color(0.11f, 0.11f, 0.11f);
private List<Suggestion> GetEntries() => Suggestions;
@ -300,7 +300,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
{
dataHandler = new ButtonListHandler<Suggestion, ButtonCell>(scrollPool, GetEntries, SetCell, ShouldDisplay, OnCellClicked);
scrollPool = UIFactory.CreateScrollPool<ButtonCell>(this.content, "AutoCompleter", out GameObject scrollObj,
scrollPool = UIFactory.CreateScrollPool<ButtonCell>(this.content, "AutoCompleter", out GameObject scrollObj,
out GameObject scrollContent);
scrollPool.Initialize(dataHandler);
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
@ -308,7 +308,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
navigationTipRow = UIFactory.CreateHorizontalGroup(this.content, "BottomRow", true, true, true, true, 0, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(navigationTipRow, minHeight: 20, flexibleWidth: 9999);
UIFactory.CreateLabel(navigationTipRow, "HelpText", "Up/Down to select, Enter to use, Esc to close",
UIFactory.CreateLabel(navigationTipRow, "HelpText", "Up/Down to select, Enter to use, Esc to close",
TextAnchor.MiddleLeft, Color.grey, false, 13);
UIRoot.SetActive(false);

View File

@ -91,7 +91,7 @@ namespace UnityExplorer.UI.Widgets
Slider.interactable = false;
return;
}
var handleHeight = viewportHeight * Math.Min(1, viewportHeight / totalHeight);
handleHeight = Math.Max(15f, handleHeight);

View File

@ -26,7 +26,7 @@ namespace UnityExplorer.UI.Widgets
}
private string currentFilter;
public ButtonListHandler(ScrollPool<TCell> scrollPool, Func<List<TData>> getEntriesMethod,
public ButtonListHandler(ScrollPool<TCell> scrollPool, Func<List<TData>> getEntriesMethod,
Action<TCell, int> setICellMethod, Func<TData, string, bool> shouldDisplayMethod,
Action<int> onCellClickedMethod)
{

View File

@ -4,9 +4,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityExplorer.UI.Models;
namespace UnityExplorer.UI.Widgets

View File

@ -118,7 +118,7 @@ namespace UnityExplorer.UI.Widgets
if (!heightCache.Any())
return;
totalHeight -= heightCache[heightCache.Count - 1];
totalHeight -= heightCache[heightCache.Count - 1];
heightCache.RemoveAt(heightCache.Count - 1);
int idx = heightCache.Count;

View File

@ -11,7 +11,7 @@ using UnityExplorer.UI.Panels;
namespace UnityExplorer.UI.Widgets
{
public struct CellInfo
public struct CellInfo
{
public int cellIndex, dataIndex;
}
@ -120,7 +120,7 @@ namespace UnityExplorer.UI.Widgets
OnHeightChanged?.Invoke();
}
}
}
#endregion
@ -129,7 +129,7 @@ namespace UnityExplorer.UI.Widgets
public void Refresh(bool setCellData, bool jumpToTop = false)
{
if (jumpToTop)
{
{
bottomDataIndex = CellPool.Count - 1;
Content.anchoredPosition = Vector2.zero;
}

View File

@ -33,10 +33,10 @@ namespace UnityExplorer.UI.Widgets
{
bool ret = false;
if (Value != transform
|| depth != Depth
|| ChildCount != transform.childCount
|| Name != transform.name
if (Value != transform
|| depth != Depth
|| ChildCount != transform.childCount
|| Name != transform.name
|| Enabled != transform.gameObject.activeSelf)
{
Value = transform;