Esempio n. 1
0
        protected override void BuildUI()
        {
            var selectionBorder = new VisualElement();

            selectionBorder.AddToClassList("ge-node__selection-border");
            Add(selectionBorder);

            var contentContainerElement = new VisualElement();

            contentContainerElement.AddToClassList("ge-node__content-container");
            selectionBorder.Add(contentContainerElement);
            m_ContentContainer = contentContainerElement;

            base.BuildUI();

            if (TitleContainer != null)
            {
                // Add an icon and wrap the icon and the title label.

                var iconAndTitleWrapper = new VisualElement();
                iconAndTitleWrapper.AddToClassList("ge-node__icon-title-wrapper");

                var icon = new VisualElement();
                icon.AddToClassList(k_UssClassName + "__icon");
                icon.AddToClassList(NodeModel.IconTypeString);
                iconAndTitleWrapper.Insert(0, icon);

                var tcIndex = TitleContainer.IndexOf(TitleLabel);
                TitleContainer.Insert(tcIndex, iconAndTitleWrapper);
                iconAndTitleWrapper.Add(TitleLabel);
            }

            styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>(UICreationHelper.templatePath + "Node.uss"));

            if (NodeModel.HasProgress && TitleContainer != null)
            {
                m_CoroutineProgressBar = new ProgressBar();
                m_CoroutineProgressBar.AddToClassList(k_UssClassName + "__progress-bar");
                TitleContainer.Insert(1, m_CoroutineProgressBar);
            }

            this.AddOverlay();
        }