/// <summary> /// 窗口打开显示函数 /// </summary> /// <param name="data">窗口数据</param> public static void Open(KitManagementEditorWindowData data) { windowData = data; var windowTitle = windowData.TitleString + ": 组件管理"; window = GetWindow <KitManagementEditorWindow>(true, windowTitle); if (UpdateData()) { var tempfilePath = System.IO.Path.Combine(Application.temporaryCachePath, kitTempFileName); if (System.IO.File.Exists(tempfilePath)) { System.IO.File.Delete(tempfilePath); } System.IO.File.WriteAllText(tempfilePath, windowTitle + "\n" + windowData.SubTitleString); window.minSize = new Vector2(600, 400); window.Show(); } }
/// <summary> /// 窗口打开显示函数 /// </summary> /// <param name="data">窗口数据</param> public static void Open(KitManagementEditorWindowData data) { windowData = data; var windowTitle = windowData.TitleString + ": " + windowData.SubTitleString; window = GetWindow <KitManagementEditorMakeNewWindow>(true, windowTitle); window.minSize = new Vector2(800, 500); var tempfilePath = System.IO.Path.Combine(Application.temporaryCachePath, kitTempFileName); if (System.IO.File.Exists(tempfilePath)) { System.IO.File.Delete(tempfilePath); } System.IO.File.WriteAllText(tempfilePath, windowTitle + "\n" + windowData.SubTitleString); var kit_new_config_tmpfile = System.IO.Path.Combine(Application.temporaryCachePath, kitNewConfigTempFileName); var parse_success = false; if (System.IO.File.Exists(kit_new_config_tmpfile)) { try { var json = System.IO.File.ReadAllText(kit_new_config_tmpfile); newConfig = JsonUtility.FromJson <KitConfig>(json); if (!string.IsNullOrWhiteSpace(newConfig.Name)) { kitUserInputNewConfigName = newConfig.Name; } if (!string.IsNullOrWhiteSpace(newConfig.Author)) { kitUserInputNewConfigAuthor = newConfig.Author; } if (!string.IsNullOrWhiteSpace(newConfig.Contact)) { kitUserInputNewConfigContact = newConfig.Contact; } if (!string.IsNullOrWhiteSpace(newConfig.HomePage)) { kitUserInputNewConfigHomePage = newConfig.HomePage; } if (!string.IsNullOrWhiteSpace(newConfig.Version)) { kitUserInputNewConfigVersion = newConfig.Version; } if (!string.IsNullOrWhiteSpace(newConfig.Description)) { kitUserInputNewConfigDescription = newConfig.Description; } var dependencies = ""; foreach (var d in newConfig.Dependencies) { if (!string.IsNullOrWhiteSpace(d)) { dependencies += d + ";"; } } if (!string.IsNullOrWhiteSpace(dependencies)) { kitUserInputNewConfigDependencies = dependencies; } parse_success = true; } catch { Debug.LogWarning("打开新组建配置文件失败!"); System.IO.File.Delete(kit_new_config_tmpfile); } } if (!parse_success) { newConfig = new KitConfig(); newConfig.Dependencies = new List <string>(); newConfig.FileSettings = new List <KitConfigFileSetting>(); } var kit_new_config_srcpath_tmpfile = System.IO.Path.Combine(Application.temporaryCachePath, kitNewConfigSrcPathTempFileName); if (System.IO.File.Exists(kit_new_config_srcpath_tmpfile)) { kitUserSelectedComponentSrcPath = System.IO.File.ReadAllText(kit_new_config_srcpath_tmpfile); } var kit_new_config_class_tmpfile = System.IO.Path.Combine(Application.temporaryCachePath, kitNewConfigClassificationTempFileName); if (System.IO.File.Exists(kit_new_config_class_tmpfile)) { kitUserSelectedComponentClassification = System.IO.File.ReadAllText(kit_new_config_class_tmpfile); componentClassificationEnum = kitUserSelectedComponentClassification == kitUserSelectedComponentClassification_Basic ? ComponentClassificationEnum.Basic : ComponentClassificationEnum.Framework; } window.Show(); }