2023-02-27 12:29:40 +00:00
|
|
|
|
using LinePutScript;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
using LinePutScript.Localization.WPF;
|
2024-06-23 08:21:27 +00:00
|
|
|
|
using NAudio.SoundFont;
|
2023-02-27 12:29:40 +00:00
|
|
|
|
using Panuon.WPF.UI;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
using Steamworks;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
using Steamworks.Ugc;
|
2023-01-03 04:18:21 +00:00
|
|
|
|
using System;
|
2023-06-23 20:08:08 +00:00
|
|
|
|
using System.Collections.Generic;
|
2023-01-23 17:31:16 +00:00
|
|
|
|
using System.Diagnostics;
|
2023-02-17 05:33:46 +00:00
|
|
|
|
using System.IO;
|
2023-06-23 13:15:57 +00:00
|
|
|
|
using System.Linq;
|
2024-06-23 08:21:27 +00:00
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Text;
|
2023-08-10 11:34:11 +00:00
|
|
|
|
using System.Threading;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2024-06-23 08:21:27 +00:00
|
|
|
|
using System.Web;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
2024-03-31 16:47:05 +00:00
|
|
|
|
using System.Windows.Media.Imaging;
|
2023-08-10 11:34:11 +00:00
|
|
|
|
using System.Windows.Threading;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
using VPet_Simulator.Core;
|
2023-08-20 13:09:07 +00:00
|
|
|
|
using VPet_Simulator.Windows.Interface;
|
2024-02-22 18:46:23 +00:00
|
|
|
|
using static VPet_Simulator.Windows.Win32;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
namespace VPet_Simulator.Windows
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// winGameSetting.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
2023-01-03 04:18:21 +00:00
|
|
|
|
public partial class winGameSetting : WindowX
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
2023-01-10 10:43:32 +00:00
|
|
|
|
MainWindow mw;
|
|
|
|
|
private bool AllowChange = false;
|
|
|
|
|
public winGameSetting(MainWindow mw)
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
2023-01-23 17:31:16 +00:00
|
|
|
|
this.mw = mw;
|
2023-02-23 04:12:14 +00:00
|
|
|
|
//Console.WriteLine(DateTime.Now.ToString("mm:ss.fff"));
|
2022-12-28 10:03:47 +00:00
|
|
|
|
InitializeComponent();
|
2023-02-23 04:12:14 +00:00
|
|
|
|
//Console.WriteLine(DateTime.Now.ToString("mm:ss.fff"));
|
|
|
|
|
//var bit = new BitmapImage(new Uri("pack://application:,,,/Res/TopLogo2019.png"));
|
|
|
|
|
//Console.WriteLine(DateTime.Now.ToString("mm:ss.fff"));
|
|
|
|
|
////ImageWHY.Source = bit;
|
|
|
|
|
//Console.WriteLine(DateTime.Now.ToString("mm:ss.fff"));
|
2023-10-10 17:03:23 +00:00
|
|
|
|
|
|
|
|
|
Title = "设置".Translate() + ' ' + mw.PrefixSave;
|
2023-10-11 16:08:04 +00:00
|
|
|
|
SettingMenuWidth.Width = new GridLength(LocalizeCore.GetDouble("SettingMenuWidth", 150));
|
2023-01-10 10:43:32 +00:00
|
|
|
|
TopMostBox.IsChecked = mw.Set.TopMost;
|
2023-01-23 17:31:16 +00:00
|
|
|
|
if (mw.Set.IsBiggerScreen)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
FullScreenBox.IsChecked = true;
|
|
|
|
|
ZoomSlider.Maximum = 8;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FullScreenBox.IsChecked = false;
|
|
|
|
|
ZoomSlider.Maximum = 3;
|
|
|
|
|
}
|
|
|
|
|
ZoomSlider.Value = mw.Set.ZoomLevel * 2;
|
2023-03-13 15:40:04 +00:00
|
|
|
|
//this.Width = 400 * Math.Sqrt(ZoomSlider.Value);
|
|
|
|
|
//this.Height = 450 * Math.Sqrt(ZoomSlider.Value);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
|
2023-05-10 03:13:34 +00:00
|
|
|
|
CalFunctionBox.IsChecked = mw.Set.EnableFunction;
|
2023-01-24 06:56:16 +00:00
|
|
|
|
CalSlider.Value = mw.Set.LogicInterval;
|
|
|
|
|
InteractionSlider.Value = mw.Set.InteractionCycle;
|
|
|
|
|
MoveEventBox.IsChecked = mw.Set.AllowMove;
|
|
|
|
|
SmartMoveEventBox.IsChecked = mw.Set.SmartMove;
|
2023-02-03 12:41:21 +00:00
|
|
|
|
PressLengthSlider.Value = mw.Set.PressLength / 1000.0;
|
2023-05-30 16:51:17 +00:00
|
|
|
|
SwitchMsgOut.IsChecked = mw.Set.MessageBarOutside;
|
2023-09-16 09:33:54 +00:00
|
|
|
|
SwitchHideFromTaskControl.IsChecked = mw.Set.HideFromTaskControl;
|
2023-01-24 06:56:16 +00:00
|
|
|
|
|
2023-02-17 05:33:46 +00:00
|
|
|
|
StartUpBox.IsChecked = mw.Set.StartUPBoot;
|
|
|
|
|
StartUpSteamBox.IsChecked = mw.Set.StartUPBootSteam;
|
2023-02-18 03:49:13 +00:00
|
|
|
|
TextBoxPetName.Text = mw.Core.Save.Name;
|
2023-01-24 06:56:16 +00:00
|
|
|
|
foreach (PetLoader pl in mw.Pets)
|
|
|
|
|
{
|
2023-07-03 11:41:02 +00:00
|
|
|
|
PetBox.Items.Add(pl.Name.Translate());
|
2023-01-24 06:56:16 +00:00
|
|
|
|
}
|
2023-02-18 02:46:08 +00:00
|
|
|
|
int petboxid = mw.Pets.FindIndex(x => x.Name == mw.Set.PetGraph);
|
|
|
|
|
if (petboxid == -1)
|
|
|
|
|
petboxid = 0;
|
|
|
|
|
PetBox.SelectedIndex = petboxid;
|
2023-10-15 13:12:00 +00:00
|
|
|
|
petboxbef = petboxid;
|
2023-07-03 11:41:02 +00:00
|
|
|
|
PetIntor.Text = mw.Pets[petboxid].Intor.Translate();
|
2023-01-24 06:56:16 +00:00
|
|
|
|
|
2023-04-03 18:11:12 +00:00
|
|
|
|
TextBoxStartUpX.Text = mw.Set.StartRecordPoint.X.ToString();
|
|
|
|
|
TextBoxStartUpY.Text = mw.Set.StartRecordPoint.Y.ToString();
|
2023-06-23 13:15:57 +00:00
|
|
|
|
numBackupSaveMaxNum.Value = mw.Set.BackupSaveMaxNum;
|
2023-06-23 20:08:08 +00:00
|
|
|
|
combCalFunState.SelectedIndex = (int)mw.Set.CalFunState;
|
|
|
|
|
combCalFunState.IsEnabled = !mw.Set.EnableFunction;
|
2023-06-24 05:40:06 +00:00
|
|
|
|
CalTimeInteraction();
|
2023-07-03 11:41:02 +00:00
|
|
|
|
|
2023-08-25 22:08:13 +00:00
|
|
|
|
swAutoCal.IsChecked = !mw.Set["gameconfig"].GetBool("noAutoCal");
|
|
|
|
|
|
2023-10-19 14:30:05 +00:00
|
|
|
|
LoadMutiUI();
|
2023-08-25 22:08:13 +00:00
|
|
|
|
|
2023-07-03 11:41:02 +00:00
|
|
|
|
LanguageBox.Items.Add("null");
|
|
|
|
|
foreach (string v in LocalizeCore.AvailableCultures)
|
|
|
|
|
{
|
|
|
|
|
LanguageBox.Items.Add(v);
|
|
|
|
|
}
|
|
|
|
|
LanguageBox.SelectedItem = LocalizeCore.CurrentCulture;
|
|
|
|
|
|
|
|
|
|
HitThroughBox.IsChecked = mw.Set.HitThrough;
|
|
|
|
|
PetHelperBox.IsChecked = mw.Set.PetHelper;
|
|
|
|
|
|
2023-04-03 18:11:12 +00:00
|
|
|
|
if (mw.Set.StartRecordLast == true)
|
|
|
|
|
{
|
|
|
|
|
StartPlace.IsChecked = true;
|
|
|
|
|
TextBoxStartUpX.IsEnabled = false;
|
|
|
|
|
TextBoxStartUpY.IsEnabled = false;
|
|
|
|
|
BtnStartUpGet.IsEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
StartPlace.IsChecked = false;
|
|
|
|
|
TextBoxStartUpX.IsEnabled = true;
|
|
|
|
|
TextBoxStartUpY.IsEnabled = true;
|
|
|
|
|
BtnStartUpGet.IsEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-11 02:47:09 +00:00
|
|
|
|
if (mw.Set.Diagnosis)
|
|
|
|
|
RBDiagnosisYES.IsChecked = true;
|
2023-10-20 11:10:38 +00:00
|
|
|
|
else
|
|
|
|
|
RBDiagnosisNO.IsChecked = true;
|
2023-08-11 02:47:09 +00:00
|
|
|
|
|
2023-08-11 16:44:28 +00:00
|
|
|
|
List<int> cbDiagnosis = new List<int> { 200, 500, 1000, 2000, 5000, 10000, 20000 };
|
2023-08-11 02:47:09 +00:00
|
|
|
|
int ds = cbDiagnosis.IndexOf(mw.Set.DiagnosisInterval);
|
|
|
|
|
if (ds == -1)
|
|
|
|
|
ds = 1;
|
|
|
|
|
CBDiagnosis.SelectedIndex = ds;
|
|
|
|
|
|
2023-01-24 06:56:16 +00:00
|
|
|
|
foreach (ComboBoxItem v in CBAutoSave.Items)
|
|
|
|
|
{
|
|
|
|
|
if ((int)v.Tag == mw.Set.AutoSaveInterval)
|
|
|
|
|
{
|
|
|
|
|
CBAutoSave.SelectedItem = v;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach (ComboBoxItem v in CBSmartMove.Items)
|
|
|
|
|
{
|
|
|
|
|
if ((int)v.Tag == mw.Set.SmartMoveInterval)
|
|
|
|
|
{
|
|
|
|
|
CBSmartMove.SelectedItem = v;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-28 14:02:28 +00:00
|
|
|
|
foreach (var v in mw.Fonts)
|
|
|
|
|
{
|
2024-03-30 09:59:45 +00:00
|
|
|
|
FontBox.Items.Add(v.TranslateName);
|
2024-02-28 14:02:28 +00:00
|
|
|
|
}
|
2024-03-30 09:59:45 +00:00
|
|
|
|
FontBox.SelectedIndex = mw.Fonts.FindIndex(x => x.Name == mw.Set.Font);
|
2024-02-28 14:02:28 +00:00
|
|
|
|
|
|
|
|
|
foreach (var v in mw.Themes)
|
|
|
|
|
{
|
2024-03-30 09:59:45 +00:00
|
|
|
|
ThemeBox.Items.Add(v.TranslateName);
|
2024-02-28 14:02:28 +00:00
|
|
|
|
}
|
|
|
|
|
if (mw.Theme != null)
|
2024-03-30 09:59:45 +00:00
|
|
|
|
ThemeBox.SelectedItem = mw.Theme.TranslateName;
|
2024-02-28 14:02:28 +00:00
|
|
|
|
|
2023-08-15 15:36:38 +00:00
|
|
|
|
VoiceCatchSilder.Value = mw.Set.MusicCatch;
|
|
|
|
|
VoiceMaxSilder.Value = mw.Set.MusicMax;
|
|
|
|
|
|
2023-02-27 12:29:40 +00:00
|
|
|
|
foreach (Sub sub in mw.Set["diy"])
|
|
|
|
|
StackDIY.Children.Add(new DIYViewer(sub));
|
|
|
|
|
|
2023-08-13 14:39:46 +00:00
|
|
|
|
SliderResolution.Maximum = Math.Min(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
|
2023-08-12 06:09:20 +00:00
|
|
|
|
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
|
|
|
|
|
SliderResolution.Value = mw.Set.Resolution;
|
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
#if X64
|
2023-08-25 22:31:44 +00:00
|
|
|
|
GameVerison.Content = "游戏版本".Translate() + $"v{mw.Version} x64";
|
2023-01-10 10:43:32 +00:00
|
|
|
|
#else
|
2023-08-25 22:31:44 +00:00
|
|
|
|
GameVerison.Content = "游戏版本".Translate() + $"v{mw.Version} x86";
|
2023-01-10 10:43:32 +00:00
|
|
|
|
#endif
|
|
|
|
|
//关于ui
|
|
|
|
|
if (mw.IsSteamUser)
|
|
|
|
|
{
|
2023-11-24 07:22:08 +00:00
|
|
|
|
runUserName.Text = SteamClient.Name;
|
|
|
|
|
runActivate.Text = "已通过Steam[{0}]激活服务注册".Translate(SteamClient.SteamId.Value.ToString("x").Substring(6));
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
runUserName.Text = Environment.UserName;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
runActivate.Text = "尚未激活 您可能需要启动Steam或去Steam上免费领个".Translate();
|
2024-06-23 08:21:27 +00:00
|
|
|
|
btn_fixdata.Visibility = Visibility.Collapsed;
|
2023-03-13 15:40:04 +00:00
|
|
|
|
}
|
2023-08-08 03:54:10 +00:00
|
|
|
|
//CGPT
|
2023-09-03 18:55:41 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2023-08-08 03:54:10 +00:00
|
|
|
|
switch (mw.Set["CGPT"][(gstr)"type"])
|
2023-03-13 15:40:04 +00:00
|
|
|
|
{
|
2023-09-03 15:06:43 +00:00
|
|
|
|
//case "API":
|
|
|
|
|
// RBCGPTUseAPI.IsChecked = true;
|
|
|
|
|
// BtnCGPTReSet.Content = "打开 ChatGPT API 设置".Translate();
|
|
|
|
|
// break;
|
2023-09-03 18:55:41 +00:00
|
|
|
|
case "DIY":
|
|
|
|
|
RBCGPTDIY.IsChecked = true;
|
|
|
|
|
BtnCGPTReSet.Content = "打开 {0} 设置".Translate(mw.TalkBoxCurr?.APIName ?? "Steam Workshop");
|
|
|
|
|
break;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
case "LB":
|
|
|
|
|
RBCGPTUseLB.IsChecked = true;
|
|
|
|
|
BtnCGPTReSet.Content = "初始化桌宠聊天程序".Translate();
|
2024-03-20 18:59:11 +00:00
|
|
|
|
//if (!mf.IsSteamUser)
|
2023-08-26 15:43:19 +00:00
|
|
|
|
// BtnCGPTReSet.IsEnabled = false;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
break;
|
|
|
|
|
case "OFF":
|
|
|
|
|
default:
|
|
|
|
|
RBCGPTClose.IsChecked = true;
|
|
|
|
|
BtnCGPTReSet.Content = "聊天框已关闭".Translate();
|
|
|
|
|
break;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
2023-08-25 22:31:44 +00:00
|
|
|
|
runabVer.Text = $"v{mw.Version} ({mw.version})";
|
2023-01-10 10:43:32 +00:00
|
|
|
|
|
|
|
|
|
//mod列表
|
|
|
|
|
ShowModList();
|
|
|
|
|
ListMod.SelectedIndex = 0;
|
|
|
|
|
ShowMod((string)((ListBoxItem)ListMod.SelectedItem).Content);
|
|
|
|
|
|
2023-08-10 11:34:11 +00:00
|
|
|
|
voicetimer = new DispatcherTimer()
|
|
|
|
|
{
|
|
|
|
|
Interval = TimeSpan.FromSeconds(0.2)
|
|
|
|
|
};
|
|
|
|
|
voicetimer.Tick += Voicetimer_Tick;
|
|
|
|
|
|
2023-10-11 16:08:04 +00:00
|
|
|
|
//为侧边添加目录
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("置于顶层", 0, TopMostBox));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("开机启动", 0, StartUpBox));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("宠物动画", 0, PetBox));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("隐藏窗口", 0, SwitchHideFromTaskControl));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("自动保存频率", 1, CBAutoSave));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("从备份中还原", 1, numBackupSaveMaxNum));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("聊天设置", 1, RBCGPTUseLB));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("游戏操作", 1, btn_cleancache));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("桌宠多开", 1, btn_mutidel));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("互动设置", 2, CalFunctionBox));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("计算间隔", 2, CalSlider));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("桌宠移动", 2, MoveEventBox));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("操作设置", 2, PressLengthSlider));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("桌宠名字", 2, TextBoxPetName));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("音乐识别设置", 2, VoiceMaxSilder));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("自定义链接", 3, btn_DIY));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("自动超模MOD优化", 4, swAutoCal));
|
|
|
|
|
ListMenuItems.Add(listmenuswith("诊断与反馈", 4, RBDiagnosisYES));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("MOD管理", 5, ButtonOpenModFolder));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
ListMenuItems.Add(listmenuswith("关于", 6, ImageWHY));
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
foreach (var v in ListMenuItems)
|
|
|
|
|
ListMenu.Items.Add(v);
|
2023-10-11 16:08:04 +00:00
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
AllowChange = true;
|
|
|
|
|
|
|
|
|
|
UpdateMoveAreaText();
|
2024-08-27 05:48:54 +00:00
|
|
|
|
|
|
|
|
|
ToolTipService.SetInitialShowDelay(runMODGameVerInfo, 0);
|
|
|
|
|
|
2023-10-13 13:38:05 +00:00
|
|
|
|
}
|
|
|
|
|
public List<ListBoxItem> ListMenuItems = new List<ListBoxItem>();
|
|
|
|
|
private void tb_seach_menu_textchange(object sender, TextChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
ListMenu.Items.Clear();
|
|
|
|
|
if (string.IsNullOrEmpty(tb_seach_menu.Text))
|
|
|
|
|
{
|
|
|
|
|
foreach (var v in ListMenuItems)
|
|
|
|
|
ListMenu.Items.Add(v);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
foreach (var v in ListMenuItems)
|
|
|
|
|
{
|
|
|
|
|
if (((string)v.Content).Contains(tb_seach_menu.Text))
|
|
|
|
|
ListMenu.Items.Add(v);
|
|
|
|
|
}
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
2023-08-10 11:34:11 +00:00
|
|
|
|
|
2023-10-11 16:08:04 +00:00
|
|
|
|
private ListBoxItem listmenuswith(string content, int page, FrameworkElement element)
|
|
|
|
|
{
|
|
|
|
|
var lbi = new ListBoxItem() { Content = content.Translate() };
|
|
|
|
|
lbi.PreviewMouseLeftButtonDown += (_, _) =>
|
|
|
|
|
{
|
|
|
|
|
if (page >= 0 && page <= 6)
|
|
|
|
|
MainTab.SelectedIndex = page;
|
|
|
|
|
if (page == 2)
|
|
|
|
|
{
|
|
|
|
|
voicetimer.Start();
|
|
|
|
|
}
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(100);
|
|
|
|
|
Dispatcher.Invoke(element.BringIntoView);
|
|
|
|
|
});
|
2023-10-11 17:24:35 +00:00
|
|
|
|
|
2023-10-11 16:08:04 +00:00
|
|
|
|
};
|
|
|
|
|
return lbi;
|
|
|
|
|
}
|
2023-08-10 11:34:11 +00:00
|
|
|
|
private void Voicetimer_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var v = mw.AudioPlayingVolume();
|
|
|
|
|
RVoice.Text = v.ToString("p2");
|
|
|
|
|
if (v > mw.Set.MusicCatch)
|
|
|
|
|
{
|
|
|
|
|
RVoice.Foreground = new SolidColorBrush(Colors.Green);
|
|
|
|
|
if (v > mw.Set.MusicMax)
|
|
|
|
|
{
|
|
|
|
|
RVoice.FontWeight = FontWeights.Bold;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
RVoice.FontWeight = FontWeights.Normal;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
RVoice.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
public void ShowModList()
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ListMod.Items.Clear();
|
|
|
|
|
foreach (CoreMOD mod in mw.CoreMODs)
|
|
|
|
|
{
|
|
|
|
|
ListBoxItem moditem = (ListBoxItem)ListMod.Items[ListMod.Items.Add(new ListBoxItem())];
|
2023-05-19 08:17:51 +00:00
|
|
|
|
moditem.Padding = new Thickness(5, 0, 5, 0);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
moditem.Content = mod.Name;
|
2023-06-25 18:55:03 +00:00
|
|
|
|
if (!mod.IsOnMOD(mw))
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
moditem.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-04-17 09:26:17 +00:00
|
|
|
|
if (mod.GameVer / 1000 == mw.version / 1000)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
moditem.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-08-25 17:18:18 +00:00
|
|
|
|
if (mod.Tag.Contains("plugin"))
|
|
|
|
|
moditem.Foreground = new SolidColorBrush(Color.FromRgb(190, 0, 0));
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CoreMOD mod;
|
|
|
|
|
private void ShowMod(string modname)
|
|
|
|
|
{
|
|
|
|
|
mod = mw.CoreMODs.Find(x => x.Name == modname);
|
2023-07-25 23:32:31 +00:00
|
|
|
|
LabelModName.Content = mod.Name.Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
runMODAuthor.Text = mod.Author;
|
|
|
|
|
runMODGameVer.Text = CoreMOD.INTtoVER(mod.GameVer);
|
|
|
|
|
runMODGameVer.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
|
2024-03-31 16:51:55 +00:00
|
|
|
|
if (ImageMOD.Source is BitmapImage bitmapImage)
|
2024-03-31 16:47:05 +00:00
|
|
|
|
{
|
|
|
|
|
bitmapImage.StreamSource?.Dispose();
|
|
|
|
|
}
|
2023-11-17 08:08:31 +00:00
|
|
|
|
if (File.Exists(mod.Path.FullName + @"\icon.png"))
|
2024-03-31 16:47:05 +00:00
|
|
|
|
{
|
|
|
|
|
bitmapImage = new();
|
|
|
|
|
bitmapImage.BeginInit();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bytes = File.ReadAllBytes(mod.Path.FullName + @"\icon.png");
|
|
|
|
|
bitmapImage.StreamSource = new MemoryStream(bytes);
|
|
|
|
|
bitmapImage.DecodePixelWidth = 250;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
bitmapImage.EndInit();
|
|
|
|
|
}
|
|
|
|
|
ImageMOD.Source = bitmapImage;
|
|
|
|
|
}
|
2023-11-17 08:08:31 +00:00
|
|
|
|
else
|
|
|
|
|
ImageMOD.Source = ImageResources.NewSafeBitmapImage(@"pack://application:,,,/Res/TopLogo2019.PNG");
|
2024-03-31 16:51:55 +00:00
|
|
|
|
if (mod.GameVer / 100 != mw.version / 100)
|
|
|
|
|
if (mod.GameVer < mw.version)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2024-03-31 16:51:55 +00:00
|
|
|
|
if (mod.GameVer / 1000 == mw.version / 1000)
|
|
|
|
|
{
|
|
|
|
|
runMODGameVer.Text += " (兼容)".Translate();
|
2024-08-25 17:18:18 +00:00
|
|
|
|
runMODGameVerInfo.Visibility = Visibility.Collapsed;
|
2024-03-31 16:51:55 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
runMODGameVer.Text += " (版本低)".Translate();
|
2024-08-25 17:18:18 +00:00
|
|
|
|
runMODGameVerInfo.Visibility = Visibility.Visible;
|
2024-07-28 05:40:49 +00:00
|
|
|
|
if (mod.Tag.Contains("plugin"))
|
2024-08-25 17:18:18 +00:00
|
|
|
|
{
|
2024-07-28 05:40:49 +00:00
|
|
|
|
runMODGameVer.Foreground = new SolidColorBrush(Color.FromRgb(190, 0, 0));
|
2024-08-25 17:18:18 +00:00
|
|
|
|
runMODGameVerInfo.ToolTip = "MOD对应游戏版本比当前游戏版本低, 因为包含代码插件, 可能有严重的兼容性问题.\n请联系MOD作者更新MOD".Translate()
|
|
|
|
|
+ $"\nv{CoreMOD.INTtoVER(mod.GameVer)} < v{mw.Version}" ;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
runMODGameVerInfo.ToolTip = "MOD对应游戏版本比当前游戏版本低, 但是游戏的兼容功能可能会生效, MOD可能可以正常使用.\n为确保最佳体验,请联系MOD作者更新MOD".Translate()
|
|
|
|
|
+ $"\nv{CoreMOD.INTtoVER(mod.GameVer)} < v{mw.Version}";
|
2024-03-31 16:51:55 +00:00
|
|
|
|
}
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
2024-03-31 16:51:55 +00:00
|
|
|
|
else if (mod.GameVer > mw.version)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2024-03-31 16:51:55 +00:00
|
|
|
|
if (mod.GameVer / 1000 == mw.version / 1000)
|
|
|
|
|
{
|
|
|
|
|
runMODGameVer.Text += " (兼容)".Translate();
|
2024-08-25 17:18:18 +00:00
|
|
|
|
runMODGameVerInfo.Visibility = Visibility.Collapsed;
|
2024-03-31 16:51:55 +00:00
|
|
|
|
runMODGameVer.Foreground = Function.ResourcesBrush(Function.BrushType.PrimaryText);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
runMODGameVer.Text += " (版本高)".Translate();
|
2024-08-25 17:18:18 +00:00
|
|
|
|
runMODGameVerInfo.Visibility = Visibility.Visible;
|
2024-03-31 16:51:55 +00:00
|
|
|
|
runMODGameVer.Foreground = new SolidColorBrush(Color.FromRgb(190, 0, 0));
|
2024-08-25 17:18:18 +00:00
|
|
|
|
runMODGameVerInfo.ToolTip = "MOD对应游戏版本比当前游戏版本高, 可能会有兼容性问题.\n请更新游戏".Translate()
|
|
|
|
|
+ $"\nv{CoreMOD.INTtoVER(mod.GameVer)} > v{mw.Version}";
|
2024-03-31 16:51:55 +00:00
|
|
|
|
}
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
2023-06-25 18:55:03 +00:00
|
|
|
|
if (!mod.IsOnMOD(mw))
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
LabelModName.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
ButtonEnable.Foreground = Function.ResourcesBrush(Function.BrushType.DARKPrimaryDarker);
|
|
|
|
|
ButtonDisEnable.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
ButtonEnable.IsEnabled = true;
|
|
|
|
|
ButtonDisEnable.IsEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LabelModName.Foreground = runMODGameVer.Foreground;
|
|
|
|
|
ButtonDisEnable.Foreground = Function.ResourcesBrush(Function.BrushType.DARKPrimaryDarker);
|
|
|
|
|
ButtonEnable.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
ButtonEnable.IsEnabled = false;
|
|
|
|
|
ButtonDisEnable.IsEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
//发布steam等功能
|
|
|
|
|
if (mw.IsSteamUser)
|
|
|
|
|
{
|
|
|
|
|
if (mod.ItemID == 1)
|
|
|
|
|
{
|
|
|
|
|
ButtonSteam.IsEnabled = false;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
ButtonPublish.Text = "系统自带".Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ButtonSteam.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
}
|
|
|
|
|
else if (mod.ItemID == 0)
|
|
|
|
|
{
|
|
|
|
|
ButtonSteam.IsEnabled = false;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
ButtonPublish.Text = "上传至Steam".Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ButtonSteam.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ButtonSteam.IsEnabled = true;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
ButtonPublish.Text = "更新至Steam".Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ButtonSteam.Foreground = Function.ResourcesBrush(Function.BrushType.DARKPrimaryDarker);
|
|
|
|
|
}
|
2023-11-24 07:22:08 +00:00
|
|
|
|
if (mod.ItemID != 1 && (mod.AuthorID == SteamClient.SteamId.AccountId || mod.AuthorID == 0))
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
ButtonPublish.IsEnabled = true;
|
|
|
|
|
ButtonPublish.Foreground = Function.ResourcesBrush(Function.BrushType.DARKPrimaryDarker);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ButtonPublish.IsEnabled = false;
|
|
|
|
|
ButtonPublish.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ButtonSteam.IsEnabled = false;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
ButtonPublish.Text = "未登录".Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ButtonPublish.IsEnabled = false;
|
|
|
|
|
ButtonPublish.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
ButtonSteam.Foreground = new SolidColorBrush(Color.FromRgb(100, 100, 100));
|
|
|
|
|
}
|
|
|
|
|
runMODVer.Text = CoreMOD.INTtoVER(mod.Ver);
|
2023-07-25 23:32:31 +00:00
|
|
|
|
GameInfo.Text = mod.Intro.Translate();
|
2023-07-02 13:41:38 +00:00
|
|
|
|
string content = "";
|
|
|
|
|
foreach (string tag in mod.Tag)
|
|
|
|
|
{
|
|
|
|
|
content += tag.Translate() + "\n";
|
|
|
|
|
}
|
|
|
|
|
GameHave.Text = content;
|
2023-05-08 05:53:39 +00:00
|
|
|
|
ButtonAllow.Visibility = mod.SuccessLoad || mw.Set.IsPassMOD(mod.Name) ? Visibility.Collapsed : Visibility.Visible;
|
2023-05-10 03:13:34 +00:00
|
|
|
|
|
2023-04-10 09:16:15 +00:00
|
|
|
|
foreach (var mainplug in mw.Plugins)
|
|
|
|
|
{
|
2023-08-20 13:09:07 +00:00
|
|
|
|
try
|
2023-04-10 09:16:15 +00:00
|
|
|
|
{
|
2023-08-20 13:24:06 +00:00
|
|
|
|
if (mainplug.PluginName == mod.Name &&
|
|
|
|
|
mainplug.GetType().GetMethod("Setting").DeclaringType != typeof(MainPlugin)
|
2023-08-20 13:09:07 +00:00
|
|
|
|
&& mainplug.GetType().Assembly.Location.Contains(mod.Path.FullName))
|
|
|
|
|
{
|
|
|
|
|
ButtonSetting.Visibility = Visibility.Visible;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-04-10 09:16:15 +00:00
|
|
|
|
}
|
2023-08-20 13:09:07 +00:00
|
|
|
|
finally { }
|
2023-04-10 09:16:15 +00:00
|
|
|
|
}
|
|
|
|
|
ButtonSetting.Visibility = Visibility.Collapsed;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
private void FullScreenBox_Check(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-02-22 05:37:37 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
if (FullScreenBox.IsChecked == true)
|
|
|
|
|
{
|
2023-01-23 17:31:16 +00:00
|
|
|
|
mw.Set.IsBiggerScreen = true;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ZoomSlider.Maximum = 8;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-01-23 17:31:16 +00:00
|
|
|
|
mw.Set.IsBiggerScreen = false;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ZoomSlider.Maximum = 3;
|
|
|
|
|
}
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ThemeBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
2024-02-28 14:02:28 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-30 09:59:45 +00:00
|
|
|
|
mw.LoadTheme(mw.Themes[ThemeBox.SelectedIndex].xName);
|
2024-02-28 14:02:28 +00:00
|
|
|
|
mw.Set.Theme = mw.Theme.xName;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FontBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
2024-02-28 14:02:28 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-30 09:59:45 +00:00
|
|
|
|
string str = mw.Fonts[FontBox.SelectedIndex].Name;
|
2024-02-28 14:02:28 +00:00
|
|
|
|
mw.LoadFont(str);
|
|
|
|
|
mw.Set.Font = str;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CBAutoSave_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
2023-01-24 06:56:16 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-09 18:05:27 +00:00
|
|
|
|
mw.Set.SetAutoSaveInterval((int)((ComboBoxItem)CBAutoSave.SelectedItem).Tag);
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void RBDiagnosisYES_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-08-11 02:47:09 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.Diagnosis = true;
|
2023-08-25 17:16:54 +00:00
|
|
|
|
CBDiagnosis.IsEnabled = true;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RBDiagnosisNO_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-08-11 02:47:09 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.Diagnosis = false;
|
2023-08-25 17:16:54 +00:00
|
|
|
|
CBDiagnosis.IsEnabled = false;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CBDiagnosis_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
2023-08-11 02:47:09 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
List<int> cbDiagnosis = new List<int> { 200, 500, 1000, 2000, 5000, 10000, 20000 };
|
|
|
|
|
mw.Set.DiagnosisInterval = cbDiagnosis[CBDiagnosis.SelectedIndex];
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ListMod_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
2023-02-17 11:42:07 +00:00
|
|
|
|
if (!AllowChange || ListMod.SelectedItem == null)
|
|
|
|
|
return;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
|
2023-02-17 11:42:07 +00:00
|
|
|
|
ShowMod((string)((ListBoxItem)ListMod.SelectedItem).Content);
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonOpenModFolder_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2024-03-19 07:26:26 +00:00
|
|
|
|
var psi = new ProcessStartInfo
|
|
|
|
|
{
|
|
|
|
|
FileName = mod.Path.FullName,
|
|
|
|
|
UseShellExecute = true
|
|
|
|
|
};
|
|
|
|
|
Process.Start(psi);
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonEnable_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-06-25 18:55:03 +00:00
|
|
|
|
mw.Set.OnMod(mod.Name);
|
2023-08-08 14:09:49 +00:00
|
|
|
|
ShowMod(mod.Name);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ButtonRestart.Visibility = Visibility.Visible;
|
|
|
|
|
//int seleid = ListMod.SelectedIndex();
|
|
|
|
|
ShowModList();
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonDisEnable_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-12-07 08:31:20 +00:00
|
|
|
|
if (mod.Name == "Core")
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法停用".Translate(), "停用失败".Translate());
|
2023-01-10 10:43:32 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2023-12-07 08:31:20 +00:00
|
|
|
|
else if (CoreMOD.OnModDefList.Contains(mod.Name))
|
|
|
|
|
return;
|
2023-06-25 18:55:03 +00:00
|
|
|
|
mw.Set.OnModRemove(mod.Name);
|
2023-07-03 23:17:17 +00:00
|
|
|
|
ShowMod(mod.Name);
|
2023-11-24 07:22:08 +00:00
|
|
|
|
ButtonRestart.Visibility = Visibility.Visible;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ShowModList();
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
2023-01-10 10:43:32 +00:00
|
|
|
|
class ProgressClass : IProgress<float>
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
2023-01-10 10:43:32 +00:00
|
|
|
|
float lastvalue = 0;
|
|
|
|
|
ProgressBar pb;
|
|
|
|
|
public ProgressClass(ProgressBar p) => pb = p;
|
|
|
|
|
public void Report(float value)
|
|
|
|
|
{
|
|
|
|
|
if (lastvalue >= value) return;
|
|
|
|
|
lastvalue = value;
|
|
|
|
|
pb.Dispatcher.Invoke(new Action(() => pb.Value = (int)(lastvalue * 100)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private async void ButtonPublish_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-08-15 15:59:11 +00:00
|
|
|
|
var mods = mod;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
if (!mw.IsSteamUser)
|
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show("请先登录Steam后才能上传文件".Translate(), "上传MOD需要Steam登录".Translate(), MessageBoxIcon.Warning);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2023-12-07 08:31:20 +00:00
|
|
|
|
if (CoreMOD.OnModDefList.Contains(mods.Name))
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法发布\n如需发布自定义内容,请复制并更改名称".Translate(), "MOD上传失败".Translate(), MessageBoxIcon.Error);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2023-08-16 10:30:39 +00:00
|
|
|
|
if (mods.Path.FullName.Contains("workshop"))
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("创意工坊物品无法进行上传,请移动到mod文件夹后重试".Translate(), "MOD上传失败".Translate(), MessageBoxIcon.Error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-08-15 15:59:11 +00:00
|
|
|
|
if (!File.Exists(mods.Path.FullName + @"\icon.png") || new FileInfo(mods.Path.FullName + @"\icon.png").Length > 524288)
|
2023-02-17 11:42:07 +00:00
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show("封面图片(icon.png)大于500kb,请修改后重试".Translate(), "MOD上传失败".Translate(), MessageBoxIcon.Error);
|
2023-02-17 11:42:07 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-08-19 15:07:17 +00:00
|
|
|
|
mods.GameVer = mw.version;
|
|
|
|
|
mods.WriteFile();
|
2023-01-29 08:27:24 +00:00
|
|
|
|
#if DEMO
|
2023-01-23 17:31:16 +00:00
|
|
|
|
MessageBoxX.Show("经测试,除正式版均无创意工坊权限,此功能仅作为展示", "特殊版无法上传创意工坊");
|
2023-01-10 10:43:32 +00:00
|
|
|
|
#endif
|
|
|
|
|
ButtonPublish.IsEnabled = false;
|
2024-04-12 15:49:42 +00:00
|
|
|
|
ButtonPublish.Text = "正在上传".Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ProgressBarUpload.Visibility = Visibility.Visible;
|
|
|
|
|
ProgressBarUpload.Value = 0;
|
2023-08-15 15:59:11 +00:00
|
|
|
|
if (mods.ItemID == 0)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
var result = Editor.NewCommunityFile
|
2023-08-15 15:59:11 +00:00
|
|
|
|
.WithTitle(mods.Name)
|
|
|
|
|
.WithDescription(mods.Intro)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
.WithPublicVisibility()
|
2023-08-15 15:59:11 +00:00
|
|
|
|
.WithPreviewFile(mods.Path.FullName + @"\icon.png")
|
|
|
|
|
.WithContent(mods.Path.FullName);
|
|
|
|
|
foreach (string tag in mods.Tag)
|
2023-08-19 15:26:03 +00:00
|
|
|
|
result = result.WithTag(tag);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
var r = await result.SubmitAsync(new ProgressClass(ProgressBarUpload));
|
2023-11-24 07:22:08 +00:00
|
|
|
|
mods.AuthorID = SteamClient.SteamId.AccountId;
|
2023-08-15 15:59:11 +00:00
|
|
|
|
mods.WriteFile();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
if (r.Success)
|
|
|
|
|
{
|
2023-08-15 15:59:11 +00:00
|
|
|
|
mods.ItemID = r.FileId.Value;
|
|
|
|
|
mods.WriteFile();
|
2023-02-17 11:42:07 +00:00
|
|
|
|
//ProgressBarUpload.Value = 0;
|
|
|
|
|
//await result.SubmitAsync(new ProgressClass(ProgressBarUpload));
|
2023-08-15 15:59:11 +00:00
|
|
|
|
if (MessageBoxX.Show("{0} 成功上传至WorkShop服务器\n是否跳转至创意工坊页面进行编辑详细介绍和图标?".Translate(mods.Name), "MOD上传成功".Translate(), MessageBoxButton.YesNo, MessageBoxIcon.Success) == MessageBoxResult.Yes)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://steamcommunity.com/sharedfiles/filedetails/?id=" + r.FileId);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2023-02-17 11:42:07 +00:00
|
|
|
|
{
|
2023-08-15 15:59:11 +00:00
|
|
|
|
mods.AuthorID = 0; mods.WriteFile();
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show("{0} 上传至WorkShop服务器失败\n请检查网络后重试\n请注意:上传和下载工坊物品可能需要良好的网络条件\n失败原因:{1}"
|
2023-08-15 15:59:11 +00:00
|
|
|
|
.Translate(mods.Name, r.Result), "MOD上传失败 {0}".Translate(r.Result));
|
2023-02-17 11:42:07 +00:00
|
|
|
|
}
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
2023-11-24 07:22:08 +00:00
|
|
|
|
else if (mods.AuthorID == SteamClient.SteamId.AccountId)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2023-08-21 05:37:46 +00:00
|
|
|
|
var item = await Item.GetAsync(mod.ItemID);
|
2023-08-18 15:07:02 +00:00
|
|
|
|
Editor result;
|
|
|
|
|
if (item == null)
|
|
|
|
|
{
|
|
|
|
|
result = new Editor(new Steamworks.Data.PublishedFileId() { Value = mods.ItemID })
|
2023-08-15 15:59:11 +00:00
|
|
|
|
.WithTitle(mods.Name)
|
|
|
|
|
.WithDescription(mods.Intro)
|
|
|
|
|
.WithPreviewFile(mods.Path.FullName + @"\icon.png")
|
|
|
|
|
.WithContent(mods.Path);
|
2023-08-18 15:07:02 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = new Editor(new Steamworks.Data.PublishedFileId() { Value = mods.ItemID })
|
|
|
|
|
.WithTitle(item.Value.Title)
|
|
|
|
|
.WithDescription(item.Value.Description)
|
|
|
|
|
.WithPreviewFile(mods.Path.FullName + @"\icon.png")
|
|
|
|
|
.WithContent(mods.Path);
|
|
|
|
|
}
|
2023-08-19 15:26:03 +00:00
|
|
|
|
|
2023-08-15 15:59:11 +00:00
|
|
|
|
foreach (string tag in mods.Tag)
|
2023-08-19 15:26:03 +00:00
|
|
|
|
result = result.WithTag(tag);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
var r = await result.SubmitAsync(new ProgressClass(ProgressBarUpload));
|
|
|
|
|
if (r.Success)
|
|
|
|
|
{
|
2023-11-24 07:22:08 +00:00
|
|
|
|
mods.AuthorID = SteamClient.SteamId.AccountId;
|
2023-08-15 15:59:11 +00:00
|
|
|
|
mods.ItemID = r.FileId.Value;
|
|
|
|
|
mods.WriteFile();
|
|
|
|
|
if (MessageBoxX.Show("{0} 成功上传至WorkShop服务器\n是否跳转至创意工坊页面进行编辑新内容?".Translate(mods.Name)
|
2023-07-02 13:41:38 +00:00
|
|
|
|
, "MOD更新成功".Translate(), MessageBoxButton.YesNo, MessageBoxIcon.Success) == MessageBoxResult.Yes)
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://steamcommunity.com/sharedfiles/filedetails/?id=" + r.FileId);
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show("{0} 上传至WorkShop服务器失败\n请检查网络后重试\n请注意:上传和下载工坊物品可能需要良好的网络条件\n失败原因:{1}"
|
2023-08-15 15:59:11 +00:00
|
|
|
|
.Translate(mods.Name, r.Result), "MOD上传失败 {0}".Translate(r.Result));
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
|
|
|
|
ButtonPublish.IsEnabled = true;
|
2023-07-02 13:41:38 +00:00
|
|
|
|
ButtonPublish.Text = "任务完成".Translate();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
ProgressBarUpload.Visibility = Visibility.Collapsed;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonSteam_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-02-22 05:37:37 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://steamcommunity.com/sharedfiles/filedetails/?id=" + mod.ItemID);
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonAllow_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
if (MessageBoxX.Show("是否启用 {0} 的代码插件?\n一经启用,该插件将会允许访问该系统(包括外部系统)的所有数据\n如果您不确定,请先使用杀毒软件查杀检查".Translate(mod.Name),
|
|
|
|
|
"启用 {0} 的代码插件?".Translate(mod.Name), MessageBoxButton.YesNo, MessageBoxIcon.Warning) == MessageBoxResult.Yes)
|
2023-04-01 19:31:28 +00:00
|
|
|
|
{
|
|
|
|
|
mw.Set.PassMod(mod.Name);
|
2023-08-08 14:09:49 +00:00
|
|
|
|
ShowMod(mod.Name);
|
2023-04-01 19:31:28 +00:00
|
|
|
|
ButtonRestart.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonRestart_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
if (MessageBoxX.Show("是否退出游戏<虚拟桌宠模拟器>?\n请注意保存游戏".Translate(), "重启游戏".Translate(), MessageBoxButton.YesNo, MessageBoxIcon.Warning) == MessageBoxResult.Yes)
|
2023-01-10 10:43:32 +00:00
|
|
|
|
{
|
2023-03-07 16:50:03 +00:00
|
|
|
|
mw.Restart();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-10 16:21:39 +00:00
|
|
|
|
public void UpdateMoveAreaText()
|
2023-09-05 15:33:08 +00:00
|
|
|
|
{
|
|
|
|
|
var mwCtrl = mw.Core.Controller as MWController;
|
|
|
|
|
if (mwCtrl.IsPrimaryScreen)
|
|
|
|
|
{
|
|
|
|
|
textMoveArea.Text = "主屏幕".Translate();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var rect = mwCtrl.ScreenBorder;
|
|
|
|
|
textMoveArea.Text = $"X:{rect.X};Y:{rect.Y};W:{rect.Width};H:{rect.Height}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnSetMoveArea_Default_Click(object sender, RoutedEventArgs e)
|
2023-09-05 14:59:30 +00:00
|
|
|
|
{
|
2023-09-05 15:33:08 +00:00
|
|
|
|
var mwCtrl = mw.Core.Controller as MWController;
|
|
|
|
|
mwCtrl.ResetScreenBorder();
|
|
|
|
|
UpdateMoveAreaText();
|
2023-09-05 14:59:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-05 15:33:08 +00:00
|
|
|
|
private void BtnSetMoveArea_DetectScreen_Click(object sender, RoutedEventArgs e)
|
2023-09-05 14:59:30 +00:00
|
|
|
|
{
|
|
|
|
|
var windowInteropHelper = new System.Windows.Interop.WindowInteropHelper(mw);
|
|
|
|
|
var currentScreen = System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle);
|
2023-09-05 15:33:08 +00:00
|
|
|
|
var mwCtrl = mw.Core.Controller as MWController;
|
2024-04-20 17:39:56 +00:00
|
|
|
|
|
|
|
|
|
// 获取窗口的 DPI 信息
|
|
|
|
|
var hwndSource = System.Windows.Interop.HwndSource.FromHwnd(windowInteropHelper.Handle);
|
|
|
|
|
if (hwndSource != null && hwndSource.CompositionTarget != null)
|
|
|
|
|
{
|
|
|
|
|
var dpiScale = hwndSource.CompositionTarget.TransformToDevice;
|
|
|
|
|
|
|
|
|
|
// 使用 DPI 缩放调整当前屏幕的边界,然后将其转换为整数坐标的矩形
|
|
|
|
|
var dpiAdjustedBounds = new System.Drawing.Rectangle(
|
|
|
|
|
(int)(currentScreen.Bounds.X / dpiScale.M11),
|
|
|
|
|
(int)(currentScreen.Bounds.Y / dpiScale.M22),
|
|
|
|
|
(int)(currentScreen.Bounds.Width / dpiScale.M11),
|
|
|
|
|
(int)(currentScreen.Bounds.Height / dpiScale.M22));
|
|
|
|
|
if (mwCtrl != null)
|
|
|
|
|
mwCtrl.ScreenBorder = dpiAdjustedBounds;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mwCtrl != null)
|
|
|
|
|
// 如果无法获取 DPI 信息,回退到未调整的边界
|
|
|
|
|
mwCtrl.ScreenBorder = currentScreen.Bounds;
|
|
|
|
|
}
|
2023-09-05 15:33:08 +00:00
|
|
|
|
UpdateMoveAreaText();
|
2023-09-05 14:59:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-10 16:21:39 +00:00
|
|
|
|
internal static System.Reflection.FieldInfo leftGetter, topGetter;
|
2023-09-05 15:33:08 +00:00
|
|
|
|
private void BtnSetMoveArea_Window_Click(object sender, RoutedEventArgs e)
|
2023-09-05 14:59:30 +00:00
|
|
|
|
{
|
2023-09-10 16:21:39 +00:00
|
|
|
|
var wma = new winMoveArea(mw);
|
2023-09-05 15:33:08 +00:00
|
|
|
|
var mwCtrl = mw.Core.Controller as MWController;
|
2023-09-10 16:21:39 +00:00
|
|
|
|
if (!mwCtrl.IsPrimaryScreen)
|
|
|
|
|
{
|
|
|
|
|
var rect = mwCtrl.ScreenBorder;
|
|
|
|
|
wma.Width = rect.Width;
|
|
|
|
|
wma.Height = rect.Height;
|
|
|
|
|
wma.Left = rect.X;
|
|
|
|
|
wma.Top = rect.Y;
|
2023-09-10 17:32:13 +00:00
|
|
|
|
}
|
2023-09-10 16:21:39 +00:00
|
|
|
|
wma.ShowDialog();
|
2023-09-05 14:59:30 +00:00
|
|
|
|
}
|
2023-01-10 10:43:32 +00:00
|
|
|
|
|
|
|
|
|
private void hyper_moreInfo(object sender, RoutedEventArgs e)
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://www.exlb.net/Diagnosis");
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
2023-08-10 11:34:11 +00:00
|
|
|
|
|
|
|
|
|
public new void Show()
|
|
|
|
|
{
|
2023-08-13 23:13:40 +00:00
|
|
|
|
if (MainTab.SelectedIndex == 2)
|
2023-08-10 11:34:11 +00:00
|
|
|
|
{
|
|
|
|
|
voicetimer.Start();
|
|
|
|
|
}
|
|
|
|
|
base.Show();
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
private void WindowX_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
mw.Topmost = mw.Set.TopMost;
|
2023-08-12 07:13:30 +00:00
|
|
|
|
e.Cancel = mw.CloseConfirm;
|
2023-08-10 11:34:11 +00:00
|
|
|
|
voicetimer.Stop();
|
2023-01-10 10:43:32 +00:00
|
|
|
|
Hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void TopMostBox_Checked(object sender, RoutedEventArgs e)
|
2022-12-28 10:03:47 +00:00
|
|
|
|
{
|
2023-01-24 06:56:16 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
mw.Set.TopMost = true;
|
2024-04-12 15:08:00 +00:00
|
|
|
|
(mw.notifyIcon.ContextMenuStrip.Items.Find("NotifyIcon_TopMost", false).First() as System.Windows.Forms.ToolStripMenuItem).Checked = true;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
}
|
2022-12-28 10:03:47 +00:00
|
|
|
|
|
2023-01-10 10:43:32 +00:00
|
|
|
|
private void TopMostBox_Unchecked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-01-24 06:56:16 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-01-10 10:43:32 +00:00
|
|
|
|
mw.Set.TopMost = false;
|
2024-04-12 15:08:00 +00:00
|
|
|
|
(mw.notifyIcon.ContextMenuStrip.Items.Find("NotifyIcon_TopMost", false).First() as System.Windows.Forms.ToolStripMenuItem).Checked = false;
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
2023-01-23 17:31:16 +00:00
|
|
|
|
|
|
|
|
|
private void ZoomSlider_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-02-22 05:37:37 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-01-23 17:31:16 +00:00
|
|
|
|
mw.SetZoomLevel(ZoomSlider.Value / 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PressLengthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
2023-01-24 06:56:16 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-01-23 17:31:16 +00:00
|
|
|
|
mw.Set.PressLength = (int)(PressLengthSlider.Value * 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InteractionSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
2023-01-24 06:56:16 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.InteractionCycle = (int)(InteractionSlider.Value);
|
2023-06-24 05:40:06 +00:00
|
|
|
|
CalTimeInteraction();
|
|
|
|
|
}
|
|
|
|
|
private void CalTimeInteraction()
|
|
|
|
|
{
|
|
|
|
|
var interact = (60 / mw.Set.LogicInterval);
|
|
|
|
|
rTimeMinute.Text = interact.ToString("f2");
|
|
|
|
|
RInter.Text = ((0.08 * mw.Set.InteractionCycle - 0.9) / interact * 2).ToString("f2");
|
2023-01-23 17:31:16 +00:00
|
|
|
|
}
|
2023-01-24 06:56:16 +00:00
|
|
|
|
#region Link
|
2023-01-23 17:31:16 +00:00
|
|
|
|
private void Git_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://github.com/LorisYounger/VPet/graphs/contributors");
|
2023-01-23 17:31:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Steam_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://store.steampowered.com/app/1920960/_/");
|
2023-01-23 17:31:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Github_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://github.com/LorisYounger/VPet");
|
2023-01-23 17:31:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LB_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://space.bilibili.com/609610777");
|
2023-01-23 17:31:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void VPET_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://www.exlb.net/");
|
2023-01-23 17:31:16 +00:00
|
|
|
|
}
|
2023-01-24 09:06:06 +00:00
|
|
|
|
private void VUP_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://store.steampowered.com/app/1352140/_/");
|
2023-01-24 09:06:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Group_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-05 06:51:18 +00:00
|
|
|
|
if (LocalizeCore.CurrentCulture.StartsWith("zh"))
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://space.bilibili.com/690425399");
|
2023-07-05 06:51:18 +00:00
|
|
|
|
else
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://github.com/LorisYounger/VPet");
|
2023-01-24 09:06:06 +00:00
|
|
|
|
}
|
2023-02-27 12:29:40 +00:00
|
|
|
|
private void sendkey_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-05 06:51:18 +00:00
|
|
|
|
if (LocalizeCore.CurrentCulture.StartsWith("zh"))
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://www.exlb.net/SendKeys");
|
2023-07-05 06:51:18 +00:00
|
|
|
|
else if (LocalizeCore.CurrentCulture == "null")
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=windowsdesktop-7.0#remarks");
|
2023-07-05 06:51:18 +00:00
|
|
|
|
else
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL($"https://learn.microsoft.com/{LocalizeCore.CurrentCulture}/dotnet/api/system.windows.forms.sendkeys?view=windowsdesktop-7.0#remarks");
|
2023-02-27 12:29:40 +00:00
|
|
|
|
}
|
2023-05-10 03:13:34 +00:00
|
|
|
|
#endregion
|
2023-01-24 06:56:16 +00:00
|
|
|
|
|
|
|
|
|
private void CalSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-09 18:05:27 +00:00
|
|
|
|
mw.Set.SetLogicInterval(CalSlider.Value);
|
2023-06-24 05:40:06 +00:00
|
|
|
|
CalTimeInteraction();
|
2023-01-24 06:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MoveEventBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-09 18:05:27 +00:00
|
|
|
|
mw.Set.SetAllowMove(MoveEventBox.IsChecked == true);
|
2023-01-24 06:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SmartMoveEventBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-09 18:05:27 +00:00
|
|
|
|
mw.Set.SetSmartMove(SmartMoveEventBox.IsChecked == true);
|
2023-01-24 06:56:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CBSmartMove_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-09 18:05:27 +00:00
|
|
|
|
mw.Set.SetSmartMoveInterval((int)((ComboBoxItem)CBSmartMove.SelectedItem).Tag);
|
2023-01-24 06:56:16 +00:00
|
|
|
|
}
|
2024-02-22 18:46:23 +00:00
|
|
|
|
|
2024-03-09 18:05:27 +00:00
|
|
|
|
|
2023-09-12 06:46:04 +00:00
|
|
|
|
public void GenStartUP()
|
2023-02-17 05:33:46 +00:00
|
|
|
|
{
|
2023-09-12 06:46:04 +00:00
|
|
|
|
mw.Set["v"][(gbol)"newverstartup"] = true;
|
2023-02-17 05:33:46 +00:00
|
|
|
|
var path = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + @"\VPET_Simulator.lnk";
|
|
|
|
|
if (mw.Set.StartUPBoot)
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(path))
|
2023-02-20 08:47:44 +00:00
|
|
|
|
File.Delete(path);
|
2024-02-22 18:46:23 +00:00
|
|
|
|
var link = (IShellLink)new ShellLink();
|
2023-02-17 05:33:46 +00:00
|
|
|
|
if (mw.Set.StartUPBootSteam)
|
2023-09-12 06:46:04 +00:00
|
|
|
|
{
|
2024-02-22 18:46:23 +00:00
|
|
|
|
link.SetPath(ExtensionValue.BaseDirectory + @"\VPet.Solution.exe");
|
|
|
|
|
link.SetArguments("launchsteam");
|
2023-09-12 06:46:04 +00:00
|
|
|
|
}
|
2023-02-17 05:33:46 +00:00
|
|
|
|
else
|
2024-04-04 13:10:19 +00:00
|
|
|
|
link.SetPath(System.Reflection.Assembly.GetExecutingAssembly().Location.Replace(".dll", ".exe"));
|
2023-02-17 05:33:46 +00:00
|
|
|
|
|
2024-02-22 18:46:23 +00:00
|
|
|
|
link.SetDescription("VPet Simulator");
|
|
|
|
|
link.SetIconLocation(ExtensionValue.BaseDirectory + @"vpeticon.ico", 0);
|
2023-07-03 23:17:17 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-02-22 18:46:23 +00:00
|
|
|
|
var file = (IPersistFile)link;
|
|
|
|
|
file.Save(path, false);
|
2023-07-03 23:17:17 +00:00
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("创建快捷方式失败,权限不足\n请以管理员身份运行后重试".Translate(), "权限不足".Translate());
|
|
|
|
|
}
|
2023-02-17 05:33:46 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(path))
|
|
|
|
|
File.Delete(path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void StartUpBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-02-18 02:46:08 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-08-18 13:26:37 +00:00
|
|
|
|
if (StartUpBox.IsChecked == true)
|
2023-09-12 06:46:04 +00:00
|
|
|
|
if (MessageBoxX.Show("该游戏随着开机启动该程序\r如需卸载游戏\r请关闭该选项".Translate() + "\n------\n" + "我已确认,并在卸载游戏前会关闭该功能".Translate(), "开机启动重要消息".Translate(),
|
2023-09-10 17:32:13 +00:00
|
|
|
|
MessageBoxButton.YesNo, MessageBoxIcon.Warning) != MessageBoxResult.Yes)
|
|
|
|
|
return;
|
2023-09-22 13:24:02 +00:00
|
|
|
|
//else
|
|
|
|
|
//{
|
2024-03-20 18:59:11 +00:00
|
|
|
|
// mf.Set["SingleTips"][(gint)"open"] = 1;
|
2023-09-22 13:24:02 +00:00
|
|
|
|
// MessageBoxX.Show("游戏开机启动的实现方式是创建快捷方式,不是注册表,更健康,所以游戏卸了也不知道\n如果游戏打不开,可以去这里手动删除游戏开机启动快捷方式:\n%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\".Translate()
|
|
|
|
|
// , "关于卸载不掉的问题是因为开启了开机启动".Translate(), MessageBoxIcon.Info);
|
|
|
|
|
//}
|
2023-09-10 17:32:13 +00:00
|
|
|
|
|
2023-02-17 05:33:46 +00:00
|
|
|
|
mw.Set.StartUPBoot = StartUpBox.IsChecked == true;
|
|
|
|
|
GenStartUP();
|
|
|
|
|
}
|
2023-01-24 09:06:06 +00:00
|
|
|
|
|
2023-02-17 05:33:46 +00:00
|
|
|
|
private void StartUpSteamBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-02-18 02:46:08 +00:00
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-02-17 05:33:46 +00:00
|
|
|
|
mw.Set.StartUPBootSteam = StartUpSteamBox.IsChecked == true;
|
|
|
|
|
GenStartUP();
|
|
|
|
|
}
|
2023-10-15 13:12:00 +00:00
|
|
|
|
private int petboxbef;
|
|
|
|
|
private void petbox_back()
|
|
|
|
|
{
|
|
|
|
|
AllowChange = false;
|
|
|
|
|
PetBox.SelectedIndex = petboxbef;
|
|
|
|
|
AllowChange = true;
|
|
|
|
|
}
|
2023-10-19 14:30:05 +00:00
|
|
|
|
private void LoadMutiUI()
|
|
|
|
|
{
|
|
|
|
|
LBHave.Items.Clear();
|
|
|
|
|
foreach (var str in App.MutiSaves)
|
|
|
|
|
{
|
2023-10-31 07:26:01 +00:00
|
|
|
|
var rn = str.Translate();
|
2023-10-19 14:30:05 +00:00
|
|
|
|
if (str == "")
|
|
|
|
|
rn = "默认存档".Translate();
|
|
|
|
|
if (str == mw.PrefixSave.Trim('-'))
|
|
|
|
|
rn += " (" + "当前存档".Translate() + ')';
|
|
|
|
|
LBHave.Items.Add(rn);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-18 02:46:08 +00:00
|
|
|
|
private void PetBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-06-23 08:21:27 +00:00
|
|
|
|
|
2024-05-13 16:45:37 +00:00
|
|
|
|
var petloader = mw.Pets.Find(x => x.Name == mw.Set.PetGraph);
|
|
|
|
|
petloader ??= mw.Pets[0];
|
2023-08-09 14:17:28 +00:00
|
|
|
|
|
2024-05-13 16:45:37 +00:00
|
|
|
|
if (mw.PrefixSave == "" && petloader.PetName != mw.Pets[PetBox.SelectedIndex].PetName)
|
2024-05-11 16:22:17 +00:00
|
|
|
|
{//多一个名称判断, 如果宠物名称一致,则切换皮肤不提示多开
|
2023-10-15 13:12:00 +00:00
|
|
|
|
switch (MessageBoxX.Show("是否多开一个新的桌宠使用 {0} 皮肤\n各自存档独立保存,互不影响\n支持同时显示多个宠物".Translate(mw.Pets[PetBox.SelectedIndex].Name.Translate()),
|
|
|
|
|
"是否多开".Translate(), MessageBoxButton.YesNoCancel))
|
|
|
|
|
{
|
2023-10-19 14:30:05 +00:00
|
|
|
|
case MessageBoxResult.Yes:
|
2023-10-15 13:12:00 +00:00
|
|
|
|
var savename = mw.Pets[PetBox.SelectedIndex].Name;
|
|
|
|
|
petbox_back();
|
2023-10-20 13:27:09 +00:00
|
|
|
|
//如果有这个皮肤的多开,自动多开
|
|
|
|
|
if (App.MutiSaves.Contains(savename))
|
|
|
|
|
{
|
|
|
|
|
if (App.MainWindows.FirstOrDefault(x => x.PrefixSave.Trim('-') == savename) != null)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("当前多开已经加载".Translate());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
new MainWindow(savename).Show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-10-15 13:12:00 +00:00
|
|
|
|
foreach (var c in @"()#:|/\?*<>-")
|
|
|
|
|
if (savename.Contains(c))
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("存档名不能包括特殊符号".Translate());
|
|
|
|
|
return;
|
2023-10-31 07:26:01 +00:00
|
|
|
|
}
|
2023-10-15 13:12:00 +00:00
|
|
|
|
var lps = new LPS(mw.Set.ToString());
|
|
|
|
|
lps.SetInt("savetimes", 0);
|
|
|
|
|
lps["gameconfig"].SetString("petgraph", savename);
|
|
|
|
|
File.WriteAllText(ExtensionValue.BaseDirectory + @$"\Setting-{savename}.lps", lps.ToString());
|
|
|
|
|
App.MutiSaves.Add(savename);
|
|
|
|
|
new MainWindow(savename).Show();
|
2023-10-31 07:26:01 +00:00
|
|
|
|
LoadMutiUI();
|
2023-10-15 13:12:00 +00:00
|
|
|
|
return;
|
|
|
|
|
case MessageBoxResult.No:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
petbox_back();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:45:37 +00:00
|
|
|
|
|
2023-08-09 14:17:28 +00:00
|
|
|
|
bool ischangename = mw.Core.Save.Name == petloader.PetName.Translate();
|
2023-10-15 13:12:00 +00:00
|
|
|
|
petboxbef = PetBox.SelectedIndex;
|
|
|
|
|
mw.Set.PetGraph = mw.Pets[petboxbef].Name;
|
|
|
|
|
PetIntor.Text = mw.Pets[petboxbef].Intor.Translate();
|
2023-02-18 02:46:08 +00:00
|
|
|
|
ButtonRestartGraph.Visibility = Visibility.Visible;
|
2023-08-09 14:17:28 +00:00
|
|
|
|
|
|
|
|
|
if (ischangename)
|
2023-08-13 14:39:46 +00:00
|
|
|
|
{
|
2023-10-15 13:12:00 +00:00
|
|
|
|
mw.Core.Save.Name = mw.Pets[petboxbef].PetName.Translate();
|
2023-08-13 14:39:46 +00:00
|
|
|
|
TextBoxPetName.Text = mw.Core.Save.Name;
|
2023-08-15 15:36:38 +00:00
|
|
|
|
if (mw.IsSteamUser)
|
2023-08-14 18:30:36 +00:00
|
|
|
|
SteamFriends.SetRichPresence("username", mw.Core.Save.Name);
|
2023-08-13 14:39:46 +00:00
|
|
|
|
}
|
2023-02-18 02:46:08 +00:00
|
|
|
|
}
|
2023-02-18 03:49:13 +00:00
|
|
|
|
|
|
|
|
|
private void TextBoxPetName_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Core.Save.Name = TextBoxPetName.Text;
|
2023-08-14 18:30:36 +00:00
|
|
|
|
if (mw.IsSteamUser)
|
|
|
|
|
SteamFriends.SetRichPresence("username", mw.Core.Save.Name);
|
2023-02-18 03:49:13 +00:00
|
|
|
|
}
|
2023-02-27 12:29:40 +00:00
|
|
|
|
|
|
|
|
|
private void DIY_ADD_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
StackDIY.Children.Add(new DIYViewer());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DIY_Save_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
mw.Set["diy"].Clear();
|
|
|
|
|
foreach (DIYViewer dv in StackDIY.Children)
|
|
|
|
|
{
|
|
|
|
|
mw.Set["diy"].Add(dv.ToSub());
|
|
|
|
|
}
|
|
|
|
|
mw.LoadDIY();
|
|
|
|
|
}
|
2023-03-13 15:40:04 +00:00
|
|
|
|
|
2023-03-07 16:50:03 +00:00
|
|
|
|
|
|
|
|
|
private void ChatGPT_Reset_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-08-08 03:54:10 +00:00
|
|
|
|
switch (mw.Set["CGPT"][(gstr)"type"])
|
2023-03-13 15:40:04 +00:00
|
|
|
|
{
|
2023-09-03 15:06:43 +00:00
|
|
|
|
//case "API":
|
2024-03-20 18:59:11 +00:00
|
|
|
|
// new winCGPTSetting(mf).ShowDialog();
|
2023-09-03 15:06:43 +00:00
|
|
|
|
// break;
|
2023-09-03 18:55:41 +00:00
|
|
|
|
case "DIY":
|
2023-09-04 14:56:27 +00:00
|
|
|
|
if (mw.TalkBoxCurr != null)
|
|
|
|
|
mw.TalkBoxCurr.Setting();
|
|
|
|
|
else
|
2024-04-17 21:13:51 +00:00
|
|
|
|
ExtensionFunction.StartURL("https://steamcommunity.com/app/1920960/workshop/");
|
2023-09-03 18:55:41 +00:00
|
|
|
|
break;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
case "LB":
|
2023-08-21 14:02:28 +00:00
|
|
|
|
//Task.Run(() =>
|
|
|
|
|
//{
|
2024-03-20 18:59:11 +00:00
|
|
|
|
// if (((TalkBox)mf.TalkBox).ChatGPT_Reset())
|
2023-08-21 14:02:28 +00:00
|
|
|
|
// {
|
2024-03-20 18:59:11 +00:00
|
|
|
|
// ((TalkBox)mf.TalkBox).btn_startup.Visibility = Visibility.Visible;
|
2023-08-21 14:02:28 +00:00
|
|
|
|
// MessageBoxX.Show("桌宠重置成功".Translate());
|
|
|
|
|
// }
|
|
|
|
|
//});
|
2024-03-20 18:59:11 +00:00
|
|
|
|
//((TalkSelect)mf.TalkBox).RelsTime
|
2023-08-08 03:54:10 +00:00
|
|
|
|
break;
|
|
|
|
|
case "OFF":
|
2023-08-09 14:17:28 +00:00
|
|
|
|
default:
|
2023-08-08 03:54:10 +00:00
|
|
|
|
break;
|
2023-08-09 14:17:28 +00:00
|
|
|
|
}
|
2023-03-13 15:40:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CGPType_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
if (RBCGPTUseLB.IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
mw.Set["CGPT"][(gstr)"type"] = "LB";
|
|
|
|
|
}
|
2023-09-04 08:45:32 +00:00
|
|
|
|
else if (RBCGPTDIY.IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
mw.Set["CGPT"][(gstr)"type"] = "DIY";
|
|
|
|
|
}
|
2023-09-03 15:06:43 +00:00
|
|
|
|
//else if (RBCGPTUseAPI.IsChecked == true)
|
|
|
|
|
//{
|
2024-03-20 18:59:11 +00:00
|
|
|
|
// mf.Set["CGPT"][(gstr)"type"] = "API";
|
2023-09-03 15:06:43 +00:00
|
|
|
|
//}
|
2023-03-08 10:40:36 +00:00
|
|
|
|
else
|
2023-03-07 16:50:03 +00:00
|
|
|
|
{
|
2023-08-08 03:54:10 +00:00
|
|
|
|
mw.Set["CGPT"][(gstr)"type"] = "OFF";
|
2023-03-07 16:50:03 +00:00
|
|
|
|
}
|
2023-08-08 03:54:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (mw.Set["CGPT"][(gstr)"type"])
|
|
|
|
|
{
|
2023-09-03 15:06:43 +00:00
|
|
|
|
//case "API":
|
|
|
|
|
// BtnCGPTReSet.IsEnabled = true;
|
|
|
|
|
// BtnCGPTReSet.Content = "打开 ChatGPT API 设置".Translate();
|
2024-03-20 18:59:11 +00:00
|
|
|
|
// if (mf.TalkBox != null)
|
|
|
|
|
// mf.Main.ToolBar.MainGrid.Children.Remove(mf.TalkBox);
|
|
|
|
|
// mf.TalkBox = new TalkBoxAPI(mf);
|
|
|
|
|
// mf.Main.ToolBar.MainGrid.Children.Add(mf.TalkBox);
|
2023-09-03 15:06:43 +00:00
|
|
|
|
// break;
|
2023-09-04 08:45:32 +00:00
|
|
|
|
case "DIY":
|
|
|
|
|
BtnCGPTReSet.IsEnabled = true;
|
|
|
|
|
mw.RemoveTalkBox();
|
|
|
|
|
BtnCGPTReSet.Content = "打开 {0} 设置".Translate(mw.TalkBoxCurr?.APIName ?? "Steam Workshop");
|
|
|
|
|
mw.LoadTalkDIY();
|
|
|
|
|
break;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
case "LB":
|
2023-09-04 08:45:32 +00:00
|
|
|
|
mw.RemoveTalkBox();
|
2023-08-08 03:54:10 +00:00
|
|
|
|
BtnCGPTReSet.IsEnabled = true;
|
|
|
|
|
BtnCGPTReSet.Content = "初始化桌宠聊天程序".Translate();
|
2023-08-21 14:02:28 +00:00
|
|
|
|
mw.TalkBox = new TalkSelect(mw);
|
2023-08-08 03:54:10 +00:00
|
|
|
|
mw.Main.ToolBar.MainGrid.Children.Add(mw.TalkBox);
|
|
|
|
|
break;
|
|
|
|
|
case "OFF":
|
|
|
|
|
default:
|
2023-09-04 08:45:32 +00:00
|
|
|
|
mw.RemoveTalkBox();
|
2023-08-08 03:54:10 +00:00
|
|
|
|
BtnCGPTReSet.IsEnabled = false;
|
|
|
|
|
BtnCGPTReSet.Content = "聊天框已关闭".Translate();
|
|
|
|
|
break;
|
2023-08-09 14:17:28 +00:00
|
|
|
|
}
|
2023-03-07 16:50:03 +00:00
|
|
|
|
}
|
2023-04-01 19:31:28 +00:00
|
|
|
|
|
|
|
|
|
private void ButtonSetting_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
2023-05-10 03:13:34 +00:00
|
|
|
|
foreach (var mainplug in mw.Plugins)
|
2023-04-10 09:16:15 +00:00
|
|
|
|
{
|
2023-08-20 13:09:07 +00:00
|
|
|
|
try
|
2023-04-10 09:16:15 +00:00
|
|
|
|
{
|
2023-08-20 13:24:06 +00:00
|
|
|
|
if (mainplug.PluginName == mod.Name && mainplug.GetType().GetMethod("Setting").DeclaringType != typeof(MainPlugin)
|
2023-08-20 13:09:07 +00:00
|
|
|
|
&& mainplug.GetType().Assembly.Location.Contains(mod.Path.FullName))
|
|
|
|
|
{
|
|
|
|
|
mainplug.Setting();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-04-10 09:16:15 +00:00
|
|
|
|
}
|
2023-08-20 13:09:07 +00:00
|
|
|
|
finally { }
|
2023-04-10 09:16:15 +00:00
|
|
|
|
}
|
2023-04-01 19:31:28 +00:00
|
|
|
|
}
|
2023-04-03 18:11:12 +00:00
|
|
|
|
|
|
|
|
|
private void StartPlace_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
if (StartPlace.IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
mw.Set.StartRecordLast = true;
|
|
|
|
|
TextBoxStartUpX.IsEnabled = false;
|
|
|
|
|
TextBoxStartUpY.IsEnabled = false;
|
|
|
|
|
BtnStartUpGet.IsEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mw.Set.StartRecordLast = false;
|
|
|
|
|
TextBoxStartUpX.IsEnabled = true;
|
|
|
|
|
TextBoxStartUpY.IsEnabled = true;
|
|
|
|
|
BtnStartUpGet.IsEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void TextBoxStartUp_TextChanged(object sender, TextChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
if (double.TryParse(TextBoxStartUpX.Text, out double x) && double.TryParse(TextBoxStartUpY.Text, out double y))
|
|
|
|
|
mw.Set.StartRecordPoint = new Point(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnStartUpGet_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
AllowChange = false;
|
|
|
|
|
TextBoxStartUpX.Text = mw.Left.ToString();
|
|
|
|
|
TextBoxStartUpY.Text = mw.Top.ToString();
|
|
|
|
|
mw.Set.StartRecordPoint = new Point(mw.Left, mw.Top);
|
|
|
|
|
AllowChange = true;
|
|
|
|
|
}
|
2023-05-10 03:13:34 +00:00
|
|
|
|
|
|
|
|
|
private void CalFunctionBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-06-10 10:05:01 +00:00
|
|
|
|
//MessageBoxX.Show("由于没做完,暂不支持数据计算\n敬请期待后续更新", "没做完!", MessageBoxButton.OK, MessageBoxIcon.Warning);
|
2023-06-23 20:08:08 +00:00
|
|
|
|
if (CalFunctionBox.IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
mw.Set.EnableFunction = true;
|
|
|
|
|
combCalFunState.IsEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mw.Set.EnableFunction = false;
|
|
|
|
|
combCalFunState.IsEnabled = true;
|
2023-09-25 11:07:22 +00:00
|
|
|
|
if (mw.Main.State != Main.WorkingState.Nomal)
|
|
|
|
|
{
|
|
|
|
|
mw.Main.WorkTimer.Visibility = Visibility.Collapsed;
|
|
|
|
|
mw.Main.State = Main.WorkingState.Nomal;
|
|
|
|
|
}
|
2023-06-23 20:08:08 +00:00
|
|
|
|
}
|
2023-05-10 03:13:34 +00:00
|
|
|
|
}
|
2023-05-30 16:51:17 +00:00
|
|
|
|
|
|
|
|
|
private void SwitchMsgOut_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.MessageBarOutside = SwitchMsgOut.IsChecked.Value;
|
|
|
|
|
if (SwitchMsgOut.IsChecked.Value)
|
|
|
|
|
mw.Main.MsgBar.SetPlaceOUT();
|
|
|
|
|
else
|
|
|
|
|
mw.Main.MsgBar.SetPlaceIN();
|
|
|
|
|
}
|
2023-06-23 13:15:57 +00:00
|
|
|
|
|
2023-08-11 16:44:28 +00:00
|
|
|
|
private void numBackupSaveMaxNum_ValueChanged(object sender, Panuon.WPF.SelectedValueChangedRoutedEventArgs<double?> e)
|
2023-06-23 13:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.BackupSaveMaxNum = (int)numBackupSaveMaxNum.Value;
|
|
|
|
|
}
|
|
|
|
|
int reloadid = 0;
|
|
|
|
|
private void CBSaveReLoad_MouseEnter(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
2023-09-22 16:59:41 +00:00
|
|
|
|
if (reloadid != mw.Set.SaveTimes)
|
2023-06-23 13:15:57 +00:00
|
|
|
|
{
|
2023-09-22 16:59:41 +00:00
|
|
|
|
reloadid = mw.Set.SaveTimes;
|
2023-06-23 13:15:57 +00:00
|
|
|
|
CBSaveReLoad.SelectedItem = null;
|
|
|
|
|
CBSaveReLoad.Items.Clear();
|
2023-09-24 13:17:48 +00:00
|
|
|
|
if (Directory.Exists(ExtensionValue.BaseDirectory + @"\Saves"))
|
2023-06-23 13:15:57 +00:00
|
|
|
|
{
|
2023-09-24 13:17:48 +00:00
|
|
|
|
foreach (var file in new DirectoryInfo(ExtensionValue.BaseDirectory + @"\Saves")
|
2023-10-12 15:06:07 +00:00
|
|
|
|
.GetFiles($"Save{mw.PrefixSave}_*.lps").OrderByDescending(x => x.LastWriteTime))
|
2023-06-23 13:15:57 +00:00
|
|
|
|
{
|
2023-09-24 13:17:48 +00:00
|
|
|
|
CBSaveReLoad.Items.Add(file.Name.Split('.').First());
|
2023-06-23 13:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
CBSaveReLoad.SelectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BtnSaveReload_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (CBSaveReLoad.SelectedItem != null)
|
|
|
|
|
{
|
|
|
|
|
string txt = (string)CBSaveReLoad.SelectedItem;
|
2023-09-24 13:17:48 +00:00
|
|
|
|
string path = ExtensionValue.BaseDirectory + @"\Saves\" + txt + ".lps";
|
2023-06-23 13:15:57 +00:00
|
|
|
|
if (File.Exists(path))
|
|
|
|
|
{
|
2023-08-30 07:45:32 +00:00
|
|
|
|
try
|
2023-06-23 13:15:57 +00:00
|
|
|
|
{
|
2024-02-05 13:12:49 +00:00
|
|
|
|
GameSave_v2 gs = new GameSave_v2(new LPS(File.ReadAllText(path)));
|
2023-09-22 16:18:24 +00:00
|
|
|
|
if (MessageBoxX.Show("存档名称:{0}\n存档等级:{1}\n存档金钱:{2}\nHashCheck:{3}\n是否加载该备份存档? 当前游戏数据会丢失"
|
|
|
|
|
.Translate(gs.GameSave.Name, gs.GameSave.Level, gs.GameSave.Money, gs.HashCheck), "是否加载该备份存档? 当前游戏数据会丢失".Translate(), MessageBoxButton.YesNo, MessageBoxIcon.Info) == MessageBoxResult.Yes)
|
2023-08-30 07:45:32 +00:00
|
|
|
|
{
|
2023-08-30 17:44:38 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
2023-09-25 11:07:22 +00:00
|
|
|
|
if (mw.Main.State != Main.WorkingState.Nomal)
|
|
|
|
|
{
|
|
|
|
|
mw.Main.WorkTimer.Visibility = Visibility.Collapsed;
|
|
|
|
|
mw.Main.State = Main.WorkingState.Nomal;
|
|
|
|
|
}
|
2024-02-05 13:12:49 +00:00
|
|
|
|
if (!mw.SavesLoad(new LPS(File.ReadAllText(path))))
|
2023-10-11 16:08:04 +00:00
|
|
|
|
MessageBoxX.Show("存档损毁,无法加载该存档\n可能是上次储存出错或Steam云同步导致的\n请在设置中加载备份还原存档", "存档损毁".Translate());
|
2023-08-30 17:44:38 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("存档损毁,无法加载该存档\n可能是数据溢出/超模导致的" + '\n' + ex.Message, "存档损毁".Translate());
|
|
|
|
|
}
|
2023-08-30 07:45:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exp)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("存档损毁,无法加载该备份\n请更换备份重试".Translate() + '\n' + exp.ToString(), "存档损毁".Translate());
|
2023-06-23 13:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-23 20:08:08 +00:00
|
|
|
|
|
|
|
|
|
private void Mod_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (CoreMOD mod in mw.CoreMODs)
|
|
|
|
|
{
|
|
|
|
|
foreach (string str in mod.Author.Split(','))
|
|
|
|
|
list.Add(str.Trim());
|
|
|
|
|
}
|
|
|
|
|
list = list.Distinct().ToList();
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show(string.Join("\n", list), "感谢以下MOD开发人员".Translate());
|
2023-06-23 20:08:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Using_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-07-02 13:41:38 +00:00
|
|
|
|
MessageBoxX.Show(string.Join("\n", CoreMOD.LoadedDLL), "DLL引用名单".Translate());
|
2023-06-23 20:08:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void combCalFunState_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-11-24 04:16:29 +00:00
|
|
|
|
mw.Set.CalFunState = (IGameSave.ModeType)combCalFunState.SelectedIndex;
|
|
|
|
|
mw.Main.NoFunctionMOD = (IGameSave.ModeType)combCalFunState.SelectedIndex;
|
2023-07-18 18:09:51 +00:00
|
|
|
|
mw.Main.EventTimer_Elapsed();
|
2023-06-23 20:08:08 +00:00
|
|
|
|
}
|
2023-07-03 11:41:02 +00:00
|
|
|
|
|
|
|
|
|
private void HitThroughBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-09-14 12:00:45 +00:00
|
|
|
|
mw.Set["v"][(gbol)"HitThrough"] = true;
|
2023-07-03 11:41:02 +00:00
|
|
|
|
mw.Set.HitThrough = HitThroughBox.IsChecked.Value;
|
|
|
|
|
if (HitThroughBox.IsChecked.Value != mw.HitThrough)
|
|
|
|
|
mw.SetTransparentHitThrough();
|
|
|
|
|
if (HitThroughBox.IsChecked.Value)
|
|
|
|
|
PetHelperBox.IsChecked = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void PetHelperBox_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-07-03 23:17:17 +00:00
|
|
|
|
if (PetHelperBox.IsChecked == true)
|
2023-07-03 11:41:02 +00:00
|
|
|
|
{
|
|
|
|
|
mw.Set.PetHelper = true;
|
|
|
|
|
mw.LoadPetHelper();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mw.Set.PetHelper = false;
|
|
|
|
|
mw.petHelper?.Close();
|
|
|
|
|
mw.petHelper = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LanguageBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2024-03-09 18:05:27 +00:00
|
|
|
|
mw.Set.SetLanguage((string)LanguageBox.SelectedItem);
|
|
|
|
|
TextBoxPetName.Text = mw.Core.Save.Name;
|
2024-05-15 07:31:41 +00:00
|
|
|
|
ButtonRestartGraph.Visibility = Visibility.Visible;
|
|
|
|
|
|
2023-07-03 11:41:02 +00:00
|
|
|
|
}
|
2023-08-08 03:54:10 +00:00
|
|
|
|
|
|
|
|
|
private void MainTab_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
2023-08-10 11:34:11 +00:00
|
|
|
|
voicetimer.Stop();
|
2023-08-08 03:54:10 +00:00
|
|
|
|
switch (MainTab.SelectedIndex)
|
|
|
|
|
{
|
2023-08-13 23:13:40 +00:00
|
|
|
|
case 2://启动音量探测
|
2023-08-10 11:34:11 +00:00
|
|
|
|
voicetimer.Start();
|
|
|
|
|
break;
|
2023-08-08 03:54:10 +00:00
|
|
|
|
case 4:
|
|
|
|
|
if (mw.HashCheck)
|
|
|
|
|
{
|
|
|
|
|
RHashCheck.Text = "通过".Translate();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RHashCheck.Text = "失败".Translate();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-10 11:34:11 +00:00
|
|
|
|
DispatcherTimer voicetimer;
|
|
|
|
|
|
|
|
|
|
private void VoiceCatchSilder_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.MusicCatch = VoiceCatchSilder.Value;
|
|
|
|
|
mw.Set.MusicMax = VoiceMaxSilder.Value;
|
|
|
|
|
}
|
2023-08-12 06:09:20 +00:00
|
|
|
|
|
|
|
|
|
private void cleancache_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
mw.Set.LastCacheDate = DateTime.MinValue;
|
|
|
|
|
MessageBoxX.Show("清理指令已下达,下次启动桌宠时生效".Translate());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SliderResolution_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
mw.Set.Resolution = (int)SliderResolution.Value;
|
|
|
|
|
ButtonRestartGraph.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
2023-08-18 10:08:38 +00:00
|
|
|
|
|
|
|
|
|
private void save_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
mw.Save();
|
|
|
|
|
MessageBoxX.Show("保存成功".Translate());
|
|
|
|
|
}
|
2023-08-25 22:08:13 +00:00
|
|
|
|
|
|
|
|
|
private void swAutoCal_Checked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set["gameconfig"].SetBool("noAutoCal", !swAutoCal.IsChecked.Value);
|
|
|
|
|
}
|
2023-08-25 22:49:26 +00:00
|
|
|
|
|
|
|
|
|
private void restart_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2023-10-19 14:30:05 +00:00
|
|
|
|
if (MessageBoxX.Show("是否重置游戏数据重新开始?".Translate(), "重新开始".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
2023-08-25 22:49:26 +00:00
|
|
|
|
{
|
2023-09-23 05:07:52 +00:00
|
|
|
|
var oldsave = mw.GameSavesData;
|
2023-09-22 18:10:15 +00:00
|
|
|
|
mw.GameSavesData = new GameSave_v2(mw.Core.Save.Name);
|
|
|
|
|
mw.Core.Save = mw.GameSavesData.GameSave;
|
2024-08-14 04:29:30 +00:00
|
|
|
|
mw.GameSavesData.GameSave.Event_LevelUp += mw.LevelUP;
|
|
|
|
|
|
2023-09-23 05:07:52 +00:00
|
|
|
|
if (oldsave.HashCheck) // 对于重开无作弊的玩家保留统计
|
2024-02-03 05:46:22 +00:00
|
|
|
|
{
|
2023-09-23 05:07:52 +00:00
|
|
|
|
mw.GameSavesData.Statistics = oldsave.Statistics;
|
2024-02-04 09:10:01 +00:00
|
|
|
|
if (oldsave.GameSave.Money > 10000000 || oldsave.GameSave.Money < -1000000000 || oldsave.GameSave.Exp > 100000000 || oldsave.GameSave.Exp < -10000000000)
|
2024-02-03 05:46:22 +00:00
|
|
|
|
{
|
|
|
|
|
mw.Core.Save.Money = 10000;
|
|
|
|
|
mw.Core.Save.Exp = 10000;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-13 13:38:05 +00:00
|
|
|
|
mw.HashCheck = true;
|
2023-08-30 07:45:32 +00:00
|
|
|
|
MessageBoxX.Show("重置成功".Translate());
|
|
|
|
|
}
|
2023-08-25 22:49:26 +00:00
|
|
|
|
}
|
2023-09-04 10:19:48 +00:00
|
|
|
|
|
|
|
|
|
private void cbChatAPISelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.TalkAPIIndex = cbChatAPISelect.SelectedIndex;
|
|
|
|
|
mw.Set["CGPT"][(gstr)"DIY"] = mw.TalkBoxCurr?.APIName ?? "";
|
|
|
|
|
if (RBCGPTDIY.IsChecked == true)
|
|
|
|
|
mw.LoadTalkDIY();
|
|
|
|
|
BtnCGPTReSet.Content = "打开 {0} 设置".Translate(mw.TalkBoxCurr?.APIName ?? "Steam Workshop");
|
|
|
|
|
|
|
|
|
|
}
|
2023-09-16 09:33:54 +00:00
|
|
|
|
|
2023-10-11 17:24:35 +00:00
|
|
|
|
private void btn_muti_open_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (LBHave.SelectedIndex == -1)
|
|
|
|
|
return;
|
2023-10-31 07:26:01 +00:00
|
|
|
|
var str = App.MutiSaves[LBHave.SelectedIndex];
|
2023-10-19 14:30:05 +00:00
|
|
|
|
if (str.EndsWith(")") || App.MainWindows.FirstOrDefault(x => x.PrefixSave.Trim('-') == str) != null)
|
2023-10-11 17:24:35 +00:00
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("当前多开已经加载".Translate());
|
|
|
|
|
return;
|
2023-10-15 13:12:00 +00:00
|
|
|
|
}
|
2023-10-11 17:24:35 +00:00
|
|
|
|
new MainWindow(str).Show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btn_mutinew_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var savename = TBNew.Text;
|
|
|
|
|
foreach (var c in @"()#:|/\?*<>-")
|
|
|
|
|
if (savename.Contains(c))
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("存档名不能包括特殊符号".Translate());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (App.MutiSaves.FirstOrDefault(x => x.ToLower() == savename.ToLower()) != null)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("存档名重复".Translate());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-10-15 13:12:00 +00:00
|
|
|
|
|
2023-10-11 17:24:35 +00:00
|
|
|
|
var lps = new LPS(mw.Set);
|
|
|
|
|
lps.SetInt("savetimes", 0);
|
|
|
|
|
File.WriteAllText(ExtensionValue.BaseDirectory + @$"\Setting-{savename}.lps", lps.ToString());
|
|
|
|
|
App.MutiSaves.Add(savename);
|
|
|
|
|
new MainWindow(savename).Show();
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 14:30:05 +00:00
|
|
|
|
private void btn_mutidel_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (LBHave.SelectedIndex == -1)
|
|
|
|
|
return;
|
2023-10-31 07:26:01 +00:00
|
|
|
|
var str = App.MutiSaves[LBHave.SelectedIndex];
|
2023-10-19 14:30:05 +00:00
|
|
|
|
if (str == "默认存档".Translate())
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("默认存档无法删除,请使用重新开始功能重新开始游戏".Translate());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (str.EndsWith(")") || App.MainWindows.FirstOrDefault(x => x.PrefixSave.Trim('-') == str) != null)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("当前多开已经加载,请先关闭改多开后重试".Translate());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!App.MutiSaves.Contains(str))
|
|
|
|
|
{
|
|
|
|
|
LoadMutiUI();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (MessageBoxX.Show("是否删除当前选择({0})的多开存档?".Translate(str), "删除前确认".Translate(), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
File.Delete(ExtensionValue.BaseDirectory + @$"\Setting-{str}.lps");
|
|
|
|
|
App.MutiSaves.Remove(str);
|
|
|
|
|
LoadMutiUI();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-13 13:38:05 +00:00
|
|
|
|
|
2024-04-17 06:51:44 +00:00
|
|
|
|
private void btn_muti_master_click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (LBHave.SelectedIndex == -1)
|
|
|
|
|
return;
|
|
|
|
|
var str = App.MutiSaves[LBHave.SelectedIndex];
|
|
|
|
|
foreach (var sp in new DirectoryInfo(ExtensionValue.BaseDirectory).GetFiles("startup_*"))
|
|
|
|
|
{
|
|
|
|
|
sp.Delete();
|
|
|
|
|
}
|
|
|
|
|
if (str != "")
|
|
|
|
|
File.Create(ExtensionValue.BaseDirectory + @"\startup_" + str).Close();
|
|
|
|
|
MessageBoxX.Show("已将当前选择 {0} 设为默认启动存档".Translate(str.Translate()));
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-23 08:21:27 +00:00
|
|
|
|
private void btn_fixdata_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//先拿玩家游戏时间
|
|
|
|
|
int playtime;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string _url = "https://aiopen.exlb.net:5810/VPet/GetPlayTime?steamid=" + SteamClient.SteamId.Value;
|
|
|
|
|
#pragma warning disable SYSLIB0014 // 类型或成员已过时
|
|
|
|
|
var request = (HttpWebRequest)WebRequest.Create(_url);
|
|
|
|
|
#pragma warning restore SYSLIB0014 // 类型或成员已过时
|
|
|
|
|
request.Method = "GET";
|
|
|
|
|
string responseString;
|
|
|
|
|
using (var response = (HttpWebResponse)request.GetResponse())
|
|
|
|
|
{
|
|
|
|
|
responseString = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
|
|
|
|
|
response.Dispose();
|
|
|
|
|
}
|
|
|
|
|
playtime = int.Parse(responseString);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
MessageBoxX.Show("获取玩家游戏时间失败,请检查网络连接或稍后再试".Translate());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (playtime == 0) return;
|
|
|
|
|
if (mw.GameSavesData.HashCheck)
|
|
|
|
|
{//对于
|
|
|
|
|
int hours = mw.GameSavesData.Statistics[(gint)"stat_total_time"] / 60;
|
|
|
|
|
if (hours < playtime)
|
|
|
|
|
{
|
|
|
|
|
mw.GameSavesData.Statistics[(gint)"stat_total_time"] = playtime * 60;
|
|
|
|
|
MessageBoxX.Show("陪伴时长已更新".Translate() + $"\n{hours}Min->{playtime}Min", "修复成功".Translate());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
MessageBoxX.Show("当前游戏时间已经大于Steam服务器记录时间,无需修复".Translate());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GameSave_v2 ogs = mw.GameSavesData;
|
|
|
|
|
mw.GameSavesData = new GameSave_v2(ogs.GameSave.Name);
|
|
|
|
|
mw.GameSavesData.Statistics[(gint)"stat_total_time"] = playtime * 60;
|
2024-08-14 04:29:30 +00:00
|
|
|
|
mw.GameSavesData.GameSave.Event_LevelUp += mw.LevelUP;
|
2024-06-23 08:21:27 +00:00
|
|
|
|
|
|
|
|
|
//同步等级
|
|
|
|
|
//按2小时=1级进行计算
|
|
|
|
|
int newlevel = playtime / 120;
|
|
|
|
|
int newmaxlevel = 0;
|
|
|
|
|
if (newlevel > 0)
|
|
|
|
|
{
|
|
|
|
|
while (newlevel > (newmaxlevel * 100 + 1000))
|
|
|
|
|
{
|
|
|
|
|
newlevel -= (newmaxlevel * 100 + 1000);
|
|
|
|
|
newmaxlevel++;
|
|
|
|
|
}
|
|
|
|
|
mw.GameSavesData.GameSave.LevelMax = Math.Min(newmaxlevel, ogs.GameSave.LevelMax);
|
|
|
|
|
mw.GameSavesData.GameSave.Level = Math.Min(newlevel, ogs.GameSave.Level);
|
|
|
|
|
}
|
|
|
|
|
//同步金钱
|
|
|
|
|
//根据当前等级计算金钱
|
|
|
|
|
int newmoney = (200 * mw.GameSavesData.GameSave.Level - 100) * mw.GameSavesData.GameSave.LevelMax;
|
|
|
|
|
mw.GameSavesData.GameSave.Money = Math.Min(newmoney, ogs.GameSave.Money);
|
|
|
|
|
|
|
|
|
|
//同步好感度
|
|
|
|
|
mw.GameSavesData.GameSave.Likability = ogs.GameSave.Likability;
|
|
|
|
|
|
|
|
|
|
MessageBoxX.Show("数据修复成功".Translate());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-16 09:33:54 +00:00
|
|
|
|
private void SwitchHideFromTaskControl_OnChecked(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!AllowChange)
|
|
|
|
|
return;
|
|
|
|
|
mw.Set.HideFromTaskControl = SwitchHideFromTaskControl.IsChecked == true;
|
|
|
|
|
ButtonRestartGraph.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
2023-10-11 14:16:10 +00:00
|
|
|
|
|
|
|
|
|
|
2022-12-28 10:03:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|