예제 #1
0
        private void SetupSettings()
        {
            foreach (SettingPage page in asset.Pages)
            {
                GameObject navEntry = Instantiate(navigationEntryPreFab, navigationContent.transform);
                navEntry.name = page.Name + "_NavEntry";
                navEntry.SetActive(true);
                Tab navTab = navEntry.GetComponent <Tab>();
                navTab.ToolTipText = page.Name;
                navTab.Sprite      = page.Image;

                GameObject pageObj = Instantiate(pagePreFab, bodyContent.transform);
                pageObj.name = page.Name + "_Page";
                TabPage tabPage = pageObj.GetComponent <TabPage>();

                tabController.AddPage(navTab, pageObj);

                if (page.Name == "keybindings")
                {
                    KeyBindingSetup(pageObj);
                    continue;
                }

                foreach (SettingEntry entry in page.Settings)
                {
                    GameObject entryObj = Instantiate(entry.Type switch
                    {
                        SettingEntryValueType.Toggle => togglePreFab,
                        SettingEntryValueType.Range => rangePreFab,
                        SettingEntryValueType.Selection => selectionPreFab,
                        _ => throw new ArgumentOutOfRangeException()
                    }, tabPage.content);