Skip to content

Commit

Permalink
修复参考预设保存失效
Browse files Browse the repository at this point in the history
修复VRoidStudio 1.23.0导致的参考预设保存失效
  • Loading branch information
xiaoye97 committed Sep 17, 2023
1 parent fadd665 commit 32d2cd0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
13 changes: 9 additions & 4 deletions VRoidXYTool/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,16 @@ public static FileDialogCommonUtil.ExtensionFilter[] GetJsonFilters()
{
return new FileDialogCommonUtil.ExtensionFilter[]
{
new FileDialogCommonUtil.ExtensionFilter("Json", new string[]
GetJsonFilter()
};
}

public static FileDialogCommonUtil.ExtensionFilter GetJsonFilter()
{
return new FileDialogCommonUtil.ExtensionFilter("Json", new string[]
{
"json"
})
};
});
}

/// <summary>
Expand Down Expand Up @@ -172,4 +177,4 @@ public static FileDialogCommonUtil.ExtensionFilter[] GetVMDFilters()
};
}
}
}
}
22 changes: 15 additions & 7 deletions VRoidXYTool/GuideTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using UnityEngine;
using VRoid.Studio.Util;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace VRoidXYTool
{
Expand All @@ -16,10 +17,12 @@ public class GuideTool
/// 标尺盒子预制体
/// </summary>
private GameObject boxPrefab;

/// <summary>
/// 参考图预制体
/// </summary>
private GameObject guideImagePrefab;

/// <summary>
/// 参考图材质
/// </summary>
Expand Down Expand Up @@ -146,14 +149,19 @@ public async void LoadPreset()
/// </summary>
public async void SavePreset()
{
var path = await SaveFileDialogUtil.SaveFilePanel("GuideTool.SelectSavePath".Translate(), null, "XYToolPreset.json", FileHelper.GetJsonFilters());
if (path == null) return;
if (string.IsNullOrEmpty(path)) return;
foreach (var obj in nowObjects)
var path = await SaveFileDialogUtil.SaveFileSingleAsync("GuideTool.SelectSavePath".Translate(), null, "XYToolPreset.json", FileHelper.GetJsonFilter(), (tmpPath) =>
{
obj.Save();
}
FileHelper.SaveJson(path, nowPreset);
if (string.IsNullOrEmpty(tmpPath))
{
return Task.FromResult<bool>(false);
}
foreach (var obj in nowObjects)
{
obj.Save();
}
FileHelper.SaveJson(tmpPath, nowPreset);
return Task.FromResult<bool>(true);
});
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion VRoidXYTool/XYTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class XYTool : BaseUnityPlugin
{
public const string PluginID = "me.xiaoye97.plugin.VRoidStudio.VRoidXYTool";
public const string PluginName = "VRoidXYTool";
public const string PluginVersion = "0.8.1";
public const string PluginVersion = "0.8.2";

public static XYTool Inst;

Expand Down

0 comments on commit 32d2cd0

Please sign in to comment.