コード例 #1
0
ファイル: UniPMWindow.cs プロジェクト: UniPM/UniPM
        static void Open()
        {
            UniPMWindow frameworkConfigEditorWindow = (UniPMWindow)GetWindow(typeof(UniPMWindow), true);

            frameworkConfigEditorWindow.titleContent = new GUIContent("UniPM");
            frameworkConfigEditorWindow.position     = new Rect(Screen.width / 2, Screen.height / 2, 800, 600f);
            frameworkConfigEditorWindow.LocalConfig  = PackageListConfig.GetInstalledPackageList();
            frameworkConfigEditorWindow.Init();
            frameworkConfigEditorWindow.Show();
        }
コード例 #2
0
        public UIInstalledPackageListPage(PackageListConfig localConfig)
        {
            ScrollView scrollView = new ScrollView();

            scrollView.Width  = 800;
            scrollView.Height = 600f;

            VerticalView verticalView = new VerticalView();

            verticalView.AddChild(new SpaceView());

            HorizontalView gitHorizontalView = new HorizontalView();

            LabelView labelView = new LabelView("Git Url:", 50, 30);

            labelView.FontColor = Color.white;
            gitHorizontalView.AddChild(labelView);
            TextField gitUrl = new TextField(PackageListConfig.GitUrl);

            gitUrl.OnTextChanged += text =>
            {
                PackageListConfig.GitUrl = text;
            };

            gitHorizontalView.AddChild(gitUrl);

            verticalView.AddChild(gitHorizontalView);

            HorizontalView horizontalView = new HorizontalView();

            horizontalView.AddChild(UIFactory.CreateTitleLabel("package name"));
            horizontalView.AddChild(UIFactory.CreateTitleLabel("version"));
            horizontalView.AddChild(UIFactory.CreateTitleLabel("release notes"));
            horizontalView.AddChild(UIFactory.CreateTitleLabel("folder"));

            verticalView.AddChild(horizontalView);
            scrollView.AddChild(verticalView);

            foreach (var localConfigPluginInfo in localConfig.InstalledPackageList)
            {
                var scrollItem = new HorizontalView();

                scrollItem.AddChild(UIFactory.CreateInstalledLabel(localConfigPluginInfo.Name));
                scrollItem.AddChild(UIFactory.CreateInstalledLabel(string.Format("v{0}", localConfigPluginInfo.Version)));
                scrollItem.AddChild(UIFactory.CreateInstalledLabel(localConfigPluginInfo.ReleaseNote));
                scrollItem.AddChild(new ButtonView("Download", 65, 25, () => UniPMWindow.DownloadZip(localConfigPluginInfo)));
                scrollView.AddChild(scrollItem);
            }

            scrollView.AddChild(new FlexibaleSpaceView());

            AddChild(scrollView);
        }
コード例 #3
0
ファイル: PackageListConfig.cs プロジェクト: UniPM/UniPM
        /// <summary>
        /// 剔除掉服务端同步的插件,再进行合并
        /// TODO: 只剔除一个就可以
        /// </summary>
        /// <returns></returns>
        public static PackageListConfig MergeGitClonedPackageList(PackageConfig toUploadPackageConfig)
        {
            string clonedConfigFilePath = Application.dataPath.CombinePath(toUploadPackageConfig.PackageServerGitUrl.GetLastWord()).CombinePath("PackageList.json");

            Log.I(clonedConfigFilePath);

            PackageListConfig clonedConfig = SerializeHelper.LoadJson <PackageListConfig>(clonedConfigFilePath);

            clonedConfig.InstalledPackageList.RemoveAll(config => config.Name.Equals(toUploadPackageConfig.Name));

            clonedConfig.InstalledPackageList.Add(toUploadPackageConfig);

            return(clonedConfig);
        }
コード例 #4
0
ファイル: UniPMWindow.cs プロジェクト: UniPM/UniPM
        static void UploadPackage()
        {
            string packagePath       = MouseSelector.GetSelectedPathOrFallback();
            string packageConfigPath = packagePath.EndsWith(".asset") ? packagePath : packagePath.Append(".asset").ToString();

            if (File.Exists(packageConfigPath))
            {
                string err = string.Empty;

                PackageConfig config             = PackageConfig.LoadFromPath(packageConfigPath);
                string        serverUploaderPath = Application.dataPath.CombinePath(config.PackageServerGitUrl.GetLastWord());

                if (!Directory.Exists(serverUploaderPath))
                {
                    RunCommand(string.Empty, "git clone ".Append(config.PackageServerGitUrl).ToString());
                }

                ZipUtil.ZipDirectory(config.PackagePath,
                                     IOUtils.CreateDirIfNotExists(serverUploaderPath.CombinePath(config.Name)).CombinePath(config.Name + ".zip"));

                PackageListConfig
                .MergeGitClonedPackageList(config)
                .SaveExport(config.PackageServerGitUrl);

                RunCommand(config.PackageServerGitUrl.GetLastWord(), string.Format(
                               "git add . && git commit -m \"{0}\" && git push",
                               config.ReleaseNote.IsNullOrEmpty()
                                                ? "no release note"
                                                : config.Name.Append(" ").Append(config.Version).AppendFormat(" {0}", config.ReleaseNote).ToString()));

                RunCommand(string.Empty, "rm -rf " + config.PackageServerGitUrl.GetLastWord());

                AssetDatabase.Refresh();

                Application.OpenURL(config.PackageServerGitUrl);
            }
            else
            {
                Log.W("no package.json file in folder:{0}", packagePath);
            }
        }
コード例 #5
0
ファイル: PackageListConfig.cs プロジェクト: UniPM/UniPM
        public static PackageListConfig GetInstalledPackageList()
        {
            PackageListConfig localConfig = new PackageListConfig();

            localConfig.InstalledPackageList = new List <PackageConfig>();

            IOUtils.GetDirSubFilePathList(Application.dataPath, true, ".asset").ForEach(fileName =>
            {
                if (fileName.EndsWith(".asset") && Directory.Exists(fileName.Replace(".asset", string.Empty)) && !fileName.Contains("PackageListServer"))
                {
                    fileName = fileName.Replace(Application.dataPath, "Assets");
                    var installedPackageInfo = AssetDatabase.LoadAssetAtPath <PackageConfig>(fileName);
                    if (null != installedPackageInfo)
                    {
                        localConfig.InstalledPackageList.Add(installedPackageInfo);
                    }
                }
            });

            return(localConfig);
        }
コード例 #6
0
        public UIOnlinePackageListPage(PackageListConfig remoteConfig)
        {
            ScrollView scrollView = new ScrollView();

            scrollView.Width  = 800;
            scrollView.Height = 600f;

            VerticalView verticalView = new VerticalView();

            verticalView.AddChild(new SpaceView());

            HorizontalView horizontalView = new HorizontalView();

            horizontalView.AddChild(UIFactory.CreateTitleLabel("package name"));
            horizontalView.AddChild(UIFactory.CreateTitleLabel("version"));
            horizontalView.AddChild(UIFactory.CreateTitleLabel("release notes"));
            horizontalView.AddChild(UIFactory.CreateTitleLabel("folder"));

            verticalView.AddChild(horizontalView);
            scrollView.AddChild(verticalView);

            foreach (var localConfigPluginInfo in remoteConfig.InstalledPackageList)
            {
                var scrollItem = new HorizontalView();

                scrollItem.AddChild(UIFactory.CreateInstalledLabel(localConfigPluginInfo.Name));
                scrollItem.AddChild(UIFactory.CreateInstalledLabel(string.Format("v{0}", localConfigPluginInfo.Version)));
                scrollItem.AddChild(UIFactory.CreateInstalledLabel(localConfigPluginInfo.ReleaseNote));
                scrollItem.AddChild(new ButtonView("Download", 65, 25, () => UniPMWindow.DownloadZip(localConfigPluginInfo)));

                scrollView.AddChild(scrollItem);
            }

            scrollView.AddChild(new FlexibaleSpaceView());

            AddChild(scrollView);
        }
コード例 #7
0
ファイル: UniPMWindow.cs プロジェクト: UniPM/UniPM
 public static void ExtractGameServer()
 {
     PackageListConfig.GetInstalledPackageList().SaveExport();
 }