From 2babad03a273ce9b0fde415127961d763864887c Mon Sep 17 00:00:00 2001 From: ZouJin Date: Thu, 26 Jan 2023 00:23:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AE=A1=E7=90=86=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet-Simulator.Core/Display/Main.xaml.cs | 2 + VPet-Simulator.Core/Display/MainDisplay.cs | 10 ++-- VPet-Simulator.Core/Display/MainLogic.cs | 2 +- VPet-Simulator.Core/Graph/GraphCore.cs | 6 +-- VPet-Simulator.Windows/MainWindow.xaml.cs | 10 +++- .../VPet-Simulator.Windows.csproj | 7 +++ .../WinDesign/winConsole.xaml | 15 ++++++ .../WinDesign/winConsole.xaml.cs | 46 +++++++++++++++++++ 8 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 VPet-Simulator.Windows/WinDesign/winConsole.xaml create mode 100644 VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs diff --git a/VPet-Simulator.Core/Display/Main.xaml.cs b/VPet-Simulator.Core/Display/Main.xaml.cs index f84fd12..b56b1ae 100644 --- a/VPet-Simulator.Core/Display/Main.xaml.cs +++ b/VPet-Simulator.Core/Display/Main.xaml.cs @@ -56,6 +56,8 @@ namespace VPet_Simulator.Core Core.TouchEvent.Add(new TouchArea(Core.Graph.GraphConfig.TouchRaisedLocate, Core.Graph.GraphConfig.TouchRaisedSize, DisplayRaised, true)); 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); + PetGrid2.Child = ig2.This; //用于缓存 ig.Run(DisplayNomal); diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs index e05eb04..f8f51c9 100644 --- a/VPet-Simulator.Core/Display/MainDisplay.cs +++ b/VPet-Simulator.Core/Display/MainDisplay.cs @@ -988,20 +988,22 @@ namespace VPet_Simulator.Core DisplayType = graph.GraphType; if (PetGrid.Child == graph.This) { + ((IGraph)(PetGrid2.Child)).Stop(true); Dispatcher.Invoke(() => { PetGrid.Visibility = Visibility.Visible; - PetGrid2.Visibility = Visibility.Collapsed; + PetGrid2.Visibility = Visibility.Hidden; }); graph.Run(EndAction); return; } else if (PetGrid2.Child == graph.This) { + ((IGraph)(PetGrid.Child)).Stop(true); Dispatcher.Invoke(() => { PetGrid2.Visibility = Visibility.Visible; - PetGrid.Visibility = Visibility.Collapsed; + PetGrid.Visibility = Visibility.Hidden; }); graph.Run(EndAction); return; @@ -1015,7 +1017,7 @@ namespace VPet_Simulator.Core Dispatcher.Invoke(() => { PetGrid2.Child = graph.This; - PetGrid.Visibility = Visibility.Collapsed; + PetGrid.Visibility = Visibility.Hidden; PetGrid2.Visibility = Visibility.Visible; }); //Task.Run(() => @@ -1030,7 +1032,7 @@ namespace VPet_Simulator.Core Dispatcher.Invoke(() => { PetGrid.Child = graph.This; - PetGrid2.Visibility = Visibility.Collapsed; + PetGrid2.Visibility = Visibility.Hidden; PetGrid.Visibility = Visibility.Visible; }); //Task.Run(() => diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index 249a709..685f7bd 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -85,7 +85,7 @@ namespace VPet_Simulator.Core Dispatcher.Invoke(() => TimeUIHandle.Invoke(this)); if (DisplayType == GraphCore.GraphType.Default && !isPress) - switch (17)//Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal))) + switch (Function.Rnd.Next(Math.Max(20, Core.Controller.InteractionCycle - CountNomal))) { case 0: //随机向右 diff --git a/VPet-Simulator.Core/Graph/GraphCore.cs b/VPet-Simulator.Core/Graph/GraphCore.cs index 06b955e..22d3517 100644 --- a/VPet-Simulator.Core/Graph/GraphCore.cs +++ b/VPet-Simulator.Core/Graph/GraphCore.cs @@ -244,8 +244,8 @@ namespace VPet_Simulator.Core /// 位置 /// 状态类型 /// 动画类型 - /// 是否储存到内存以节约加载 - public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype, bool storemem = false) + ///// 是否储存到内存以节约加载 + public void AddGraph(string path, Save.ModeType modetype, GraphType graphtype)//, bool storemem = false) { var paths = new DirectoryInfo(path).GetFiles(); if (paths.Length == 0) @@ -254,7 +254,7 @@ namespace VPet_Simulator.Core AddGraph(new Picture(paths[0].FullName, modetype, graphtype, int.Parse(paths[0].Name.Split('.').Reverse().ToArray()[1].Split('_').Last())), graphtype); else - AddGraph(new PNGAnimation(paths, modetype, graphtype, storemem), graphtype); + AddGraph(new PNGAnimation(paths, modetype, graphtype), graphtype); } /// /// 随机数字典(用于确保随机动画不会错位) diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index d6377da..bb95b14 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -79,6 +79,7 @@ namespace VPet_Simulator.Windows } Task.Run(GameLoad); } + private long lastclicktime; public void GameLoad() { //加载所有MOD @@ -134,9 +135,16 @@ namespace VPet_Simulator.Windows LoadingText.Visibility = Visibility.Collapsed; winSetting = new winGameSetting(this); Main = new Main(Core) { }; - Main.DefaultClickAction = () => { Dispatcher.Invoke(() => { Main.Say("你知道吗? 鼠标右键可以打开菜单栏"); }); }; + Main.DefaultClickAction = () => { + if (new TimeSpan(DateTime.Now.Ticks - lastclicktime).TotalMinutes > 1) + { + lastclicktime = DateTime.Now.Ticks; + Dispatcher.Invoke(() => { Main.Say("你知道吗? 鼠标右键可以打开菜单栏"); }); + } + }; DisplayGrid.Child = Main; Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "退出桌宠", () => { Close(); }); + Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "管理控制台", () => { new winConsole(this).Show(); }); Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "反馈中心", () => { new winReport(this).Show(); }); Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "设置面板", () => { diff --git a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj index ac6b825..c79b5b0 100644 --- a/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj +++ b/VPet-Simulator.Windows/VPet-Simulator.Windows.csproj @@ -118,6 +118,9 @@ winCharacterPanel.xaml + + winConsole.xaml + winGameSetting.xaml @@ -145,6 +148,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/VPet-Simulator.Windows/WinDesign/winConsole.xaml b/VPet-Simulator.Windows/WinDesign/winConsole.xaml new file mode 100644 index 0000000..248fbc4 --- /dev/null +++ b/VPet-Simulator.Windows/WinDesign/winConsole.xaml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs b/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs new file mode 100644 index 0000000..02d256c --- /dev/null +++ b/VPet-Simulator.Windows/WinDesign/winConsole.xaml.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using static VPet_Simulator.Core.GraphCore; + +namespace VPet_Simulator.Windows +{ + /// + /// winConsole.xaml 的交互逻辑 + /// + public partial class winConsole : Window + { + MainWindow mw; + public winConsole(MainWindow mw) + { + InitializeComponent(); + this.mw = mw; + foreach (string v in Enum.GetNames(typeof(GraphType))) + { + GraphListBox.Items.Add(v); + } + + } + public void DisplayLoop(GraphType graphType) + { + mw.Main.Display(graphType, () => DisplayLoop(graphType)); + } + private void GraphListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + if (GraphListBox.SelectedItem == null) + return; + LabelNowPlay.Content = $"当前正在播放: {GraphListBox.SelectedItem}"; + DisplayLoop((GraphType)Enum.Parse(typeof(GraphType), (string)GraphListBox.SelectedItem)); + } + } +}