From 81debbaf67a690bfef9699a9023cdc890665f663 Mon Sep 17 00:00:00 2001 From: ZouJin Date: Sat, 28 Jan 2023 01:44:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=B4=E8=AF=9D&=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/Main.xaml.cs | 18 +++++++++++++++--- VPet-Simulator.Core/Display/MainLogic.cs | 15 ++++++++++++--- VPet-Simulator.Core/Display/MessageBar.xaml.cs | 3 ++- VPet-Simulator.Windows/MainWindow.xaml.cs | 6 ++++-- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/VPet-Simulator.Core/Display/Main.xaml.cs b/VPet-Simulator.Core/Display/Main.xaml.cs index 49274f4..24c8e87 100644 --- a/VPet-Simulator.Core/Display/Main.xaml.cs +++ b/VPet-Simulator.Core/Display/Main.xaml.cs @@ -41,7 +41,7 @@ namespace VPet_Simulator.Core /// 刷新时间时会调用该方法,在所有任务处理完之后 /// public event Action
TimeUIHandle; - public Main(GameCore core) + public Main(GameCore core,bool loadtouchevent = true) { InitializeComponent(); Core = core; @@ -52,8 +52,12 @@ namespace VPet_Simulator.Core MsgBar = new MessageBar(this); MsgBar.Visibility = Visibility.Collapsed; UIGrid.Children.Add(MsgBar); - Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchHeadLocate, Core.Graph.GraphConfig.TouchHeadSize, DisplayTouchHead)); - Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate, Core.Graph.GraphConfig.TouchRaisedSize, DisplayRaised, true)); + + if (loadtouchevent) + { + LoadTouchEvent(); + } + var ig = Core.Graph.FindGraph(GraphCore.GraphType.Default, core.Save.Mode); PetGrid.Child = ig.This; var ig2 = Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_A_Start, core.Save.Mode); @@ -65,6 +69,14 @@ namespace VPet_Simulator.Core MoveTimer.Elapsed += MoveTimer_Elapsed; SmartMoveTimer.Elapsed += SmartMoveTimer_Elapsed; } + /// + /// 自动加载触摸事件 + /// + public void LoadTouchEvent() + { + Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchHeadLocate, Core.Graph.GraphConfig.TouchHeadSize, DisplayTouchHead)); + Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate, Core.Graph.GraphConfig.TouchRaisedSize, DisplayRaised, true)); + } private void SmartMoveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index b094ca5..b5c27c2 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -24,13 +24,22 @@ namespace VPet_Simulator.Core AutoReset = true, Enabled = true }; + /// + /// 说话 + /// + /// 说话内容 public void Say(string text) { - Display(GraphCore.GraphType.Say_A_Start, () => + if (DisplayType == GraphCore.GraphType.Default) + Display(GraphCore.GraphType.Say_A_Start, () => + { + Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text)); + Saying(); + }); + else { Dispatcher.Invoke(() => MsgBar.Show(Core.Save.Name, text)); - Saying(); - }); + } } public void Saying() { diff --git a/VPet-Simulator.Core/Display/MessageBar.xaml.cs b/VPet-Simulator.Core/Display/MessageBar.xaml.cs index 77c9a95..e76922a 100644 --- a/VPet-Simulator.Core/Display/MessageBar.xaml.cs +++ b/VPet-Simulator.Core/Display/MessageBar.xaml.cs @@ -58,7 +58,8 @@ namespace VPet_Simulator.Core Task.Run(() => { Thread.Sleep(timeleft * 50); - m.Display(GraphCore.GraphType.Say_C_End, m.DisplayNomal); + if (m.DisplayType == GraphCore.GraphType.Default || m.DisplayType.ToString().Contains("Say")) + m.Display(GraphCore.GraphType.Say_C_End, m.DisplayNomal); }); ShowTimer.Stop(); EndTimer.Start(); diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index bb95b14..62a5cc1 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -65,10 +65,12 @@ namespace VPet_Simulator.Windows Set = new Setting("Setting#VPET:|\n"); //this.Width = 400 * ZoomSlider.Value; //this.Height = 450 * ZoomSlider.Value; - this.Height = 500 * Set.ZoomLevel; - this.Width = 500 * Set.ZoomLevel; + InitializeComponent(); + this.Height = 1000 * Set.ZoomLevel; + this.Width = 1000 * Set.ZoomLevel; + //不存在就关掉 var modpath = new DirectoryInfo(ModPath + @"\0000_core\pet\vup"); if (!modpath.Exists)