新增 EdgeTTS

桌宠说话的时候附带语音,使用EdgeTTS
This commit is contained in:
ZouJin 2023-05-26 00:41:42 +10:00
parent 8a7bd0ded5
commit c9ccde31fd
34 changed files with 24698 additions and 1560 deletions

View File

@ -1,4 +1,9 @@
# VPet.Plugin.DemoClock
# VPet.Plugin.Demo
由开发者制作的桌宠插件案例
* DemoClock: 给桌宠添加一个时钟显示的功能
* EdgeTTS: 桌宠说话的时候附带语音,使用EdgeTTS
## VPet.Plugin.DemoClock
给桌宠添加一个时钟显示的功能,这算是代码嵌入类型MOD的DEMO
![democlock](democlock.png)
@ -44,3 +49,23 @@
游戏设置窗口
![image-20230411134959369](README.assets/image-20230411134959369.png)
## VPet.Plugin.EdgeTTS
桌宠说话的时候附带语音,使用EdgeTTS
![edgetts](edgetts.png)
参考本软件即可编写自己的代码MOD
### 功能
让桌宠说话的时候说出来
* 支持自定义讲述人和语音语调语速等
### 相关截图
游戏设置窗口
![image-20230411134959369](README.assets/image-20230411134959369.png)

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,11 @@
刷新时间时会调用该方法,在所有任务处理完之后
</summary>
</member>
<member name="P:VPet_Simulator.Core.Main.IsWorking">
<summary>
是否开始运行
</summary>
</member>
<member name="M:VPet_Simulator.Core.Main.LoadTouchEvent">
<summary>
自动加载触摸事件
@ -310,6 +315,12 @@
</summary>
<param name="text">说话内容</param>
</member>
<member name="M:VPet_Simulator.Core.Main.FunctionSpend(System.Double)">
<summary>
根据消耗计算相关数据
</summary>
<param name="TimePass">过去时间倍率</param>
</member>
<member name="F:VPet_Simulator.Core.Main.MoveTimerPoint">
<summary>
定点移动位置向量
@ -733,6 +744,21 @@
说话 (结束)
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.GraphType.Say_Self_A_Start">
<summary>
说话 (开始)
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.GraphType.Say_Self_B_Loop">
<summary>
说话 (循环)
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.GraphType.Say_Self_C_End">
<summary>
说话 (结束)
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.GraphType.Idel_StateONE_A_Start">
<summary>
待机 模式1 (开始)
@ -795,7 +821,7 @@
<param name="graph">动画</param>
<param name="type">类型</param>
</member>
<member name="M:VPet_Simulator.Core.GraphCore.AddGraph(System.String,VPet_Simulator.Core.Save.ModeType,VPet_Simulator.Core.GraphCore.GraphType)">
<member name="M:VPet_Simulator.Core.GraphCore.AddGraph(System.String,VPet_Simulator.Core.GameSave.ModeType,VPet_Simulator.Core.GraphCore.GraphType)">
<summary>
添加动画 自动创建
</summary>
@ -808,7 +834,7 @@
随机数字典(用于确保随机动画不会错位)
</summary>
</member>
<member name="M:VPet_Simulator.Core.GraphCore.FindGraph(VPet_Simulator.Core.GraphCore.GraphType,VPet_Simulator.Core.Save.ModeType,System.Boolean)">
<member name="M:VPet_Simulator.Core.GraphCore.FindGraph(VPet_Simulator.Core.GraphCore.GraphType,VPet_Simulator.Core.GameSave.ModeType,System.Boolean)">
<summary>
查找动画
</summary>
@ -908,6 +934,36 @@
加载更多设置,新的替换后来的,允许空内容
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.Helper.SayType.None">
<summary>
无:不执行动作
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.Helper.SayType.Default">
<summary>
默认说话
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.Helper.SayType.Serious">
<summary>
严肃
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.Helper.SayType.Shining">
<summary>
闪亮
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.Helper.SayType.Self">
<summary>
自己
</summary>
</member>
<member name="F:VPet_Simulator.Core.GraphCore.Helper.SayType.Error">
<summary>
错误
</summary>
</member>
<member name="T:VPet_Simulator.Core.EyeTracking">
<summary>
IEyeTracking.xaml 的交互逻辑
@ -972,7 +1028,7 @@
Picture.xaml 的交互逻辑
</summary>
</member>
<member name="M:VPet_Simulator.Core.Picture.#ctor(VPet_Simulator.Core.GraphCore,System.String,VPet_Simulator.Core.Save.ModeType,VPet_Simulator.Core.GraphCore.GraphType,System.Int32,System.Boolean)">
<member name="M:VPet_Simulator.Core.Picture.#ctor(VPet_Simulator.Core.GraphCore,System.String,VPet_Simulator.Core.GameSave.ModeType,VPet_Simulator.Core.GraphCore.GraphType,System.Int32,System.Boolean)">
<summary>
新建新静态图像
</summary>
@ -1028,7 +1084,7 @@
图片资源
</summary>
</member>
<member name="M:VPet_Simulator.Core.PNGAnimation.#ctor(VPet_Simulator.Core.GraphCore,System.String,System.IO.FileInfo[],VPet_Simulator.Core.Save.ModeType,VPet_Simulator.Core.GraphCore.GraphType,System.Boolean)">
<member name="M:VPet_Simulator.Core.PNGAnimation.#ctor(VPet_Simulator.Core.GraphCore,System.String,System.IO.FileInfo[],VPet_Simulator.Core.GameSave.ModeType,VPet_Simulator.Core.GraphCore.GraphType,System.Boolean)">
<summary>
新建 PNG 动画
</summary>
@ -1211,159 +1267,164 @@
宠物介绍
</summary>
</member>
<member name="T:VPet_Simulator.Core.Save">
<member name="T:VPet_Simulator.Core.GameSave">
<summary>
游戏存档
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.Name">
<member name="F:VPet_Simulator.Core.GameSave.Name">
<summary>
宠物名字
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.Money">
<member name="F:VPet_Simulator.Core.GameSave.Money">
<summary>
金钱
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.Exp">
<member name="F:VPet_Simulator.Core.GameSave.Exp">
<summary>
经验值
</summary>
</member>
<member name="P:VPet_Simulator.Core.Save.Level">
<member name="P:VPet_Simulator.Core.GameSave.Level">
<summary>
等级
</summary>
</member>
<member name="M:VPet_Simulator.Core.Save.LevelUpNeed">
<member name="M:VPet_Simulator.Core.GameSave.LevelUpNeed">
<summary>
升级所需经验值
</summary>
<returns></returns>
</member>
<member name="P:VPet_Simulator.Core.Save.Strength">
<member name="P:VPet_Simulator.Core.GameSave.Strength">
<summary>
体力 0-100
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ChangeStrength">
<member name="F:VPet_Simulator.Core.GameSave.ChangeStrength">
<summary>
变化 体力
</summary>
</member>
<member name="P:VPet_Simulator.Core.Save.StrengthFood">
<member name="P:VPet_Simulator.Core.GameSave.StrengthFood">
<summary>
饱腹度
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ChangeStrengthFood">
<member name="F:VPet_Simulator.Core.GameSave.ChangeStrengthFood">
<summary>
变化 食物
</summary>
</member>
<member name="P:VPet_Simulator.Core.Save.StrengthDrink">
<member name="P:VPet_Simulator.Core.GameSave.StrengthDrink">
<summary>
口渴度
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ChangeStrengthDrink">
<member name="F:VPet_Simulator.Core.GameSave.ChangeStrengthDrink">
<summary>
变化 口渴度
</summary>
</member>
<member name="P:VPet_Simulator.Core.Save.Feeling">
<member name="P:VPet_Simulator.Core.GameSave.Feeling">
<summary>
心情
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ChangeFeeling">
<member name="F:VPet_Simulator.Core.GameSave.ChangeFeeling">
<summary>
变化 心情
</summary>
</member>
<member name="P:VPet_Simulator.Core.Save.Health">
<member name="P:VPet_Simulator.Core.GameSave.Health">
<summary>
健康(生病)(隐藏)
</summary>
</member>
<member name="P:VPet_Simulator.Core.Save.Likability">
<member name="P:VPet_Simulator.Core.GameSave.Likability">
<summary>
好感度(隐藏)(累加值)
</summary>
</member>
<member name="M:VPet_Simulator.Core.Save.CleanChange">
<member name="M:VPet_Simulator.Core.GameSave.CleanChange(System.Boolean)">
<summary>
清除变化
</summary>
</member>
<member name="T:VPet_Simulator.Core.Save.ModeType">
<member name="T:VPet_Simulator.Core.GameSave.ModeType">
<summary>
宠物状态模式
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ModeType.Happy">
<member name="F:VPet_Simulator.Core.GameSave.ModeType.Happy">
<summary>
高兴
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ModeType.Nomal">
<member name="F:VPet_Simulator.Core.GameSave.ModeType.Nomal">
<summary>
普通
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ModeType.PoorCondition">
<member name="F:VPet_Simulator.Core.GameSave.ModeType.PoorCondition">
<summary>
状态不佳
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.ModeType.Ill">
<member name="F:VPet_Simulator.Core.GameSave.ModeType.Ill">
<summary>
生病(躺床)
</summary>
</member>
<member name="M:VPet_Simulator.Core.Save.CalMode">
<member name="M:VPet_Simulator.Core.GameSave.CalMode">
<summary>
计算宠物当前状态
</summary>
</member>
<member name="M:VPet_Simulator.Core.Save.#ctor(System.String)">
<member name="M:VPet_Simulator.Core.GameSave.#ctor(System.String)">
<summary>
新游戏
</summary>
</member>
<member name="M:VPet_Simulator.Core.Save.#ctor(LinePutScript.Line)">
<member name="M:VPet_Simulator.Core.GameSave.#ctor">
<summary>
读档
</summary>
</member>
<member name="M:VPet_Simulator.Core.Save.ToLine">
<member name="M:VPet_Simulator.Core.GameSave.Load(LinePutScript.ILine)">
<summary>
读档
</summary>
</member>
<member name="M:VPet_Simulator.Core.GameSave.ToLine">
<summary>
存档
</summary>
<returns>存档行</returns>
</member>
<member name="T:VPet_Simulator.Core.Save.WorkingState">
<member name="T:VPet_Simulator.Core.GameSave.WorkingState">
<summary>
当前正在的状态
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.WorkingState.Nomal">
<member name="F:VPet_Simulator.Core.GameSave.WorkingState.Nomal">
<summary>
默认:啥都没干
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.WorkingState.Working">
<member name="F:VPet_Simulator.Core.GameSave.WorkingState.Working">
<summary>
正在干活, workingobj指示正在干啥活
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.WorkingState.Studying">
<member name="F:VPet_Simulator.Core.GameSave.WorkingState.Studying">
<summary>
学习中
</summary>
</member>
<member name="F:VPet_Simulator.Core.Save.WorkingState.Playing">
<member name="F:VPet_Simulator.Core.GameSave.WorkingState.Playing">
<summary>
玩耍中
</summary>

View File

@ -17,7 +17,7 @@ namespace VPet.Plugin.DemoClock
tomato_resttime = 15;
tomato_resttimelong = 45;
}
public Setting(Line line) : base(line)
public Setting(ILine line) : base(line)
{
timeshifting = GetFloat("timeshifting", 0);
hour24 = GetBool("hour24");

View File

@ -147,7 +147,7 @@ namespace VPet.Plugin.DemoClock
TTimes.Text = diff.ToString(@"ss\:ff");
if (TimeSpanChanged)
{
CountTimer.Interval = TimeSpan.FromMilliseconds(10);
CountTimer.Interval = TimeSpan.FromMilliseconds(50);
TimeSpanChanged = false;
}
}
@ -262,7 +262,7 @@ namespace VPet.Plugin.DemoClock
TOthers.Visibility = Visibility.Collapsed;
IsPause = false;
PauseTime = TimeSpan.Zero;
CountTimer.Interval = TimeSpan.FromMilliseconds(10);
CountTimer.Interval = TimeSpan.FromMilliseconds(50);
CountTimer.Start();
Master.mode = Mode.Timing;
}

View File

@ -33,13 +33,13 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.6.1\lib\net462\LinePutScript.dll</HintPath>
<HintPath>..\packages\LinePutScript.1.8.0\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.8.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.8.5\lib\net462\Panuon.WPF.UI.dll</HintPath>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11-beta\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -53,7 +53,7 @@
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VPet-Simulator.Core.0.1.1\lib\net462\VPet-Simulator.Core.dll</HintPath>
<HintPath>..\packages\VPet-Simulator.Core.0.1.3\lib\net462\VPet-Simulator.Core.dll</HintPath>
</Reference>
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VPet-Simulator.Windows.Interface.0.1.2\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LinePutScript" version="1.6.1" targetFramework="net462" />
<package id="LinePutScript" version="1.8.0" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.8.5" targetFramework="net462" />
<package id="VPet-Simulator.Core" version="0.1.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.11-beta" targetFramework="net462" />
<package id="VPet-Simulator.Core" version="0.1.3" targetFramework="net462" />
<package id="VPet-Simulator.Windows.Interface" version="0.1.2" targetFramework="net462" />
</packages>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,2 @@
vupmod#EdgeTTS:|author#lorisyounger:|gamever#100:|ver#100:|
intro#桌宠说话的时候附带语音,使用EdgeTTS:|

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,225 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>VPet-Simulator.Windows.Interface</name>
</assembly>
<members>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.IsSteamUser">
<summary>
是否为Steam用户
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Set">
<summary>
游戏设置
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Pets">
<summary>
宠物加载器列表
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Core">
<summary>
桌宠数据核心
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Main">
<summary>
桌宠主要部件
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.verison">
<summary>
版本号
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Verison">
<summary>
版本号
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.lastclicktime">
<summary>
上次点击时间 (Tick)
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.IMainWindow.Plugins">
<summary>
所有三方插件
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.SetZoomLevel(System.Double)">
<summary>
设置游戏缩放倍率
</summary>
<param name="zl">缩放倍率 范围0.1-10</param>
</member>
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.Save">
<summary>
保存设置
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.LoadDIY">
<summary>
加载DIY内容
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.IMainWindow.RunAction(System.String)">
<summary>
运行动作
</summary>
<param name="action">动作名称</param>
</member>
<member name="T:VPet_Simulator.Windows.Interface.MainPlugin">
<summary>
这是插件的主体内容 请继承这个类
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.MainPlugin.PluginName">
<summary>
通过插件名称定位插件
</summary>
</member>
<member name="F:VPet_Simulator.Windows.Interface.MainPlugin.MW">
<summary>
主窗体, 主程序提供的各种功能和设置等 大部分参数和调用均在这里
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.#ctor(VPet_Simulator.Windows.Interface.IMainWindow)">
<summary>
MOD插件初始化
</summary>
<param name="mainwin">主窗体</param>
请不要加载游戏和玩家数据,仅用作初始化
加载数据(CORE)/游戏(SAVE),请使用 LoadPlugin
</member>
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.LoadPlugin">
<summary>
初始化程序+读取存档
</summary>
例:添加自己的Tick到 mw.Main.EventTimer
例:创建使用UI的桌面控件
</member>
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.EndGame">
<summary>
游戏结束 (可以保存或清空等,不过保存有专门的Save())
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.Save">
<summary>
储存游戏 (可以写 GameSave.Other 储存设置和数据等)
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.Setting">
<summary>
打开代码插件设置
</summary>
</member>
<member name="M:VPet_Simulator.Windows.Interface.MainPlugin.LoadDIY">
<summary>
重载DIY按钮, 如需添加自定义按钮可在此处添加
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.ZoomLevel">
<summary>
缩放倍率
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.IsBiggerScreen">
<summary>
是否为更大的屏幕
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.Diagnosis">
<summary>
是否启用数据收集 //TODO:判断游戏是否是原版的
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.DiagnosisInterval">
<summary>
数据收集频率
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.AutoSaveInterval">
<summary>
自动保存频率 (min)
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.TopMost">
<summary>
是否置于顶层
</summary>
</member>
<member name="F:VPet_Simulator.Windows.Interface.Setting.DiagnosisDayEnable">
<summary>
数据收集是否被禁止(当日)
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.PressLength">
<summary>
按多久视为长按 单位毫秒
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.InteractionCycle">
<summary>
互动周期
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.LogicInterval">
<summary>
计算间隔
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.AllowMove">
<summary>
允许移动事件
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.SmartMove">
<summary>
智能移动
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.EnableFunction">
<summary>
启用计算等数据功能
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.SmartMoveInterval">
<summary>
智能移动周期 (秒)
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartUPBoot">
<summary>
开机启动
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartUPBootSteam">
<summary>
开机启动 Steam
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.PetGraph">
<summary>
桌宠选择内容
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartRecordLast">
<summary>
是否记录游戏退出位置 (默认:是)
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartRecordLastPoint">
<summary>
记录上次退出位置
</summary>
</member>
<member name="P:VPet_Simulator.Windows.Interface.Setting.StartRecordPoint">
<summary>
设置中桌宠启动的位置
</summary>
</member>
</members>
</doc>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("VPet.Plugin.VPetTTS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VPet.Plugin.VPetTTS")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("a826a8d4-a741-49bf-b857-e2ea9a462db7")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,58 @@
using LinePutScript.Converter;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.Plugin.VPetTTS
{
public class Setting
{
/// <summary>
/// 音量大小
/// </summary>
[Line]
public int Volume { get; set; } = 100;
/// <summary>
/// 语速
/// </summary>
[Line]
public double Rate
{
get => rate; set
{
rate = value;
RateStr = $"{(value >= 0 ? "+" : "")}{value:f2}%";
}
}
private double rate = 0;
public string RateStr { get; private set; } = "+0%";
double pitch = 10;
/// <summary>
/// 音调
/// </summary>
[Line]
public double Pitch
{
get
{
return pitch;
}
set
{
pitch = value;
PitchStr = $"{(value >= 0 ? "+" : "")}{value:f2}Hz";
}
}
public string PitchStr { get; private set; } = "+10Hz";
/// <summary>
/// 讲述人
/// </summary>
[Line]
public string Speaker { get; set; } = "zh-CN-XiaoyiNeural";
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VPet_Simulator.Windows.Interface;
using EdgeTTS;
using LinePutScript.Converter;
using LinePutScript;
using System.IO;
using VPet_Simulator.Core;
namespace VPet.Plugin.VPetTTS
{
public class VPETTTS : MainPlugin
{
IMainWindow mw;
EdgeTTSClient etts;
Setting Set;
public VPETTTS(IMainWindow mainwin) : base(mainwin)
{
mw = mainwin;
}
public override void LoadPlugin()
{
etts = new EdgeTTSClient();
var line = MW.Set.FindLine("DemoClock");
if (line == null)
{
Set = new Setting();
}
else
{
Set = LPSConvert.DeserializeObject<Setting>(line);
}
if (!Directory.Exists(GraphCore.CachePath + @"\voice"))
Directory.CreateDirectory(GraphCore.CachePath + @"\voice");
mw.Main.OnSay += Main_OnSay;
}
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
{
var res = etts.SynthesisAsync(saythings, Set.Speaker, Set.PitchStr, Set.RateStr).Result;
if (res.Code == ResultCode.Success)
{
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
BinaryWriter w = new BinaryWriter(fs);
w.Write(res.Data.ToArray());
fs.Close();
fs.Dispose();
w.Dispose();
mw.Main.PlayVoice(new Uri(path));
}
}
}
//public override void Save()
//{
// MW.Set.Remove("DemoClock");
// MW.Set.Add(LPSConvert.SerializeObject(Set, "DemoClock"));
//}
public override string PluginName => "EdgeTTS";
}
}

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A826A8D4-A741-49BF-B857-E2EA9A462DB7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VPet.Plugin.VPetTTS</RootNamespace>
<AssemblyName>VPet.Plugin.VPetTTS</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EdgeTTS.Framework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EdgeTTS.Framework.1.0.1\lib\net462\EdgeTTS.Framework.dll</HintPath>
</Reference>
<Reference Include="LinePutScript, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LinePutScript.1.8.0\lib\net462\LinePutScript.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.1.0.1\lib\net462\Panuon.WPF.dll</HintPath>
</Reference>
<Reference Include="Panuon.WPF.UI, Version=1.1.11.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Panuon.WPF.UI.1.1.11.8\lib\net462\Panuon.WPF.UI.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.12.0\lib\net46\Serilog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VPet-Simulator.Core.0.1.5\lib\net462\VPet-Simulator.Core.dll</HintPath>
</Reference>
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VPet-Simulator.Windows.Interface.0.1.4\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="VPETTTS.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EdgeTTS.Framework" version="1.0.1" targetFramework="net462" />
<package id="LinePutScript" version="1.8.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
<package id="Panuon.WPF" version="1.0.1" targetFramework="net462" />
<package id="Panuon.WPF.UI" version="1.1.11.8" targetFramework="net462" />
<package id="Serilog" version="2.12.0" targetFramework="net462" />
<package id="VPet-Simulator.Core" version="0.1.5" targetFramework="net462" />
<package id="VPet-Simulator.Windows.Interface" version="0.1.4" targetFramework="net462" />
</packages>

View File

@ -5,6 +5,8 @@ VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet.Plugin.DemoClock", "VPet.Plugin.DemoClock\VPet.Plugin.DemoClock.csproj", "{D23F1150-999F-4698-800C-4E60FF853A3E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet.Plugin.VPetTTS", "VPet.Plugin.EdgeTTS\VPet.Plugin.VPetTTS.csproj", "{A826A8D4-A741-49BF-B857-E2EA9A462DB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{D23F1150-999F-4698-800C-4E60FF853A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D23F1150-999F-4698-800C-4E60FF853A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D23F1150-999F-4698-800C-4E60FF853A3E}.Release|Any CPU.Build.0 = Release|Any CPU
{A826A8D4-A741-49BF-B857-E2EA9A462DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A826A8D4-A741-49BF-B857-E2EA9A462DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A826A8D4-A741-49BF-B857-E2EA9A462DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A826A8D4-A741-49BF-B857-E2EA9A462DB7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

BIN
edgetts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB