private void CloseClickHander() { Close(); return; //string filePath = Application.streamingAssetsPath + "../../../../TouhouBarrageDemo/Assets/StreamingAssets/LuaRoot/stages/TestEditorStage.lua"; //if (filePath != null) //{ // BaseNode root = BarrageProject.RootNode; // string luaData = ""; // root.ToLua(0, ref luaData); // FileUtils.WriteToFile(luaData, filePath); //} string openPath = FileUtils.OpenFile("选择要更新的关卡数据", "关卡数据(*.nd)\0*.nd\0", false); if (openPath != null) { EventManager.GetInstance().PostEvent(EditorEvents.BeforeProjectChanged); BarrageProject.UnloadProject(); BarrageProject.UpdateProject(openPath); BarrageProject.LoadProject(openPath); EventManager.GetInstance().PostEvent(EditorEvents.AfterProjectChanged); BarrageProject.Log("current project file: " + FileUtils.GetFileNameByPath(openPath)); } }
private void OnOpenClickHandler() { string openPath = FileUtils.OpenFile("选择关卡数据", "关卡数据(*.nd)\0*.nd\0", false); if (openPath != null) { EventManager.GetInstance().PostEvent(EditorEvents.BeforeProjectChanged); BarrageProject.UnloadProject(); BarrageProject.LoadProject(openPath); EventManager.GetInstance().PostEvent(EditorEvents.AfterProjectChanged); BarrageProject.Log("current project file: " + FileUtils.GetFileNameByPath(openPath)); } }
private void SaveClickHander() { Close(); string savePath = BarrageProject.GetProjectPath(); if (savePath != null) { BaseNode root = BarrageProject.RootNode; NodeData nd = NodeManager.SaveAsNodeData(root, true); FileUtils.SerializableObjectToFile(savePath, nd); BarrageProject.Log("Save Complete"); } }
private void OnCreateClickHandler() { string savePath = FileUtils.SaveFile("选择新建工程的位置", "关卡数据(*.nd)\0*.nd\0"); if (savePath != null) { EventManager.GetInstance().PostEvent(EditorEvents.BeforeProjectChanged); BarrageProject.UnloadProject(); // todo 载入固定位置的一个模板 string templatePath = Application.streamingAssetsPath + "/template.nd"; BarrageProject.LoadProject(templatePath); EventManager.GetInstance().PostEvent(EditorEvents.AfterProjectChanged); // 当前文件 BarrageProject.Log("current project file: " + FileUtils.GetFileNameByPath(savePath)); } }
private void SaveAsClickHander() { Close(); string path = BarrageProject.GetProjectPath(); if (path == null) { return; } string savePath = FileUtils.SaveFile("选择保存数据", "关卡数据(*.nd)\0*.nd\0"); if (savePath != null) { BaseNode root = BarrageProject.RootNode; NodeData nd = NodeManager.SaveAsNodeData(root, true); FileUtils.SerializableObjectToFile(savePath, nd); BarrageProject.SetProjectPath(savePath); BarrageProject.Log("Save Complete"); } }
private void NewClickHandler() { Close(); string savePath = FileUtils.SaveFile("选择新建工程的位置", "关卡数据(*.nd)\0*.nd\0"); if (savePath != null) { EventManager.GetInstance().PostEvent(EditorEvents.BeforeProjectChanged); BarrageProject.UnloadProject(); // todo 载入固定位置的一个模板 string templatePath = Application.streamingAssetsPath + "/template.nd"; BarrageProject.LoadProject(templatePath); BarrageProject.SetProjectPath(savePath); // 保存文件 BaseNode root = BarrageProject.RootNode; NodeData nd = NodeManager.SaveAsNodeData(root, true); FileUtils.SerializableObjectToFile(savePath, nd); EventManager.GetInstance().PostEvent(EditorEvents.AfterProjectChanged); // 当前文件 BarrageProject.Log("Current project file: " + FileUtils.GetFileNameByPath(savePath)); } }