void MainWindow_Loaded(object sender, RoutedEventArgs e) { var x = new CreateWindow(); x.Show(); }
private bool SearchRelatedPrefab() { bool isMapPrefabExist = false; bool isMapIDExist = false; // 检索Resources\Scene string targetMapPath = ""; foreach (string path in Directory.GetFiles(MapEditor.MAP_PREFAB_ID_PATH)) { //获取所有文件夹中包含后缀为 .prefab 的路径 if (Path.GetExtension(path) == ".prefab" && (Path.GetFileNameWithoutExtension(path) == mapPrefabID)) { isMapPrefabExist = true; targetMapPath = "Scene/" + mapPrefabID; } } // 检索Resources\Config\Map DirectoryInfo mapDir = new DirectoryInfo(MapEditor.MAP_ID_PATH); if (mapDir.Exists) { foreach (string path in Directory.GetFiles(MapEditor.MAP_ID_PATH)) { if (Path.GetFileNameWithoutExtension(path) == mapID) { isMapIDExist = true; } } } if (isMapIDExist && isMapPrefabExist) { MapEditor.loadMap(targetMapPath, mapID); return(true); } else if (!isMapPrefabExist) { // 弹出提示信息 MessageWindow.CreateMessageBox( "Map prefab 不存在", delegate(EditorWindow window) { window.Close(); }, delegate(EditorWindow window) { window.Close(); } ); return(false); } else { // 提示是否新建地图 MessageWindow.CreateMessageBox( "是否新建地图", delegate(EditorWindow window) { window.Close(); CreateWindow createWindow = CreateInstance <CreateWindow>(); createWindow.MapPrefabID = mapPrefabID; createWindow.MapID = mapID; createWindow.Show(); }, delegate(EditorWindow window) { window.Close(); } ); return(false); } }