mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
parent
3c52b72226
commit
20021342ca
@ -24,6 +24,14 @@ namespace VPet_Simulator.Windows.Interface
|
||||
/// </summary>
|
||||
List<PetLoader> Pets { get; }
|
||||
/// <summary>
|
||||
/// 所有可用聊天API
|
||||
/// </summary>
|
||||
List<TalkBox> TalkAPI { get; }
|
||||
/// <summary>
|
||||
/// 当前正在使用的TalkBox
|
||||
/// </summary>
|
||||
TalkBox TalkBoxCurr { get; }
|
||||
/// <summary>
|
||||
/// 桌宠数据核心
|
||||
/// </summary>
|
||||
GameCore Core { get; }
|
||||
|
33
VPet-Simulator.Windows.Interface/TalkBox.xaml
Normal file
33
VPet-Simulator.Windows.Interface/TalkBox.xaml
Normal file
@ -0,0 +1,33 @@
|
||||
<UserControl x:Class="VPet_Simulator.Windows.Interface.TalkBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:VPet_Simulator.Windows.Interface"
|
||||
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" mc:Ignorable="d"
|
||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" Height="500" Width="500" VerticalAlignment="Top">
|
||||
<Border Background="{DynamicResource PrimaryLighter}" BorderBrush="{DynamicResource Primary}" BorderThickness="5"
|
||||
VerticalAlignment="Top" Margin="5,50,5,5" CornerRadius="5" Padding="5,5,5,3">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="2" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="tbTalk" Style="{DynamicResource StandardTextBoxStyle}" Height="Auto"
|
||||
pu:TextBoxHelper.Watermark="{ll:Str 和桌宠说}" FontSize="30" AcceptsReturn="True"
|
||||
TextWrapping="WrapWithOverflow" PreviewKeyDown="tbTalk_KeyDown" />
|
||||
<Button pu:ButtonHelper.CornerRadius="4" Content="{ll:Str '发送'}" BorderThickness="2"
|
||||
Background="{DynamicResource SecondaryLight}" Grid.Column="2"
|
||||
BorderBrush="{DynamicResource DARKPrimaryDarker}" FontSize="30"
|
||||
ToolTip="{ll:Str '按 Ctrl+Enter 发送'}"
|
||||
Click="Send_Click" />
|
||||
<Grid x:Name="PublicGrid" Grid.Row="2" Grid.ColumnSpan="3" x:FieldModifier="public" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
72
VPet-Simulator.Windows.Interface/TalkBox.xaml.cs
Normal file
72
VPet-Simulator.Windows.Interface/TalkBox.xaml.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
|
||||
namespace VPet_Simulator.Windows.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 聊天API接口/显示类
|
||||
/// </summary>
|
||||
public abstract partial class TalkBox : UserControl
|
||||
{
|
||||
MainPlugin MainPlugin;
|
||||
public TalkBox(MainPlugin mainPlugin)
|
||||
{
|
||||
InitializeComponent();
|
||||
MainPlugin = mainPlugin;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据内容进行回应 (异步)
|
||||
/// </summary>
|
||||
/// <param name="text">内容</param>
|
||||
public abstract void Responded(string text);
|
||||
/// <summary>
|
||||
/// 该聊天接口名字
|
||||
/// </summary>
|
||||
public abstract string APIName { get; }
|
||||
|
||||
private void Send_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tbTalk.Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var cont = tbTalk.Text;
|
||||
tbTalk.Text = "";
|
||||
Task.Run(() => Responded(cont));
|
||||
}
|
||||
/// <summary>
|
||||
/// 聊天设置
|
||||
/// </summary>
|
||||
public abstract void Setting();
|
||||
|
||||
private void tbTalk_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter && e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control))
|
||||
{
|
||||
Send_Click(sender, e);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
if (tbTalk.Text.Length > 0)
|
||||
{
|
||||
MainPlugin.MW.Main.ToolBar.CloseTimer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainPlugin.MW.Main.ToolBar.CloseTimer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@ namespace VPet_Simulator.Windows
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
public int version { get; } = 104;
|
||||
public int version { get; } = 105;
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
@ -808,6 +808,25 @@ namespace VPet_Simulator.Windows
|
||||
/// 关闭指示器,默认为true
|
||||
/// </summary>
|
||||
public bool CloseConfirm { get; private set; } = true;
|
||||
|
||||
public List<TalkBox> TalkAPI { get; } = new List<TalkBox>();
|
||||
/// <summary>
|
||||
/// 当前选择的对话框index
|
||||
/// </summary>
|
||||
public int TalkAPIIndex = -1;
|
||||
/// <summary>
|
||||
/// 当前对话框
|
||||
/// </summary>
|
||||
public TalkBox TalkBoxCurr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TalkAPIIndex == -1)
|
||||
return null;
|
||||
return TalkAPI[TalkAPIIndex];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 超模工作检查
|
||||
/// </summary>
|
||||
|
@ -6,7 +6,8 @@
|
||||
xmlns:local="clr-namespace:VPet_Simulator.Windows"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib" Title="{ll:Str 设置}" Width="{ll:Dbe SettingWidth, DefValue=500}" Height="550" Closing="WindowX_Closing" FontSize="16"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib" Title="{ll:Str 设置}" Width="{ll:Dbe SettingWidth,
|
||||
DefValue=500}" Height="550" Closing="WindowX_Closing" FontSize="16"
|
||||
Style="{DynamicResource BaseWindowXStyle}" Topmost="True" WindowStartupLocation="CenterScreen" mc:Ignorable="d">
|
||||
<!--<pu:WindowX.Resources>
|
||||
<DataTemplate x:Key="DIYDataTemplate">
|
||||
@ -238,11 +239,6 @@
|
||||
<system:Int32>-1</system:Int32>
|
||||
</ComboBoxItem.Tag>
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem Content="{ll:Str 每2分钟一次}">
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>2</system:Int32>
|
||||
</ComboBoxItem.Tag>
|
||||
</ComboBoxItem>
|
||||
<ComboBoxItem Content="{ll:Str 每5分钟一次}">
|
||||
<ComboBoxItem.Tag>
|
||||
<system:Int32>5</system:Int32>
|
||||
@ -324,10 +320,10 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<!--<RadioButton x:Name="RBCGPTUseAPI" Grid.Column="1" Checked="CGPType_Checked"
|
||||
<RadioButton x:Name="RBCGPTUseAPI" Grid.Column="1" Checked="CGPType_Checked"
|
||||
Content="{ll:Str '使用从ChatGPT\ 申请的的API'}" GroupName="cgpttype"
|
||||
Style="{DynamicResource StandardRadioButtonStyle}"
|
||||
ToolTip="{ll:Str 需要去OpenAI官网申请}" />-->
|
||||
ToolTip="{ll:Str 需要去OpenAI官网申请}" />
|
||||
<RadioButton x:Name="RBCGPTUseLB" Checked="CGPType_Checked"
|
||||
Content="{ll:Str '使用桌宠选项式\ 聊天功能'}" GroupName="cgpttype" IsChecked="True"
|
||||
Style="{DynamicResource StandardRadioButtonStyle}"
|
||||
|
@ -163,12 +163,29 @@ namespace VPet_Simulator.Windows
|
||||
runActivate.Text = "尚未激活 您可能需要启动Steam或去Steam上免费领个".Translate();
|
||||
}
|
||||
//CGPT
|
||||
if (mw.TalkAPI.Count > 0)
|
||||
{
|
||||
foreach (var v in mw.TalkAPI)
|
||||
cbChatAPISelect.Items.Add(v.APIName.Translate());
|
||||
if (mw.TalkAPIIndex != -1)
|
||||
cbChatAPISelect.SelectedIndex = mw.TalkAPIIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
cbChatAPISelect.Items.Add("暂无聊天API, 您可以通过订阅MOD添加".Translate());
|
||||
cbChatAPISelect.SelectedIndex = 0;
|
||||
cbChatAPISelect.IsEnabled = false;
|
||||
}
|
||||
switch (mw.Set["CGPT"][(gstr)"type"])
|
||||
{
|
||||
//case "API":
|
||||
// RBCGPTUseAPI.IsChecked = true;
|
||||
// BtnCGPTReSet.Content = "打开 ChatGPT API 设置".Translate();
|
||||
// break;
|
||||
case "DIY":
|
||||
RBCGPTDIY.IsChecked = true;
|
||||
BtnCGPTReSet.Content = "打开 {0} 设置".Translate(mw.TalkBoxCurr?.APIName ?? "Steam Workshop");
|
||||
break;
|
||||
case "LB":
|
||||
RBCGPTUseLB.IsChecked = true;
|
||||
BtnCGPTReSet.Content = "初始化桌宠聊天程序".Translate();
|
||||
@ -860,6 +877,9 @@ namespace VPet_Simulator.Windows
|
||||
//case "API":
|
||||
// new winCGPTSetting(mw).ShowDialog();
|
||||
// break;
|
||||
case "DIY":
|
||||
|
||||
break;
|
||||
case "LB":
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
|
18
VPet.sln
18
VPet.sln
@ -18,58 +18,40 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{7BD4CB1D-C8F3-4349-9BF0-CD11789130BA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{692CE45E-01A9-4500-8B1D-AFC0FE2767FA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Debug|x64.Build.0 = Debug|x64
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Debug|x86.Build.0 = Debug|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Release|Any CPU.Build.0 = Release|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Release|x64.ActiveCfg = Release|x64
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Release|x64.Build.0 = Release|x64
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Release|x86.ActiveCfg = Release|x86
|
||||
{B5C2DD17-735F-4F9F-82E4-B8692AEC03F1}.Release|x86.Build.0 = Release|x86
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
|
Loading…
Reference in New Issue
Block a user