Exemple #1
0
        public static SettingsProvider PreferenceView()
        {
            var manifestJson = FileUtility.LoadManifestJson();
            var model        = new CustomPackageManagerModel(manifestJson);
            var view         = new CustomPackageManagerGUI();
            var presenter    = new CustomPackageManagerPresenter(model, view);

            var provider = new SettingsProvider("Preferences/CustomPackageManager", SettingsScope.User)
            {
                label           = "CustomPackageManager",
                activateHandler = (searchContext, rootElement) => {
                    var basicContainer = new VisualElement()
                    {
                        style =
                        {
                            paddingTop    =                    5,
                            paddingLeft   =                   10,
                            paddingRight  =                   10,
                            flexDirection = FlexDirection.Column,
                        }
                    };

                    var titleElement = new VisualElement();
                    titleElement.Add(new Label()
                    {
                        text  = "CustomPackageManager",
                        style =
                        {
                            fontSize                =             15,
                            unityFontStyleAndWeight = FontStyle.Bold,
                            flexBasis =             25,
                            minHeight =             25,
                        }
                    });

                    var imguiContainer = new IMGUIContainer(() =>
                    {
                        view.OnIMGUI();
                    });
                    imguiContainer.style.flexBasis = 1000;

                    basicContainer.Add(titleElement);
                    basicContainer.Add(imguiContainer);
                    rootElement.Add(basicContainer);
                },
                guiHandler = (searchText) => {
                },
                keywords   = new[] { "CustomPackageManager" }
            };

            return(provider);
        }
Exemple #2
0
        public CustomPackageManagerPresenter(CustomPackageManagerModel model, CustomPackageManagerGUI view)
        {
            this.model = model;
            this.view  = view;

            this.view.GetManifestJsonData     += GetManifestData;
            this.view.OnAddDependencies       += onAddDependencies;
            this.view.OnAddRegistry           += onAddRegistry;
            this.view.OnPackageContextClicked += onPackageContextClicked;
            this.view.OnChangePackageVersion  += onPackageVersionChanged;

            this.view.OnAddScopedRegistry            += onAddScopedRegistries;
            this.view.OnScopedRegistryContextClicked += onScopedRegistryContextClicked;
            this.view.OnScopedRegistryScopesChange   += onScopedRegistryScopesChange;
        }