mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
聊天API接口相关设置实现
This commit is contained in:
parent
00facd5bef
commit
88649bb146
@ -26,11 +26,11 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有可用聊天API
|
/// 所有可用聊天API
|
||||||
/// </summary>
|
/// </summary>
|
||||||
List<TalkBox> TalkAPI { get; }
|
List<ITalkAPI> TalkAPI { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前正在使用的TalkBox
|
/// 当前正在使用的TalkBox
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TalkBox TalkBoxCurr { get; }
|
ITalkAPI TalkBoxCurr { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 桌宠数据核心
|
/// 桌宠数据核心
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -18,7 +18,7 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 聊天API接口/显示类
|
/// 聊天API接口/显示类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract partial class TalkBox : UserControl
|
public abstract partial class TalkBox : UserControl, ITalkAPI
|
||||||
{
|
{
|
||||||
MainPlugin MainPlugin;
|
MainPlugin MainPlugin;
|
||||||
public TalkBox(MainPlugin mainPlugin)
|
public TalkBox(MainPlugin mainPlugin)
|
||||||
@ -49,7 +49,7 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 聊天设置
|
/// 聊天设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Setting();
|
public abstract void Setting();
|
||||||
|
|
||||||
private void tbTalk_KeyDown(object sender, KeyEventArgs e)
|
private void tbTalk_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
@ -68,5 +68,22 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
MainPlugin.MW.Main.ToolBar.CloseTimer.Start();
|
MainPlugin.MW.Main.ToolBar.CloseTimer.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public UIElement This => this;
|
||||||
|
}
|
||||||
|
public interface ITalkAPI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 显示的窗口
|
||||||
|
/// </summary>
|
||||||
|
UIElement This { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 该聊天接口名字
|
||||||
|
/// </summary>
|
||||||
|
string APIName { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// 聊天设置
|
||||||
|
/// </summary>
|
||||||
|
void Setting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ namespace VPet_Simulator.Windows
|
|||||||
if (obj.DisplayType.Name == "music")
|
if (obj.DisplayType.Name == "music")
|
||||||
SteamFriends.SetRichPresence("steam_display", "#Status_Music");
|
SteamFriends.SetRichPresence("steam_display", "#Status_Music");
|
||||||
else
|
else
|
||||||
SteamFriends.SetRichPresence("steam_display", "#Status_IDLE");
|
SteamFriends.SetRichPresence("steam_display", "#Status_IDLE(test)");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -809,7 +809,7 @@ namespace VPet_Simulator.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CloseConfirm { get; private set; } = true;
|
public bool CloseConfirm { get; private set; } = true;
|
||||||
|
|
||||||
public List<TalkBox> TalkAPI { get; } = new List<TalkBox>();
|
public List<ITalkAPI> TalkAPI { get; } = new List<ITalkAPI>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前选择的对话框index
|
/// 当前选择的对话框index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -817,7 +817,7 @@ namespace VPet_Simulator.Windows
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前对话框
|
/// 当前对话框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TalkBox TalkBoxCurr
|
public ITalkAPI TalkBoxCurr
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -826,7 +826,30 @@ namespace VPet_Simulator.Windows
|
|||||||
return TalkAPI[TalkAPIIndex];
|
return TalkAPI[TalkAPIIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 移除所有聊天对话框
|
||||||
|
/// </summary>
|
||||||
|
public void RemoveTalkBox()
|
||||||
|
{
|
||||||
|
if (TalkBox != null)
|
||||||
|
{
|
||||||
|
Main.ToolBar.MainGrid.Children.Remove(TalkBox);
|
||||||
|
TalkBox = null;
|
||||||
|
}
|
||||||
|
if (TalkAPIIndex == -1)
|
||||||
|
return;
|
||||||
|
Main.ToolBar.MainGrid.Children.Remove(TalkAPI[TalkAPIIndex].This);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 加载自定义对话框
|
||||||
|
/// </summary>
|
||||||
|
public void LoadTalkDIY()
|
||||||
|
{
|
||||||
|
RemoveTalkBox();
|
||||||
|
if (TalkAPIIndex == -1)
|
||||||
|
return;
|
||||||
|
Main.ToolBar.MainGrid.Children.Add(TalkAPI[TalkAPIIndex].This);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 超模工作检查
|
/// 超模工作检查
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -852,5 +875,6 @@ namespace VPet_Simulator.Windows
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ namespace VPet_Simulator.Windows
|
|||||||
}
|
}
|
||||||
if (Set.TopMost)
|
if (Set.TopMost)
|
||||||
{
|
{
|
||||||
Topmost= true;
|
Topmost = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -496,6 +496,10 @@ namespace VPet_Simulator.Windows
|
|||||||
LoadingText.Content = "正在加载CGPT".Translate();
|
LoadingText.Content = "正在加载CGPT".Translate();
|
||||||
switch (Set["CGPT"][(gstr)"type"])
|
switch (Set["CGPT"][(gstr)"type"])
|
||||||
{
|
{
|
||||||
|
case "DIY":
|
||||||
|
TalkAPIIndex = TalkAPI.FindIndex(x => x.APIName == Set["CGPT"][(gstr)"DIY"]);
|
||||||
|
LoadTalkDIY();
|
||||||
|
break;
|
||||||
//case "API":
|
//case "API":
|
||||||
// TalkBox = new TalkBoxAPI(this);
|
// TalkBox = new TalkBoxAPI(this);
|
||||||
// Main.ToolBar.MainGrid.Children.Add(TalkBox);
|
// Main.ToolBar.MainGrid.Children.Add(TalkBox);
|
||||||
|
@ -878,7 +878,7 @@ namespace VPet_Simulator.Windows
|
|||||||
// new winCGPTSetting(mw).ShowDialog();
|
// new winCGPTSetting(mw).ShowDialog();
|
||||||
// break;
|
// break;
|
||||||
case "DIY":
|
case "DIY":
|
||||||
|
mw.TalkBoxCurr?.Setting();
|
||||||
break;
|
break;
|
||||||
case "LB":
|
case "LB":
|
||||||
//Task.Run(() =>
|
//Task.Run(() =>
|
||||||
@ -905,6 +905,10 @@ namespace VPet_Simulator.Windows
|
|||||||
{
|
{
|
||||||
mw.Set["CGPT"][(gstr)"type"] = "LB";
|
mw.Set["CGPT"][(gstr)"type"] = "LB";
|
||||||
}
|
}
|
||||||
|
else if (RBCGPTDIY.IsChecked == true)
|
||||||
|
{
|
||||||
|
mw.Set["CGPT"][(gstr)"type"] = "DIY";
|
||||||
|
}
|
||||||
//else if (RBCGPTUseAPI.IsChecked == true)
|
//else if (RBCGPTUseAPI.IsChecked == true)
|
||||||
//{
|
//{
|
||||||
// mw.Set["CGPT"][(gstr)"type"] = "API";
|
// mw.Set["CGPT"][(gstr)"type"] = "API";
|
||||||
@ -925,18 +929,22 @@ namespace VPet_Simulator.Windows
|
|||||||
// mw.TalkBox = new TalkBoxAPI(mw);
|
// mw.TalkBox = new TalkBoxAPI(mw);
|
||||||
// mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox);
|
// mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox);
|
||||||
// break;
|
// break;
|
||||||
|
case "DIY":
|
||||||
|
BtnCGPTReSet.IsEnabled = true;
|
||||||
|
mw.RemoveTalkBox();
|
||||||
|
BtnCGPTReSet.Content = "打开 {0} 设置".Translate(mw.TalkBoxCurr?.APIName ?? "Steam Workshop");
|
||||||
|
mw.LoadTalkDIY();
|
||||||
|
break;
|
||||||
case "LB":
|
case "LB":
|
||||||
|
mw.RemoveTalkBox();
|
||||||
BtnCGPTReSet.IsEnabled = true;
|
BtnCGPTReSet.IsEnabled = true;
|
||||||
BtnCGPTReSet.Content = "初始化桌宠聊天程序".Translate();
|
BtnCGPTReSet.Content = "初始化桌宠聊天程序".Translate();
|
||||||
if (mw.TalkBox != null)
|
|
||||||
mw.Main.ToolBar.MainGrid.Children.Remove(mw.TalkBox);
|
|
||||||
mw.TalkBox = new TalkSelect(mw);
|
mw.TalkBox = new TalkSelect(mw);
|
||||||
mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox);
|
mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox);
|
||||||
break;
|
break;
|
||||||
case "OFF":
|
case "OFF":
|
||||||
default:
|
default:
|
||||||
if (mw.TalkBox != null)
|
mw.RemoveTalkBox();
|
||||||
mw.Main.ToolBar.MainGrid.Children.Remove(mw.TalkBox);
|
|
||||||
BtnCGPTReSet.IsEnabled = false;
|
BtnCGPTReSet.IsEnabled = false;
|
||||||
BtnCGPTReSet.Content = "聊天框已关闭".Translate();
|
BtnCGPTReSet.Content = "聊天框已关闭".Translate();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user