using System; using System.Collections.Generic; using System.Linq; using System.Security.AccessControl; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Input; using System.Windows.Threading; namespace VPet_Simulator.Core { public partial class Main { /// /// 显示默认情况 /// public void DisplayNomal() { IsNomal = true; Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode)); } /// /// 显示摸头情况 /// public void DisplayTouchHead() { IsNomal = false; if (((IGraph)PetGrid.Child).GraphType == GraphCore.GraphType.Touch_Head_B_Loop) { ((IGraph)PetGrid.Child).IsContinue = true; return; } Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_A_Start, Core.Save.Mode), () => Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_B_Loop, Core.Save.Mode), () => Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_C_End, Core.Save.Mode), () => Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode) )))); } /// /// 显示拖拽情况 /// public void DisplayRaised() { IsNomal = false; //位置迁移: 254-128 MainGrid.MouseMove += MainGrid_MouseMove; rasetype = 0; DisplayRaising(); //if (((IGraph)PetGrid.Child).GraphType == GraphCore.GraphType.Touch_Head_B_Loop) //{ // ((IGraph)PetGrid.Child).IsContinue = true; // return; //} //Display(Core.Graph.FindGraph(GraphCore.GraphType.Raised_Dynamic, Core.Save.Mode), () => // Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_B_Loop, Core.Save.Mode), () => // Display(Core.Graph.FindGraph(GraphCore.GraphType.Touch_Head_C_End, Core.Save.Mode), () => // Display(Core.Graph.FindGraph(GraphCore.GraphType.Default, Core.Save.Mode) //)))); } int rasetype = -1; /// /// 显示拖拽中 /// public void DisplayRaising() { switch (rasetype++) { case -1: DisplayFalled(); rasetype = -2; return; case 0: case 1: case 2: Display(Core.Graph.FindGraph(GraphCore.GraphType.Raised_Dynamic, Core.Save.Mode), DisplayRaising); return; case 3: Display(Core.Graph.FindGraph(GraphCore.GraphType.Raised_Static_A_Start, Core.Save.Mode), DisplayRaising); return; default: Display(Core.Graph.FindGraph(GraphCore.GraphType.Raised_Static_B_Loop, Core.Save.Mode), DisplayRaising); rasetype = 4; break; } } /// /// 显示掉到地上 /// public void DisplayFalled() {//TODO:爬起 Display(Core.Graph.FindGraph(GraphCore.GraphType.Fall_B_End, Core.Save.Mode), DisplayNomal); } bool petgridcrlf = true; /// /// 显示动画 (自动多层切换) /// /// 动画 /// 结束操作 public void Display(IGraph graph, Action EndAction = null) { if (PetGrid.Child == graph.This) { ((IGraph)(PetGrid.Child)).Run(EndAction); return; } else if (PetGrid2.Child == graph.This) { ((IGraph)(PetGrid2.Child)).Run(EndAction); return; } graph.Run(EndAction); if (petgridcrlf) { ((IGraph)(PetGrid.Child)).Stop(true); Dispatcher.Invoke(() => PetGrid2.Child = graph.This); Task.Run(() => { Thread.Sleep(25); Dispatcher.Invoke(() => PetGrid.Child = null); }); } else { ((IGraph)(PetGrid2.Child)).Stop(true); Dispatcher.Invoke(() => PetGrid.Child = graph.This); Task.Run(() => { Thread.Sleep(25); Dispatcher.Invoke(() => PetGrid2.Child = null); }); } petgridcrlf = !petgridcrlf; } } }