VPet/VPet-Simulator.Core/Display/MainDisplay.cs

1222 lines
45 KiB
C#
Raw Normal View History

2022-12-13 07:10:18 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
2022-12-14 18:17:13 +00:00
using System.Windows;
2023-01-19 15:26:58 +00:00
using System.Windows.Controls;
2022-12-13 07:10:18 +00:00
using System.Windows.Input;
using System.Windows.Threading;
2023-01-20 07:08:28 +00:00
using static VPet_Simulator.Core.GraphCore;
2022-12-13 07:10:18 +00:00
namespace VPet_Simulator.Core
{
public partial class Main
{
2023-01-20 07:08:28 +00:00
/// <summary>
/// 当前动画类型
/// </summary>
2023-05-19 16:43:22 +00:00
public GraphCore.GraphType DisplayType = GraphType.Default;
2022-12-13 07:10:18 +00:00
/// <summary>
2023-01-20 07:08:28 +00:00
/// 默认循环次数
/// </summary>
public int CountNomal = 0;
/// <summary>
2023-05-19 08:17:51 +00:00
/// 以标准形式显示当前默认状态
/// </summary>
public void DisplayToNomal()
{
switch (State)
{
default:
case WorkingState.Nomal:
DisplayNomal();
return;
case WorkingState.Sleep:
DisplaySleep(true);
return;
case WorkingState.WorkONE:
DisplayWorkONE();
return;
case WorkingState.WorkTWO:
DisplayWorkTWO();
return;
case WorkingState.Study:
DisplayStudy();
return;
}
}
/// <summary>
2022-12-13 07:10:18 +00:00
/// 显示默认情况
/// </summary>
public void DisplayNomal()
{
2023-01-20 07:08:28 +00:00
CountNomal++;
2023-05-19 16:43:22 +00:00
Display(GraphType.Default, DisplayNomal);
2022-12-13 07:10:18 +00:00
}
2023-01-19 15:26:58 +00:00
/// <summary>
/// 显示结束动画
/// </summary>
/// <param name="EndAction">结束后接下来</param>
/// <returns>是否成功结束</returns>
public bool DisplayStopMove(Action EndAction)
{
switch (DisplayType)
{
2023-05-19 16:43:22 +00:00
case GraphType.Boring_B_Loop:
Display(GraphType.Boring_C_End, EndAction);
2023-01-19 15:26:58 +00:00
return true;
2023-05-19 16:43:22 +00:00
case GraphType.Squat_B_Loop:
Display(GraphType.Squat_C_End, EndAction);
2023-01-19 15:26:58 +00:00
return true;
2023-01-22 17:33:13 +00:00
case GraphType.Crawl_Left_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_C_End, EndAction);
2023-01-22 17:33:13 +00:00
return true;
case GraphType.Crawl_Right_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_C_End, EndAction);
2023-01-22 17:33:13 +00:00
return true;
case GraphType.Fall_Left_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Fall_Left_C_End,
() => Display(GraphType.Climb_Up_Left, EndAction));
2023-01-22 17:33:13 +00:00
return true;
case GraphType.Fall_Right_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Fall_Right_C_End,
() => Display(GraphType.Climb_Up_Right, EndAction));
2023-01-22 17:33:13 +00:00
return true;
case GraphType.Walk_Left_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, EndAction);
2023-01-22 17:33:13 +00:00
return true;
case GraphType.Walk_Right_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Right_C_End, EndAction);
2023-01-25 04:49:18 +00:00
return true;
case GraphType.Sleep_B_Loop:
2023-05-19 08:17:51 +00:00
State = WorkingState.Nomal;
2023-05-19 16:43:22 +00:00
Display(GraphType.Sleep_C_End, EndAction);
2023-01-22 17:33:13 +00:00
return true;
2023-01-28 06:12:01 +00:00
case GraphType.Idel_StateONE_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateONE_C_End, EndAction);
2023-01-28 06:12:01 +00:00
return true;
case GraphType.Idel_StateTWO_B_Loop:
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateTWO_C_End, () => Display(GraphType.Idel_StateONE_C_End, EndAction));
2023-01-28 06:12:01 +00:00
return true;
2023-01-24 06:56:16 +00:00
//case GraphType.Climb_Left:
//case GraphType.Climb_Right:
//case GraphType.Climb_Top_Left:
//case GraphType.Climb_Top_Right:
// DisplayFalled_Left();
// return true;
2023-01-19 15:26:58 +00:00
}
return false;
}
/// <summary>
/// 显示关机动画
/// </summary>
public void DisplayClose(Action EndAction)
{
CountNomal++;
2023-05-19 16:43:22 +00:00
Display(GraphType.Shutdown, EndAction);
}
2022-12-13 07:10:18 +00:00
/// <summary>
/// 显示摸头情况
/// </summary>
public void DisplayTouchHead()
{
2023-05-10 03:13:34 +00:00
if (Core.Controller.EnableFunction && Core.Save.Strength >= 10 && Core.Save.Feeling < 100)
2023-02-20 08:47:44 +00:00
{
Core.Save.StrengthChange(-1);
Core.Save.FeelingChange(1);
}
if (DisplayType == GraphType.Touch_Head_A_Start)
return;
2023-01-21 14:16:13 +00:00
if (DisplayType == GraphType.Touch_Head_B_Loop)
2023-05-19 16:43:22 +00:00
if (Dispatcher.Invoke(() => PetGrid.Tag) is IGraph ig && ig.GraphType == GraphType.Touch_Head_B_Loop)
2022-12-14 18:17:13 +00:00
{
2023-01-20 07:08:28 +00:00
ig.IsContinue = true;
2022-12-14 18:17:13 +00:00
return;
}
2023-05-19 16:43:22 +00:00
else if (Dispatcher.Invoke(() => PetGrid2.Tag) is IGraph ig2 && ig2.GraphType == GraphType.Touch_Head_B_Loop)
2022-12-14 18:17:13 +00:00
{
2023-01-20 07:08:28 +00:00
ig2.IsContinue = true;
2022-12-14 18:17:13 +00:00
return;
}
2023-02-20 08:47:44 +00:00
2023-05-19 16:43:22 +00:00
Display(GraphType.Touch_Head_A_Start, () =>
Display(GraphType.Touch_Head_B_Loop, () =>
Display(GraphType.Touch_Head_C_End, DisplayToNomal
2022-12-14 18:17:13 +00:00
)));
2022-12-13 07:10:18 +00:00
}
2023-02-21 11:37:01 +00:00
/// <summary>
/// 显示摸身体情况
/// </summary>
public void DisplayTouchBody()
{
2023-05-10 03:13:34 +00:00
if (Core.Controller.EnableFunction && Core.Save.Strength >= 10 && Core.Save.Feeling < 100)
2023-02-21 11:37:01 +00:00
{
Core.Save.StrengthChange(-1);
Core.Save.FeelingChange(1);
}
if (DisplayType == GraphType.Touch_Body_A_Start)
return;
if (DisplayType == GraphType.Touch_Body_B_Loop)
2023-05-19 16:43:22 +00:00
if (Dispatcher.Invoke(() => PetGrid.Tag) is IGraph ig && ig.GraphType == GraphType.Touch_Body_B_Loop)
2023-02-21 11:37:01 +00:00
{
ig.IsContinue = true;
return;
}
2023-05-19 16:43:22 +00:00
else if (Dispatcher.Invoke(() => PetGrid2.Tag) is IGraph ig2 && ig2.GraphType == GraphType.Touch_Body_B_Loop)
2023-02-21 11:37:01 +00:00
{
ig2.IsContinue = true;
return;
}
2023-02-22 05:37:23 +00:00
Core.Graph.RndGraph.Clear();
2023-05-19 16:43:22 +00:00
Display(GraphType.Touch_Body_A_Start, () =>
Display(GraphType.Touch_Body_B_Loop, () =>
Display(GraphType.Touch_Body_C_End, DisplayToNomal
2023-05-19 08:17:51 +00:00
)));
2023-02-21 11:37:01 +00:00
}
2023-01-19 15:26:58 +00:00
/// <summary>
2023-01-28 06:12:01 +00:00
/// 显示待机(模式1)情况
2023-01-19 15:26:58 +00:00
/// </summary>
2023-01-28 06:12:01 +00:00
public void DisplayIdel_StateONE()
2023-01-19 15:26:58 +00:00
{
looptimes = 0;
CountNomal = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateONE_A_Start, DisplayIdel_StateONEing);
2023-01-19 15:26:58 +00:00
}
/// <summary>
2023-01-28 06:12:01 +00:00
/// 显示待机(模式1)情况
2023-01-19 15:26:58 +00:00
/// </summary>
2023-01-28 06:12:01 +00:00
private void DisplayIdel_StateONEing()
2023-01-19 15:26:58 +00:00
{
2023-01-28 06:12:01 +00:00
if (Function.Rnd.Next(++looptimes) > LoopMax)
switch (Function.Rnd.Next(2 + CountNomal))
{
case 0:
DisplayIdel_StateTWO();
break;
default:
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateONE_C_End, DisplayToNomal);
2023-01-28 06:12:01 +00:00
break;
}
2023-01-19 15:26:58 +00:00
else
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateONE_B_Loop, DisplayIdel_StateONEing);
2023-01-28 06:12:01 +00:00
}
/// <summary>
/// 显示待机(模式2)情况
/// </summary>
public void DisplayIdel_StateTWO()
{
looptimes = 0;
CountNomal++;
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateTWO_A_Start, DisplayIdel_StateTWOing);
2023-01-19 15:26:58 +00:00
}
2023-01-28 06:12:01 +00:00
/// <summary>
/// 显示待机(模式2)情况
/// </summary>
private void DisplayIdel_StateTWOing()
{
if (Function.Rnd.Next(++looptimes) > LoopMax)
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateTWO_C_End, DisplayIdel_StateONEing);
2023-01-28 06:12:01 +00:00
else
2023-05-19 16:43:22 +00:00
Display(GraphType.Idel_StateTWO_B_Loop, DisplayIdel_StateTWOing);
2023-01-28 06:12:01 +00:00
}
2023-01-19 15:26:58 +00:00
int looptimes;
/// <summary>
/// 显示蹲下情况
/// </summary>
public void DisplaySquat()
{
looptimes = 0;
CountNomal = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Squat_A_Start, DisplaySquating);
2023-01-19 15:26:58 +00:00
}
/// <summary>
/// 显示蹲下情况
/// </summary>
2023-01-28 06:12:01 +00:00
private void DisplaySquating()
2023-01-19 15:26:58 +00:00
{
2023-01-25 04:49:18 +00:00
if (Function.Rnd.Next(++looptimes) > LoopProMax)
2023-05-19 16:43:22 +00:00
Display(GraphType.Squat_C_End, DisplayToNomal);
2023-01-19 15:26:58 +00:00
else
2023-05-19 16:43:22 +00:00
Display(GraphType.Squat_B_Loop, DisplaySquating);
2023-01-19 15:26:58 +00:00
}
2023-01-28 06:12:01 +00:00
/// <summary>
/// 显示无聊情况
/// </summary>
public void DisplayBoring()
{
looptimes = 0;
CountNomal = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Boring_A_Start, DisplayBoringing);
2023-01-28 06:12:01 +00:00
}
/// <summary>
/// 显示无聊情况
/// </summary>
private void DisplayBoringing()
{
if (Function.Rnd.Next(++looptimes) > LoopProMax)
2023-05-19 16:43:22 +00:00
Display(GraphType.Boring_C_End, DisplayToNomal);
2023-01-28 06:12:01 +00:00
else
2023-05-19 16:43:22 +00:00
Display(GraphType.Boring_B_Loop, DisplayBoringing);
2023-01-28 06:12:01 +00:00
}
2023-01-25 04:49:18 +00:00
/// <summary>
/// 显示睡觉情况
/// </summary>
public void DisplaySleep(bool force = false)
{
looptimes = 0;
CountNomal = 0;
if (force)
2023-05-19 08:17:51 +00:00
{
State = WorkingState.Sleep;
2023-05-19 16:43:22 +00:00
Display(GraphType.Sleep_A_Start, DisplaySleepingForce);
2023-05-19 08:17:51 +00:00
}
2023-01-25 04:49:18 +00:00
else
2023-05-19 16:43:22 +00:00
Display(GraphType.Sleep_A_Start, DisplaySleeping);
2023-01-25 04:49:18 +00:00
}
/// <summary>
/// 显示睡觉情况 (正常)
/// </summary>
2023-01-28 06:12:01 +00:00
private void DisplaySleeping()
2023-01-25 04:49:18 +00:00
{
if (Function.Rnd.Next(++looptimes) > LoopProMax)
2023-05-19 16:43:22 +00:00
Display(GraphType.Sleep_C_End, DisplayToNomal);
2023-01-25 04:49:18 +00:00
else
2023-05-19 16:43:22 +00:00
Display(GraphType.Sleep_B_Loop, DisplaySleeping);
2023-01-25 04:49:18 +00:00
}
/// <summary>
/// 显示睡觉情况 (强制)
/// </summary>
2023-01-28 06:12:01 +00:00
private void DisplaySleepingForce()
2023-01-25 04:49:18 +00:00
{//TODO:如果开启了Function,强制睡觉为永久,否则睡到自然醒+LoopMax
2023-05-19 16:43:22 +00:00
Display(GraphType.Sleep_B_Loop, DisplaySleepingForce);
2023-01-25 04:49:18 +00:00
}
2023-05-19 08:17:51 +00:00
/// <summary>
/// 显示工作情况
/// </summary>
public void DisplayWorkONE()
{
State = WorkingState.WorkONE;
2023-05-19 16:43:22 +00:00
Display(GraphType.WorkONE_A_Start, DisplayWorkONEing);
}
/// <summary>
/// 显示工作情况结束
/// </summary>
public void DisplayWorkONEend()
{
State = WorkingState.Nomal;
Display(GraphType.WorkONE_C_End, DisplayNomal);
2023-05-19 08:17:51 +00:00
}
/// <summary>
/// 显示工作情况循环
/// </summary>
private void DisplayWorkONEing()
{
2023-05-19 16:43:22 +00:00
Display(GraphType.WorkONE_B_Loop, DisplayWorkONEing);
2023-05-19 08:17:51 +00:00
}
/// <summary>
/// 显示工作情况
/// </summary>
public void DisplayWorkTWO()
{
State = WorkingState.WorkTWO;
2023-05-19 16:43:22 +00:00
Display(GraphType.WorkTWO_A_Start, DisplayWorkTWOing);
2023-05-19 08:17:51 +00:00
}
/// <summary>
/// 显示工作情况循环
/// </summary>
private void DisplayWorkTWOing()
{
2023-05-19 16:43:22 +00:00
Display(GraphType.WorkTWO_B_Loop, DisplayWorkTWOing);
}
/// <summary>
/// 显示工作情况结束
/// </summary>
public void DisplayWorkTWOend()
{
State = WorkingState.Nomal;
Display(GraphType.WorkTWO_C_End, DisplayNomal);
2023-05-19 08:17:51 +00:00
}
/// <summary>
/// 显示学习情况
/// </summary>
public void DisplayStudy()
{
State = WorkingState.Study;
2023-05-19 16:43:22 +00:00
Display(GraphType.Study_A_Start, DisplayStudying);
2023-05-19 08:17:51 +00:00
}
/// <summary>
/// 显示学习情况
/// </summary>
private void DisplayStudying()
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Study_B_Loop, DisplayStudying);
2023-05-19 08:17:51 +00:00
}
2022-12-13 07:10:18 +00:00
/// <summary>
/// 显示拖拽情况
/// </summary>
public void DisplayRaised()
{
//位置迁移: 254-128
MainGrid.MouseMove += MainGrid_MouseMove;
2023-02-20 08:47:44 +00:00
MainGrid.MouseMove -= MainGrid_MouseWave;
2022-12-13 07:10:18 +00:00
rasetype = 0;
DisplayRaising();
}
2023-01-20 07:08:28 +00:00
int rasetype = int.MinValue;
2022-12-14 18:17:13 +00:00
int walklength = 0;
2022-12-13 07:10:18 +00:00
/// <summary>
/// 显示拖拽中
/// </summary>
private void DisplayRaising()
2022-12-13 07:10:18 +00:00
{
2023-01-23 17:31:16 +00:00
switch (rasetype)
2022-12-13 07:10:18 +00:00
{
2023-01-23 17:31:16 +00:00
case int.MinValue:
break;
2022-12-13 07:10:18 +00:00
case -1:
DisplayFalled_Left();
2023-01-20 07:08:28 +00:00
rasetype = int.MinValue;
2022-12-13 07:10:18 +00:00
return;
case 0:
case 1:
case 2:
2023-01-23 17:31:16 +00:00
rasetype++;
2023-05-19 16:43:22 +00:00
Display(GraphType.Raised_Dynamic, DisplayRaising);
2022-12-13 07:10:18 +00:00
return;
case 3:
2023-01-23 17:31:16 +00:00
rasetype++;
2023-05-19 16:43:22 +00:00
Display(GraphType.Raised_Static_A_Start, DisplayRaising);
2022-12-13 07:10:18 +00:00
return;
default:
2023-05-19 16:43:22 +00:00
Display(GraphType.Raised_Static_B_Loop, DisplayRaising);
2022-12-13 07:10:18 +00:00
rasetype = 4;
break;
}
}
/// <summary>
/// 显示掉到地上 从左边
2022-12-13 07:10:18 +00:00
/// </summary>
public void DisplayFalled_Left()
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Fall_Left_C_End,
() => Display(GraphType.Climb_Up_Left, DisplayToNomal));
}
/// <summary>
/// 显示掉到地上 从左边
/// </summary>
public void DisplayFalled_Right()
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Fall_Right_C_End,
() => Display(GraphType.Climb_Up_Right, DisplayToNomal));
2022-12-13 07:10:18 +00:00
}
2022-12-14 18:17:13 +00:00
/// <summary>
/// 显示向左走 (有判断)
/// </summary>
public void DisplayWalk_Left()
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() > DistanceMax * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{
walklength = 0;
CountNomal = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_A_Start, () =>
2022-12-14 18:17:13 +00:00
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedWalk, 0);
2022-12-14 18:17:13 +00:00
MoveTimer.Start();
DisplayWalk_Lefting();
});
}
}
/// <summary>
/// 显示向左走
/// </summary>
private void DisplayWalk_Lefting()
2022-12-14 18:17:13 +00:00
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() < DistanceMin * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{//是,停下恢复默认 or/爬墙
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2022-12-14 18:17:13 +00:00
{
case 0:
2023-01-21 14:16:13 +00:00
DisplayFall_Left(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
});
2022-12-14 18:17:13 +00:00
return;
case 1:
2023-01-21 14:16:13 +00:00
DisplayFall_Right(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
});
2022-12-14 18:17:13 +00:00
return;
default:
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2022-12-14 18:17:13 +00:00
return;
}
}
//不是:继续右边走or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2022-12-14 18:17:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_B_Loop, DisplayWalk_Lefting);
2022-12-14 18:17:13 +00:00
}
else
{//停下来
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-21 14:16:13 +00:00
{
case 0:
DisplayFall_Left(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2023-01-21 14:16:13 +00:00
});
break;
case 1:
DisplayFall_Right(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2023-01-21 14:16:13 +00:00
});
break;
default:
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2023-01-21 14:16:13 +00:00
break;
}
2022-12-14 18:17:13 +00:00
}
}
/// <summary>
/// 显示向右走 (有判断)
/// </summary>
public void DisplayWalk_Right()
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() > DistanceMax * Core.Controller.ZoomRatio)
{
walklength = 0;
CountNomal = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Right_A_Start, () =>
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedWalk, 0);
MoveTimer.Start();
DisplayWalk_Righting();
});
}
}
2023-01-20 07:08:28 +00:00
/// <summary>
/// 显示向右走
/// </summary>
private void DisplayWalk_Righting()
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() < DistanceMin * Core.Controller.ZoomRatio)
2023-01-20 07:08:28 +00:00
{//是,停下恢复默认 or/爬墙
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-20 07:08:28 +00:00
{
case 0:
DisplayClimb_Right_UP(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Right_C_End, DisplayToNomal);
2023-01-20 07:08:28 +00:00
});
return;
case 1:
DisplayClimb_Right_DOWN(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Right_C_End, DisplayToNomal);
2023-01-20 07:08:28 +00:00
});
return;
default:
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Right_C_End, DisplayToNomal);
2023-01-20 07:08:28 +00:00
return;
}
}
//不是:继续右边走or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2023-01-20 07:08:28 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Right_B_Loop, DisplayWalk_Righting);
2023-01-20 07:08:28 +00:00
}
else
{//停下来
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-21 14:16:13 +00:00
{
case 0:
DisplayFall_Left(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2023-01-21 14:16:13 +00:00
});
break;
case 1:
DisplayFall_Right(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2023-01-21 14:16:13 +00:00
});
break;
default:
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Walk_Left_C_End, DisplayToNomal);
2023-01-21 14:16:13 +00:00
break;
}
2023-01-20 07:08:28 +00:00
}
}
2023-01-22 17:33:13 +00:00
/// <summary>
/// 显示向左爬 (有判断)
/// </summary>
public void DisplayCrawl_Left()
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() > DistanceMax * Core.Controller.ZoomRatio)
2023-01-22 17:33:13 +00:00
{
walklength = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_A_Start, () =>
2023-01-22 17:33:13 +00:00
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedCrawl, 0);
2023-01-22 17:33:13 +00:00
MoveTimer.Start();
DisplayCrawl_Lefting();
});
}
}
/// <summary>
/// 显示向左爬
/// </summary>
private void DisplayCrawl_Lefting()
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() < DistanceMin * Core.Controller.ZoomRatio)
2023-01-22 17:33:13 +00:00
{//是,停下恢复默认 or/爬墙
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-22 17:33:13 +00:00
{
case 0:
DisplayClimb_Left_UP(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
});
return;
case 1:
DisplayClimb_Left_DOWN(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
});
return;
default:
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
return;
}
}
//不是:继续右边走or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2023-01-22 17:33:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_B_Loop, DisplayCrawl_Lefting);
2023-01-22 17:33:13 +00:00
}
else
{//停下来
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Left_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
}
}
/// <summary>
/// 显示向右爬 (有判断)
/// </summary>
public void DisplayCrawl_Right()
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() > DistanceMax * Core.Controller.ZoomRatio)
2023-01-22 17:33:13 +00:00
{
walklength = 0;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_A_Start, () =>
2023-01-22 17:33:13 +00:00
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedCrawl, 0);
2023-01-22 17:33:13 +00:00
MoveTimer.Start();
DisplayCrawl_Righting();
});
}
}
/// <summary>
/// 显示向右爬
/// </summary>
private void DisplayCrawl_Righting()
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() < DistanceMin * Core.Controller.ZoomRatio)
2023-01-22 17:33:13 +00:00
{//是,停下恢复默认 or/爬墙
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-22 17:33:13 +00:00
{
case 0:
DisplayClimb_Right_UP(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
});
return;
case 1:
DisplayClimb_Right_DOWN(() =>
{
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
});
return;
default:
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
return;
}
}
//不是:继续右边走or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2023-01-22 17:33:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_B_Loop, DisplayCrawl_Righting);
2023-01-22 17:33:13 +00:00
}
else
{//停下来
MoveTimer.Enabled = false;
2023-05-19 16:43:22 +00:00
Display(GraphType.Crawl_Right_C_End, DisplayToNomal);
2023-01-22 17:33:13 +00:00
}
}
/// <summary>
2022-12-14 18:17:13 +00:00
/// 显示左墙壁爬行 上
/// </summary>
public void DisplayClimb_Left_UP(Action ifNot = null)
2022-12-14 18:17:13 +00:00
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() < DistanceMid * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceUp() > DistanceMax * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{
walklength = 0;
CountNomal = 0;
2023-01-24 06:56:16 +00:00
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbLeft, 0);
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Left_A_Start, () =>
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Lefting_UP();
});
2022-12-14 18:17:13 +00:00
}
else
ifNot?.Invoke();
2022-12-14 18:17:13 +00:00
}
/// <summary>
/// 显示左墙壁爬行 上
/// </summary>
private void DisplayClimb_Lefting_UP()
2022-12-14 18:17:13 +00:00
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceUp() < DistanceMid * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{//是,停下恢复默认 or/爬上面的墙
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2022-12-14 18:17:13 +00:00
{
case 0:
DisplayClimb_Top_Right();
return;
2023-01-21 14:16:13 +00:00
case 1:
DisplayFall_Right();
return;
2022-12-14 18:17:13 +00:00
default:
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2022-12-14 18:17:13 +00:00
return;
}
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMid)
2022-12-14 18:17:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Left_B_Loop, DisplayClimb_Lefting_UP);
2022-12-14 18:17:13 +00:00
}
else
{//停下来
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-21 14:16:13 +00:00
{
case 1:
DisplayFall_Right();
break;
default:
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2023-01-21 14:16:13 +00:00
break;
}
2022-12-14 18:17:13 +00:00
}
}
/// <summary>
/// 显示左墙壁爬行 下
/// </summary>
public void DisplayClimb_Left_DOWN(Action ifNot = null)
2022-12-14 18:17:13 +00:00
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() < DistanceMin * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceDown() > DistanceMax * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{
walklength = 0;
CountNomal = 0;
2022-12-14 18:17:13 +00:00
2023-01-24 06:56:16 +00:00
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbLeft, 0);
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Left_A_Start, () =>
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new System.Windows.Point(0, Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Lefting_DOWN();
});
2022-12-14 18:17:13 +00:00
}
else
ifNot?.Invoke();
2022-12-14 18:17:13 +00:00
}
/// <summary>
/// 显示左墙壁爬行 下
/// </summary>
private void DisplayClimb_Lefting_DOWN()
2022-12-14 18:17:13 +00:00
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceDown() < DistanceMin * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{//是,停下恢复默认
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2022-12-14 18:17:13 +00:00
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2022-12-14 18:17:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Left_B_Loop, DisplayClimb_Lefting_DOWN);
2022-12-14 18:17:13 +00:00
}
else
{//停下来
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2022-12-14 18:17:13 +00:00
}
}
/// <summary>
/// 显示右墙壁爬行 上
/// </summary>
public void DisplayClimb_Right_UP(Action ifNot = null)
2022-12-14 18:17:13 +00:00
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() < DistanceMid * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceUp() > DistanceMax * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{
walklength = 0;
CountNomal = 0;
2022-12-14 18:17:13 +00:00
2023-01-24 06:56:16 +00:00
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + Core.Graph.GraphConfig.LocateClimbRight, 0);
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Right_A_Start, () =>
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Righting_UP();
});
2022-12-14 18:17:13 +00:00
}
else
ifNot?.Invoke();
2022-12-14 18:17:13 +00:00
}
/// <summary>
/// 显示右墙壁爬行 上
/// </summary>
private void DisplayClimb_Righting_UP()
2022-12-14 18:17:13 +00:00
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceUp() < DistanceMid * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{//是,停下恢复默认 or/爬上面的墙
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2022-12-14 18:17:13 +00:00
{
case 0:
DisplayClimb_Top_Left();
2022-12-14 18:17:13 +00:00
return;
2023-01-21 14:16:13 +00:00
case 1:
DisplayFall_Left();
return;
2022-12-14 18:17:13 +00:00
default:
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2022-12-14 18:17:13 +00:00
return;
}
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2022-12-14 18:17:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Right_B_Loop, DisplayClimb_Righting_UP);
2022-12-14 18:17:13 +00:00
}
else
{//停下来
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-21 14:16:13 +00:00
{
case 0:
DisplayFall_Left();
break;
default:
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2023-01-21 14:16:13 +00:00
break;
}
2022-12-14 18:17:13 +00:00
}
}
/// <summary>
/// 显示右墙壁爬行 下
/// </summary>
public void DisplayClimb_Right_DOWN(Action ifNot = null)
2022-12-14 18:17:13 +00:00
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() < DistanceMid * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceDown() > DistanceMax * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{
walklength = 0;
CountNomal = 0;
2022-12-14 18:17:13 +00:00
2023-01-24 06:56:16 +00:00
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + Core.Graph.GraphConfig.LocateClimbRight, 0);
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Right_A_Start, () =>
{
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(0, Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Righting_DOWN();
});
2022-12-14 18:17:13 +00:00
}
else
ifNot?.Invoke();
2022-12-14 18:17:13 +00:00
}
/// <summary>
/// 显示右墙壁爬行 下
/// </summary>
private void DisplayClimb_Righting_DOWN()
2022-12-14 18:17:13 +00:00
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceDown() < DistanceMin * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{//是,停下恢复默认
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2022-12-14 18:17:13 +00:00
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMin)
2022-12-14 18:17:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Right_B_Loop, DisplayClimb_Righting_DOWN);
2022-12-14 18:17:13 +00:00
}
else
{//停下来
MoveTimer.Enabled = false;
2023-05-19 08:17:51 +00:00
DisplayToNomal();
2022-12-14 18:17:13 +00:00
}
}
/// <summary>
/// 显示顶部墙壁爬行向右
/// </summary>
public void DisplayClimb_Top_Right()
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceUp() < DistanceMid * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceRight() > DistanceMax * Core.Controller.ZoomRatio)
2022-12-14 18:17:13 +00:00
{
walklength = 0;
CountNomal = 0;
2022-12-14 18:17:13 +00:00
2023-01-24 06:56:16 +00:00
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbTop);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop, 0);
2022-12-14 18:17:13 +00:00
MoveTimer.Start();
DisplayClimb_Top_Righting();
}
}
/// <summary>
/// 显示顶部墙壁爬行向左
2022-12-14 18:17:13 +00:00
/// </summary>
private void DisplayClimb_Top_Righting()
2022-12-14 18:17:13 +00:00
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() < DistanceMin * Core.Controller.ZoomRatio)
{//是,停下恢复默认 or向下爬or掉落
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2022-12-14 18:17:13 +00:00
{
case 0:
DisplayClimb_Right_DOWN();
2022-12-14 18:17:13 +00:00
return;
2023-01-21 14:16:13 +00:00
case 1:
DisplayFall_Right();
return;
2022-12-14 18:17:13 +00:00
default:
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-01-28 06:12:01 +00:00
DisplayFalled_Right();
2022-12-14 18:17:13 +00:00
return;
}
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMax)
2022-12-14 18:17:13 +00:00
{
2023-01-21 14:16:13 +00:00
Display(GraphType.Climb_Top_Right, DisplayClimb_Top_Righting);
2022-12-14 18:17:13 +00:00
}
else
{//停下来
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-01-28 06:12:01 +00:00
DisplayFalled_Right();
2022-12-14 18:17:13 +00:00
}
}
/// <summary>
/// 显示顶部墙壁爬行向左
/// </summary>
public void DisplayClimb_Top_Left()
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceUp() < DistanceMid * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceLeft() > DistanceMax * Core.Controller.ZoomRatio)
{
walklength = 0;
CountNomal = 0;
2022-12-14 18:17:13 +00:00
2023-01-24 06:56:16 +00:00
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbTop);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop, 0);
MoveTimer.Start();
DisplayClimb_Top_Lefting();
}
}
/// <summary>
/// 显示顶部墙壁爬行向左
/// </summary>
private void DisplayClimb_Top_Lefting()
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() < DistanceMin * Core.Controller.ZoomRatio)
{//是,停下恢复默认 or向下爬
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
{
case 0:
DisplayClimb_Left_DOWN();
return;
2023-01-21 14:16:13 +00:00
case 1:
DisplayFall_Left();
return;
default:
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-02-13 09:48:59 +00:00
DisplayFalled_Left();
return;
}
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMax)
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Climb_Top_Left, DisplayClimb_Top_Lefting);
}
else
{//停下来
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-02-13 09:48:59 +00:00
DisplayFalled_Left();
}
}
2023-01-21 14:16:13 +00:00
/// <summary>
/// 显示掉落向左
/// </summary>
public void DisplayFall_Left(Action ifNot = null)
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceDown() > DistanceMax * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceLeft() > DistanceMax * Core.Controller.ZoomRatio)
2023-01-21 14:16:13 +00:00
{
walklength = 0;
CountNomal = 0;
2023-01-24 15:47:16 +00:00
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 1DistanceMin);
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedFallX, Core.Graph.GraphConfig.SpeedFallY);
2023-01-21 14:16:13 +00:00
MoveTimer.Start();
Display(GraphType.Fall_Left_A_Start, DisplayFall_Lefting);
}
else
ifNot?.Invoke();
}
/// <summary>
/// 显示掉落向左
/// </summary>
private void DisplayFall_Lefting()
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceLeft() < DistanceMin * Core.Controller.ZoomRatio || Core.Controller.GetWindowsDistanceDown() < DistanceMin * Core.Controller.ZoomRatio)
2023-01-21 14:16:13 +00:00
{//是,停下恢复默认 or向上爬
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-21 14:16:13 +00:00
{
case 0:
DisplayClimb_Left_UP(() =>
{
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Left();
});
return;
case 1:
DisplayClimb_Left_DOWN(() =>
{
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Left();
});
return;
default:
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Left();
return;
}
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMid)
2023-01-21 14:16:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Fall_Left_B_Loop, DisplayFall_Lefting);
2023-01-21 14:16:13 +00:00
}
else
{//停下来
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Left();
2023-05-19 08:17:51 +00:00
//DisplayToNomal();
2023-01-21 14:16:13 +00:00
}
}
2022-12-14 18:17:13 +00:00
2023-01-21 14:16:13 +00:00
/// <summary>
/// 显示掉落向右
/// </summary>
public void DisplayFall_Right(Action ifNot = null)
{
//看看距离是否满足调节
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceDown() > DistanceMax * Core.Controller.ZoomRatio && Core.Controller.GetWindowsDistanceRight() > DistanceMax * Core.Controller.ZoomRatio)
2023-01-21 14:16:13 +00:00
{
walklength = 0;
CountNomal = 0;
2023-01-24 15:47:16 +00:00
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 1DistanceMin);
2023-01-24 06:56:16 +00:00
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedFallX, Core.Graph.GraphConfig.SpeedFallY);
2023-01-21 14:16:13 +00:00
MoveTimer.Start();
Display(GraphType.Fall_Right_A_Start, DisplayFall_Righting);
}
else
ifNot?.Invoke();
}
/// <summary>
/// 显示掉落向右
/// </summary>
private void DisplayFall_Righting()
{
//看看距离是不是不足
2023-01-24 15:47:16 +00:00
if (Core.Controller.GetWindowsDistanceRight() < DistanceMin * Core.Controller.ZoomRatio || Core.Controller.GetWindowsDistanceDown() < DistanceMin * Core.Controller.ZoomRatio)
2023-01-21 14:16:13 +00:00
{//是,停下恢复默认 or向上爬
2023-01-24 15:47:16 +00:00
switch (Function.Rnd.Next(TreeRND))
2023-01-21 14:16:13 +00:00
{
case 0:
DisplayClimb_Right_UP(() =>
{
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Right();
});
return;
case 1:
DisplayClimb_Right_DOWN(() =>
{
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Right();
});
return;
default:
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Right();
return;
}
}
//不是:继续or停下
2023-01-24 15:47:16 +00:00
if (Function.Rnd.Next(walklength++) < LoopMid)
2023-01-21 14:16:13 +00:00
{
2023-05-19 16:43:22 +00:00
Display(GraphType.Fall_Right_B_Loop, DisplayFall_Righting);
2023-01-21 14:16:13 +00:00
}
else
{//停下来
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio);
MoveTimer.Enabled = false;
2023-01-21 14:16:13 +00:00
DisplayFalled_Right();
2023-05-19 08:17:51 +00:00
//DisplayToNomal();
2023-01-21 14:16:13 +00:00
}
}
2022-12-14 18:17:13 +00:00
2023-01-25 04:49:18 +00:00
/// <summary>
/// 显示动画
/// </summary>
/// <param name="Type">动画类型</param>
/// <param name="EndAction">动画结束后操作</param>
2023-05-19 08:17:51 +00:00
///// <param name="storernd">是否储存随机数字典</param>
public void Display(GraphType Type, Action EndAction = null)
2023-01-21 14:16:13 +00:00
{
2023-05-19 08:17:51 +00:00
Display(Core.Graph.FindGraph(Type, Core.Save.Mode), EndAction);
2023-01-21 14:16:13 +00:00
}
2022-12-13 07:10:18 +00:00
bool petgridcrlf = true;
/// <summary>
/// 显示动画 (自动多层切换)
/// </summary>
/// <param name="graph">动画</param>
/// <param name="EndAction">结束操作</param>
public void Display(IGraph graph, Action EndAction = null)
{
2023-02-20 08:47:44 +00:00
if (graph == null)
2023-01-29 08:27:24 +00:00
{
EndAction?.Invoke();
return;
}
2023-01-20 07:08:28 +00:00
//if(graph.GraphType == GraphType.Climb_Up_Left)
//{
// Dispatcher.Invoke(() => Say(graph.GraphType.ToString()));
//}
2023-01-19 15:26:58 +00:00
DisplayType = graph.GraphType;
2023-03-26 22:35:19 +00:00
var PetGridTag = Dispatcher.Invoke(() => PetGrid.Tag);
var PetGrid2Tag = Dispatcher.Invoke(() => PetGrid2.Tag);
if (PetGridTag == graph)
2022-12-13 07:10:18 +00:00
{
petgridcrlf = true;
2023-03-26 22:35:19 +00:00
((IGraph)(PetGrid2Tag)).Stop(true);
2023-01-19 15:26:58 +00:00
Dispatcher.Invoke(() =>
{
2023-01-20 07:08:28 +00:00
PetGrid.Visibility = Visibility.Visible;
2023-01-25 16:23:09 +00:00
PetGrid2.Visibility = Visibility.Hidden;
2023-01-21 14:16:13 +00:00
});
2023-03-26 22:35:19 +00:00
graph.Run(PetGrid, EndAction);//(x) => PetGrid.Child = x
2022-12-13 07:10:18 +00:00
return;
}
2023-03-26 22:35:19 +00:00
else if (PetGrid2Tag == graph)
2022-12-13 07:10:18 +00:00
{
petgridcrlf = false;
2023-03-26 22:35:19 +00:00
((IGraph)(PetGridTag)).Stop(true);
2023-01-19 15:26:58 +00:00
Dispatcher.Invoke(() =>
{
2023-01-20 07:08:28 +00:00
PetGrid2.Visibility = Visibility.Visible;
2023-01-25 16:23:09 +00:00
PetGrid.Visibility = Visibility.Hidden;
});
2023-03-26 22:35:19 +00:00
graph.Run(PetGrid2, EndAction);
2022-12-13 07:10:18 +00:00
return;
}
2023-03-26 22:35:19 +00:00
2022-12-13 07:10:18 +00:00
if (petgridcrlf)
{
2023-03-26 22:46:23 +00:00
graph.Run(PetGrid2, EndAction);
2023-03-26 22:35:19 +00:00
((IGraph)(PetGridTag)).Stop(true);
2023-01-19 15:26:58 +00:00
Dispatcher.Invoke(() =>
{
2023-01-25 16:23:09 +00:00
PetGrid.Visibility = Visibility.Hidden;
2023-01-20 07:08:28 +00:00
PetGrid2.Visibility = Visibility.Visible;
2023-03-26 22:35:19 +00:00
//PetGrid2.Tag = graph;
2023-05-10 03:13:34 +00:00
});
2022-12-13 07:10:18 +00:00
}
else
{
2023-03-26 22:46:23 +00:00
graph.Run(PetGrid, EndAction);
2023-03-26 22:35:19 +00:00
((IGraph)(PetGrid2Tag)).Stop(true);
2023-01-19 15:26:58 +00:00
Dispatcher.Invoke(() =>
{
2023-01-25 16:23:09 +00:00
PetGrid2.Visibility = Visibility.Hidden;
2023-01-20 07:08:28 +00:00
PetGrid.Visibility = Visibility.Visible;
2023-03-26 22:35:19 +00:00
//PetGrid.Tag = graph;
2023-05-10 03:13:34 +00:00
});
2022-12-13 07:10:18 +00:00
}
petgridcrlf = !petgridcrlf;
2023-03-26 22:46:23 +00:00
GC.Collect();
2022-12-13 07:10:18 +00:00
}
}
}