Beispiel #1
0
        public FrameworkPMView()
        {
            mPackageDatas = PackageInfosRequestCache.Get().PackageDatas;

            InstalledPackageVersions.Reload();

            EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas => { mPackageDatas = packageDatas; }));
        }
Beispiel #2
0
 public static void GetAllPackagesInfo()
 {
     EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas =>
     {
         Dispatch("setPackages", packageDatas);
     }
                                                             ));
 }
Beispiel #3
0
        public void OnGUI()
        {
            mScrollPos = GUILayout.BeginScrollView(mScrollPos, true, true, GUILayout.Width(580), GUILayout.Height(300));

            GUILayout.Label("类型:" + mPackageVersion.Type);

            mReadme.items.ForEach(item =>
            {
                new CustomView(() =>
                {
                    GUILayout.BeginHorizontal(EditorStyles.helpBox);
                    GUILayout.BeginVertical();
                    GUILayout.BeginHorizontal();

                    GUILayout.Label("version: " + item.version, GUILayout.Width(130));
                    GUILayout.Label("author: " + item.author);
                    GUILayout.Label("date: " + item.date);

                    if (item.author == User.Username.Value)
                    {
                        if (GUILayout.Button("删除"))
                        {
                            EditorActionKit.ExecuteNode(new DeletePackage(item.PackageId)
                            {
                                OnEndedCallback = () =>
                                {
                                    mReadme.items.Remove(item);
                                }
                            });
                        }
                    }


                    GUILayout.EndHorizontal();
                    GUILayout.Label(item.content);
                    GUILayout.EndVertical();

                    GUILayout.EndHorizontal();
                }).DrawGUI();
            });

            GUILayout.EndScrollView();
        }
Beispiel #4
0
        private void ProcessCompare()
        {
            if (Network.IsReachable)
            {
                EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas =>
                {
                    if (packageDatas == null)
                    {
                        return;
                    }

                    if (PackageKitModel.State.VersionCheck)
                    {
                        CheckNewVersionDialog(packageDatas, PackageInfosRequestCache.Get().PackageDatas);
                    }
                }));
            }

            ReCheckConfigDatas();
            GoToWait();
        }
Beispiel #5
0
        public override void OnGUI()
        {
            base.OnGUI();

            mRootLayout.OnGUI();

            GUILayout.BeginVertical("box");

            mFrameworkInfoLayout.OnGUI();

            mToolbarIndex = GUILayout.Toolbar(mToolbarIndex, ToolbarNames);

            // 这里开始具体的内容
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("Package", GUILayout.Width(150));
            GUILayout.Label("Server", GUILayout.Width(80));
            GUILayout.Label("Local", GUILayout.Width(80));
            GUILayout.Label("Access Right", GUILayout.Width(80));
            GUILayout.Label("Doc", new GUIStyle {
                alignment = TextAnchor.MiddleCenter, fixedWidth = 40f
            });
            GUILayout.Label("Action", new GUIStyle {
                alignment = TextAnchor.MiddleCenter, fixedWidth = 100f
            });
            GUILayout.Label("Release Note", new GUIStyle {
                alignment = TextAnchor.MiddleCenter, fixedWidth = 100f
            });
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical("box");

            mScrollPos = GUILayout.BeginScrollView(mScrollPos, false, true, GUILayout.Height(240));

            foreach (var packageData in SelectedPackageType)
            {
                GUILayout.Space(2);
                GUILayout.BeginHorizontal();
                GUILayout.Label(packageData.Name, GUILayout.Width(150));
                GUILayout.Label(packageData.Version, GUILayout.Width(80));
                var installedPackage = InstalledPackageVersions.FindVersionByName(packageData.Name);
                GUILayout.Label(installedPackage != null ? installedPackage.Version : " ", GUILayout.Width(80));
                GUILayout.Label(packageData.AccessRight.ToString(), GUILayout.Width(80));

                if (packageData.DocUrl.IsNotNullAndEmpty())
                {
                    if (GUILayout.Button("Doc", GUILayout.Width(40)))
                    {
                        Application.OpenURL(packageData.DocUrl);
                    }
                }
                else
                {
                    GUILayout.Space(40);
                }

                if (installedPackage == null)
                {
                    if (GUILayout.Button("Import", GUILayout.Width(90)))
                    {
                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                    }
                }
                else if (installedPackage != null && packageData.VersionNumber > installedPackage.VersionNumber)
                {
                    if (GUILayout.Button("Update", GUILayout.Width(90)))
                    {
                        var path = Application.dataPath.Replace("Assets", packageData.InstallPath);

                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }

                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                    }
                }
                else if (installedPackage.IsNotNull() && packageData.VersionNumber == installedPackage.VersionNumber)
                {
                    if (GUILayout.Button("Reimport", GUILayout.Width(90)))
                    {
                        var path = Application.dataPath.Replace("Assets", packageData.InstallPath);

                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }

                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));
                        PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                    }
                }
                else if (installedPackage != null)
                {
                    // maybe support upload?
                    GUILayout.Space(94);
                }

                if (GUILayout.Button("Release Notes", GUILayout.Width(100)))
                {
                    ReadmeWindow.Init(packageData.readme, packageData.PackageVersions.First());
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();

            GUILayout.Space(2);

            GUILayout.EndVertical();

            GUILayout.EndVertical();


            GUILayout.Space(50);
        }
Beispiel #6
0
        protected override void OnRefresh()
        {
            Clear();

            new EGO.Framework.SpaceView(2).AddTo(this);

            new EGO.Framework.LabelView(mPackageData.Name)
            .FontBold()
            .Width(150)
            .AddTo(this);

            new EGO.Framework.LabelView(mPackageData.Version)
            .TextMiddleCenter()
            .Width(80)
            .AddTo(this);

            var installedPackage = InstalledPackageVersions.FindVersionByName(mPackageData.Name);

            new EGO.Framework.LabelView(installedPackage != null ? installedPackage.Version : " ")
            .TextMiddleCenter()
            .Width(80)
            .AddTo(this);

            new EGO.Framework.LabelView(mPackageData.AccessRight.ToString())
            .TextMiddleCenter()
            .Width(80)
            .AddTo(this);

            if (mPackageData.DocUrl.IsNotNullAndEmpty())
            {
                new ButtonView(LocaleText.Doc, () => { }).AddTo(this);
            }
            else
            {
                new EGO.Framework.SpaceView(40).AddTo(this);
            }


            if (installedPackage == null)
            {
                new ButtonView(LocaleText.Import, () =>
                {
                    EditorActionKit.ExecuteNode(new InstallPackage(mPackageData));

                    PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                })
                .Width(90)
                .AddTo(this);
            }

            else if (installedPackage != null && mPackageData.VersionNumber > installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Update, () =>
                {
                    var path = Application.dataPath.Replace("Assets", mPackageData.InstallPath);

                    path.DeleteDirIfExists();

                    EditorActionKit.ExecuteNode(new InstallPackage(mPackageData));

                    PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                })
                .Width(90)
                .AddTo(this);
            }
            else if (installedPackage.IsNotNull() &&
                     mPackageData.VersionNumber == installedPackage.VersionNumber)
            {
                new ButtonView(LocaleText.Reimport, () =>
                {
                    var path = Application.dataPath.Replace("Assets", mPackageData.InstallPath);

                    path.DeleteDirIfExists();

                    EditorActionKit.ExecuteNode(new InstallPackage(mPackageData));
                    PackageApplication.Container.Resolve <PackageKitWindow>().Close();
                })
                .Width(90)
                .AddTo(this);
            }
            else if (installedPackage != null)
            {
                new EGO.Framework.SpaceView(94).AddTo(this);
            }

            new ButtonView(LocaleText.ReleaseNotes,
                           () => { ReadmeWindow.Init(mPackageData.readme, mPackageData.PackageVersions.First()); }).Width(100)
            .AddTo(this);
        }