static void Open() { PreferencesWindow frameworkConfigEditorWindow = (PreferencesWindow)GetWindow(typeof(PreferencesWindow), true); frameworkConfigEditorWindow.titleContent = new GUIContent("QFrameworkConfig"); frameworkConfigEditorWindow.CurConfigData = QFrameworkConfigData.Load(); frameworkConfigEditorWindow.Show(); frameworkConfigEditorWindow.OnShow(); }
public void Init(PreferencesWindow window) { mMainWindow = window; mPackageDatas = PackageInfosRequestCache.Get().PackageDatas; InstalledPackageVersions.Reload(); EditorActionKit.ExecuteNode(new GetAllRemotePackageInfo(packageDatas => { mPackageDatas = packageDatas; })); }
public void OnGUI() { GUILayout.Label("Framework:"); GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("QFramework:{0}", mPackageDatas.Find(packageData => packageData.Name == "Framework").Version), GUILayout.Width(150)); VersionCheck = GUILayout.Toggle(VersionCheck, "Version Check"); GUILayout.EndHorizontal(); 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("Right", GUILayout.Width(120)); GUILayout.Label("Action", GUILayout.Width(100)); GUILayout.Label("Readme", GUILayout.Width(100)); 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(120)); if (installedPackage == null) { if (GUILayout.Button("Import", GUILayout.Width(90))) { EditorActionKit.ExecuteNode(new InstallPackage(packageData)); mMainWindow.Close(); mMainWindow = null; } } 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)); mMainWindow.Close(); mMainWindow = null; } } else if (installedPackage != null) { // maybe support upload? GUILayout.Space(94); } if (GUILayout.Button("Readme", GUILayout.Width(90))) { ReadmeWindow.Init(packageData.readme, packageData.PackageVersions.First()); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.Space(2); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.Space(50); }