Add Cutscene command to Scene page

This commit is contained in:
2023-06-08 21:19:26 +08:00
parent 6da7e1d4d0
commit 1ccb3656c2
12 changed files with 411 additions and 56 deletions

View File

@@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using GrasscutterTools.Game.CutScene;
using GrasscutterTools.Properties;
using Newtonsoft.Json;
namespace GrasscutterTools.Pages
{
@@ -62,5 +66,28 @@ namespace GrasscutterTools.Pages
}
}
}
private void BtnConvertCutScene_Click(object sender, EventArgs e)
{
var src = new OpenFileDialog
{
Title = "请选择 Json 格式的 Cutscene.txt",
Multiselect = false,
};
if (src.ShowDialog() != DialogResult.OK)
return;
try
{
var cutScenes = JsonConvert.DeserializeObject<List<CutSceneItem>>(File.ReadAllText(src.FileName));
File.WriteAllLines(src.FileName, cutScenes.Select(it => $"{it.Id}:{it.Path.Substring(it.Path.IndexOf('/') + 1)}"));
MessageBox.Show("OK", Resources.Tips, MessageBoxButtons.OK);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}