Пример #1
0
        public MultiSelectFoldout(PackageToolBarRegularButton button = null)
        {
            m_Toggle = new Toggle {
                name = "multiSelectFoldoutToggle", classList = { "containerTitle", "expander" }
            };
            m_Container = new VisualElement {
                name = "multiSelectFoldoutContainer"
            };
            Add(m_Toggle);
            Add(m_Container);

            SetExpanded(false);
            m_Toggle.RegisterValueChangedCallback(evt => SetExpanded(evt.newValue));

            m_Button = button;
            if (button != null)
            {
                m_Toggle.Add(button.element);
            }
        }
        public PackageDetailsVersionHistoryItem(ResourceLoader resourceLoader,
                                                PackageDatabase packageDatabase,
                                                UpmCache upmCache,
                                                ApplicationProxy applicationProxy,
                                                IOProxy ioProxy,
                                                IPackageVersion version,
                                                bool multipleVersionsVisible,
                                                bool isLatestVersion,
                                                bool expanded,
                                                PackageToolBarRegularButton button)
        {
            m_Version          = version;
            m_PackageDatabase  = packageDatabase;
            m_UpmCache         = upmCache;
            m_ApplicationProxy = applicationProxy;
            m_IOProxy          = ioProxy;

            var root = resourceLoader.GetTemplate("PackageDetailsVersionHistoryItem.uxml");

            Add(root);
            m_Cache = new VisualElementCache(root);

            SetExpanded(expanded);
            versionHistoryItemToggle.RegisterValueChangedCallback(evt =>
            {
                SetExpanded(evt.newValue);
                onToggleChanged?.Invoke(evt.newValue);
            });

            m_Button = button;
            if (m_Button != null)
            {
                versionHistoryItemToggleRightContainer.Add(m_Button.element);
            }

            versionHistoryItemChangeLogLink.clickable.clicked += () => UpmPackageDocs.ViewUrl(UpmPackageDocs.GetChangelogUrl(m_Version), UpmPackageDocs.GetOfflineChangelog(m_IOProxy, m_Version), L10n.Tr("changelog"), "viewChangelog", m_Version, m_Version.package, m_ApplicationProxy);

            Refresh(multipleVersionsVisible, isLatestVersion);
        }