Ejemplo n.º 1
0
        public AssetBrowserRootDirectoryButton(RootAssetDirectory 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);
        }
Ejemplo n.º 2
0
        // Token: 0x06001078 RID: 4216 RVA: 0x0006C564 File Offset: 0x0006A964
        public AssetBrowserWindow()
        {
            base.gameObject.name       = "Asset_Browser";
            base.tab.label.translation = new TranslatedText(new TranslationReference("SDG", "Devkit.Window.Asset_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);
            for (int i = 0; i < Assets.rootAssetDirectories.Count; i++)
            {
                RootAssetDirectory newDirectory = Assets.rootAssetDirectories[i];
                AssetBrowserRootDirectoryButton assetBrowserRootDirectoryButton = new AssetBrowserRootDirectoryButton(newDirectory);
                assetBrowserRootDirectoryButton.clicked += this.handleRootDirectoryButtonClicked;
                this.rootsPanel.addElement(assetBrowserRootDirectoryButton);
            }
            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 = ContentSizeFitter.FitMode.PreferredSize;
            this.itemsPanel.transform.reset();
            this.itemsPanel.transform.pivot = new Vector2(0f, 1f);
            this.itemsView.panel            = this.itemsPanel;
            this.itemsBox.addElement(this.itemsView);
            AssetBrowserWindow.browsed += this.handleBrowsed;
            this.handleBrowsed(AssetBrowserWindow.currentDirectory);
        }