示例#1
0
        // Token: 0x0600108F RID: 4239 RVA: 0x0006CE4C File Offset: 0x0006B24C
        public ContentBrowserRootDirectoryButton(RootContentDirectory newDirectory)
        {
            this.directory           = newDirectory;
            base.transform.anchorMin = new Vector2(0f, 1f);
            base.transform.anchorMax = new Vector2(1f, 1f);
            base.transform.pivot     = new Vector2(0.5f, 1f);
            base.transform.sizeDelta = new Vector2(0f, 30f);
            Sleek2Label sleek2Label = new Sleek2Label();

            sleek2Label.transform.reset();
            sleek2Label.textComponent.text  = this.directory.name;
            sleek2Label.textComponent.color = Sleek2Config.darkTextColor;
            this.addElement(sleek2Label);
        }
        public ContentBrowserWindow()
        {
            base.gameObject.name       = "Content_Browser";
            base.tab.label.translation = new TranslatedText(new TranslationReference("SDG", "Devkit.Window.Content_Browser.Title"));
            base.tab.label.translation.format();
            this.rootsBox      = new Sleek2Element();
            this.rootsBox.name = "Roots";
            this.addElement(this.rootsBox);
            this.itemsBox      = new Sleek2Element();
            this.itemsBox.name = "Items";
            this.addElement(this.itemsBox);
            this.separator = new Sleek2Separator();
            this.separator.handle.value = 0.25f;
            this.separator.handle.a     = this.rootsBox.transform;
            this.separator.handle.b     = this.itemsBox.transform;
            this.addElement(this.separator);
            this.rootsView = new Sleek2Scrollview();
            this.rootsView.transform.reset();
            this.rootsView.transform.offsetMin = new Vector2(5f, 5f);
            this.rootsView.transform.offsetMax = new Vector2(-5f, -5f);
            this.rootsView.vertical            = true;
            this.rootsPanel      = new Sleek2VerticalScrollviewContents();
            this.rootsPanel.name = "Panel";
            this.rootsView.panel = this.rootsPanel;
            this.rootsBox.addElement(this.rootsView);
            foreach (KeyValuePair <string, RootContentDirectory> keyValuePair in Assets.rootContentDirectories)
            {
                RootContentDirectory value = keyValuePair.Value;
                ContentBrowserRootDirectoryButton contentBrowserRootDirectoryButton = new ContentBrowserRootDirectoryButton(value);
                contentBrowserRootDirectoryButton.clicked += this.handleRootDirectoryButtonClicked;
                this.rootsPanel.addElement(contentBrowserRootDirectoryButton);
            }
            this.pathPanel      = new Sleek2HorizontalScrollviewContents();
            this.pathPanel.name = "Path";
            this.pathPanel.transform.anchorMin = new Vector2(0f, 1f);
            this.pathPanel.transform.anchorMax = new Vector2(1f, 1f);
            this.pathPanel.transform.pivot     = new Vector2(0f, 1f);
            this.pathPanel.transform.offsetMin = new Vector2(5f, -55f);
            this.pathPanel.transform.offsetMax = new Vector2(5f, -5f);
            this.itemsBox.addElement(this.pathPanel);
            this.itemsView = new Sleek2Scrollview();
            this.itemsView.transform.reset();
            this.itemsView.transform.offsetMin = new Vector2(5f, 5f);
            this.itemsView.transform.offsetMax = new Vector2(-5f, -60f);
            this.itemsView.vertical            = true;
            this.itemsPanel      = new Sleek2Element();
            this.itemsPanel.name = "Panel";
            GridLayoutGroup gridLayoutGroup = this.itemsPanel.gameObject.AddComponent <GridLayoutGroup>();

            gridLayoutGroup.cellSize = new Vector2(200f, 50f);
            gridLayoutGroup.spacing  = new Vector2(5f, 5f);
            ContentSizeFitter contentSizeFitter = this.itemsPanel.gameObject.AddComponent <ContentSizeFitter>();

            contentSizeFitter.verticalFit = 2;
            this.itemsPanel.transform.reset();
            this.itemsPanel.transform.pivot = new Vector2(0f, 1f);
            this.itemsView.panel            = this.itemsPanel;
            this.itemsBox.addElement(this.itemsView);
            ContentBrowserWindow.browsed += this.handleBrowsed;
            this.handleBrowsed(ContentBrowserWindow.currentDirectory);
        }