Support for overflowing tabs

This commit is contained in:
tverona1
2019-08-01 23:29:20 -07:00
parent a5c987acef
commit f14cc15164
7 changed files with 1720 additions and 9 deletions
+11 -4
View File
@@ -45,6 +45,9 @@ namespace QuestAppLauncher
// Tab container
public GameObject tabContainer;
// Tab container
public GameObject tabContainerContent;
// Tracking space
public GameObject trackingSpace;
@@ -386,9 +389,9 @@ namespace QuestAppLauncher
Dictionary<string, string> iconOverrides)
{
// Destroy existing scrollviews and tabs
for (int i = 0; i < this.tabContainer.transform.childCount; i++)
for (int i = 0; i < this.tabContainerContent.transform.childCount; i++)
{
Destroy(this.tabContainer.transform.GetChild(i).gameObject);
Destroy(this.tabContainerContent.transform.GetChild(i).gameObject);
Destroy(this.scrollContainer.transform.GetChild(i).gameObject);
}
@@ -453,12 +456,12 @@ namespace QuestAppLauncher
SetGridSize(gridContent, config.gridSize.rows, config.gridSize.cols);
// Create tab
var tab = (GameObject)Instantiate(this.prefabTab, this.tabContainer.transform);
var tab = (GameObject)Instantiate(this.prefabTab, this.tabContainerContent.transform);
tab.GetComponentInChildren<TextMeshProUGUI>().text = tabName;
var toggle = tab.GetComponent<Toggle>();
toggle.isOn = isFirstTab;
toggle.group = this.tabContainer.GetComponent<ToggleGroup>();
toggle.group = this.tabContainerContent.GetComponent<ToggleGroup>();
toggle.onValueChanged.AddListener(scrollView.SetActive);
if (isNoneTab)
@@ -473,6 +476,10 @@ namespace QuestAppLauncher
gridContents[tabName] = scrollView.GetComponent<ScrollRect>().content.gameObject;
}
// Refresh tab prev / next buttons
this.tabContainer.GetComponent<ScrollButtonHandler>().RefreshScrollContent(tabs.Count);
this.tabContainer.GetComponent<ScrollRectColliderMask>().Refresh();
// Populate grid with app information (name & icon)
// Sort by app name
foreach (var app in apps.OrderBy(key => key.Value.AppName))