From f39108bc0004e4d7e0ad0d75c383cc7ff7172de3 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Mon, 14 Aug 2023 00:39:46 +1000 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B9=B1=E8=AF=B4=E8=AF=9D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/WorkTimer.xaml | 71 ++++++++++--------- VPet-Simulator.Core/Display/WorkTimer.xaml.cs | 45 +++++++----- .../IMainWindow.cs | 9 +++ .../Mod/ClickText.cs | 48 +++++++++++-- VPet-Simulator.Windows/Function/CoreMOD.cs | 2 +- VPet-Simulator.Windows/MainWindow.cs | 41 +++++++++++ VPet-Simulator.Windows/MainWindow.xaml.cs | 40 ++++++----- .../WinDesign/winGameSetting.xaml.cs | 8 ++- .../mod/0000_core/lang/en/Base2308.lps | 1 + .../mod/0000_core/lang/zh-Hans/Base2308.lps | 1 + .../mod/0000_core/lang/zh-Hant/Base2308.lps | 1 + 11 files changed, 193 insertions(+), 74 deletions(-) diff --git a/VPet-Simulator.Core/Display/WorkTimer.xaml b/VPet-Simulator.Core/Display/WorkTimer.xaml index 6cf2a17..0aad48a 100644 --- a/VPet-Simulator.Core/Display/WorkTimer.xaml +++ b/VPet-Simulator.Core/Display/WorkTimer.xaml @@ -15,37 +15,42 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/VPet-Simulator.Core/Display/WorkTimer.xaml.cs b/VPet-Simulator.Core/Display/WorkTimer.xaml.cs index e0b8883..25a4038 100644 --- a/VPet-Simulator.Core/Display/WorkTimer.xaml.cs +++ b/VPet-Simulator.Core/Display/WorkTimer.xaml.cs @@ -86,6 +86,8 @@ namespace VPet_Simulator.Core else tNumberUnit.Text = LocalizeCore.Translate("EXP"); break; + case 3: + break; } } public void ShowTimeSpan(TimeSpan ts) @@ -108,31 +110,38 @@ namespace VPet_Simulator.Core } public void DisplayUI() { - btnStop.Content = LocalizeCore.Translate("停止") + nowWork.NameTrans; - switch (DisplayType) + if (DisplayType == 3) { - default: - case 0: - tNow.Text = LocalizeCore.Translate("当前已") + nowWork.NameTrans; - break; - case 1: - tNow.Text = LocalizeCore.Translate("剩余{0}时间", nowWork.NameTrans); - break; - case 2: - if (nowWork.Type == Work.WorkType.Work) - tNow.Text = LocalizeCore.Translate("累计金钱收益"); - else - tNow.Text = LocalizeCore.Translate("获得经验值"); - break; + DisplayBorder.Visibility = Visibility.Collapsed; } + else + { + DisplayBorder.Visibility = Visibility.Visible; + btnStop.Content = LocalizeCore.Translate("停止") + nowWork.NameTrans; + switch (DisplayType) + { + default: + case 0: + tNow.Text = LocalizeCore.Translate("当前已") + nowWork.NameTrans; + break; + case 1: + tNow.Text = LocalizeCore.Translate("剩余{0}时间", nowWork.NameTrans); + break; + case 2: + if (nowWork.Type == Work.WorkType.Work) + tNow.Text = LocalizeCore.Translate("累计金钱收益"); + else + tNow.Text = LocalizeCore.Translate("获得经验值"); + break; + } + } M_TimeUIHandle(m); } private void SwitchState_Click(object sender, RoutedEventArgs e) { DisplayType++; - if (DisplayType >= 3) - DisplayType = 0; - + if (DisplayType >= 4) + DisplayType = 0; DisplayUI(); } public void Start(Work work) diff --git a/VPet-Simulator.Windows.Interface/IMainWindow.cs b/VPet-Simulator.Windows.Interface/IMainWindow.cs index 4eb29c5..5f1eca4 100644 --- a/VPet-Simulator.Windows.Interface/IMainWindow.cs +++ b/VPet-Simulator.Windows.Interface/IMainWindow.cs @@ -60,6 +60,15 @@ namespace VPet_Simulator.Windows.Interface /// List LowDrinkText { get; } /// + /// 点击时会说的话 + /// + List ClickTexts { get; } + /// + /// 获得自动点击的文本 + /// + /// 说话内容 + ClickText GetClickText(); + /// /// 图片资源 /// ImageResources ImageSources { get; } diff --git a/VPet-Simulator.Windows.Interface/Mod/ClickText.cs b/VPet-Simulator.Windows.Interface/Mod/ClickText.cs index 917e430..0c06150 100644 --- a/VPet-Simulator.Windows.Interface/Mod/ClickText.cs +++ b/VPet-Simulator.Windows.Interface/Mod/ClickText.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using VPet_Simulator.Core; +using static VPet_Simulator.Core.Main; namespace VPet_Simulator.Windows.Interface { @@ -13,8 +15,17 @@ namespace VPet_Simulator.Windows.Interface /// public class ClickText { + public ClickText() + { + + } + public ClickText(string text) + { + Text = text; + } + [Line(ignoreCase: true)] - private int mode { get; set; } = 15; + private int mode { get; set; } = 7; /// /// 需求状态模式 /// @@ -28,7 +39,7 @@ namespace VPet_Simulator.Windows.Interface /// [Flags] public enum ModeType - { + { /// /// 高兴 /// @@ -57,7 +68,7 @@ namespace VPet_Simulator.Windows.Interface /// [Flags] public enum DayTime - { + { Morning = 1, Afternoon = 2, Night = 4, @@ -86,7 +97,11 @@ namespace VPet_Simulator.Windows.Interface /// [Line(IgnoreCase = true)] public int LikeMax = int.MaxValue; - + /// + /// 工作状态 + /// + [Line(IgnoreCase = true)] + public WorkingState State { get; set; } = WorkingState.Nomal; /// /// 说话的内容 /// @@ -106,6 +121,31 @@ namespace VPet_Simulator.Windows.Interface } return transText; } + set + { + transText = value; + } + } + /// + /// 检查部分状态是否满足需求 + /// 之所以不是全部的,是因为挨个取效率太差了 + public bool CheckState(Main m) + { + if (m.Core.Save.Likability < LikeMin || m.Core.Save.Likability > LikeMax) + return false; + if (string.IsNullOrWhiteSpace(Working)) + { + if (State != m.State) + return false; + } + else + { + if (State != WorkingState.Work) + return false; + if (m.nowWork.Name != Working) + return false; + } + return true; } } } diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index 82c5d4c..2233484 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -97,7 +97,7 @@ namespace VPet_Simulator.Windows if (!IsOnMOD(mw)) { - //Content = "该模组已停用".Translate(); + Tag.Add("该模组已停用"); return; } diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 9be190c..347b84c 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -53,6 +53,47 @@ namespace VPet_Simulator.Windows public List LowFoodText { get; set; } = new List(); public List LowDrinkText { get; set; } = new List(); + + public List ClickTexts { get; set; } = new List(); + /// + /// 获得自动点击的文本 + /// + /// 说话内容 + public ClickText GetClickText() + { + ClickText.DayTime dt; + var now = DateTime.Now.Hour; + if (now < 6) + dt = ClickText.DayTime.Midnight; + else if (now < 12) + dt = ClickText.DayTime.Morning; + else if (now < 18) + dt = ClickText.DayTime.Afternoon; + else + dt = ClickText.DayTime.Night; + + ClickText.ModeType mt; + switch (Core.Save.Mode) + { + case GameSave.ModeType.PoorCondition: + mt = ClickText.ModeType.PoorCondition; + break; + default: + case GameSave.ModeType.Nomal: + mt = ClickText.ModeType.Nomal; + break; + case GameSave.ModeType.Happy: + mt = ClickText.ModeType.Happy; + break; + case GameSave.ModeType.Ill: + mt = ClickText.ModeType.Ill; + break; + } + var list = ClickTexts.FindAll(x => x.DaiTime.HasFlag(dt) && x.Mode.HasFlag(mt) && x.CheckState(Main)); + if (list.Count == 0) + return null; + return list[Function.Rnd.Next(list.Count)]; + } /// /// 存档 Hash检查 是否通过 /// diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 36ae947..62f3034 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -154,7 +154,6 @@ namespace VPet_Simulator.Windows System.Environment.Exit(0); } - private List rndtext; public long lastclicktime { get; set; } public void LoadLatestSave(string petname) @@ -278,25 +277,27 @@ namespace VPet_Simulator.Windows AutoSaveTimer.Interval = Set.AutoSaveInterval * 60000; AutoSaveTimer.Start(); } + ClickTexts.Add(new ClickText("你知道吗? 鼠标右键可以打开菜单栏")); + ClickTexts.Add(new ClickText("你知道吗? 你可以在设置里面修改游戏的缩放比例")); + ClickTexts.Add(new ClickText("想要宠物不乱动? 设置里可以设置智能移动或者关闭移动")); + ClickTexts.Add(new ClickText("有建议/游玩反馈? 来 菜单-系统-反馈中心 反馈吧")); + ClickTexts.Add(new ClickText("长按脑袋拖动桌宠到你喜欢的任意位置")); + ClickTexts.Add(new ClickText("长按脑袋拖动桌宠到你喜欢的任意位置")); + //"如果你觉得目前功能太少,那就多挂会机. 宠物会自己动的".Translate(), + //"你知道吗? 你可以在设置里面修改游戏的缩放比例".Translate(), + //"你现在乱点说话是说话系统的一部分,不过还没做,在做了在做了ing".Translate(), + //"你添加了虚拟主播模拟器和虚拟桌宠模拟器到愿望单了吗? 快去加吧".Translate(), + //"这游戏开发这么慢,都怪画师太咕了".Translate(), + //"欢迎加入 虚拟主播模拟器群 430081239".Translate() - rndtext = new List - { - "你知道吗? 鼠标右键可以打开菜单栏".Translate(), - "如果你觉得目前功能太少,那就多挂会机. 宠物会自己动的".Translate(), - "你知道吗? 你可以在设置里面修改游戏的缩放比例".Translate(), - "想要宠物不乱动? 设置里可以设置智能移动或者关闭移动".Translate(), - "有建议/游玩反馈? 来 菜单-系统-反馈中心 反馈吧".Translate(), - "你现在乱点说话是说话系统的一部分,不过还没做,在做了在做了ing".Translate(), - "你添加了虚拟主播模拟器和虚拟桌宠模拟器到愿望单了吗? 快去加吧".Translate(), - "这游戏开发这么慢,都怪画师太咕了".Translate(), - "长按脑袋拖动桌宠到你喜欢的任意位置".Translate(), - "欢迎加入 虚拟主播模拟器群 430081239".Translate() - }; await Dispatcher.InvokeAsync(new Action(() => LoadingText.Content = "尝试加载Steam内容".Translate())); //给正在玩这个游戏的主播/游戏up主做个小功能 if (IsSteamUser) { - rndtext.Add("关注 {0} 谢谢喵".Translate(SteamClient.Name)); + ClickTexts.Add(new ClickText("关注 {0} 谢谢喵") + { + TranslateText = "关注 {0} 谢谢喵".Translate(SteamClient.Name) + }); //Steam成就 Set.Statistics.StatisticChanged += Statistics_StatisticChanged; //Steam通知 @@ -306,7 +307,10 @@ namespace VPet_Simulator.Windows } else { - rndtext.Add("关注 {0} 谢谢喵".Translate(Environment.UserName)); + ClickTexts.Add(new ClickText("关注 {0} 谢谢喵") + { + TranslateText = "关注 {0} 谢谢喵".Translate(Environment.UserName) + }); } //音乐识别timer加载 @@ -380,7 +384,9 @@ namespace VPet_Simulator.Windows if (new TimeSpan(DateTime.Now.Ticks - lastclicktime).TotalSeconds > 20) { lastclicktime = DateTime.Now.Ticks; - Main.SayRnd(rndtext[Function.Rnd.Next(rndtext.Count)]); + var rt = GetClickText(); + if (rt != null) + Main.SayRnd(rt.TranslateText); } }; Main.PlayVoiceVolume = Set.VoiceVolume; diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs index e8f090c..c4810d9 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs @@ -135,7 +135,7 @@ namespace VPet_Simulator.Windows foreach (Sub sub in mw.Set["diy"]) StackDIY.Children.Add(new DIYViewer(sub)); - SliderResolution.Maximum = Math.Min(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, + SliderResolution.Maximum = Math.Min(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height); SliderResolution.Value = mw.Set.Resolution; @@ -786,7 +786,10 @@ namespace VPet_Simulator.Windows ButtonRestartGraph.Visibility = Visibility.Visible; if (ischangename) + { mw.Core.Save.Name = petloader.PetName.Translate(); + TextBoxPetName.Text = mw.Core.Save.Name; + } } private void TextBoxPetName_TextChanged(object sender, TextChangedEventArgs e) @@ -1070,7 +1073,10 @@ namespace VPet_Simulator.Windows LocalizeCore.LoadCulture((string)LanguageBox.SelectedItem); mw.Set.Language = LocalizeCore.CurrentCulture; if (ischangename) + { mw.Core.Save.Name = petloader.PetName.Translate(); + TextBoxPetName.Text = mw.Core.Save.Name; + } } private void MainTab_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps index a5104c7..934df6c 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2308.lps @@ -27,3 +27,4 @@ Happyly#Happily:| Nomally#Nomally:| PoorConditionly#Sadly:| Illly#Sickly:| +plugin#Code Plugin:| \ No newline at end of file diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps index 7bcf840..95bc3d2 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2308.lps @@ -27,3 +27,4 @@ Happyly#高兴地:| Nomally#普通地:| PoorConditionly#悲伤地:| Illly#生病地:| +plugin#代码插件:| \ No newline at end of file diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps index 552ef50..ec58f4b 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2308.lps @@ -27,3 +27,4 @@ Happyly#高興地:| Nomally#普通地:| PoorConditionly#悲傷地:| Illly#生病地:| +plugin#代碼外掛:| \ No newline at end of file