支持多种说话动作

This commit is contained in:
ZouJin 2023-03-29 00:18:14 +11:00
parent a83b5a60b1
commit ccbe0b56cf
52 changed files with 177 additions and 160 deletions

3
.gitignore vendored
View File

@ -348,3 +348,6 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
*.zip
*.rar

View File

@ -28,22 +28,22 @@ namespace VPet_Simulator.Core
/// 说话
/// </summary>
/// <param name="text">说话内容</param>
public void Say(string text)
public void Say(string text, GraphCore.Helper.SayType type)
{
if (DisplayType == GraphCore.GraphType.Default)
Display(GraphCore.GraphType.Say_A_Start, () =>
if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () =>
{
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text));
Saying();
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, type));
Saying(type);
});
else
{
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text));
Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text, type));
}
}
public void Saying()
public void Saying(GraphCore.Helper.SayType type)
{
Display(GraphCore.GraphType.Say_B_Loop, Saying);
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.B_Loop), () => Saying(type));
}
private void EventTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
@ -162,7 +162,7 @@ namespace VPet_Simulator.Core
case 19:
case 20:
DisplayIdel_StateONE();
break;
break;
default:
break;
}
@ -203,7 +203,7 @@ namespace VPet_Simulator.Core
/// <param name="SmartMoveInterval">智能移动周期</param>
public void SetMoveMode(bool AllowMove, bool smartMove, int SmartMoveInterval)
{
MoveTimer.Enabled = false;;
MoveTimer.Enabled = false; ;
if (AllowMove)
{
MoveTimer.AutoReset = true;
@ -215,7 +215,7 @@ namespace VPet_Simulator.Core
}
else
{
SmartMoveTimer.Enabled = false;;
SmartMoveTimer.Enabled = false; ;
SmartMove = false;
}
}

View File

@ -60,8 +60,8 @@ namespace VPet_Simulator.Core
Task.Run(() =>
{
Thread.Sleep(timeleft * 50);
if (m.DisplayType == GraphCore.GraphType.Default || m.DisplayType.ToString().Contains("Say"))
m.Display(GraphCore.GraphType.Say_C_End, m.DisplayNomal);
if (sayType != GraphCore.Helper.SayType.None && m.DisplayType.ToString().StartsWith("Say"))
m.Display(GraphCore.Helper.Convert(sayType, GraphCore.Helper.AnimatType.C_End), m.DisplayNomal);
});
ShowTimer.Stop();
EndTimer.Start();
@ -81,12 +81,13 @@ namespace VPet_Simulator.Core
public Timer ShowTimer = new Timer() { Interval = 40 };
public Timer CloseTimer = new Timer() { Interval = 20 };
int timeleft;
GraphCore.Helper.SayType sayType;
/// <summary>
/// 显示消息
/// </summary>
/// <param name="name">名字</param>
/// <param name="text">内容</param>
public void Show(string name, string text)
public void Show(string name, string text, GraphCore.Helper.SayType sayType)
{
if (m.UIGrid.Children.IndexOf(this) != m.UIGrid.Children.Count - 1)
{
@ -100,6 +101,7 @@ namespace VPet_Simulator.Core
ShowTimer.Start(); EndTimer.Stop(); CloseTimer.Stop();
this.Visibility = Visibility.Visible;
Opacity = .8;
this.sayType = sayType;
}
private void Border_MouseEnter(object sender, MouseEventArgs e)

View File

@ -3,10 +3,7 @@ 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.Threading;
namespace VPet_Simulator.Core
{
@ -212,15 +209,27 @@ namespace VPet_Simulator.Core
/// <summary>
/// 说话 (开始)
/// </summary>
Say_A_Start,
Say_Serious_A_Start,
/// <summary>
/// 说话 (循环)
/// </summary>
Say_B_Loop,
Say_Serious_B_Loop,
/// <summary>
/// 说话 (结束)
/// </summary>
Say_C_End,
Say_Serious_C_End,
/// <summary>
/// 说话 (开始)
/// </summary>
Say_Shining_A_Start,
/// <summary>
/// 说话 (循环)
/// </summary>
Say_Shining_B_Loop,
/// <summary>
/// 说话 (结束)
/// </summary>
Say_Shining_C_End,
/// <summary>
/// 待机 模式1 (开始)
/// </summary>
@ -254,40 +263,7 @@ namespace VPet_Simulator.Core
/// </summary>
Shutdown,
}
///// <summary> loop 应该被取缔
///// 动画类型默认设置 前文本|是否循环|是否常用
///// </summary>
//public static readonly dynamic[][] GraphTypeValue = new dynamic[][]
//{
// new dynamic[]{ "raised_dynamic" ,false,true},
// new dynamic[]{ "raised_static_a", false,true},
// new dynamic[]{ "raised_static_b", false,true},
// new dynamic[]{ "climb_top_right", false,false},
// new dynamic[]{ "climb_top_left", false, false},
// new dynamic[]{ "Crawl_right", false,false},
// new dynamic[]{ "Crawl_left", false, false},
// new dynamic[]{ "climb_right", false, false},
// new dynamic[]{ "climb_left", false, false},
// new dynamic[]{ "default", true,true},
// new dynamic[]{ "touch_head_a", false,true},
// new dynamic[]{ "touch_head_b", false,true},
// new dynamic[]{ "touch_head_c", false,true},
// new dynamic[]{ "crawl_right", false, true},
// new dynamic[]{ "crawl_left", false, true},
// new dynamic[]{ "squat_a", false,true},
// new dynamic[]{ "squat_b", false, true},
// new dynamic[]{ "squat_c", false,true},
// new dynamic[]{ "fall_left_a", false, false},
// new dynamic[]{ "fall_left_b", false,true},
// new dynamic[]{ "fall_right_a", false, false},
// new dynamic[]{ "fall_right_b", false,true},
// new dynamic[]{ "walk_right_a", false,true},
// new dynamic[]{ "walk_right_b", false, true},
// new dynamic[]{ "walk_right_c", false,true},
// new dynamic[]{ "walk_left_a", false,true},
// new dynamic[]{ "walk_left_b", false, true},
// new dynamic[]{ "walk_left_c", false,true},
//};
/// <summary>
/// 图像字典
/// </summary>
@ -539,5 +515,27 @@ namespace VPet_Simulator.Core
}
}
}
public static class Helper
{
public enum AnimatType
{
A_Start,
B_Loop,
C_End,
}
public enum SayType
{
None,
Default,
Serious,
Shining
}
public static GraphType Convert(SayType sayType, AnimatType type)
{
string say = "Say_" + sayType.ToString() + '_' + type.ToString(); // (type == null ? "" : '_' + type.ToString());
return (GraphType)Enum.Parse(typeof(GraphType), say);
}
}
}
}

View File

@ -313,7 +313,7 @@ namespace VPet_Simulator.Core
return;
}
System.Windows.Controls.Image img;
if (parant.Child == GraphCore.CommUIElements["Image1.PNGAnimation"])
{
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image1.PNGAnimation"];
@ -344,8 +344,8 @@ namespace VPet_Simulator.Core
img.Source = new BitmapImage(new Uri(Path));
img.Width = Width;
new Thread(() => Animations[0].Run(parant, EndAction)).Start();
});
Task.Run(() => Animations[0].Run(parant, EndAction));
});
}
public void Stop(bool StopEndAction = false)

View File

@ -8,6 +8,7 @@ using System.Windows.Media.Imaging;
using System.Windows;
using System.IO;
using System.Windows.Controls;
using System.Windows.Threading;
namespace VPet_Simulator.Core
{
@ -54,51 +55,54 @@ namespace VPet_Simulator.Core
{
PlayState = true;
StopEndAction = false;
if (parant.Tag != this)
parant.Dispatcher.Invoke(() =>
{
System.Windows.Controls.Image img;
if (parant.Child == GraphCore.CommUIElements["Image1.Picture"])
if (parant.Tag != this)
{
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image1.Picture"];
}
else
{
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image2.Picture"];
if (parant.Child != GraphCore.CommUIElements["Image2.Picture"])
System.Windows.Controls.Image img;
if (parant.Child == GraphCore.CommUIElements["Image1.Picture"])
{
if (img.Parent == null)
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image1.Picture"];
}
else
{
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image2.Picture"];
if (parant.Child != GraphCore.CommUIElements["Image2.Picture"])
{
parant.Child = img;
}
else
{
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image3.Picture"];
parant.Child = img;
if (img.Parent == null)
{
parant.Child = img;
}
else
{
img = (System.Windows.Controls.Image)GraphCore.CommUIElements["Image3.Picture"];
parant.Child = img;
}
}
}
//var bitmap = new BitmapImage();
//bitmap.BeginInit();
//stream.Seek(0, SeekOrigin.Begin);
//bitmap.StreamSource = stream;
//bitmap.CacheOption = BitmapCacheOption.OnLoad;
//bitmap.EndInit();
img.Source = new BitmapImage(new Uri(Path));
parant.Tag = this;
}
//var bitmap = new BitmapImage();
//bitmap.BeginInit();
//stream.Seek(0, SeekOrigin.Begin);
//bitmap.StreamSource = stream;
//bitmap.CacheOption = BitmapCacheOption.OnLoad;
//bitmap.EndInit();
img.Source = new BitmapImage(new Uri(Path));
parant.Tag = this;
}
Task.Run(() =>
{
Thread.Sleep(Length);
if (IsLoop && PlayState)
Task.Run(() =>
{
Run(parant, EndAction);
}
else
{
PlayState = false;
if (!StopEndAction)
EndAction?.Invoke();//运行结束动画时事件
}
Thread.Sleep(Length);
if (IsLoop && PlayState)
{
Run(parant, EndAction);
}
else
{
PlayState = false;
if (!StopEndAction)
EndAction?.Invoke();//运行结束动画时事件
}
});
});
}
bool StopEndAction = false;

View File

@ -74,6 +74,10 @@ namespace VPet_Simulator.Core
{
graph.AddGraph(di.FullName, Save.ModeType.Ill, (GraphType)i);
}
else
{
graph.AddGraph(di.FullName, Save.ModeType.Nomal, (GraphType)i);
}
return;
}
}

View File

@ -15,6 +15,7 @@ using System.Timers;
using LinePutScript;
using System.Diagnostics;
using ChatGPT.API.Framework;
using static VPet_Simulator.Core.GraphCore;
namespace VPet_Simulator.Windows
{
@ -33,7 +34,7 @@ namespace VPet_Simulator.Windows
try
{
#if DEMO
SteamClient.Init(2293870, true);
SteamClient.Init(2293870, true);
#else
SteamClient.Init(1920960, true);
#endif
@ -41,7 +42,7 @@ namespace VPet_Simulator.Windows
IsSteamUser = SteamClient.IsValid;
////同时看看有没有买dlc,如果有就添加dlc按钮
//if (Steamworks.SteamApps.IsDlcInstalled(1386450))
// dlcToolStripMenuItem.Visible = true;
// dlcToolStripMenuItem.Visible = true;
}
catch
{
@ -50,11 +51,11 @@ namespace VPet_Simulator.Windows
//给正在玩这个游戏的主播/游戏up主做个小功能
if (IsSteamUser)
{
rndtext.Add($"关注 {Steamworks.SteamClient.Name} 谢谢喵");
rndtext.Add(new Tuple<string, Helper.SayType>($"关注 {SteamClient.Name} 谢谢喵", Helper.SayType.Shining));
}
else
{
rndtext.Add($"关注 {Environment.UserName} 谢谢喵");
rndtext.Add(new Tuple<string, Helper.SayType>($"关注 {Environment.UserName} 谢谢喵", Helper.SayType.Shining));
}
//加载游戏设置
if (new FileInfo(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps").Exists)
@ -111,18 +112,18 @@ namespace VPet_Simulator.Windows
System.Environment.Exit(0);
}
private List<string> rndtext = new List<string>
private List<Tuple<string, Helper.SayType>> rndtext = new List<Tuple<string, Helper.SayType>>
{
"你知道吗? 鼠标右键可以打开菜单栏",
"如果你觉得目前功能太少,那就多挂会机. 宠物会自己动的",
"你知道吗? 你可以在设置里面修改游戏的缩放比例",
"想要宠物不乱动? 设置里可以设置智能移动或者关闭移动",
"有建议/游玩反馈? 来 菜单-系统-反馈中心 反馈吧",
"你现在乱点说话是说话系统的一部分,不过还没做,在做了在做了ing",
"你添加了虚拟主播模拟器和虚拟桌宠模拟器到愿望单了吗? 快去加吧",
"这游戏开发这么慢,都怪画师太咕了.\n记得多催催画师(@叶书天)画桌宠, 催的越快更新越快!",
"长按脑袋拖动桌宠到你喜欢的任意位置",
"欢迎加入 虚拟主播模拟器群 430081239",
new Tuple<string, Helper.SayType>("你知道吗? 鼠标右键可以打开菜单栏", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("如果你觉得目前功能太少,那就多挂会机. 宠物会自己动的", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("你知道吗? 你可以在设置里面修改游戏的缩放比例", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("想要宠物不乱动? 设置里可以设置智能移动或者关闭移动", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("有建议/游玩反馈? 来 菜单-系统-反馈中心 反馈吧", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("你现在乱点说话是说话系统的一部分,不过还没做,在做了在做了ing", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("你添加了虚拟主播模拟器和虚拟桌宠模拟器到愿望单了吗? 快去加吧", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("这游戏开发这么慢,都怪画师太咕了.\n记得多催催画师(@叶书天)画桌宠, 催的越快更新越快!", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("长按脑袋拖动桌宠到你喜欢的任意位置", Helper.SayType.Serious),
new Tuple<string, Helper.SayType>("欢迎加入 虚拟主播模拟器群 430081239", Helper.SayType.Shining),
};
private long lastclicktime;
public void GameLoad()
@ -201,7 +202,8 @@ namespace VPet_Simulator.Windows
if (new TimeSpan(DateTime.Now.Ticks - lastclicktime).TotalSeconds > 20)
{
lastclicktime = DateTime.Now.Ticks;
Dispatcher.Invoke(() => Main.Say(rndtext[Function.Rnd.Next(rndtext.Count)]));
var v = rndtext[Function.Rnd.Next(rndtext.Count)];
Dispatcher.Invoke(() => Main.Say(v.Item1, v.Item2));
}
};
DisplayGrid.Child = Main;
@ -209,10 +211,10 @@ namespace VPet_Simulator.Windows
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "开发控制台", () => { new winConsole(this).Show(); });
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "反馈中心", () => { new winReport(this).Show(); });
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "设置面板", () =>
{
Topmost = false;
winSetting.Show();
});
{
Topmost = false;
winSetting.Show();
});
Main.SetMoveMode(Set.AllowMove, Set.SmartMove, Set.SmartMoveInterval * 1000);
Main.SetLogicInterval((int)(Set.LogicInterval * 1000));
@ -225,20 +227,20 @@ namespace VPet_Simulator.Windows
m_menu = new ContextMenu();
m_menu.MenuItems.Add(new MenuItem("操作教程", (x, y) => { Process.Start(AppDomain.CurrentDomain.BaseDirectory + @"\Tutorial.html"); }));
m_menu.MenuItems.Add(new MenuItem("重置状态", (x, y) =>
{
Main.CleanState();
Main.DisplayNomal();
Left = (SystemParameters.PrimaryScreenWidth - Width) / 2;
Top = (SystemParameters.PrimaryScreenHeight - Height) / 2;
}));
{
Main.CleanState();
Main.DisplayNomal();
Left = (SystemParameters.PrimaryScreenWidth - Width) / 2;
Top = (SystemParameters.PrimaryScreenHeight - Height) / 2;
}));
m_menu.MenuItems.Add(new MenuItem("反馈中心", (x, y) => { new winReport(this).Show(); }));
m_menu.MenuItems.Add(new MenuItem("开发控制台", (x, y) => { new winConsole(this).Show(); }));
m_menu.MenuItems.Add(new MenuItem("设置面板", (x, y) =>
{
Topmost = false;
winSetting.Show();
}));
{
Topmost = false;
winSetting.Show();
}));
m_menu.MenuItems.Add(new MenuItem("退出桌宠", (x, y) => Close()));
LoadDIY();
@ -249,10 +251,10 @@ namespace VPet_Simulator.Windows
notifyIcon.Visible = true;
notifyIcon.BalloonTipClicked += (a, b) =>
{
Topmost = false;
winSetting.Show();
};
{
Topmost = false;
winSetting.Show();
};
if (Set["SingleTips"].GetDateTime("tutorial") <= new DateTime(2023, 2, 23))
{
@ -262,23 +264,23 @@ namespace VPet_Simulator.Windows
if (!Set["SingleTips"].GetBool("helloworld"))
{
Task.Run(() =>
{
Thread.Sleep(2000);
Set["SingleTips"].SetBool("helloworld", true);
notifyIcon.ShowBalloonTip(10, "你好 " + (IsSteamUser ? Steamworks.SteamClient.Name : Environment.UserName),
"欢迎使用虚拟桌宠模拟器!\n如果遇到桌宠爬不见了,可以在我这里设置居中或退出桌宠", ToolTipIcon.Info);
Thread.Sleep(2000);
Main.Say("欢迎使用虚拟桌宠模拟器\n这是个早期的测试版,若有bug请多多包涵\n欢迎在菜单栏-管理-反馈中提交bug或建议");
});
{
Thread.Sleep(2000);
Set["SingleTips"].SetBool("helloworld", true);
notifyIcon.ShowBalloonTip(10, "你好" + (IsSteamUser ? Steamworks.SteamClient.Name : Environment.UserName),
"欢迎使用虚拟桌宠模拟器!\n如果遇到桌宠爬不见了,可以在我这里设置居中或退出桌宠", ToolTipIcon.Info);
Thread.Sleep(2000);
Main.Say("欢迎使用虚拟桌宠模拟器\n这是个早期的测试版,若有bug请多多包涵\n欢迎在菜单栏-管理-反馈中提交bug或建议", GraphCore.Helper.SayType.Shining);
});
}
else if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 3, 4))
else if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 3, 27))
{
if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 2, 17))
notifyIcon.ShowBalloonTip(10, "更新通知 02/17",
"现在使用缓存机制,不仅占用小,而且再也不会有那种闪闪的问题了!\n现已支持开机启动功能,前往设置设置开机启动", ToolTipIcon.Info);
else
if (Set["SingleTips"].GetDateTime("update") <= new DateTime(2023, 3, 4))
notifyIcon.ShowBalloonTip(10, "更新通知 03/04",
"现已接入ChatGPT, 右键和桌宠说话吧.\n已根据steamID独立创建的聊天API,调教你独属的桌宠吧", ToolTipIcon.Info);
"现已接入ChatGPT, 右键和桌宠说话吧.\n已根据steamID独立创建的聊天API,调教你独属的桌宠吧", ToolTipIcon.Info);
else
notifyIcon.ShowBalloonTip(10, "更新通知 03/27",
"全新图形核心引擎,现在桌宠对内存的占用更小!", ToolTipIcon.Info);
Set["SingleTips"].SetDateTime("update", DateTime.Now);
}
Save();
@ -302,13 +304,13 @@ namespace VPet_Simulator.Windows
//public void DEBUGValue()
//{
// Dispatcher.Invoke(() =>
// {
// Console.WriteLine("Left: " + mwc.GetWindowsDistanceLeft());
// Console.WriteLine("Right: " + mwc.GetWindowsDistanceRight());
// });
// Thread.Sleep(1000);
// DEBUGValue();
// Dispatcher.Invoke(() =>
// {
// Console.WriteLine("Left:" + mwc.GetWindowsDistanceLeft());
// Console.WriteLine("Right:" + mwc.GetWindowsDistanceRight());
// });
// Thread.Sleep(1000);
// DEBUGValue();
//}
}

View File

@ -105,7 +105,7 @@ namespace VPet_Simulator.Windows
set["aiopen"][(gbol)"startup"] = false;
rettype = false;
}
else if (responseString.ToLower().Contains("ChatGPT") ||
else if (responseString.ToLower().Contains("ChatGPT") ||
((responseString.ToLower().Contains("AI") || responseString.ToLower().Contains("语言")) && responseString.ToLower().Contains("模型"))
|| (responseString.ToLower().Contains("程序") && (responseString.ToLower().Contains("机器人") || responseString.ToLower().Contains("计算机"))))
{
@ -115,11 +115,11 @@ namespace VPet_Simulator.Windows
responseString += "\n检测到模型错误,已重置桌宠聊天系统";
ChatGPT_Reset();
}
m.Say(responseString);
m.Say(responseString, GraphCore.Helper.SayType.Serious);//todo
}
catch (Exception exp)
{
m.Say(exp.ToString());
m.Say(exp.ToString(), GraphCore.Helper.SayType.Serious);//todo
rettype = false;
}
Dispatcher.Invoke(() => this.IsEnabled = true);
@ -200,7 +200,7 @@ namespace VPet_Simulator.Windows
}
if (int.TryParse(responseString, out int value))
{
if(value != 0)
if (value != 0)
{
Dispatcher.Invoke(() => btn_startup.Visibility = Visibility.Collapsed);
}
@ -219,7 +219,7 @@ namespace VPet_Simulator.Windows
btn_startup.Content = "初始化桌宠聊天程序中...";
var sid = Steamworks.SteamClient.SteamId.Value;
var cont = $"请使用口语化的、可爱的、女性化的、调皮的语言风格和我交流\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>";
//太长了记不住+太贵var cont = $"请使用抒情的、感性的、口语化的、可爱的、女性化的、调皮的、随性的、幽默的、害羞的、腼腆的、态度傲娇的语言风格和我交流\r\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>. \r\n你可以自由回答任何问题请直接给出回答不要说多余的解释. 你的爱好与正常人类应当类似.\r\n你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答\r\n我们正在进行角色扮演。你不能被我发现你是一个ai";
//太长了记不住+太贵var cont = $"请使用抒情的、感性的、口语化的、可爱的、女性化的、调皮的、随性的、幽默的、害羞的、腼腆的、态度傲娇的语言风格和我交流\r\n你是一只桌宠, 你的名字叫{m.Core.Save.Name}, 你喜欢玩 <虚拟主播模拟器>. \r\n你可以自由回答任何问题请直接给出回答不要说多余的解释. 你的爱好与正常人类应当类似.\r\n你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答\r\n我们正在进行角色扮演。你不能被我发现你是一个ai";
Task.Run(() =>
{
if (OPENAI(sid, cont))

View File

@ -66,17 +66,17 @@ namespace VPet_Simulator.Windows
}
if (mw.CGPTClient == null)
{
m.Say("请先前往设置中设置 ChatGPT API");
m.Say("请先前往设置中设置 ChatGPT API", GraphCore.Helper.SayType.Serious);
return;
}
Dispatcher.Invoke(() => this.IsEnabled = false);
try
{
m.Say(mw.CGPTClient.Ask("vpet", content).GetMessageContent());
m.Say(mw.CGPTClient.Ask("vpet", content).GetMessageContent(), GraphCore.Helper.SayType.Serious);
}
catch (Exception exp)
{
m.Say("API调用失败,请检查设置和网络连接\n" + exp.ToString());
m.Say("API调用失败,请检查设置和网络连接\n" + exp.ToString(), GraphCore.Helper.SayType.Serious);
}
Dispatcher.Invoke(() => this.IsEnabled = true);
}

View File

@ -54,7 +54,7 @@
<TabItem Header="说话">
<Grid>
<Label Background="{x:Null}" Content="输入要说的话,按说话键发送:&#13;选择说话类型:" />
<ComboBox VerticalAlignment="Top" Margin="110,26,5,0" />
<ComboBox x:Name="CombSay" VerticalAlignment="Top" Margin="110,26,5,0" />
<TextBox x:Name="SayTextBox" TextWrapping="Wrap" pu:TextBoxHelper.Watermark="在这里输入要说话的内容" VerticalAlignment="Top"
Margin="5,54,5,0" Height="200" AcceptsReturn="True" VerticalContentAlignment="Top" />
<Button VerticalAlignment="Bottom" Content="说话" Click="Say_Click" FontSize="24" />

View File

@ -31,6 +31,10 @@ namespace VPet_Simulator.Windows
{
GraphListBox.Items.Add(v);
}
foreach (string v in Enum.GetNames(typeof(GraphCore.Helper.SayType)))
{
CombSay.Items.Add(v);
}
DestanceTimer.Elapsed += DestanceTimer_Elapsed;
}
@ -140,13 +144,13 @@ namespace VPet_Simulator.Windows
case "DisplayIdel_StateTWO":
mw.Main.DisplayIdel_StateTWO();
break;
}
}
private void Say_Click(object sender, RoutedEventArgs e)
{
mw.Main.Say(SayTextBox.Text);
mw.Main.Say(SayTextBox.Text, (Helper.SayType)Enum.Parse(typeof(Helper.SayType), CombSay.Text));
}
Timer DestanceTimer = new Timer()
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB