diff --git a/VPet.Plugin.DemoClock/1100_DemoClock/info.lps b/VPet.Plugin.DemoClock/1100_DemoClock/info.lps
index 575978c..214c468 100644
--- a/VPet.Plugin.DemoClock/1100_DemoClock/info.lps
+++ b/VPet.Plugin.DemoClock/1100_DemoClock/info.lps
@@ -1,2 +1,4 @@
vupmod#DemoClock:|author#lorisyounger:|gamever#100:|ver#100:|
-intro#给桌宠添加一个时钟显示的功能,这算是代码嵌入类型MOD的DEMO:|
\ No newline at end of file
+intro#给桌宠添加一个时钟显示的功能/com这算是代码嵌入类型MOD的DEMO:|
+authorid#253101309:|
+itemid#2980456794:|
\ No newline at end of file
diff --git a/VPet.Plugin.DemoClock/1100_DemoClock/plugin/VPet.Plugin.DemoClock.dll b/VPet.Plugin.DemoClock/1100_DemoClock/plugin/VPet.Plugin.DemoClock.dll
index 1da3639..592ab96 100644
Binary files a/VPet.Plugin.DemoClock/1100_DemoClock/plugin/VPet.Plugin.DemoClock.dll and b/VPet.Plugin.DemoClock/1100_DemoClock/plugin/VPet.Plugin.DemoClock.dll differ
diff --git a/VPet.Plugin.DemoClock/DemoClock.cs b/VPet.Plugin.DemoClock/DemoClock.cs
index 6a653a0..954069e 100644
--- a/VPet.Plugin.DemoClock/DemoClock.cs
+++ b/VPet.Plugin.DemoClock/DemoClock.cs
@@ -62,6 +62,7 @@ namespace VPet.Plugin.DemoClock
public MenuItem mTiming;
public long CountDownLength;
+ public winSetting winSetting;
public DemoClock(IMainWindow mainwin) : base(mainwin)
{
}
@@ -140,7 +141,15 @@ namespace VPet.Plugin.DemoClock
public override void Setting()
{
- new winSetting(this).Show();
+ if (winSetting == null)
+ {
+ winSetting = new winSetting(this);
+ winSetting.Show();
+ }
+ else
+ {
+ winSetting.Topmost = true;
+ }
}
}
}
diff --git a/VPet.Plugin.DemoClock/winSetting.xaml b/VPet.Plugin.DemoClock/winSetting.xaml
index ae7b68e..afa7837 100644
--- a/VPet.Plugin.DemoClock/winSetting.xaml
+++ b/VPet.Plugin.DemoClock/winSetting.xaml
@@ -5,7 +5,7 @@
xmlns:local="clr-namespace:VPet.Plugin.DemoClock" mc:Ignorable="d"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Title="Demo Clock 设置" Width="450" FontSize="16"
Height="Auto" ResizeMode="NoResize" WindowState="Normal" SizeToContent="Height"
- Background="{DynamicResource PrimaryLighter}">
+ Background="{DynamicResource PrimaryLighter}" Closed="Window_Closed">
diff --git a/VPet.Plugin.DemoClock/winSetting.xaml.cs b/VPet.Plugin.DemoClock/winSetting.xaml.cs
index 3861057..7f26d46 100644
--- a/VPet.Plugin.DemoClock/winSetting.xaml.cs
+++ b/VPet.Plugin.DemoClock/winSetting.xaml.cs
@@ -169,5 +169,10 @@ namespace VPet.Plugin.DemoClock
break;
}
}
+
+ private void Window_Closed(object sender, EventArgs e)
+ {
+ Master.winSetting = null;
+ }
}
}
diff --git a/VPet.Plugin.EdgeTTS/1101_EdgeTTS/plugin/VPet.Plugin.VPetTTS.dll b/VPet.Plugin.EdgeTTS/1101_EdgeTTS/plugin/VPet.Plugin.VPetTTS.dll
index d4954be..045b72e 100644
Binary files a/VPet.Plugin.EdgeTTS/1101_EdgeTTS/plugin/VPet.Plugin.VPetTTS.dll and b/VPet.Plugin.EdgeTTS/1101_EdgeTTS/plugin/VPet.Plugin.VPetTTS.dll differ
diff --git a/VPet.Plugin.EdgeTTS/VPETTTS.cs b/VPet.Plugin.EdgeTTS/EdgeTTS.cs
similarity index 61%
rename from VPet.Plugin.EdgeTTS/VPETTTS.cs
rename to VPet.Plugin.EdgeTTS/EdgeTTS.cs
index 447b28e..ce8d36f 100644
--- a/VPet.Plugin.EdgeTTS/VPETTTS.cs
+++ b/VPet.Plugin.EdgeTTS/EdgeTTS.cs
@@ -9,22 +9,22 @@ using LinePutScript.Converter;
using LinePutScript;
using System.IO;
using VPet_Simulator.Core;
+using System.Windows.Controls;
+using System.Windows;
namespace VPet.Plugin.VPetTTS
{
- public class VPETTTS : MainPlugin
+ public class EdgeTTS : MainPlugin
{
- IMainWindow mw;
- EdgeTTSClient etts;
- Setting Set;
- public VPETTTS(IMainWindow mainwin) : base(mainwin)
+ public EdgeTTSClient etts;
+ public Setting Set;
+ public EdgeTTS(IMainWindow mainwin) : base(mainwin)
{
- mw = mainwin;
+ etts = new EdgeTTSClient();
}
public override void LoadPlugin()
{
- etts = new EdgeTTSClient();
- var line = MW.Set.FindLine("DemoClock");
+ var line = MW.Set.FindLine("EdgeTTS");
if (line == null)
{
Set = new Setting();
@@ -35,16 +35,21 @@ namespace VPet.Plugin.VPetTTS
}
if (!Directory.Exists(GraphCore.CachePath + @"\voice"))
Directory.CreateDirectory(GraphCore.CachePath + @"\voice");
- mw.Main.OnSay += Main_OnSay;
+ if (Set.Enable)
+ MW.Main.OnSay += Main_OnSay;
+ }
+ public override void LoadDIY()
+ {
+ MW.Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "EdgeTTS", Setting);
}
-
private void Main_OnSay(string saythings)
{//说话语音
var path = GraphCore.CachePath + $"\\voice\\{Sub.GetHashCode(saythings):X}.mp3";
if (File.Exists(path))
{
- mw.Main.PlayVoice(new Uri(path));
- }else
+ MW.Main.PlayVoice(new Uri(path));
+ }
+ else
{
var res = etts.SynthesisAsync(saythings, Set.Speaker, Set.PitchStr, Set.RateStr).Result;
if (res.Code == ResultCode.Success)
@@ -55,16 +60,24 @@ namespace VPet.Plugin.VPetTTS
fs.Close();
fs.Dispose();
w.Dispose();
- mw.Main.PlayVoice(new Uri(path));
+ MW.Main.PlayVoice(new Uri(path));
}
- }
+ }
}
- //public override void Save()
- //{
- // MW.Set.Remove("DemoClock");
- // MW.Set.Add(LPSConvert.SerializeObject(Set, "DemoClock"));
- //}
+ public winSetting winSetting;
+ public override void Setting()
+ {
+ if (winSetting == null)
+ {
+ winSetting = new winSetting(this);
+ winSetting.Show();
+ }
+ else
+ {
+ winSetting.Topmost = true;
+ }
+ }
public override string PluginName => "EdgeTTS";
}
}
diff --git a/VPet.Plugin.EdgeTTS/Setting.cs b/VPet.Plugin.EdgeTTS/Setting.cs
index e664099..79010fe 100644
--- a/VPet.Plugin.EdgeTTS/Setting.cs
+++ b/VPet.Plugin.EdgeTTS/Setting.cs
@@ -9,12 +9,6 @@ namespace VPet.Plugin.VPetTTS
{
public class Setting
{
- ///
- /// 音量大小
- ///
- [Line]
- public int Volume { get; set; } = 100;
-
///
/// 语速
///
@@ -54,5 +48,10 @@ namespace VPet.Plugin.VPetTTS
///
[Line]
public string Speaker { get; set; } = "zh-CN-XiaoyiNeural";
+ ///
+ /// 启用EdgeTTS
+ ///
+ [Line]
+ public bool Enable { get; set; } = true;
}
}
diff --git a/VPet.Plugin.EdgeTTS/VPet.Plugin.VPetTTS.csproj b/VPet.Plugin.EdgeTTS/VPet.Plugin.VPetTTS.csproj
index 8b6269b..d185e2b 100644
--- a/VPet.Plugin.EdgeTTS/VPet.Plugin.VPetTTS.csproj
+++ b/VPet.Plugin.EdgeTTS/VPet.Plugin.VPetTTS.csproj
@@ -53,6 +53,7 @@
+
@@ -68,12 +69,21 @@
-
+
+
+ winSetting.xaml
+
+
+
+ Designer
+ MSBuild:Compile
+
+
\ No newline at end of file
diff --git a/VPet.Plugin.EdgeTTS/winSetting.xaml b/VPet.Plugin.EdgeTTS/winSetting.xaml
new file mode 100644
index 0000000..196a0a9
--- /dev/null
+++ b/VPet.Plugin.EdgeTTS/winSetting.xaml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ zh-CN-XiaoxiaoNeural
+ zh-CN-XiaoyiNeural
+ zh-CN-YunjianNeural
+ zh-CN-YunxiNeural
+ zh-CN-YunxiaNeural
+ zh-CN-YunyangNeural
+ zh-CN-liaoning-XiaobeiNeural
+ zh-CN-shaanxi-XiaoniNeural
+ zh-HK-HiuGaaiNeural
+ zh-HK-HiuMaanNeural
+ zh-HK-WanLungNeural
+ zh-TW-HsiaoChenNeural
+ zh-TW-HsiaoYuNeural
+ zh-TW-YunJheNeural
+
+
+
+
diff --git a/VPet.Plugin.EdgeTTS/winSetting.xaml.cs b/VPet.Plugin.EdgeTTS/winSetting.xaml.cs
new file mode 100644
index 0000000..39b9f32
--- /dev/null
+++ b/VPet.Plugin.EdgeTTS/winSetting.xaml.cs
@@ -0,0 +1,65 @@
+using LinePutScript.Converter;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using VPet_Simulator.Core;
+
+namespace VPet.Plugin.VPetTTS
+{
+ ///
+ /// winSetting.xaml 的交互逻辑
+ ///
+ public partial class winSetting : Window
+ {
+ EdgeTTS vts;
+ public winSetting(EdgeTTS vts)
+ {
+ InitializeComponent();
+ this.vts = vts;
+ SwitchOn.IsChecked = vts.Set.Enable;
+ //TODO VolumeSilder
+ PitchSilder.Value = vts.Set.Pitch;
+ RateSilder.Value = vts.Set.Rate;
+ CombSpeaker.Text = vts.Set.Speaker;
+ }
+
+ private void Save_Click(object sender, RoutedEventArgs e)
+ {
+ vts.Set.Enable = SwitchOn.IsChecked.Value;
+ vts.Set.Pitch = PitchSilder.Value;
+ vts.Set.Rate = RateSilder.Value;
+ vts.Set.Speaker = CombSpeaker.Text;
+ vts.MW.Set.Remove("DemoClock");
+ vts.MW.Set.Add(LPSConvert.SerializeObject(vts.Set, "DemoClock"));
+ foreach (var tmpfile in Directory.GetFiles(GraphCore.CachePath + @"\voice"))
+ {
+ try
+ {
+ File.Delete(tmpfile);
+ }
+ finally
+ {
+
+ }
+ }
+ Close();
+ }
+
+ private void Window_Closed(object sender, EventArgs e)
+ {
+ vts.winSetting = null;
+ }
+ }
+}