mirror of
https://github.com/jie65535/GrasscutterCommandGenerator.git
synced 2025-12-10 08:51:34 +08:00
Add Cutscene command to Scene page
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user