Example #1
0
        private void onPackageContextClicked(CustomPackageManagerPackage contextClickedItem)
        {
            var menu = new GenericMenu();

            menu.AddItem(new GUIContent($"Delete [ {contextClickedItem.PackageName} ]"), false, () => {
                onRemoveDependencies(contextClickedItem.PackageName);
            });
            if (contextClickedItem.Version.Contains(".git") && model.ManifestJsonData.ContainsKey("lock"))
            {
                menu.AddSeparator("");
                menu.AddItem(new GUIContent("Update Git Package"), false, () =>
                {
                    onUpdateGitPackage(contextClickedItem.PackageName);
                });
            }
            menu.ShowAsContext();
        }
        private void onInitialize(JsonData manifestData)
        {
            noSpaceBoxStyle = new GUIStyle("Tooltip")
            {
                margin  = new RectOffset(0, 0, 0, 0),
                padding = new RectOffset(0, 0, 0, 0),
            };
            searchTextField         = new GUIStyle("SearchTextField");
            searchFieldCancelButton = new GUIStyle("SearchCancelButton");

            {
                packages = new List <CustomPackageManagerPackage>();
                var dependencies = manifestData["dependencies"];
                var counter      = 0;
                foreach (var pkg in dependencies.Keys)
                {
                    var p = new CustomPackageManagerPackage(pkg, dependencies[pkg].ToString())
                    {
                        id    = ++counter,
                        depth = 0,
                        name  = dependencies[pkg].ToString(),
                    };
                    packages.Add(p);
                }
                packages.Insert(0, CustomPackageManagerPackage.Root);

                // check registry exists
                if (manifestData.ContainsKey("registry"))
                {
                    registryURL = manifestData["registry"]?.ToString();
                }
            }

            {
                // check scopedRegistry exists
                scopedRegistries = new List <CustomPackageManagerScopedRegistry>();
                if (manifestData.ContainsKey("scopedRegistries"))
                {
                    var scopes = manifestData["scopedRegistries"];
                    if (scopes != null)
                    {
                        var counter = 1000; // holy shit
                        for (int i = 0; i < scopes.Count; i++)
                        {
                            var srName    = scopes[i]["name"].ToString();
                            var url       = scopes[i]["url"].ToString();
                            var tmp       = scopes[i]["scopes"];
                            var scopeList = "";
                            for (int j = 0; j < tmp.Count; j++)
                            {
                                scopeList += tmp[j].ToString() + (j == tmp.Count - 1 ? "" : ",");
                            }
                            var sr = new CustomPackageManagerScopedRegistry(srName, url, scopeList)
                            {
                                id    = ++counter,
                                depth = 0,
                                name  = scopeList,
                            };
                            scopedRegistries.Add(sr);
                        }
                    }
                }
                scopedRegistries.Insert(0, CustomPackageManagerScopedRegistry.Root);
            }

            packageTreeViewInitialize();
            scopedRegistryTreeViewInitialize();
        }
Example #3
0
 private void onPackageVersionChanged(CustomPackageManagerPackage versionChangedItem)
 {
     onAddDependencies(versionChangedItem.PackageName, versionChangedItem.Version);
 }